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