hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/mfd/display-serdes/core.h
....@@ -46,6 +46,7 @@
4646 #include <drm/drm_of.h>
4747 #include <drm/drm_connector.h>
4848 #include <drm/drm_probe_helper.h>
49
+#include <drm/drm_dp_helper.h>
4950 #include <drm/drm_device.h>
5051 #include <drm/drm_modes.h>
5152 #include <drm/drm_atomic_state_helper.h>
....@@ -69,6 +70,8 @@
6970 #include "../../../../drivers/pinctrl/pinconf.h"
7071 #include "../../../../drivers/pinctrl/pinmux.h"
7172 #include "../../../../drivers/gpio/gpiolib.h"
73
+#include "../../../../drivers/extcon/extcon.h"
74
+#include "../../../../drivers/base/regmap/internal.h"
7275
7376 /*
7477 * if enable all the debug information,
....@@ -99,8 +102,15 @@
99102 #endif
100103
101104 #define MFD_SERDES_DISPLAY_VERSION "serdes-mfd-displaly-v10-230901"
102
-
105
+#define MAX_NUM_SERDES_SPLIT 8
103106 struct serdes;
107
+enum ser_link_mode {
108
+ SER_DUAL_LINK,
109
+ SER_LINKA,
110
+ SER_LINKB,
111
+ SER_SPLITTER_MODE,
112
+};
113
+
104114 struct serdes_chip_pinctrl_info {
105115 struct pinctrl_pin_desc *pins;
106116 unsigned int num_pins;
....@@ -160,6 +170,12 @@
160170 int (*to_irq)(struct serdes *serdes, int gpio);
161171 };
162172
173
+struct serdes_chip_split_ops {
174
+ int (*select)(struct serdes *serdes, int chan);
175
+ int (*deselect)(struct serdes *serdes, int chan);
176
+ int (*set_i2c_addr)(struct serdes *serdes, int address, int link);
177
+};
178
+
163179 struct serdes_chip_pm_ops {
164180 /* serdes chip function for suspend and resume */
165181 int (*suspend)(struct serdes *serdes);
....@@ -188,12 +204,14 @@
188204 int same_chip_count;
189205 u8 bank_num;
190206
207
+ int (*chip_init)(struct serdes *serdes);
191208 struct regmap_config *regmap_config;
192209 struct serdes_chip_pinctrl_info *pinctrl_info;
193210 struct serdes_chip_bridge_ops *bridge_ops;
194211 struct serdes_chip_panel_ops *panel_ops;
195212 struct serdes_chip_pinctrl_ops *pinctrl_ops;
196213 struct serdes_chip_gpio_ops *gpio_ops;
214
+ struct serdes_chip_split_ops *split_ops;
197215 struct serdes_chip_pm_ops *pm_ops;
198216 struct serdes_chip_irq_ops *irq_ops;
199217 };
....@@ -237,7 +255,35 @@
237255 struct serdes *parent;
238256 struct regmap *regmap;
239257 struct mipi_dsi_device *dsi;
240
- struct device_node *dsi_node;
258
+ struct device_node *remote_node;
259
+ struct drm_display_mode mode;
260
+ struct backlight_device *backlight;
261
+ struct serdes_init_seq *serdes_init_seq;
262
+ bool sel_mipi;
263
+ bool dv_swp_ab;
264
+ bool dpi_deskew_en;
265
+ bool split_mode;
266
+ u32 num_lanes;
267
+ u32 dsi_lane_map[4];
268
+};
269
+
270
+struct serdes_panel_split {
271
+ struct drm_panel panel;
272
+ enum drm_connector_status status;
273
+ struct drm_connector connector;
274
+
275
+ const char *name;
276
+ u32 width_mm;
277
+ u32 height_mm;
278
+ u32 link_rate;
279
+ u32 lane_count;
280
+ bool ssc;
281
+
282
+ struct device *dev;
283
+ struct serdes *parent;
284
+ struct regmap *regmap;
285
+ struct mipi_dsi_device *dsi;
286
+ struct device_node *remote_node;
241287 struct drm_display_mode mode;
242288 struct backlight_device *backlight;
243289 struct serdes_init_seq *serdes_init_seq;
....@@ -261,7 +307,7 @@
261307 struct serdes *parent;
262308 struct regmap *regmap;
263309 struct mipi_dsi_device *dsi;
264
- struct device_node *dsi_node;
310
+ struct device_node *remote_node;
265311 struct drm_display_mode mode;
266312 struct backlight_device *backlight;
267313
....@@ -269,6 +315,29 @@
269315 bool dv_swp_ab;
270316 bool dpi_deskew_en;
271317 bool split_mode;
318
+ u32 num_lanes;
319
+ u32 dsi_lane_map[4];
320
+};
321
+
322
+struct serdes_bridge_split {
323
+ struct drm_bridge base_bridge;
324
+ struct drm_bridge *next_bridge;
325
+ enum drm_connector_status status;
326
+ atomic_t triggered;
327
+ struct drm_connector connector;
328
+ struct drm_panel *panel;
329
+
330
+ struct device *dev;
331
+ struct serdes *parent;
332
+ struct regmap *regmap;
333
+ struct mipi_dsi_device *dsi;
334
+ struct device_node *remote_node;
335
+ struct drm_display_mode mode;
336
+ struct backlight_device *backlight;
337
+
338
+ bool sel_mipi;
339
+ bool dv_swp_ab;
340
+ bool dpi_deskew_en;
272341 u32 num_lanes;
273342 u32 dsi_lane_map[4];
274343 };
....@@ -303,13 +372,25 @@
303372 struct delayed_work mfd_delay_work;
304373 bool route_enable;
305374 bool use_delay_work;
375
+
376
+ bool split_mode_enable;
377
+ unsigned int reg_hw;
378
+ unsigned int reg_use;
379
+ unsigned int link_use;
380
+ unsigned int id_serdes_bridge_split;
381
+ unsigned int id_serdes_panel_split;
382
+ struct serdes *g_serdes_bridge_split;
383
+
306384 struct pinctrl *pinctrl_node;
307385 struct pinctrl_state *pins_default;
386
+ struct pinctrl_state *pins_init;
308387 struct pinctrl_state *pins_sleep;
309388
310389 struct serdes_init_seq *serdes_init_seq;
311390 struct serdes_bridge *serdes_bridge;
391
+ struct serdes_bridge_split *serdes_bridge_split;
312392 struct serdes_panel *serdes_panel;
393
+ struct serdes_panel_split *serdes_panel_split;
313394 struct serdes_pinctrl *pinctrl;
314395 struct serdes_chip_data *chip_data;
315396 };
....@@ -334,7 +415,8 @@
334415 int serdes_set_pinctrl_sleep(struct serdes *serdes);
335416 int serdes_device_suspend(struct serdes *serdes);
336417 int serdes_device_resume(struct serdes *serdes);
337
-void serdes_device_shutdown(struct serdes *serdes);
418
+void serdes_device_poweroff(struct serdes *serdes);
419
+int serdes_device_shutdown(struct serdes *serdes);
338420 int serdes_irq_init(struct serdes *serdes);
339421 void serdes_irq_exit(struct serdes *serdes);
340422 void serdes_auxadc_init(struct serdes *serdes);