forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/gpu/drm/panel/panel-jdi-lt070me05000.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2016 InforceComputing
34 * Author: Vinay Simha BN <simhavcs@gmail.com>
....@@ -8,31 +9,21 @@
89 * From internet archives, the panel for Nexus 7 2nd Gen, 2013 model is a
910 * JDI model LT070ME05000, and its data sheet is at:
1011 * http://panelone.net/en/7-0-inch/JDI_LT070ME05000_7.0_inch-datasheet
11
- *
12
- * This program is free software; you can redistribute it and/or modify it
13
- * under the terms of the GNU General Public License version 2 as published by
14
- * the Free Software Foundation.
15
- *
16
- * This program is distributed in the hope that it will be useful, but WITHOUT
17
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19
- * more details.
20
- *
21
- * You should have received a copy of the GNU General Public License along with
22
- * this program. If not, see <http://www.gnu.org/licenses/>.
2312 */
13
+
2414 #include <linux/backlight.h>
15
+#include <linux/delay.h>
2516 #include <linux/gpio/consumer.h>
2617 #include <linux/module.h>
2718 #include <linux/of.h>
2819 #include <linux/regulator/consumer.h>
2920
30
-#include <drm/drmP.h>
21
+#include <video/mipi_display.h>
22
+
3123 #include <drm/drm_crtc.h>
3224 #include <drm/drm_mipi_dsi.h>
25
+#include <drm/drm_modes.h>
3326 #include <drm/drm_panel.h>
34
-
35
-#include <video/mipi_display.h>
3627
3728 static const char * const regulator_names[] = {
3829 "vddp",
....@@ -305,30 +296,30 @@
305296 .vsync_start = 1920 + 3,
306297 .vsync_end = 1920 + 3 + 5,
307298 .vtotal = 1920 + 3 + 5 + 6,
308
- .vrefresh = 60,
309299 .flags = 0,
310300 };
311301
312
-static int jdi_panel_get_modes(struct drm_panel *panel)
302
+static int jdi_panel_get_modes(struct drm_panel *panel,
303
+ struct drm_connector *connector)
313304 {
314305 struct drm_display_mode *mode;
315306 struct jdi_panel *jdi = to_jdi_panel(panel);
316307 struct device *dev = &jdi->dsi->dev;
317308
318
- mode = drm_mode_duplicate(panel->drm, &default_mode);
309
+ mode = drm_mode_duplicate(connector->dev, &default_mode);
319310 if (!mode) {
320311 dev_err(dev, "failed to add mode %ux%ux@%u\n",
321312 default_mode.hdisplay, default_mode.vdisplay,
322
- default_mode.vrefresh);
313
+ drm_mode_vrefresh(&default_mode));
323314 return -ENOMEM;
324315 }
325316
326317 drm_mode_set_name(mode);
327318
328
- drm_mode_probed_add(panel->connector, mode);
319
+ drm_mode_probed_add(connector, mode);
329320
330
- panel->connector->display_info.width_mm = 95;
331
- panel->connector->display_info.height_mm = 151;
321
+ connector->display_info.width_mm = 95;
322
+ connector->display_info.height_mm = 151;
332323
333324 return 1;
334325 }
....@@ -446,13 +437,12 @@
446437 return ret;
447438 }
448439
449
- drm_panel_init(&jdi->base);
450
- jdi->base.funcs = &jdi_panel_funcs;
451
- jdi->base.dev = &jdi->dsi->dev;
440
+ drm_panel_init(&jdi->base, &jdi->dsi->dev, &jdi_panel_funcs,
441
+ DRM_MODE_CONNECTOR_DSI);
452442
453
- ret = drm_panel_add(&jdi->base);
443
+ drm_panel_add(&jdi->base);
454444
455
- return ret;
445
+ return 0;
456446 }
457447
458448 static void jdi_panel_del(struct jdi_panel *jdi)