hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/media/platform/rockchip/cif/mipi-csi2.h
....@@ -8,6 +8,7 @@
88 #include <media/v4l2-fwnode.h>
99 #include <media/v4l2-subdev.h>
1010 #include <media/v4l2-event.h>
11
+#include <linux/rkcif-config.h>
1112
1213 #define CSI2_ERR_FSFE_MASK (0xff << 8)
1314 #define CSI2_ERR_COUNT_ALL_MASK (0xff)
....@@ -42,6 +43,7 @@
4243 #define CSIHOST_MAX_ERRINT_COUNT 10
4344
4445 #define DEVICE_NAME "rockchip-mipi-csi2"
46
+#define DEVICE_NAME_HW "rockchip-mipi-csi2-hw"
4547
4648 /* CSI Host Registers Define */
4749 #define CSIHOST_N_LANES 0x04
....@@ -76,6 +78,8 @@
7678 #define SW_DATATYPE_LS(x) ((x) << 20)
7779 #define SW_DATATYPE_LE(x) ((x) << 26)
7880
81
+#define RK_MAX_CSI_HW (6)
82
+
7983 /*
8084 * add new chip id in tail in time order
8185 * by increasing to distinguish csi2 host version
....@@ -88,6 +92,7 @@
8892 CHIP_RV1126_CSI2,
8993 CHIP_RK3568_CSI2,
9094 CHIP_RK3588_CSI2,
95
+ CHIP_RV1106_CSI2,
9196 CHIP_RK3562_CSI2,
9297 };
9398
....@@ -117,6 +122,11 @@
117122 struct csi2_match_data {
118123 int chip_id;
119124 int num_pads;
125
+ int num_hw;
126
+};
127
+
128
+struct csi2_hw_match_data {
129
+ int chip_id;
120130 };
121131
122132 struct csi2_sensor_info {
....@@ -155,10 +165,29 @@
155165 int num_sensors;
156166 atomic_t frm_sync_seq;
157167 struct csi2_err_stats err_list[RK_CSI2_ERR_MAX];
168
+ struct csi2_hw *csi2_hw[RK_MAX_CSI_HW];
158169 int irq1;
159170 int irq2;
160171 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;
162191 const char *dev_name;
163192 };
164193
....@@ -166,7 +195,9 @@
166195 void rkcif_csi2_set_sof(struct csi2_dev *csi2_dev, u32 seq);
167196 void rkcif_csi2_event_inc_sof(struct csi2_dev *csi2_dev);
168197 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);
170201 int rkcif_csi2_register_notifier(struct notifier_block *nb);
171202 int rkcif_csi2_unregister_notifier(struct notifier_block *nb);
172203 void rkcif_csi2_event_reset_pipe(struct csi2_dev *csi2_dev, int reset_src);