forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/gpu/drm/sti/sti_hda.c
....@@ -6,13 +6,18 @@
66
77 #include <linux/clk.h>
88 #include <linux/component.h>
9
+#include <linux/io.h>
910 #include <linux/module.h>
1011 #include <linux/platform_device.h>
1112 #include <linux/seq_file.h>
1213
13
-#include <drm/drmP.h>
1414 #include <drm/drm_atomic_helper.h>
15
-#include <drm/drm_crtc_helper.h>
15
+#include <drm/drm_bridge.h>
16
+#include <drm/drm_debugfs.h>
17
+#include <drm/drm_device.h>
18
+#include <drm/drm_file.h>
19
+#include <drm/drm_print.h>
20
+#include <drm/drm_probe_helper.h>
1621
1722 /* HDformatter registers */
1823 #define HDA_ANA_CFG 0x0000
....@@ -226,7 +231,7 @@
226231 AWGi_720x480p_60, NN_720x480p_60, VID_ED}
227232 };
228233
229
-/**
234
+/*
230235 * STI hd analog structure
231236 *
232237 * @dev: driver device
....@@ -362,16 +367,16 @@
362367 { "hda", hda_dbg_show, 0, NULL },
363368 };
364369
365
-static int hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
370
+static void hda_debugfs_init(struct sti_hda *hda, struct drm_minor *minor)
366371 {
367372 unsigned int i;
368373
369374 for (i = 0; i < ARRAY_SIZE(hda_debugfs_files); i++)
370375 hda_debugfs_files[i].data = hda;
371376
372
- return drm_debugfs_create_files(hda_debugfs_files,
373
- ARRAY_SIZE(hda_debugfs_files),
374
- minor->debugfs_root, minor);
377
+ drm_debugfs_create_files(hda_debugfs_files,
378
+ ARRAY_SIZE(hda_debugfs_files),
379
+ minor->debugfs_root, minor);
375380 }
376381
377382 /**
....@@ -508,8 +513,8 @@
508513 }
509514
510515 static void sti_hda_set_mode(struct drm_bridge *bridge,
511
- struct drm_display_mode *mode,
512
- struct drm_display_mode *adjusted_mode)
516
+ const struct drm_display_mode *mode,
517
+ const struct drm_display_mode *adjusted_mode)
513518 {
514519 struct sti_hda *hda = bridge->driver_private;
515520 u32 mode_idx;
....@@ -518,7 +523,7 @@
518523
519524 DRM_DEBUG_DRIVER("\n");
520525
521
- memcpy(&hda->mode, mode, sizeof(struct drm_display_mode));
526
+ drm_mode_copy(&hda->mode, mode);
522527
523528 if (!hda_get_mode_idx(hda->mode, &mode_idx)) {
524529 DRM_ERROR("Undefined mode\n");
....@@ -581,7 +586,6 @@
581586 &hda_supported_modes[i].mode);
582587 if (!mode)
583588 continue;
584
- mode->vrefresh = drm_mode_vrefresh(mode);
585589
586590 /* the first mode is the preferred mode */
587591 if (i == 0)
....@@ -596,8 +600,9 @@
596600
597601 #define CLK_TOLERANCE_HZ 50
598602
599
-static int sti_hda_connector_mode_valid(struct drm_connector *connector,
600
- struct drm_display_mode *mode)
603
+static enum drm_mode_status
604
+sti_hda_connector_mode_valid(struct drm_connector *connector,
605
+ struct drm_display_mode *mode)
601606 {
602607 int target = mode->clock * 1000;
603608 int target_min = target - CLK_TOLERANCE_HZ;
....@@ -638,10 +643,7 @@
638643 = to_sti_hda_connector(connector);
639644 struct sti_hda *hda = hda_connector->hda;
640645
641
- if (hda_debugfs_init(hda, hda->drm_dev->primary)) {
642
- DRM_ERROR("HDA debugfs setup failed\n");
643
- return -EINVAL;
644
- }
646
+ hda_debugfs_init(hda, hda->drm_dev->primary);
645647
646648 return 0;
647649 }
....@@ -696,7 +698,7 @@
696698
697699 bridge->driver_private = hda;
698700 bridge->funcs = &sti_hda_bridge_funcs;
699
- drm_bridge_attach(encoder, bridge, NULL);
701
+ drm_bridge_attach(encoder, bridge, NULL, 0);
700702
701703 connector->encoder = encoder;
702704
....@@ -754,14 +756,14 @@
754756 DRM_ERROR("Invalid hda resource\n");
755757 return -ENOMEM;
756758 }
757
- hda->regs = devm_ioremap_nocache(dev, res->start, resource_size(res));
759
+ hda->regs = devm_ioremap(dev, res->start, resource_size(res));
758760 if (!hda->regs)
759761 return -ENOMEM;
760762
761763 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
762764 "video-dacs-ctrl");
763765 if (res) {
764
- hda->video_dacs_ctrl = devm_ioremap_nocache(dev, res->start,
766
+ hda->video_dacs_ctrl = devm_ioremap(dev, res->start,
765767 resource_size(res));
766768 if (!hda->video_dacs_ctrl)
767769 return -ENOMEM;