1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * vsp1.h -- R-Car VSP1 Driver
5 * Copyright (C) 2013-2014 Renesas Electronics Corporation
7 * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com)
13 #include <linux/list.h>
14 #include <linux/mutex.h>
16 #include <media/media-device.h>
17 #include <media/v4l2-device.h>
18 #include <media/v4l2-subdev.h>
20 #include "vsp1_regs.h"
24 struct rcar_fcp_device;
28 struct vsp1_platform_data;
41 #define VSP1_MAX_LIF 2
42 #define VSP1_MAX_RPF 5
43 #define VSP1_MAX_UDS 3
44 #define VSP1_MAX_UIF 2
45 #define VSP1_MAX_WPF 4
47 #define VSP1_HAS_LUT BIT(1)
48 #define VSP1_HAS_SRU BIT(2)
49 #define VSP1_HAS_BRU BIT(3)
50 #define VSP1_HAS_CLU BIT(4)
51 #define VSP1_HAS_WPF_VFLIP BIT(5)
52 #define VSP1_HAS_WPF_HFLIP BIT(6)
53 #define VSP1_HAS_HGO BIT(7)
54 #define VSP1_HAS_HGT BIT(8)
55 #define VSP1_HAS_BRS BIT(9)
56 #define VSP1_HAS_EXT_DL BIT(10)
58 struct vsp1_device_info {
62 unsigned int features;
63 unsigned int lif_count;
64 unsigned int rpf_count;
65 unsigned int uds_count;
66 unsigned int uif_count;
67 unsigned int wpf_count;
68 unsigned int num_bru_inputs;
72 #define vsp1_feature(vsp1, f) ((vsp1)->info->features & (f))
76 const struct vsp1_device_info *info;
80 struct rcar_fcp_device *fcp;
81 struct device *bus_master;
88 struct vsp1_hsit *hsi;
89 struct vsp1_hsit *hst;
90 struct vsp1_lif *lif[VSP1_MAX_LIF];
92 struct vsp1_rwpf *rpf[VSP1_MAX_RPF];
94 struct vsp1_uds *uds[VSP1_MAX_UDS];
95 struct vsp1_uif *uif[VSP1_MAX_UIF];
96 struct vsp1_rwpf *wpf[VSP1_MAX_WPF];
98 struct list_head entities;
99 struct list_head videos;
101 struct v4l2_device v4l2_dev;
102 struct media_device media_dev;
103 struct media_entity_operations media_ops;
105 struct vsp1_drm *drm;
108 int vsp1_device_get(struct vsp1_device *vsp1);
109 void vsp1_device_put(struct vsp1_device *vsp1);
111 int vsp1_reset_wpf(struct vsp1_device *vsp1, unsigned int index);
113 static inline u32 vsp1_read(struct vsp1_device *vsp1, u32 reg)
115 return ioread32(vsp1->mmio + reg);
118 static inline void vsp1_write(struct vsp1_device *vsp1, u32 reg, u32 data)
120 iowrite32(data, vsp1->mmio + reg);
123 #endif /* __VSP1_H__ */