forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-09 95099d4622f8cb224d94e314c7a8e0df60b13f87
kernel/drivers/gpu/drm/sti/sti_dvo.c
....@@ -11,10 +11,12 @@
1111 #include <linux/of_gpio.h>
1212 #include <linux/platform_device.h>
1313
14
-#include <drm/drmP.h>
1514 #include <drm/drm_atomic_helper.h>
16
-#include <drm/drm_crtc_helper.h>
15
+#include <drm/drm_bridge.h>
16
+#include <drm/drm_device.h>
1717 #include <drm/drm_panel.h>
18
+#include <drm/drm_print.h>
19
+#include <drm/drm_probe_helper.h>
1820
1921 #include "sti_awg_utils.h"
2022 #include "sti_drv.h"
....@@ -64,7 +66,7 @@
6466 .awg_fwgen_fct = sti_awg_generate_code_data_enable_mode,
6567 };
6668
67
-/**
69
+/*
6870 * STI digital video output structure
6971 *
7072 * @dev: driver device
....@@ -194,16 +196,16 @@
194196 { "dvo", dvo_dbg_show, 0, NULL },
195197 };
196198
197
-static int dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
199
+static void dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor)
198200 {
199201 unsigned int i;
200202
201203 for (i = 0; i < ARRAY_SIZE(dvo_debugfs_files); i++)
202204 dvo_debugfs_files[i].data = dvo;
203205
204
- return drm_debugfs_create_files(dvo_debugfs_files,
205
- ARRAY_SIZE(dvo_debugfs_files),
206
- minor->debugfs_root, minor);
206
+ drm_debugfs_create_files(dvo_debugfs_files,
207
+ ARRAY_SIZE(dvo_debugfs_files),
208
+ minor->debugfs_root, minor);
207209 }
208210
209211 static void sti_dvo_disable(struct drm_bridge *bridge)
....@@ -220,8 +222,7 @@
220222
221223 writel(0x00000000, dvo->regs + DVO_DOF_CFG);
222224
223
- if (dvo->panel)
224
- dvo->panel->funcs->disable(dvo->panel);
225
+ drm_panel_disable(dvo->panel);
225226
226227 /* Disable/unprepare dvo clock */
227228 clk_disable_unprepare(dvo->clk_pix);
....@@ -261,8 +262,7 @@
261262 if (clk_prepare_enable(dvo->clk))
262263 DRM_ERROR("Failed to prepare/enable dvo clk\n");
263264
264
- if (dvo->panel)
265
- dvo->panel->funcs->enable(dvo->panel);
265
+ drm_panel_enable(dvo->panel);
266266
267267 /* Set LUT */
268268 writel(config->lowbyte, dvo->regs + DVO_LUT_PROG_LOW);
....@@ -277,8 +277,8 @@
277277 }
278278
279279 static void sti_dvo_set_mode(struct drm_bridge *bridge,
280
- struct drm_display_mode *mode,
281
- struct drm_display_mode *adjusted_mode)
280
+ const struct drm_display_mode *mode,
281
+ const struct drm_display_mode *adjusted_mode)
282282 {
283283 struct sti_dvo *dvo = bridge->driver_private;
284284 struct sti_mixer *mixer = to_sti_mixer(dvo->encoder->crtc);
....@@ -339,7 +339,7 @@
339339 struct sti_dvo *dvo = dvo_connector->dvo;
340340
341341 if (dvo->panel)
342
- return dvo->panel->funcs->get_modes(dvo->panel);
342
+ return drm_panel_get_modes(dvo->panel, connector);
343343
344344 return 0;
345345 }
....@@ -389,8 +389,6 @@
389389 dvo->panel = of_drm_find_panel(dvo->panel_node);
390390 if (IS_ERR(dvo->panel))
391391 dvo->panel = NULL;
392
- else
393
- drm_panel_attach(dvo->panel, connector);
394392 }
395393
396394 if (dvo->panel)
....@@ -405,10 +403,7 @@
405403 = to_sti_dvo_connector(connector);
406404 struct sti_dvo *dvo = dvo_connector->dvo;
407405
408
- if (dvo_debugfs_init(dvo, dvo->drm_dev->primary)) {
409
- DRM_ERROR("DVO debugfs setup failed\n");
410
- return -EINVAL;
411
- }
406
+ dvo_debugfs_init(dvo, dvo->drm_dev->primary);
412407
413408 return 0;
414409 }
....@@ -467,7 +462,7 @@
467462 bridge->of_node = dvo->dev.of_node;
468463 drm_bridge_add(bridge);
469464
470
- err = drm_bridge_attach(encoder, bridge, NULL);
465
+ err = drm_bridge_attach(encoder, bridge, NULL, 0);
471466 if (err) {
472467 DRM_ERROR("Failed to attach bridge\n");
473468 return err;
....@@ -534,7 +529,7 @@
534529 DRM_ERROR("Invalid dvo resource\n");
535530 return -ENOMEM;
536531 }
537
- dvo->regs = devm_ioremap_nocache(dev, res->start,
532
+ dvo->regs = devm_ioremap(dev, res->start,
538533 resource_size(res));
539534 if (!dvo->regs)
540535 return -ENOMEM;