forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/panel/panel-samsung-s6e3ha2.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * MIPI-DSI based s6e3ha2 AMOLED 5.7 inch panel driver.
34 *
....@@ -5,19 +6,18 @@
56 * Donghwa Lee <dh09.lee@samsung.com>
67 * Hyungwon Hwang <human.hwang@samsung.com>
78 * Hoegeun Kwon <hoegeun.kwon@samsung.com>
8
- *
9
- * This program is free software; you can redistribute it and/or modify
10
- * it under the terms of the GNU General Public License version 2 as
11
- * published by the Free Software Foundation.
129 */
1310
14
-#include <drm/drmP.h>
15
-#include <drm/drm_mipi_dsi.h>
16
-#include <drm/drm_panel.h>
1711 #include <linux/backlight.h>
12
+#include <linux/delay.h>
1813 #include <linux/gpio/consumer.h>
14
+#include <linux/module.h>
1915 #include <linux/of_device.h>
2016 #include <linux/regulator/consumer.h>
17
+
18
+#include <drm/drm_mipi_dsi.h>
19
+#include <drm/drm_modes.h>
20
+#include <drm/drm_panel.h>
2121
2222 #define S6E3HA2_MIN_BRIGHTNESS 0
2323 #define S6E3HA2_MAX_BRIGHTNESS 100
....@@ -616,7 +616,6 @@
616616 .vsync_start = 2560 + 1,
617617 .vsync_end = 2560 + 1 + 1,
618618 .vtotal = 2560 + 1 + 1 + 15,
619
- .vrefresh = 60,
620619 .flags = 0,
621620 };
622621
....@@ -635,7 +634,6 @@
635634 .vsync_start = 2560 + 1,
636635 .vsync_end = 2560 + 1 + 1,
637636 .vtotal = 2560 + 1 + 1 + 15,
638
- .vrefresh = 60,
639637 .flags = 0,
640638 };
641639
....@@ -644,17 +642,17 @@
644642 .type = HF2_TYPE,
645643 };
646644
647
-static int s6e3ha2_get_modes(struct drm_panel *panel)
645
+static int s6e3ha2_get_modes(struct drm_panel *panel,
646
+ struct drm_connector *connector)
648647 {
649
- struct drm_connector *connector = panel->connector;
650648 struct s6e3ha2 *ctx = container_of(panel, struct s6e3ha2, panel);
651649 struct drm_display_mode *mode;
652650
653
- mode = drm_mode_duplicate(panel->drm, ctx->desc->mode);
651
+ mode = drm_mode_duplicate(connector->dev, ctx->desc->mode);
654652 if (!mode) {
655
- DRM_ERROR("failed to add mode %ux%ux@%u\n",
653
+ dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
656654 ctx->desc->mode->hdisplay, ctx->desc->mode->vdisplay,
657
- ctx->desc->mode->vrefresh);
655
+ drm_mode_vrefresh(ctx->desc->mode));
658656 return -ENOMEM;
659657 }
660658
....@@ -731,13 +729,10 @@
731729 ctx->bl_dev->props.brightness = S6E3HA2_DEFAULT_BRIGHTNESS;
732730 ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
733731
734
- drm_panel_init(&ctx->panel);
735
- ctx->panel.dev = dev;
736
- ctx->panel.funcs = &s6e3ha2_drm_funcs;
732
+ drm_panel_init(&ctx->panel, dev, &s6e3ha2_drm_funcs,
733
+ DRM_MODE_CONNECTOR_DSI);
737734
738
- ret = drm_panel_add(&ctx->panel);
739
- if (ret < 0)
740
- goto unregister_backlight;
735
+ drm_panel_add(&ctx->panel);
741736
742737 ret = mipi_dsi_attach(dsi);
743738 if (ret < 0)
....@@ -747,8 +742,6 @@
747742
748743 remove_panel:
749744 drm_panel_remove(&ctx->panel);
750
-
751
-unregister_backlight:
752745 backlight_device_unregister(ctx->bl_dev);
753746
754747 return ret;