forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/panel/panel-samsung-s6e63j0x03.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * MIPI-DSI based S6E63J0X03 AMOLED lcd 1.63 inch panel driver.
34 *
....@@ -5,19 +6,19 @@
56 *
67 * Inki Dae <inki.dae@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/regulator/consumer.h>
16
+
2017 #include <video/mipi_display.h>
18
+
19
+#include <drm/drm_mipi_dsi.h>
20
+#include <drm/drm_modes.h>
21
+#include <drm/drm_panel.h>
2122
2223 #define MCS_LEVEL2_KEY 0xf0
2324 #define MCS_MTP_KEY 0xf1
....@@ -50,7 +51,6 @@
5051 .vsync_start = 320 + 150,
5152 .vsync_end = 320 + 150 + 1,
5253 .vtotal = 320 + 150 + 1 + 2,
53
- .vrefresh = 30,
5454 .flags = 0,
5555 };
5656
....@@ -398,16 +398,16 @@
398398 return 0;
399399 }
400400
401
-static int s6e63j0x03_get_modes(struct drm_panel *panel)
401
+static int s6e63j0x03_get_modes(struct drm_panel *panel,
402
+ struct drm_connector *connector)
402403 {
403
- struct drm_connector *connector = panel->connector;
404404 struct drm_display_mode *mode;
405405
406
- mode = drm_mode_duplicate(panel->drm, &default_mode);
406
+ mode = drm_mode_duplicate(connector->dev, &default_mode);
407407 if (!mode) {
408
- DRM_ERROR("failed to add mode %ux%ux@%u\n",
408
+ dev_err(panel->dev, "failed to add mode %ux%u@%u\n",
409409 default_mode.hdisplay, default_mode.vdisplay,
410
- default_mode.vrefresh);
410
+ drm_mode_vrefresh(&default_mode));
411411 return -ENOMEM;
412412 }
413413
....@@ -464,9 +464,8 @@
464464 return PTR_ERR(ctx->reset_gpio);
465465 }
466466
467
- drm_panel_init(&ctx->panel);
468
- ctx->panel.dev = dev;
469
- ctx->panel.funcs = &s6e63j0x03_funcs;
467
+ drm_panel_init(&ctx->panel, dev, &s6e63j0x03_funcs,
468
+ DRM_MODE_CONNECTOR_DSI);
470469
471470 ctx->bl_dev = backlight_device_register("s6e63j0x03", dev, ctx,
472471 &s6e63j0x03_bl_ops, NULL);
....@@ -479,9 +478,7 @@
479478 ctx->bl_dev->props.brightness = DEFAULT_BRIGHTNESS;
480479 ctx->bl_dev->props.power = FB_BLANK_POWERDOWN;
481480
482
- ret = drm_panel_add(&ctx->panel);
483
- if (ret < 0)
484
- goto unregister_backlight;
481
+ drm_panel_add(&ctx->panel);
485482
486483 ret = mipi_dsi_attach(dsi);
487484 if (ret < 0)
....@@ -491,8 +488,6 @@
491488
492489 remove_panel:
493490 drm_panel_remove(&ctx->panel);
494
-
495
-unregister_backlight:
496491 backlight_device_unregister(ctx->bl_dev);
497492
498493 return ret;