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_claa070wp03xg_mode = {
572 .hsync_start = 800 + 24,
573 .hsync_end = 800 + 24 + 16,
574 .htotal = 800 + 24 + 16 + 24,
576 .vsync_start = 1280 + 2,
577 .vsync_end = 1280 + 2 + 2,
578 .vtotal = 1280 + 2 + 2 + 4,
582 static const struct panel_desc chunghwa_claa070wp03xg = {
583 .modes = &chunghwa_claa070wp03xg_mode,
592 static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
595 .hsync_start = 1366 + 58,
596 .hsync_end = 1366 + 58 + 58,
597 .htotal = 1366 + 58 + 58 + 58,
599 .vsync_start = 768 + 4,
600 .vsync_end = 768 + 4 + 4,
601 .vtotal = 768 + 4 + 4 + 4,
605 static const struct panel_desc chunghwa_claa101wa01a = {
606 .modes = &chunghwa_claa101wa01a_mode,
615 static const struct drm_display_mode chunghwa_claa101wb01_mode = {
618 .hsync_start = 1366 + 48,
619 .hsync_end = 1366 + 48 + 32,
620 .htotal = 1366 + 48 + 32 + 20,
622 .vsync_start = 768 + 16,
623 .vsync_end = 768 + 16 + 8,
624 .vtotal = 768 + 16 + 8 + 16,
628 static const struct panel_desc chunghwa_claa101wb01 = {
629 .modes = &chunghwa_claa101wb01_mode,
638 static const struct drm_display_mode edt_et057090dhu_mode = {
641 .hsync_start = 640 + 16,
642 .hsync_end = 640 + 16 + 30,
643 .htotal = 640 + 16 + 30 + 114,
645 .vsync_start = 480 + 10,
646 .vsync_end = 480 + 10 + 3,
647 .vtotal = 480 + 10 + 3 + 32,
649 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
652 static const struct panel_desc edt_et057090dhu = {
653 .modes = &edt_et057090dhu_mode,
662 static const struct drm_display_mode edt_etm0700g0dh6_mode = {
665 .hsync_start = 800 + 40,
666 .hsync_end = 800 + 40 + 128,
667 .htotal = 800 + 40 + 128 + 88,
669 .vsync_start = 480 + 10,
670 .vsync_end = 480 + 10 + 2,
671 .vtotal = 480 + 10 + 2 + 33,
673 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
676 static const struct panel_desc edt_etm0700g0dh6 = {
677 .modes = &edt_etm0700g0dh6_mode,
686 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
689 .hsync_start = 800 + 168,
690 .hsync_end = 800 + 168 + 64,
691 .htotal = 800 + 168 + 64 + 88,
693 .vsync_start = 480 + 37,
694 .vsync_end = 480 + 37 + 2,
695 .vtotal = 480 + 37 + 2 + 8,
699 static const struct panel_desc foxlink_fl500wvr00_a0t = {
700 .modes = &foxlink_fl500wvr00_a0t_mode,
707 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
710 static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
713 .hsync_start = 480 + 5,
714 .hsync_end = 480 + 5 + 1,
715 .htotal = 480 + 5 + 1 + 40,
717 .vsync_start = 272 + 8,
718 .vsync_end = 272 + 8 + 1,
719 .vtotal = 272 + 8 + 1 + 8,
723 static const struct panel_desc giantplus_gpg482739qs5 = {
724 .modes = &giantplus_gpg482739qs5_mode,
731 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
734 static const struct display_timing hannstar_hsd070pww1_timing = {
735 .pixelclock = { 64300000, 71100000, 82000000 },
736 .hactive = { 1280, 1280, 1280 },
737 .hfront_porch = { 1, 1, 10 },
738 .hback_porch = { 1, 1, 10 },
740 * According to the data sheet, the minimum horizontal blanking interval
741 * is 54 clocks (1 + 52 + 1), but tests with a Nitrogen6X have shown the
742 * minimum working horizontal blanking interval to be 60 clocks.
744 .hsync_len = { 58, 158, 661 },
745 .vactive = { 800, 800, 800 },
746 .vfront_porch = { 1, 1, 10 },
747 .vback_porch = { 1, 1, 10 },
748 .vsync_len = { 1, 21, 203 },
749 .flags = DISPLAY_FLAGS_DE_HIGH,
752 static const struct panel_desc hannstar_hsd070pww1 = {
753 .timings = &hannstar_hsd070pww1_timing,
760 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
763 static const struct display_timing hannstar_hsd100pxn1_timing = {
764 .pixelclock = { 55000000, 65000000, 75000000 },
765 .hactive = { 1024, 1024, 1024 },
766 .hfront_porch = { 40, 40, 40 },
767 .hback_porch = { 220, 220, 220 },
768 .hsync_len = { 20, 60, 100 },
769 .vactive = { 768, 768, 768 },
770 .vfront_porch = { 7, 7, 7 },
771 .vback_porch = { 21, 21, 21 },
772 .vsync_len = { 10, 10, 10 },
773 .flags = DISPLAY_FLAGS_DE_HIGH,
776 static const struct panel_desc hannstar_hsd100pxn1 = {
777 .timings = &hannstar_hsd100pxn1_timing,
784 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
787 static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
790 .hsync_start = 800 + 85,
791 .hsync_end = 800 + 85 + 86,
792 .htotal = 800 + 85 + 86 + 85,
794 .vsync_start = 480 + 16,
795 .vsync_end = 480 + 16 + 13,
796 .vtotal = 480 + 16 + 13 + 16,
800 static const struct panel_desc hitachi_tx23d38vm0caa = {
801 .modes = &hitachi_tx23d38vm0caa_mode,
810 static const struct drm_display_mode innolux_at043tn24_mode = {
813 .hsync_start = 480 + 2,
814 .hsync_end = 480 + 2 + 41,
815 .htotal = 480 + 2 + 41 + 2,
817 .vsync_start = 272 + 2,
818 .vsync_end = 272 + 2 + 11,
819 .vtotal = 272 + 2 + 11 + 2,
821 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
824 static const struct panel_desc innolux_at043tn24 = {
825 .modes = &innolux_at043tn24_mode,
832 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
835 static const struct drm_display_mode innolux_g121i1_l01_mode = {
838 .hsync_start = 1280 + 64,
839 .hsync_end = 1280 + 64 + 32,
840 .htotal = 1280 + 64 + 32 + 64,
842 .vsync_start = 800 + 9,
843 .vsync_end = 800 + 9 + 6,
844 .vtotal = 800 + 9 + 6 + 9,
848 static const struct panel_desc innolux_g121i1_l01 = {
849 .modes = &innolux_g121i1_l01_mode,
858 static const struct drm_display_mode innolux_n116bge_mode = {
861 .hsync_start = 1366 + 136,
862 .hsync_end = 1366 + 136 + 30,
863 .htotal = 1366 + 136 + 30 + 60,
865 .vsync_start = 768 + 8,
866 .vsync_end = 768 + 8 + 12,
867 .vtotal = 768 + 8 + 12 + 12,
869 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
872 static const struct panel_desc innolux_n116bge = {
873 .modes = &innolux_n116bge_mode,
882 static const struct drm_display_mode innolux_n156bge_l21_mode = {
885 .hsync_start = 1366 + 16,
886 .hsync_end = 1366 + 16 + 34,
887 .htotal = 1366 + 16 + 34 + 50,
889 .vsync_start = 768 + 2,
890 .vsync_end = 768 + 2 + 6,
891 .vtotal = 768 + 2 + 6 + 12,
895 static const struct panel_desc innolux_n156bge_l21 = {
896 .modes = &innolux_n156bge_l21_mode,
905 static const struct drm_display_mode innolux_zj070na_01p_mode = {
908 .hsync_start = 1024 + 128,
909 .hsync_end = 1024 + 128 + 64,
910 .htotal = 1024 + 128 + 64 + 128,
912 .vsync_start = 600 + 16,
913 .vsync_end = 600 + 16 + 4,
914 .vtotal = 600 + 16 + 4 + 16,
918 static const struct panel_desc innolux_zj070na_01p = {
919 .modes = &innolux_zj070na_01p_mode,
928 static const struct drm_display_mode lg_lb070wv8_mode = {
931 .hsync_start = 800 + 88,
932 .hsync_end = 800 + 88 + 80,
933 .htotal = 800 + 88 + 80 + 88,
935 .vsync_start = 480 + 10,
936 .vsync_end = 480 + 10 + 25,
937 .vtotal = 480 + 10 + 25 + 10,
941 static const struct panel_desc lg_lb070wv8 = {
942 .modes = &lg_lb070wv8_mode,
949 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
952 static const struct drm_display_mode lg_lp079qx1_sp0v_mode = {
955 .hsync_start = 1536 + 12,
956 .hsync_end = 1536 + 12 + 16,
957 .htotal = 1536 + 12 + 16 + 48,
959 .vsync_start = 2048 + 8,
960 .vsync_end = 2048 + 8 + 4,
961 .vtotal = 2048 + 8 + 4 + 8,
963 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
966 static const struct panel_desc lg_lp079qx1_sp0v = {
967 .modes = &lg_lp079qx1_sp0v_mode,
975 static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
978 .hsync_start = 2048 + 150,
979 .hsync_end = 2048 + 150 + 5,
980 .htotal = 2048 + 150 + 5 + 5,
982 .vsync_start = 1536 + 3,
983 .vsync_end = 1536 + 3 + 1,
984 .vtotal = 1536 + 3 + 1 + 9,
988 static const struct panel_desc lg_lp097qx1_spa1 = {
989 .modes = &lg_lp097qx1_spa1_mode,
997 static const struct drm_display_mode lg_lp129qe_mode = {
1000 .hsync_start = 2560 + 48,
1001 .hsync_end = 2560 + 48 + 32,
1002 .htotal = 2560 + 48 + 32 + 80,
1004 .vsync_start = 1700 + 3,
1005 .vsync_end = 1700 + 3 + 10,
1006 .vtotal = 1700 + 3 + 10 + 36,
1010 static const struct panel_desc lg_lp129qe = {
1011 .modes = &lg_lp129qe_mode,
1020 static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
1023 .hsync_start = 480 + 2,
1024 .hsync_end = 480 + 2 + 41,
1025 .htotal = 480 + 2 + 41 + 2,
1027 .vsync_start = 272 + 2,
1028 .vsync_end = 272 + 2 + 4,
1029 .vtotal = 272 + 2 + 4 + 2,
1033 static const struct panel_desc nec_nl4827hc19_05b = {
1034 .modes = &nec_nl4827hc19_05b_mode,
1041 .bus_format = MEDIA_BUS_FMT_RGB888_1X24
1044 static const struct display_timing okaya_rs800480t_7x0gp_timing = {
1045 .pixelclock = { 30000000, 30000000, 40000000 },
1046 .hactive = { 800, 800, 800 },
1047 .hfront_porch = { 40, 40, 40 },
1048 .hback_porch = { 40, 40, 40 },
1049 .hsync_len = { 1, 48, 48 },
1050 .vactive = { 480, 480, 480 },
1051 .vfront_porch = { 13, 13, 13 },
1052 .vback_porch = { 29, 29, 29 },
1053 .vsync_len = { 3, 3, 3 },
1054 .flags = DISPLAY_FLAGS_DE_HIGH,
1057 static const struct panel_desc okaya_rs800480t_7x0gp = {
1058 .timings = &okaya_rs800480t_7x0gp_timing,
1071 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1074 static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
1077 .hsync_start = 480 + 10,
1078 .hsync_end = 480 + 10 + 10,
1079 .htotal = 480 + 10 + 10 + 15,
1081 .vsync_start = 800 + 3,
1082 .vsync_end = 800 + 3 + 3,
1083 .vtotal = 800 + 3 + 3 + 3,
1087 static const struct panel_desc ortustech_com43h4m85ulc = {
1088 .modes = &ortustech_com43h4m85ulc_mode,
1095 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1098 static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
1101 .hsync_start = 2560 + 48,
1102 .hsync_end = 2560 + 48 + 32,
1103 .htotal = 2560 + 48 + 32 + 80,
1105 .vsync_start = 1600 + 2,
1106 .vsync_end = 1600 + 2 + 5,
1107 .vtotal = 1600 + 2 + 5 + 57,
1111 static const struct panel_desc samsung_lsn122dl01_c01 = {
1112 .modes = &samsung_lsn122dl01_c01_mode,
1120 static const struct drm_display_mode samsung_ltn101nt05_mode = {
1123 .hsync_start = 1024 + 24,
1124 .hsync_end = 1024 + 24 + 136,
1125 .htotal = 1024 + 24 + 136 + 160,
1127 .vsync_start = 600 + 3,
1128 .vsync_end = 600 + 3 + 6,
1129 .vtotal = 600 + 3 + 6 + 61,
1133 static const struct panel_desc samsung_ltn101nt05 = {
1134 .modes = &samsung_ltn101nt05_mode,
1143 static const struct drm_display_mode samsung_ltn140at29_301_mode = {
1146 .hsync_start = 1366 + 64,
1147 .hsync_end = 1366 + 64 + 48,
1148 .htotal = 1366 + 64 + 48 + 128,
1150 .vsync_start = 768 + 2,
1151 .vsync_end = 768 + 2 + 5,
1152 .vtotal = 768 + 2 + 5 + 17,
1156 static const struct panel_desc samsung_ltn140at29_301 = {
1157 .modes = &samsung_ltn140at29_301_mode,
1166 static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
1169 .hsync_start = 800 + 1,
1170 .hsync_end = 800 + 1 + 64,
1171 .htotal = 800 + 1 + 64 + 64,
1173 .vsync_start = 480 + 1,
1174 .vsync_end = 480 + 1 + 23,
1175 .vtotal = 480 + 1 + 23 + 22,
1179 static const struct panel_desc shelly_sca07010_bfn_lnn = {
1180 .modes = &shelly_sca07010_bfn_lnn_mode,
1186 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1189 static const struct of_device_id platform_of_match[] = {
1191 .compatible = "ampire,am800480r3tmqwa1h",
1192 .data = &ire_am800480r3tmqwa1h,
1194 .compatible = "auo,b101aw03",
1195 .data = &auo_b101aw03,
1197 .compatible = "auo,b101ean01",
1198 .data = &auo_b101ean01,
1200 .compatible = "auo,b101xtn01",
1201 .data = &auo_b101xtn01,
1203 .compatible = "auo,b116xw03",
1204 .data = &auo_b116xw03,
1206 .compatible = "auo,b133htn01",
1207 .data = &auo_b133htn01,
1209 .compatible = "auo,b133xtn01",
1210 .data = &auo_b133xtn01,
1212 .compatible = "avic,tm070ddh03",
1213 .data = &avic_tm070ddh03,
1215 .compatible = "chunghwa,claa070wp03xg",
1216 .data = &chunghwa_claa070wp03xg,
1218 .compatible = "chunghwa,claa101wa01a",
1219 .data = &chunghwa_claa101wa01a
1221 .compatible = "chunghwa,claa101wb01",
1222 .data = &chunghwa_claa101wb01
1224 .compatible = "edt,et057090dhu",
1225 .data = &edt_et057090dhu,
1227 .compatible = "edt,et070080dh6",
1228 .data = &edt_etm0700g0dh6,
1230 .compatible = "edt,etm0700g0dh6",
1231 .data = &edt_etm0700g0dh6,
1233 .compatible = "foxlink,fl500wvr00-a0t",
1234 .data = &foxlink_fl500wvr00_a0t,
1236 .compatible = "giantplus,gpg482739qs5",
1237 .data = &giantplus_gpg482739qs5
1239 .compatible = "hannstar,hsd070pww1",
1240 .data = &hannstar_hsd070pww1,
1242 .compatible = "hannstar,hsd100pxn1",
1243 .data = &hannstar_hsd100pxn1,
1245 .compatible = "hit,tx23d38vm0caa",
1246 .data = &hitachi_tx23d38vm0caa
1248 .compatible = "innolux,at043tn24",
1249 .data = &innolux_at043tn24,
1251 .compatible ="innolux,g121i1-l01",
1252 .data = &innolux_g121i1_l01
1254 .compatible = "innolux,n116bge",
1255 .data = &innolux_n116bge,
1257 .compatible = "innolux,n156bge-l21",
1258 .data = &innolux_n156bge_l21,
1260 .compatible = "innolux,zj070na-01p",
1261 .data = &innolux_zj070na_01p,
1263 .compatible = "lg,lb070wv8",
1264 .data = &lg_lb070wv8,
1266 .compatible = "lg,lp079qx1-sp0v",
1267 .data = &lg_lp079qx1_sp0v,
1269 .compatible = "lg,lp097qx1-spa1",
1270 .data = &lg_lp097qx1_spa1,
1272 .compatible = "lg,lp129qe",
1273 .data = &lg_lp129qe,
1275 .compatible = "nec,nl4827hc19-05b",
1276 .data = &nec_nl4827hc19_05b,
1278 .compatible = "okaya,rs800480t-7x0gp",
1279 .data = &okaya_rs800480t_7x0gp,
1281 .compatible = "ortustech,com43h4m85ulc",
1282 .data = &ortustech_com43h4m85ulc,
1284 .compatible = "samsung,lsn122dl01-c01",
1285 .data = &samsung_lsn122dl01_c01,
1287 .compatible = "samsung,ltn101nt05",
1288 .data = &samsung_ltn101nt05,
1290 .compatible = "samsung,ltn140at29-301",
1291 .data = &samsung_ltn140at29_301,
1293 .compatible = "shelly,sca07010-bfn-lnn",
1294 .data = &shelly_sca07010_bfn_lnn,
1299 MODULE_DEVICE_TABLE(of, platform_of_match);
1301 static int panel_simple_platform_probe(struct platform_device *pdev)
1303 const struct of_device_id *id;
1305 id = of_match_node(platform_of_match, pdev->dev.of_node);
1309 return panel_simple_probe(&pdev->dev, id->data);
1312 static int panel_simple_platform_remove(struct platform_device *pdev)
1314 return panel_simple_remove(&pdev->dev);
1317 static void panel_simple_platform_shutdown(struct platform_device *pdev)
1319 panel_simple_shutdown(&pdev->dev);
1322 static struct platform_driver panel_simple_platform_driver = {
1324 .name = "panel-simple",
1325 .of_match_table = platform_of_match,
1327 .probe = panel_simple_platform_probe,
1328 .remove = panel_simple_platform_remove,
1329 .shutdown = panel_simple_platform_shutdown,
1332 struct panel_desc_dsi {
1333 struct panel_desc desc;
1335 unsigned long flags;
1336 enum mipi_dsi_pixel_format format;
1340 static const struct drm_display_mode auo_b080uan01_mode = {
1343 .hsync_start = 1200 + 62,
1344 .hsync_end = 1200 + 62 + 4,
1345 .htotal = 1200 + 62 + 4 + 62,
1347 .vsync_start = 1920 + 9,
1348 .vsync_end = 1920 + 9 + 2,
1349 .vtotal = 1920 + 9 + 2 + 8,
1353 static const struct panel_desc_dsi auo_b080uan01 = {
1355 .modes = &auo_b080uan01_mode,
1363 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1364 .format = MIPI_DSI_FMT_RGB888,
1368 static const struct drm_display_mode boe_tv080wum_nl0_mode = {
1371 .hsync_start = 1200 + 120,
1372 .hsync_end = 1200 + 120 + 20,
1373 .htotal = 1200 + 120 + 20 + 21,
1375 .vsync_start = 1920 + 21,
1376 .vsync_end = 1920 + 21 + 3,
1377 .vtotal = 1920 + 21 + 3 + 18,
1379 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1382 static const struct panel_desc_dsi boe_tv080wum_nl0 = {
1384 .modes = &boe_tv080wum_nl0_mode,
1391 .flags = MIPI_DSI_MODE_VIDEO |
1392 MIPI_DSI_MODE_VIDEO_BURST |
1393 MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
1394 .format = MIPI_DSI_FMT_RGB888,
1398 static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
1401 .hsync_start = 800 + 32,
1402 .hsync_end = 800 + 32 + 1,
1403 .htotal = 800 + 32 + 1 + 57,
1405 .vsync_start = 1280 + 28,
1406 .vsync_end = 1280 + 28 + 1,
1407 .vtotal = 1280 + 28 + 1 + 14,
1411 static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
1413 .modes = &lg_ld070wx3_sl01_mode,
1421 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1422 .format = MIPI_DSI_FMT_RGB888,
1426 static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
1429 .hsync_start = 720 + 12,
1430 .hsync_end = 720 + 12 + 4,
1431 .htotal = 720 + 12 + 4 + 112,
1433 .vsync_start = 1280 + 8,
1434 .vsync_end = 1280 + 8 + 4,
1435 .vtotal = 1280 + 8 + 4 + 12,
1439 static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
1441 .modes = &lg_lh500wx1_sd03_mode,
1449 .flags = MIPI_DSI_MODE_VIDEO,
1450 .format = MIPI_DSI_FMT_RGB888,
1454 static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
1457 .hsync_start = 1920 + 154,
1458 .hsync_end = 1920 + 154 + 16,
1459 .htotal = 1920 + 154 + 16 + 32,
1461 .vsync_start = 1200 + 17,
1462 .vsync_end = 1200 + 17 + 2,
1463 .vtotal = 1200 + 17 + 2 + 16,
1467 static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
1469 .modes = &panasonic_vvx10f004b00_mode,
1477 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
1478 MIPI_DSI_CLOCK_NON_CONTINUOUS,
1479 .format = MIPI_DSI_FMT_RGB888,
1484 static const struct of_device_id dsi_of_match[] = {
1486 .compatible = "auo,b080uan01",
1487 .data = &auo_b080uan01
1489 .compatible = "boe,tv080wum-nl0",
1490 .data = &boe_tv080wum_nl0
1492 .compatible = "lg,ld070wx3-sl01",
1493 .data = &lg_ld070wx3_sl01
1495 .compatible = "lg,lh500wx1-sd03",
1496 .data = &lg_lh500wx1_sd03
1498 .compatible = "panasonic,vvx10f004b00",
1499 .data = &panasonic_vvx10f004b00
1504 MODULE_DEVICE_TABLE(of, dsi_of_match);
1506 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
1508 const struct panel_desc_dsi *desc;
1509 const struct of_device_id *id;
1512 id = of_match_node(dsi_of_match, dsi->dev.of_node);
1518 err = panel_simple_probe(&dsi->dev, &desc->desc);
1522 dsi->mode_flags = desc->flags;
1523 dsi->format = desc->format;
1524 dsi->lanes = desc->lanes;
1526 return mipi_dsi_attach(dsi);
1529 static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
1533 err = mipi_dsi_detach(dsi);
1535 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
1537 return panel_simple_remove(&dsi->dev);
1540 static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
1542 panel_simple_shutdown(&dsi->dev);
1545 static struct mipi_dsi_driver panel_simple_dsi_driver = {
1547 .name = "panel-simple-dsi",
1548 .of_match_table = dsi_of_match,
1550 .probe = panel_simple_dsi_probe,
1551 .remove = panel_simple_dsi_remove,
1552 .shutdown = panel_simple_dsi_shutdown,
1555 static int __init panel_simple_init(void)
1559 err = platform_driver_register(&panel_simple_platform_driver);
1563 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
1564 err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
1571 module_init(panel_simple_init);
1573 static void __exit panel_simple_exit(void)
1575 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
1576 mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
1578 platform_driver_unregister(&panel_simple_platform_driver);
1580 module_exit(panel_simple_exit);
1582 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1583 MODULE_DESCRIPTION("DRM Driver for Simple Panels");
1584 MODULE_LICENSE("GPL and additional rights");