2 * Copyright (C) 2013, NVIDIA Corporation. All rights reserved.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sub license,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the
12 * next paragraph) shall be included in all copies or substantial portions
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
24 #include <linux/backlight.h>
25 #include <linux/gpio/consumer.h>
26 #include <linux/module.h>
27 #include <linux/of_platform.h>
28 #include <linux/platform_device.h>
29 #include <linux/regulator/consumer.h>
32 #include <drm/drm_crtc.h>
33 #include <drm/drm_mipi_dsi.h>
34 #include <drm/drm_panel.h>
36 #include <video/display_timing.h>
37 #include <video/videomode.h>
40 const struct drm_display_mode *modes;
41 unsigned int num_modes;
42 const struct display_timing *timings;
43 unsigned int num_timings;
53 * @prepare: the time (in milliseconds) that it takes for the panel to
54 * become ready and start receiving video data
55 * @enable: the time (in milliseconds) that it takes for the panel to
56 * display the first valid frame after starting to receive
58 * @disable: the time (in milliseconds) that it takes for the panel to
59 * turn the display off (no content is visible)
60 * @unprepare: the time (in milliseconds) that it takes for the panel
61 * to power itself down completely
67 unsigned int unprepare;
74 struct drm_panel base;
78 const struct panel_desc *desc;
80 struct backlight_device *backlight;
81 struct regulator *supply;
82 struct i2c_adapter *ddc;
84 struct gpio_desc *enable_gpio;
87 static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
89 return container_of(panel, struct panel_simple, base);
92 static int panel_simple_get_fixed_modes(struct panel_simple *panel)
94 struct drm_connector *connector = panel->base.connector;
95 struct drm_device *drm = panel->base.drm;
96 struct drm_display_mode *mode;
97 unsigned int i, num = 0;
102 for (i = 0; i < panel->desc->num_timings; i++) {
103 const struct display_timing *dt = &panel->desc->timings[i];
106 videomode_from_timing(dt, &vm);
107 mode = drm_mode_create(drm);
109 dev_err(drm->dev, "failed to add mode %ux%u\n",
110 dt->hactive.typ, dt->vactive.typ);
114 drm_display_mode_from_videomode(&vm, mode);
115 drm_mode_set_name(mode);
117 drm_mode_probed_add(connector, mode);
121 for (i = 0; i < panel->desc->num_modes; i++) {
122 const struct drm_display_mode *m = &panel->desc->modes[i];
124 mode = drm_mode_duplicate(drm, m);
126 dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
127 m->hdisplay, m->vdisplay, m->vrefresh);
131 drm_mode_set_name(mode);
133 drm_mode_probed_add(connector, mode);
137 connector->display_info.bpc = panel->desc->bpc;
138 connector->display_info.width_mm = panel->desc->size.width;
139 connector->display_info.height_mm = panel->desc->size.height;
140 if (panel->desc->bus_format)
141 drm_display_info_set_bus_formats(&connector->display_info,
142 &panel->desc->bus_format, 1);
147 static int panel_simple_disable(struct drm_panel *panel)
149 struct panel_simple *p = to_panel_simple(panel);
155 p->backlight->props.power = FB_BLANK_POWERDOWN;
156 backlight_update_status(p->backlight);
159 if (p->desc->delay.disable)
160 msleep(p->desc->delay.disable);
167 static int panel_simple_unprepare(struct drm_panel *panel)
169 struct panel_simple *p = to_panel_simple(panel);
175 gpiod_set_value_cansleep(p->enable_gpio, 0);
177 regulator_disable(p->supply);
179 if (p->desc->delay.unprepare)
180 msleep(p->desc->delay.unprepare);
187 static int panel_simple_prepare(struct drm_panel *panel)
189 struct panel_simple *p = to_panel_simple(panel);
195 err = regulator_enable(p->supply);
197 dev_err(panel->dev, "failed to enable supply: %d\n", err);
202 gpiod_set_value_cansleep(p->enable_gpio, 1);
204 if (p->desc->delay.prepare)
205 msleep(p->desc->delay.prepare);
212 static int panel_simple_enable(struct drm_panel *panel)
214 struct panel_simple *p = to_panel_simple(panel);
219 if (p->desc->delay.enable)
220 msleep(p->desc->delay.enable);
223 p->backlight->props.power = FB_BLANK_UNBLANK;
224 backlight_update_status(p->backlight);
232 static int panel_simple_get_modes(struct drm_panel *panel)
234 struct panel_simple *p = to_panel_simple(panel);
237 /* probe EDID if a DDC bus is available */
239 struct edid *edid = drm_get_edid(panel->connector, p->ddc);
240 drm_mode_connector_update_edid_property(panel->connector, edid);
242 num += drm_add_edid_modes(panel->connector, edid);
247 /* add hard-coded panel modes */
248 num += panel_simple_get_fixed_modes(p);
253 static int panel_simple_get_timings(struct drm_panel *panel,
254 unsigned int num_timings,
255 struct display_timing *timings)
257 struct panel_simple *p = to_panel_simple(panel);
260 if (p->desc->num_timings < num_timings)
261 num_timings = p->desc->num_timings;
264 for (i = 0; i < num_timings; i++)
265 timings[i] = p->desc->timings[i];
267 return p->desc->num_timings;
270 static const struct drm_panel_funcs panel_simple_funcs = {
271 .disable = panel_simple_disable,
272 .unprepare = panel_simple_unprepare,
273 .prepare = panel_simple_prepare,
274 .enable = panel_simple_enable,
275 .get_modes = panel_simple_get_modes,
276 .get_timings = panel_simple_get_timings,
279 static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
281 struct device_node *backlight, *ddc;
282 struct panel_simple *panel;
285 panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
289 panel->enabled = false;
290 panel->prepared = false;
293 panel->supply = devm_regulator_get(dev, "power");
294 if (IS_ERR(panel->supply))
295 return PTR_ERR(panel->supply);
297 panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
299 if (IS_ERR(panel->enable_gpio)) {
300 err = PTR_ERR(panel->enable_gpio);
301 dev_err(dev, "failed to request GPIO: %d\n", err);
305 backlight = of_parse_phandle(dev->of_node, "backlight", 0);
307 panel->backlight = of_find_backlight_by_node(backlight);
308 of_node_put(backlight);
310 if (!panel->backlight)
311 return -EPROBE_DEFER;
314 ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
316 panel->ddc = of_find_i2c_adapter_by_node(ddc);
325 drm_panel_init(&panel->base);
326 panel->base.dev = dev;
327 panel->base.funcs = &panel_simple_funcs;
329 err = drm_panel_add(&panel->base);
333 dev_set_drvdata(dev, panel);
339 put_device(&panel->ddc->dev);
341 if (panel->backlight)
342 put_device(&panel->backlight->dev);
347 static int panel_simple_remove(struct device *dev)
349 struct panel_simple *panel = dev_get_drvdata(dev);
351 drm_panel_detach(&panel->base);
352 drm_panel_remove(&panel->base);
354 panel_simple_disable(&panel->base);
357 put_device(&panel->ddc->dev);
359 if (panel->backlight)
360 put_device(&panel->backlight->dev);
365 static void panel_simple_shutdown(struct device *dev)
367 struct panel_simple *panel = dev_get_drvdata(dev);
369 panel_simple_disable(&panel->base);
372 static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
375 .hsync_start = 800 + 0,
376 .hsync_end = 800 + 0 + 255,
377 .htotal = 800 + 0 + 255 + 0,
379 .vsync_start = 480 + 2,
380 .vsync_end = 480 + 2 + 45,
381 .vtotal = 480 + 2 + 45 + 0,
383 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
386 static const struct panel_desc ampire_am800480r3tmqwa1h = {
387 .modes = &ire_am800480r3tmqwa1h_mode,
394 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
397 static const struct drm_display_mode auo_b101aw03_mode = {
400 .hsync_start = 1024 + 156,
401 .hsync_end = 1024 + 156 + 8,
402 .htotal = 1024 + 156 + 8 + 156,
404 .vsync_start = 600 + 16,
405 .vsync_end = 600 + 16 + 6,
406 .vtotal = 600 + 16 + 6 + 16,
410 static const struct panel_desc auo_b101aw03 = {
411 .modes = &auo_b101aw03_mode,
420 static const struct drm_display_mode auo_b101ean01_mode = {
423 .hsync_start = 1280 + 119,
424 .hsync_end = 1280 + 119 + 32,
425 .htotal = 1280 + 119 + 32 + 21,
427 .vsync_start = 800 + 4,
428 .vsync_end = 800 + 4 + 20,
429 .vtotal = 800 + 4 + 20 + 8,
433 static const struct panel_desc auo_b101ean01 = {
434 .modes = &auo_b101ean01_mode,
443 static const struct drm_display_mode auo_b101xtn01_mode = {
446 .hsync_start = 1366 + 20,
447 .hsync_end = 1366 + 20 + 70,
448 .htotal = 1366 + 20 + 70,
450 .vsync_start = 768 + 14,
451 .vsync_end = 768 + 14 + 42,
452 .vtotal = 768 + 14 + 42,
454 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
457 static const struct panel_desc auo_b101xtn01 = {
458 .modes = &auo_b101xtn01_mode,
467 static const struct drm_display_mode auo_b116xw03_mode = {
470 .hsync_start = 1366 + 40,
471 .hsync_end = 1366 + 40 + 40,
472 .htotal = 1366 + 40 + 40 + 32,
474 .vsync_start = 768 + 10,
475 .vsync_end = 768 + 10 + 12,
476 .vtotal = 768 + 10 + 12 + 6,
480 static const struct panel_desc auo_b116xw03 = {
481 .modes = &auo_b116xw03_mode,
490 static const struct drm_display_mode auo_b133xtn01_mode = {
493 .hsync_start = 1366 + 48,
494 .hsync_end = 1366 + 48 + 32,
495 .htotal = 1366 + 48 + 32 + 20,
497 .vsync_start = 768 + 3,
498 .vsync_end = 768 + 3 + 6,
499 .vtotal = 768 + 3 + 6 + 13,
503 static const struct panel_desc auo_b133xtn01 = {
504 .modes = &auo_b133xtn01_mode,
513 static const struct drm_display_mode auo_b133htn01_mode = {
516 .hsync_start = 1920 + 172,
517 .hsync_end = 1920 + 172 + 80,
518 .htotal = 1920 + 172 + 80 + 60,
520 .vsync_start = 1080 + 25,
521 .vsync_end = 1080 + 25 + 10,
522 .vtotal = 1080 + 25 + 10 + 10,
526 static const struct panel_desc auo_b133htn01 = {
527 .modes = &auo_b133htn01_mode,
541 static const struct drm_display_mode avic_tm070ddh03_mode = {
544 .hsync_start = 1024 + 160,
545 .hsync_end = 1024 + 160 + 4,
546 .htotal = 1024 + 160 + 4 + 156,
548 .vsync_start = 600 + 17,
549 .vsync_end = 600 + 17 + 1,
550 .vtotal = 600 + 17 + 1 + 17,
554 static const struct panel_desc avic_tm070ddh03 = {
555 .modes = &avic_tm070ddh03_mode,
569 static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
572 .hsync_start = 1366 + 58,
573 .hsync_end = 1366 + 58 + 58,
574 .htotal = 1366 + 58 + 58 + 58,
576 .vsync_start = 768 + 4,
577 .vsync_end = 768 + 4 + 4,
578 .vtotal = 768 + 4 + 4 + 4,
582 static const struct panel_desc chunghwa_claa101wa01a = {
583 .modes = &chunghwa_claa101wa01a_mode,
592 static const struct drm_display_mode chunghwa_claa101wb01_mode = {
595 .hsync_start = 1366 + 48,
596 .hsync_end = 1366 + 48 + 32,
597 .htotal = 1366 + 48 + 32 + 20,
599 .vsync_start = 768 + 16,
600 .vsync_end = 768 + 16 + 8,
601 .vtotal = 768 + 16 + 8 + 16,
605 static const struct panel_desc chunghwa_claa101wb01 = {
606 .modes = &chunghwa_claa101wb01_mode,
615 static const struct drm_display_mode edt_et057090dhu_mode = {
618 .hsync_start = 640 + 16,
619 .hsync_end = 640 + 16 + 30,
620 .htotal = 640 + 16 + 30 + 114,
622 .vsync_start = 480 + 10,
623 .vsync_end = 480 + 10 + 3,
624 .vtotal = 480 + 10 + 3 + 32,
626 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
629 static const struct panel_desc edt_et057090dhu = {
630 .modes = &edt_et057090dhu_mode,
639 static const struct drm_display_mode edt_etm0700g0dh6_mode = {
642 .hsync_start = 800 + 40,
643 .hsync_end = 800 + 40 + 128,
644 .htotal = 800 + 40 + 128 + 88,
646 .vsync_start = 480 + 10,
647 .vsync_end = 480 + 10 + 2,
648 .vtotal = 480 + 10 + 2 + 33,
650 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
653 static const struct panel_desc edt_etm0700g0dh6 = {
654 .modes = &edt_etm0700g0dh6_mode,
663 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
666 .hsync_start = 800 + 168,
667 .hsync_end = 800 + 168 + 64,
668 .htotal = 800 + 168 + 64 + 88,
670 .vsync_start = 480 + 37,
671 .vsync_end = 480 + 37 + 2,
672 .vtotal = 480 + 37 + 2 + 8,
676 static const struct panel_desc foxlink_fl500wvr00_a0t = {
677 .modes = &foxlink_fl500wvr00_a0t_mode,
684 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
687 static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
690 .hsync_start = 480 + 5,
691 .hsync_end = 480 + 5 + 1,
692 .htotal = 480 + 5 + 1 + 40,
694 .vsync_start = 272 + 8,
695 .vsync_end = 272 + 8 + 1,
696 .vtotal = 272 + 8 + 1 + 8,
700 static const struct panel_desc giantplus_gpg482739qs5 = {
701 .modes = &giantplus_gpg482739qs5_mode,
708 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
711 static const struct display_timing hannstar_hsd070pww1_timing = {
712 .pixelclock = { 64300000, 71100000, 82000000 },
713 .hactive = { 1280, 1280, 1280 },
714 .hfront_porch = { 1, 1, 10 },
715 .hback_porch = { 1, 1, 10 },
716 .hsync_len = { 52, 158, 661 },
717 .vactive = { 800, 800, 800 },
718 .vfront_porch = { 1, 1, 10 },
719 .vback_porch = { 1, 1, 10 },
720 .vsync_len = { 1, 21, 203 },
721 .flags = DISPLAY_FLAGS_DE_HIGH,
724 static const struct panel_desc hannstar_hsd070pww1 = {
725 .timings = &hannstar_hsd070pww1_timing,
734 static const struct display_timing hannstar_hsd100pxn1_timing = {
735 .pixelclock = { 55000000, 65000000, 75000000 },
736 .hactive = { 1024, 1024, 1024 },
737 .hfront_porch = { 40, 40, 40 },
738 .hback_porch = { 220, 220, 220 },
739 .hsync_len = { 20, 60, 100 },
740 .vactive = { 768, 768, 768 },
741 .vfront_porch = { 7, 7, 7 },
742 .vback_porch = { 21, 21, 21 },
743 .vsync_len = { 10, 10, 10 },
744 .flags = DISPLAY_FLAGS_DE_HIGH,
747 static const struct panel_desc hannstar_hsd100pxn1 = {
748 .timings = &hannstar_hsd100pxn1_timing,
755 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
758 static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
761 .hsync_start = 800 + 85,
762 .hsync_end = 800 + 85 + 86,
763 .htotal = 800 + 85 + 86 + 85,
765 .vsync_start = 480 + 16,
766 .vsync_end = 480 + 16 + 13,
767 .vtotal = 480 + 16 + 13 + 16,
771 static const struct panel_desc hitachi_tx23d38vm0caa = {
772 .modes = &hitachi_tx23d38vm0caa_mode,
781 static const struct drm_display_mode innolux_at043tn24_mode = {
784 .hsync_start = 480 + 2,
785 .hsync_end = 480 + 2 + 41,
786 .htotal = 480 + 2 + 41 + 2,
788 .vsync_start = 272 + 2,
789 .vsync_end = 272 + 2 + 11,
790 .vtotal = 272 + 2 + 11 + 2,
792 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
795 static const struct panel_desc innolux_at043tn24 = {
796 .modes = &innolux_at043tn24_mode,
803 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
806 static const struct drm_display_mode innolux_g121i1_l01_mode = {
809 .hsync_start = 1280 + 64,
810 .hsync_end = 1280 + 64 + 32,
811 .htotal = 1280 + 64 + 32 + 64,
813 .vsync_start = 800 + 9,
814 .vsync_end = 800 + 9 + 6,
815 .vtotal = 800 + 9 + 6 + 9,
819 static const struct panel_desc innolux_g121i1_l01 = {
820 .modes = &innolux_g121i1_l01_mode,
829 static const struct drm_display_mode innolux_n116bge_mode = {
832 .hsync_start = 1366 + 136,
833 .hsync_end = 1366 + 136 + 30,
834 .htotal = 1366 + 136 + 30 + 60,
836 .vsync_start = 768 + 8,
837 .vsync_end = 768 + 8 + 12,
838 .vtotal = 768 + 8 + 12 + 12,
840 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
843 static const struct panel_desc innolux_n116bge = {
844 .modes = &innolux_n116bge_mode,
853 static const struct drm_display_mode innolux_n156bge_l21_mode = {
856 .hsync_start = 1366 + 16,
857 .hsync_end = 1366 + 16 + 34,
858 .htotal = 1366 + 16 + 34 + 50,
860 .vsync_start = 768 + 2,
861 .vsync_end = 768 + 2 + 6,
862 .vtotal = 768 + 2 + 6 + 12,
866 static const struct panel_desc innolux_n156bge_l21 = {
867 .modes = &innolux_n156bge_l21_mode,
876 static const struct drm_display_mode innolux_zj070na_01p_mode = {
879 .hsync_start = 1024 + 128,
880 .hsync_end = 1024 + 128 + 64,
881 .htotal = 1024 + 128 + 64 + 128,
883 .vsync_start = 600 + 16,
884 .vsync_end = 600 + 16 + 4,
885 .vtotal = 600 + 16 + 4 + 16,
889 static const struct panel_desc innolux_zj070na_01p = {
890 .modes = &innolux_zj070na_01p_mode,
899 static const struct drm_display_mode lg_lb070wv8_mode = {
902 .hsync_start = 800 + 88,
903 .hsync_end = 800 + 88 + 80,
904 .htotal = 800 + 88 + 80 + 88,
906 .vsync_start = 480 + 10,
907 .vsync_end = 480 + 10 + 25,
908 .vtotal = 480 + 10 + 25 + 10,
912 static const struct panel_desc lg_lb070wv8 = {
913 .modes = &lg_lb070wv8_mode,
920 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
923 static const struct drm_display_mode lg_lp129qe_mode = {
926 .hsync_start = 2560 + 48,
927 .hsync_end = 2560 + 48 + 32,
928 .htotal = 2560 + 48 + 32 + 80,
930 .vsync_start = 1700 + 3,
931 .vsync_end = 1700 + 3 + 10,
932 .vtotal = 1700 + 3 + 10 + 36,
936 static const struct panel_desc lg_lp129qe = {
937 .modes = &lg_lp129qe_mode,
946 static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
949 .hsync_start = 480 + 10,
950 .hsync_end = 480 + 10 + 10,
951 .htotal = 480 + 10 + 10 + 15,
953 .vsync_start = 800 + 3,
954 .vsync_end = 800 + 3 + 3,
955 .vtotal = 800 + 3 + 3 + 3,
959 static const struct panel_desc ortustech_com43h4m85ulc = {
960 .modes = &ortustech_com43h4m85ulc_mode,
967 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
970 static const struct drm_display_mode samsung_ltn101nt05_mode = {
973 .hsync_start = 1024 + 24,
974 .hsync_end = 1024 + 24 + 136,
975 .htotal = 1024 + 24 + 136 + 160,
977 .vsync_start = 600 + 3,
978 .vsync_end = 600 + 3 + 6,
979 .vtotal = 600 + 3 + 6 + 61,
983 static const struct panel_desc samsung_ltn101nt05 = {
984 .modes = &samsung_ltn101nt05_mode,
993 static const struct drm_display_mode samsung_ltn140at29_301_mode = {
996 .hsync_start = 1366 + 64,
997 .hsync_end = 1366 + 64 + 48,
998 .htotal = 1366 + 64 + 48 + 128,
1000 .vsync_start = 768 + 2,
1001 .vsync_end = 768 + 2 + 5,
1002 .vtotal = 768 + 2 + 5 + 17,
1006 static const struct panel_desc samsung_ltn140at29_301 = {
1007 .modes = &samsung_ltn140at29_301_mode,
1016 static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
1019 .hsync_start = 800 + 1,
1020 .hsync_end = 800 + 1 + 64,
1021 .htotal = 800 + 1 + 64 + 64,
1023 .vsync_start = 480 + 1,
1024 .vsync_end = 480 + 1 + 23,
1025 .vtotal = 480 + 1 + 23 + 22,
1029 static const struct panel_desc shelly_sca07010_bfn_lnn = {
1030 .modes = &shelly_sca07010_bfn_lnn_mode,
1036 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1039 static const struct of_device_id platform_of_match[] = {
1041 .compatible = "ampire,am800480r3tmqwa1h",
1042 .data = &ire_am800480r3tmqwa1h,
1044 .compatible = "auo,b101aw03",
1045 .data = &auo_b101aw03,
1047 .compatible = "auo,b101ean01",
1048 .data = &auo_b101ean01,
1050 .compatible = "auo,b101xtn01",
1051 .data = &auo_b101xtn01,
1053 .compatible = "auo,b116xw03",
1054 .data = &auo_b116xw03,
1056 .compatible = "auo,b133htn01",
1057 .data = &auo_b133htn01,
1059 .compatible = "auo,b133xtn01",
1060 .data = &auo_b133xtn01,
1062 .compatible = "avic,tm070ddh03",
1063 .data = &avic_tm070ddh03,
1065 .compatible = "chunghwa,claa101wa01a",
1066 .data = &chunghwa_claa101wa01a
1068 .compatible = "chunghwa,claa101wb01",
1069 .data = &chunghwa_claa101wb01
1071 .compatible = "edt,et057090dhu",
1072 .data = &edt_et057090dhu,
1074 .compatible = "edt,et070080dh6",
1075 .data = &edt_etm0700g0dh6,
1077 .compatible = "edt,etm0700g0dh6",
1078 .data = &edt_etm0700g0dh6,
1080 .compatible = "foxlink,fl500wvr00-a0t",
1081 .data = &foxlink_fl500wvr00_a0t,
1083 .compatible = "giantplus,gpg482739qs5",
1084 .data = &giantplus_gpg482739qs5
1086 .compatible = "hannstar,hsd070pww1",
1087 .data = &hannstar_hsd070pww1,
1089 .compatible = "hannstar,hsd100pxn1",
1090 .data = &hannstar_hsd100pxn1,
1092 .compatible = "hit,tx23d38vm0caa",
1093 .data = &hitachi_tx23d38vm0caa
1095 .compatible = "innolux,at043tn24",
1096 .data = &innolux_at043tn24,
1098 .compatible ="innolux,g121i1-l01",
1099 .data = &innolux_g121i1_l01
1101 .compatible = "innolux,n116bge",
1102 .data = &innolux_n116bge,
1104 .compatible = "innolux,n156bge-l21",
1105 .data = &innolux_n156bge_l21,
1107 .compatible = "innolux,zj070na-01p",
1108 .data = &innolux_zj070na_01p,
1110 .compatible = "lg,lb070wv8",
1111 .data = &lg_lb070wv8,
1113 .compatible = "lg,lp129qe",
1114 .data = &lg_lp129qe,
1116 .compatible = "ortustech,com43h4m85ulc",
1117 .data = &ortustech_com43h4m85ulc,
1119 .compatible = "samsung,ltn101nt05",
1120 .data = &samsung_ltn101nt05,
1122 .compatible = "samsung,ltn140at29-301",
1123 .data = &samsung_ltn140at29_301,
1125 .compatible = "shelly,sca07010-bfn-lnn",
1126 .data = &shelly_sca07010_bfn_lnn,
1131 MODULE_DEVICE_TABLE(of, platform_of_match);
1133 static int panel_simple_platform_probe(struct platform_device *pdev)
1135 const struct of_device_id *id;
1137 id = of_match_node(platform_of_match, pdev->dev.of_node);
1141 return panel_simple_probe(&pdev->dev, id->data);
1144 static int panel_simple_platform_remove(struct platform_device *pdev)
1146 return panel_simple_remove(&pdev->dev);
1149 static void panel_simple_platform_shutdown(struct platform_device *pdev)
1151 panel_simple_shutdown(&pdev->dev);
1154 static struct platform_driver panel_simple_platform_driver = {
1156 .name = "panel-simple",
1157 .of_match_table = platform_of_match,
1159 .probe = panel_simple_platform_probe,
1160 .remove = panel_simple_platform_remove,
1161 .shutdown = panel_simple_platform_shutdown,
1164 struct panel_desc_dsi {
1165 struct panel_desc desc;
1167 unsigned long flags;
1168 enum mipi_dsi_pixel_format format;
1172 static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
1175 .hsync_start = 800 + 32,
1176 .hsync_end = 800 + 32 + 1,
1177 .htotal = 800 + 32 + 1 + 57,
1179 .vsync_start = 1280 + 28,
1180 .vsync_end = 1280 + 28 + 1,
1181 .vtotal = 1280 + 28 + 1 + 14,
1185 static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
1187 .modes = &lg_ld070wx3_sl01_mode,
1195 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1196 .format = MIPI_DSI_FMT_RGB888,
1200 static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
1203 .hsync_start = 720 + 12,
1204 .hsync_end = 720 + 12 + 4,
1205 .htotal = 720 + 12 + 4 + 112,
1207 .vsync_start = 1280 + 8,
1208 .vsync_end = 1280 + 8 + 4,
1209 .vtotal = 1280 + 8 + 4 + 12,
1213 static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
1215 .modes = &lg_lh500wx1_sd03_mode,
1223 .flags = MIPI_DSI_MODE_VIDEO,
1224 .format = MIPI_DSI_FMT_RGB888,
1228 static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
1231 .hsync_start = 1920 + 154,
1232 .hsync_end = 1920 + 154 + 16,
1233 .htotal = 1920 + 154 + 16 + 32,
1235 .vsync_start = 1200 + 17,
1236 .vsync_end = 1200 + 17 + 2,
1237 .vtotal = 1200 + 17 + 2 + 16,
1241 static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
1243 .modes = &panasonic_vvx10f004b00_mode,
1251 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
1252 MIPI_DSI_CLOCK_NON_CONTINUOUS,
1253 .format = MIPI_DSI_FMT_RGB888,
1257 static const struct of_device_id dsi_of_match[] = {
1259 .compatible = "lg,ld070wx3-sl01",
1260 .data = &lg_ld070wx3_sl01
1262 .compatible = "lg,lh500wx1-sd03",
1263 .data = &lg_lh500wx1_sd03
1265 .compatible = "panasonic,vvx10f004b00",
1266 .data = &panasonic_vvx10f004b00
1271 MODULE_DEVICE_TABLE(of, dsi_of_match);
1273 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
1275 const struct panel_desc_dsi *desc;
1276 const struct of_device_id *id;
1279 id = of_match_node(dsi_of_match, dsi->dev.of_node);
1285 err = panel_simple_probe(&dsi->dev, &desc->desc);
1289 dsi->mode_flags = desc->flags;
1290 dsi->format = desc->format;
1291 dsi->lanes = desc->lanes;
1293 return mipi_dsi_attach(dsi);
1296 static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
1300 err = mipi_dsi_detach(dsi);
1302 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
1304 return panel_simple_remove(&dsi->dev);
1307 static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
1309 panel_simple_shutdown(&dsi->dev);
1312 static struct mipi_dsi_driver panel_simple_dsi_driver = {
1314 .name = "panel-simple-dsi",
1315 .of_match_table = dsi_of_match,
1317 .probe = panel_simple_dsi_probe,
1318 .remove = panel_simple_dsi_remove,
1319 .shutdown = panel_simple_dsi_shutdown,
1322 static int __init panel_simple_init(void)
1326 err = platform_driver_register(&panel_simple_platform_driver);
1330 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
1331 err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
1338 module_init(panel_simple_init);
1340 static void __exit panel_simple_exit(void)
1342 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
1343 mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
1345 platform_driver_unregister(&panel_simple_platform_driver);
1347 module_exit(panel_simple_exit);
1350 MODULE_DESCRIPTION("DRM Driver for Simple Panels");
1351 MODULE_LICENSE("GPL and additional rights");