forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/gpu/drm/panel/panel-lg-lg4573.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2015 Heiko Schocher <hs@denx.de>
34 *
....@@ -9,22 +10,21 @@
910 * Derived from drivers/video/backlight/ld9040.c
1011 *
1112 * Andrzej Hajda <a.hajda@samsung.com>
12
- *
13
- * This program is free software; you can redistribute it and/or modify
14
- * it under the terms of the GNU General Public License version 2 as
15
- * published by the Free Software Foundation.
1613 */
1714
18
-#include <drm/drmP.h>
19
-#include <drm/drm_panel.h>
20
-
15
+#include <linux/delay.h>
2116 #include <linux/gpio/consumer.h>
17
+#include <linux/module.h>
2218 #include <linux/regulator/consumer.h>
2319 #include <linux/spi/spi.h>
2420
2521 #include <video/mipi_display.h>
2622 #include <video/of_videomode.h>
2723 #include <video/videomode.h>
24
+
25
+#include <drm/drm_device.h>
26
+#include <drm/drm_modes.h>
27
+#include <drm/drm_panel.h>
2828
2929 struct lg4573 {
3030 struct drm_panel panel;
....@@ -42,7 +42,7 @@
4242 struct spi_transfer xfer = {
4343 .len = 2,
4444 };
45
- u16 temp = cpu_to_be16(data);
45
+ __be16 temp = cpu_to_be16(data);
4646 struct spi_message msg;
4747
4848 dev_dbg(ctx->panel.dev, "writing data: %x\n", data);
....@@ -197,7 +197,7 @@
197197 }
198198
199199 static const struct drm_display_mode default_mode = {
200
- .clock = 27000,
200
+ .clock = 28341,
201201 .hdisplay = 480,
202202 .hsync_start = 480 + 10,
203203 .hsync_end = 480 + 10 + 59,
....@@ -206,19 +206,18 @@
206206 .vsync_start = 800 + 15,
207207 .vsync_end = 800 + 15 + 15,
208208 .vtotal = 800 + 15 + 15 + 15,
209
- .vrefresh = 60,
210209 };
211210
212
-static int lg4573_get_modes(struct drm_panel *panel)
211
+static int lg4573_get_modes(struct drm_panel *panel,
212
+ struct drm_connector *connector)
213213 {
214
- struct drm_connector *connector = panel->connector;
215214 struct drm_display_mode *mode;
216215
217
- mode = drm_mode_duplicate(panel->drm, &default_mode);
216
+ mode = drm_mode_duplicate(connector->dev, &default_mode);
218217 if (!mode) {
219
- dev_err(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
218
+ dev_err(panel->dev, "failed to add mode %ux%ux@%u\n",
220219 default_mode.hdisplay, default_mode.vdisplay,
221
- default_mode.vrefresh);
220
+ drm_mode_vrefresh(&default_mode));
222221 return -ENOMEM;
223222 }
224223
....@@ -227,8 +226,8 @@
227226 mode->type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
228227 drm_mode_probed_add(connector, mode);
229228
230
- panel->connector->display_info.width_mm = 61;
231
- panel->connector->display_info.height_mm = 103;
229
+ connector->display_info.width_mm = 61;
230
+ connector->display_info.height_mm = 103;
232231
233232 return 1;
234233 }
....@@ -259,11 +258,12 @@
259258 return ret;
260259 }
261260
262
- drm_panel_init(&ctx->panel);
263
- ctx->panel.dev = &spi->dev;
264
- ctx->panel.funcs = &lg4573_drm_funcs;
261
+ drm_panel_init(&ctx->panel, &spi->dev, &lg4573_drm_funcs,
262
+ DRM_MODE_CONNECTOR_DPI);
265263
266
- return drm_panel_add(&ctx->panel);
264
+ drm_panel_add(&ctx->panel);
265
+
266
+ return 0;
267267 }
268268
269269 static int lg4573_remove(struct spi_device *spi)