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/of_display_timing.h>
38 #include <video/videomode.h>
41 const struct drm_display_mode *modes;
42 unsigned int num_modes;
43 const struct display_timing *timings;
44 unsigned int num_timings;
54 * @prepare: the time (in milliseconds) that it takes for the panel to
55 * become ready and start receiving video data
56 * @enable: the time (in milliseconds) that it takes for the panel to
57 * display the first valid frame after starting to receive
59 * @disable: the time (in milliseconds) that it takes for the panel to
60 * turn the display off (no content is visible)
61 * @unprepare: the time (in milliseconds) that it takes for the panel
62 * to power itself down completely
68 unsigned int unprepare;
75 struct drm_panel base;
80 const struct panel_desc *desc;
82 struct backlight_device *backlight;
83 struct regulator *supply;
84 struct i2c_adapter *ddc;
86 struct gpio_desc *enable_gpio;
89 static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
91 return container_of(panel, struct panel_simple, base);
94 static int panel_simple_get_fixed_modes(struct panel_simple *panel)
96 struct drm_connector *connector = panel->base.connector;
97 struct drm_device *drm = panel->base.drm;
98 struct drm_display_mode *mode;
99 unsigned int i, num = 0;
104 for (i = 0; i < panel->desc->num_timings; i++) {
105 const struct display_timing *dt = &panel->desc->timings[i];
108 videomode_from_timing(dt, &vm);
109 mode = drm_mode_create(drm);
111 dev_err(drm->dev, "failed to add mode %ux%u\n",
112 dt->hactive.typ, dt->vactive.typ);
116 drm_display_mode_from_videomode(&vm, mode);
117 drm_mode_set_name(mode);
119 drm_mode_probed_add(connector, mode);
123 for (i = 0; i < panel->desc->num_modes; i++) {
124 const struct drm_display_mode *m = &panel->desc->modes[i];
126 mode = drm_mode_duplicate(drm, m);
128 dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
129 m->hdisplay, m->vdisplay, m->vrefresh);
133 drm_mode_set_name(mode);
135 drm_mode_probed_add(connector, mode);
139 connector->display_info.bpc = panel->desc->bpc;
140 connector->display_info.width_mm = panel->desc->size.width;
141 connector->display_info.height_mm = panel->desc->size.height;
142 if (panel->desc->bus_format)
143 drm_display_info_set_bus_formats(&connector->display_info,
144 &panel->desc->bus_format, 1);
149 static int panel_simple_of_get_native_mode(struct panel_simple *panel)
151 struct drm_connector *connector = panel->base.connector;
152 struct drm_device *drm = panel->base.drm;
153 struct drm_display_mode *mode;
154 struct device_node *timings_np;
157 timings_np = of_get_child_by_name(panel->dev->of_node,
160 dev_dbg(panel->dev, "failed to find display-timings node\n");
164 of_node_put(timings_np);
165 mode = drm_mode_create(drm);
169 ret = of_get_drm_display_mode(panel->dev->of_node, mode,
172 dev_dbg(panel->dev, "failed to find dts display timings\n");
173 drm_mode_destroy(drm, mode);
177 drm_mode_set_name(mode);
178 mode->type |= DRM_MODE_TYPE_PREFERRED;
179 drm_mode_probed_add(connector, mode);
184 static int panel_simple_disable(struct drm_panel *panel)
186 struct panel_simple *p = to_panel_simple(panel);
192 p->backlight->props.power = FB_BLANK_POWERDOWN;
193 backlight_update_status(p->backlight);
196 if (p->desc && p->desc->delay.disable)
197 msleep(p->desc->delay.disable);
204 static int panel_simple_unprepare(struct drm_panel *panel)
206 struct panel_simple *p = to_panel_simple(panel);
212 gpiod_direction_output(p->enable_gpio, 0);
214 regulator_disable(p->supply);
216 if (p->desc && p->desc->delay.unprepare)
217 msleep(p->desc->delay.unprepare);
224 static int panel_simple_prepare(struct drm_panel *panel)
226 struct panel_simple *p = to_panel_simple(panel);
232 err = regulator_enable(p->supply);
234 dev_err(panel->dev, "failed to enable supply: %d\n", err);
239 gpiod_direction_output(p->enable_gpio, 1);
241 if (p->desc && p->desc->delay.prepare)
242 msleep(p->desc->delay.prepare);
249 static int panel_simple_enable(struct drm_panel *panel)
251 struct panel_simple *p = to_panel_simple(panel);
256 if (p->desc && p->desc->delay.enable)
257 msleep(p->desc->delay.enable);
260 p->backlight->props.power = FB_BLANK_UNBLANK;
261 backlight_update_status(p->backlight);
269 static int panel_simple_get_modes(struct drm_panel *panel)
271 struct panel_simple *p = to_panel_simple(panel);
274 /* probe EDID if a DDC bus is available */
276 struct edid *edid = drm_get_edid(panel->connector, p->ddc);
277 drm_mode_connector_update_edid_property(panel->connector, edid);
279 num += drm_add_edid_modes(panel->connector, edid);
284 /* add hard-coded panel modes */
285 num += panel_simple_get_fixed_modes(p);
287 /* add device node plane modes */
288 num += panel_simple_of_get_native_mode(p);
293 static int panel_simple_get_timings(struct drm_panel *panel,
294 unsigned int num_timings,
295 struct display_timing *timings)
297 struct panel_simple *p = to_panel_simple(panel);
303 if (p->desc->num_timings < num_timings)
304 num_timings = p->desc->num_timings;
307 for (i = 0; i < num_timings; i++)
308 timings[i] = p->desc->timings[i];
310 return p->desc->num_timings;
313 static const struct drm_panel_funcs panel_simple_funcs = {
314 .disable = panel_simple_disable,
315 .unprepare = panel_simple_unprepare,
316 .prepare = panel_simple_prepare,
317 .enable = panel_simple_enable,
318 .get_modes = panel_simple_get_modes,
319 .get_timings = panel_simple_get_timings,
322 static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
324 struct device_node *backlight, *ddc;
325 struct panel_simple *panel;
328 panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
332 panel->enabled = false;
333 panel->prepared = false;
337 panel->supply = devm_regulator_get(dev, "power");
338 if (IS_ERR(panel->supply))
339 return PTR_ERR(panel->supply);
341 panel->enable_gpio = devm_gpiod_get_optional(dev, "enable", 0);
342 if (IS_ERR(panel->enable_gpio)) {
343 err = PTR_ERR(panel->enable_gpio);
344 dev_err(dev, "failed to request GPIO: %d\n", err);
348 backlight = of_parse_phandle(dev->of_node, "backlight", 0);
350 panel->backlight = of_find_backlight_by_node(backlight);
351 of_node_put(backlight);
353 if (!panel->backlight)
354 return -EPROBE_DEFER;
357 ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
359 panel->ddc = of_find_i2c_adapter_by_node(ddc);
368 drm_panel_init(&panel->base);
369 panel->base.dev = dev;
370 panel->base.funcs = &panel_simple_funcs;
372 err = drm_panel_add(&panel->base);
376 dev_set_drvdata(dev, panel);
382 put_device(&panel->ddc->dev);
384 if (panel->backlight)
385 put_device(&panel->backlight->dev);
390 static int panel_simple_remove(struct device *dev)
392 struct panel_simple *panel = dev_get_drvdata(dev);
394 drm_panel_detach(&panel->base);
395 drm_panel_remove(&panel->base);
397 panel_simple_disable(&panel->base);
400 put_device(&panel->ddc->dev);
402 if (panel->backlight)
403 put_device(&panel->backlight->dev);
408 static void panel_simple_shutdown(struct device *dev)
410 struct panel_simple *panel = dev_get_drvdata(dev);
412 panel_simple_disable(&panel->base);
415 static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
418 .hsync_start = 800 + 0,
419 .hsync_end = 800 + 0 + 255,
420 .htotal = 800 + 0 + 255 + 0,
422 .vsync_start = 480 + 2,
423 .vsync_end = 480 + 2 + 45,
424 .vtotal = 480 + 2 + 45 + 0,
426 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
429 static const struct panel_desc ampire_am800480r3tmqwa1h = {
430 .modes = &ire_am800480r3tmqwa1h_mode,
437 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
440 static const struct drm_display_mode auo_b101aw03_mode = {
443 .hsync_start = 1024 + 156,
444 .hsync_end = 1024 + 156 + 8,
445 .htotal = 1024 + 156 + 8 + 156,
447 .vsync_start = 600 + 16,
448 .vsync_end = 600 + 16 + 6,
449 .vtotal = 600 + 16 + 6 + 16,
453 static const struct panel_desc auo_b101aw03 = {
454 .modes = &auo_b101aw03_mode,
463 static const struct drm_display_mode auo_b101ean01_mode = {
466 .hsync_start = 1280 + 119,
467 .hsync_end = 1280 + 119 + 32,
468 .htotal = 1280 + 119 + 32 + 21,
470 .vsync_start = 800 + 4,
471 .vsync_end = 800 + 4 + 20,
472 .vtotal = 800 + 4 + 20 + 8,
476 static const struct panel_desc auo_b101ean01 = {
477 .modes = &auo_b101ean01_mode,
486 static const struct drm_display_mode auo_b101ew05_mode = {
489 .hsync_start = 1280 + 18,
490 .hsync_end = 1280 + 18 + 10,
491 .htotal = 1280 + 18 + 10 + 100,
493 .vsync_start = 800 + 6,
494 .vsync_end = 800 + 6 + 2,
495 .vtotal = 800 + 6 + 2 + 8,
499 static const struct panel_desc auo_b101ew05 = {
500 .modes = &auo_b101ew05_mode,
509 static const struct drm_display_mode auo_b101xtn01_mode = {
512 .hsync_start = 1366 + 20,
513 .hsync_end = 1366 + 20 + 70,
514 .htotal = 1366 + 20 + 70,
516 .vsync_start = 768 + 14,
517 .vsync_end = 768 + 14 + 42,
518 .vtotal = 768 + 14 + 42,
520 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
523 static const struct panel_desc auo_b101xtn01 = {
524 .modes = &auo_b101xtn01_mode,
533 static const struct drm_display_mode auo_b116xw03_mode = {
536 .hsync_start = 1366 + 40,
537 .hsync_end = 1366 + 40 + 40,
538 .htotal = 1366 + 40 + 40 + 32,
540 .vsync_start = 768 + 10,
541 .vsync_end = 768 + 10 + 12,
542 .vtotal = 768 + 10 + 12 + 6,
546 static const struct panel_desc auo_b116xw03 = {
547 .modes = &auo_b116xw03_mode,
556 static const struct drm_display_mode auo_b125han03_mode = {
559 .hsync_start = 1920 + 88,
560 .hsync_end = 1920 + 88 + 60,
561 .htotal = 1920 + 88 + 60 + 36,
563 .vsync_start = 1080 + 12,
564 .vsync_end = 1080 + 12 + 4,
565 .vtotal = 1080 + 12 + 4 + 20,
567 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
570 static const struct panel_desc auo_b125han03 = {
571 .modes = &auo_b125han03_mode,
578 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
581 static const struct drm_display_mode auo_b133xtn01_mode = {
584 .hsync_start = 1366 + 48,
585 .hsync_end = 1366 + 48 + 32,
586 .htotal = 1366 + 48 + 32 + 20,
588 .vsync_start = 768 + 3,
589 .vsync_end = 768 + 3 + 6,
590 .vtotal = 768 + 3 + 6 + 13,
594 static const struct panel_desc auo_b133xtn01 = {
595 .modes = &auo_b133xtn01_mode,
604 static const struct drm_display_mode auo_b133htn01_mode = {
607 .hsync_start = 1920 + 172,
608 .hsync_end = 1920 + 172 + 80,
609 .htotal = 1920 + 172 + 80 + 60,
611 .vsync_start = 1080 + 25,
612 .vsync_end = 1080 + 25 + 10,
613 .vtotal = 1080 + 25 + 10 + 10,
617 static const struct panel_desc auo_b133htn01 = {
618 .modes = &auo_b133htn01_mode,
632 static const struct drm_display_mode avic_tm070ddh03_mode = {
635 .hsync_start = 1024 + 160,
636 .hsync_end = 1024 + 160 + 4,
637 .htotal = 1024 + 160 + 4 + 156,
639 .vsync_start = 600 + 17,
640 .vsync_end = 600 + 17 + 1,
641 .vtotal = 600 + 17 + 1 + 17,
645 static const struct panel_desc avic_tm070ddh03 = {
646 .modes = &avic_tm070ddh03_mode,
660 static const struct drm_display_mode boe_nv125fhm_n73_mode = {
663 .hsync_start = 1366 + 80,
664 .hsync_end = 1366 + 80 + 20,
665 .htotal = 1366 + 80 + 20 + 60,
667 .vsync_start = 768 + 12,
668 .vsync_end = 768 + 12 + 2,
669 .vtotal = 768 + 12 + 2 + 8,
671 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
674 static const struct panel_desc boe_nv125fhm_n73 = {
675 .modes = &boe_nv125fhm_n73_mode,
685 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
688 static const struct drm_display_mode chunghwa_claa070wp03xg_mode = {
691 .hsync_start = 800 + 24,
692 .hsync_end = 800 + 24 + 16,
693 .htotal = 800 + 24 + 16 + 24,
695 .vsync_start = 1280 + 2,
696 .vsync_end = 1280 + 2 + 2,
697 .vtotal = 1280 + 2 + 2 + 4,
701 static const struct panel_desc chunghwa_claa070wp03xg = {
702 .modes = &chunghwa_claa070wp03xg_mode,
711 static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
714 .hsync_start = 1366 + 58,
715 .hsync_end = 1366 + 58 + 58,
716 .htotal = 1366 + 58 + 58 + 58,
718 .vsync_start = 768 + 4,
719 .vsync_end = 768 + 4 + 4,
720 .vtotal = 768 + 4 + 4 + 4,
724 static const struct panel_desc chunghwa_claa101wa01a = {
725 .modes = &chunghwa_claa101wa01a_mode,
734 static const struct drm_display_mode chunghwa_claa101wb01_mode = {
737 .hsync_start = 1366 + 48,
738 .hsync_end = 1366 + 48 + 32,
739 .htotal = 1366 + 48 + 32 + 20,
741 .vsync_start = 768 + 16,
742 .vsync_end = 768 + 16 + 8,
743 .vtotal = 768 + 16 + 8 + 16,
747 static const struct panel_desc chunghwa_claa101wb01 = {
748 .modes = &chunghwa_claa101wb01_mode,
757 static const struct drm_display_mode edt_et057090dhu_mode = {
760 .hsync_start = 640 + 16,
761 .hsync_end = 640 + 16 + 30,
762 .htotal = 640 + 16 + 30 + 114,
764 .vsync_start = 480 + 10,
765 .vsync_end = 480 + 10 + 3,
766 .vtotal = 480 + 10 + 3 + 32,
768 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
771 static const struct panel_desc edt_et057090dhu = {
772 .modes = &edt_et057090dhu_mode,
781 static const struct drm_display_mode edt_etm0700g0dh6_mode = {
784 .hsync_start = 800 + 40,
785 .hsync_end = 800 + 40 + 128,
786 .htotal = 800 + 40 + 128 + 88,
788 .vsync_start = 480 + 10,
789 .vsync_end = 480 + 10 + 2,
790 .vtotal = 480 + 10 + 2 + 33,
792 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
795 static const struct panel_desc edt_etm0700g0dh6 = {
796 .modes = &edt_etm0700g0dh6_mode,
805 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
808 .hsync_start = 800 + 168,
809 .hsync_end = 800 + 168 + 64,
810 .htotal = 800 + 168 + 64 + 88,
812 .vsync_start = 480 + 37,
813 .vsync_end = 480 + 37 + 2,
814 .vtotal = 480 + 37 + 2 + 8,
818 static const struct panel_desc foxlink_fl500wvr00_a0t = {
819 .modes = &foxlink_fl500wvr00_a0t_mode,
826 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
829 static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
832 .hsync_start = 480 + 5,
833 .hsync_end = 480 + 5 + 1,
834 .htotal = 480 + 5 + 1 + 40,
836 .vsync_start = 272 + 8,
837 .vsync_end = 272 + 8 + 1,
838 .vtotal = 272 + 8 + 1 + 8,
842 static const struct panel_desc giantplus_gpg482739qs5 = {
843 .modes = &giantplus_gpg482739qs5_mode,
850 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
853 static const struct display_timing hannstar_hsd070pww1_timing = {
854 .pixelclock = { 64300000, 71100000, 82000000 },
855 .hactive = { 1280, 1280, 1280 },
856 .hfront_porch = { 1, 1, 10 },
857 .hback_porch = { 1, 1, 10 },
859 * According to the data sheet, the minimum horizontal blanking interval
860 * is 54 clocks (1 + 52 + 1), but tests with a Nitrogen6X have shown the
861 * minimum working horizontal blanking interval to be 60 clocks.
863 .hsync_len = { 58, 158, 661 },
864 .vactive = { 800, 800, 800 },
865 .vfront_porch = { 1, 1, 10 },
866 .vback_porch = { 1, 1, 10 },
867 .vsync_len = { 1, 21, 203 },
868 .flags = DISPLAY_FLAGS_DE_HIGH,
871 static const struct panel_desc hannstar_hsd070pww1 = {
872 .timings = &hannstar_hsd070pww1_timing,
879 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
882 static const struct display_timing hannstar_hsd100pxn1_timing = {
883 .pixelclock = { 55000000, 65000000, 75000000 },
884 .hactive = { 1024, 1024, 1024 },
885 .hfront_porch = { 40, 40, 40 },
886 .hback_porch = { 220, 220, 220 },
887 .hsync_len = { 20, 60, 100 },
888 .vactive = { 768, 768, 768 },
889 .vfront_porch = { 7, 7, 7 },
890 .vback_porch = { 21, 21, 21 },
891 .vsync_len = { 10, 10, 10 },
892 .flags = DISPLAY_FLAGS_DE_HIGH,
895 static const struct panel_desc hannstar_hsd100pxn1 = {
896 .timings = &hannstar_hsd100pxn1_timing,
903 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
906 static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
909 .hsync_start = 800 + 85,
910 .hsync_end = 800 + 85 + 86,
911 .htotal = 800 + 85 + 86 + 85,
913 .vsync_start = 480 + 16,
914 .vsync_end = 480 + 16 + 13,
915 .vtotal = 480 + 16 + 13 + 16,
919 static const struct panel_desc hitachi_tx23d38vm0caa = {
920 .modes = &hitachi_tx23d38vm0caa_mode,
929 static const struct drm_display_mode innolux_at043tn24_mode = {
932 .hsync_start = 480 + 2,
933 .hsync_end = 480 + 2 + 41,
934 .htotal = 480 + 2 + 41 + 2,
936 .vsync_start = 272 + 2,
937 .vsync_end = 272 + 2 + 11,
938 .vtotal = 272 + 2 + 11 + 2,
940 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
943 static const struct panel_desc innolux_at043tn24 = {
944 .modes = &innolux_at043tn24_mode,
951 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
954 static const struct drm_display_mode innolux_g121i1_l01_mode = {
957 .hsync_start = 1280 + 64,
958 .hsync_end = 1280 + 64 + 32,
959 .htotal = 1280 + 64 + 32 + 64,
961 .vsync_start = 800 + 9,
962 .vsync_end = 800 + 9 + 6,
963 .vtotal = 800 + 9 + 6 + 9,
967 static const struct panel_desc innolux_g121i1_l01 = {
968 .modes = &innolux_g121i1_l01_mode,
977 static const struct drm_display_mode innolux_n116bge_mode = {
980 .hsync_start = 1366 + 136,
981 .hsync_end = 1366 + 136 + 30,
982 .htotal = 1366 + 136 + 30 + 60,
984 .vsync_start = 768 + 8,
985 .vsync_end = 768 + 8 + 12,
986 .vtotal = 768 + 8 + 12 + 12,
988 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
991 static const struct panel_desc innolux_n116bge = {
992 .modes = &innolux_n116bge_mode,
1001 static const struct drm_display_mode innolux_n156bge_l21_mode = {
1004 .hsync_start = 1366 + 16,
1005 .hsync_end = 1366 + 16 + 34,
1006 .htotal = 1366 + 16 + 34 + 50,
1008 .vsync_start = 768 + 2,
1009 .vsync_end = 768 + 2 + 6,
1010 .vtotal = 768 + 2 + 6 + 12,
1014 static const struct panel_desc innolux_n156bge_l21 = {
1015 .modes = &innolux_n156bge_l21_mode,
1024 static const struct drm_display_mode innolux_zj070na_01p_mode = {
1027 .hsync_start = 1024 + 128,
1028 .hsync_end = 1024 + 128 + 64,
1029 .htotal = 1024 + 128 + 64 + 128,
1031 .vsync_start = 600 + 16,
1032 .vsync_end = 600 + 16 + 4,
1033 .vtotal = 600 + 16 + 4 + 16,
1037 static const struct panel_desc innolux_zj070na_01p = {
1038 .modes = &innolux_zj070na_01p_mode,
1047 static const struct drm_display_mode lg_lb070wv8_mode = {
1050 .hsync_start = 800 + 88,
1051 .hsync_end = 800 + 88 + 80,
1052 .htotal = 800 + 88 + 80 + 88,
1054 .vsync_start = 480 + 10,
1055 .vsync_end = 480 + 10 + 25,
1056 .vtotal = 480 + 10 + 25 + 10,
1060 static const struct panel_desc lg_lb070wv8 = {
1061 .modes = &lg_lb070wv8_mode,
1068 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1071 static const struct drm_display_mode lg_lp079qx1_sp0v_mode = {
1074 .hsync_start = 1536 + 12,
1075 .hsync_end = 1536 + 12 + 16,
1076 .htotal = 1536 + 12 + 16 + 48,
1078 .vsync_start = 2048 + 8,
1079 .vsync_end = 2048 + 8 + 4,
1080 .vtotal = 2048 + 8 + 4 + 8,
1082 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1085 static const struct panel_desc lg_lp079qx1_sp0v = {
1086 .modes = &lg_lp079qx1_sp0v_mode,
1092 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1095 static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
1098 .hsync_start = 2048 + 150,
1099 .hsync_end = 2048 + 150 + 5,
1100 .htotal = 2048 + 150 + 5 + 5,
1102 .vsync_start = 1536 + 3,
1103 .vsync_end = 1536 + 3 + 1,
1104 .vtotal = 1536 + 3 + 1 + 9,
1108 static const struct panel_desc lg_lp097qx1_spa1 = {
1109 .modes = &lg_lp097qx1_spa1_mode,
1117 static const struct drm_display_mode lg_lp129qe_mode = {
1120 .hsync_start = 2560 + 48,
1121 .hsync_end = 2560 + 48 + 32,
1122 .htotal = 2560 + 48 + 32 + 80,
1124 .vsync_start = 1700 + 3,
1125 .vsync_end = 1700 + 3 + 10,
1126 .vtotal = 1700 + 3 + 10 + 36,
1130 static const struct panel_desc lg_lp129qe = {
1131 .modes = &lg_lp129qe_mode,
1140 static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
1143 .hsync_start = 480 + 2,
1144 .hsync_end = 480 + 2 + 41,
1145 .htotal = 480 + 2 + 41 + 2,
1147 .vsync_start = 272 + 2,
1148 .vsync_end = 272 + 2 + 4,
1149 .vtotal = 272 + 2 + 4 + 2,
1153 static const struct panel_desc nec_nl4827hc19_05b = {
1154 .modes = &nec_nl4827hc19_05b_mode,
1161 .bus_format = MEDIA_BUS_FMT_RGB888_1X24
1164 static const struct display_timing okaya_rs800480t_7x0gp_timing = {
1165 .pixelclock = { 30000000, 30000000, 40000000 },
1166 .hactive = { 800, 800, 800 },
1167 .hfront_porch = { 40, 40, 40 },
1168 .hback_porch = { 40, 40, 40 },
1169 .hsync_len = { 1, 48, 48 },
1170 .vactive = { 480, 480, 480 },
1171 .vfront_porch = { 13, 13, 13 },
1172 .vback_porch = { 29, 29, 29 },
1173 .vsync_len = { 3, 3, 3 },
1174 .flags = DISPLAY_FLAGS_DE_HIGH,
1177 static const struct panel_desc okaya_rs800480t_7x0gp = {
1178 .timings = &okaya_rs800480t_7x0gp_timing,
1191 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1194 static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
1197 .hsync_start = 480 + 10,
1198 .hsync_end = 480 + 10 + 10,
1199 .htotal = 480 + 10 + 10 + 15,
1201 .vsync_start = 800 + 3,
1202 .vsync_end = 800 + 3 + 3,
1203 .vtotal = 800 + 3 + 3 + 3,
1207 static const struct panel_desc ortustech_com43h4m85ulc = {
1208 .modes = &ortustech_com43h4m85ulc_mode,
1215 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1218 static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
1221 .hsync_start = 2560 + 48,
1222 .hsync_end = 2560 + 48 + 32,
1223 .htotal = 2560 + 48 + 32 + 80,
1225 .vsync_start = 1600 + 2,
1226 .vsync_end = 1600 + 2 + 5,
1227 .vtotal = 1600 + 2 + 5 + 57,
1231 static const struct panel_desc samsung_lsn122dl01_c01 = {
1232 .modes = &samsung_lsn122dl01_c01_mode,
1240 static const struct drm_display_mode samsung_ltn101nt05_mode = {
1243 .hsync_start = 1024 + 24,
1244 .hsync_end = 1024 + 24 + 136,
1245 .htotal = 1024 + 24 + 136 + 160,
1247 .vsync_start = 600 + 3,
1248 .vsync_end = 600 + 3 + 6,
1249 .vtotal = 600 + 3 + 6 + 61,
1253 static const struct panel_desc samsung_ltn101nt05 = {
1254 .modes = &samsung_ltn101nt05_mode,
1263 static const struct drm_display_mode samsung_ltn140at29_301_mode = {
1266 .hsync_start = 1366 + 64,
1267 .hsync_end = 1366 + 64 + 48,
1268 .htotal = 1366 + 64 + 48 + 128,
1270 .vsync_start = 768 + 2,
1271 .vsync_end = 768 + 2 + 5,
1272 .vtotal = 768 + 2 + 5 + 17,
1276 static const struct panel_desc samsung_ltn140at29_301 = {
1277 .modes = &samsung_ltn140at29_301_mode,
1286 static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
1289 .hsync_start = 800 + 1,
1290 .hsync_end = 800 + 1 + 64,
1291 .htotal = 800 + 1 + 64 + 64,
1293 .vsync_start = 480 + 1,
1294 .vsync_end = 480 + 1 + 23,
1295 .vtotal = 480 + 1 + 23 + 22,
1299 static const struct panel_desc shelly_sca07010_bfn_lnn = {
1300 .modes = &shelly_sca07010_bfn_lnn_mode,
1306 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1309 static const struct of_device_id platform_of_match[] = {
1311 .compatible = "simple-panel",
1314 .compatible = "ampire,am800480r3tmqwa1h",
1315 .data = &ire_am800480r3tmqwa1h,
1317 .compatible = "auo,b101aw03",
1318 .data = &auo_b101aw03,
1320 .compatible = "auo,b101ean01",
1321 .data = &auo_b101ean01,
1323 .compatible = "auo,b101ew05",
1324 .data = &auo_b101ew05,
1326 .compatible = "auo,b101xtn01",
1327 .data = &auo_b101xtn01,
1329 .compatible = "auo,b116xw03",
1330 .data = &auo_b116xw03,
1332 .compatible = "auo,b125han03",
1333 .data = &auo_b125han03,
1335 .compatible = "auo,b133htn01",
1336 .data = &auo_b133htn01,
1338 .compatible = "auo,b133xtn01",
1339 .data = &auo_b133xtn01,
1341 .compatible = "avic,tm070ddh03",
1342 .data = &avic_tm070ddh03,
1344 .compatible = "boe,nv125fhm-n73",
1345 .data = &boe_nv125fhm_n73,
1347 .compatible = "chunghwa,claa070wp03xg",
1348 .data = &chunghwa_claa070wp03xg,
1350 .compatible = "chunghwa,claa101wa01a",
1351 .data = &chunghwa_claa101wa01a
1353 .compatible = "chunghwa,claa101wb01",
1354 .data = &chunghwa_claa101wb01
1356 .compatible = "edt,et057090dhu",
1357 .data = &edt_et057090dhu,
1359 .compatible = "edt,et070080dh6",
1360 .data = &edt_etm0700g0dh6,
1362 .compatible = "edt,etm0700g0dh6",
1363 .data = &edt_etm0700g0dh6,
1365 .compatible = "foxlink,fl500wvr00-a0t",
1366 .data = &foxlink_fl500wvr00_a0t,
1368 .compatible = "giantplus,gpg482739qs5",
1369 .data = &giantplus_gpg482739qs5
1371 .compatible = "hannstar,hsd070pww1",
1372 .data = &hannstar_hsd070pww1,
1374 .compatible = "hannstar,hsd100pxn1",
1375 .data = &hannstar_hsd100pxn1,
1377 .compatible = "hit,tx23d38vm0caa",
1378 .data = &hitachi_tx23d38vm0caa
1380 .compatible = "innolux,at043tn24",
1381 .data = &innolux_at043tn24,
1383 .compatible ="innolux,g121i1-l01",
1384 .data = &innolux_g121i1_l01
1386 .compatible = "innolux,n116bge",
1387 .data = &innolux_n116bge,
1389 .compatible = "innolux,n156bge-l21",
1390 .data = &innolux_n156bge_l21,
1392 .compatible = "innolux,zj070na-01p",
1393 .data = &innolux_zj070na_01p,
1395 .compatible = "lg,lb070wv8",
1396 .data = &lg_lb070wv8,
1398 .compatible = "lg,lp079qx1-sp0v",
1399 .data = &lg_lp079qx1_sp0v,
1401 .compatible = "lg,lp097qx1-spa1",
1402 .data = &lg_lp097qx1_spa1,
1404 .compatible = "lg,lp129qe",
1405 .data = &lg_lp129qe,
1407 .compatible = "nec,nl4827hc19-05b",
1408 .data = &nec_nl4827hc19_05b,
1410 .compatible = "okaya,rs800480t-7x0gp",
1411 .data = &okaya_rs800480t_7x0gp,
1413 .compatible = "ortustech,com43h4m85ulc",
1414 .data = &ortustech_com43h4m85ulc,
1416 .compatible = "samsung,lsn122dl01-c01",
1417 .data = &samsung_lsn122dl01_c01,
1419 .compatible = "samsung,ltn101nt05",
1420 .data = &samsung_ltn101nt05,
1422 .compatible = "samsung,ltn140at29-301",
1423 .data = &samsung_ltn140at29_301,
1425 .compatible = "shelly,sca07010-bfn-lnn",
1426 .data = &shelly_sca07010_bfn_lnn,
1431 MODULE_DEVICE_TABLE(of, platform_of_match);
1433 static int panel_simple_platform_probe(struct platform_device *pdev)
1435 const struct of_device_id *id;
1437 id = of_match_node(platform_of_match, pdev->dev.of_node);
1441 return panel_simple_probe(&pdev->dev, id->data);
1444 static int panel_simple_platform_remove(struct platform_device *pdev)
1446 return panel_simple_remove(&pdev->dev);
1449 static void panel_simple_platform_shutdown(struct platform_device *pdev)
1451 panel_simple_shutdown(&pdev->dev);
1454 static struct platform_driver panel_simple_platform_driver = {
1456 .name = "panel-simple",
1457 .of_match_table = platform_of_match,
1459 .probe = panel_simple_platform_probe,
1460 .remove = panel_simple_platform_remove,
1461 .shutdown = panel_simple_platform_shutdown,
1464 struct panel_desc_dsi {
1465 struct panel_desc desc;
1467 unsigned long flags;
1468 enum mipi_dsi_pixel_format format;
1472 static const struct drm_display_mode auo_b080uan01_mode = {
1475 .hsync_start = 1200 + 62,
1476 .hsync_end = 1200 + 62 + 4,
1477 .htotal = 1200 + 62 + 4 + 62,
1479 .vsync_start = 1920 + 9,
1480 .vsync_end = 1920 + 9 + 2,
1481 .vtotal = 1920 + 9 + 2 + 8,
1485 static const struct panel_desc_dsi auo_b080uan01 = {
1487 .modes = &auo_b080uan01_mode,
1495 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1496 .format = MIPI_DSI_FMT_RGB888,
1500 static const struct drm_display_mode boe_tv080wum_nl0_mode = {
1503 .hsync_start = 1200 + 120,
1504 .hsync_end = 1200 + 120 + 20,
1505 .htotal = 1200 + 120 + 20 + 21,
1507 .vsync_start = 1920 + 21,
1508 .vsync_end = 1920 + 21 + 3,
1509 .vtotal = 1920 + 21 + 3 + 18,
1511 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1514 static const struct panel_desc_dsi boe_tv080wum_nl0 = {
1516 .modes = &boe_tv080wum_nl0_mode,
1523 .flags = MIPI_DSI_MODE_VIDEO |
1524 MIPI_DSI_MODE_VIDEO_BURST |
1525 MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
1526 .format = MIPI_DSI_FMT_RGB888,
1530 static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
1533 .hsync_start = 800 + 32,
1534 .hsync_end = 800 + 32 + 1,
1535 .htotal = 800 + 32 + 1 + 57,
1537 .vsync_start = 1280 + 28,
1538 .vsync_end = 1280 + 28 + 1,
1539 .vtotal = 1280 + 28 + 1 + 14,
1543 static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
1545 .modes = &lg_ld070wx3_sl01_mode,
1553 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1554 .format = MIPI_DSI_FMT_RGB888,
1558 static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
1561 .hsync_start = 720 + 12,
1562 .hsync_end = 720 + 12 + 4,
1563 .htotal = 720 + 12 + 4 + 112,
1565 .vsync_start = 1280 + 8,
1566 .vsync_end = 1280 + 8 + 4,
1567 .vtotal = 1280 + 8 + 4 + 12,
1571 static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
1573 .modes = &lg_lh500wx1_sd03_mode,
1581 .flags = MIPI_DSI_MODE_VIDEO,
1582 .format = MIPI_DSI_FMT_RGB888,
1586 static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
1589 .hsync_start = 1920 + 154,
1590 .hsync_end = 1920 + 154 + 16,
1591 .htotal = 1920 + 154 + 16 + 32,
1593 .vsync_start = 1200 + 17,
1594 .vsync_end = 1200 + 17 + 2,
1595 .vtotal = 1200 + 17 + 2 + 16,
1599 static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
1601 .modes = &panasonic_vvx10f004b00_mode,
1609 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
1610 MIPI_DSI_CLOCK_NON_CONTINUOUS,
1611 .format = MIPI_DSI_FMT_RGB888,
1616 static const struct of_device_id dsi_of_match[] = {
1618 .compatible = "simple-panel-dsi",
1621 .compatible = "auo,b080uan01",
1622 .data = &auo_b080uan01
1624 .compatible = "boe,tv080wum-nl0",
1625 .data = &boe_tv080wum_nl0
1627 .compatible = "lg,ld070wx3-sl01",
1628 .data = &lg_ld070wx3_sl01
1630 .compatible = "lg,lh500wx1-sd03",
1631 .data = &lg_lh500wx1_sd03
1633 .compatible = "panasonic,vvx10f004b00",
1634 .data = &panasonic_vvx10f004b00
1639 MODULE_DEVICE_TABLE(of, dsi_of_match);
1641 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
1643 const struct panel_desc_dsi *desc;
1644 const struct of_device_id *id;
1645 const struct panel_desc *pdesc;
1649 id = of_match_node(dsi_of_match, dsi->dev.of_node);
1656 dsi->mode_flags = desc->flags;
1657 dsi->format = desc->format;
1658 dsi->lanes = desc->lanes;
1659 pdesc = &desc->desc;
1664 err = panel_simple_probe(&dsi->dev, pdesc);
1668 if (!of_property_read_u32(dsi->dev.of_node, "dsi,flags", &val))
1669 dsi->mode_flags = val;
1671 if (!of_property_read_u32(dsi->dev.of_node, "dsi,format", &val))
1674 if (!of_property_read_u32(dsi->dev.of_node, "dsi,lanes", &val))
1677 return mipi_dsi_attach(dsi);
1680 static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
1684 err = mipi_dsi_detach(dsi);
1686 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
1688 return panel_simple_remove(&dsi->dev);
1691 static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
1693 panel_simple_shutdown(&dsi->dev);
1696 static struct mipi_dsi_driver panel_simple_dsi_driver = {
1698 .name = "panel-simple-dsi",
1699 .of_match_table = dsi_of_match,
1701 .probe = panel_simple_dsi_probe,
1702 .remove = panel_simple_dsi_remove,
1703 .shutdown = panel_simple_dsi_shutdown,
1706 static int __init panel_simple_init(void)
1710 err = platform_driver_register(&panel_simple_platform_driver);
1714 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
1715 err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
1722 module_init(panel_simple_init);
1724 static void __exit panel_simple_exit(void)
1726 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
1727 mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
1729 platform_driver_unregister(&panel_simple_platform_driver);
1731 module_exit(panel_simple_exit);
1733 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1734 MODULE_DESCRIPTION("DRM Driver for Simple Panels");
1735 MODULE_LICENSE("GPL and additional rights");