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);
355 panel_simple_unprepare(&panel->base);
358 put_device(&panel->ddc->dev);
360 if (panel->backlight)
361 put_device(&panel->backlight->dev);
366 static void panel_simple_shutdown(struct device *dev)
368 struct panel_simple *panel = dev_get_drvdata(dev);
370 panel_simple_disable(&panel->base);
371 panel_simple_unprepare(&panel->base);
374 static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
377 .hsync_start = 800 + 0,
378 .hsync_end = 800 + 0 + 255,
379 .htotal = 800 + 0 + 255 + 0,
381 .vsync_start = 480 + 2,
382 .vsync_end = 480 + 2 + 45,
383 .vtotal = 480 + 2 + 45 + 0,
385 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
388 static const struct panel_desc ampire_am800480r3tmqwa1h = {
389 .modes = &ire_am800480r3tmqwa1h_mode,
396 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
399 static const struct drm_display_mode auo_b101aw03_mode = {
402 .hsync_start = 1024 + 156,
403 .hsync_end = 1024 + 156 + 8,
404 .htotal = 1024 + 156 + 8 + 156,
406 .vsync_start = 600 + 16,
407 .vsync_end = 600 + 16 + 6,
408 .vtotal = 600 + 16 + 6 + 16,
412 static const struct panel_desc auo_b101aw03 = {
413 .modes = &auo_b101aw03_mode,
422 static const struct drm_display_mode auo_b101ean01_mode = {
425 .hsync_start = 1280 + 119,
426 .hsync_end = 1280 + 119 + 32,
427 .htotal = 1280 + 119 + 32 + 21,
429 .vsync_start = 800 + 4,
430 .vsync_end = 800 + 4 + 20,
431 .vtotal = 800 + 4 + 20 + 8,
435 static const struct panel_desc auo_b101ean01 = {
436 .modes = &auo_b101ean01_mode,
445 static const struct drm_display_mode auo_b101xtn01_mode = {
448 .hsync_start = 1366 + 20,
449 .hsync_end = 1366 + 20 + 70,
450 .htotal = 1366 + 20 + 70,
452 .vsync_start = 768 + 14,
453 .vsync_end = 768 + 14 + 42,
454 .vtotal = 768 + 14 + 42,
456 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
459 static const struct panel_desc auo_b101xtn01 = {
460 .modes = &auo_b101xtn01_mode,
469 static const struct drm_display_mode auo_b116xw03_mode = {
472 .hsync_start = 1366 + 40,
473 .hsync_end = 1366 + 40 + 40,
474 .htotal = 1366 + 40 + 40 + 32,
476 .vsync_start = 768 + 10,
477 .vsync_end = 768 + 10 + 12,
478 .vtotal = 768 + 10 + 12 + 6,
482 static const struct panel_desc auo_b116xw03 = {
483 .modes = &auo_b116xw03_mode,
492 static const struct drm_display_mode auo_b133xtn01_mode = {
495 .hsync_start = 1366 + 48,
496 .hsync_end = 1366 + 48 + 32,
497 .htotal = 1366 + 48 + 32 + 20,
499 .vsync_start = 768 + 3,
500 .vsync_end = 768 + 3 + 6,
501 .vtotal = 768 + 3 + 6 + 13,
505 static const struct panel_desc auo_b133xtn01 = {
506 .modes = &auo_b133xtn01_mode,
515 static const struct drm_display_mode auo_b133htn01_mode = {
518 .hsync_start = 1920 + 172,
519 .hsync_end = 1920 + 172 + 80,
520 .htotal = 1920 + 172 + 80 + 60,
522 .vsync_start = 1080 + 25,
523 .vsync_end = 1080 + 25 + 10,
524 .vtotal = 1080 + 25 + 10 + 10,
528 static const struct panel_desc auo_b133htn01 = {
529 .modes = &auo_b133htn01_mode,
543 static const struct drm_display_mode avic_tm070ddh03_mode = {
546 .hsync_start = 1024 + 160,
547 .hsync_end = 1024 + 160 + 4,
548 .htotal = 1024 + 160 + 4 + 156,
550 .vsync_start = 600 + 17,
551 .vsync_end = 600 + 17 + 1,
552 .vtotal = 600 + 17 + 1 + 17,
556 static const struct panel_desc avic_tm070ddh03 = {
557 .modes = &avic_tm070ddh03_mode,
571 static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
574 .hsync_start = 1366 + 58,
575 .hsync_end = 1366 + 58 + 58,
576 .htotal = 1366 + 58 + 58 + 58,
578 .vsync_start = 768 + 4,
579 .vsync_end = 768 + 4 + 4,
580 .vtotal = 768 + 4 + 4 + 4,
584 static const struct panel_desc chunghwa_claa101wa01a = {
585 .modes = &chunghwa_claa101wa01a_mode,
594 static const struct drm_display_mode chunghwa_claa101wb01_mode = {
597 .hsync_start = 1366 + 48,
598 .hsync_end = 1366 + 48 + 32,
599 .htotal = 1366 + 48 + 32 + 20,
601 .vsync_start = 768 + 16,
602 .vsync_end = 768 + 16 + 8,
603 .vtotal = 768 + 16 + 8 + 16,
607 static const struct panel_desc chunghwa_claa101wb01 = {
608 .modes = &chunghwa_claa101wb01_mode,
617 static const struct drm_display_mode edt_et057090dhu_mode = {
620 .hsync_start = 640 + 16,
621 .hsync_end = 640 + 16 + 30,
622 .htotal = 640 + 16 + 30 + 114,
624 .vsync_start = 480 + 10,
625 .vsync_end = 480 + 10 + 3,
626 .vtotal = 480 + 10 + 3 + 32,
628 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
631 static const struct panel_desc edt_et057090dhu = {
632 .modes = &edt_et057090dhu_mode,
641 static const struct drm_display_mode edt_etm0700g0dh6_mode = {
644 .hsync_start = 800 + 40,
645 .hsync_end = 800 + 40 + 128,
646 .htotal = 800 + 40 + 128 + 88,
648 .vsync_start = 480 + 10,
649 .vsync_end = 480 + 10 + 2,
650 .vtotal = 480 + 10 + 2 + 33,
652 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
655 static const struct panel_desc edt_etm0700g0dh6 = {
656 .modes = &edt_etm0700g0dh6_mode,
665 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
668 .hsync_start = 800 + 168,
669 .hsync_end = 800 + 168 + 64,
670 .htotal = 800 + 168 + 64 + 88,
672 .vsync_start = 480 + 37,
673 .vsync_end = 480 + 37 + 2,
674 .vtotal = 480 + 37 + 2 + 8,
678 static const struct panel_desc foxlink_fl500wvr00_a0t = {
679 .modes = &foxlink_fl500wvr00_a0t_mode,
686 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
689 static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
692 .hsync_start = 480 + 5,
693 .hsync_end = 480 + 5 + 1,
694 .htotal = 480 + 5 + 1 + 40,
696 .vsync_start = 272 + 8,
697 .vsync_end = 272 + 8 + 1,
698 .vtotal = 272 + 8 + 1 + 8,
702 static const struct panel_desc giantplus_gpg482739qs5 = {
703 .modes = &giantplus_gpg482739qs5_mode,
710 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
713 static const struct display_timing hannstar_hsd070pww1_timing = {
714 .pixelclock = { 64300000, 71100000, 82000000 },
715 .hactive = { 1280, 1280, 1280 },
716 .hfront_porch = { 1, 1, 10 },
717 .hback_porch = { 1, 1, 10 },
719 * According to the data sheet, the minimum horizontal blanking interval
720 * is 54 clocks (1 + 52 + 1), but tests with a Nitrogen6X have shown the
721 * minimum working horizontal blanking interval to be 60 clocks.
723 .hsync_len = { 58, 158, 661 },
724 .vactive = { 800, 800, 800 },
725 .vfront_porch = { 1, 1, 10 },
726 .vback_porch = { 1, 1, 10 },
727 .vsync_len = { 1, 21, 203 },
728 .flags = DISPLAY_FLAGS_DE_HIGH,
731 static const struct panel_desc hannstar_hsd070pww1 = {
732 .timings = &hannstar_hsd070pww1_timing,
739 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
742 static const struct display_timing hannstar_hsd100pxn1_timing = {
743 .pixelclock = { 55000000, 65000000, 75000000 },
744 .hactive = { 1024, 1024, 1024 },
745 .hfront_porch = { 40, 40, 40 },
746 .hback_porch = { 220, 220, 220 },
747 .hsync_len = { 20, 60, 100 },
748 .vactive = { 768, 768, 768 },
749 .vfront_porch = { 7, 7, 7 },
750 .vback_porch = { 21, 21, 21 },
751 .vsync_len = { 10, 10, 10 },
752 .flags = DISPLAY_FLAGS_DE_HIGH,
755 static const struct panel_desc hannstar_hsd100pxn1 = {
756 .timings = &hannstar_hsd100pxn1_timing,
763 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
766 static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
769 .hsync_start = 800 + 85,
770 .hsync_end = 800 + 85 + 86,
771 .htotal = 800 + 85 + 86 + 85,
773 .vsync_start = 480 + 16,
774 .vsync_end = 480 + 16 + 13,
775 .vtotal = 480 + 16 + 13 + 16,
779 static const struct panel_desc hitachi_tx23d38vm0caa = {
780 .modes = &hitachi_tx23d38vm0caa_mode,
789 static const struct drm_display_mode innolux_at043tn24_mode = {
792 .hsync_start = 480 + 2,
793 .hsync_end = 480 + 2 + 41,
794 .htotal = 480 + 2 + 41 + 2,
796 .vsync_start = 272 + 2,
797 .vsync_end = 272 + 2 + 11,
798 .vtotal = 272 + 2 + 11 + 2,
800 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
803 static const struct panel_desc innolux_at043tn24 = {
804 .modes = &innolux_at043tn24_mode,
811 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
814 static const struct drm_display_mode innolux_g121i1_l01_mode = {
817 .hsync_start = 1280 + 64,
818 .hsync_end = 1280 + 64 + 32,
819 .htotal = 1280 + 64 + 32 + 64,
821 .vsync_start = 800 + 9,
822 .vsync_end = 800 + 9 + 6,
823 .vtotal = 800 + 9 + 6 + 9,
827 static const struct panel_desc innolux_g121i1_l01 = {
828 .modes = &innolux_g121i1_l01_mode,
837 static const struct drm_display_mode innolux_n116bge_mode = {
840 .hsync_start = 1366 + 136,
841 .hsync_end = 1366 + 136 + 30,
842 .htotal = 1366 + 136 + 30 + 60,
844 .vsync_start = 768 + 8,
845 .vsync_end = 768 + 8 + 12,
846 .vtotal = 768 + 8 + 12 + 12,
848 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
851 static const struct panel_desc innolux_n116bge = {
852 .modes = &innolux_n116bge_mode,
861 static const struct drm_display_mode innolux_n156bge_l21_mode = {
864 .hsync_start = 1366 + 16,
865 .hsync_end = 1366 + 16 + 34,
866 .htotal = 1366 + 16 + 34 + 50,
868 .vsync_start = 768 + 2,
869 .vsync_end = 768 + 2 + 6,
870 .vtotal = 768 + 2 + 6 + 12,
874 static const struct panel_desc innolux_n156bge_l21 = {
875 .modes = &innolux_n156bge_l21_mode,
884 static const struct drm_display_mode innolux_zj070na_01p_mode = {
887 .hsync_start = 1024 + 128,
888 .hsync_end = 1024 + 128 + 64,
889 .htotal = 1024 + 128 + 64 + 128,
891 .vsync_start = 600 + 16,
892 .vsync_end = 600 + 16 + 4,
893 .vtotal = 600 + 16 + 4 + 16,
897 static const struct panel_desc innolux_zj070na_01p = {
898 .modes = &innolux_zj070na_01p_mode,
907 static const struct drm_display_mode lg_lb070wv8_mode = {
910 .hsync_start = 800 + 88,
911 .hsync_end = 800 + 88 + 80,
912 .htotal = 800 + 88 + 80 + 88,
914 .vsync_start = 480 + 10,
915 .vsync_end = 480 + 10 + 25,
916 .vtotal = 480 + 10 + 25 + 10,
920 static const struct panel_desc lg_lb070wv8 = {
921 .modes = &lg_lb070wv8_mode,
928 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
931 static const struct drm_display_mode lg_lp129qe_mode = {
934 .hsync_start = 2560 + 48,
935 .hsync_end = 2560 + 48 + 32,
936 .htotal = 2560 + 48 + 32 + 80,
938 .vsync_start = 1700 + 3,
939 .vsync_end = 1700 + 3 + 10,
940 .vtotal = 1700 + 3 + 10 + 36,
944 static const struct panel_desc lg_lp129qe = {
945 .modes = &lg_lp129qe_mode,
954 static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
957 .hsync_start = 480 + 2,
958 .hsync_end = 480 + 2 + 41,
959 .htotal = 480 + 2 + 41 + 2,
961 .vsync_start = 272 + 2,
962 .vsync_end = 272 + 2 + 4,
963 .vtotal = 272 + 2 + 4 + 2,
967 static const struct panel_desc nec_nl4827hc19_05b = {
968 .modes = &nec_nl4827hc19_05b_mode,
975 .bus_format = MEDIA_BUS_FMT_RGB888_1X24
978 static const struct display_timing okaya_rs800480t_7x0gp_timing = {
979 .pixelclock = { 30000000, 30000000, 40000000 },
980 .hactive = { 800, 800, 800 },
981 .hfront_porch = { 40, 40, 40 },
982 .hback_porch = { 40, 40, 40 },
983 .hsync_len = { 1, 48, 48 },
984 .vactive = { 480, 480, 480 },
985 .vfront_porch = { 13, 13, 13 },
986 .vback_porch = { 29, 29, 29 },
987 .vsync_len = { 3, 3, 3 },
988 .flags = DISPLAY_FLAGS_DE_HIGH,
991 static const struct panel_desc okaya_rs800480t_7x0gp = {
992 .timings = &okaya_rs800480t_7x0gp_timing,
1005 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1008 static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
1011 .hsync_start = 480 + 10,
1012 .hsync_end = 480 + 10 + 10,
1013 .htotal = 480 + 10 + 10 + 15,
1015 .vsync_start = 800 + 3,
1016 .vsync_end = 800 + 3 + 3,
1017 .vtotal = 800 + 3 + 3 + 3,
1021 static const struct panel_desc ortustech_com43h4m85ulc = {
1022 .modes = &ortustech_com43h4m85ulc_mode,
1029 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1032 static const struct drm_display_mode samsung_ltn101nt05_mode = {
1035 .hsync_start = 1024 + 24,
1036 .hsync_end = 1024 + 24 + 136,
1037 .htotal = 1024 + 24 + 136 + 160,
1039 .vsync_start = 600 + 3,
1040 .vsync_end = 600 + 3 + 6,
1041 .vtotal = 600 + 3 + 6 + 61,
1045 static const struct panel_desc samsung_ltn101nt05 = {
1046 .modes = &samsung_ltn101nt05_mode,
1055 static const struct drm_display_mode samsung_ltn140at29_301_mode = {
1058 .hsync_start = 1366 + 64,
1059 .hsync_end = 1366 + 64 + 48,
1060 .htotal = 1366 + 64 + 48 + 128,
1062 .vsync_start = 768 + 2,
1063 .vsync_end = 768 + 2 + 5,
1064 .vtotal = 768 + 2 + 5 + 17,
1068 static const struct panel_desc samsung_ltn140at29_301 = {
1069 .modes = &samsung_ltn140at29_301_mode,
1078 static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
1081 .hsync_start = 800 + 1,
1082 .hsync_end = 800 + 1 + 64,
1083 .htotal = 800 + 1 + 64 + 64,
1085 .vsync_start = 480 + 1,
1086 .vsync_end = 480 + 1 + 23,
1087 .vtotal = 480 + 1 + 23 + 22,
1091 static const struct panel_desc shelly_sca07010_bfn_lnn = {
1092 .modes = &shelly_sca07010_bfn_lnn_mode,
1098 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1101 static const struct of_device_id platform_of_match[] = {
1103 .compatible = "ampire,am800480r3tmqwa1h",
1104 .data = &ire_am800480r3tmqwa1h,
1106 .compatible = "auo,b101aw03",
1107 .data = &auo_b101aw03,
1109 .compatible = "auo,b101ean01",
1110 .data = &auo_b101ean01,
1112 .compatible = "auo,b101xtn01",
1113 .data = &auo_b101xtn01,
1115 .compatible = "auo,b116xw03",
1116 .data = &auo_b116xw03,
1118 .compatible = "auo,b133htn01",
1119 .data = &auo_b133htn01,
1121 .compatible = "auo,b133xtn01",
1122 .data = &auo_b133xtn01,
1124 .compatible = "avic,tm070ddh03",
1125 .data = &avic_tm070ddh03,
1127 .compatible = "chunghwa,claa101wa01a",
1128 .data = &chunghwa_claa101wa01a
1130 .compatible = "chunghwa,claa101wb01",
1131 .data = &chunghwa_claa101wb01
1133 .compatible = "edt,et057090dhu",
1134 .data = &edt_et057090dhu,
1136 .compatible = "edt,et070080dh6",
1137 .data = &edt_etm0700g0dh6,
1139 .compatible = "edt,etm0700g0dh6",
1140 .data = &edt_etm0700g0dh6,
1142 .compatible = "foxlink,fl500wvr00-a0t",
1143 .data = &foxlink_fl500wvr00_a0t,
1145 .compatible = "giantplus,gpg482739qs5",
1146 .data = &giantplus_gpg482739qs5
1148 .compatible = "hannstar,hsd070pww1",
1149 .data = &hannstar_hsd070pww1,
1151 .compatible = "hannstar,hsd100pxn1",
1152 .data = &hannstar_hsd100pxn1,
1154 .compatible = "hit,tx23d38vm0caa",
1155 .data = &hitachi_tx23d38vm0caa
1157 .compatible = "innolux,at043tn24",
1158 .data = &innolux_at043tn24,
1160 .compatible ="innolux,g121i1-l01",
1161 .data = &innolux_g121i1_l01
1163 .compatible = "innolux,n116bge",
1164 .data = &innolux_n116bge,
1166 .compatible = "innolux,n156bge-l21",
1167 .data = &innolux_n156bge_l21,
1169 .compatible = "innolux,zj070na-01p",
1170 .data = &innolux_zj070na_01p,
1172 .compatible = "lg,lb070wv8",
1173 .data = &lg_lb070wv8,
1175 .compatible = "lg,lp129qe",
1176 .data = &lg_lp129qe,
1178 .compatible = "nec,nl4827hc19-05b",
1179 .data = &nec_nl4827hc19_05b,
1181 .compatible = "okaya,rs800480t-7x0gp",
1182 .data = &okaya_rs800480t_7x0gp,
1184 .compatible = "ortustech,com43h4m85ulc",
1185 .data = &ortustech_com43h4m85ulc,
1187 .compatible = "samsung,ltn101nt05",
1188 .data = &samsung_ltn101nt05,
1190 .compatible = "samsung,ltn140at29-301",
1191 .data = &samsung_ltn140at29_301,
1193 .compatible = "shelly,sca07010-bfn-lnn",
1194 .data = &shelly_sca07010_bfn_lnn,
1199 MODULE_DEVICE_TABLE(of, platform_of_match);
1201 static int panel_simple_platform_probe(struct platform_device *pdev)
1203 const struct of_device_id *id;
1205 id = of_match_node(platform_of_match, pdev->dev.of_node);
1209 return panel_simple_probe(&pdev->dev, id->data);
1212 static int panel_simple_platform_remove(struct platform_device *pdev)
1214 return panel_simple_remove(&pdev->dev);
1217 static void panel_simple_platform_shutdown(struct platform_device *pdev)
1219 panel_simple_shutdown(&pdev->dev);
1222 static struct platform_driver panel_simple_platform_driver = {
1224 .name = "panel-simple",
1225 .of_match_table = platform_of_match,
1227 .probe = panel_simple_platform_probe,
1228 .remove = panel_simple_platform_remove,
1229 .shutdown = panel_simple_platform_shutdown,
1232 struct panel_desc_dsi {
1233 struct panel_desc desc;
1235 unsigned long flags;
1236 enum mipi_dsi_pixel_format format;
1240 static const struct drm_display_mode auo_b080uan01_mode = {
1243 .hsync_start = 1200 + 62,
1244 .hsync_end = 1200 + 62 + 4,
1245 .htotal = 1200 + 62 + 4 + 62,
1247 .vsync_start = 1920 + 9,
1248 .vsync_end = 1920 + 9 + 2,
1249 .vtotal = 1920 + 9 + 2 + 8,
1253 static const struct panel_desc_dsi auo_b080uan01 = {
1255 .modes = &auo_b080uan01_mode,
1263 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1264 .format = MIPI_DSI_FMT_RGB888,
1268 static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
1271 .hsync_start = 800 + 32,
1272 .hsync_end = 800 + 32 + 1,
1273 .htotal = 800 + 32 + 1 + 57,
1275 .vsync_start = 1280 + 28,
1276 .vsync_end = 1280 + 28 + 1,
1277 .vtotal = 1280 + 28 + 1 + 14,
1281 static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
1283 .modes = &lg_ld070wx3_sl01_mode,
1291 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1292 .format = MIPI_DSI_FMT_RGB888,
1296 static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
1299 .hsync_start = 720 + 12,
1300 .hsync_end = 720 + 12 + 4,
1301 .htotal = 720 + 12 + 4 + 112,
1303 .vsync_start = 1280 + 8,
1304 .vsync_end = 1280 + 8 + 4,
1305 .vtotal = 1280 + 8 + 4 + 12,
1309 static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
1311 .modes = &lg_lh500wx1_sd03_mode,
1319 .flags = MIPI_DSI_MODE_VIDEO,
1320 .format = MIPI_DSI_FMT_RGB888,
1324 static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
1327 .hsync_start = 1920 + 154,
1328 .hsync_end = 1920 + 154 + 16,
1329 .htotal = 1920 + 154 + 16 + 32,
1331 .vsync_start = 1200 + 17,
1332 .vsync_end = 1200 + 17 + 2,
1333 .vtotal = 1200 + 17 + 2 + 16,
1337 static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
1339 .modes = &panasonic_vvx10f004b00_mode,
1347 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
1348 MIPI_DSI_CLOCK_NON_CONTINUOUS,
1349 .format = MIPI_DSI_FMT_RGB888,
1353 static const struct of_device_id dsi_of_match[] = {
1355 .compatible = "auo,b080uan01",
1356 .data = &auo_b080uan01
1358 .compatible = "lg,ld070wx3-sl01",
1359 .data = &lg_ld070wx3_sl01
1361 .compatible = "lg,lh500wx1-sd03",
1362 .data = &lg_lh500wx1_sd03
1364 .compatible = "panasonic,vvx10f004b00",
1365 .data = &panasonic_vvx10f004b00
1370 MODULE_DEVICE_TABLE(of, dsi_of_match);
1372 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
1374 const struct panel_desc_dsi *desc;
1375 const struct of_device_id *id;
1378 id = of_match_node(dsi_of_match, dsi->dev.of_node);
1384 err = panel_simple_probe(&dsi->dev, &desc->desc);
1388 dsi->mode_flags = desc->flags;
1389 dsi->format = desc->format;
1390 dsi->lanes = desc->lanes;
1392 err = mipi_dsi_attach(dsi);
1394 struct panel_simple *panel = dev_get_drvdata(&dsi->dev);
1396 drm_panel_remove(&panel->base);
1402 static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
1406 err = mipi_dsi_detach(dsi);
1408 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
1410 return panel_simple_remove(&dsi->dev);
1413 static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
1415 panel_simple_shutdown(&dsi->dev);
1418 static struct mipi_dsi_driver panel_simple_dsi_driver = {
1420 .name = "panel-simple-dsi",
1421 .of_match_table = dsi_of_match,
1423 .probe = panel_simple_dsi_probe,
1424 .remove = panel_simple_dsi_remove,
1425 .shutdown = panel_simple_dsi_shutdown,
1428 static int __init panel_simple_init(void)
1432 err = platform_driver_register(&panel_simple_platform_driver);
1436 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
1437 err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
1444 module_init(panel_simple_init);
1446 static void __exit panel_simple_exit(void)
1448 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
1449 mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
1451 platform_driver_unregister(&panel_simple_platform_driver);
1453 module_exit(panel_simple_exit);
1455 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1456 MODULE_DESCRIPTION("DRM Driver for Simple Panels");
1457 MODULE_LICENSE("GPL and additional rights");