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