]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/panel/panel-simple.c
f356a7b32f08db68af20c542e251653d91725404
[karo-tx-linux.git] / drivers / gpu / drm / panel / panel-simple.c
1 /*
2  * Copyright (C) 2013, NVIDIA Corporation.  All rights reserved.
3  *
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:
10  *
11  * The above copyright notice and this permission notice (including the
12  * next paragraph) shall be included in all copies or substantial portions
13  * of the Software.
14  *
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.
22  */
23
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>
30
31 #include <drm/drmP.h>
32 #include <drm/drm_crtc.h>
33 #include <drm/drm_mipi_dsi.h>
34 #include <drm/drm_panel.h>
35
36 #include <video/display_timing.h>
37 #include <video/videomode.h>
38
39 struct panel_desc {
40         const struct drm_display_mode *modes;
41         unsigned int num_modes;
42         const struct display_timing *timings;
43         unsigned int num_timings;
44
45         unsigned int bpc;
46
47         /**
48          * @width: width (in millimeters) of the panel's active display area
49          * @height: height (in millimeters) of the panel's active display area
50          */
51         struct {
52                 unsigned int width;
53                 unsigned int height;
54         } size;
55
56         /**
57          * @prepare: the time (in milliseconds) that it takes for the panel to
58          *           become ready and start receiving video data
59          * @enable: the time (in milliseconds) that it takes for the panel to
60          *          display the first valid frame after starting to receive
61          *          video data
62          * @disable: the time (in milliseconds) that it takes for the panel to
63          *           turn the display off (no content is visible)
64          * @unprepare: the time (in milliseconds) that it takes for the panel
65          *             to power itself down completely
66          */
67         struct {
68                 unsigned int prepare;
69                 unsigned int enable;
70                 unsigned int disable;
71                 unsigned int unprepare;
72         } delay;
73
74         u32 bus_format;
75         u32 bus_flags;
76 };
77
78 struct panel_simple {
79         struct drm_panel base;
80         bool prepared;
81         bool enabled;
82
83         const struct panel_desc *desc;
84
85         struct backlight_device *backlight;
86         struct regulator *supply;
87         struct i2c_adapter *ddc;
88
89         struct gpio_desc *enable_gpio;
90
91         u32 bus_fmt_override;
92 };
93
94 #define SP_DISPLAY_MODE(freq, ha, hfp, hs, hbp, va, vfp, vs, vbp, vr, flgs) { \
95         .clock = freq,                                                  \
96         .hdisplay = ha,                                                 \
97         .hsync_start = (ha) + (hfp),                                    \
98         .hsync_end = (ha) + (hfp) + (hs),                               \
99         .htotal = (ha) + (hfp) + (hs) + (hbp),                          \
100         .vdisplay = (va),                                               \
101         .vsync_start = (va) + (vfp),                                    \
102         .vsync_end = (va) + (vfp) + (vs),                               \
103         .vtotal = (va) + (vfp) + (vs) + (vbp),                          \
104         .vrefresh = vr,                                                 \
105         .flags = flgs,                                                  \
106 }
107
108 static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
109 {
110         return container_of(panel, struct panel_simple, base);
111 }
112
113 static int panel_simple_get_fixed_modes(struct panel_simple *panel)
114 {
115         struct drm_connector *connector = panel->base.connector;
116         struct drm_device *drm = panel->base.drm;
117         struct drm_display_mode *mode;
118         unsigned int i, num = 0;
119
120         if (!panel->desc)
121                 return 0;
122
123         for (i = 0; i < panel->desc->num_timings; i++) {
124                 const struct display_timing *dt = &panel->desc->timings[i];
125                 struct videomode vm;
126
127                 videomode_from_timing(dt, &vm);
128                 mode = drm_mode_create(drm);
129                 if (!mode) {
130                         dev_err(drm->dev, "failed to add mode %ux%u\n",
131                                 dt->hactive.typ, dt->vactive.typ);
132                         continue;
133                 }
134
135                 drm_display_mode_from_videomode(&vm, mode);
136
137                 mode->type |= DRM_MODE_TYPE_DRIVER;
138
139                 if (panel->desc->num_timings == 1)
140                         mode->type |= DRM_MODE_TYPE_PREFERRED;
141
142                 drm_mode_probed_add(connector, mode);
143                 num++;
144         }
145
146         for (i = 0; i < panel->desc->num_modes; i++) {
147                 const struct drm_display_mode *m = &panel->desc->modes[i];
148
149                 mode = drm_mode_duplicate(drm, m);
150                 if (!mode) {
151                         dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
152                                 m->hdisplay, m->vdisplay, m->vrefresh);
153                         continue;
154                 }
155
156                 mode->type |= DRM_MODE_TYPE_DRIVER;
157
158                 if (panel->desc->num_modes == 1)
159                         mode->type |= DRM_MODE_TYPE_PREFERRED;
160
161                 drm_mode_set_name(mode);
162
163                 drm_mode_probed_add(connector, mode);
164                 num++;
165         }
166
167         connector->display_info.bpc = panel->desc->bpc;
168         connector->display_info.width_mm = panel->desc->size.width;
169         connector->display_info.height_mm = panel->desc->size.height;
170
171         if (panel->bus_fmt_override)
172                 drm_display_info_set_bus_formats(&connector->display_info,
173                                                  &panel->bus_fmt_override, 1);
174         else if (panel->desc->bus_format)
175                 drm_display_info_set_bus_formats(&connector->display_info,
176                                                  &panel->desc->bus_format, 1);
177         connector->display_info.bus_flags = panel->desc->bus_flags;
178
179         return num;
180 }
181
182 static int panel_simple_disable(struct drm_panel *panel)
183 {
184         struct panel_simple *p = to_panel_simple(panel);
185
186         if (!p->enabled)
187                 return 0;
188
189         if (p->backlight) {
190                 p->backlight->props.power = FB_BLANK_POWERDOWN;
191                 p->backlight->props.state |= BL_CORE_FBBLANK;
192                 backlight_update_status(p->backlight);
193         }
194
195         if (p->desc->delay.disable)
196                 msleep(p->desc->delay.disable);
197
198         p->enabled = false;
199
200         return 0;
201 }
202
203 static int panel_simple_unprepare(struct drm_panel *panel)
204 {
205         struct panel_simple *p = to_panel_simple(panel);
206
207         if (!p->prepared)
208                 return 0;
209
210         if (p->enable_gpio)
211                 gpiod_set_value_cansleep(p->enable_gpio, 0);
212
213         regulator_disable(p->supply);
214
215         if (p->desc->delay.unprepare)
216                 msleep(p->desc->delay.unprepare);
217
218         p->prepared = false;
219
220         return 0;
221 }
222
223 static int panel_simple_prepare(struct drm_panel *panel)
224 {
225         struct panel_simple *p = to_panel_simple(panel);
226         int err;
227
228         if (p->prepared)
229                 return 0;
230
231         err = regulator_enable(p->supply);
232         if (err < 0) {
233                 dev_err(panel->dev, "failed to enable supply: %d\n", err);
234                 return err;
235         }
236
237         if (p->enable_gpio)
238                 gpiod_set_value_cansleep(p->enable_gpio, 1);
239
240         if (p->desc->delay.prepare)
241                 msleep(p->desc->delay.prepare);
242
243         p->prepared = true;
244
245         return 0;
246 }
247
248 static int panel_simple_enable(struct drm_panel *panel)
249 {
250         struct panel_simple *p = to_panel_simple(panel);
251
252         if (p->enabled)
253                 return 0;
254
255         if (p->desc->delay.enable)
256                 msleep(p->desc->delay.enable);
257
258         if (p->backlight) {
259                 p->backlight->props.state &= ~BL_CORE_FBBLANK;
260                 p->backlight->props.power = FB_BLANK_UNBLANK;
261                 backlight_update_status(p->backlight);
262         }
263
264         p->enabled = true;
265
266         return 0;
267 }
268
269 static int panel_simple_get_modes(struct drm_panel *panel)
270 {
271         struct panel_simple *p = to_panel_simple(panel);
272         int num = 0;
273
274         /* probe EDID if a DDC bus is available */
275         if (p->ddc) {
276                 struct edid *edid = drm_get_edid(panel->connector, p->ddc);
277                 drm_mode_connector_update_edid_property(panel->connector, edid);
278                 if (edid) {
279                         num += drm_add_edid_modes(panel->connector, edid);
280                         kfree(edid);
281                 }
282         }
283
284         /* add hard-coded panel modes */
285         num += panel_simple_get_fixed_modes(p);
286
287         return num;
288 }
289
290 static int panel_simple_get_timings(struct drm_panel *panel,
291                                     unsigned int num_timings,
292                                     struct display_timing *timings)
293 {
294         struct panel_simple *p = to_panel_simple(panel);
295         unsigned int i;
296
297         if (p->desc->num_timings < num_timings)
298                 num_timings = p->desc->num_timings;
299
300         if (timings)
301                 for (i = 0; i < num_timings; i++)
302                         timings[i] = p->desc->timings[i];
303
304         return p->desc->num_timings;
305 }
306
307 static inline int panel_simple_check_quirks(struct device *dev,
308                                             struct panel_simple *p)
309 {
310         const char *bus_fmt;
311
312         if (of_property_read_string(dev->of_node, "bus-format-override",
313                                     &bus_fmt) == 0) {
314                 if (strcmp(bus_fmt, "rgb24") == 0)
315                         p->bus_fmt_override = MEDIA_BUS_FMT_RGB888_1X24;
316                 else if (strcmp(bus_fmt, "rgb666") == 0)
317                         p->bus_fmt_override = MEDIA_BUS_FMT_RGB666_1X18;
318                 else if (strcmp(bus_fmt, "rgb565") == 0)
319                         p->bus_fmt_override = MEDIA_BUS_FMT_RGB565_1X16;
320                 else if (strcmp(bus_fmt, "spwg-18") == 0)
321                         p->bus_fmt_override = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG;
322                 else if (strcmp(bus_fmt, "spwg-24") == 0)
323                         p->bus_fmt_override = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG;
324                 else if (strcmp(bus_fmt, "jeida-24") == 0)
325                         p->bus_fmt_override = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA;
326                 else
327                         dev_err(dev,
328                                 "Unsupported bus-format-override value: '%s'\n",
329                                 bus_fmt);
330                 return p->bus_fmt_override ? 0 : -EINVAL;
331         }
332         return 0;
333 }
334
335 static const struct drm_panel_funcs panel_simple_funcs = {
336         .disable = panel_simple_disable,
337         .unprepare = panel_simple_unprepare,
338         .prepare = panel_simple_prepare,
339         .enable = panel_simple_enable,
340         .get_modes = panel_simple_get_modes,
341         .get_timings = panel_simple_get_timings,
342 };
343
344 static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
345 {
346         struct device_node *backlight, *ddc;
347         struct panel_simple *panel;
348         int err;
349
350         panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
351         if (!panel)
352                 return -ENOMEM;
353
354         panel->enabled = false;
355         panel->prepared = false;
356         panel->desc = desc;
357
358         panel->supply = devm_regulator_get(dev, "power");
359         if (IS_ERR(panel->supply))
360                 return PTR_ERR(panel->supply);
361
362         panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
363                                                      GPIOD_OUT_LOW);
364         if (IS_ERR(panel->enable_gpio)) {
365                 err = PTR_ERR(panel->enable_gpio);
366                 dev_err(dev, "failed to request GPIO: %d\n", err);
367                 return err;
368         }
369
370         backlight = of_parse_phandle(dev->of_node, "backlight", 0);
371         if (backlight) {
372                 panel->backlight = of_find_backlight_by_node(backlight);
373                 of_node_put(backlight);
374
375                 if (!panel->backlight)
376                         return -EPROBE_DEFER;
377         }
378
379         ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
380         if (ddc) {
381                 panel->ddc = of_find_i2c_adapter_by_node(ddc);
382                 of_node_put(ddc);
383
384                 if (!panel->ddc) {
385                         err = -EPROBE_DEFER;
386                         goto free_backlight;
387                 }
388         }
389
390         err = panel_simple_check_quirks(dev, panel);
391         if (err)
392                 goto free_ddc;
393
394         drm_panel_init(&panel->base);
395         panel->base.dev = dev;
396         panel->base.funcs = &panel_simple_funcs;
397
398         err = drm_panel_add(&panel->base);
399         if (err < 0)
400                 goto free_ddc;
401
402         dev_set_drvdata(dev, panel);
403
404         return 0;
405
406 free_ddc:
407         if (panel->ddc)
408                 put_device(&panel->ddc->dev);
409 free_backlight:
410         if (panel->backlight)
411                 put_device(&panel->backlight->dev);
412
413         return err;
414 }
415
416 static int panel_simple_remove(struct device *dev)
417 {
418         struct panel_simple *panel = dev_get_drvdata(dev);
419
420         drm_panel_detach(&panel->base);
421         drm_panel_remove(&panel->base);
422
423         panel_simple_disable(&panel->base);
424
425         if (panel->ddc)
426                 put_device(&panel->ddc->dev);
427
428         if (panel->backlight)
429                 put_device(&panel->backlight->dev);
430
431         return 0;
432 }
433
434 static void panel_simple_shutdown(struct device *dev)
435 {
436         struct panel_simple *panel = dev_get_drvdata(dev);
437
438         panel_simple_disable(&panel->base);
439 }
440
441 static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode =
442         SP_DISPLAY_MODE(9000, 480, 2, 41, 2, 272, 2, 10, 2, 60,
443                         DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
444
445 static const struct panel_desc ampire_am_480272h3tmqw_t01h = {
446         .modes = &ampire_am_480272h3tmqw_t01h_mode,
447         .num_modes = 1,
448         .bpc = 8,
449         .size = {
450                 .width = 105,
451                 .height = 67,
452         },
453         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
454 };
455
456 static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode =
457         SP_DISPLAY_MODE(33333, 800, 0, 255, 0, 480, 2, 45, 0, 60,
458                         DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC);
459
460 static const struct panel_desc ampire_am800480r3tmqwa1h = {
461         .modes = &ampire_am800480r3tmqwa1h_mode,
462         .num_modes = 1,
463         .bpc = 6,
464         .size = {
465                 .width = 152,
466                 .height = 91,
467         },
468         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
469 };
470
471 static const struct drm_display_mode auo_b101aw03_mode =
472         SP_DISPLAY_MODE(51450, 1024, 156, 8, 156, 600, 16, 6, 16, 60, 0);
473
474 static const struct panel_desc auo_b101aw03 = {
475         .modes = &auo_b101aw03_mode,
476         .num_modes = 1,
477         .bpc = 6,
478         .size = {
479                 .width = 223,
480                 .height = 125,
481         },
482 };
483
484 static const struct drm_display_mode auo_b101ean01_mode =
485         SP_DISPLAY_MODE(72500, 1280, 119, 32, 21, 800, 4, 20, 8, 60, 0);
486
487 static const struct panel_desc auo_b101ean01 = {
488         .modes = &auo_b101ean01_mode,
489         .num_modes = 1,
490         .bpc = 6,
491         .size = {
492                 .width = 217,
493                 .height = 136,
494         },
495 };
496
497 static const struct drm_display_mode auo_b101xtn01_mode =
498         SP_DISPLAY_MODE(72000, 1366, 20, 70, 0, 768, 14, 42, 0, 60,
499                         DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
500
501 static const struct panel_desc auo_b101xtn01 = {
502         .modes = &auo_b101xtn01_mode,
503         .num_modes = 1,
504         .bpc = 6,
505         .size = {
506                 .width = 223,
507                 .height = 125,
508         },
509 };
510
511 static const struct drm_display_mode auo_b116xw03_mode =
512         SP_DISPLAY_MODE(70589, 1366, 40, 40, 32, 768, 10, 12, 6, 60, 0);
513
514 static const struct panel_desc auo_b116xw03 = {
515         .modes = &auo_b116xw03_mode,
516         .num_modes = 1,
517         .bpc = 6,
518         .size = {
519                 .width = 256,
520                 .height = 144,
521         },
522 };
523
524 static const struct drm_display_mode auo_b133xtn01_mode =
525         SP_DISPLAY_MODE(69500, 1366, 48, 32, 20, 768, 3, 6, 13, 60, 0);
526
527 static const struct panel_desc auo_b133xtn01 = {
528         .modes = &auo_b133xtn01_mode,
529         .num_modes = 1,
530         .bpc = 6,
531         .size = {
532                 .width = 293,
533                 .height = 165,
534         },
535 };
536
537 static const struct drm_display_mode auo_b133htn01_mode =
538         SP_DISPLAY_MODE(150660, 1920, 172, 80, 60, 1080, 25, 10, 10, 60, 0);
539
540 static const struct panel_desc auo_b133htn01 = {
541         .modes = &auo_b133htn01_mode,
542         .num_modes = 1,
543         .bpc = 6,
544         .size = {
545                 .width = 293,
546                 .height = 165,
547         },
548         .delay = {
549                 .prepare = 105,
550                 .enable = 20,
551                 .unprepare = 50,
552         },
553 };
554
555 static const struct display_timing auo_g133han01_timings = {
556         .pixelclock = { 134000000, 141200000, 149000000 },
557         .hactive = { 1920, 1920, 1920 },
558         .hfront_porch = { 39, 58, 77 },
559         .hback_porch = { 59, 88, 117 },
560         .hsync_len = { 28, 42, 56 },
561         .vactive = { 1080, 1080, 1080 },
562         .vfront_porch = { 3, 8, 11 },
563         .vback_porch = { 5, 14, 19 },
564         .vsync_len = { 4, 14, 19 },
565 };
566
567 static const struct panel_desc auo_g133han01 = {
568         .timings = &auo_g133han01_timings,
569         .num_timings = 1,
570         .bpc = 8,
571         .size = {
572                 .width = 293,
573                 .height = 165,
574         },
575         .delay = {
576                 .prepare = 200,
577                 .enable = 50,
578                 .disable = 50,
579                 .unprepare = 1000,
580         },
581         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
582 };
583
584 static const struct display_timing auo_g185han01_timings = {
585         .pixelclock = { 120000000, 144000000, 175000000 },
586         .hactive = { 1920, 1920, 1920 },
587         .hfront_porch = { 18, 60, 74 },
588         .hback_porch = { 12, 44, 54 },
589         .hsync_len = { 10, 24, 32 },
590         .vactive = { 1080, 1080, 1080 },
591         .vfront_porch = { 6, 10, 40 },
592         .vback_porch = { 2, 5, 20 },
593         .vsync_len = { 2, 5, 20 },
594 };
595
596 static const struct panel_desc auo_g185han01 = {
597         .timings = &auo_g185han01_timings,
598         .num_timings = 1,
599         .bpc = 8,
600         .size = {
601                 .width = 409,
602                 .height = 230,
603         },
604         .delay = {
605                 .prepare = 50,
606                 .enable = 200,
607                 .disable = 110,
608                 .unprepare = 1000,
609         },
610         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
611 };
612
613 static const struct display_timing auo_p320hvn03_timings = {
614         .pixelclock = { 106000000, 148500000, 164000000 },
615         .hactive = { 1920, 1920, 1920 },
616         .hfront_porch = { 25, 50, 130 },
617         .hback_porch = { 25, 50, 130 },
618         .hsync_len = { 20, 40, 105 },
619         .vactive = { 1080, 1080, 1080 },
620         .vfront_porch = { 8, 17, 150 },
621         .vback_porch = { 8, 17, 150 },
622         .vsync_len = { 4, 11, 100 },
623 };
624
625 static const struct panel_desc auo_p320hvn03 = {
626         .timings = &auo_p320hvn03_timings,
627         .num_timings = 1,
628         .bpc = 8,
629         .size = {
630                 .width = 698,
631                 .height = 393,
632         },
633         .delay = {
634                 .prepare = 1,
635                 .enable = 450,
636                 .unprepare = 500,
637         },
638         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
639 };
640
641 static const struct drm_display_mode auo_t215hvn01_mode =
642         SP_DISPLAY_MODE(148800, 1920, 88, 44, 148, 1080, 4, 5, 36, 60, 0);
643
644 static const struct panel_desc auo_t215hvn01 = {
645         .modes = &auo_t215hvn01_mode,
646         .num_modes = 1,
647         .bpc = 8,
648         .size = {
649                 .width = 430,
650                 .height = 270,
651         },
652         .delay = {
653                 .disable = 5,
654                 .unprepare = 1000,
655         }
656 };
657
658 static const struct drm_display_mode avic_tm070ddh03_mode =
659         SP_DISPLAY_MODE(51200, 1024, 160, 4, 156, 600, 17, 1, 17, 60, 0);
660
661 static const struct panel_desc avic_tm070ddh03 = {
662         .modes = &avic_tm070ddh03_mode,
663         .num_modes = 1,
664         .bpc = 8,
665         .size = {
666                 .width = 154,
667                 .height = 90,
668         },
669         .delay = {
670                 .prepare = 20,
671                 .enable = 200,
672                 .disable = 200,
673         },
674 };
675
676 static const struct drm_display_mode boe_nv101wxmn51_modes[] = {
677         SP_DISPLAY_MODE(71900, 1280, 48, 32, 80, 800, 3, 5, 24, 60, 0),
678         SP_DISPLAY_MODE(57500, 1280, 48, 32, 80, 800, 3, 5, 24, 48, 0),
679 };
680
681 static const struct panel_desc boe_nv101wxmn51 = {
682         .modes = boe_nv101wxmn51_modes,
683         .num_modes = ARRAY_SIZE(boe_nv101wxmn51_modes),
684         .bpc = 8,
685         .size = {
686                 .width = 217,
687                 .height = 136,
688         },
689         .delay = {
690                 .prepare = 210,
691                 .enable = 50,
692                 .unprepare = 160,
693         },
694 };
695
696 static const struct drm_display_mode chunghwa_claa070wp03xg_mode =
697         SP_DISPLAY_MODE(66770, 800, 49, 33, 17, 1280, 1, 7, 15, 60,
698                         DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
699
700 static const struct panel_desc chunghwa_claa070wp03xg = {
701         .modes = &chunghwa_claa070wp03xg_mode,
702         .num_modes = 1,
703         .bpc = 6,
704         .size = {
705                 .width = 94,
706                 .height = 150,
707         },
708 };
709
710 static const struct drm_display_mode chunghwa_claa101wa01a_mode =
711         SP_DISPLAY_MODE(72070, 1366, 58, 58, 58, 768, 4, 4, 4, 60, 0);
712
713 static const struct panel_desc chunghwa_claa101wa01a = {
714         .modes = &chunghwa_claa101wa01a_mode,
715         .num_modes = 1,
716         .bpc = 6,
717         .size = {
718                 .width = 220,
719                 .height = 120,
720         },
721 };
722
723 static const struct drm_display_mode chunghwa_claa101wb01_mode =
724         SP_DISPLAY_MODE(69300, 1366, 48, 32, 20, 768, 16, 8, 16, 60, 0);
725
726 static const struct panel_desc chunghwa_claa101wb01 = {
727         .modes = &chunghwa_claa101wb01_mode,
728         .num_modes = 1,
729         .bpc = 6,
730         .size = {
731                 .width = 223,
732                 .height = 125,
733         },
734 };
735
736 static const struct drm_display_mode edt_et057090dhu_mode =
737         SP_DISPLAY_MODE(25175, 640, 16, 30, 114, 480, 10, 3, 32, 60,
738                         DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
739
740 static const struct panel_desc edt_et057090dhu = {
741         .modes = &edt_et057090dhu_mode,
742         .num_modes = 1,
743         .bpc = 6,
744         .size = {
745                 .width = 115,
746                 .height = 86,
747         },
748         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
749         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_NEGEDGE,
750 };
751
752 static const struct drm_display_mode edt_etm0700g0dh6_mode =
753         SP_DISPLAY_MODE(33260, 800, 40, 128, 88, 480, 10, 2, 33, 60,
754                         DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
755
756 static const struct panel_desc edt_etm0700g0dh6 = {
757         .modes = &edt_etm0700g0dh6_mode,
758         .num_modes = 1,
759         .bpc = 6,
760         .size = {
761                 .width = 152,
762                 .height = 91,
763         },
764         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
765         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_NEGEDGE,
766 };
767
768 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode =
769         SP_DISPLAY_MODE(32260, 800, 168, 64, 88, 480, 37, 2, 8, 60, 0);
770
771 static const struct panel_desc foxlink_fl500wvr00_a0t = {
772         .modes = &foxlink_fl500wvr00_a0t_mode,
773         .num_modes = 1,
774         .bpc = 8,
775         .size = {
776                 .width = 108,
777                 .height = 65,
778         },
779         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
780 };
781
782 static const struct drm_display_mode giantplus_gpg482739qs5_mode =
783         SP_DISPLAY_MODE(9000, 480, 5, 1, 40, 272, 8, 1, 8, 60, 0);
784
785 static const struct panel_desc giantplus_gpg482739qs5 = {
786         .modes = &giantplus_gpg482739qs5_mode,
787         .num_modes = 1,
788         .bpc = 8,
789         .size = {
790                 .width = 95,
791                 .height = 54,
792         },
793         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
794 };
795
796 static const struct display_timing hannstar_hsd070pww1_timing = {
797         .pixelclock = { 64300000, 71100000, 82000000 },
798         .hactive = { 1280, 1280, 1280 },
799         .hfront_porch = { 1, 1, 10 },
800         .hback_porch = { 1, 1, 10 },
801         /*
802          * According to the data sheet, the minimum horizontal blanking interval
803          * is 54 clocks (1 + 52 + 1), but tests with a Nitrogen6X have shown the
804          * minimum working horizontal blanking interval to be 60 clocks.
805          */
806         .hsync_len = { 58, 158, 661 },
807         .vactive = { 800, 800, 800 },
808         .vfront_porch = { 1, 1, 10 },
809         .vback_porch = { 1, 1, 10 },
810         .vsync_len = { 1, 21, 203 },
811         .flags = DISPLAY_FLAGS_DE_HIGH,
812 };
813
814 static const struct panel_desc hannstar_hsd070pww1 = {
815         .timings = &hannstar_hsd070pww1_timing,
816         .num_timings = 1,
817         .bpc = 6,
818         .size = {
819                 .width = 151,
820                 .height = 94,
821         },
822         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
823 };
824
825 static const struct display_timing hannstar_hsd100pxn1_timing = {
826         .pixelclock = { 55000000, 65000000, 75000000 },
827         .hactive = { 1024, 1024, 1024 },
828         .hfront_porch = { 40, 40, 40 },
829         .hback_porch = { 220, 220, 220 },
830         .hsync_len = { 20, 60, 100 },
831         .vactive = { 768, 768, 768 },
832         .vfront_porch = { 7, 7, 7 },
833         .vback_porch = { 21, 21, 21 },
834         .vsync_len = { 10, 10, 10 },
835         .flags = DISPLAY_FLAGS_DE_HIGH,
836 };
837
838 static const struct panel_desc hannstar_hsd100pxn1 = {
839         .timings = &hannstar_hsd100pxn1_timing,
840         .num_timings = 1,
841         .bpc = 6,
842         .size = {
843                 .width = 203,
844                 .height = 152,
845         },
846         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
847 };
848
849 static const struct drm_display_mode hitachi_tx23d38vm0caa_mode =
850         SP_DISPLAY_MODE(33333, 800, 85, 86, 85, 480, 16, 13, 16, 60, 0);
851
852 static const struct panel_desc hitachi_tx23d38vm0caa = {
853         .modes = &hitachi_tx23d38vm0caa_mode,
854         .num_modes = 1,
855         .bpc = 6,
856         .size = {
857                 .width = 195,
858                 .height = 117,
859         },
860 };
861
862 static const struct drm_display_mode innolux_at043tn24_mode =
863         SP_DISPLAY_MODE(9000, 480, 2, 41, 2, 272, 2, 11, 2, 60,
864                         DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
865
866 static const struct panel_desc innolux_at043tn24 = {
867         .modes = &innolux_at043tn24_mode,
868         .num_modes = 1,
869         .bpc = 8,
870         .size = {
871                 .width = 95,
872                 .height = 54,
873         },
874         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
875 };
876
877 static const struct drm_display_mode innolux_at070tn92_mode =
878         SP_DISPLAY_MODE(33333, 800, 210, 20, 46, 480, 22, 10, 23, 60, 0);
879
880 static const struct panel_desc innolux_at070tn92 = {
881         .modes = &innolux_at070tn92_mode,
882         .num_modes = 1,
883         .size = {
884                 .width = 154,
885                 .height = 86,
886         },
887         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
888 };
889
890 static const struct display_timing innolux_g101ice_l01_timing = {
891         .pixelclock = { 60400000, 71100000, 74700000 },
892         .hactive = { 1280, 1280, 1280 },
893         .hfront_porch = { 41, 80, 100 },
894         .hback_porch = { 40, 79, 99 },
895         .hsync_len = { 1, 1, 1 },
896         .vactive = { 800, 800, 800 },
897         .vfront_porch = { 5, 11, 14 },
898         .vback_porch = { 4, 11, 14 },
899         .vsync_len = { 1, 1, 1 },
900         .flags = DISPLAY_FLAGS_DE_HIGH,
901 };
902
903 static const struct panel_desc innolux_g101ice_l01 = {
904         .timings = &innolux_g101ice_l01_timing,
905         .num_timings = 1,
906         .bpc = 8,
907         .size = {
908                 .width = 217,
909                 .height = 135,
910         },
911         .delay = {
912                 .enable = 200,
913                 .disable = 200,
914         },
915         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
916 };
917
918 static const struct display_timing innolux_g121i1_l01_timing = {
919         .pixelclock = { 67450000, 71000000, 74550000 },
920         .hactive = { 1280, 1280, 1280 },
921         .hfront_porch = { 40, 80, 160 },
922         .hback_porch = { 39, 79, 159 },
923         .hsync_len = { 1, 1, 1 },
924         .vactive = { 800, 800, 800 },
925         .vfront_porch = { 5, 11, 100 },
926         .vback_porch = { 4, 11, 99 },
927         .vsync_len = { 1, 1, 1 },
928 };
929
930 static const struct panel_desc innolux_g121i1_l01 = {
931         .timings = &innolux_g121i1_l01_timing,
932         .num_timings = 1,
933         .bpc = 6,
934         .size = {
935                 .width = 261,
936                 .height = 163,
937         },
938         .delay = {
939                 .enable = 200,
940                 .disable = 20,
941         },
942         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
943 };
944
945 static const struct drm_display_mode innolux_g121x1_l03_mode =
946         SP_DISPLAY_MODE(65000, 1024, 0, 1, 320, 768, 38, 1, 0, 60,
947                         DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
948
949 static const struct panel_desc innolux_g121x1_l03 = {
950         .modes = &innolux_g121x1_l03_mode,
951         .num_modes = 1,
952         .bpc = 6,
953         .size = {
954                 .width = 246,
955                 .height = 185,
956         },
957         .delay = {
958                 .enable = 200,
959                 .unprepare = 200,
960                 .disable = 400,
961         },
962 };
963
964 static const struct drm_display_mode innolux_n116bge_mode =
965         SP_DISPLAY_MODE(76420, 1366, 136, 30, 60, 768, 8, 12, 12, 60,
966                         DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC);
967
968 static const struct panel_desc innolux_n116bge = {
969         .modes = &innolux_n116bge_mode,
970         .num_modes = 1,
971         .bpc = 6,
972         .size = {
973                 .width = 256,
974                 .height = 144,
975         },
976 };
977
978 static const struct drm_display_mode innolux_n156bge_l21_mode =
979         SP_DISPLAY_MODE(69300, 1366, 16, 34, 50, 768, 2, 6, 12, 60, 0);
980
981 static const struct panel_desc innolux_n156bge_l21 = {
982         .modes = &innolux_n156bge_l21_mode,
983         .num_modes = 1,
984         .bpc = 6,
985         .size = {
986                 .width = 344,
987                 .height = 193,
988         },
989 };
990
991 static const struct drm_display_mode innolux_zj070na_01p_mode =
992         SP_DISPLAY_MODE(51501, 1024, 128, 64, 128, 600, 16, 4, 16, 60, 0);
993
994 static const struct panel_desc innolux_zj070na_01p = {
995         .modes = &innolux_zj070na_01p_mode,
996         .num_modes = 1,
997         .bpc = 6,
998         .size = {
999                 .width = 154,
1000                 .height = 90,
1001         },
1002 };
1003
1004 static const struct display_timing kyo_tcg121xglp_timing = {
1005         .pixelclock = { 52000000, 65000000, 71000000 },
1006         .hactive = { 1024, 1024, 1024 },
1007         .hfront_porch = { 2, 2, 2 },
1008         .hback_porch = { 2, 2, 2 },
1009         .hsync_len = { 86, 124, 244 },
1010         .vactive = { 768, 768, 768 },
1011         .vfront_porch = { 2, 2, 2 },
1012         .vback_porch = { 2, 2, 2 },
1013         .vsync_len = { 6, 34, 73 },
1014         .flags = DISPLAY_FLAGS_DE_HIGH,
1015 };
1016
1017 static const struct panel_desc kyo_tcg121xglp = {
1018         .timings = &kyo_tcg121xglp_timing,
1019         .num_timings = 1,
1020         .bpc = 8,
1021         .size = {
1022                 .width = 246,
1023                 .height = 184,
1024         },
1025         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1026 };
1027
1028 static const struct drm_display_mode lg_lb070wv8_mode =
1029         SP_DISPLAY_MODE(33246, 800, 88, 80, 88, 480, 10, 25, 10, 60, 0);
1030
1031 static const struct panel_desc lg_lb070wv8 = {
1032         .modes = &lg_lb070wv8_mode,
1033         .num_modes = 1,
1034         .bpc = 16,
1035         .size = {
1036                 .width = 151,
1037                 .height = 91,
1038         },
1039         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1040 };
1041
1042 static const struct drm_display_mode lg_lp079qx1_sp0v_mode =
1043         SP_DISPLAY_MODE(200000, 1536, 12, 16, 48, 2048, 8, 4, 8, 60,
1044                          DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
1045
1046 static const struct panel_desc lg_lp079qx1_sp0v = {
1047         .modes = &lg_lp079qx1_sp0v_mode,
1048         .num_modes = 1,
1049         .size = {
1050                 .width = 129,
1051                 .height = 171,
1052         },
1053 };
1054
1055 static const struct drm_display_mode lg_lp097qx1_spa1_mode =
1056         SP_DISPLAY_MODE(205210, 2048, 150, 5, 5, 1536, 3, 1, 9, 60, 0);
1057
1058 static const struct panel_desc lg_lp097qx1_spa1 = {
1059         .modes = &lg_lp097qx1_spa1_mode,
1060         .num_modes = 1,
1061         .size = {
1062                 .width = 208,
1063                 .height = 147,
1064         },
1065 };
1066
1067 static const struct drm_display_mode lg_lp120up1_mode =
1068         SP_DISPLAY_MODE(162300, 1920, 40, 40, 80, 1280, 4, 4, 12, 60, 0);
1069
1070 static const struct panel_desc lg_lp120up1 = {
1071         .modes = &lg_lp120up1_mode,
1072         .num_modes = 1,
1073         .bpc = 8,
1074         .size = {
1075                 .width = 267,
1076                 .height = 183,
1077         },
1078 };
1079
1080 static const struct drm_display_mode lg_lp129qe_mode =
1081         SP_DISPLAY_MODE(285250, 2560, 48, 32, 80, 1700, 3, 10, 36, 60, 0);
1082
1083 static const struct panel_desc lg_lp129qe = {
1084         .modes = &lg_lp129qe_mode,
1085         .num_modes = 1,
1086         .bpc = 8,
1087         .size = {
1088                 .width = 272,
1089                 .height = 181,
1090         },
1091 };
1092
1093 static const struct display_timing nec_nl12880bc20_05_timing = {
1094         .pixelclock = { 67000000, 71000000, 75000000 },
1095         .hactive = { 1280, 1280, 1280 },
1096         .hfront_porch = { 2, 30, 30 },
1097         .hback_porch = { 6, 100, 100 },
1098         .hsync_len = { 2, 30, 30 },
1099         .vactive = { 800, 800, 800 },
1100         .vfront_porch = { 5, 5, 5 },
1101         .vback_porch = { 11, 11, 11 },
1102         .vsync_len = { 7, 7, 7 },
1103 };
1104
1105 static const struct panel_desc nec_nl12880bc20_05 = {
1106         .timings = &nec_nl12880bc20_05_timing,
1107         .num_timings = 1,
1108         .bpc = 8,
1109         .size = {
1110                 .width = 261,
1111                 .height = 163,
1112         },
1113         .delay = {
1114                 .enable = 50,
1115                 .disable = 50,
1116         },
1117         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1118 };
1119
1120 static const struct drm_display_mode nec_nl4827hc19_05b_mode =
1121         SP_DISPLAY_MODE(10870, 480, 2, 41, 2, 272, 2, 4, 2, 74,
1122                          DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
1123
1124 static const struct panel_desc nec_nl4827hc19_05b = {
1125         .modes = &nec_nl4827hc19_05b_mode,
1126         .num_modes = 1,
1127         .bpc = 8,
1128         .size = {
1129                 .width = 95,
1130                 .height = 54,
1131         },
1132         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1133         .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
1134 };
1135
1136 static const struct drm_display_mode netron_dy_e231732_mode =
1137         SP_DISPLAY_MODE(66000, 1024, 160, 70, 90, 600, 127, 20, 3, 60, 0);
1138
1139 static const struct panel_desc netron_dy_e231732 = {
1140         .modes = &netron_dy_e231732_mode,
1141         .num_modes = 1,
1142         .size = {
1143                 .width = 154,
1144                 .height = 87,
1145         },
1146         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1147 };
1148
1149 static const struct display_timing nlt_nl192108ac18_02d_timing = {
1150         .pixelclock = { 130000000, 148350000, 163000000 },
1151         .hactive = { 1920, 1920, 1920 },
1152         .hfront_porch = { 80, 100, 100 },
1153         .hback_porch = { 100, 120, 120 },
1154         .hsync_len = { 50, 60, 60 },
1155         .vactive = { 1080, 1080, 1080 },
1156         .vfront_porch = { 12, 30, 30 },
1157         .vback_porch = { 4, 10, 10 },
1158         .vsync_len = { 4, 5, 5 },
1159 };
1160
1161 static const struct panel_desc nlt_nl192108ac18_02d = {
1162         .timings = &nlt_nl192108ac18_02d_timing,
1163         .num_timings = 1,
1164         .bpc = 8,
1165         .size = {
1166                 .width = 344,
1167                 .height = 194,
1168         },
1169         .delay = {
1170                 .unprepare = 500,
1171         },
1172         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1173 };
1174
1175 static const struct drm_display_mode nvd_9128_mode =
1176         SP_DISPLAY_MODE(29500, 800, 130, 98, 0, 480, 10, 50, 0, 0, 0);
1177
1178 static const struct panel_desc nvd_9128 = {
1179         .modes = &nvd_9128_mode,
1180         .num_modes = 1,
1181         .bpc = 8,
1182         .size = {
1183                 .width = 156,
1184                 .height = 88,
1185         },
1186         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1187 };
1188
1189 static const struct display_timing okaya_rs800480t_7x0gp_timing = {
1190         .pixelclock = { 30000000, 30000000, 40000000 },
1191         .hactive = { 800, 800, 800 },
1192         .hfront_porch = { 40, 40, 40 },
1193         .hback_porch = { 40, 40, 40 },
1194         .hsync_len = { 1, 48, 48 },
1195         .vactive = { 480, 480, 480 },
1196         .vfront_porch = { 13, 13, 13 },
1197         .vback_porch = { 29, 29, 29 },
1198         .vsync_len = { 3, 3, 3 },
1199         .flags = DISPLAY_FLAGS_DE_HIGH,
1200 };
1201
1202 static const struct panel_desc okaya_rs800480t_7x0gp = {
1203         .timings = &okaya_rs800480t_7x0gp_timing,
1204         .num_timings = 1,
1205         .bpc = 6,
1206         .size = {
1207                 .width = 154,
1208                 .height = 87,
1209         },
1210         .delay = {
1211                 .prepare = 41,
1212                 .enable = 50,
1213                 .unprepare = 41,
1214                 .disable = 50,
1215         },
1216         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1217 };
1218
1219 static const struct drm_display_mode olimex_lcd_olinuxino_43ts_mode =
1220         SP_DISPLAY_MODE(9000, 480, 5, 30, 10, 272, 8, 5, 3, 60, 0);
1221
1222 static const struct panel_desc olimex_lcd_olinuxino_43ts = {
1223         .modes = &olimex_lcd_olinuxino_43ts_mode,
1224         .num_modes = 1,
1225         .size = {
1226                 .width = 105,
1227                 .height = 67,
1228         },
1229         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1230 };
1231
1232 /*
1233  * 800x480 CVT. The panel appears to be quite accepting, at least as far as
1234  * pixel clocks, but this is the timing that was being used in the Adafruit
1235  * installation instructions.
1236  */
1237 static const struct drm_display_mode ontat_yx700wv03_mode =
1238         SP_DISPLAY_MODE(29500, 800, 24, 72, 96, 480, 3, 10, 7, 60,
1239                         DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
1240
1241 /*
1242  * Specification at:
1243  * https://www.adafruit.com/images/product-files/2406/c3163.pdf
1244  */
1245 static const struct panel_desc ontat_yx700wv03 = {
1246         .modes = &ontat_yx700wv03_mode,
1247         .num_modes = 1,
1248         .bpc = 8,
1249         .size = {
1250                 .width = 154,
1251                 .height = 83,
1252         },
1253         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1254 };
1255
1256 static const struct drm_display_mode ortustech_com43h4m85ulc_mode  =
1257         SP_DISPLAY_MODE(25000, 480, 10, 10, 15, 800, 3, 3, 3, 60, 0);
1258
1259 static const struct panel_desc ortustech_com43h4m85ulc = {
1260         .modes = &ortustech_com43h4m85ulc_mode,
1261         .num_modes = 1,
1262         .bpc = 8,
1263         .size = {
1264                 .width = 56,
1265                 .height = 93,
1266         },
1267         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1268         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_POSEDGE,
1269 };
1270
1271 static const struct drm_display_mode qd43003c0_40_mode =
1272         SP_DISPLAY_MODE(9000, 480, 8, 4, 39, 272, 4, 10, 2, 60, 0);
1273
1274 static const struct panel_desc qd43003c0_40 = {
1275         .modes = &qd43003c0_40_mode,
1276         .num_modes = 1,
1277         .bpc = 8,
1278         .size = {
1279                 .width = 95,
1280                 .height = 53,
1281         },
1282         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1283 };
1284
1285 static const struct drm_display_mode samsung_lsn122dl01_c01_mode =
1286         SP_DISPLAY_MODE(271560, 2560, 48, 32, 80, 1600, 2, 5, 57, 60, 0);
1287
1288 static const struct panel_desc samsung_lsn122dl01_c01 = {
1289         .modes = &samsung_lsn122dl01_c01_mode,
1290         .num_modes = 1,
1291         .size = {
1292                 .width = 263,
1293                 .height = 164,
1294         },
1295 };
1296
1297 static const struct drm_display_mode samsung_ltn101nt05_mode =
1298         SP_DISPLAY_MODE(54030, 1024, 24, 136, 160, 600, 3, 6, 61, 60, 0);
1299
1300 static const struct panel_desc samsung_ltn101nt05 = {
1301         .modes = &samsung_ltn101nt05_mode,
1302         .num_modes = 1,
1303         .bpc = 6,
1304         .size = {
1305                 .width = 223,
1306                 .height = 125,
1307         },
1308 };
1309
1310 static const struct drm_display_mode samsung_ltn140at29_301_mode =
1311         SP_DISPLAY_MODE(76300, 1366, 64, 48, 128, 768, 2, 5, 17, 60, 0);
1312
1313 static const struct panel_desc samsung_ltn140at29_301 = {
1314         .modes = &samsung_ltn140at29_301_mode,
1315         .num_modes = 1,
1316         .bpc = 6,
1317         .size = {
1318                 .width = 320,
1319                 .height = 187,
1320         },
1321 };
1322
1323 static const struct display_timing sharp_lq101k1ly04_timing = {
1324         .pixelclock = { 60000000, 65000000, 80000000 },
1325         .hactive = { 1280, 1280, 1280 },
1326         .hfront_porch = { 20, 20, 20 },
1327         .hback_porch = { 20, 20, 20 },
1328         .hsync_len = { 10, 10, 10 },
1329         .vactive = { 800, 800, 800 },
1330         .vfront_porch = { 4, 4, 4 },
1331         .vback_porch = { 4, 4, 4 },
1332         .vsync_len = { 4, 4, 4 },
1333         .flags = DISPLAY_FLAGS_PIXDATA_POSEDGE,
1334 };
1335
1336 static const struct panel_desc sharp_lq101k1ly04 = {
1337         .timings = &sharp_lq101k1ly04_timing,
1338         .num_timings = 1,
1339         .bpc = 8,
1340         .size = {
1341                 .width = 217,
1342                 .height = 136,
1343         },
1344         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
1345 };
1346
1347 static const struct drm_display_mode sharp_lq123p1jx31_mode =
1348         SP_DISPLAY_MODE(252750, 2400, 48, 32, 80, 1600, 3, 10, 33, 60,
1349                          DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
1350
1351 static const struct panel_desc sharp_lq123p1jx31 = {
1352         .modes = &sharp_lq123p1jx31_mode,
1353         .num_modes = 1,
1354         .bpc = 8,
1355         .size = {
1356                 .width = 259,
1357                 .height = 173,
1358         },
1359         .delay = {
1360                 .prepare = 110,
1361                 .enable = 50,
1362                 .unprepare = 550,
1363         },
1364 };
1365
1366 static const struct drm_display_mode sharp_lq150x1lg11_mode =
1367         SP_DISPLAY_MODE(71100, 1024, 168, 64, 88, 768, 37, 2, 8, 60, 0);
1368
1369 static const struct panel_desc sharp_lq150x1lg11 = {
1370         .modes = &sharp_lq150x1lg11_mode,
1371         .num_modes = 1,
1372         .bpc = 6,
1373         .size = {
1374                 .width = 304,
1375                 .height = 228,
1376         },
1377         .bus_format = MEDIA_BUS_FMT_RGB565_1X16,
1378 };
1379
1380 static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode =
1381         SP_DISPLAY_MODE(33300, 800, 1, 64, 64, 480, 1, 23, 22, 60, 0);
1382
1383 static const struct panel_desc shelly_sca07010_bfn_lnn = {
1384         .modes = &shelly_sca07010_bfn_lnn_mode,
1385         .num_modes = 1,
1386         .size = {
1387                 .width = 152,
1388                 .height = 91,
1389         },
1390         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1391 };
1392
1393 static const struct drm_display_mode starry_kr122ea0sra_mode =
1394         SP_DISPLAY_MODE(147000, 1920, 16, 16, 32, 1200, 15, 2, 18, 60,
1395                          DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
1396
1397 static const struct panel_desc starry_kr122ea0sra = {
1398         .modes = &starry_kr122ea0sra_mode,
1399         .num_modes = 1,
1400         .size = {
1401                 .width = 263,
1402                 .height = 164,
1403         },
1404         .delay = {
1405                 .prepare = 10 + 200,
1406                 .enable = 50,
1407                 .unprepare = 10 + 500,
1408         },
1409 };
1410
1411 static const struct display_timing tianma_tm070jdhg30_timing = {
1412         .pixelclock = { 62600000, 68200000, 78100000 },
1413         .hactive = { 1280, 1280, 1280 },
1414         .hfront_porch = { 15, 64, 159 },
1415         .hback_porch = { 5, 5, 5 },
1416         .hsync_len = { 1, 1, 256 },
1417         .vactive = { 800, 800, 800 },
1418         .vfront_porch = { 3, 40, 99 },
1419         .vback_porch = { 2, 2, 2 },
1420         .vsync_len = { 1, 1, 128 },
1421         .flags = DISPLAY_FLAGS_DE_HIGH,
1422 };
1423
1424 static const struct panel_desc tianma_tm070jdhg30 = {
1425         .timings = &tianma_tm070jdhg30_timing,
1426         .num_timings = 1,
1427         .bpc = 8,
1428         .size = {
1429                 .width = 151,
1430                 .height = 95,
1431         },
1432         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1433 };
1434
1435 static const struct drm_display_mode tpk_f07a_0102_mode =
1436         SP_DISPLAY_MODE(33260, 800, 40, 128, 88, 480, 10, 2, 33, 60, 0);
1437
1438 static const struct panel_desc tpk_f07a_0102 = {
1439         .modes = &tpk_f07a_0102_mode,
1440         .num_modes = 1,
1441         .size = {
1442                 .width = 152,
1443                 .height = 91,
1444         },
1445         .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
1446 };
1447
1448 static const struct drm_display_mode tpk_f10a_0102_mode =
1449         SP_DISPLAY_MODE(45000, 1024, 176, 5, 88, 600, 20, 5, 25, 60, 0);
1450
1451 static const struct panel_desc tpk_f10a_0102 = {
1452         .modes = &tpk_f10a_0102_mode,
1453         .num_modes = 1,
1454         .size = {
1455                 .width = 223,
1456                 .height = 125,
1457         },
1458 };
1459
1460 static const struct display_timing urt_umsh_8596md_timing = {
1461         .pixelclock = { 33260000, 33260000, 33260000 },
1462         .hactive = { 800, 800, 800 },
1463         .hfront_porch = { 41, 41, 41 },
1464         .hback_porch = { 216 - 128, 216 - 128, 216 - 128 },
1465         .hsync_len = { 71, 128, 128 },
1466         .vactive = { 480, 480, 480 },
1467         .vfront_porch = { 10, 10, 10 },
1468         .vback_porch = { 35 - 2, 35 - 2, 35 - 2 },
1469         .vsync_len = { 2, 2, 2 },
1470         .flags = DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_NEGEDGE |
1471                 DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
1472 };
1473
1474 static const struct panel_desc urt_umsh_8596md_lvds = {
1475         .timings = &urt_umsh_8596md_timing,
1476         .num_timings = 1,
1477         .bpc = 6,
1478         .size = {
1479                 .width = 152,
1480                 .height = 91,
1481         },
1482         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
1483 };
1484
1485 static const struct panel_desc urt_umsh_8596md_parallel = {
1486         .timings = &urt_umsh_8596md_timing,
1487         .num_timings = 1,
1488         .bpc = 6,
1489         .size = {
1490                 .width = 152,
1491                 .height = 91,
1492         },
1493         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1494 };
1495
1496 static const struct drm_display_mode winstar_wf35ltiacd_mode =
1497         SP_DISPLAY_MODE(6410, 320, 20, 30, 38, 240, 4, 3, 15, 60,
1498                         DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
1499
1500 static const struct panel_desc winstar_wf35ltiacd = {
1501         .modes = &winstar_wf35ltiacd_mode,
1502         .num_modes = 1,
1503         .bpc = 8,
1504         .size = {
1505                 .width = 70,
1506                 .height = 53,
1507         },
1508         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1509 };
1510
1511 static const struct of_device_id platform_of_match[] = {
1512         {
1513                 .compatible = "ampire,am-480272h3tmqw-t01h",
1514                 .data = &ampire_am_480272h3tmqw_t01h,
1515         }, {
1516                 .compatible = "ampire,am800480r3tmqwa1h",
1517                 .data = &ampire_am800480r3tmqwa1h,
1518         }, {
1519                 .compatible = "auo,b101aw03",
1520                 .data = &auo_b101aw03,
1521         }, {
1522                 .compatible = "auo,b101ean01",
1523                 .data = &auo_b101ean01,
1524         }, {
1525                 .compatible = "auo,b101xtn01",
1526                 .data = &auo_b101xtn01,
1527         }, {
1528                 .compatible = "auo,b116xw03",
1529                 .data = &auo_b116xw03,
1530         }, {
1531                 .compatible = "auo,b133htn01",
1532                 .data = &auo_b133htn01,
1533         }, {
1534                 .compatible = "auo,b133xtn01",
1535                 .data = &auo_b133xtn01,
1536         }, {
1537                 .compatible = "auo,g133han01",
1538                 .data = &auo_g133han01,
1539         }, {
1540                 .compatible = "auo,g185han01",
1541                 .data = &auo_g185han01,
1542         }, {
1543                 .compatible = "auo,p320hvn03",
1544                 .data = &auo_p320hvn03,
1545         }, {
1546                 .compatible = "auo,t215hvn01",
1547                 .data = &auo_t215hvn01,
1548         }, {
1549                 .compatible = "avic,tm070ddh03",
1550                 .data = &avic_tm070ddh03,
1551         }, {
1552                 .compatible = "boe,nv101wxmn51",
1553                 .data = &boe_nv101wxmn51,
1554         }, {
1555                 .compatible = "chunghwa,claa070wp03xg",
1556                 .data = &chunghwa_claa070wp03xg,
1557         }, {
1558                 .compatible = "chunghwa,claa101wa01a",
1559                 .data = &chunghwa_claa101wa01a
1560         }, {
1561                 .compatible = "chunghwa,claa101wb01",
1562                 .data = &chunghwa_claa101wb01
1563         }, {
1564                 .compatible = "edt,et057090dhu",
1565                 .data = &edt_et057090dhu,
1566         }, {
1567                 .compatible = "edt,et070080dh6",
1568                 .data = &edt_etm0700g0dh6,
1569         }, {
1570                 .compatible = "edt,etm0700g0dh6",
1571                 .data = &edt_etm0700g0dh6,
1572         }, {
1573                 .compatible = "foxlink,fl500wvr00-a0t",
1574                 .data = &foxlink_fl500wvr00_a0t,
1575         }, {
1576                 .compatible = "giantplus,gpg482739qs5",
1577                 .data = &giantplus_gpg482739qs5
1578         }, {
1579                 .compatible = "hannstar,hsd070pww1",
1580                 .data = &hannstar_hsd070pww1,
1581         }, {
1582                 .compatible = "hannstar,hsd100pxn1",
1583                 .data = &hannstar_hsd100pxn1,
1584         }, {
1585                 .compatible = "hit,tx23d38vm0caa",
1586                 .data = &hitachi_tx23d38vm0caa
1587         }, {
1588                 .compatible = "innolux,at043tn24",
1589                 .data = &innolux_at043tn24,
1590         }, {
1591                 .compatible = "innolux,at070tn92",
1592                 .data = &innolux_at070tn92,
1593         }, {
1594                 .compatible ="innolux,g101ice-l01",
1595                 .data = &innolux_g101ice_l01
1596         }, {
1597                 .compatible ="innolux,g121i1-l01",
1598                 .data = &innolux_g121i1_l01
1599         }, {
1600                 .compatible = "innolux,g121x1-l03",
1601                 .data = &innolux_g121x1_l03,
1602         }, {
1603                 .compatible = "innolux,n116bge",
1604                 .data = &innolux_n116bge,
1605         }, {
1606                 .compatible = "innolux,n156bge-l21",
1607                 .data = &innolux_n156bge_l21,
1608         }, {
1609                 .compatible = "innolux,zj070na-01p",
1610                 .data = &innolux_zj070na_01p,
1611         }, {
1612                 .compatible = "kyo,tcg121xglp",
1613                 .data = &kyo_tcg121xglp,
1614         }, {
1615                 .compatible = "lg,lb070wv8",
1616                 .data = &lg_lb070wv8,
1617         }, {
1618                 .compatible = "lg,lp079qx1-sp0v",
1619                 .data = &lg_lp079qx1_sp0v,
1620         }, {
1621                 .compatible = "lg,lp097qx1-spa1",
1622                 .data = &lg_lp097qx1_spa1,
1623         }, {
1624                 .compatible = "lg,lp120up1",
1625                 .data = &lg_lp120up1,
1626         }, {
1627                 .compatible = "lg,lp129qe",
1628                 .data = &lg_lp129qe,
1629         }, {
1630                 .compatible = "nec,nl12880bc20-05",
1631                 .data = &nec_nl12880bc20_05,
1632         }, {
1633                 .compatible = "nec,nl4827hc19-05b",
1634                 .data = &nec_nl4827hc19_05b,
1635         }, {
1636                 .compatible = "netron-dy,e231732",
1637                 .data = &netron_dy_e231732,
1638         }, {
1639                 .compatible = "nlt,nl192108ac18-02d",
1640                 .data = &nlt_nl192108ac18_02d,
1641         }, {
1642                 .compatible = "nvd,9128",
1643                 .data = &nvd_9128,
1644         }, {
1645                 .compatible = "okaya,rs800480t-7x0gp",
1646                 .data = &okaya_rs800480t_7x0gp,
1647         }, {
1648                 .compatible = "olimex,lcd-olinuxino-43-ts",
1649                 .data = &olimex_lcd_olinuxino_43ts,
1650         }, {
1651                 .compatible = "ontat,yx700wv03",
1652                 .data = &ontat_yx700wv03,
1653         }, {
1654                 .compatible = "ortustech,com43h4m85ulc",
1655                 .data = &ortustech_com43h4m85ulc,
1656         }, {
1657                 .compatible = "qiaodian,qd43003c0-40",
1658                 .data = &qd43003c0_40,
1659         }, {
1660                 .compatible = "samsung,lsn122dl01-c01",
1661                 .data = &samsung_lsn122dl01_c01,
1662         }, {
1663                 .compatible = "samsung,ltn101nt05",
1664                 .data = &samsung_ltn101nt05,
1665         }, {
1666                 .compatible = "samsung,ltn140at29-301",
1667                 .data = &samsung_ltn140at29_301,
1668         }, {
1669                 .compatible = "sharp,lq101k1ly04",
1670                 .data = &sharp_lq101k1ly04,
1671         }, {
1672                 .compatible = "sharp,lq123p1jx31",
1673                 .data = &sharp_lq123p1jx31,
1674         }, {
1675                 .compatible = "sharp,lq150x1lg11",
1676                 .data = &sharp_lq150x1lg11,
1677         }, {
1678                 .compatible = "shelly,sca07010-bfn-lnn",
1679                 .data = &shelly_sca07010_bfn_lnn,
1680         }, {
1681                 .compatible = "starry,kr122ea0sra",
1682                 .data = &starry_kr122ea0sra,
1683         }, {
1684                 .compatible = "tianma,tm070jdhg30",
1685                 .data = &tianma_tm070jdhg30,
1686         }, {
1687                 .compatible = "tpk,f07a-0102",
1688                 .data = &tpk_f07a_0102,
1689         }, {
1690                 .compatible = "tpk,f10a-0102",
1691                 .data = &tpk_f10a_0102,
1692         }, {
1693                 .compatible = "urt,umsh-8596md-t",
1694                 .data = &urt_umsh_8596md_parallel,
1695         }, {
1696                 .compatible = "urt,umsh-8596md-1t",
1697                 .data = &urt_umsh_8596md_parallel,
1698         }, {
1699                 .compatible = "urt,umsh-8596md-7t",
1700                 .data = &urt_umsh_8596md_parallel,
1701         }, {
1702                 .compatible = "urt,umsh-8596md-11t",
1703                 .data = &urt_umsh_8596md_lvds,
1704         }, {
1705                 .compatible = "urt,umsh-8596md-19t",
1706                 .data = &urt_umsh_8596md_lvds,
1707         }, {
1708                 .compatible = "urt,umsh-8596md-20t",
1709                 .data = &urt_umsh_8596md_parallel,
1710         }, {
1711                 .compatible = "winstar,wf35ltiacd",
1712                 .data = &winstar_wf35ltiacd,
1713         }, {
1714                 /* sentinel */
1715         }
1716 };
1717 MODULE_DEVICE_TABLE(of, platform_of_match);
1718
1719 static int panel_simple_platform_probe(struct platform_device *pdev)
1720 {
1721         const struct of_device_id *id;
1722
1723         id = of_match_node(platform_of_match, pdev->dev.of_node);
1724         if (!id)
1725                 return -ENODEV;
1726
1727         return panel_simple_probe(&pdev->dev, id->data);
1728 }
1729
1730 static int panel_simple_platform_remove(struct platform_device *pdev)
1731 {
1732         return panel_simple_remove(&pdev->dev);
1733 }
1734
1735 static void panel_simple_platform_shutdown(struct platform_device *pdev)
1736 {
1737         panel_simple_shutdown(&pdev->dev);
1738 }
1739
1740 static struct platform_driver panel_simple_platform_driver = {
1741         .driver = {
1742                 .name = "panel-simple",
1743                 .of_match_table = platform_of_match,
1744         },
1745         .probe = panel_simple_platform_probe,
1746         .remove = panel_simple_platform_remove,
1747         .shutdown = panel_simple_platform_shutdown,
1748 };
1749
1750 struct panel_desc_dsi {
1751         struct panel_desc desc;
1752
1753         unsigned long flags;
1754         enum mipi_dsi_pixel_format format;
1755         unsigned int lanes;
1756 };
1757
1758 static const struct drm_display_mode auo_b080uan01_mode =
1759         SP_DISPLAY_MODE(154500, 1200, 62, 4, 62, 1920, 9, 2, 8, 60, 0);
1760
1761 static const struct panel_desc_dsi auo_b080uan01 = {
1762         .desc = {
1763                 .modes = &auo_b080uan01_mode,
1764                 .num_modes = 1,
1765                 .bpc = 8,
1766                 .size = {
1767                         .width = 108,
1768                         .height = 272,
1769                 },
1770         },
1771         .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1772         .format = MIPI_DSI_FMT_RGB888,
1773         .lanes = 4,
1774 };
1775
1776 static const struct drm_display_mode boe_tv080wum_nl0_mode =
1777         SP_DISPLAY_MODE(160000, 1200, 120, 20, 21, 1920, 21, 3, 18, 60,
1778                          DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC);
1779
1780 static const struct panel_desc_dsi boe_tv080wum_nl0 = {
1781         .desc = {
1782                 .modes = &boe_tv080wum_nl0_mode,
1783                 .num_modes = 1,
1784                 .size = {
1785                         .width = 107,
1786                         .height = 172,
1787                 },
1788         },
1789         .flags = MIPI_DSI_MODE_VIDEO |
1790                  MIPI_DSI_MODE_VIDEO_BURST |
1791                  MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
1792         .format = MIPI_DSI_FMT_RGB888,
1793         .lanes = 4,
1794 };
1795
1796 static const struct drm_display_mode lg_ld070wx3_sl01_mode =
1797         SP_DISPLAY_MODE(71000, 800, 32, 1, 57, 1280, 28, 1, 14, 60, 0);
1798
1799 static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
1800         .desc = {
1801                 .modes = &lg_ld070wx3_sl01_mode,
1802                 .num_modes = 1,
1803                 .bpc = 8,
1804                 .size = {
1805                         .width = 94,
1806                         .height = 151,
1807                 },
1808         },
1809         .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1810         .format = MIPI_DSI_FMT_RGB888,
1811         .lanes = 4,
1812 };
1813
1814 static const struct drm_display_mode lg_lh500wx1_sd03_mode =
1815         SP_DISPLAY_MODE(67000, 720, 12, 4, 112, 1280, 8, 4, 12, 60, 0);
1816
1817 static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
1818         .desc = {
1819                 .modes = &lg_lh500wx1_sd03_mode,
1820                 .num_modes = 1,
1821                 .bpc = 8,
1822                 .size = {
1823                         .width = 62,
1824                         .height = 110,
1825                 },
1826         },
1827         .flags = MIPI_DSI_MODE_VIDEO,
1828         .format = MIPI_DSI_FMT_RGB888,
1829         .lanes = 4,
1830 };
1831
1832 static const struct drm_display_mode panasonic_vvx10f004b00_mode =
1833         SP_DISPLAY_MODE(157200, 1920, 154, 16, 32, 1200, 17, 2, 16, 60, 0);
1834
1835 static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
1836         .desc = {
1837                 .modes = &panasonic_vvx10f004b00_mode,
1838                 .num_modes = 1,
1839                 .bpc = 8,
1840                 .size = {
1841                         .width = 217,
1842                         .height = 136,
1843                 },
1844         },
1845         .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
1846                  MIPI_DSI_CLOCK_NON_CONTINUOUS,
1847         .format = MIPI_DSI_FMT_RGB888,
1848         .lanes = 4,
1849 };
1850
1851 static const struct of_device_id dsi_of_match[] = {
1852         {
1853                 .compatible = "auo,b080uan01",
1854                 .data = &auo_b080uan01
1855         }, {
1856                 .compatible = "boe,tv080wum-nl0",
1857                 .data = &boe_tv080wum_nl0
1858         }, {
1859                 .compatible = "lg,ld070wx3-sl01",
1860                 .data = &lg_ld070wx3_sl01
1861         }, {
1862                 .compatible = "lg,lh500wx1-sd03",
1863                 .data = &lg_lh500wx1_sd03
1864         }, {
1865                 .compatible = "panasonic,vvx10f004b00",
1866                 .data = &panasonic_vvx10f004b00
1867         }, {
1868                 /* sentinel */
1869         }
1870 };
1871 MODULE_DEVICE_TABLE(of, dsi_of_match);
1872
1873 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
1874 {
1875         const struct panel_desc_dsi *desc;
1876         const struct of_device_id *id;
1877         int err;
1878
1879         id = of_match_node(dsi_of_match, dsi->dev.of_node);
1880         if (!id)
1881                 return -ENODEV;
1882
1883         desc = id->data;
1884
1885         err = panel_simple_probe(&dsi->dev, &desc->desc);
1886         if (err < 0)
1887                 return err;
1888
1889         dsi->mode_flags = desc->flags;
1890         dsi->format = desc->format;
1891         dsi->lanes = desc->lanes;
1892
1893         return mipi_dsi_attach(dsi);
1894 }
1895
1896 static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
1897 {
1898         int err;
1899
1900         err = mipi_dsi_detach(dsi);
1901         if (err < 0)
1902                 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
1903
1904         return panel_simple_remove(&dsi->dev);
1905 }
1906
1907 static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
1908 {
1909         panel_simple_shutdown(&dsi->dev);
1910 }
1911
1912 static struct mipi_dsi_driver panel_simple_dsi_driver = {
1913         .driver = {
1914                 .name = "panel-simple-dsi",
1915                 .of_match_table = dsi_of_match,
1916         },
1917         .probe = panel_simple_dsi_probe,
1918         .remove = panel_simple_dsi_remove,
1919         .shutdown = panel_simple_dsi_shutdown,
1920 };
1921
1922 static int __init panel_simple_init(void)
1923 {
1924         int err;
1925
1926         err = platform_driver_register(&panel_simple_platform_driver);
1927         if (err < 0)
1928                 return err;
1929
1930         if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
1931                 err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
1932                 if (err < 0)
1933                         return err;
1934         }
1935
1936         return 0;
1937 }
1938 module_init(panel_simple_init);
1939
1940 static void __exit panel_simple_exit(void)
1941 {
1942         if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
1943                 mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
1944
1945         platform_driver_unregister(&panel_simple_platform_driver);
1946 }
1947 module_exit(panel_simple_exit);
1948
1949 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1950 MODULE_DESCRIPTION("DRM Driver for Simple Panels");
1951 MODULE_LICENSE("GPL and additional rights");