Linux 5.15.57
[platform/kernel/linux-rpi.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/delay.h>
25 #include <linux/gpio/consumer.h>
26 #include <linux/iopoll.h>
27 #include <linux/module.h>
28 #include <linux/of_platform.h>
29 #include <linux/platform_device.h>
30 #include <linux/pm_runtime.h>
31 #include <linux/regulator/consumer.h>
32
33 #include <video/display_timing.h>
34 #include <video/of_display_timing.h>
35 #include <video/videomode.h>
36
37 #include <drm/drm_crtc.h>
38 #include <drm/drm_device.h>
39 #include <drm/drm_dp_aux_bus.h>
40 #include <drm/drm_dp_helper.h>
41 #include <drm/drm_mipi_dsi.h>
42 #include <drm/drm_panel.h>
43
44 /**
45  * struct panel_desc - Describes a simple panel.
46  */
47 struct panel_desc {
48         /**
49          * @modes: Pointer to array of fixed modes appropriate for this panel.
50          *
51          * If only one mode then this can just be the address of the mode.
52          * NOTE: cannot be used with "timings" and also if this is specified
53          * then you cannot override the mode in the device tree.
54          */
55         const struct drm_display_mode *modes;
56
57         /** @num_modes: Number of elements in modes array. */
58         unsigned int num_modes;
59
60         /**
61          * @timings: Pointer to array of display timings
62          *
63          * NOTE: cannot be used with "modes" and also these will be used to
64          * validate a device tree override if one is present.
65          */
66         const struct display_timing *timings;
67
68         /** @num_timings: Number of elements in timings array. */
69         unsigned int num_timings;
70
71         /** @bpc: Bits per color. */
72         unsigned int bpc;
73
74         /** @size: Structure containing the physical size of this panel. */
75         struct {
76                 /**
77                  * @size.width: Width (in mm) of the active display area.
78                  */
79                 unsigned int width;
80
81                 /**
82                  * @size.height: Height (in mm) of the active display area.
83                  */
84                 unsigned int height;
85         } size;
86
87         /** @delay: Structure containing various delay values for this panel. */
88         struct {
89                 /**
90                  * @delay.prepare: Time for the panel to become ready.
91                  *
92                  * The time (in milliseconds) that it takes for the panel to
93                  * become ready and start receiving video data
94                  */
95                 unsigned int prepare;
96
97                 /**
98                  * @delay.hpd_absent_delay: Time to wait if HPD isn't hooked up.
99                  *
100                  * Add this to the prepare delay if we know Hot Plug Detect
101                  * isn't used.
102                  */
103                 unsigned int hpd_absent_delay;
104
105                 /**
106                  * @delay.prepare_to_enable: Time between prepare and enable.
107                  *
108                  * The minimum time, in milliseconds, that needs to have passed
109                  * between when prepare finished and enable may begin. If at
110                  * enable time less time has passed since prepare finished,
111                  * the driver waits for the remaining time.
112                  *
113                  * If a fixed enable delay is also specified, we'll start
114                  * counting before delaying for the fixed delay.
115                  *
116                  * If a fixed prepare delay is also specified, we won't start
117                  * counting until after the fixed delay. We can't overlap this
118                  * fixed delay with the min time because the fixed delay
119                  * doesn't happen at the end of the function if a HPD GPIO was
120                  * specified.
121                  *
122                  * In other words:
123                  *   prepare()
124                  *     ...
125                  *     // do fixed prepare delay
126                  *     // wait for HPD GPIO if applicable
127                  *     // start counting for prepare_to_enable
128                  *
129                  *   enable()
130                  *     // do fixed enable delay
131                  *     // enforce prepare_to_enable min time
132                  */
133                 unsigned int prepare_to_enable;
134
135                 /**
136                  * @delay.enable: Time for the panel to display a valid frame.
137                  *
138                  * The time (in milliseconds) that it takes for the panel to
139                  * display the first valid frame after starting to receive
140                  * video data.
141                  */
142                 unsigned int enable;
143
144                 /**
145                  * @delay.disable: Time for the panel to turn the display off.
146                  *
147                  * The time (in milliseconds) that it takes for the panel to
148                  * turn the display off (no content is visible).
149                  */
150                 unsigned int disable;
151
152                 /**
153                  * @delay.unprepare: Time to power down completely.
154                  *
155                  * The time (in milliseconds) that it takes for the panel
156                  * to power itself down completely.
157                  *
158                  * This time is used to prevent a future "prepare" from
159                  * starting until at least this many milliseconds has passed.
160                  * If at prepare time less time has passed since unprepare
161                  * finished, the driver waits for the remaining time.
162                  */
163                 unsigned int unprepare;
164         } delay;
165
166         /** @bus_format: See MEDIA_BUS_FMT_... defines. */
167         u32 bus_format;
168
169         /** @bus_flags: See DRM_BUS_FLAG_... defines. */
170         u32 bus_flags;
171
172         /** @connector_type: LVDS, eDP, DSI, DPI, etc. */
173         int connector_type;
174 };
175
176 struct panel_simple {
177         struct drm_panel base;
178         bool enabled;
179         bool no_hpd;
180
181         bool prepared;
182
183         ktime_t prepared_time;
184         ktime_t unprepared_time;
185
186         const struct panel_desc *desc;
187
188         struct regulator *supply;
189         struct i2c_adapter *ddc;
190         struct drm_dp_aux *aux;
191
192         struct gpio_desc *enable_gpio;
193         struct gpio_desc *hpd_gpio;
194
195         struct edid *edid;
196
197         struct drm_display_mode override_mode;
198
199         enum drm_panel_orientation orientation;
200 };
201
202 static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
203 {
204         return container_of(panel, struct panel_simple, base);
205 }
206
207 static unsigned int panel_simple_get_timings_modes(struct panel_simple *panel,
208                                                    struct drm_connector *connector)
209 {
210         struct drm_display_mode *mode;
211         unsigned int i, num = 0;
212
213         for (i = 0; i < panel->desc->num_timings; i++) {
214                 const struct display_timing *dt = &panel->desc->timings[i];
215                 struct videomode vm;
216
217                 videomode_from_timing(dt, &vm);
218                 mode = drm_mode_create(connector->dev);
219                 if (!mode) {
220                         dev_err(panel->base.dev, "failed to add mode %ux%u\n",
221                                 dt->hactive.typ, dt->vactive.typ);
222                         continue;
223                 }
224
225                 drm_display_mode_from_videomode(&vm, mode);
226
227                 mode->type |= DRM_MODE_TYPE_DRIVER;
228
229                 if (panel->desc->num_timings == 1)
230                         mode->type |= DRM_MODE_TYPE_PREFERRED;
231
232                 drm_mode_probed_add(connector, mode);
233                 num++;
234         }
235
236         return num;
237 }
238
239 static unsigned int panel_simple_get_display_modes(struct panel_simple *panel,
240                                                    struct drm_connector *connector)
241 {
242         struct drm_display_mode *mode;
243         unsigned int i, num = 0;
244
245         for (i = 0; i < panel->desc->num_modes; i++) {
246                 const struct drm_display_mode *m = &panel->desc->modes[i];
247
248                 mode = drm_mode_duplicate(connector->dev, m);
249                 if (!mode) {
250                         dev_err(panel->base.dev, "failed to add mode %ux%u@%u\n",
251                                 m->hdisplay, m->vdisplay,
252                                 drm_mode_vrefresh(m));
253                         continue;
254                 }
255
256                 mode->type |= DRM_MODE_TYPE_DRIVER;
257
258                 if (panel->desc->num_modes == 1)
259                         mode->type |= DRM_MODE_TYPE_PREFERRED;
260
261                 drm_mode_set_name(mode);
262
263                 drm_mode_probed_add(connector, mode);
264                 num++;
265         }
266
267         return num;
268 }
269
270 static int panel_simple_get_non_edid_modes(struct panel_simple *panel,
271                                            struct drm_connector *connector)
272 {
273         struct drm_display_mode *mode;
274         bool has_override = panel->override_mode.type;
275         unsigned int num = 0;
276
277         if (!panel->desc)
278                 return 0;
279
280         if (has_override) {
281                 mode = drm_mode_duplicate(connector->dev,
282                                           &panel->override_mode);
283                 if (mode) {
284                         drm_mode_probed_add(connector, mode);
285                         num = 1;
286                 } else {
287                         dev_err(panel->base.dev, "failed to add override mode\n");
288                 }
289         }
290
291         /* Only add timings if override was not there or failed to validate */
292         if (num == 0 && panel->desc->num_timings)
293                 num = panel_simple_get_timings_modes(panel, connector);
294
295         /*
296          * Only add fixed modes if timings/override added no mode.
297          *
298          * We should only ever have either the display timings specified
299          * or a fixed mode. Anything else is rather bogus.
300          */
301         WARN_ON(panel->desc->num_timings && panel->desc->num_modes);
302         if (num == 0)
303                 num = panel_simple_get_display_modes(panel, connector);
304
305         connector->display_info.bpc = panel->desc->bpc;
306         connector->display_info.width_mm = panel->desc->size.width;
307         connector->display_info.height_mm = panel->desc->size.height;
308         if (panel->desc->bus_format)
309                 drm_display_info_set_bus_formats(&connector->display_info,
310                                                  &panel->desc->bus_format, 1);
311         connector->display_info.bus_flags = panel->desc->bus_flags;
312
313         return num;
314 }
315
316 static void panel_simple_wait(ktime_t start_ktime, unsigned int min_ms)
317 {
318         ktime_t now_ktime, min_ktime;
319
320         if (!min_ms)
321                 return;
322
323         min_ktime = ktime_add(start_ktime, ms_to_ktime(min_ms));
324         now_ktime = ktime_get();
325
326         if (ktime_before(now_ktime, min_ktime))
327                 msleep(ktime_to_ms(ktime_sub(min_ktime, now_ktime)) + 1);
328 }
329
330 static int panel_simple_disable(struct drm_panel *panel)
331 {
332         struct panel_simple *p = to_panel_simple(panel);
333
334         if (!p->enabled)
335                 return 0;
336
337         if (p->desc->delay.disable)
338                 msleep(p->desc->delay.disable);
339
340         p->enabled = false;
341
342         return 0;
343 }
344
345 static int panel_simple_suspend(struct device *dev)
346 {
347         struct panel_simple *p = dev_get_drvdata(dev);
348
349         gpiod_set_value_cansleep(p->enable_gpio, 0);
350         regulator_disable(p->supply);
351         p->unprepared_time = ktime_get();
352
353         kfree(p->edid);
354         p->edid = NULL;
355
356         return 0;
357 }
358
359 static int panel_simple_unprepare(struct drm_panel *panel)
360 {
361         struct panel_simple *p = to_panel_simple(panel);
362         int ret;
363
364         /* Unpreparing when already unprepared is a no-op */
365         if (!p->prepared)
366                 return 0;
367
368         pm_runtime_mark_last_busy(panel->dev);
369         ret = pm_runtime_put_autosuspend(panel->dev);
370         if (ret < 0)
371                 return ret;
372         p->prepared = false;
373
374         return 0;
375 }
376
377 static int panel_simple_get_hpd_gpio(struct device *dev, struct panel_simple *p)
378 {
379         int err;
380
381         p->hpd_gpio = devm_gpiod_get_optional(dev, "hpd", GPIOD_IN);
382         if (IS_ERR(p->hpd_gpio)) {
383                 err = PTR_ERR(p->hpd_gpio);
384
385                 if (err != -EPROBE_DEFER)
386                         dev_err(dev, "failed to get 'hpd' GPIO: %d\n", err);
387
388                 return err;
389         }
390
391         return 0;
392 }
393
394 static int panel_simple_prepare_once(struct panel_simple *p)
395 {
396         struct device *dev = p->base.dev;
397         unsigned int delay;
398         int err;
399         int hpd_asserted;
400         unsigned long hpd_wait_us;
401
402         panel_simple_wait(p->unprepared_time, p->desc->delay.unprepare);
403
404         err = regulator_enable(p->supply);
405         if (err < 0) {
406                 dev_err(dev, "failed to enable supply: %d\n", err);
407                 return err;
408         }
409
410         gpiod_set_value_cansleep(p->enable_gpio, 1);
411
412         delay = p->desc->delay.prepare;
413         if (p->no_hpd)
414                 delay += p->desc->delay.hpd_absent_delay;
415         if (delay)
416                 msleep(delay);
417
418         if (p->hpd_gpio) {
419                 if (p->desc->delay.hpd_absent_delay)
420                         hpd_wait_us = p->desc->delay.hpd_absent_delay * 1000UL;
421                 else
422                         hpd_wait_us = 2000000;
423
424                 err = readx_poll_timeout(gpiod_get_value_cansleep, p->hpd_gpio,
425                                          hpd_asserted, hpd_asserted,
426                                          1000, hpd_wait_us);
427                 if (hpd_asserted < 0)
428                         err = hpd_asserted;
429
430                 if (err) {
431                         if (err != -ETIMEDOUT)
432                                 dev_err(dev,
433                                         "error waiting for hpd GPIO: %d\n", err);
434                         goto error;
435                 }
436         }
437
438         p->prepared_time = ktime_get();
439
440         return 0;
441
442 error:
443         gpiod_set_value_cansleep(p->enable_gpio, 0);
444         regulator_disable(p->supply);
445         p->unprepared_time = ktime_get();
446
447         return err;
448 }
449
450 /*
451  * Some panels simply don't always come up and need to be power cycled to
452  * work properly.  We'll allow for a handful of retries.
453  */
454 #define MAX_PANEL_PREPARE_TRIES         5
455
456 static int panel_simple_resume(struct device *dev)
457 {
458         struct panel_simple *p = dev_get_drvdata(dev);
459         int ret;
460         int try;
461
462         for (try = 0; try < MAX_PANEL_PREPARE_TRIES; try++) {
463                 ret = panel_simple_prepare_once(p);
464                 if (ret != -ETIMEDOUT)
465                         break;
466         }
467
468         if (ret == -ETIMEDOUT)
469                 dev_err(dev, "Prepare timeout after %d tries\n", try);
470         else if (try)
471                 dev_warn(dev, "Prepare needed %d retries\n", try);
472
473         return ret;
474 }
475
476 static int panel_simple_prepare(struct drm_panel *panel)
477 {
478         struct panel_simple *p = to_panel_simple(panel);
479         int ret;
480
481         /* Preparing when already prepared is a no-op */
482         if (p->prepared)
483                 return 0;
484
485         ret = pm_runtime_get_sync(panel->dev);
486         if (ret < 0) {
487                 pm_runtime_put_autosuspend(panel->dev);
488                 return ret;
489         }
490
491         p->prepared = true;
492
493         return 0;
494 }
495
496 static int panel_simple_enable(struct drm_panel *panel)
497 {
498         struct panel_simple *p = to_panel_simple(panel);
499
500         if (p->enabled)
501                 return 0;
502
503         if (p->desc->delay.enable)
504                 msleep(p->desc->delay.enable);
505
506         panel_simple_wait(p->prepared_time, p->desc->delay.prepare_to_enable);
507
508         p->enabled = true;
509
510         return 0;
511 }
512
513 static int panel_simple_get_modes(struct drm_panel *panel,
514                                   struct drm_connector *connector)
515 {
516         struct panel_simple *p = to_panel_simple(panel);
517         int num = 0;
518
519         /* probe EDID if a DDC bus is available */
520         if (p->ddc) {
521                 pm_runtime_get_sync(panel->dev);
522
523                 if (!p->edid)
524                         p->edid = drm_get_edid(connector, p->ddc);
525
526                 if (p->edid)
527                         num += drm_add_edid_modes(connector, p->edid);
528
529                 pm_runtime_mark_last_busy(panel->dev);
530                 pm_runtime_put_autosuspend(panel->dev);
531         }
532
533         /* add hard-coded panel modes */
534         num += panel_simple_get_non_edid_modes(p, connector);
535
536         /* set up connector's "panel orientation" property */
537         drm_connector_set_panel_orientation(connector, p->orientation);
538
539         return num;
540 }
541
542 static int panel_simple_get_timings(struct drm_panel *panel,
543                                     unsigned int num_timings,
544                                     struct display_timing *timings)
545 {
546         struct panel_simple *p = to_panel_simple(panel);
547         unsigned int i;
548
549         if (p->desc->num_timings < num_timings)
550                 num_timings = p->desc->num_timings;
551
552         if (timings)
553                 for (i = 0; i < num_timings; i++)
554                         timings[i] = p->desc->timings[i];
555
556         return p->desc->num_timings;
557 }
558
559 static const struct drm_panel_funcs panel_simple_funcs = {
560         .disable = panel_simple_disable,
561         .unprepare = panel_simple_unprepare,
562         .prepare = panel_simple_prepare,
563         .enable = panel_simple_enable,
564         .get_modes = panel_simple_get_modes,
565         .get_timings = panel_simple_get_timings,
566 };
567
568 static struct panel_desc panel_dpi;
569
570 static int panel_dpi_probe(struct device *dev,
571                            struct panel_simple *panel)
572 {
573         struct display_timing *timing;
574         const struct device_node *np;
575         struct panel_desc *desc;
576         unsigned int bus_flags;
577         struct videomode vm;
578         int ret;
579
580         np = dev->of_node;
581         desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
582         if (!desc)
583                 return -ENOMEM;
584
585         timing = devm_kzalloc(dev, sizeof(*timing), GFP_KERNEL);
586         if (!timing)
587                 return -ENOMEM;
588
589         ret = of_get_display_timing(np, "panel-timing", timing);
590         if (ret < 0) {
591                 dev_err(dev, "%pOF: no panel-timing node found for \"panel-dpi\" binding\n",
592                         np);
593                 return ret;
594         }
595
596         desc->timings = timing;
597         desc->num_timings = 1;
598
599         of_property_read_u32(np, "width-mm", &desc->size.width);
600         of_property_read_u32(np, "height-mm", &desc->size.height);
601
602         /* Extract bus_flags from display_timing */
603         bus_flags = 0;
604         vm.flags = timing->flags;
605         drm_bus_flags_from_videomode(&vm, &bus_flags);
606         desc->bus_flags = bus_flags;
607
608         /* We do not know the connector for the DT node, so guess it */
609         desc->connector_type = DRM_MODE_CONNECTOR_DPI;
610
611         panel->desc = desc;
612
613         return 0;
614 }
615
616 #define PANEL_SIMPLE_BOUNDS_CHECK(to_check, bounds, field) \
617         (to_check->field.typ >= bounds->field.min && \
618          to_check->field.typ <= bounds->field.max)
619 static void panel_simple_parse_panel_timing_node(struct device *dev,
620                                                  struct panel_simple *panel,
621                                                  const struct display_timing *ot)
622 {
623         const struct panel_desc *desc = panel->desc;
624         struct videomode vm;
625         unsigned int i;
626
627         if (WARN_ON(desc->num_modes)) {
628                 dev_err(dev, "Reject override mode: panel has a fixed mode\n");
629                 return;
630         }
631         if (WARN_ON(!desc->num_timings)) {
632                 dev_err(dev, "Reject override mode: no timings specified\n");
633                 return;
634         }
635
636         for (i = 0; i < panel->desc->num_timings; i++) {
637                 const struct display_timing *dt = &panel->desc->timings[i];
638
639                 if (!PANEL_SIMPLE_BOUNDS_CHECK(ot, dt, hactive) ||
640                     !PANEL_SIMPLE_BOUNDS_CHECK(ot, dt, hfront_porch) ||
641                     !PANEL_SIMPLE_BOUNDS_CHECK(ot, dt, hback_porch) ||
642                     !PANEL_SIMPLE_BOUNDS_CHECK(ot, dt, hsync_len) ||
643                     !PANEL_SIMPLE_BOUNDS_CHECK(ot, dt, vactive) ||
644                     !PANEL_SIMPLE_BOUNDS_CHECK(ot, dt, vfront_porch) ||
645                     !PANEL_SIMPLE_BOUNDS_CHECK(ot, dt, vback_porch) ||
646                     !PANEL_SIMPLE_BOUNDS_CHECK(ot, dt, vsync_len))
647                         continue;
648
649                 if (ot->flags != dt->flags)
650                         continue;
651
652                 videomode_from_timing(ot, &vm);
653                 drm_display_mode_from_videomode(&vm, &panel->override_mode);
654                 panel->override_mode.type |= DRM_MODE_TYPE_DRIVER |
655                                              DRM_MODE_TYPE_PREFERRED;
656                 break;
657         }
658
659         if (WARN_ON(!panel->override_mode.type))
660                 dev_err(dev, "Reject override mode: No display_timing found\n");
661 }
662
663 static int panel_simple_probe(struct device *dev, const struct panel_desc *desc,
664                               struct drm_dp_aux *aux)
665 {
666         struct panel_simple *panel;
667         struct display_timing dt;
668         struct device_node *ddc;
669         int connector_type;
670         u32 bus_flags;
671         int err;
672
673         panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
674         if (!panel)
675                 return -ENOMEM;
676
677         panel->enabled = false;
678         panel->prepared_time = 0;
679         panel->desc = desc;
680         panel->aux = aux;
681
682         panel->no_hpd = of_property_read_bool(dev->of_node, "no-hpd");
683         if (!panel->no_hpd) {
684                 err = panel_simple_get_hpd_gpio(dev, panel);
685                 if (err)
686                         return err;
687         }
688
689         panel->supply = devm_regulator_get(dev, "power");
690         if (IS_ERR(panel->supply))
691                 return PTR_ERR(panel->supply);
692
693         panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
694                                                      GPIOD_OUT_LOW);
695         if (IS_ERR(panel->enable_gpio)) {
696                 err = PTR_ERR(panel->enable_gpio);
697                 if (err != -EPROBE_DEFER)
698                         dev_err(dev, "failed to request GPIO: %d\n", err);
699                 return err;
700         }
701
702         err = of_drm_get_panel_orientation(dev->of_node, &panel->orientation);
703         if (err) {
704                 dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, err);
705                 return err;
706         }
707
708         ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
709         if (ddc) {
710                 panel->ddc = of_find_i2c_adapter_by_node(ddc);
711                 of_node_put(ddc);
712
713                 if (!panel->ddc)
714                         return -EPROBE_DEFER;
715         } else if (aux) {
716                 panel->ddc = &aux->ddc;
717         }
718
719         if (desc == &panel_dpi) {
720                 /* Handle the generic panel-dpi binding */
721                 err = panel_dpi_probe(dev, panel);
722                 if (err)
723                         goto free_ddc;
724                 desc = panel->desc;
725         } else {
726                 if (!of_get_display_timing(dev->of_node, "panel-timing", &dt))
727                         panel_simple_parse_panel_timing_node(dev, panel, &dt);
728         }
729
730         connector_type = desc->connector_type;
731         /* Catch common mistakes for panels. */
732         switch (connector_type) {
733         case 0:
734                 dev_warn(dev, "Specify missing connector_type\n");
735                 connector_type = DRM_MODE_CONNECTOR_DPI;
736                 break;
737         case DRM_MODE_CONNECTOR_LVDS:
738                 WARN_ON(desc->bus_flags &
739                         ~(DRM_BUS_FLAG_DE_LOW |
740                           DRM_BUS_FLAG_DE_HIGH |
741                           DRM_BUS_FLAG_DATA_MSB_TO_LSB |
742                           DRM_BUS_FLAG_DATA_LSB_TO_MSB));
743                 WARN_ON(desc->bus_format != MEDIA_BUS_FMT_RGB666_1X7X3_SPWG &&
744                         desc->bus_format != MEDIA_BUS_FMT_RGB888_1X7X4_SPWG &&
745                         desc->bus_format != MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA);
746                 WARN_ON(desc->bus_format == MEDIA_BUS_FMT_RGB666_1X7X3_SPWG &&
747                         desc->bpc != 6);
748                 WARN_ON((desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_SPWG ||
749                          desc->bus_format == MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA) &&
750                         desc->bpc != 8);
751                 break;
752         case DRM_MODE_CONNECTOR_eDP:
753                 if (desc->bpc != 6 && desc->bpc != 8 && desc->bpc != 10)
754                         dev_warn(dev, "Expected bpc in {6,8,10} but got: %u\n", desc->bpc);
755                 break;
756         case DRM_MODE_CONNECTOR_DSI:
757                 if (desc->bpc != 6 && desc->bpc != 8)
758                         dev_warn(dev, "Expected bpc in {6,8} but got: %u\n", desc->bpc);
759                 break;
760         case DRM_MODE_CONNECTOR_DPI:
761                 bus_flags = DRM_BUS_FLAG_DE_LOW |
762                             DRM_BUS_FLAG_DE_HIGH |
763                             DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE |
764                             DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
765                             DRM_BUS_FLAG_DATA_MSB_TO_LSB |
766                             DRM_BUS_FLAG_DATA_LSB_TO_MSB |
767                             DRM_BUS_FLAG_SYNC_SAMPLE_POSEDGE |
768                             DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE;
769                 if (desc->bus_flags & ~bus_flags)
770                         dev_warn(dev, "Unexpected bus_flags(%d)\n", desc->bus_flags & ~bus_flags);
771                 if (!(desc->bus_flags & bus_flags))
772                         dev_warn(dev, "Specify missing bus_flags\n");
773                 if (desc->bus_format == 0)
774                         dev_warn(dev, "Specify missing bus_format\n");
775                 if (desc->bpc != 6 && desc->bpc != 8)
776                         dev_warn(dev, "Expected bpc in {6,8} but got: %u\n", desc->bpc);
777                 break;
778         default:
779                 dev_warn(dev, "Specify a valid connector_type: %d\n", desc->connector_type);
780                 connector_type = DRM_MODE_CONNECTOR_DPI;
781                 break;
782         }
783
784         dev_set_drvdata(dev, panel);
785
786         /*
787          * We use runtime PM for prepare / unprepare since those power the panel
788          * on and off and those can be very slow operations. This is important
789          * to optimize powering the panel on briefly to read the EDID before
790          * fully enabling the panel.
791          */
792         pm_runtime_enable(dev);
793         pm_runtime_set_autosuspend_delay(dev, 1000);
794         pm_runtime_use_autosuspend(dev);
795
796         drm_panel_init(&panel->base, dev, &panel_simple_funcs, connector_type);
797
798         err = drm_panel_of_backlight(&panel->base);
799         if (err)
800                 goto disable_pm_runtime;
801
802         if (!panel->base.backlight && panel->aux) {
803                 pm_runtime_get_sync(dev);
804                 err = drm_panel_dp_aux_backlight(&panel->base, panel->aux);
805                 pm_runtime_mark_last_busy(dev);
806                 pm_runtime_put_autosuspend(dev);
807                 if (err)
808                         goto disable_pm_runtime;
809         }
810
811         drm_panel_add(&panel->base);
812
813         return 0;
814
815 disable_pm_runtime:
816         pm_runtime_dont_use_autosuspend(dev);
817         pm_runtime_disable(dev);
818 free_ddc:
819         if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc))
820                 put_device(&panel->ddc->dev);
821
822         return err;
823 }
824
825 static int panel_simple_remove(struct device *dev)
826 {
827         struct panel_simple *panel = dev_get_drvdata(dev);
828
829         drm_panel_remove(&panel->base);
830         drm_panel_disable(&panel->base);
831         drm_panel_unprepare(&panel->base);
832
833         pm_runtime_dont_use_autosuspend(dev);
834         pm_runtime_disable(dev);
835         if (panel->ddc && (!panel->aux || panel->ddc != &panel->aux->ddc))
836                 put_device(&panel->ddc->dev);
837
838         return 0;
839 }
840
841 static void panel_simple_shutdown(struct device *dev)
842 {
843         struct panel_simple *panel = dev_get_drvdata(dev);
844
845         drm_panel_disable(&panel->base);
846         drm_panel_unprepare(&panel->base);
847 }
848
849 static const struct drm_display_mode ampire_am_1280800n3tzqw_t00h_mode = {
850         .clock = 71100,
851         .hdisplay = 1280,
852         .hsync_start = 1280 + 40,
853         .hsync_end = 1280 + 40 + 80,
854         .htotal = 1280 + 40 + 80 + 40,
855         .vdisplay = 800,
856         .vsync_start = 800 + 3,
857         .vsync_end = 800 + 3 + 10,
858         .vtotal = 800 + 3 + 10 + 10,
859         .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
860 };
861
862 static const struct panel_desc ampire_am_1280800n3tzqw_t00h = {
863         .modes = &ampire_am_1280800n3tzqw_t00h_mode,
864         .num_modes = 1,
865         .bpc = 8,
866         .size = {
867                 .width = 217,
868                 .height = 136,
869         },
870         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
871         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
872         .connector_type = DRM_MODE_CONNECTOR_LVDS,
873 };
874
875 static const struct drm_display_mode ampire_am_480272h3tmqw_t01h_mode = {
876         .clock = 9000,
877         .hdisplay = 480,
878         .hsync_start = 480 + 2,
879         .hsync_end = 480 + 2 + 41,
880         .htotal = 480 + 2 + 41 + 2,
881         .vdisplay = 272,
882         .vsync_start = 272 + 2,
883         .vsync_end = 272 + 2 + 10,
884         .vtotal = 272 + 2 + 10 + 2,
885         .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
886 };
887
888 static const struct panel_desc ampire_am_480272h3tmqw_t01h = {
889         .modes = &ampire_am_480272h3tmqw_t01h_mode,
890         .num_modes = 1,
891         .bpc = 8,
892         .size = {
893                 .width = 105,
894                 .height = 67,
895         },
896         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
897 };
898
899 static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
900         .clock = 33333,
901         .hdisplay = 800,
902         .hsync_start = 800 + 0,
903         .hsync_end = 800 + 0 + 255,
904         .htotal = 800 + 0 + 255 + 0,
905         .vdisplay = 480,
906         .vsync_start = 480 + 2,
907         .vsync_end = 480 + 2 + 45,
908         .vtotal = 480 + 2 + 45 + 0,
909         .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
910 };
911
912 static const struct panel_desc ampire_am800480r3tmqwa1h = {
913         .modes = &ampire_am800480r3tmqwa1h_mode,
914         .num_modes = 1,
915         .bpc = 6,
916         .size = {
917                 .width = 152,
918                 .height = 91,
919         },
920         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
921 };
922
923 static const struct display_timing santek_st0700i5y_rbslw_f_timing = {
924         .pixelclock = { 26400000, 33300000, 46800000 },
925         .hactive = { 800, 800, 800 },
926         .hfront_porch = { 16, 210, 354 },
927         .hback_porch = { 45, 36, 6 },
928         .hsync_len = { 1, 10, 40 },
929         .vactive = { 480, 480, 480 },
930         .vfront_porch = { 7, 22, 147 },
931         .vback_porch = { 22, 13, 3 },
932         .vsync_len = { 1, 10, 20 },
933         .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
934                 DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE
935 };
936
937 static const struct panel_desc armadeus_st0700_adapt = {
938         .timings = &santek_st0700i5y_rbslw_f_timing,
939         .num_timings = 1,
940         .bpc = 6,
941         .size = {
942                 .width = 154,
943                 .height = 86,
944         },
945         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
946         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
947 };
948
949 static const struct drm_display_mode auo_b101aw03_mode = {
950         .clock = 51450,
951         .hdisplay = 1024,
952         .hsync_start = 1024 + 156,
953         .hsync_end = 1024 + 156 + 8,
954         .htotal = 1024 + 156 + 8 + 156,
955         .vdisplay = 600,
956         .vsync_start = 600 + 16,
957         .vsync_end = 600 + 16 + 6,
958         .vtotal = 600 + 16 + 6 + 16,
959 };
960
961 static const struct panel_desc auo_b101aw03 = {
962         .modes = &auo_b101aw03_mode,
963         .num_modes = 1,
964         .bpc = 6,
965         .size = {
966                 .width = 223,
967                 .height = 125,
968         },
969         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
970         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
971         .connector_type = DRM_MODE_CONNECTOR_LVDS,
972 };
973
974 static const struct display_timing auo_b101ean01_timing = {
975         .pixelclock = { 65300000, 72500000, 75000000 },
976         .hactive = { 1280, 1280, 1280 },
977         .hfront_porch = { 18, 119, 119 },
978         .hback_porch = { 21, 21, 21 },
979         .hsync_len = { 32, 32, 32 },
980         .vactive = { 800, 800, 800 },
981         .vfront_porch = { 4, 4, 4 },
982         .vback_porch = { 8, 8, 8 },
983         .vsync_len = { 18, 20, 20 },
984 };
985
986 static const struct panel_desc auo_b101ean01 = {
987         .timings = &auo_b101ean01_timing,
988         .num_timings = 1,
989         .bpc = 6,
990         .size = {
991                 .width = 217,
992                 .height = 136,
993         },
994 };
995
996 static const struct drm_display_mode auo_b101xtn01_mode = {
997         .clock = 72000,
998         .hdisplay = 1366,
999         .hsync_start = 1366 + 20,
1000         .hsync_end = 1366 + 20 + 70,
1001         .htotal = 1366 + 20 + 70,
1002         .vdisplay = 768,
1003         .vsync_start = 768 + 14,
1004         .vsync_end = 768 + 14 + 42,
1005         .vtotal = 768 + 14 + 42,
1006         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1007 };
1008
1009 static const struct panel_desc auo_b101xtn01 = {
1010         .modes = &auo_b101xtn01_mode,
1011         .num_modes = 1,
1012         .bpc = 6,
1013         .size = {
1014                 .width = 223,
1015                 .height = 125,
1016         },
1017 };
1018
1019 static const struct drm_display_mode auo_b116xak01_mode = {
1020         .clock = 69300,
1021         .hdisplay = 1366,
1022         .hsync_start = 1366 + 48,
1023         .hsync_end = 1366 + 48 + 32,
1024         .htotal = 1366 + 48 + 32 + 10,
1025         .vdisplay = 768,
1026         .vsync_start = 768 + 4,
1027         .vsync_end = 768 + 4 + 6,
1028         .vtotal = 768 + 4 + 6 + 15,
1029         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1030 };
1031
1032 static const struct panel_desc auo_b116xak01 = {
1033         .modes = &auo_b116xak01_mode,
1034         .num_modes = 1,
1035         .bpc = 6,
1036         .size = {
1037                 .width = 256,
1038                 .height = 144,
1039         },
1040         .delay = {
1041                 .hpd_absent_delay = 200,
1042         },
1043         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1044         .connector_type = DRM_MODE_CONNECTOR_eDP,
1045 };
1046
1047 static const struct drm_display_mode auo_b116xw03_mode = {
1048         .clock = 70589,
1049         .hdisplay = 1366,
1050         .hsync_start = 1366 + 40,
1051         .hsync_end = 1366 + 40 + 40,
1052         .htotal = 1366 + 40 + 40 + 32,
1053         .vdisplay = 768,
1054         .vsync_start = 768 + 10,
1055         .vsync_end = 768 + 10 + 12,
1056         .vtotal = 768 + 10 + 12 + 6,
1057         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1058 };
1059
1060 static const struct panel_desc auo_b116xw03 = {
1061         .modes = &auo_b116xw03_mode,
1062         .num_modes = 1,
1063         .bpc = 6,
1064         .size = {
1065                 .width = 256,
1066                 .height = 144,
1067         },
1068         .delay = {
1069                 .enable = 400,
1070         },
1071         .bus_flags = DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,
1072         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1073         .connector_type = DRM_MODE_CONNECTOR_eDP,
1074 };
1075
1076 static const struct drm_display_mode auo_b133xtn01_mode = {
1077         .clock = 69500,
1078         .hdisplay = 1366,
1079         .hsync_start = 1366 + 48,
1080         .hsync_end = 1366 + 48 + 32,
1081         .htotal = 1366 + 48 + 32 + 20,
1082         .vdisplay = 768,
1083         .vsync_start = 768 + 3,
1084         .vsync_end = 768 + 3 + 6,
1085         .vtotal = 768 + 3 + 6 + 13,
1086 };
1087
1088 static const struct panel_desc auo_b133xtn01 = {
1089         .modes = &auo_b133xtn01_mode,
1090         .num_modes = 1,
1091         .bpc = 6,
1092         .size = {
1093                 .width = 293,
1094                 .height = 165,
1095         },
1096 };
1097
1098 static const struct drm_display_mode auo_b133han05_mode = {
1099         .clock = 142600,
1100         .hdisplay = 1920,
1101         .hsync_start = 1920 + 58,
1102         .hsync_end = 1920 + 58 + 42,
1103         .htotal = 1920 + 58 + 42 + 60,
1104         .vdisplay = 1080,
1105         .vsync_start = 1080 + 3,
1106         .vsync_end = 1080 + 3 + 5,
1107         .vtotal = 1080 + 3 + 5 + 54,
1108 };
1109
1110 static const struct panel_desc auo_b133han05 = {
1111         .modes = &auo_b133han05_mode,
1112         .num_modes = 1,
1113         .bpc = 8,
1114         .size = {
1115                 .width = 293,
1116                 .height = 165,
1117         },
1118         .delay = {
1119                 .prepare = 100,
1120                 .enable = 20,
1121                 .unprepare = 50,
1122         },
1123         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1124         .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB,
1125         .connector_type = DRM_MODE_CONNECTOR_eDP,
1126 };
1127
1128 static const struct drm_display_mode auo_b133htn01_mode = {
1129         .clock = 150660,
1130         .hdisplay = 1920,
1131         .hsync_start = 1920 + 172,
1132         .hsync_end = 1920 + 172 + 80,
1133         .htotal = 1920 + 172 + 80 + 60,
1134         .vdisplay = 1080,
1135         .vsync_start = 1080 + 25,
1136         .vsync_end = 1080 + 25 + 10,
1137         .vtotal = 1080 + 25 + 10 + 10,
1138 };
1139
1140 static const struct panel_desc auo_b133htn01 = {
1141         .modes = &auo_b133htn01_mode,
1142         .num_modes = 1,
1143         .bpc = 6,
1144         .size = {
1145                 .width = 293,
1146                 .height = 165,
1147         },
1148         .delay = {
1149                 .prepare = 105,
1150                 .enable = 20,
1151                 .unprepare = 50,
1152         },
1153 };
1154
1155 static const struct drm_display_mode auo_b140han06_mode = {
1156         .clock = 141000,
1157         .hdisplay = 1920,
1158         .hsync_start = 1920 + 16,
1159         .hsync_end = 1920 + 16 + 16,
1160         .htotal = 1920 + 16 + 16 + 152,
1161         .vdisplay = 1080,
1162         .vsync_start = 1080 + 3,
1163         .vsync_end = 1080 + 3 + 14,
1164         .vtotal = 1080 + 3 + 14 + 19,
1165 };
1166
1167 static const struct panel_desc auo_b140han06 = {
1168         .modes = &auo_b140han06_mode,
1169         .num_modes = 1,
1170         .bpc = 8,
1171         .size = {
1172                 .width = 309,
1173                 .height = 174,
1174         },
1175         .delay = {
1176                 .prepare = 100,
1177                 .enable = 20,
1178                 .unprepare = 50,
1179         },
1180         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1181         .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB,
1182         .connector_type = DRM_MODE_CONNECTOR_eDP,
1183 };
1184
1185 static const struct display_timing auo_g070vvn01_timings = {
1186         .pixelclock = { 33300000, 34209000, 45000000 },
1187         .hactive = { 800, 800, 800 },
1188         .hfront_porch = { 20, 40, 200 },
1189         .hback_porch = { 87, 40, 1 },
1190         .hsync_len = { 1, 48, 87 },
1191         .vactive = { 480, 480, 480 },
1192         .vfront_porch = { 5, 13, 200 },
1193         .vback_porch = { 31, 31, 29 },
1194         .vsync_len = { 1, 1, 3 },
1195 };
1196
1197 static const struct panel_desc auo_g070vvn01 = {
1198         .timings = &auo_g070vvn01_timings,
1199         .num_timings = 1,
1200         .bpc = 8,
1201         .size = {
1202                 .width = 152,
1203                 .height = 91,
1204         },
1205         .delay = {
1206                 .prepare = 200,
1207                 .enable = 50,
1208                 .disable = 50,
1209                 .unprepare = 1000,
1210         },
1211 };
1212
1213 static const struct drm_display_mode auo_g101evn010_mode = {
1214         .clock = 68930,
1215         .hdisplay = 1280,
1216         .hsync_start = 1280 + 82,
1217         .hsync_end = 1280 + 82 + 2,
1218         .htotal = 1280 + 82 + 2 + 84,
1219         .vdisplay = 800,
1220         .vsync_start = 800 + 8,
1221         .vsync_end = 800 + 8 + 2,
1222         .vtotal = 800 + 8 + 2 + 6,
1223 };
1224
1225 static const struct panel_desc auo_g101evn010 = {
1226         .modes = &auo_g101evn010_mode,
1227         .num_modes = 1,
1228         .bpc = 6,
1229         .size = {
1230                 .width = 216,
1231                 .height = 135,
1232         },
1233         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
1234         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1235 };
1236
1237 static const struct drm_display_mode auo_g104sn02_mode = {
1238         .clock = 40000,
1239         .hdisplay = 800,
1240         .hsync_start = 800 + 40,
1241         .hsync_end = 800 + 40 + 216,
1242         .htotal = 800 + 40 + 216 + 128,
1243         .vdisplay = 600,
1244         .vsync_start = 600 + 10,
1245         .vsync_end = 600 + 10 + 35,
1246         .vtotal = 600 + 10 + 35 + 2,
1247 };
1248
1249 static const struct panel_desc auo_g104sn02 = {
1250         .modes = &auo_g104sn02_mode,
1251         .num_modes = 1,
1252         .bpc = 8,
1253         .size = {
1254                 .width = 211,
1255                 .height = 158,
1256         },
1257         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1258         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1259 };
1260
1261 static const struct drm_display_mode auo_g121ean01_mode = {
1262         .clock = 66700,
1263         .hdisplay = 1280,
1264         .hsync_start = 1280 + 58,
1265         .hsync_end = 1280 + 58 + 8,
1266         .htotal = 1280 + 58 + 8 + 70,
1267         .vdisplay = 800,
1268         .vsync_start = 800 + 6,
1269         .vsync_end = 800 + 6 + 4,
1270         .vtotal = 800 + 6 + 4 + 10,
1271 };
1272
1273 static const struct panel_desc auo_g121ean01 = {
1274         .modes = &auo_g121ean01_mode,
1275         .num_modes = 1,
1276         .bpc = 8,
1277         .size = {
1278                 .width = 261,
1279                 .height = 163,
1280         },
1281         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1282         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1283 };
1284
1285 static const struct display_timing auo_g133han01_timings = {
1286         .pixelclock = { 134000000, 141200000, 149000000 },
1287         .hactive = { 1920, 1920, 1920 },
1288         .hfront_porch = { 39, 58, 77 },
1289         .hback_porch = { 59, 88, 117 },
1290         .hsync_len = { 28, 42, 56 },
1291         .vactive = { 1080, 1080, 1080 },
1292         .vfront_porch = { 3, 8, 11 },
1293         .vback_porch = { 5, 14, 19 },
1294         .vsync_len = { 4, 14, 19 },
1295 };
1296
1297 static const struct panel_desc auo_g133han01 = {
1298         .timings = &auo_g133han01_timings,
1299         .num_timings = 1,
1300         .bpc = 8,
1301         .size = {
1302                 .width = 293,
1303                 .height = 165,
1304         },
1305         .delay = {
1306                 .prepare = 200,
1307                 .enable = 50,
1308                 .disable = 50,
1309                 .unprepare = 1000,
1310         },
1311         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
1312         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1313 };
1314
1315 static const struct drm_display_mode auo_g156xtn01_mode = {
1316         .clock = 76000,
1317         .hdisplay = 1366,
1318         .hsync_start = 1366 + 33,
1319         .hsync_end = 1366 + 33 + 67,
1320         .htotal = 1560,
1321         .vdisplay = 768,
1322         .vsync_start = 768 + 4,
1323         .vsync_end = 768 + 4 + 4,
1324         .vtotal = 806,
1325 };
1326
1327 static const struct panel_desc auo_g156xtn01 = {
1328         .modes = &auo_g156xtn01_mode,
1329         .num_modes = 1,
1330         .bpc = 8,
1331         .size = {
1332                 .width = 344,
1333                 .height = 194,
1334         },
1335         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1336         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1337 };
1338
1339 static const struct display_timing auo_g185han01_timings = {
1340         .pixelclock = { 120000000, 144000000, 175000000 },
1341         .hactive = { 1920, 1920, 1920 },
1342         .hfront_porch = { 36, 120, 148 },
1343         .hback_porch = { 24, 88, 108 },
1344         .hsync_len = { 20, 48, 64 },
1345         .vactive = { 1080, 1080, 1080 },
1346         .vfront_porch = { 6, 10, 40 },
1347         .vback_porch = { 2, 5, 20 },
1348         .vsync_len = { 2, 5, 20 },
1349 };
1350
1351 static const struct panel_desc auo_g185han01 = {
1352         .timings = &auo_g185han01_timings,
1353         .num_timings = 1,
1354         .bpc = 8,
1355         .size = {
1356                 .width = 409,
1357                 .height = 230,
1358         },
1359         .delay = {
1360                 .prepare = 50,
1361                 .enable = 200,
1362                 .disable = 110,
1363                 .unprepare = 1000,
1364         },
1365         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1366         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1367 };
1368
1369 static const struct display_timing auo_g190ean01_timings = {
1370         .pixelclock = { 90000000, 108000000, 135000000 },
1371         .hactive = { 1280, 1280, 1280 },
1372         .hfront_porch = { 126, 184, 1266 },
1373         .hback_porch = { 84, 122, 844 },
1374         .hsync_len = { 70, 102, 704 },
1375         .vactive = { 1024, 1024, 1024 },
1376         .vfront_porch = { 4, 26, 76 },
1377         .vback_porch = { 2, 8, 25 },
1378         .vsync_len = { 2, 8, 25 },
1379 };
1380
1381 static const struct panel_desc auo_g190ean01 = {
1382         .timings = &auo_g190ean01_timings,
1383         .num_timings = 1,
1384         .bpc = 8,
1385         .size = {
1386                 .width = 376,
1387                 .height = 301,
1388         },
1389         .delay = {
1390                 .prepare = 50,
1391                 .enable = 200,
1392                 .disable = 110,
1393                 .unprepare = 1000,
1394         },
1395         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1396         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1397 };
1398
1399 static const struct display_timing auo_p320hvn03_timings = {
1400         .pixelclock = { 106000000, 148500000, 164000000 },
1401         .hactive = { 1920, 1920, 1920 },
1402         .hfront_porch = { 25, 50, 130 },
1403         .hback_porch = { 25, 50, 130 },
1404         .hsync_len = { 20, 40, 105 },
1405         .vactive = { 1080, 1080, 1080 },
1406         .vfront_porch = { 8, 17, 150 },
1407         .vback_porch = { 8, 17, 150 },
1408         .vsync_len = { 4, 11, 100 },
1409 };
1410
1411 static const struct panel_desc auo_p320hvn03 = {
1412         .timings = &auo_p320hvn03_timings,
1413         .num_timings = 1,
1414         .bpc = 8,
1415         .size = {
1416                 .width = 698,
1417                 .height = 393,
1418         },
1419         .delay = {
1420                 .prepare = 1,
1421                 .enable = 450,
1422                 .unprepare = 500,
1423         },
1424         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1425         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1426 };
1427
1428 static const struct drm_display_mode auo_t215hvn01_mode = {
1429         .clock = 148800,
1430         .hdisplay = 1920,
1431         .hsync_start = 1920 + 88,
1432         .hsync_end = 1920 + 88 + 44,
1433         .htotal = 1920 + 88 + 44 + 148,
1434         .vdisplay = 1080,
1435         .vsync_start = 1080 + 4,
1436         .vsync_end = 1080 + 4 + 5,
1437         .vtotal = 1080 + 4 + 5 + 36,
1438 };
1439
1440 static const struct panel_desc auo_t215hvn01 = {
1441         .modes = &auo_t215hvn01_mode,
1442         .num_modes = 1,
1443         .bpc = 8,
1444         .size = {
1445                 .width = 430,
1446                 .height = 270,
1447         },
1448         .delay = {
1449                 .disable = 5,
1450                 .unprepare = 1000,
1451         }
1452 };
1453
1454 static const struct drm_display_mode avic_tm070ddh03_mode = {
1455         .clock = 51200,
1456         .hdisplay = 1024,
1457         .hsync_start = 1024 + 160,
1458         .hsync_end = 1024 + 160 + 4,
1459         .htotal = 1024 + 160 + 4 + 156,
1460         .vdisplay = 600,
1461         .vsync_start = 600 + 17,
1462         .vsync_end = 600 + 17 + 1,
1463         .vtotal = 600 + 17 + 1 + 17,
1464 };
1465
1466 static const struct panel_desc avic_tm070ddh03 = {
1467         .modes = &avic_tm070ddh03_mode,
1468         .num_modes = 1,
1469         .bpc = 8,
1470         .size = {
1471                 .width = 154,
1472                 .height = 90,
1473         },
1474         .delay = {
1475                 .prepare = 20,
1476                 .enable = 200,
1477                 .disable = 200,
1478         },
1479 };
1480
1481 static const struct drm_display_mode bananapi_s070wv20_ct16_mode = {
1482         .clock = 30000,
1483         .hdisplay = 800,
1484         .hsync_start = 800 + 40,
1485         .hsync_end = 800 + 40 + 48,
1486         .htotal = 800 + 40 + 48 + 40,
1487         .vdisplay = 480,
1488         .vsync_start = 480 + 13,
1489         .vsync_end = 480 + 13 + 3,
1490         .vtotal = 480 + 13 + 3 + 29,
1491 };
1492
1493 static const struct panel_desc bananapi_s070wv20_ct16 = {
1494         .modes = &bananapi_s070wv20_ct16_mode,
1495         .num_modes = 1,
1496         .bpc = 6,
1497         .size = {
1498                 .width = 154,
1499                 .height = 86,
1500         },
1501 };
1502
1503 static const struct drm_display_mode boe_hv070wsa_mode = {
1504         .clock = 42105,
1505         .hdisplay = 1024,
1506         .hsync_start = 1024 + 30,
1507         .hsync_end = 1024 + 30 + 30,
1508         .htotal = 1024 + 30 + 30 + 30,
1509         .vdisplay = 600,
1510         .vsync_start = 600 + 10,
1511         .vsync_end = 600 + 10 + 10,
1512         .vtotal = 600 + 10 + 10 + 10,
1513 };
1514
1515 static const struct panel_desc boe_hv070wsa = {
1516         .modes = &boe_hv070wsa_mode,
1517         .num_modes = 1,
1518         .bpc = 8,
1519         .size = {
1520                 .width = 154,
1521                 .height = 90,
1522         },
1523         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1524         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
1525         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1526 };
1527
1528 static const struct drm_display_mode boe_nv101wxmn51_modes[] = {
1529         {
1530                 .clock = 71900,
1531                 .hdisplay = 1280,
1532                 .hsync_start = 1280 + 48,
1533                 .hsync_end = 1280 + 48 + 32,
1534                 .htotal = 1280 + 48 + 32 + 80,
1535                 .vdisplay = 800,
1536                 .vsync_start = 800 + 3,
1537                 .vsync_end = 800 + 3 + 5,
1538                 .vtotal = 800 + 3 + 5 + 24,
1539         },
1540         {
1541                 .clock = 57500,
1542                 .hdisplay = 1280,
1543                 .hsync_start = 1280 + 48,
1544                 .hsync_end = 1280 + 48 + 32,
1545                 .htotal = 1280 + 48 + 32 + 80,
1546                 .vdisplay = 800,
1547                 .vsync_start = 800 + 3,
1548                 .vsync_end = 800 + 3 + 5,
1549                 .vtotal = 800 + 3 + 5 + 24,
1550         },
1551 };
1552
1553 static const struct panel_desc boe_nv101wxmn51 = {
1554         .modes = boe_nv101wxmn51_modes,
1555         .num_modes = ARRAY_SIZE(boe_nv101wxmn51_modes),
1556         .bpc = 8,
1557         .size = {
1558                 .width = 217,
1559                 .height = 136,
1560         },
1561         .delay = {
1562                 .prepare = 210,
1563                 .enable = 50,
1564                 .unprepare = 160,
1565         },
1566 };
1567
1568 static const struct drm_display_mode boe_nv110wtm_n61_modes[] = {
1569         {
1570                 .clock = 207800,
1571                 .hdisplay = 2160,
1572                 .hsync_start = 2160 + 48,
1573                 .hsync_end = 2160 + 48 + 32,
1574                 .htotal = 2160 + 48 + 32 + 100,
1575                 .vdisplay = 1440,
1576                 .vsync_start = 1440 + 3,
1577                 .vsync_end = 1440 + 3 + 6,
1578                 .vtotal = 1440 + 3 + 6 + 31,
1579                 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC,
1580         },
1581         {
1582                 .clock = 138500,
1583                 .hdisplay = 2160,
1584                 .hsync_start = 2160 + 48,
1585                 .hsync_end = 2160 + 48 + 32,
1586                 .htotal = 2160 + 48 + 32 + 100,
1587                 .vdisplay = 1440,
1588                 .vsync_start = 1440 + 3,
1589                 .vsync_end = 1440 + 3 + 6,
1590                 .vtotal = 1440 + 3 + 6 + 31,
1591                 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC,
1592         },
1593 };
1594
1595 static const struct panel_desc boe_nv110wtm_n61 = {
1596         .modes = boe_nv110wtm_n61_modes,
1597         .num_modes = ARRAY_SIZE(boe_nv110wtm_n61_modes),
1598         .bpc = 8,
1599         .size = {
1600                 .width = 233,
1601                 .height = 155,
1602         },
1603         .delay = {
1604                 .hpd_absent_delay = 200,
1605                 .prepare_to_enable = 80,
1606                 .enable = 50,
1607                 .unprepare = 500,
1608         },
1609         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1610         .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB,
1611         .connector_type = DRM_MODE_CONNECTOR_eDP,
1612 };
1613
1614 /* Also used for boe_nv133fhm_n62 */
1615 static const struct drm_display_mode boe_nv133fhm_n61_modes = {
1616         .clock = 147840,
1617         .hdisplay = 1920,
1618         .hsync_start = 1920 + 48,
1619         .hsync_end = 1920 + 48 + 32,
1620         .htotal = 1920 + 48 + 32 + 200,
1621         .vdisplay = 1080,
1622         .vsync_start = 1080 + 3,
1623         .vsync_end = 1080 + 3 + 6,
1624         .vtotal = 1080 + 3 + 6 + 31,
1625         .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC,
1626 };
1627
1628 /* Also used for boe_nv133fhm_n62 */
1629 static const struct panel_desc boe_nv133fhm_n61 = {
1630         .modes = &boe_nv133fhm_n61_modes,
1631         .num_modes = 1,
1632         .bpc = 6,
1633         .size = {
1634                 .width = 294,
1635                 .height = 165,
1636         },
1637         .delay = {
1638                 /*
1639                  * When power is first given to the panel there's a short
1640                  * spike on the HPD line.  It was explained that this spike
1641                  * was until the TCON data download was complete.  On
1642                  * one system this was measured at 8 ms.  We'll put 15 ms
1643                  * in the prepare delay just to be safe and take it away
1644                  * from the hpd_absent_delay (which would otherwise be 200 ms)
1645                  * to handle this.  That means:
1646                  * - If HPD isn't hooked up you still have 200 ms delay.
1647                  * - If HPD is hooked up we won't try to look at it for the
1648                  *   first 15 ms.
1649                  */
1650                 .prepare = 15,
1651                 .hpd_absent_delay = 185,
1652
1653                 .unprepare = 500,
1654         },
1655         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1656         .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB,
1657         .connector_type = DRM_MODE_CONNECTOR_eDP,
1658 };
1659
1660 static const struct drm_display_mode boe_nv140fhmn49_modes[] = {
1661         {
1662                 .clock = 148500,
1663                 .hdisplay = 1920,
1664                 .hsync_start = 1920 + 48,
1665                 .hsync_end = 1920 + 48 + 32,
1666                 .htotal = 2200,
1667                 .vdisplay = 1080,
1668                 .vsync_start = 1080 + 3,
1669                 .vsync_end = 1080 + 3 + 5,
1670                 .vtotal = 1125,
1671         },
1672 };
1673
1674 static const struct panel_desc boe_nv140fhmn49 = {
1675         .modes = boe_nv140fhmn49_modes,
1676         .num_modes = ARRAY_SIZE(boe_nv140fhmn49_modes),
1677         .bpc = 6,
1678         .size = {
1679                 .width = 309,
1680                 .height = 174,
1681         },
1682         .delay = {
1683                 .prepare = 210,
1684                 .enable = 50,
1685                 .unprepare = 160,
1686         },
1687         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1688         .connector_type = DRM_MODE_CONNECTOR_eDP,
1689 };
1690
1691 static const struct drm_display_mode cdtech_s043wq26h_ct7_mode = {
1692         .clock = 9000,
1693         .hdisplay = 480,
1694         .hsync_start = 480 + 5,
1695         .hsync_end = 480 + 5 + 5,
1696         .htotal = 480 + 5 + 5 + 40,
1697         .vdisplay = 272,
1698         .vsync_start = 272 + 8,
1699         .vsync_end = 272 + 8 + 8,
1700         .vtotal = 272 + 8 + 8 + 8,
1701         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
1702 };
1703
1704 static const struct panel_desc cdtech_s043wq26h_ct7 = {
1705         .modes = &cdtech_s043wq26h_ct7_mode,
1706         .num_modes = 1,
1707         .bpc = 8,
1708         .size = {
1709                 .width = 95,
1710                 .height = 54,
1711         },
1712         .bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
1713 };
1714
1715 /* S070PWS19HP-FC21 2017/04/22 */
1716 static const struct drm_display_mode cdtech_s070pws19hp_fc21_mode = {
1717         .clock = 51200,
1718         .hdisplay = 1024,
1719         .hsync_start = 1024 + 160,
1720         .hsync_end = 1024 + 160 + 20,
1721         .htotal = 1024 + 160 + 20 + 140,
1722         .vdisplay = 600,
1723         .vsync_start = 600 + 12,
1724         .vsync_end = 600 + 12 + 3,
1725         .vtotal = 600 + 12 + 3 + 20,
1726         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
1727 };
1728
1729 static const struct panel_desc cdtech_s070pws19hp_fc21 = {
1730         .modes = &cdtech_s070pws19hp_fc21_mode,
1731         .num_modes = 1,
1732         .bpc = 6,
1733         .size = {
1734                 .width = 154,
1735                 .height = 86,
1736         },
1737         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1738         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
1739         .connector_type = DRM_MODE_CONNECTOR_DPI,
1740 };
1741
1742 /* S070SWV29HG-DC44 2017/09/21 */
1743 static const struct drm_display_mode cdtech_s070swv29hg_dc44_mode = {
1744         .clock = 33300,
1745         .hdisplay = 800,
1746         .hsync_start = 800 + 210,
1747         .hsync_end = 800 + 210 + 2,
1748         .htotal = 800 + 210 + 2 + 44,
1749         .vdisplay = 480,
1750         .vsync_start = 480 + 22,
1751         .vsync_end = 480 + 22 + 2,
1752         .vtotal = 480 + 22 + 2 + 21,
1753         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
1754 };
1755
1756 static const struct panel_desc cdtech_s070swv29hg_dc44 = {
1757         .modes = &cdtech_s070swv29hg_dc44_mode,
1758         .num_modes = 1,
1759         .bpc = 6,
1760         .size = {
1761                 .width = 154,
1762                 .height = 86,
1763         },
1764         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1765         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
1766         .connector_type = DRM_MODE_CONNECTOR_DPI,
1767 };
1768
1769 static const struct drm_display_mode cdtech_s070wv95_ct16_mode = {
1770         .clock = 35000,
1771         .hdisplay = 800,
1772         .hsync_start = 800 + 40,
1773         .hsync_end = 800 + 40 + 40,
1774         .htotal = 800 + 40 + 40 + 48,
1775         .vdisplay = 480,
1776         .vsync_start = 480 + 29,
1777         .vsync_end = 480 + 29 + 13,
1778         .vtotal = 480 + 29 + 13 + 3,
1779         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
1780 };
1781
1782 static const struct panel_desc cdtech_s070wv95_ct16 = {
1783         .modes = &cdtech_s070wv95_ct16_mode,
1784         .num_modes = 1,
1785         .bpc = 8,
1786         .size = {
1787                 .width = 154,
1788                 .height = 85,
1789         },
1790 };
1791
1792 static const struct display_timing chefree_ch101olhlwh_002_timing = {
1793         .pixelclock = { 68900000, 71100000, 73400000 },
1794         .hactive = { 1280, 1280, 1280 },
1795         .hfront_porch = { 65, 80, 95 },
1796         .hback_porch = { 64, 79, 94 },
1797         .hsync_len = { 1, 1, 1 },
1798         .vactive = { 800, 800, 800 },
1799         .vfront_porch = { 7, 11, 14 },
1800         .vback_porch = { 7, 11, 14 },
1801         .vsync_len = { 1, 1, 1 },
1802         .flags = DISPLAY_FLAGS_DE_HIGH,
1803 };
1804
1805 static const struct panel_desc chefree_ch101olhlwh_002 = {
1806         .timings = &chefree_ch101olhlwh_002_timing,
1807         .num_timings = 1,
1808         .bpc = 8,
1809         .size = {
1810                 .width = 217,
1811                 .height = 135,
1812         },
1813         .delay = {
1814                 .enable = 200,
1815                 .disable = 200,
1816         },
1817         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
1818         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1819         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1820 };
1821
1822 static const struct drm_display_mode chunghwa_claa070wp03xg_mode = {
1823         .clock = 66770,
1824         .hdisplay = 800,
1825         .hsync_start = 800 + 49,
1826         .hsync_end = 800 + 49 + 33,
1827         .htotal = 800 + 49 + 33 + 17,
1828         .vdisplay = 1280,
1829         .vsync_start = 1280 + 1,
1830         .vsync_end = 1280 + 1 + 7,
1831         .vtotal = 1280 + 1 + 7 + 15,
1832         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1833 };
1834
1835 static const struct panel_desc chunghwa_claa070wp03xg = {
1836         .modes = &chunghwa_claa070wp03xg_mode,
1837         .num_modes = 1,
1838         .bpc = 6,
1839         .size = {
1840                 .width = 94,
1841                 .height = 150,
1842         },
1843         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
1844         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
1845         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1846 };
1847
1848 static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
1849         .clock = 72070,
1850         .hdisplay = 1366,
1851         .hsync_start = 1366 + 58,
1852         .hsync_end = 1366 + 58 + 58,
1853         .htotal = 1366 + 58 + 58 + 58,
1854         .vdisplay = 768,
1855         .vsync_start = 768 + 4,
1856         .vsync_end = 768 + 4 + 4,
1857         .vtotal = 768 + 4 + 4 + 4,
1858 };
1859
1860 static const struct panel_desc chunghwa_claa101wa01a = {
1861         .modes = &chunghwa_claa101wa01a_mode,
1862         .num_modes = 1,
1863         .bpc = 6,
1864         .size = {
1865                 .width = 220,
1866                 .height = 120,
1867         },
1868         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
1869         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
1870         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1871 };
1872
1873 static const struct drm_display_mode chunghwa_claa101wb01_mode = {
1874         .clock = 69300,
1875         .hdisplay = 1366,
1876         .hsync_start = 1366 + 48,
1877         .hsync_end = 1366 + 48 + 32,
1878         .htotal = 1366 + 48 + 32 + 20,
1879         .vdisplay = 768,
1880         .vsync_start = 768 + 16,
1881         .vsync_end = 768 + 16 + 8,
1882         .vtotal = 768 + 16 + 8 + 16,
1883 };
1884
1885 static const struct panel_desc chunghwa_claa101wb01 = {
1886         .modes = &chunghwa_claa101wb01_mode,
1887         .num_modes = 1,
1888         .bpc = 6,
1889         .size = {
1890                 .width = 223,
1891                 .height = 125,
1892         },
1893         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
1894         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
1895         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1896 };
1897
1898 static const struct drm_display_mode dataimage_scf0700c48ggu18_mode = {
1899         .clock = 33260,
1900         .hdisplay = 800,
1901         .hsync_start = 800 + 40,
1902         .hsync_end = 800 + 40 + 128,
1903         .htotal = 800 + 40 + 128 + 88,
1904         .vdisplay = 480,
1905         .vsync_start = 480 + 10,
1906         .vsync_end = 480 + 10 + 2,
1907         .vtotal = 480 + 10 + 2 + 33,
1908         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1909 };
1910
1911 static const struct panel_desc dataimage_scf0700c48ggu18 = {
1912         .modes = &dataimage_scf0700c48ggu18_mode,
1913         .num_modes = 1,
1914         .bpc = 8,
1915         .size = {
1916                 .width = 152,
1917                 .height = 91,
1918         },
1919         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1920         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
1921 };
1922
1923 static const struct display_timing dlc_dlc0700yzg_1_timing = {
1924         .pixelclock = { 45000000, 51200000, 57000000 },
1925         .hactive = { 1024, 1024, 1024 },
1926         .hfront_porch = { 100, 106, 113 },
1927         .hback_porch = { 100, 106, 113 },
1928         .hsync_len = { 100, 108, 114 },
1929         .vactive = { 600, 600, 600 },
1930         .vfront_porch = { 8, 11, 15 },
1931         .vback_porch = { 8, 11, 15 },
1932         .vsync_len = { 9, 13, 15 },
1933         .flags = DISPLAY_FLAGS_DE_HIGH,
1934 };
1935
1936 static const struct panel_desc dlc_dlc0700yzg_1 = {
1937         .timings = &dlc_dlc0700yzg_1_timing,
1938         .num_timings = 1,
1939         .bpc = 6,
1940         .size = {
1941                 .width = 154,
1942                 .height = 86,
1943         },
1944         .delay = {
1945                 .prepare = 30,
1946                 .enable = 200,
1947                 .disable = 200,
1948         },
1949         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
1950         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1951 };
1952
1953 static const struct display_timing dlc_dlc1010gig_timing = {
1954         .pixelclock = { 68900000, 71100000, 73400000 },
1955         .hactive = { 1280, 1280, 1280 },
1956         .hfront_porch = { 43, 53, 63 },
1957         .hback_porch = { 43, 53, 63 },
1958         .hsync_len = { 44, 54, 64 },
1959         .vactive = { 800, 800, 800 },
1960         .vfront_porch = { 5, 8, 11 },
1961         .vback_porch = { 5, 8, 11 },
1962         .vsync_len = { 5, 7, 11 },
1963         .flags = DISPLAY_FLAGS_DE_HIGH,
1964 };
1965
1966 static const struct panel_desc dlc_dlc1010gig = {
1967         .timings = &dlc_dlc1010gig_timing,
1968         .num_timings = 1,
1969         .bpc = 8,
1970         .size = {
1971                 .width = 216,
1972                 .height = 135,
1973         },
1974         .delay = {
1975                 .prepare = 60,
1976                 .enable = 150,
1977                 .disable = 100,
1978                 .unprepare = 60,
1979         },
1980         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1981         .connector_type = DRM_MODE_CONNECTOR_LVDS,
1982 };
1983
1984 static const struct drm_display_mode edt_et035012dm6_mode = {
1985         .clock = 6500,
1986         .hdisplay = 320,
1987         .hsync_start = 320 + 20,
1988         .hsync_end = 320 + 20 + 30,
1989         .htotal = 320 + 20 + 68,
1990         .vdisplay = 240,
1991         .vsync_start = 240 + 4,
1992         .vsync_end = 240 + 4 + 4,
1993         .vtotal = 240 + 4 + 4 + 14,
1994         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1995 };
1996
1997 static const struct panel_desc edt_et035012dm6 = {
1998         .modes = &edt_et035012dm6_mode,
1999         .num_modes = 1,
2000         .bpc = 8,
2001         .size = {
2002                 .width = 70,
2003                 .height = 52,
2004         },
2005         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2006         .bus_flags = DRM_BUS_FLAG_DE_LOW | DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
2007 };
2008
2009 static const struct drm_display_mode edt_etm0350g0dh6_mode = {
2010         .clock = 6520,
2011         .hdisplay = 320,
2012         .hsync_start = 320 + 20,
2013         .hsync_end = 320 + 20 + 68,
2014         .htotal = 320 + 20 + 68,
2015         .vdisplay = 240,
2016         .vsync_start = 240 + 4,
2017         .vsync_end = 240 + 4 + 18,
2018         .vtotal = 240 + 4 + 18,
2019         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
2020 };
2021
2022 static const struct panel_desc edt_etm0350g0dh6 = {
2023         .modes = &edt_etm0350g0dh6_mode,
2024         .num_modes = 1,
2025         .bpc = 6,
2026         .size = {
2027                 .width = 70,
2028                 .height = 53,
2029         },
2030         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2031         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
2032         .connector_type = DRM_MODE_CONNECTOR_DPI,
2033 };
2034
2035 static const struct drm_display_mode edt_etm043080dh6gp_mode = {
2036         .clock = 10870,
2037         .hdisplay = 480,
2038         .hsync_start = 480 + 8,
2039         .hsync_end = 480 + 8 + 4,
2040         .htotal = 480 + 8 + 4 + 41,
2041
2042         /*
2043          * IWG22M: Y resolution changed for "dc_linuxfb" module crashing while
2044          * fb_align
2045          */
2046
2047         .vdisplay = 288,
2048         .vsync_start = 288 + 2,
2049         .vsync_end = 288 + 2 + 4,
2050         .vtotal = 288 + 2 + 4 + 10,
2051 };
2052
2053 static const struct panel_desc edt_etm043080dh6gp = {
2054         .modes = &edt_etm043080dh6gp_mode,
2055         .num_modes = 1,
2056         .bpc = 8,
2057         .size = {
2058                 .width = 100,
2059                 .height = 65,
2060         },
2061         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
2062         .connector_type = DRM_MODE_CONNECTOR_DPI,
2063 };
2064
2065 static const struct drm_display_mode edt_etm0430g0dh6_mode = {
2066         .clock = 9000,
2067         .hdisplay = 480,
2068         .hsync_start = 480 + 2,
2069         .hsync_end = 480 + 2 + 41,
2070         .htotal = 480 + 2 + 41 + 2,
2071         .vdisplay = 272,
2072         .vsync_start = 272 + 2,
2073         .vsync_end = 272 + 2 + 10,
2074         .vtotal = 272 + 2 + 10 + 2,
2075         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
2076 };
2077
2078 static const struct panel_desc edt_etm0430g0dh6 = {
2079         .modes = &edt_etm0430g0dh6_mode,
2080         .num_modes = 1,
2081         .bpc = 6,
2082         .size = {
2083                 .width = 95,
2084                 .height = 54,
2085         },
2086         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
2087         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
2088         .connector_type = DRM_MODE_CONNECTOR_DPI,
2089 };
2090
2091 static const struct drm_display_mode edt_et057090dhu_mode = {
2092         .clock = 25175,
2093         .hdisplay = 640,
2094         .hsync_start = 640 + 16,
2095         .hsync_end = 640 + 16 + 30,
2096         .htotal = 640 + 16 + 30 + 114,
2097         .vdisplay = 480,
2098         .vsync_start = 480 + 10,
2099         .vsync_end = 480 + 10 + 3,
2100         .vtotal = 480 + 10 + 3 + 32,
2101         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
2102 };
2103
2104 static const struct panel_desc edt_et057090dhu = {
2105         .modes = &edt_et057090dhu_mode,
2106         .num_modes = 1,
2107         .bpc = 6,
2108         .size = {
2109                 .width = 115,
2110                 .height = 86,
2111         },
2112         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
2113         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
2114         .connector_type = DRM_MODE_CONNECTOR_DPI,
2115 };
2116
2117 static const struct drm_display_mode edt_etm0700g0dh6_mode = {
2118         .clock = 33260,
2119         .hdisplay = 800,
2120         .hsync_start = 800 + 40,
2121         .hsync_end = 800 + 40 + 128,
2122         .htotal = 800 + 40 + 128 + 88,
2123         .vdisplay = 480,
2124         .vsync_start = 480 + 10,
2125         .vsync_end = 480 + 10 + 2,
2126         .vtotal = 480 + 10 + 2 + 33,
2127         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
2128 };
2129
2130 static const struct panel_desc edt_etm0700g0dh6 = {
2131         .modes = &edt_etm0700g0dh6_mode,
2132         .num_modes = 1,
2133         .bpc = 6,
2134         .size = {
2135                 .width = 152,
2136                 .height = 91,
2137         },
2138         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
2139         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
2140         .connector_type = DRM_MODE_CONNECTOR_DPI,
2141 };
2142
2143 static const struct panel_desc edt_etm0700g0bdh6 = {
2144         .modes = &edt_etm0700g0dh6_mode,
2145         .num_modes = 1,
2146         .bpc = 6,
2147         .size = {
2148                 .width = 152,
2149                 .height = 91,
2150         },
2151         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
2152         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
2153         .connector_type = DRM_MODE_CONNECTOR_DPI,
2154 };
2155
2156 static const struct drm_display_mode edt_etmv570g2dhu_mode = {
2157         .clock = 25175,
2158         .hdisplay = 640,
2159         .hsync_start = 640,
2160         .hsync_end = 640 + 16,
2161         .htotal = 640 + 16 + 30 + 114,
2162         .vdisplay = 480,
2163         .vsync_start = 480 + 10,
2164         .vsync_end = 480 + 10 + 3,
2165         .vtotal = 480 + 10 + 3 + 35,
2166         .flags = DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_PHSYNC,
2167 };
2168
2169 static const struct panel_desc edt_etmv570g2dhu = {
2170         .modes = &edt_etmv570g2dhu_mode,
2171         .num_modes = 1,
2172         .bpc = 6,
2173         .size = {
2174                 .width = 115,
2175                 .height = 86,
2176         },
2177         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2178         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
2179         .connector_type = DRM_MODE_CONNECTOR_DPI,
2180 };
2181
2182 static const struct display_timing eink_vb3300_kca_timing = {
2183         .pixelclock = { 40000000, 40000000, 40000000 },
2184         .hactive = { 334, 334, 334 },
2185         .hfront_porch = { 1, 1, 1 },
2186         .hback_porch = { 1, 1, 1 },
2187         .hsync_len = { 1, 1, 1 },
2188         .vactive = { 1405, 1405, 1405 },
2189         .vfront_porch = { 1, 1, 1 },
2190         .vback_porch = { 1, 1, 1 },
2191         .vsync_len = { 1, 1, 1 },
2192         .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
2193                  DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE,
2194 };
2195
2196 static const struct panel_desc eink_vb3300_kca = {
2197         .timings = &eink_vb3300_kca_timing,
2198         .num_timings = 1,
2199         .bpc = 6,
2200         .size = {
2201                 .width = 157,
2202                 .height = 209,
2203         },
2204         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2205         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
2206         .connector_type = DRM_MODE_CONNECTOR_DPI,
2207 };
2208
2209 static const struct display_timing evervision_vgg804821_timing = {
2210         .pixelclock = { 27600000, 33300000, 50000000 },
2211         .hactive = { 800, 800, 800 },
2212         .hfront_porch = { 40, 66, 70 },
2213         .hback_porch = { 40, 67, 70 },
2214         .hsync_len = { 40, 67, 70 },
2215         .vactive = { 480, 480, 480 },
2216         .vfront_porch = { 6, 10, 10 },
2217         .vback_porch = { 7, 11, 11 },
2218         .vsync_len = { 7, 11, 11 },
2219         .flags = DISPLAY_FLAGS_HSYNC_HIGH | DISPLAY_FLAGS_VSYNC_HIGH |
2220                  DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_NEGEDGE |
2221                  DISPLAY_FLAGS_SYNC_NEGEDGE,
2222 };
2223
2224 static const struct panel_desc evervision_vgg804821 = {
2225         .timings = &evervision_vgg804821_timing,
2226         .num_timings = 1,
2227         .bpc = 8,
2228         .size = {
2229                 .width = 108,
2230                 .height = 64,
2231         },
2232         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2233         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
2234 };
2235
2236 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
2237         .clock = 32260,
2238         .hdisplay = 800,
2239         .hsync_start = 800 + 168,
2240         .hsync_end = 800 + 168 + 64,
2241         .htotal = 800 + 168 + 64 + 88,
2242         .vdisplay = 480,
2243         .vsync_start = 480 + 37,
2244         .vsync_end = 480 + 37 + 2,
2245         .vtotal = 480 + 37 + 2 + 8,
2246 };
2247
2248 static const struct panel_desc foxlink_fl500wvr00_a0t = {
2249         .modes = &foxlink_fl500wvr00_a0t_mode,
2250         .num_modes = 1,
2251         .bpc = 8,
2252         .size = {
2253                 .width = 108,
2254                 .height = 65,
2255         },
2256         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2257 };
2258
2259 static const struct drm_display_mode frida_frd350h54004_modes[] = {
2260         { /* 60 Hz */
2261                 .clock = 6000,
2262                 .hdisplay = 320,
2263                 .hsync_start = 320 + 44,
2264                 .hsync_end = 320 + 44 + 16,
2265                 .htotal = 320 + 44 + 16 + 20,
2266                 .vdisplay = 240,
2267                 .vsync_start = 240 + 2,
2268                 .vsync_end = 240 + 2 + 6,
2269                 .vtotal = 240 + 2 + 6 + 2,
2270                 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
2271         },
2272         { /* 50 Hz */
2273                 .clock = 5400,
2274                 .hdisplay = 320,
2275                 .hsync_start = 320 + 56,
2276                 .hsync_end = 320 + 56 + 16,
2277                 .htotal = 320 + 56 + 16 + 40,
2278                 .vdisplay = 240,
2279                 .vsync_start = 240 + 2,
2280                 .vsync_end = 240 + 2 + 6,
2281                 .vtotal = 240 + 2 + 6 + 2,
2282                 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
2283         },
2284 };
2285
2286 static const struct panel_desc frida_frd350h54004 = {
2287         .modes = frida_frd350h54004_modes,
2288         .num_modes = ARRAY_SIZE(frida_frd350h54004_modes),
2289         .bpc = 8,
2290         .size = {
2291                 .width = 77,
2292                 .height = 64,
2293         },
2294         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2295         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
2296         .connector_type = DRM_MODE_CONNECTOR_DPI,
2297 };
2298
2299 static const struct drm_display_mode friendlyarm_hd702e_mode = {
2300         .clock          = 67185,
2301         .hdisplay       = 800,
2302         .hsync_start    = 800 + 20,
2303         .hsync_end      = 800 + 20 + 24,
2304         .htotal         = 800 + 20 + 24 + 20,
2305         .vdisplay       = 1280,
2306         .vsync_start    = 1280 + 4,
2307         .vsync_end      = 1280 + 4 + 8,
2308         .vtotal         = 1280 + 4 + 8 + 4,
2309         .flags          = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
2310 };
2311
2312 static const struct panel_desc friendlyarm_hd702e = {
2313         .modes = &friendlyarm_hd702e_mode,
2314         .num_modes = 1,
2315         .size = {
2316                 .width  = 94,
2317                 .height = 151,
2318         },
2319 };
2320
2321 static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
2322         .clock = 9000,
2323         .hdisplay = 480,
2324         .hsync_start = 480 + 5,
2325         .hsync_end = 480 + 5 + 1,
2326         .htotal = 480 + 5 + 1 + 40,
2327         .vdisplay = 272,
2328         .vsync_start = 272 + 8,
2329         .vsync_end = 272 + 8 + 1,
2330         .vtotal = 272 + 8 + 1 + 8,
2331 };
2332
2333 static const struct panel_desc giantplus_gpg482739qs5 = {
2334         .modes = &giantplus_gpg482739qs5_mode,
2335         .num_modes = 1,
2336         .bpc = 8,
2337         .size = {
2338                 .width = 95,
2339                 .height = 54,
2340         },
2341         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2342 };
2343
2344 static const struct display_timing giantplus_gpm940b0_timing = {
2345         .pixelclock = { 13500000, 27000000, 27500000 },
2346         .hactive = { 320, 320, 320 },
2347         .hfront_porch = { 14, 686, 718 },
2348         .hback_porch = { 50, 70, 255 },
2349         .hsync_len = { 1, 1, 1 },
2350         .vactive = { 240, 240, 240 },
2351         .vfront_porch = { 1, 1, 179 },
2352         .vback_porch = { 1, 21, 31 },
2353         .vsync_len = { 1, 1, 6 },
2354         .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
2355 };
2356
2357 static const struct panel_desc giantplus_gpm940b0 = {
2358         .timings = &giantplus_gpm940b0_timing,
2359         .num_timings = 1,
2360         .bpc = 8,
2361         .size = {
2362                 .width = 60,
2363                 .height = 45,
2364         },
2365         .bus_format = MEDIA_BUS_FMT_RGB888_3X8,
2366         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
2367 };
2368
2369 static const struct display_timing hannstar_hsd070pww1_timing = {
2370         .pixelclock = { 64300000, 71100000, 82000000 },
2371         .hactive = { 1280, 1280, 1280 },
2372         .hfront_porch = { 1, 1, 10 },
2373         .hback_porch = { 1, 1, 10 },
2374         /*
2375          * According to the data sheet, the minimum horizontal blanking interval
2376          * is 54 clocks (1 + 52 + 1), but tests with a Nitrogen6X have shown the
2377          * minimum working horizontal blanking interval to be 60 clocks.
2378          */
2379         .hsync_len = { 58, 158, 661 },
2380         .vactive = { 800, 800, 800 },
2381         .vfront_porch = { 1, 1, 10 },
2382         .vback_porch = { 1, 1, 10 },
2383         .vsync_len = { 1, 21, 203 },
2384         .flags = DISPLAY_FLAGS_DE_HIGH,
2385 };
2386
2387 static const struct panel_desc hannstar_hsd070pww1 = {
2388         .timings = &hannstar_hsd070pww1_timing,
2389         .num_timings = 1,
2390         .bpc = 6,
2391         .size = {
2392                 .width = 151,
2393                 .height = 94,
2394         },
2395         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
2396         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2397 };
2398
2399 static const struct display_timing hannstar_hsd100pxn1_timing = {
2400         .pixelclock = { 55000000, 65000000, 75000000 },
2401         .hactive = { 1024, 1024, 1024 },
2402         .hfront_porch = { 40, 40, 40 },
2403         .hback_porch = { 220, 220, 220 },
2404         .hsync_len = { 20, 60, 100 },
2405         .vactive = { 768, 768, 768 },
2406         .vfront_porch = { 7, 7, 7 },
2407         .vback_porch = { 21, 21, 21 },
2408         .vsync_len = { 10, 10, 10 },
2409         .flags = DISPLAY_FLAGS_DE_HIGH,
2410 };
2411
2412 static const struct panel_desc hannstar_hsd100pxn1 = {
2413         .timings = &hannstar_hsd100pxn1_timing,
2414         .num_timings = 1,
2415         .bpc = 6,
2416         .size = {
2417                 .width = 203,
2418                 .height = 152,
2419         },
2420         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
2421         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2422 };
2423
2424 static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
2425         .clock = 33333,
2426         .hdisplay = 800,
2427         .hsync_start = 800 + 85,
2428         .hsync_end = 800 + 85 + 86,
2429         .htotal = 800 + 85 + 86 + 85,
2430         .vdisplay = 480,
2431         .vsync_start = 480 + 16,
2432         .vsync_end = 480 + 16 + 13,
2433         .vtotal = 480 + 16 + 13 + 16,
2434 };
2435
2436 static const struct panel_desc hitachi_tx23d38vm0caa = {
2437         .modes = &hitachi_tx23d38vm0caa_mode,
2438         .num_modes = 1,
2439         .bpc = 6,
2440         .size = {
2441                 .width = 195,
2442                 .height = 117,
2443         },
2444         .delay = {
2445                 .enable = 160,
2446                 .disable = 160,
2447         },
2448 };
2449
2450 static const struct drm_display_mode innolux_at043tn24_mode = {
2451         .clock = 9000,
2452         .hdisplay = 480,
2453         .hsync_start = 480 + 2,
2454         .hsync_end = 480 + 2 + 41,
2455         .htotal = 480 + 2 + 41 + 2,
2456         .vdisplay = 272,
2457         .vsync_start = 272 + 2,
2458         .vsync_end = 272 + 2 + 10,
2459         .vtotal = 272 + 2 + 10 + 2,
2460         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
2461 };
2462
2463 static const struct panel_desc innolux_at043tn24 = {
2464         .modes = &innolux_at043tn24_mode,
2465         .num_modes = 1,
2466         .bpc = 8,
2467         .size = {
2468                 .width = 95,
2469                 .height = 54,
2470         },
2471         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2472         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
2473 };
2474
2475 static const struct drm_display_mode innolux_at070tn92_mode = {
2476         .clock = 33333,
2477         .hdisplay = 800,
2478         .hsync_start = 800 + 210,
2479         .hsync_end = 800 + 210 + 20,
2480         .htotal = 800 + 210 + 20 + 46,
2481         .vdisplay = 480,
2482         .vsync_start = 480 + 22,
2483         .vsync_end = 480 + 22 + 10,
2484         .vtotal = 480 + 22 + 23 + 10,
2485 };
2486
2487 static const struct panel_desc innolux_at070tn92 = {
2488         .modes = &innolux_at070tn92_mode,
2489         .num_modes = 1,
2490         .size = {
2491                 .width = 154,
2492                 .height = 86,
2493         },
2494         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2495 };
2496
2497 static const struct display_timing innolux_g070y2_l01_timing = {
2498         .pixelclock = { 28000000, 29500000, 32000000 },
2499         .hactive = { 800, 800, 800 },
2500         .hfront_porch = { 61, 91, 141 },
2501         .hback_porch = { 60, 90, 140 },
2502         .hsync_len = { 12, 12, 12 },
2503         .vactive = { 480, 480, 480 },
2504         .vfront_porch = { 4, 9, 30 },
2505         .vback_porch = { 4, 8, 28 },
2506         .vsync_len = { 2, 2, 2 },
2507         .flags = DISPLAY_FLAGS_DE_HIGH,
2508 };
2509
2510 static const struct panel_desc innolux_g070y2_l01 = {
2511         .timings = &innolux_g070y2_l01_timing,
2512         .num_timings = 1,
2513         .bpc = 8,
2514         .size = {
2515                 .width = 152,
2516                 .height = 91,
2517         },
2518         .delay = {
2519                 .prepare = 10,
2520                 .enable = 100,
2521                 .disable = 100,
2522                 .unprepare = 800,
2523         },
2524         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
2525         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
2526         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2527 };
2528
2529 static const struct display_timing innolux_g101ice_l01_timing = {
2530         .pixelclock = { 60400000, 71100000, 74700000 },
2531         .hactive = { 1280, 1280, 1280 },
2532         .hfront_porch = { 41, 80, 100 },
2533         .hback_porch = { 40, 79, 99 },
2534         .hsync_len = { 1, 1, 1 },
2535         .vactive = { 800, 800, 800 },
2536         .vfront_porch = { 5, 11, 14 },
2537         .vback_porch = { 4, 11, 14 },
2538         .vsync_len = { 1, 1, 1 },
2539         .flags = DISPLAY_FLAGS_DE_HIGH,
2540 };
2541
2542 static const struct panel_desc innolux_g101ice_l01 = {
2543         .timings = &innolux_g101ice_l01_timing,
2544         .num_timings = 1,
2545         .bpc = 8,
2546         .size = {
2547                 .width = 217,
2548                 .height = 135,
2549         },
2550         .delay = {
2551                 .enable = 200,
2552                 .disable = 200,
2553         },
2554         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
2555         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2556 };
2557
2558 static const struct display_timing innolux_g121i1_l01_timing = {
2559         .pixelclock = { 67450000, 71000000, 74550000 },
2560         .hactive = { 1280, 1280, 1280 },
2561         .hfront_porch = { 40, 80, 160 },
2562         .hback_porch = { 39, 79, 159 },
2563         .hsync_len = { 1, 1, 1 },
2564         .vactive = { 800, 800, 800 },
2565         .vfront_porch = { 5, 11, 100 },
2566         .vback_porch = { 4, 11, 99 },
2567         .vsync_len = { 1, 1, 1 },
2568 };
2569
2570 static const struct panel_desc innolux_g121i1_l01 = {
2571         .timings = &innolux_g121i1_l01_timing,
2572         .num_timings = 1,
2573         .bpc = 6,
2574         .size = {
2575                 .width = 261,
2576                 .height = 163,
2577         },
2578         .delay = {
2579                 .enable = 200,
2580                 .disable = 20,
2581         },
2582         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
2583         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2584 };
2585
2586 static const struct drm_display_mode innolux_g121x1_l03_mode = {
2587         .clock = 65000,
2588         .hdisplay = 1024,
2589         .hsync_start = 1024 + 0,
2590         .hsync_end = 1024 + 1,
2591         .htotal = 1024 + 0 + 1 + 320,
2592         .vdisplay = 768,
2593         .vsync_start = 768 + 38,
2594         .vsync_end = 768 + 38 + 1,
2595         .vtotal = 768 + 38 + 1 + 0,
2596         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
2597 };
2598
2599 static const struct panel_desc innolux_g121x1_l03 = {
2600         .modes = &innolux_g121x1_l03_mode,
2601         .num_modes = 1,
2602         .bpc = 6,
2603         .size = {
2604                 .width = 246,
2605                 .height = 185,
2606         },
2607         .delay = {
2608                 .enable = 200,
2609                 .unprepare = 200,
2610                 .disable = 400,
2611         },
2612 };
2613
2614 static const struct drm_display_mode innolux_n116bca_ea1_mode = {
2615         .clock = 76420,
2616         .hdisplay = 1366,
2617         .hsync_start = 1366 + 136,
2618         .hsync_end = 1366 + 136 + 30,
2619         .htotal = 1366 + 136 + 30 + 60,
2620         .vdisplay = 768,
2621         .vsync_start = 768 + 8,
2622         .vsync_end = 768 + 8 + 12,
2623         .vtotal = 768 + 8 + 12 + 12,
2624         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
2625 };
2626
2627 static const struct panel_desc innolux_n116bca_ea1 = {
2628         .modes = &innolux_n116bca_ea1_mode,
2629         .num_modes = 1,
2630         .bpc = 6,
2631         .size = {
2632                 .width = 256,
2633                 .height = 144,
2634         },
2635         .delay = {
2636                 .hpd_absent_delay = 200,
2637                 .prepare_to_enable = 80,
2638                 .unprepare = 500,
2639         },
2640         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
2641         .connector_type = DRM_MODE_CONNECTOR_eDP,
2642 };
2643
2644 /*
2645  * Datasheet specifies that at 60 Hz refresh rate:
2646  * - total horizontal time: { 1506, 1592, 1716 }
2647  * - total vertical time: { 788, 800, 868 }
2648  *
2649  * ...but doesn't go into exactly how that should be split into a front
2650  * porch, back porch, or sync length.  For now we'll leave a single setting
2651  * here which allows a bit of tweaking of the pixel clock at the expense of
2652  * refresh rate.
2653  */
2654 static const struct display_timing innolux_n116bge_timing = {
2655         .pixelclock = { 72600000, 76420000, 80240000 },
2656         .hactive = { 1366, 1366, 1366 },
2657         .hfront_porch = { 136, 136, 136 },
2658         .hback_porch = { 60, 60, 60 },
2659         .hsync_len = { 30, 30, 30 },
2660         .vactive = { 768, 768, 768 },
2661         .vfront_porch = { 8, 8, 8 },
2662         .vback_porch = { 12, 12, 12 },
2663         .vsync_len = { 12, 12, 12 },
2664         .flags = DISPLAY_FLAGS_VSYNC_LOW | DISPLAY_FLAGS_HSYNC_LOW,
2665 };
2666
2667 static const struct panel_desc innolux_n116bge = {
2668         .timings = &innolux_n116bge_timing,
2669         .num_timings = 1,
2670         .bpc = 6,
2671         .size = {
2672                 .width = 256,
2673                 .height = 144,
2674         },
2675         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
2676         .connector_type = DRM_MODE_CONNECTOR_eDP,
2677 };
2678
2679 static const struct drm_display_mode innolux_n125hce_gn1_mode = {
2680         .clock = 162000,
2681         .hdisplay = 1920,
2682         .hsync_start = 1920 + 40,
2683         .hsync_end = 1920 + 40 + 40,
2684         .htotal = 1920 + 40 + 40 + 80,
2685         .vdisplay = 1080,
2686         .vsync_start = 1080 + 4,
2687         .vsync_end = 1080 + 4 + 4,
2688         .vtotal = 1080 + 4 + 4 + 24,
2689 };
2690
2691 static const struct panel_desc innolux_n125hce_gn1 = {
2692         .modes = &innolux_n125hce_gn1_mode,
2693         .num_modes = 1,
2694         .bpc = 8,
2695         .size = {
2696                 .width = 276,
2697                 .height = 155,
2698         },
2699         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2700         .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB,
2701         .connector_type = DRM_MODE_CONNECTOR_eDP,
2702 };
2703
2704 static const struct drm_display_mode innolux_n156bge_l21_mode = {
2705         .clock = 69300,
2706         .hdisplay = 1366,
2707         .hsync_start = 1366 + 16,
2708         .hsync_end = 1366 + 16 + 34,
2709         .htotal = 1366 + 16 + 34 + 50,
2710         .vdisplay = 768,
2711         .vsync_start = 768 + 2,
2712         .vsync_end = 768 + 2 + 6,
2713         .vtotal = 768 + 2 + 6 + 12,
2714 };
2715
2716 static const struct panel_desc innolux_n156bge_l21 = {
2717         .modes = &innolux_n156bge_l21_mode,
2718         .num_modes = 1,
2719         .bpc = 6,
2720         .size = {
2721                 .width = 344,
2722                 .height = 193,
2723         },
2724         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
2725         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
2726         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2727 };
2728
2729 static const struct drm_display_mode innolux_p120zdg_bf1_mode = {
2730         .clock = 206016,
2731         .hdisplay = 2160,
2732         .hsync_start = 2160 + 48,
2733         .hsync_end = 2160 + 48 + 32,
2734         .htotal = 2160 + 48 + 32 + 80,
2735         .vdisplay = 1440,
2736         .vsync_start = 1440 + 3,
2737         .vsync_end = 1440 + 3 + 10,
2738         .vtotal = 1440 + 3 + 10 + 27,
2739         .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
2740 };
2741
2742 static const struct panel_desc innolux_p120zdg_bf1 = {
2743         .modes = &innolux_p120zdg_bf1_mode,
2744         .num_modes = 1,
2745         .bpc = 8,
2746         .size = {
2747                 .width = 254,
2748                 .height = 169,
2749         },
2750         .delay = {
2751                 .hpd_absent_delay = 200,
2752                 .unprepare = 500,
2753         },
2754 };
2755
2756 static const struct drm_display_mode innolux_zj070na_01p_mode = {
2757         .clock = 51501,
2758         .hdisplay = 1024,
2759         .hsync_start = 1024 + 128,
2760         .hsync_end = 1024 + 128 + 64,
2761         .htotal = 1024 + 128 + 64 + 128,
2762         .vdisplay = 600,
2763         .vsync_start = 600 + 16,
2764         .vsync_end = 600 + 16 + 4,
2765         .vtotal = 600 + 16 + 4 + 16,
2766 };
2767
2768 static const struct panel_desc innolux_zj070na_01p = {
2769         .modes = &innolux_zj070na_01p_mode,
2770         .num_modes = 1,
2771         .bpc = 6,
2772         .size = {
2773                 .width = 154,
2774                 .height = 90,
2775         },
2776 };
2777
2778 static const struct drm_display_mode ivo_m133nwf4_r0_mode = {
2779         .clock = 138778,
2780         .hdisplay = 1920,
2781         .hsync_start = 1920 + 24,
2782         .hsync_end = 1920 + 24 + 48,
2783         .htotal = 1920 + 24 + 48 + 88,
2784         .vdisplay = 1080,
2785         .vsync_start = 1080 + 3,
2786         .vsync_end = 1080 + 3 + 12,
2787         .vtotal = 1080 + 3 + 12 + 17,
2788         .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
2789 };
2790
2791 static const struct panel_desc ivo_m133nwf4_r0 = {
2792         .modes = &ivo_m133nwf4_r0_mode,
2793         .num_modes = 1,
2794         .bpc = 8,
2795         .size = {
2796                 .width = 294,
2797                 .height = 165,
2798         },
2799         .delay = {
2800                 .hpd_absent_delay = 200,
2801                 .unprepare = 500,
2802         },
2803         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2804         .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB,
2805         .connector_type = DRM_MODE_CONNECTOR_eDP,
2806 };
2807
2808 static const struct drm_display_mode kingdisplay_kd116n21_30nv_a010_mode = {
2809         .clock = 81000,
2810         .hdisplay = 1366,
2811         .hsync_start = 1366 + 40,
2812         .hsync_end = 1366 + 40 + 32,
2813         .htotal = 1366 + 40 + 32 + 62,
2814         .vdisplay = 768,
2815         .vsync_start = 768 + 5,
2816         .vsync_end = 768 + 5 + 5,
2817         .vtotal = 768 + 5 + 5 + 122,
2818         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
2819 };
2820
2821 static const struct panel_desc kingdisplay_kd116n21_30nv_a010 = {
2822         .modes = &kingdisplay_kd116n21_30nv_a010_mode,
2823         .num_modes = 1,
2824         .bpc = 6,
2825         .size = {
2826                 .width = 256,
2827                 .height = 144,
2828         },
2829         .delay = {
2830                 .hpd_absent_delay = 200,
2831         },
2832         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
2833         .connector_type = DRM_MODE_CONNECTOR_eDP,
2834 };
2835
2836 static const struct display_timing koe_tx14d24vm1bpa_timing = {
2837         .pixelclock = { 5580000, 5850000, 6200000 },
2838         .hactive = { 320, 320, 320 },
2839         .hfront_porch = { 30, 30, 30 },
2840         .hback_porch = { 30, 30, 30 },
2841         .hsync_len = { 1, 5, 17 },
2842         .vactive = { 240, 240, 240 },
2843         .vfront_porch = { 6, 6, 6 },
2844         .vback_porch = { 5, 5, 5 },
2845         .vsync_len = { 1, 2, 11 },
2846         .flags = DISPLAY_FLAGS_DE_HIGH,
2847 };
2848
2849 static const struct panel_desc koe_tx14d24vm1bpa = {
2850         .timings = &koe_tx14d24vm1bpa_timing,
2851         .num_timings = 1,
2852         .bpc = 6,
2853         .size = {
2854                 .width = 115,
2855                 .height = 86,
2856         },
2857 };
2858
2859 static const struct display_timing koe_tx26d202vm0bwa_timing = {
2860         .pixelclock = { 151820000, 156720000, 159780000 },
2861         .hactive = { 1920, 1920, 1920 },
2862         .hfront_porch = { 105, 130, 142 },
2863         .hback_porch = { 45, 70, 82 },
2864         .hsync_len = { 30, 30, 30 },
2865         .vactive = { 1200, 1200, 1200},
2866         .vfront_porch = { 3, 5, 10 },
2867         .vback_porch = { 2, 5, 10 },
2868         .vsync_len = { 5, 5, 5 },
2869 };
2870
2871 static const struct panel_desc koe_tx26d202vm0bwa = {
2872         .timings = &koe_tx26d202vm0bwa_timing,
2873         .num_timings = 1,
2874         .bpc = 8,
2875         .size = {
2876                 .width = 217,
2877                 .height = 136,
2878         },
2879         .delay = {
2880                 .prepare = 1000,
2881                 .enable = 1000,
2882                 .unprepare = 1000,
2883                 .disable = 1000,
2884         },
2885         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
2886         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
2887         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2888 };
2889
2890 static const struct display_timing koe_tx31d200vm0baa_timing = {
2891         .pixelclock = { 39600000, 43200000, 48000000 },
2892         .hactive = { 1280, 1280, 1280 },
2893         .hfront_porch = { 16, 36, 56 },
2894         .hback_porch = { 16, 36, 56 },
2895         .hsync_len = { 8, 8, 8 },
2896         .vactive = { 480, 480, 480 },
2897         .vfront_porch = { 6, 21, 33 },
2898         .vback_porch = { 6, 21, 33 },
2899         .vsync_len = { 8, 8, 8 },
2900         .flags = DISPLAY_FLAGS_DE_HIGH,
2901 };
2902
2903 static const struct panel_desc koe_tx31d200vm0baa = {
2904         .timings = &koe_tx31d200vm0baa_timing,
2905         .num_timings = 1,
2906         .bpc = 6,
2907         .size = {
2908                 .width = 292,
2909                 .height = 109,
2910         },
2911         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
2912         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2913 };
2914
2915 static const struct display_timing kyo_tcg121xglp_timing = {
2916         .pixelclock = { 52000000, 65000000, 71000000 },
2917         .hactive = { 1024, 1024, 1024 },
2918         .hfront_porch = { 2, 2, 2 },
2919         .hback_porch = { 2, 2, 2 },
2920         .hsync_len = { 86, 124, 244 },
2921         .vactive = { 768, 768, 768 },
2922         .vfront_porch = { 2, 2, 2 },
2923         .vback_porch = { 2, 2, 2 },
2924         .vsync_len = { 6, 34, 73 },
2925         .flags = DISPLAY_FLAGS_DE_HIGH,
2926 };
2927
2928 static const struct panel_desc kyo_tcg121xglp = {
2929         .timings = &kyo_tcg121xglp_timing,
2930         .num_timings = 1,
2931         .bpc = 8,
2932         .size = {
2933                 .width = 246,
2934                 .height = 184,
2935         },
2936         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
2937         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2938 };
2939
2940 static const struct drm_display_mode lemaker_bl035_rgb_002_mode = {
2941         .clock = 7000,
2942         .hdisplay = 320,
2943         .hsync_start = 320 + 20,
2944         .hsync_end = 320 + 20 + 30,
2945         .htotal = 320 + 20 + 30 + 38,
2946         .vdisplay = 240,
2947         .vsync_start = 240 + 4,
2948         .vsync_end = 240 + 4 + 3,
2949         .vtotal = 240 + 4 + 3 + 15,
2950 };
2951
2952 static const struct panel_desc lemaker_bl035_rgb_002 = {
2953         .modes = &lemaker_bl035_rgb_002_mode,
2954         .num_modes = 1,
2955         .size = {
2956                 .width = 70,
2957                 .height = 52,
2958         },
2959         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
2960         .bus_flags = DRM_BUS_FLAG_DE_LOW,
2961 };
2962
2963 static const struct drm_display_mode lg_lb070wv8_mode = {
2964         .clock = 33246,
2965         .hdisplay = 800,
2966         .hsync_start = 800 + 88,
2967         .hsync_end = 800 + 88 + 80,
2968         .htotal = 800 + 88 + 80 + 88,
2969         .vdisplay = 480,
2970         .vsync_start = 480 + 10,
2971         .vsync_end = 480 + 10 + 25,
2972         .vtotal = 480 + 10 + 25 + 10,
2973 };
2974
2975 static const struct panel_desc lg_lb070wv8 = {
2976         .modes = &lg_lb070wv8_mode,
2977         .num_modes = 1,
2978         .bpc = 8,
2979         .size = {
2980                 .width = 151,
2981                 .height = 91,
2982         },
2983         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
2984         .connector_type = DRM_MODE_CONNECTOR_LVDS,
2985 };
2986
2987 static const struct drm_display_mode lg_lp079qx1_sp0v_mode = {
2988         .clock = 200000,
2989         .hdisplay = 1536,
2990         .hsync_start = 1536 + 12,
2991         .hsync_end = 1536 + 12 + 16,
2992         .htotal = 1536 + 12 + 16 + 48,
2993         .vdisplay = 2048,
2994         .vsync_start = 2048 + 8,
2995         .vsync_end = 2048 + 8 + 4,
2996         .vtotal = 2048 + 8 + 4 + 8,
2997         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
2998 };
2999
3000 static const struct panel_desc lg_lp079qx1_sp0v = {
3001         .modes = &lg_lp079qx1_sp0v_mode,
3002         .num_modes = 1,
3003         .size = {
3004                 .width = 129,
3005                 .height = 171,
3006         },
3007 };
3008
3009 static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
3010         .clock = 205210,
3011         .hdisplay = 2048,
3012         .hsync_start = 2048 + 150,
3013         .hsync_end = 2048 + 150 + 5,
3014         .htotal = 2048 + 150 + 5 + 5,
3015         .vdisplay = 1536,
3016         .vsync_start = 1536 + 3,
3017         .vsync_end = 1536 + 3 + 1,
3018         .vtotal = 1536 + 3 + 1 + 9,
3019 };
3020
3021 static const struct panel_desc lg_lp097qx1_spa1 = {
3022         .modes = &lg_lp097qx1_spa1_mode,
3023         .num_modes = 1,
3024         .size = {
3025                 .width = 208,
3026                 .height = 147,
3027         },
3028 };
3029
3030 static const struct drm_display_mode lg_lp120up1_mode = {
3031         .clock = 162300,
3032         .hdisplay = 1920,
3033         .hsync_start = 1920 + 40,
3034         .hsync_end = 1920 + 40 + 40,
3035         .htotal = 1920 + 40 + 40+ 80,
3036         .vdisplay = 1280,
3037         .vsync_start = 1280 + 4,
3038         .vsync_end = 1280 + 4 + 4,
3039         .vtotal = 1280 + 4 + 4 + 12,
3040 };
3041
3042 static const struct panel_desc lg_lp120up1 = {
3043         .modes = &lg_lp120up1_mode,
3044         .num_modes = 1,
3045         .bpc = 8,
3046         .size = {
3047                 .width = 267,
3048                 .height = 183,
3049         },
3050         .connector_type = DRM_MODE_CONNECTOR_eDP,
3051 };
3052
3053 static const struct drm_display_mode lg_lp129qe_mode = {
3054         .clock = 285250,
3055         .hdisplay = 2560,
3056         .hsync_start = 2560 + 48,
3057         .hsync_end = 2560 + 48 + 32,
3058         .htotal = 2560 + 48 + 32 + 80,
3059         .vdisplay = 1700,
3060         .vsync_start = 1700 + 3,
3061         .vsync_end = 1700 + 3 + 10,
3062         .vtotal = 1700 + 3 + 10 + 36,
3063 };
3064
3065 static const struct panel_desc lg_lp129qe = {
3066         .modes = &lg_lp129qe_mode,
3067         .num_modes = 1,
3068         .bpc = 8,
3069         .size = {
3070                 .width = 272,
3071                 .height = 181,
3072         },
3073 };
3074
3075 static const struct display_timing logictechno_lt161010_2nh_timing = {
3076         .pixelclock = { 26400000, 33300000, 46800000 },
3077         .hactive = { 800, 800, 800 },
3078         .hfront_porch = { 16, 210, 354 },
3079         .hback_porch = { 46, 46, 46 },
3080         .hsync_len = { 1, 20, 40 },
3081         .vactive = { 480, 480, 480 },
3082         .vfront_porch = { 7, 22, 147 },
3083         .vback_porch = { 23, 23, 23 },
3084         .vsync_len = { 1, 10, 20 },
3085         .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
3086                  DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE |
3087                  DISPLAY_FLAGS_SYNC_POSEDGE,
3088 };
3089
3090 static const struct panel_desc logictechno_lt161010_2nh = {
3091         .timings = &logictechno_lt161010_2nh_timing,
3092         .num_timings = 1,
3093         .size = {
3094                 .width = 154,
3095                 .height = 86,
3096         },
3097         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
3098         .bus_flags = DRM_BUS_FLAG_DE_HIGH |
3099                      DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
3100                      DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE,
3101         .connector_type = DRM_MODE_CONNECTOR_DPI,
3102 };
3103
3104 static const struct display_timing logictechno_lt170410_2whc_timing = {
3105         .pixelclock = { 68900000, 71100000, 73400000 },
3106         .hactive = { 1280, 1280, 1280 },
3107         .hfront_porch = { 23, 60, 71 },
3108         .hback_porch = { 23, 60, 71 },
3109         .hsync_len = { 15, 40, 47 },
3110         .vactive = { 800, 800, 800 },
3111         .vfront_porch = { 5, 7, 10 },
3112         .vback_porch = { 5, 7, 10 },
3113         .vsync_len = { 6, 9, 12 },
3114         .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
3115                  DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_POSEDGE |
3116                  DISPLAY_FLAGS_SYNC_POSEDGE,
3117 };
3118
3119 static const struct panel_desc logictechno_lt170410_2whc = {
3120         .timings = &logictechno_lt170410_2whc_timing,
3121         .num_timings = 1,
3122         .size = {
3123                 .width = 217,
3124                 .height = 136,
3125         },
3126         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
3127         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
3128         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3129 };
3130
3131 static const struct drm_display_mode logictechno_lttd800480070_l6wh_rt_mode = {
3132         .clock = 33000,
3133         .hdisplay = 800,
3134         .hsync_start = 800 + 154,
3135         .hsync_end = 800 + 154 + 3,
3136         .htotal = 800 + 154 + 3 + 43,
3137         .vdisplay = 480,
3138         .vsync_start = 480 + 47,
3139         .vsync_end = 480 + 47 + 3,
3140         .vtotal = 480 + 47 + 3 + 20,
3141         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3142 };
3143
3144 static const struct panel_desc logictechno_lttd800480070_l6wh_rt = {
3145         .modes = &logictechno_lttd800480070_l6wh_rt_mode,
3146         .num_modes = 1,
3147         .bpc = 8,
3148         .size = {
3149                 .width = 154,
3150                 .height = 86,
3151         },
3152         .delay = {
3153                 .prepare = 45,
3154                 .enable = 100,
3155                 .disable = 100,
3156                 .unprepare = 45
3157         },
3158         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3159         .bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
3160         .connector_type = DRM_MODE_CONNECTOR_DPI,
3161 };
3162
3163 static const struct drm_display_mode mitsubishi_aa070mc01_mode = {
3164         .clock = 30400,
3165         .hdisplay = 800,
3166         .hsync_start = 800 + 0,
3167         .hsync_end = 800 + 1,
3168         .htotal = 800 + 0 + 1 + 160,
3169         .vdisplay = 480,
3170         .vsync_start = 480 + 0,
3171         .vsync_end = 480 + 48 + 1,
3172         .vtotal = 480 + 48 + 1 + 0,
3173         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
3174 };
3175
3176 static const struct drm_display_mode logicpd_type_28_mode = {
3177         .clock = 9107,
3178         .hdisplay = 480,
3179         .hsync_start = 480 + 3,
3180         .hsync_end = 480 + 3 + 42,
3181         .htotal = 480 + 3 + 42 + 2,
3182
3183         .vdisplay = 272,
3184         .vsync_start = 272 + 2,
3185         .vsync_end = 272 + 2 + 11,
3186         .vtotal = 272 + 2 + 11 + 3,
3187         .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
3188 };
3189
3190 static const struct panel_desc logicpd_type_28 = {
3191         .modes = &logicpd_type_28_mode,
3192         .num_modes = 1,
3193         .bpc = 8,
3194         .size = {
3195                 .width = 105,
3196                 .height = 67,
3197         },
3198         .delay = {
3199                 .prepare = 200,
3200                 .enable = 200,
3201                 .unprepare = 200,
3202                 .disable = 200,
3203         },
3204         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3205         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
3206                      DRM_BUS_FLAG_SYNC_DRIVE_NEGEDGE,
3207         .connector_type = DRM_MODE_CONNECTOR_DPI,
3208 };
3209
3210 static const struct panel_desc mitsubishi_aa070mc01 = {
3211         .modes = &mitsubishi_aa070mc01_mode,
3212         .num_modes = 1,
3213         .bpc = 8,
3214         .size = {
3215                 .width = 152,
3216                 .height = 91,
3217         },
3218
3219         .delay = {
3220                 .enable = 200,
3221                 .unprepare = 200,
3222                 .disable = 400,
3223         },
3224         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
3225         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3226         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
3227 };
3228
3229 static const struct display_timing multi_inno_mi1010ait_1cp_timing = {
3230         .pixelclock = { 68900000, 70000000, 73400000 },
3231         .hactive = { 1280, 1280, 1280 },
3232         .hfront_porch = { 30, 60, 71 },
3233         .hback_porch = { 30, 60, 71 },
3234         .hsync_len = { 10, 10, 48 },
3235         .vactive = { 800, 800, 800 },
3236         .vfront_porch = { 5, 10, 10 },
3237         .vback_porch = { 5, 10, 10 },
3238         .vsync_len = { 5, 6, 13 },
3239         .flags = DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW |
3240                  DISPLAY_FLAGS_DE_HIGH,
3241 };
3242
3243 static const struct panel_desc multi_inno_mi1010ait_1cp = {
3244         .timings = &multi_inno_mi1010ait_1cp_timing,
3245         .num_timings = 1,
3246         .bpc = 8,
3247         .size = {
3248                 .width = 217,
3249                 .height = 136,
3250         },
3251         .delay = {
3252                 .enable = 50,
3253                 .disable = 50,
3254         },
3255         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
3256         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
3257         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3258 };
3259
3260 static const struct display_timing nec_nl12880bc20_05_timing = {
3261         .pixelclock = { 67000000, 71000000, 75000000 },
3262         .hactive = { 1280, 1280, 1280 },
3263         .hfront_porch = { 2, 30, 30 },
3264         .hback_porch = { 6, 100, 100 },
3265         .hsync_len = { 2, 30, 30 },
3266         .vactive = { 800, 800, 800 },
3267         .vfront_porch = { 5, 5, 5 },
3268         .vback_porch = { 11, 11, 11 },
3269         .vsync_len = { 7, 7, 7 },
3270 };
3271
3272 static const struct panel_desc nec_nl12880bc20_05 = {
3273         .timings = &nec_nl12880bc20_05_timing,
3274         .num_timings = 1,
3275         .bpc = 8,
3276         .size = {
3277                 .width = 261,
3278                 .height = 163,
3279         },
3280         .delay = {
3281                 .enable = 50,
3282                 .disable = 50,
3283         },
3284         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
3285         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3286 };
3287
3288 static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
3289         .clock = 10870,
3290         .hdisplay = 480,
3291         .hsync_start = 480 + 2,
3292         .hsync_end = 480 + 2 + 41,
3293         .htotal = 480 + 2 + 41 + 2,
3294         .vdisplay = 272,
3295         .vsync_start = 272 + 2,
3296         .vsync_end = 272 + 2 + 4,
3297         .vtotal = 272 + 2 + 4 + 2,
3298         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3299 };
3300
3301 static const struct panel_desc nec_nl4827hc19_05b = {
3302         .modes = &nec_nl4827hc19_05b_mode,
3303         .num_modes = 1,
3304         .bpc = 8,
3305         .size = {
3306                 .width = 95,
3307                 .height = 54,
3308         },
3309         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3310         .bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
3311 };
3312
3313 static const struct drm_display_mode netron_dy_e231732_mode = {
3314         .clock = 66000,
3315         .hdisplay = 1024,
3316         .hsync_start = 1024 + 160,
3317         .hsync_end = 1024 + 160 + 70,
3318         .htotal = 1024 + 160 + 70 + 90,
3319         .vdisplay = 600,
3320         .vsync_start = 600 + 127,
3321         .vsync_end = 600 + 127 + 20,
3322         .vtotal = 600 + 127 + 20 + 3,
3323 };
3324
3325 static const struct panel_desc netron_dy_e231732 = {
3326         .modes = &netron_dy_e231732_mode,
3327         .num_modes = 1,
3328         .size = {
3329                 .width = 154,
3330                 .height = 87,
3331         },
3332         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
3333 };
3334
3335 static const struct drm_display_mode neweast_wjfh116008a_modes[] = {
3336         {
3337                 .clock = 138500,
3338                 .hdisplay = 1920,
3339                 .hsync_start = 1920 + 48,
3340                 .hsync_end = 1920 + 48 + 32,
3341                 .htotal = 1920 + 48 + 32 + 80,
3342                 .vdisplay = 1080,
3343                 .vsync_start = 1080 + 3,
3344                 .vsync_end = 1080 + 3 + 5,
3345                 .vtotal = 1080 + 3 + 5 + 23,
3346                 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3347         }, {
3348                 .clock = 110920,
3349                 .hdisplay = 1920,
3350                 .hsync_start = 1920 + 48,
3351                 .hsync_end = 1920 + 48 + 32,
3352                 .htotal = 1920 + 48 + 32 + 80,
3353                 .vdisplay = 1080,
3354                 .vsync_start = 1080 + 3,
3355                 .vsync_end = 1080 + 3 + 5,
3356                 .vtotal = 1080 + 3 + 5 + 23,
3357                 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3358         }
3359 };
3360
3361 static const struct panel_desc neweast_wjfh116008a = {
3362         .modes = neweast_wjfh116008a_modes,
3363         .num_modes = 2,
3364         .bpc = 6,
3365         .size = {
3366                 .width = 260,
3367                 .height = 150,
3368         },
3369         .delay = {
3370                 .prepare = 110,
3371                 .enable = 20,
3372                 .unprepare = 500,
3373         },
3374         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
3375         .connector_type = DRM_MODE_CONNECTOR_eDP,
3376 };
3377
3378 static const struct drm_display_mode newhaven_nhd_43_480272ef_atxl_mode = {
3379         .clock = 9000,
3380         .hdisplay = 480,
3381         .hsync_start = 480 + 2,
3382         .hsync_end = 480 + 2 + 41,
3383         .htotal = 480 + 2 + 41 + 2,
3384         .vdisplay = 272,
3385         .vsync_start = 272 + 2,
3386         .vsync_end = 272 + 2 + 10,
3387         .vtotal = 272 + 2 + 10 + 2,
3388         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3389 };
3390
3391 static const struct panel_desc newhaven_nhd_43_480272ef_atxl = {
3392         .modes = &newhaven_nhd_43_480272ef_atxl_mode,
3393         .num_modes = 1,
3394         .bpc = 8,
3395         .size = {
3396                 .width = 95,
3397                 .height = 54,
3398         },
3399         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3400         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
3401                      DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
3402         .connector_type = DRM_MODE_CONNECTOR_DPI,
3403 };
3404
3405 static const struct display_timing nlt_nl192108ac18_02d_timing = {
3406         .pixelclock = { 130000000, 148350000, 163000000 },
3407         .hactive = { 1920, 1920, 1920 },
3408         .hfront_porch = { 80, 100, 100 },
3409         .hback_porch = { 100, 120, 120 },
3410         .hsync_len = { 50, 60, 60 },
3411         .vactive = { 1080, 1080, 1080 },
3412         .vfront_porch = { 12, 30, 30 },
3413         .vback_porch = { 4, 10, 10 },
3414         .vsync_len = { 4, 5, 5 },
3415 };
3416
3417 static const struct panel_desc nlt_nl192108ac18_02d = {
3418         .timings = &nlt_nl192108ac18_02d_timing,
3419         .num_timings = 1,
3420         .bpc = 8,
3421         .size = {
3422                 .width = 344,
3423                 .height = 194,
3424         },
3425         .delay = {
3426                 .unprepare = 500,
3427         },
3428         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
3429         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3430 };
3431
3432 static const struct drm_display_mode nvd_9128_mode = {
3433         .clock = 29500,
3434         .hdisplay = 800,
3435         .hsync_start = 800 + 130,
3436         .hsync_end = 800 + 130 + 98,
3437         .htotal = 800 + 0 + 130 + 98,
3438         .vdisplay = 480,
3439         .vsync_start = 480 + 10,
3440         .vsync_end = 480 + 10 + 50,
3441         .vtotal = 480 + 0 + 10 + 50,
3442 };
3443
3444 static const struct panel_desc nvd_9128 = {
3445         .modes = &nvd_9128_mode,
3446         .num_modes = 1,
3447         .bpc = 8,
3448         .size = {
3449                 .width = 156,
3450                 .height = 88,
3451         },
3452         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
3453         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3454 };
3455
3456 static const struct display_timing okaya_rs800480t_7x0gp_timing = {
3457         .pixelclock = { 30000000, 30000000, 40000000 },
3458         .hactive = { 800, 800, 800 },
3459         .hfront_porch = { 40, 40, 40 },
3460         .hback_porch = { 40, 40, 40 },
3461         .hsync_len = { 1, 48, 48 },
3462         .vactive = { 480, 480, 480 },
3463         .vfront_porch = { 13, 13, 13 },
3464         .vback_porch = { 29, 29, 29 },
3465         .vsync_len = { 3, 3, 3 },
3466         .flags = DISPLAY_FLAGS_DE_HIGH,
3467 };
3468
3469 static const struct panel_desc okaya_rs800480t_7x0gp = {
3470         .timings = &okaya_rs800480t_7x0gp_timing,
3471         .num_timings = 1,
3472         .bpc = 6,
3473         .size = {
3474                 .width = 154,
3475                 .height = 87,
3476         },
3477         .delay = {
3478                 .prepare = 41,
3479                 .enable = 50,
3480                 .unprepare = 41,
3481                 .disable = 50,
3482         },
3483         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
3484 };
3485
3486 static const struct drm_display_mode olimex_lcd_olinuxino_43ts_mode = {
3487         .clock = 9000,
3488         .hdisplay = 480,
3489         .hsync_start = 480 + 5,
3490         .hsync_end = 480 + 5 + 30,
3491         .htotal = 480 + 5 + 30 + 10,
3492         .vdisplay = 272,
3493         .vsync_start = 272 + 8,
3494         .vsync_end = 272 + 8 + 5,
3495         .vtotal = 272 + 8 + 5 + 3,
3496 };
3497
3498 static const struct panel_desc olimex_lcd_olinuxino_43ts = {
3499         .modes = &olimex_lcd_olinuxino_43ts_mode,
3500         .num_modes = 1,
3501         .size = {
3502                 .width = 95,
3503                 .height = 54,
3504         },
3505         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3506 };
3507
3508 /*
3509  * 800x480 CVT. The panel appears to be quite accepting, at least as far as
3510  * pixel clocks, but this is the timing that was being used in the Adafruit
3511  * installation instructions.
3512  */
3513 static const struct drm_display_mode ontat_yx700wv03_mode = {
3514         .clock = 29500,
3515         .hdisplay = 800,
3516         .hsync_start = 824,
3517         .hsync_end = 896,
3518         .htotal = 992,
3519         .vdisplay = 480,
3520         .vsync_start = 483,
3521         .vsync_end = 493,
3522         .vtotal = 500,
3523         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3524 };
3525
3526 /*
3527  * Specification at:
3528  * https://www.adafruit.com/images/product-files/2406/c3163.pdf
3529  */
3530 static const struct panel_desc ontat_yx700wv03 = {
3531         .modes = &ontat_yx700wv03_mode,
3532         .num_modes = 1,
3533         .bpc = 8,
3534         .size = {
3535                 .width = 154,
3536                 .height = 83,
3537         },
3538         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
3539 };
3540
3541 static const struct drm_display_mode ortustech_com37h3m_mode  = {
3542         .clock = 22230,
3543         .hdisplay = 480,
3544         .hsync_start = 480 + 40,
3545         .hsync_end = 480 + 40 + 10,
3546         .htotal = 480 + 40 + 10 + 40,
3547         .vdisplay = 640,
3548         .vsync_start = 640 + 4,
3549         .vsync_end = 640 + 4 + 2,
3550         .vtotal = 640 + 4 + 2 + 4,
3551         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3552 };
3553
3554 static const struct panel_desc ortustech_com37h3m = {
3555         .modes = &ortustech_com37h3m_mode,
3556         .num_modes = 1,
3557         .bpc = 8,
3558         .size = {
3559                 .width = 56,    /* 56.16mm */
3560                 .height = 75,   /* 74.88mm */
3561         },
3562         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3563         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
3564                      DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
3565 };
3566
3567 static const struct drm_display_mode ortustech_com43h4m85ulc_mode  = {
3568         .clock = 25000,
3569         .hdisplay = 480,
3570         .hsync_start = 480 + 10,
3571         .hsync_end = 480 + 10 + 10,
3572         .htotal = 480 + 10 + 10 + 15,
3573         .vdisplay = 800,
3574         .vsync_start = 800 + 3,
3575         .vsync_end = 800 + 3 + 3,
3576         .vtotal = 800 + 3 + 3 + 3,
3577 };
3578
3579 static const struct panel_desc ortustech_com43h4m85ulc = {
3580         .modes = &ortustech_com43h4m85ulc_mode,
3581         .num_modes = 1,
3582         .bpc = 6,
3583         .size = {
3584                 .width = 56,
3585                 .height = 93,
3586         },
3587         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
3588         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
3589         .connector_type = DRM_MODE_CONNECTOR_DPI,
3590 };
3591
3592 static const struct drm_display_mode osddisplays_osd070t1718_19ts_mode  = {
3593         .clock = 33000,
3594         .hdisplay = 800,
3595         .hsync_start = 800 + 210,
3596         .hsync_end = 800 + 210 + 30,
3597         .htotal = 800 + 210 + 30 + 16,
3598         .vdisplay = 480,
3599         .vsync_start = 480 + 22,
3600         .vsync_end = 480 + 22 + 13,
3601         .vtotal = 480 + 22 + 13 + 10,
3602         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3603 };
3604
3605 static const struct panel_desc osddisplays_osd070t1718_19ts = {
3606         .modes = &osddisplays_osd070t1718_19ts_mode,
3607         .num_modes = 1,
3608         .bpc = 8,
3609         .size = {
3610                 .width = 152,
3611                 .height = 91,
3612         },
3613         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3614         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE |
3615                 DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
3616         .connector_type = DRM_MODE_CONNECTOR_DPI,
3617 };
3618
3619 static const struct drm_display_mode pda_91_00156_a0_mode = {
3620         .clock = 33300,
3621         .hdisplay = 800,
3622         .hsync_start = 800 + 1,
3623         .hsync_end = 800 + 1 + 64,
3624         .htotal = 800 + 1 + 64 + 64,
3625         .vdisplay = 480,
3626         .vsync_start = 480 + 1,
3627         .vsync_end = 480 + 1 + 23,
3628         .vtotal = 480 + 1 + 23 + 22,
3629 };
3630
3631 static const struct panel_desc pda_91_00156_a0  = {
3632         .modes = &pda_91_00156_a0_mode,
3633         .num_modes = 1,
3634         .size = {
3635                 .width = 152,
3636                 .height = 91,
3637         },
3638         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3639 };
3640
3641 static const struct drm_display_mode powertip_ph800480t013_idf02_mode = {
3642         .clock = 24750,
3643         .hdisplay = 800,
3644         .hsync_start = 800 + 54,
3645         .hsync_end = 800 + 54 + 2,
3646         .htotal = 800 + 54 + 2 + 44,
3647         .vdisplay = 480,
3648         .vsync_start = 480 + 49,
3649         .vsync_end = 480 + 49 + 2,
3650         .vtotal = 480 + 49 + 2 + 22,
3651 };
3652
3653 static const struct panel_desc powertip_ph800480t013_idf02  = {
3654         .modes = &powertip_ph800480t013_idf02_mode,
3655         .num_modes = 1,
3656         .size = {
3657                 .width = 152,
3658                 .height = 91,
3659         },
3660         .bus_flags = DRM_BUS_FLAG_DE_HIGH |
3661                      DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
3662                      DRM_BUS_FLAG_SYNC_SAMPLE_NEGEDGE,
3663         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3664         .connector_type = DRM_MODE_CONNECTOR_DPI,
3665 };
3666
3667 static const struct drm_display_mode qd43003c0_40_mode = {
3668         .clock = 9000,
3669         .hdisplay = 480,
3670         .hsync_start = 480 + 8,
3671         .hsync_end = 480 + 8 + 4,
3672         .htotal = 480 + 8 + 4 + 39,
3673         .vdisplay = 272,
3674         .vsync_start = 272 + 4,
3675         .vsync_end = 272 + 4 + 10,
3676         .vtotal = 272 + 4 + 10 + 2,
3677 };
3678
3679 static const struct panel_desc qd43003c0_40 = {
3680         .modes = &qd43003c0_40_mode,
3681         .num_modes = 1,
3682         .bpc = 8,
3683         .size = {
3684                 .width = 95,
3685                 .height = 53,
3686         },
3687         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3688 };
3689
3690 static const struct drm_display_mode qishenglong_gopher2b_lcd_modes[] = {
3691         { /* 60 Hz */
3692                 .clock = 10800,
3693                 .hdisplay = 480,
3694                 .hsync_start = 480 + 77,
3695                 .hsync_end = 480 + 77 + 41,
3696                 .htotal = 480 + 77 + 41 + 2,
3697                 .vdisplay = 272,
3698                 .vsync_start = 272 + 16,
3699                 .vsync_end = 272 + 16 + 10,
3700                 .vtotal = 272 + 16 + 10 + 2,
3701                 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3702         },
3703         { /* 50 Hz */
3704                 .clock = 10800,
3705                 .hdisplay = 480,
3706                 .hsync_start = 480 + 17,
3707                 .hsync_end = 480 + 17 + 41,
3708                 .htotal = 480 + 17 + 41 + 2,
3709                 .vdisplay = 272,
3710                 .vsync_start = 272 + 116,
3711                 .vsync_end = 272 + 116 + 10,
3712                 .vtotal = 272 + 116 + 10 + 2,
3713                 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
3714         },
3715 };
3716
3717 static const struct panel_desc qishenglong_gopher2b_lcd = {
3718         .modes = qishenglong_gopher2b_lcd_modes,
3719         .num_modes = ARRAY_SIZE(qishenglong_gopher2b_lcd_modes),
3720         .bpc = 8,
3721         .size = {
3722                 .width = 95,
3723                 .height = 54,
3724         },
3725         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3726         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
3727         .connector_type = DRM_MODE_CONNECTOR_DPI,
3728 };
3729
3730 static const struct display_timing rocktech_rk070er9427_timing = {
3731         .pixelclock = { 26400000, 33300000, 46800000 },
3732         .hactive = { 800, 800, 800 },
3733         .hfront_porch = { 16, 210, 354 },
3734         .hback_porch = { 46, 46, 46 },
3735         .hsync_len = { 1, 1, 1 },
3736         .vactive = { 480, 480, 480 },
3737         .vfront_porch = { 7, 22, 147 },
3738         .vback_porch = { 23, 23, 23 },
3739         .vsync_len = { 1, 1, 1 },
3740         .flags = DISPLAY_FLAGS_DE_HIGH,
3741 };
3742
3743 static const struct panel_desc rocktech_rk070er9427 = {
3744         .timings = &rocktech_rk070er9427_timing,
3745         .num_timings = 1,
3746         .bpc = 6,
3747         .size = {
3748                 .width = 154,
3749                 .height = 86,
3750         },
3751         .delay = {
3752                 .prepare = 41,
3753                 .enable = 50,
3754                 .unprepare = 41,
3755                 .disable = 50,
3756         },
3757         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
3758 };
3759
3760 static const struct drm_display_mode rocktech_rk101ii01d_ct_mode = {
3761         .clock = 71100,
3762         .hdisplay = 1280,
3763         .hsync_start = 1280 + 48,
3764         .hsync_end = 1280 + 48 + 32,
3765         .htotal = 1280 + 48 + 32 + 80,
3766         .vdisplay = 800,
3767         .vsync_start = 800 + 2,
3768         .vsync_end = 800 + 2 + 5,
3769         .vtotal = 800 + 2 + 5 + 16,
3770 };
3771
3772 static const struct panel_desc rocktech_rk101ii01d_ct = {
3773         .modes = &rocktech_rk101ii01d_ct_mode,
3774         .num_modes = 1,
3775         .size = {
3776                 .width = 217,
3777                 .height = 136,
3778         },
3779         .delay = {
3780                 .prepare = 50,
3781                 .disable = 50,
3782         },
3783         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
3784         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
3785         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3786 };
3787
3788 static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
3789         .clock = 271560,
3790         .hdisplay = 2560,
3791         .hsync_start = 2560 + 48,
3792         .hsync_end = 2560 + 48 + 32,
3793         .htotal = 2560 + 48 + 32 + 80,
3794         .vdisplay = 1600,
3795         .vsync_start = 1600 + 2,
3796         .vsync_end = 1600 + 2 + 5,
3797         .vtotal = 1600 + 2 + 5 + 57,
3798 };
3799
3800 static const struct panel_desc samsung_lsn122dl01_c01 = {
3801         .modes = &samsung_lsn122dl01_c01_mode,
3802         .num_modes = 1,
3803         .size = {
3804                 .width = 263,
3805                 .height = 164,
3806         },
3807 };
3808
3809 static const struct drm_display_mode samsung_ltn101nt05_mode = {
3810         .clock = 54030,
3811         .hdisplay = 1024,
3812         .hsync_start = 1024 + 24,
3813         .hsync_end = 1024 + 24 + 136,
3814         .htotal = 1024 + 24 + 136 + 160,
3815         .vdisplay = 600,
3816         .vsync_start = 600 + 3,
3817         .vsync_end = 600 + 3 + 6,
3818         .vtotal = 600 + 3 + 6 + 61,
3819 };
3820
3821 static const struct panel_desc samsung_ltn101nt05 = {
3822         .modes = &samsung_ltn101nt05_mode,
3823         .num_modes = 1,
3824         .bpc = 6,
3825         .size = {
3826                 .width = 223,
3827                 .height = 125,
3828         },
3829         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
3830         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
3831         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3832 };
3833
3834 static const struct drm_display_mode samsung_ltn140at29_301_mode = {
3835         .clock = 76300,
3836         .hdisplay = 1366,
3837         .hsync_start = 1366 + 64,
3838         .hsync_end = 1366 + 64 + 48,
3839         .htotal = 1366 + 64 + 48 + 128,
3840         .vdisplay = 768,
3841         .vsync_start = 768 + 2,
3842         .vsync_end = 768 + 2 + 5,
3843         .vtotal = 768 + 2 + 5 + 17,
3844 };
3845
3846 static const struct panel_desc samsung_ltn140at29_301 = {
3847         .modes = &samsung_ltn140at29_301_mode,
3848         .num_modes = 1,
3849         .bpc = 6,
3850         .size = {
3851                 .width = 320,
3852                 .height = 187,
3853         },
3854 };
3855
3856 static const struct display_timing satoz_sat050at40h12r2_timing = {
3857         .pixelclock = {33300000, 33300000, 50000000},
3858         .hactive = {800, 800, 800},
3859         .hfront_porch = {16, 210, 354},
3860         .hback_porch = {46, 46, 46},
3861         .hsync_len = {1, 1, 40},
3862         .vactive = {480, 480, 480},
3863         .vfront_porch = {7, 22, 147},
3864         .vback_porch = {23, 23, 23},
3865         .vsync_len = {1, 1, 20},
3866 };
3867
3868 static const struct panel_desc satoz_sat050at40h12r2 = {
3869         .timings = &satoz_sat050at40h12r2_timing,
3870         .num_timings = 1,
3871         .bpc = 8,
3872         .size = {
3873                 .width = 108,
3874                 .height = 65,
3875         },
3876         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
3877         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3878 };
3879
3880 static const struct drm_display_mode sharp_ld_d5116z01b_mode = {
3881         .clock = 168480,
3882         .hdisplay = 1920,
3883         .hsync_start = 1920 + 48,
3884         .hsync_end = 1920 + 48 + 32,
3885         .htotal = 1920 + 48 + 32 + 80,
3886         .vdisplay = 1280,
3887         .vsync_start = 1280 + 3,
3888         .vsync_end = 1280 + 3 + 10,
3889         .vtotal = 1280 + 3 + 10 + 57,
3890         .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
3891 };
3892
3893 static const struct panel_desc sharp_ld_d5116z01b = {
3894         .modes = &sharp_ld_d5116z01b_mode,
3895         .num_modes = 1,
3896         .bpc = 8,
3897         .size = {
3898                 .width = 260,
3899                 .height = 120,
3900         },
3901         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3902         .bus_flags = DRM_BUS_FLAG_DATA_MSB_TO_LSB,
3903 };
3904
3905 static const struct drm_display_mode sharp_lq070y3dg3b_mode = {
3906         .clock = 33260,
3907         .hdisplay = 800,
3908         .hsync_start = 800 + 64,
3909         .hsync_end = 800 + 64 + 128,
3910         .htotal = 800 + 64 + 128 + 64,
3911         .vdisplay = 480,
3912         .vsync_start = 480 + 8,
3913         .vsync_end = 480 + 8 + 2,
3914         .vtotal = 480 + 8 + 2 + 35,
3915         .flags = DISPLAY_FLAGS_PIXDATA_POSEDGE,
3916 };
3917
3918 static const struct panel_desc sharp_lq070y3dg3b = {
3919         .modes = &sharp_lq070y3dg3b_mode,
3920         .num_modes = 1,
3921         .bpc = 8,
3922         .size = {
3923                 .width = 152,   /* 152.4mm */
3924                 .height = 91,   /* 91.4mm */
3925         },
3926         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
3927         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE |
3928                      DRM_BUS_FLAG_SYNC_DRIVE_POSEDGE,
3929 };
3930
3931 static const struct drm_display_mode sharp_lq035q7db03_mode = {
3932         .clock = 5500,
3933         .hdisplay = 240,
3934         .hsync_start = 240 + 16,
3935         .hsync_end = 240 + 16 + 7,
3936         .htotal = 240 + 16 + 7 + 5,
3937         .vdisplay = 320,
3938         .vsync_start = 320 + 9,
3939         .vsync_end = 320 + 9 + 1,
3940         .vtotal = 320 + 9 + 1 + 7,
3941 };
3942
3943 static const struct panel_desc sharp_lq035q7db03 = {
3944         .modes = &sharp_lq035q7db03_mode,
3945         .num_modes = 1,
3946         .bpc = 6,
3947         .size = {
3948                 .width = 54,
3949                 .height = 72,
3950         },
3951         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
3952 };
3953
3954 static const struct display_timing sharp_lq101k1ly04_timing = {
3955         .pixelclock = { 60000000, 65000000, 80000000 },
3956         .hactive = { 1280, 1280, 1280 },
3957         .hfront_porch = { 20, 20, 20 },
3958         .hback_porch = { 20, 20, 20 },
3959         .hsync_len = { 10, 10, 10 },
3960         .vactive = { 800, 800, 800 },
3961         .vfront_porch = { 4, 4, 4 },
3962         .vback_porch = { 4, 4, 4 },
3963         .vsync_len = { 4, 4, 4 },
3964         .flags = DISPLAY_FLAGS_PIXDATA_POSEDGE,
3965 };
3966
3967 static const struct panel_desc sharp_lq101k1ly04 = {
3968         .timings = &sharp_lq101k1ly04_timing,
3969         .num_timings = 1,
3970         .bpc = 8,
3971         .size = {
3972                 .width = 217,
3973                 .height = 136,
3974         },
3975         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
3976         .connector_type = DRM_MODE_CONNECTOR_LVDS,
3977 };
3978
3979 static const struct display_timing sharp_lq123p1jx31_timing = {
3980         .pixelclock = { 252750000, 252750000, 266604720 },
3981         .hactive = { 2400, 2400, 2400 },
3982         .hfront_porch = { 48, 48, 48 },
3983         .hback_porch = { 80, 80, 84 },
3984         .hsync_len = { 32, 32, 32 },
3985         .vactive = { 1600, 1600, 1600 },
3986         .vfront_porch = { 3, 3, 3 },
3987         .vback_porch = { 33, 33, 120 },
3988         .vsync_len = { 10, 10, 10 },
3989         .flags = DISPLAY_FLAGS_VSYNC_LOW | DISPLAY_FLAGS_HSYNC_LOW,
3990 };
3991
3992 static const struct panel_desc sharp_lq123p1jx31 = {
3993         .timings = &sharp_lq123p1jx31_timing,
3994         .num_timings = 1,
3995         .bpc = 8,
3996         .size = {
3997                 .width = 259,
3998                 .height = 173,
3999         },
4000         .delay = {
4001                 .prepare = 110,
4002                 .enable = 50,
4003                 .unprepare = 550,
4004         },
4005 };
4006
4007 static const struct drm_display_mode sharp_ls020b1dd01d_modes[] = {
4008         { /* 50 Hz */
4009                 .clock = 3000,
4010                 .hdisplay = 240,
4011                 .hsync_start = 240 + 58,
4012                 .hsync_end = 240 + 58 + 1,
4013                 .htotal = 240 + 58 + 1 + 1,
4014                 .vdisplay = 160,
4015                 .vsync_start = 160 + 24,
4016                 .vsync_end = 160 + 24 + 10,
4017                 .vtotal = 160 + 24 + 10 + 6,
4018                 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC,
4019         },
4020         { /* 60 Hz */
4021                 .clock = 3000,
4022                 .hdisplay = 240,
4023                 .hsync_start = 240 + 8,
4024                 .hsync_end = 240 + 8 + 1,
4025                 .htotal = 240 + 8 + 1 + 1,
4026                 .vdisplay = 160,
4027                 .vsync_start = 160 + 24,
4028                 .vsync_end = 160 + 24 + 10,
4029                 .vtotal = 160 + 24 + 10 + 6,
4030                 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_NVSYNC,
4031         },
4032 };
4033
4034 static const struct panel_desc sharp_ls020b1dd01d = {
4035         .modes = sharp_ls020b1dd01d_modes,
4036         .num_modes = ARRAY_SIZE(sharp_ls020b1dd01d_modes),
4037         .bpc = 6,
4038         .size = {
4039                 .width = 42,
4040                 .height = 28,
4041         },
4042         .bus_format = MEDIA_BUS_FMT_RGB565_1X16,
4043         .bus_flags = DRM_BUS_FLAG_DE_HIGH
4044                    | DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE
4045                    | DRM_BUS_FLAG_SHARP_SIGNALS,
4046 };
4047
4048 static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
4049         .clock = 33300,
4050         .hdisplay = 800,
4051         .hsync_start = 800 + 1,
4052         .hsync_end = 800 + 1 + 64,
4053         .htotal = 800 + 1 + 64 + 64,
4054         .vdisplay = 480,
4055         .vsync_start = 480 + 1,
4056         .vsync_end = 480 + 1 + 23,
4057         .vtotal = 480 + 1 + 23 + 22,
4058 };
4059
4060 static const struct panel_desc shelly_sca07010_bfn_lnn = {
4061         .modes = &shelly_sca07010_bfn_lnn_mode,
4062         .num_modes = 1,
4063         .size = {
4064                 .width = 152,
4065                 .height = 91,
4066         },
4067         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
4068 };
4069
4070 static const struct drm_display_mode starry_kr070pe2t_mode = {
4071         .clock = 33000,
4072         .hdisplay = 800,
4073         .hsync_start = 800 + 209,
4074         .hsync_end = 800 + 209 + 1,
4075         .htotal = 800 + 209 + 1 + 45,
4076         .vdisplay = 480,
4077         .vsync_start = 480 + 22,
4078         .vsync_end = 480 + 22 + 1,
4079         .vtotal = 480 + 22 + 1 + 22,
4080 };
4081
4082 static const struct panel_desc starry_kr070pe2t = {
4083         .modes = &starry_kr070pe2t_mode,
4084         .num_modes = 1,
4085         .bpc = 8,
4086         .size = {
4087                 .width = 152,
4088                 .height = 86,
4089         },
4090         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
4091         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE,
4092         .connector_type = DRM_MODE_CONNECTOR_DPI,
4093 };
4094
4095 static const struct drm_display_mode starry_kr122ea0sra_mode = {
4096         .clock = 147000,
4097         .hdisplay = 1920,
4098         .hsync_start = 1920 + 16,
4099         .hsync_end = 1920 + 16 + 16,
4100         .htotal = 1920 + 16 + 16 + 32,
4101         .vdisplay = 1200,
4102         .vsync_start = 1200 + 15,
4103         .vsync_end = 1200 + 15 + 2,
4104         .vtotal = 1200 + 15 + 2 + 18,
4105         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
4106 };
4107
4108 static const struct panel_desc starry_kr122ea0sra = {
4109         .modes = &starry_kr122ea0sra_mode,
4110         .num_modes = 1,
4111         .size = {
4112                 .width = 263,
4113                 .height = 164,
4114         },
4115         .delay = {
4116                 .prepare = 10 + 200,
4117                 .enable = 50,
4118                 .unprepare = 10 + 500,
4119         },
4120 };
4121
4122 static const struct drm_display_mode tfc_s9700rtwv43tr_01b_mode = {
4123         .clock = 30000,
4124         .hdisplay = 800,
4125         .hsync_start = 800 + 39,
4126         .hsync_end = 800 + 39 + 47,
4127         .htotal = 800 + 39 + 47 + 39,
4128         .vdisplay = 480,
4129         .vsync_start = 480 + 13,
4130         .vsync_end = 480 + 13 + 2,
4131         .vtotal = 480 + 13 + 2 + 29,
4132 };
4133
4134 static const struct panel_desc tfc_s9700rtwv43tr_01b = {
4135         .modes = &tfc_s9700rtwv43tr_01b_mode,
4136         .num_modes = 1,
4137         .bpc = 8,
4138         .size = {
4139                 .width = 155,
4140                 .height = 90,
4141         },
4142         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
4143         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
4144 };
4145
4146 static const struct display_timing tianma_tm070jdhg30_timing = {
4147         .pixelclock = { 62600000, 68200000, 78100000 },
4148         .hactive = { 1280, 1280, 1280 },
4149         .hfront_porch = { 15, 64, 159 },
4150         .hback_porch = { 5, 5, 5 },
4151         .hsync_len = { 1, 1, 256 },
4152         .vactive = { 800, 800, 800 },
4153         .vfront_porch = { 3, 40, 99 },
4154         .vback_porch = { 2, 2, 2 },
4155         .vsync_len = { 1, 1, 128 },
4156         .flags = DISPLAY_FLAGS_DE_HIGH,
4157 };
4158
4159 static const struct panel_desc tianma_tm070jdhg30 = {
4160         .timings = &tianma_tm070jdhg30_timing,
4161         .num_timings = 1,
4162         .bpc = 8,
4163         .size = {
4164                 .width = 151,
4165                 .height = 95,
4166         },
4167         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
4168         .connector_type = DRM_MODE_CONNECTOR_LVDS,
4169 };
4170
4171 static const struct panel_desc tianma_tm070jvhg33 = {
4172         .timings = &tianma_tm070jdhg30_timing,
4173         .num_timings = 1,
4174         .bpc = 8,
4175         .size = {
4176                 .width = 150,
4177                 .height = 94,
4178         },
4179         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
4180         .connector_type = DRM_MODE_CONNECTOR_LVDS,
4181 };
4182
4183 static const struct display_timing tianma_tm070rvhg71_timing = {
4184         .pixelclock = { 27700000, 29200000, 39600000 },
4185         .hactive = { 800, 800, 800 },
4186         .hfront_porch = { 12, 40, 212 },
4187         .hback_porch = { 88, 88, 88 },
4188         .hsync_len = { 1, 1, 40 },
4189         .vactive = { 480, 480, 480 },
4190         .vfront_porch = { 1, 13, 88 },
4191         .vback_porch = { 32, 32, 32 },
4192         .vsync_len = { 1, 1, 3 },
4193         .flags = DISPLAY_FLAGS_DE_HIGH,
4194 };
4195
4196 static const struct panel_desc tianma_tm070rvhg71 = {
4197         .timings = &tianma_tm070rvhg71_timing,
4198         .num_timings = 1,
4199         .bpc = 8,
4200         .size = {
4201                 .width = 154,
4202                 .height = 86,
4203         },
4204         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
4205         .connector_type = DRM_MODE_CONNECTOR_LVDS,
4206 };
4207
4208 static const struct drm_display_mode ti_nspire_cx_lcd_mode[] = {
4209         {
4210                 .clock = 10000,
4211                 .hdisplay = 320,
4212                 .hsync_start = 320 + 50,
4213                 .hsync_end = 320 + 50 + 6,
4214                 .htotal = 320 + 50 + 6 + 38,
4215                 .vdisplay = 240,
4216                 .vsync_start = 240 + 3,
4217                 .vsync_end = 240 + 3 + 1,
4218                 .vtotal = 240 + 3 + 1 + 17,
4219                 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
4220         },
4221 };
4222
4223 static const struct panel_desc ti_nspire_cx_lcd_panel = {
4224         .modes = ti_nspire_cx_lcd_mode,
4225         .num_modes = 1,
4226         .bpc = 8,
4227         .size = {
4228                 .width = 65,
4229                 .height = 49,
4230         },
4231         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
4232         .bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
4233 };
4234
4235 static const struct drm_display_mode ti_nspire_classic_lcd_mode[] = {
4236         {
4237                 .clock = 10000,
4238                 .hdisplay = 320,
4239                 .hsync_start = 320 + 6,
4240                 .hsync_end = 320 + 6 + 6,
4241                 .htotal = 320 + 6 + 6 + 6,
4242                 .vdisplay = 240,
4243                 .vsync_start = 240 + 0,
4244                 .vsync_end = 240 + 0 + 1,
4245                 .vtotal = 240 + 0 + 1 + 0,
4246                 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
4247         },
4248 };
4249
4250 static const struct panel_desc ti_nspire_classic_lcd_panel = {
4251         .modes = ti_nspire_classic_lcd_mode,
4252         .num_modes = 1,
4253         /* The grayscale panel has 8 bit for the color .. Y (black) */
4254         .bpc = 8,
4255         .size = {
4256                 .width = 71,
4257                 .height = 53,
4258         },
4259         /* This is the grayscale bus format */
4260         .bus_format = MEDIA_BUS_FMT_Y8_1X8,
4261         .bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
4262 };
4263
4264 static const struct drm_display_mode toshiba_lt089ac29000_mode = {
4265         .clock = 79500,
4266         .hdisplay = 1280,
4267         .hsync_start = 1280 + 192,
4268         .hsync_end = 1280 + 192 + 128,
4269         .htotal = 1280 + 192 + 128 + 64,
4270         .vdisplay = 768,
4271         .vsync_start = 768 + 20,
4272         .vsync_end = 768 + 20 + 7,
4273         .vtotal = 768 + 20 + 7 + 3,
4274 };
4275
4276 static const struct panel_desc toshiba_lt089ac29000 = {
4277         .modes = &toshiba_lt089ac29000_mode,
4278         .num_modes = 1,
4279         .size = {
4280                 .width = 194,
4281                 .height = 116,
4282         },
4283         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_JEIDA,
4284         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
4285         .connector_type = DRM_MODE_CONNECTOR_LVDS,
4286 };
4287
4288 static const struct drm_display_mode tpk_f07a_0102_mode = {
4289         .clock = 33260,
4290         .hdisplay = 800,
4291         .hsync_start = 800 + 40,
4292         .hsync_end = 800 + 40 + 128,
4293         .htotal = 800 + 40 + 128 + 88,
4294         .vdisplay = 480,
4295         .vsync_start = 480 + 10,
4296         .vsync_end = 480 + 10 + 2,
4297         .vtotal = 480 + 10 + 2 + 33,
4298 };
4299
4300 static const struct panel_desc tpk_f07a_0102 = {
4301         .modes = &tpk_f07a_0102_mode,
4302         .num_modes = 1,
4303         .size = {
4304                 .width = 152,
4305                 .height = 91,
4306         },
4307         .bus_flags = DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
4308 };
4309
4310 static const struct drm_display_mode tpk_f10a_0102_mode = {
4311         .clock = 45000,
4312         .hdisplay = 1024,
4313         .hsync_start = 1024 + 176,
4314         .hsync_end = 1024 + 176 + 5,
4315         .htotal = 1024 + 176 + 5 + 88,
4316         .vdisplay = 600,
4317         .vsync_start = 600 + 20,
4318         .vsync_end = 600 + 20 + 5,
4319         .vtotal = 600 + 20 + 5 + 25,
4320 };
4321
4322 static const struct panel_desc tpk_f10a_0102 = {
4323         .modes = &tpk_f10a_0102_mode,
4324         .num_modes = 1,
4325         .size = {
4326                 .width = 223,
4327                 .height = 125,
4328         },
4329 };
4330
4331 static const struct display_timing urt_umsh_8596md_timing = {
4332         .pixelclock = { 33260000, 33260000, 33260000 },
4333         .hactive = { 800, 800, 800 },
4334         .hfront_porch = { 41, 41, 41 },
4335         .hback_porch = { 216 - 128, 216 - 128, 216 - 128 },
4336         .hsync_len = { 71, 128, 128 },
4337         .vactive = { 480, 480, 480 },
4338         .vfront_porch = { 10, 10, 10 },
4339         .vback_porch = { 35 - 2, 35 - 2, 35 - 2 },
4340         .vsync_len = { 2, 2, 2 },
4341         .flags = DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_NEGEDGE |
4342                 DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
4343 };
4344
4345 static const struct panel_desc urt_umsh_8596md_lvds = {
4346         .timings = &urt_umsh_8596md_timing,
4347         .num_timings = 1,
4348         .bpc = 6,
4349         .size = {
4350                 .width = 152,
4351                 .height = 91,
4352         },
4353         .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
4354         .connector_type = DRM_MODE_CONNECTOR_LVDS,
4355 };
4356
4357 static const struct panel_desc urt_umsh_8596md_parallel = {
4358         .timings = &urt_umsh_8596md_timing,
4359         .num_timings = 1,
4360         .bpc = 6,
4361         .size = {
4362                 .width = 152,
4363                 .height = 91,
4364         },
4365         .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
4366 };
4367
4368 static const struct drm_display_mode vl050_8048nt_c01_mode = {
4369         .clock = 33333,
4370         .hdisplay = 800,
4371         .hsync_start = 800 + 210,
4372         .hsync_end = 800 + 210 + 20,
4373         .htotal = 800 + 210 + 20 + 46,
4374         .vdisplay =  480,
4375         .vsync_start = 480 + 22,
4376         .vsync_end = 480 + 22 + 10,
4377         .vtotal = 480 + 22 + 10 + 23,
4378         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
4379 };
4380
4381 static const struct panel_desc vl050_8048nt_c01 = {
4382         .modes = &vl050_8048nt_c01_mode,
4383         .num_modes = 1,
4384         .bpc = 8,
4385         .size = {
4386                 .width = 120,
4387                 .height = 76,
4388         },
4389         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
4390         .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_SAMPLE_NEGEDGE,
4391 };
4392
4393 static const struct drm_display_mode winstar_wf35ltiacd_mode = {
4394         .clock = 6410,
4395         .hdisplay = 320,
4396         .hsync_start = 320 + 20,
4397         .hsync_end = 320 + 20 + 30,
4398         .htotal = 320 + 20 + 30 + 38,
4399         .vdisplay = 240,
4400         .vsync_start = 240 + 4,
4401         .vsync_end = 240 + 4 + 3,
4402         .vtotal = 240 + 4 + 3 + 15,
4403         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
4404 };
4405
4406 static const struct panel_desc winstar_wf35ltiacd = {
4407         .modes = &winstar_wf35ltiacd_mode,
4408         .num_modes = 1,
4409         .bpc = 8,
4410         .size = {
4411                 .width = 70,
4412                 .height = 53,
4413         },
4414         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
4415 };
4416
4417 static const struct drm_display_mode yes_optoelectronics_ytc700tlag_05_201c_mode = {
4418         .clock = 51200,
4419         .hdisplay = 1024,
4420         .hsync_start = 1024 + 100,
4421         .hsync_end = 1024 + 100 + 100,
4422         .htotal = 1024 + 100 + 100 + 120,
4423         .vdisplay = 600,
4424         .vsync_start = 600 + 10,
4425         .vsync_end = 600 + 10 + 10,
4426         .vtotal = 600 + 10 + 10 + 15,
4427         .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
4428 };
4429
4430 static const struct panel_desc yes_optoelectronics_ytc700tlag_05_201c = {
4431         .modes = &yes_optoelectronics_ytc700tlag_05_201c_mode,
4432         .num_modes = 1,
4433         .bpc = 8,
4434         .size = {
4435                 .width = 154,
4436                 .height = 90,
4437         },
4438         .bus_flags = DRM_BUS_FLAG_DE_HIGH,
4439         .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
4440         .connector_type = DRM_MODE_CONNECTOR_LVDS,
4441 };
4442
4443 static const struct drm_display_mode arm_rtsm_mode[] = {
4444         {
4445                 .clock = 65000,
4446                 .hdisplay = 1024,
4447                 .hsync_start = 1024 + 24,
4448                 .hsync_end = 1024 + 24 + 136,
4449                 .htotal = 1024 + 24 + 136 + 160,
4450                 .vdisplay = 768,
4451                 .vsync_start = 768 + 3,
4452                 .vsync_end = 768 + 3 + 6,
4453                 .vtotal = 768 + 3 + 6 + 29,
4454                 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
4455         },
4456 };
4457
4458 static const struct panel_desc arm_rtsm = {
4459         .modes = arm_rtsm_mode,
4460         .num_modes = 1,
4461         .bpc = 8,
4462         .size = {
4463                 .width = 400,
4464                 .height = 300,
4465         },
4466         .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
4467 };
4468
4469 static const struct of_device_id platform_of_match[] = {
4470         {
4471                 .compatible = "ampire,am-1280800n3tzqw-t00h",
4472                 .data = &ampire_am_1280800n3tzqw_t00h,
4473         }, {
4474                 .compatible = "ampire,am-480272h3tmqw-t01h",
4475                 .data = &ampire_am_480272h3tmqw_t01h,
4476         }, {
4477                 .compatible = "ampire,am800480r3tmqwa1h",
4478                 .data = &ampire_am800480r3tmqwa1h,
4479         }, {
4480                 .compatible = "arm,rtsm-display",
4481                 .data = &arm_rtsm,
4482         }, {
4483                 .compatible = "armadeus,st0700-adapt",
4484                 .data = &armadeus_st0700_adapt,
4485         }, {
4486                 .compatible = "auo,b101aw03",
4487                 .data = &auo_b101aw03,
4488         }, {
4489                 .compatible = "auo,b101ean01",
4490                 .data = &auo_b101ean01,
4491         }, {
4492                 .compatible = "auo,b101xtn01",
4493                 .data = &auo_b101xtn01,
4494         }, {
4495                 .compatible = "auo,b116xa01",
4496                 .data = &auo_b116xak01,
4497         }, {
4498                 .compatible = "auo,b116xw03",
4499                 .data = &auo_b116xw03,
4500         }, {
4501                 .compatible = "auo,b133han05",
4502                 .data = &auo_b133han05,
4503         }, {
4504                 .compatible = "auo,b133htn01",
4505                 .data = &auo_b133htn01,
4506         }, {
4507                 .compatible = "auo,b140han06",
4508                 .data = &auo_b140han06,
4509         }, {
4510                 .compatible = "auo,b133xtn01",
4511                 .data = &auo_b133xtn01,
4512         }, {
4513                 .compatible = "auo,g070vvn01",
4514                 .data = &auo_g070vvn01,
4515         }, {
4516                 .compatible = "auo,g101evn010",
4517                 .data = &auo_g101evn010,
4518         }, {
4519                 .compatible = "auo,g104sn02",
4520                 .data = &auo_g104sn02,
4521         }, {
4522                 .compatible = "auo,g121ean01",
4523                 .data = &auo_g121ean01,
4524         }, {
4525                 .compatible = "auo,g133han01",
4526                 .data = &auo_g133han01,
4527         }, {
4528                 .compatible = "auo,g156xtn01",
4529                 .data = &auo_g156xtn01,
4530         }, {
4531                 .compatible = "auo,g185han01",
4532                 .data = &auo_g185han01,
4533         }, {
4534                 .compatible = "auo,g190ean01",
4535                 .data = &auo_g190ean01,
4536         }, {
4537                 .compatible = "auo,p320hvn03",
4538                 .data = &auo_p320hvn03,
4539         }, {
4540                 .compatible = "auo,t215hvn01",
4541                 .data = &auo_t215hvn01,
4542         }, {
4543                 .compatible = "avic,tm070ddh03",
4544                 .data = &avic_tm070ddh03,
4545         }, {
4546                 .compatible = "bananapi,s070wv20-ct16",
4547                 .data = &bananapi_s070wv20_ct16,
4548         }, {
4549                 .compatible = "boe,hv070wsa-100",
4550                 .data = &boe_hv070wsa
4551         }, {
4552                 .compatible = "boe,nv101wxmn51",
4553                 .data = &boe_nv101wxmn51,
4554         }, {
4555                 .compatible = "boe,nv110wtm-n61",
4556                 .data = &boe_nv110wtm_n61,
4557         }, {
4558                 .compatible = "boe,nv133fhm-n61",
4559                 .data = &boe_nv133fhm_n61,
4560         }, {
4561                 .compatible = "boe,nv133fhm-n62",
4562                 .data = &boe_nv133fhm_n61,
4563         }, {
4564                 .compatible = "boe,nv140fhmn49",
4565                 .data = &boe_nv140fhmn49,
4566         }, {
4567                 .compatible = "cdtech,s043wq26h-ct7",
4568                 .data = &cdtech_s043wq26h_ct7,
4569         }, {
4570                 .compatible = "cdtech,s070pws19hp-fc21",
4571                 .data = &cdtech_s070pws19hp_fc21,
4572         }, {
4573                 .compatible = "cdtech,s070swv29hg-dc44",
4574                 .data = &cdtech_s070swv29hg_dc44,
4575         }, {
4576                 .compatible = "cdtech,s070wv95-ct16",
4577                 .data = &cdtech_s070wv95_ct16,
4578         }, {
4579                 .compatible = "chefree,ch101olhlwh-002",
4580                 .data = &chefree_ch101olhlwh_002,
4581         }, {
4582                 .compatible = "chunghwa,claa070wp03xg",
4583                 .data = &chunghwa_claa070wp03xg,
4584         }, {
4585                 .compatible = "chunghwa,claa101wa01a",
4586                 .data = &chunghwa_claa101wa01a
4587         }, {
4588                 .compatible = "chunghwa,claa101wb01",
4589                 .data = &chunghwa_claa101wb01
4590         }, {
4591                 .compatible = "dataimage,scf0700c48ggu18",
4592                 .data = &dataimage_scf0700c48ggu18,
4593         }, {
4594                 .compatible = "dlc,dlc0700yzg-1",
4595                 .data = &dlc_dlc0700yzg_1,
4596         }, {
4597                 .compatible = "dlc,dlc1010gig",
4598                 .data = &dlc_dlc1010gig,
4599         }, {
4600                 .compatible = "edt,et035012dm6",
4601                 .data = &edt_et035012dm6,
4602         }, {
4603                 .compatible = "edt,etm0350g0dh6",
4604                 .data = &edt_etm0350g0dh6,
4605         }, {
4606                 .compatible = "edt,etm043080dh6gp",
4607                 .data = &edt_etm043080dh6gp,
4608         }, {
4609                 .compatible = "edt,etm0430g0dh6",
4610                 .data = &edt_etm0430g0dh6,
4611         }, {
4612                 .compatible = "edt,et057090dhu",
4613                 .data = &edt_et057090dhu,
4614         }, {
4615                 .compatible = "edt,et070080dh6",
4616                 .data = &edt_etm0700g0dh6,
4617         }, {
4618                 .compatible = "edt,etm0700g0dh6",
4619                 .data = &edt_etm0700g0dh6,
4620         }, {
4621                 .compatible = "edt,etm0700g0bdh6",
4622                 .data = &edt_etm0700g0bdh6,
4623         }, {
4624                 .compatible = "edt,etm0700g0edh6",
4625                 .data = &edt_etm0700g0bdh6,
4626         }, {
4627                 .compatible = "edt,etmv570g2dhu",
4628                 .data = &edt_etmv570g2dhu,
4629         }, {
4630                 .compatible = "eink,vb3300-kca",
4631                 .data = &eink_vb3300_kca,
4632         }, {
4633                 .compatible = "evervision,vgg804821",
4634                 .data = &evervision_vgg804821,
4635         }, {
4636                 .compatible = "foxlink,fl500wvr00-a0t",
4637                 .data = &foxlink_fl500wvr00_a0t,
4638         }, {
4639                 .compatible = "frida,frd350h54004",
4640                 .data = &frida_frd350h54004,
4641         }, {
4642                 .compatible = "friendlyarm,hd702e",
4643                 .data = &friendlyarm_hd702e,
4644         }, {
4645                 .compatible = "giantplus,gpg482739qs5",
4646                 .data = &giantplus_gpg482739qs5
4647         }, {
4648                 .compatible = "giantplus,gpm940b0",
4649                 .data = &giantplus_gpm940b0,
4650         }, {
4651                 .compatible = "hannstar,hsd070pww1",
4652                 .data = &hannstar_hsd070pww1,
4653         }, {
4654                 .compatible = "hannstar,hsd100pxn1",
4655                 .data = &hannstar_hsd100pxn1,
4656         }, {
4657                 .compatible = "hit,tx23d38vm0caa",
4658                 .data = &hitachi_tx23d38vm0caa
4659         }, {
4660                 .compatible = "innolux,at043tn24",
4661                 .data = &innolux_at043tn24,
4662         }, {
4663                 .compatible = "innolux,at070tn92",
4664                 .data = &innolux_at070tn92,
4665         }, {
4666                 .compatible = "innolux,g070y2-l01",
4667                 .data = &innolux_g070y2_l01,
4668         }, {
4669                 .compatible = "innolux,g101ice-l01",
4670                 .data = &innolux_g101ice_l01
4671         }, {
4672                 .compatible = "innolux,g121i1-l01",
4673                 .data = &innolux_g121i1_l01
4674         }, {
4675                 .compatible = "innolux,g121x1-l03",
4676                 .data = &innolux_g121x1_l03,
4677         }, {
4678                 .compatible = "innolux,n116bca-ea1",
4679                 .data = &innolux_n116bca_ea1,
4680         }, {
4681                 .compatible = "innolux,n116bge",
4682                 .data = &innolux_n116bge,
4683         }, {
4684                 .compatible = "innolux,n125hce-gn1",
4685                 .data = &innolux_n125hce_gn1,
4686         }, {
4687                 .compatible = "innolux,n156bge-l21",
4688                 .data = &innolux_n156bge_l21,
4689         }, {
4690                 .compatible = "innolux,p120zdg-bf1",
4691                 .data = &innolux_p120zdg_bf1,
4692         }, {
4693                 .compatible = "innolux,zj070na-01p",
4694                 .data = &innolux_zj070na_01p,
4695         }, {
4696                 .compatible = "ivo,m133nwf4-r0",
4697                 .data = &ivo_m133nwf4_r0,
4698         }, {
4699                 .compatible = "kingdisplay,kd116n21-30nv-a010",
4700                 .data = &kingdisplay_kd116n21_30nv_a010,
4701         }, {
4702                 .compatible = "koe,tx14d24vm1bpa",
4703                 .data = &koe_tx14d24vm1bpa,
4704         }, {
4705                 .compatible = "koe,tx26d202vm0bwa",
4706                 .data = &koe_tx26d202vm0bwa,
4707         }, {
4708                 .compatible = "koe,tx31d200vm0baa",
4709                 .data = &koe_tx31d200vm0baa,
4710         }, {
4711                 .compatible = "kyo,tcg121xglp",
4712                 .data = &kyo_tcg121xglp,
4713         }, {
4714                 .compatible = "lemaker,bl035-rgb-002",
4715                 .data = &lemaker_bl035_rgb_002,
4716         }, {
4717                 .compatible = "lg,lb070wv8",
4718                 .data = &lg_lb070wv8,
4719         }, {
4720                 .compatible = "lg,lp079qx1-sp0v",
4721                 .data = &lg_lp079qx1_sp0v,
4722         }, {
4723                 .compatible = "lg,lp097qx1-spa1",
4724                 .data = &lg_lp097qx1_spa1,
4725         }, {
4726                 .compatible = "lg,lp120up1",
4727                 .data = &lg_lp120up1,
4728         }, {
4729                 .compatible = "lg,lp129qe",
4730                 .data = &lg_lp129qe,
4731         }, {
4732                 .compatible = "logicpd,type28",
4733                 .data = &logicpd_type_28,
4734         }, {
4735                 .compatible = "logictechno,lt161010-2nhc",
4736                 .data = &logictechno_lt161010_2nh,
4737         }, {
4738                 .compatible = "logictechno,lt161010-2nhr",
4739                 .data = &logictechno_lt161010_2nh,
4740         }, {
4741                 .compatible = "logictechno,lt170410-2whc",
4742                 .data = &logictechno_lt170410_2whc,
4743         }, {
4744                 .compatible = "logictechno,lttd800480070-l6wh-rt",
4745                 .data = &logictechno_lttd800480070_l6wh_rt,
4746         }, {
4747                 .compatible = "mitsubishi,aa070mc01-ca1",
4748                 .data = &mitsubishi_aa070mc01,
4749         }, {
4750                 .compatible = "multi-inno,mi1010ait-1cp",
4751                 .data = &multi_inno_mi1010ait_1cp,
4752         }, {
4753                 .compatible = "nec,nl12880bc20-05",
4754                 .data = &nec_nl12880bc20_05,
4755         }, {
4756                 .compatible = "nec,nl4827hc19-05b",
4757                 .data = &nec_nl4827hc19_05b,
4758         }, {
4759                 .compatible = "netron-dy,e231732",
4760                 .data = &netron_dy_e231732,
4761         }, {
4762                 .compatible = "neweast,wjfh116008a",
4763                 .data = &neweast_wjfh116008a,
4764         }, {
4765                 .compatible = "newhaven,nhd-4.3-480272ef-atxl",
4766                 .data = &newhaven_nhd_43_480272ef_atxl,
4767         }, {
4768                 .compatible = "nlt,nl192108ac18-02d",
4769                 .data = &nlt_nl192108ac18_02d,
4770         }, {
4771                 .compatible = "nvd,9128",
4772                 .data = &nvd_9128,
4773         }, {
4774                 .compatible = "okaya,rs800480t-7x0gp",
4775                 .data = &okaya_rs800480t_7x0gp,
4776         }, {
4777                 .compatible = "olimex,lcd-olinuxino-43-ts",
4778                 .data = &olimex_lcd_olinuxino_43ts,
4779         }, {
4780                 .compatible = "ontat,yx700wv03",
4781                 .data = &ontat_yx700wv03,
4782         }, {
4783                 .compatible = "ortustech,com37h3m05dtc",
4784                 .data = &ortustech_com37h3m,
4785         }, {
4786                 .compatible = "ortustech,com37h3m99dtc",
4787                 .data = &ortustech_com37h3m,
4788         }, {
4789                 .compatible = "ortustech,com43h4m85ulc",
4790                 .data = &ortustech_com43h4m85ulc,
4791         }, {
4792                 .compatible = "osddisplays,osd070t1718-19ts",
4793                 .data = &osddisplays_osd070t1718_19ts,
4794         }, {
4795                 .compatible = "pda,91-00156-a0",
4796                 .data = &pda_91_00156_a0,
4797         }, {
4798                 .compatible = "powertip,ph800480t013-idf02",
4799                 .data = &powertip_ph800480t013_idf02,
4800         }, {
4801                 .compatible = "qiaodian,qd43003c0-40",
4802                 .data = &qd43003c0_40,
4803         }, {
4804                 .compatible = "qishenglong,gopher2b-lcd",
4805                 .data = &qishenglong_gopher2b_lcd,
4806         }, {
4807                 .compatible = "rocktech,rk070er9427",
4808                 .data = &rocktech_rk070er9427,
4809         }, {
4810                 .compatible = "rocktech,rk101ii01d-ct",
4811                 .data = &rocktech_rk101ii01d_ct,
4812         }, {
4813                 .compatible = "samsung,lsn122dl01-c01",
4814                 .data = &samsung_lsn122dl01_c01,
4815         }, {
4816                 .compatible = "samsung,ltn101nt05",
4817                 .data = &samsung_ltn101nt05,
4818         }, {
4819                 .compatible = "samsung,ltn140at29-301",
4820                 .data = &samsung_ltn140at29_301,
4821         }, {
4822                 .compatible = "satoz,sat050at40h12r2",
4823                 .data = &satoz_sat050at40h12r2,
4824         }, {
4825                 .compatible = "sharp,ld-d5116z01b",
4826                 .data = &sharp_ld_d5116z01b,
4827         }, {
4828                 .compatible = "sharp,lq035q7db03",
4829                 .data = &sharp_lq035q7db03,
4830         }, {
4831                 .compatible = "sharp,lq070y3dg3b",
4832                 .data = &sharp_lq070y3dg3b,
4833         }, {
4834                 .compatible = "sharp,lq101k1ly04",
4835                 .data = &sharp_lq101k1ly04,
4836         }, {
4837                 .compatible = "sharp,lq123p1jx31",
4838                 .data = &sharp_lq123p1jx31,
4839         }, {
4840                 .compatible = "sharp,ls020b1dd01d",
4841                 .data = &sharp_ls020b1dd01d,
4842         }, {
4843                 .compatible = "shelly,sca07010-bfn-lnn",
4844                 .data = &shelly_sca07010_bfn_lnn,
4845         }, {
4846                 .compatible = "starry,kr070pe2t",
4847                 .data = &starry_kr070pe2t,
4848         }, {
4849                 .compatible = "starry,kr122ea0sra",
4850                 .data = &starry_kr122ea0sra,
4851         }, {
4852                 .compatible = "tfc,s9700rtwv43tr-01b",
4853                 .data = &tfc_s9700rtwv43tr_01b,
4854         }, {
4855                 .compatible = "tianma,tm070jdhg30",
4856                 .data = &tianma_tm070jdhg30,
4857         }, {
4858                 .compatible = "tianma,tm070jvhg33",
4859                 .data = &tianma_tm070jvhg33,
4860         }, {
4861                 .compatible = "tianma,tm070rvhg71",
4862                 .data = &tianma_tm070rvhg71,
4863         }, {
4864                 .compatible = "ti,nspire-cx-lcd-panel",
4865                 .data = &ti_nspire_cx_lcd_panel,
4866         }, {
4867                 .compatible = "ti,nspire-classic-lcd-panel",
4868                 .data = &ti_nspire_classic_lcd_panel,
4869         }, {
4870                 .compatible = "toshiba,lt089ac29000",
4871                 .data = &toshiba_lt089ac29000,
4872         }, {
4873                 .compatible = "tpk,f07a-0102",
4874                 .data = &tpk_f07a_0102,
4875         }, {
4876                 .compatible = "tpk,f10a-0102",
4877                 .data = &tpk_f10a_0102,
4878         }, {
4879                 .compatible = "urt,umsh-8596md-t",
4880                 .data = &urt_umsh_8596md_parallel,
4881         }, {
4882                 .compatible = "urt,umsh-8596md-1t",
4883                 .data = &urt_umsh_8596md_parallel,
4884         }, {
4885                 .compatible = "urt,umsh-8596md-7t",
4886                 .data = &urt_umsh_8596md_parallel,
4887         }, {
4888                 .compatible = "urt,umsh-8596md-11t",
4889                 .data = &urt_umsh_8596md_lvds,
4890         }, {
4891                 .compatible = "urt,umsh-8596md-19t",
4892                 .data = &urt_umsh_8596md_lvds,
4893         }, {
4894                 .compatible = "urt,umsh-8596md-20t",
4895                 .data = &urt_umsh_8596md_parallel,
4896         }, {
4897                 .compatible = "vxt,vl050-8048nt-c01",
4898                 .data = &vl050_8048nt_c01,
4899         }, {
4900                 .compatible = "winstar,wf35ltiacd",
4901                 .data = &winstar_wf35ltiacd,
4902         }, {
4903                 .compatible = "yes-optoelectronics,ytc700tlag-05-201c",
4904                 .data = &yes_optoelectronics_ytc700tlag_05_201c,
4905         }, {
4906                 /* Must be the last entry */
4907                 .compatible = "panel-dpi",
4908                 .data = &panel_dpi,
4909         }, {
4910                 /* sentinel */
4911         }
4912 };
4913 MODULE_DEVICE_TABLE(of, platform_of_match);
4914
4915 static int panel_simple_platform_probe(struct platform_device *pdev)
4916 {
4917         const struct of_device_id *id;
4918
4919         id = of_match_node(platform_of_match, pdev->dev.of_node);
4920         if (!id)
4921                 return -ENODEV;
4922
4923         return panel_simple_probe(&pdev->dev, id->data, NULL);
4924 }
4925
4926 static int panel_simple_platform_remove(struct platform_device *pdev)
4927 {
4928         return panel_simple_remove(&pdev->dev);
4929 }
4930
4931 static void panel_simple_platform_shutdown(struct platform_device *pdev)
4932 {
4933         panel_simple_shutdown(&pdev->dev);
4934 }
4935
4936 static const struct dev_pm_ops panel_simple_pm_ops = {
4937         SET_RUNTIME_PM_OPS(panel_simple_suspend, panel_simple_resume, NULL)
4938         SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
4939                                 pm_runtime_force_resume)
4940 };
4941
4942 static struct platform_driver panel_simple_platform_driver = {
4943         .driver = {
4944                 .name = "panel-simple",
4945                 .of_match_table = platform_of_match,
4946                 .pm = &panel_simple_pm_ops,
4947         },
4948         .probe = panel_simple_platform_probe,
4949         .remove = panel_simple_platform_remove,
4950         .shutdown = panel_simple_platform_shutdown,
4951 };
4952
4953 struct panel_desc_dsi {
4954         struct panel_desc desc;
4955
4956         unsigned long flags;
4957         enum mipi_dsi_pixel_format format;
4958         unsigned int lanes;
4959 };
4960
4961 static const struct drm_display_mode auo_b080uan01_mode = {
4962         .clock = 154500,
4963         .hdisplay = 1200,
4964         .hsync_start = 1200 + 62,
4965         .hsync_end = 1200 + 62 + 4,
4966         .htotal = 1200 + 62 + 4 + 62,
4967         .vdisplay = 1920,
4968         .vsync_start = 1920 + 9,
4969         .vsync_end = 1920 + 9 + 2,
4970         .vtotal = 1920 + 9 + 2 + 8,
4971 };
4972
4973 static const struct panel_desc_dsi auo_b080uan01 = {
4974         .desc = {
4975                 .modes = &auo_b080uan01_mode,
4976                 .num_modes = 1,
4977                 .bpc = 8,
4978                 .size = {
4979                         .width = 108,
4980                         .height = 272,
4981                 },
4982                 .connector_type = DRM_MODE_CONNECTOR_DSI,
4983         },
4984         .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
4985         .format = MIPI_DSI_FMT_RGB888,
4986         .lanes = 4,
4987 };
4988
4989 static const struct drm_display_mode boe_tv080wum_nl0_mode = {
4990         .clock = 160000,
4991         .hdisplay = 1200,
4992         .hsync_start = 1200 + 120,
4993         .hsync_end = 1200 + 120 + 20,
4994         .htotal = 1200 + 120 + 20 + 21,
4995         .vdisplay = 1920,
4996         .vsync_start = 1920 + 21,
4997         .vsync_end = 1920 + 21 + 3,
4998         .vtotal = 1920 + 21 + 3 + 18,
4999         .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
5000 };
5001
5002 static const struct panel_desc_dsi boe_tv080wum_nl0 = {
5003         .desc = {
5004                 .modes = &boe_tv080wum_nl0_mode,
5005                 .num_modes = 1,
5006                 .size = {
5007                         .width = 107,
5008                         .height = 172,
5009                 },
5010                 .connector_type = DRM_MODE_CONNECTOR_DSI,
5011         },
5012         .flags = MIPI_DSI_MODE_VIDEO |
5013                  MIPI_DSI_MODE_VIDEO_BURST |
5014                  MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
5015         .format = MIPI_DSI_FMT_RGB888,
5016         .lanes = 4,
5017 };
5018
5019 static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
5020         .clock = 71000,
5021         .hdisplay = 800,
5022         .hsync_start = 800 + 32,
5023         .hsync_end = 800 + 32 + 1,
5024         .htotal = 800 + 32 + 1 + 57,
5025         .vdisplay = 1280,
5026         .vsync_start = 1280 + 28,
5027         .vsync_end = 1280 + 28 + 1,
5028         .vtotal = 1280 + 28 + 1 + 14,
5029 };
5030
5031 static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
5032         .desc = {
5033                 .modes = &lg_ld070wx3_sl01_mode,
5034                 .num_modes = 1,
5035                 .bpc = 8,
5036                 .size = {
5037                         .width = 94,
5038                         .height = 151,
5039                 },
5040                 .connector_type = DRM_MODE_CONNECTOR_DSI,
5041         },
5042         .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
5043         .format = MIPI_DSI_FMT_RGB888,
5044         .lanes = 4,
5045 };
5046
5047 static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
5048         .clock = 67000,
5049         .hdisplay = 720,
5050         .hsync_start = 720 + 12,
5051         .hsync_end = 720 + 12 + 4,
5052         .htotal = 720 + 12 + 4 + 112,
5053         .vdisplay = 1280,
5054         .vsync_start = 1280 + 8,
5055         .vsync_end = 1280 + 8 + 4,
5056         .vtotal = 1280 + 8 + 4 + 12,
5057 };
5058
5059 static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
5060         .desc = {
5061                 .modes = &lg_lh500wx1_sd03_mode,
5062                 .num_modes = 1,
5063                 .bpc = 8,
5064                 .size = {
5065                         .width = 62,
5066                         .height = 110,
5067                 },
5068                 .connector_type = DRM_MODE_CONNECTOR_DSI,
5069         },
5070         .flags = MIPI_DSI_MODE_VIDEO,
5071         .format = MIPI_DSI_FMT_RGB888,
5072         .lanes = 4,
5073 };
5074
5075 static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
5076         .clock = 157200,
5077         .hdisplay = 1920,
5078         .hsync_start = 1920 + 154,
5079         .hsync_end = 1920 + 154 + 16,
5080         .htotal = 1920 + 154 + 16 + 32,
5081         .vdisplay = 1200,
5082         .vsync_start = 1200 + 17,
5083         .vsync_end = 1200 + 17 + 2,
5084         .vtotal = 1200 + 17 + 2 + 16,
5085 };
5086
5087 static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
5088         .desc = {
5089                 .modes = &panasonic_vvx10f004b00_mode,
5090                 .num_modes = 1,
5091                 .bpc = 8,
5092                 .size = {
5093                         .width = 217,
5094                         .height = 136,
5095                 },
5096                 .connector_type = DRM_MODE_CONNECTOR_DSI,
5097         },
5098         .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
5099                  MIPI_DSI_CLOCK_NON_CONTINUOUS,
5100         .format = MIPI_DSI_FMT_RGB888,
5101         .lanes = 4,
5102 };
5103
5104 static const struct drm_display_mode lg_acx467akm_7_mode = {
5105         .clock = 150000,
5106         .hdisplay = 1080,
5107         .hsync_start = 1080 + 2,
5108         .hsync_end = 1080 + 2 + 2,
5109         .htotal = 1080 + 2 + 2 + 2,
5110         .vdisplay = 1920,
5111         .vsync_start = 1920 + 2,
5112         .vsync_end = 1920 + 2 + 2,
5113         .vtotal = 1920 + 2 + 2 + 2,
5114 };
5115
5116 static const struct panel_desc_dsi lg_acx467akm_7 = {
5117         .desc = {
5118                 .modes = &lg_acx467akm_7_mode,
5119                 .num_modes = 1,
5120                 .bpc = 8,
5121                 .size = {
5122                         .width = 62,
5123                         .height = 110,
5124                 },
5125                 .connector_type = DRM_MODE_CONNECTOR_DSI,
5126         },
5127         .flags = 0,
5128         .format = MIPI_DSI_FMT_RGB888,
5129         .lanes = 4,
5130 };
5131
5132 static const struct drm_display_mode osd101t2045_53ts_mode = {
5133         .clock = 154500,
5134         .hdisplay = 1920,
5135         .hsync_start = 1920 + 112,
5136         .hsync_end = 1920 + 112 + 16,
5137         .htotal = 1920 + 112 + 16 + 32,
5138         .vdisplay = 1200,
5139         .vsync_start = 1200 + 16,
5140         .vsync_end = 1200 + 16 + 2,
5141         .vtotal = 1200 + 16 + 2 + 16,
5142         .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
5143 };
5144
5145 static const struct panel_desc_dsi osd101t2045_53ts = {
5146         .desc = {
5147                 .modes = &osd101t2045_53ts_mode,
5148                 .num_modes = 1,
5149                 .bpc = 8,
5150                 .size = {
5151                         .width = 217,
5152                         .height = 136,
5153                 },
5154                 .connector_type = DRM_MODE_CONNECTOR_DSI,
5155         },
5156         .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_BURST |
5157                  MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
5158                  MIPI_DSI_MODE_NO_EOT_PACKET,
5159         .format = MIPI_DSI_FMT_RGB888,
5160         .lanes = 4,
5161 };
5162
5163 static const struct of_device_id dsi_of_match[] = {
5164         {
5165                 .compatible = "auo,b080uan01",
5166                 .data = &auo_b080uan01
5167         }, {
5168                 .compatible = "boe,tv080wum-nl0",
5169                 .data = &boe_tv080wum_nl0
5170         }, {
5171                 .compatible = "lg,ld070wx3-sl01",
5172                 .data = &lg_ld070wx3_sl01
5173         }, {
5174                 .compatible = "lg,lh500wx1-sd03",
5175                 .data = &lg_lh500wx1_sd03
5176         }, {
5177                 .compatible = "panasonic,vvx10f004b00",
5178                 .data = &panasonic_vvx10f004b00
5179         }, {
5180                 .compatible = "lg,acx467akm-7",
5181                 .data = &lg_acx467akm_7
5182         }, {
5183                 .compatible = "osddisplays,osd101t2045-53ts",
5184                 .data = &osd101t2045_53ts
5185         }, {
5186                 /* sentinel */
5187         }
5188 };
5189 MODULE_DEVICE_TABLE(of, dsi_of_match);
5190
5191 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
5192 {
5193         const struct panel_desc_dsi *desc;
5194         const struct of_device_id *id;
5195         int err;
5196
5197         id = of_match_node(dsi_of_match, dsi->dev.of_node);
5198         if (!id)
5199                 return -ENODEV;
5200
5201         desc = id->data;
5202
5203         err = panel_simple_probe(&dsi->dev, &desc->desc, NULL);
5204         if (err < 0)
5205                 return err;
5206
5207         dsi->mode_flags = desc->flags;
5208         dsi->format = desc->format;
5209         dsi->lanes = desc->lanes;
5210
5211         err = mipi_dsi_attach(dsi);
5212         if (err) {
5213                 struct panel_simple *panel = mipi_dsi_get_drvdata(dsi);
5214
5215                 drm_panel_remove(&panel->base);
5216         }
5217
5218         return err;
5219 }
5220
5221 static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
5222 {
5223         int err;
5224
5225         err = mipi_dsi_detach(dsi);
5226         if (err < 0)
5227                 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
5228
5229         return panel_simple_remove(&dsi->dev);
5230 }
5231
5232 static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
5233 {
5234         panel_simple_shutdown(&dsi->dev);
5235 }
5236
5237 static struct mipi_dsi_driver panel_simple_dsi_driver = {
5238         .driver = {
5239                 .name = "panel-simple-dsi",
5240                 .of_match_table = dsi_of_match,
5241                 .pm = &panel_simple_pm_ops,
5242         },
5243         .probe = panel_simple_dsi_probe,
5244         .remove = panel_simple_dsi_remove,
5245         .shutdown = panel_simple_dsi_shutdown,
5246 };
5247
5248 static int panel_simple_dp_aux_ep_probe(struct dp_aux_ep_device *aux_ep)
5249 {
5250         const struct of_device_id *id;
5251
5252         id = of_match_node(platform_of_match, aux_ep->dev.of_node);
5253         if (!id)
5254                 return -ENODEV;
5255
5256         return panel_simple_probe(&aux_ep->dev, id->data, aux_ep->aux);
5257 }
5258
5259 static void panel_simple_dp_aux_ep_remove(struct dp_aux_ep_device *aux_ep)
5260 {
5261         panel_simple_remove(&aux_ep->dev);
5262 }
5263
5264 static void panel_simple_dp_aux_ep_shutdown(struct dp_aux_ep_device *aux_ep)
5265 {
5266         panel_simple_shutdown(&aux_ep->dev);
5267 }
5268
5269 static struct dp_aux_ep_driver panel_simple_dp_aux_ep_driver = {
5270         .driver = {
5271                 .name = "panel-simple-dp-aux",
5272                 .of_match_table = platform_of_match,    /* Same as platform one! */
5273                 .pm = &panel_simple_pm_ops,
5274         },
5275         .probe = panel_simple_dp_aux_ep_probe,
5276         .remove = panel_simple_dp_aux_ep_remove,
5277         .shutdown = panel_simple_dp_aux_ep_shutdown,
5278 };
5279
5280 static int __init panel_simple_init(void)
5281 {
5282         int err;
5283
5284         err = platform_driver_register(&panel_simple_platform_driver);
5285         if (err < 0)
5286                 return err;
5287
5288         err = dp_aux_dp_driver_register(&panel_simple_dp_aux_ep_driver);
5289         if (err < 0)
5290                 goto err_did_platform_register;
5291
5292         if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
5293                 err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
5294                 if (err < 0)
5295                         goto err_did_aux_ep_register;
5296         }
5297
5298         return 0;
5299
5300 err_did_aux_ep_register:
5301         dp_aux_dp_driver_unregister(&panel_simple_dp_aux_ep_driver);
5302
5303 err_did_platform_register:
5304         platform_driver_unregister(&panel_simple_platform_driver);
5305
5306         return err;
5307 }
5308 module_init(panel_simple_init);
5309
5310 static void __exit panel_simple_exit(void)
5311 {
5312         if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
5313                 mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
5314
5315         dp_aux_dp_driver_unregister(&panel_simple_dp_aux_ep_driver);
5316         platform_driver_unregister(&panel_simple_platform_driver);
5317 }
5318 module_exit(panel_simple_exit);
5319
5320 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
5321 MODULE_DESCRIPTION("DRM Driver for Simple Panels");
5322 MODULE_LICENSE("GPL and additional rights");