.. | .. |
---|
8 | 8 | #include <media/v4l2-fwnode.h> |
---|
9 | 9 | #include <media/v4l2-subdev.h> |
---|
10 | 10 | #include <media/v4l2-event.h> |
---|
| 11 | +#include <linux/rkcif-config.h> |
---|
11 | 12 | |
---|
12 | 13 | #define CSI2_ERR_FSFE_MASK (0xff << 8) |
---|
13 | 14 | #define CSI2_ERR_COUNT_ALL_MASK (0xff) |
---|
.. | .. |
---|
42 | 43 | #define CSIHOST_MAX_ERRINT_COUNT 10 |
---|
43 | 44 | |
---|
44 | 45 | #define DEVICE_NAME "rockchip-mipi-csi2" |
---|
| 46 | +#define DEVICE_NAME_HW "rockchip-mipi-csi2-hw" |
---|
45 | 47 | |
---|
46 | 48 | /* CSI Host Registers Define */ |
---|
47 | 49 | #define CSIHOST_N_LANES 0x04 |
---|
.. | .. |
---|
76 | 78 | #define SW_DATATYPE_LS(x) ((x) << 20) |
---|
77 | 79 | #define SW_DATATYPE_LE(x) ((x) << 26) |
---|
78 | 80 | |
---|
| 81 | +#define RK_MAX_CSI_HW (6) |
---|
| 82 | + |
---|
79 | 83 | /* |
---|
80 | 84 | * add new chip id in tail in time order |
---|
81 | 85 | * by increasing to distinguish csi2 host version |
---|
.. | .. |
---|
88 | 92 | CHIP_RV1126_CSI2, |
---|
89 | 93 | CHIP_RK3568_CSI2, |
---|
90 | 94 | CHIP_RK3588_CSI2, |
---|
| 95 | + CHIP_RV1106_CSI2, |
---|
91 | 96 | CHIP_RK3562_CSI2, |
---|
92 | 97 | }; |
---|
93 | 98 | |
---|
.. | .. |
---|
117 | 122 | struct csi2_match_data { |
---|
118 | 123 | int chip_id; |
---|
119 | 124 | int num_pads; |
---|
| 125 | + int num_hw; |
---|
| 126 | +}; |
---|
| 127 | + |
---|
| 128 | +struct csi2_hw_match_data { |
---|
| 129 | + int chip_id; |
---|
120 | 130 | }; |
---|
121 | 131 | |
---|
122 | 132 | struct csi2_sensor_info { |
---|
.. | .. |
---|
155 | 165 | int num_sensors; |
---|
156 | 166 | atomic_t frm_sync_seq; |
---|
157 | 167 | struct csi2_err_stats err_list[RK_CSI2_ERR_MAX]; |
---|
| 168 | + struct csi2_hw *csi2_hw[RK_MAX_CSI_HW]; |
---|
158 | 169 | int irq1; |
---|
159 | 170 | int irq2; |
---|
160 | 171 | int dsi_input_en; |
---|
161 | | - u32 csi_idx; |
---|
| 172 | + struct rkcif_csi_info csi_info; |
---|
| 173 | + const char *dev_name; |
---|
| 174 | +}; |
---|
| 175 | + |
---|
| 176 | +struct csi2_hw { |
---|
| 177 | + struct device *dev; |
---|
| 178 | + struct clk_bulk_data *clks_bulk; |
---|
| 179 | + int clks_num; |
---|
| 180 | + struct reset_control *rsts_bulk; |
---|
| 181 | + struct csi2_dev *csi2; |
---|
| 182 | + const struct csi2_hw_match_data *match_data; |
---|
| 183 | + |
---|
| 184 | + void __iomem *base; |
---|
| 185 | + |
---|
| 186 | + /* lock to protect all members below */ |
---|
| 187 | + struct mutex lock; |
---|
| 188 | + |
---|
| 189 | + int irq1; |
---|
| 190 | + int irq2; |
---|
162 | 191 | const char *dev_name; |
---|
163 | 192 | }; |
---|
164 | 193 | |
---|
.. | .. |
---|
166 | 195 | void rkcif_csi2_set_sof(struct csi2_dev *csi2_dev, u32 seq); |
---|
167 | 196 | void rkcif_csi2_event_inc_sof(struct csi2_dev *csi2_dev); |
---|
168 | 197 | int rkcif_csi2_plat_drv_init(void); |
---|
169 | | -void __exit rkcif_csi2_plat_drv_exit(void); |
---|
| 198 | +void rkcif_csi2_plat_drv_exit(void); |
---|
| 199 | +int rkcif_csi2_hw_plat_drv_init(void); |
---|
| 200 | +void rkcif_csi2_hw_plat_drv_exit(void); |
---|
170 | 201 | int rkcif_csi2_register_notifier(struct notifier_block *nb); |
---|
171 | 202 | int rkcif_csi2_unregister_notifier(struct notifier_block *nb); |
---|
172 | 203 | void rkcif_csi2_event_reset_pipe(struct csi2_dev *csi2_dev, int reset_src); |
---|