blob: aac65e6d41d0f74f1ec478d9cc71b5d9b68349bb [file] [log] [blame]
Thierry Reding280921d2013-08-30 15:10:14 +02001/*
2 * Copyright (C) 2013, NVIDIA Corporation. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sub license,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice (including the
12 * next paragraph) shall be included in all copies or substantial portions
13 * of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#include <linux/backlight.h>
Alexandre Courbotcfdf0542014-03-01 14:00:58 +090025#include <linux/gpio/consumer.h>
Thierry Reding280921d2013-08-30 15:10:14 +020026#include <linux/module.h>
Thierry Reding280921d2013-08-30 15:10:14 +020027#include <linux/of_platform.h>
28#include <linux/platform_device.h>
29#include <linux/regulator/consumer.h>
30
31#include <drm/drmP.h>
32#include <drm/drm_crtc.h>
Thierry Reding210fcd92013-11-22 19:27:11 +010033#include <drm/drm_mipi_dsi.h>
Thierry Reding280921d2013-08-30 15:10:14 +020034#include <drm/drm_panel.h>
35
Philipp Zabela5d3e622014-12-11 18:32:45 +010036#include <video/display_timing.h>
37#include <video/videomode.h>
38
Thierry Reding280921d2013-08-30 15:10:14 +020039struct panel_desc {
40 const struct drm_display_mode *modes;
41 unsigned int num_modes;
Philipp Zabela5d3e622014-12-11 18:32:45 +010042 const struct display_timing *timings;
43 unsigned int num_timings;
Thierry Reding280921d2013-08-30 15:10:14 +020044
Stéphane Marchesin0208d512014-06-19 18:18:28 -070045 unsigned int bpc;
46
Ulrich Ölmann85533e32015-12-04 12:31:28 +010047 /**
48 * @width: width (in millimeters) of the panel's active display area
49 * @height: height (in millimeters) of the panel's active display area
50 */
Thierry Reding280921d2013-08-30 15:10:14 +020051 struct {
52 unsigned int width;
53 unsigned int height;
54 } size;
Ajay Kumarf673c372014-07-31 23:12:11 +053055
56 /**
57 * @prepare: the time (in milliseconds) that it takes for the panel to
58 * become ready and start receiving video data
59 * @enable: the time (in milliseconds) that it takes for the panel to
60 * display the first valid frame after starting to receive
61 * video data
62 * @disable: the time (in milliseconds) that it takes for the panel to
63 * turn the display off (no content is visible)
64 * @unprepare: the time (in milliseconds) that it takes for the panel
65 * to power itself down completely
66 */
67 struct {
68 unsigned int prepare;
69 unsigned int enable;
70 unsigned int disable;
71 unsigned int unprepare;
72 } delay;
Boris Brezillon795f7ab2014-07-22 13:33:59 +020073
74 u32 bus_format;
Stefan Agnerf0aa0832016-02-08 11:38:14 -080075 u32 bus_flags;
Thierry Reding280921d2013-08-30 15:10:14 +020076};
77
Thierry Reding280921d2013-08-30 15:10:14 +020078struct panel_simple {
79 struct drm_panel base;
Ajay Kumar613a6332014-07-31 23:12:10 +053080 bool prepared;
Thierry Reding280921d2013-08-30 15:10:14 +020081 bool enabled;
82
83 const struct panel_desc *desc;
84
85 struct backlight_device *backlight;
86 struct regulator *supply;
87 struct i2c_adapter *ddc;
88
Alexandre Courbotcfdf0542014-03-01 14:00:58 +090089 struct gpio_desc *enable_gpio;
Thierry Reding280921d2013-08-30 15:10:14 +020090};
91
92static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
93{
94 return container_of(panel, struct panel_simple, base);
95}
96
97static int panel_simple_get_fixed_modes(struct panel_simple *panel)
98{
99 struct drm_connector *connector = panel->base.connector;
100 struct drm_device *drm = panel->base.drm;
101 struct drm_display_mode *mode;
102 unsigned int i, num = 0;
103
104 if (!panel->desc)
105 return 0;
106
Philipp Zabela5d3e622014-12-11 18:32:45 +0100107 for (i = 0; i < panel->desc->num_timings; i++) {
108 const struct display_timing *dt = &panel->desc->timings[i];
109 struct videomode vm;
110
111 videomode_from_timing(dt, &vm);
112 mode = drm_mode_create(drm);
113 if (!mode) {
114 dev_err(drm->dev, "failed to add mode %ux%u\n",
115 dt->hactive.typ, dt->vactive.typ);
116 continue;
117 }
118
119 drm_display_mode_from_videomode(&vm, mode);
Boris Brezilloncda55372016-04-15 18:23:33 +0200120
121 mode->type |= DRM_MODE_TYPE_DRIVER;
122
123 if (panel->desc->num_modes == 1)
124 mode->type |= DRM_MODE_TYPE_PREFERRED;
125
Philipp Zabela5d3e622014-12-11 18:32:45 +0100126 drm_mode_probed_add(connector, mode);
127 num++;
128 }
129
Thierry Reding280921d2013-08-30 15:10:14 +0200130 for (i = 0; i < panel->desc->num_modes; i++) {
131 const struct drm_display_mode *m = &panel->desc->modes[i];
132
133 mode = drm_mode_duplicate(drm, m);
134 if (!mode) {
135 dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
136 m->hdisplay, m->vdisplay, m->vrefresh);
137 continue;
138 }
139
Boris Brezilloncda55372016-04-15 18:23:33 +0200140 mode->type |= DRM_MODE_TYPE_DRIVER;
141
142 if (panel->desc->num_modes == 1)
143 mode->type |= DRM_MODE_TYPE_PREFERRED;
144
Thierry Reding280921d2013-08-30 15:10:14 +0200145 drm_mode_set_name(mode);
146
147 drm_mode_probed_add(connector, mode);
148 num++;
149 }
150
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700151 connector->display_info.bpc = panel->desc->bpc;
Thierry Reding280921d2013-08-30 15:10:14 +0200152 connector->display_info.width_mm = panel->desc->size.width;
153 connector->display_info.height_mm = panel->desc->size.height;
Boris Brezillon795f7ab2014-07-22 13:33:59 +0200154 if (panel->desc->bus_format)
155 drm_display_info_set_bus_formats(&connector->display_info,
156 &panel->desc->bus_format, 1);
Stefan Agnerf0aa0832016-02-08 11:38:14 -0800157 connector->display_info.bus_flags = panel->desc->bus_flags;
Thierry Reding280921d2013-08-30 15:10:14 +0200158
159 return num;
160}
161
162static int panel_simple_disable(struct drm_panel *panel)
163{
164 struct panel_simple *p = to_panel_simple(panel);
165
166 if (!p->enabled)
167 return 0;
168
169 if (p->backlight) {
170 p->backlight->props.power = FB_BLANK_POWERDOWN;
171 backlight_update_status(p->backlight);
172 }
173
Ajay Kumarf673c372014-07-31 23:12:11 +0530174 if (p->desc->delay.disable)
175 msleep(p->desc->delay.disable);
176
Thierry Reding280921d2013-08-30 15:10:14 +0200177 p->enabled = false;
178
179 return 0;
180}
181
Ajay Kumarc0e1d172014-07-31 23:12:04 +0530182static int panel_simple_unprepare(struct drm_panel *panel)
183{
Ajay Kumar613a6332014-07-31 23:12:10 +0530184 struct panel_simple *p = to_panel_simple(panel);
185
186 if (!p->prepared)
187 return 0;
188
189 if (p->enable_gpio)
190 gpiod_set_value_cansleep(p->enable_gpio, 0);
191
192 regulator_disable(p->supply);
193
Ajay Kumarf673c372014-07-31 23:12:11 +0530194 if (p->desc->delay.unprepare)
195 msleep(p->desc->delay.unprepare);
196
Ajay Kumar613a6332014-07-31 23:12:10 +0530197 p->prepared = false;
198
Ajay Kumarc0e1d172014-07-31 23:12:04 +0530199 return 0;
200}
201
202static int panel_simple_prepare(struct drm_panel *panel)
203{
Thierry Reding280921d2013-08-30 15:10:14 +0200204 struct panel_simple *p = to_panel_simple(panel);
205 int err;
206
Ajay Kumar613a6332014-07-31 23:12:10 +0530207 if (p->prepared)
Thierry Reding280921d2013-08-30 15:10:14 +0200208 return 0;
209
210 err = regulator_enable(p->supply);
211 if (err < 0) {
212 dev_err(panel->dev, "failed to enable supply: %d\n", err);
213 return err;
214 }
215
Alexandre Courbotcfdf0542014-03-01 14:00:58 +0900216 if (p->enable_gpio)
Thierry Reding15c1a912014-03-14 12:03:47 +0100217 gpiod_set_value_cansleep(p->enable_gpio, 1);
Thierry Reding280921d2013-08-30 15:10:14 +0200218
Ajay Kumarf673c372014-07-31 23:12:11 +0530219 if (p->desc->delay.prepare)
220 msleep(p->desc->delay.prepare);
221
Ajay Kumar613a6332014-07-31 23:12:10 +0530222 p->prepared = true;
223
224 return 0;
225}
226
227static int panel_simple_enable(struct drm_panel *panel)
228{
229 struct panel_simple *p = to_panel_simple(panel);
230
231 if (p->enabled)
232 return 0;
233
Ajay Kumarf673c372014-07-31 23:12:11 +0530234 if (p->desc->delay.enable)
235 msleep(p->desc->delay.enable);
236
Thierry Reding280921d2013-08-30 15:10:14 +0200237 if (p->backlight) {
238 p->backlight->props.power = FB_BLANK_UNBLANK;
239 backlight_update_status(p->backlight);
240 }
241
242 p->enabled = true;
243
244 return 0;
245}
246
247static int panel_simple_get_modes(struct drm_panel *panel)
248{
249 struct panel_simple *p = to_panel_simple(panel);
250 int num = 0;
251
252 /* probe EDID if a DDC bus is available */
253 if (p->ddc) {
254 struct edid *edid = drm_get_edid(panel->connector, p->ddc);
Stephen Warren70bf6872014-01-09 11:37:34 -0700255 drm_mode_connector_update_edid_property(panel->connector, edid);
Thierry Reding280921d2013-08-30 15:10:14 +0200256 if (edid) {
257 num += drm_add_edid_modes(panel->connector, edid);
258 kfree(edid);
259 }
260 }
261
262 /* add hard-coded panel modes */
263 num += panel_simple_get_fixed_modes(p);
264
265 return num;
266}
267
Philipp Zabela5d3e622014-12-11 18:32:45 +0100268static int panel_simple_get_timings(struct drm_panel *panel,
269 unsigned int num_timings,
270 struct display_timing *timings)
271{
272 struct panel_simple *p = to_panel_simple(panel);
273 unsigned int i;
274
275 if (p->desc->num_timings < num_timings)
276 num_timings = p->desc->num_timings;
277
278 if (timings)
279 for (i = 0; i < num_timings; i++)
280 timings[i] = p->desc->timings[i];
281
282 return p->desc->num_timings;
283}
284
Thierry Reding280921d2013-08-30 15:10:14 +0200285static const struct drm_panel_funcs panel_simple_funcs = {
286 .disable = panel_simple_disable,
Ajay Kumarc0e1d172014-07-31 23:12:04 +0530287 .unprepare = panel_simple_unprepare,
288 .prepare = panel_simple_prepare,
Thierry Reding280921d2013-08-30 15:10:14 +0200289 .enable = panel_simple_enable,
290 .get_modes = panel_simple_get_modes,
Philipp Zabela5d3e622014-12-11 18:32:45 +0100291 .get_timings = panel_simple_get_timings,
Thierry Reding280921d2013-08-30 15:10:14 +0200292};
293
294static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
295{
296 struct device_node *backlight, *ddc;
297 struct panel_simple *panel;
Thierry Reding280921d2013-08-30 15:10:14 +0200298 int err;
299
300 panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
301 if (!panel)
302 return -ENOMEM;
303
304 panel->enabled = false;
Ajay Kumar613a6332014-07-31 23:12:10 +0530305 panel->prepared = false;
Thierry Reding280921d2013-08-30 15:10:14 +0200306 panel->desc = desc;
307
308 panel->supply = devm_regulator_get(dev, "power");
309 if (IS_ERR(panel->supply))
310 return PTR_ERR(panel->supply);
311
Alexandre Courbota61400d2014-10-23 17:16:58 +0900312 panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
313 GPIOD_OUT_LOW);
Alexandre Courbotcfdf0542014-03-01 14:00:58 +0900314 if (IS_ERR(panel->enable_gpio)) {
315 err = PTR_ERR(panel->enable_gpio);
Alexandre Courbot9746c612014-07-25 23:47:25 +0900316 dev_err(dev, "failed to request GPIO: %d\n", err);
317 return err;
318 }
Thierry Reding280921d2013-08-30 15:10:14 +0200319
Thierry Reding280921d2013-08-30 15:10:14 +0200320 backlight = of_parse_phandle(dev->of_node, "backlight", 0);
321 if (backlight) {
322 panel->backlight = of_find_backlight_by_node(backlight);
323 of_node_put(backlight);
324
Alexandre Courbotcfdf0542014-03-01 14:00:58 +0900325 if (!panel->backlight)
326 return -EPROBE_DEFER;
Thierry Reding280921d2013-08-30 15:10:14 +0200327 }
328
329 ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
330 if (ddc) {
331 panel->ddc = of_find_i2c_adapter_by_node(ddc);
332 of_node_put(ddc);
333
334 if (!panel->ddc) {
335 err = -EPROBE_DEFER;
336 goto free_backlight;
337 }
338 }
339
340 drm_panel_init(&panel->base);
341 panel->base.dev = dev;
342 panel->base.funcs = &panel_simple_funcs;
343
344 err = drm_panel_add(&panel->base);
345 if (err < 0)
346 goto free_ddc;
347
348 dev_set_drvdata(dev, panel);
349
350 return 0;
351
352free_ddc:
353 if (panel->ddc)
354 put_device(&panel->ddc->dev);
355free_backlight:
356 if (panel->backlight)
357 put_device(&panel->backlight->dev);
Thierry Reding280921d2013-08-30 15:10:14 +0200358
359 return err;
360}
361
362static int panel_simple_remove(struct device *dev)
363{
364 struct panel_simple *panel = dev_get_drvdata(dev);
365
366 drm_panel_detach(&panel->base);
367 drm_panel_remove(&panel->base);
368
369 panel_simple_disable(&panel->base);
370
371 if (panel->ddc)
372 put_device(&panel->ddc->dev);
373
374 if (panel->backlight)
375 put_device(&panel->backlight->dev);
376
Thierry Reding280921d2013-08-30 15:10:14 +0200377 return 0;
378}
379
Thierry Redingd02fd932014-04-29 17:21:21 +0200380static void panel_simple_shutdown(struct device *dev)
381{
382 struct panel_simple *panel = dev_get_drvdata(dev);
383
384 panel_simple_disable(&panel->base);
385}
386
Philipp Zabel1c550fa12015-02-11 18:50:09 +0100387static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
388 .clock = 33333,
389 .hdisplay = 800,
390 .hsync_start = 800 + 0,
391 .hsync_end = 800 + 0 + 255,
392 .htotal = 800 + 0 + 255 + 0,
393 .vdisplay = 480,
394 .vsync_start = 480 + 2,
395 .vsync_end = 480 + 2 + 45,
396 .vtotal = 480 + 2 + 45 + 0,
397 .vrefresh = 60,
398 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
399};
400
401static const struct panel_desc ampire_am800480r3tmqwa1h = {
402 .modes = &ampire_am800480r3tmqwa1h_mode,
403 .num_modes = 1,
404 .bpc = 6,
405 .size = {
406 .width = 152,
407 .height = 91,
408 },
409 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
410};
411
Thierry Reding280921d2013-08-30 15:10:14 +0200412static const struct drm_display_mode auo_b101aw03_mode = {
413 .clock = 51450,
414 .hdisplay = 1024,
415 .hsync_start = 1024 + 156,
416 .hsync_end = 1024 + 156 + 8,
417 .htotal = 1024 + 156 + 8 + 156,
418 .vdisplay = 600,
419 .vsync_start = 600 + 16,
420 .vsync_end = 600 + 16 + 6,
421 .vtotal = 600 + 16 + 6 + 16,
422 .vrefresh = 60,
423};
424
425static const struct panel_desc auo_b101aw03 = {
426 .modes = &auo_b101aw03_mode,
427 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700428 .bpc = 6,
Thierry Reding280921d2013-08-30 15:10:14 +0200429 .size = {
430 .width = 223,
431 .height = 125,
432 },
433};
434
Huang Lina531bc32015-02-28 10:18:58 +0800435static const struct drm_display_mode auo_b101ean01_mode = {
436 .clock = 72500,
437 .hdisplay = 1280,
438 .hsync_start = 1280 + 119,
439 .hsync_end = 1280 + 119 + 32,
440 .htotal = 1280 + 119 + 32 + 21,
441 .vdisplay = 800,
442 .vsync_start = 800 + 4,
443 .vsync_end = 800 + 4 + 20,
444 .vtotal = 800 + 4 + 20 + 8,
445 .vrefresh = 60,
446};
447
448static const struct panel_desc auo_b101ean01 = {
449 .modes = &auo_b101ean01_mode,
450 .num_modes = 1,
451 .bpc = 6,
452 .size = {
453 .width = 217,
454 .height = 136,
455 },
456};
457
Rob Clarkdac746e2014-08-01 17:01:06 -0400458static const struct drm_display_mode auo_b101xtn01_mode = {
459 .clock = 72000,
460 .hdisplay = 1366,
461 .hsync_start = 1366 + 20,
462 .hsync_end = 1366 + 20 + 70,
463 .htotal = 1366 + 20 + 70,
464 .vdisplay = 768,
465 .vsync_start = 768 + 14,
466 .vsync_end = 768 + 14 + 42,
467 .vtotal = 768 + 14 + 42,
468 .vrefresh = 60,
469 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
470};
471
472static const struct panel_desc auo_b101xtn01 = {
473 .modes = &auo_b101xtn01_mode,
474 .num_modes = 1,
475 .bpc = 6,
476 .size = {
477 .width = 223,
478 .height = 125,
479 },
480};
481
Ajay Kumare35e3052014-09-01 15:40:02 +0530482static const struct drm_display_mode auo_b116xw03_mode = {
483 .clock = 70589,
484 .hdisplay = 1366,
485 .hsync_start = 1366 + 40,
486 .hsync_end = 1366 + 40 + 40,
487 .htotal = 1366 + 40 + 40 + 32,
488 .vdisplay = 768,
489 .vsync_start = 768 + 10,
490 .vsync_end = 768 + 10 + 12,
491 .vtotal = 768 + 10 + 12 + 6,
492 .vrefresh = 60,
493};
494
495static const struct panel_desc auo_b116xw03 = {
496 .modes = &auo_b116xw03_mode,
497 .num_modes = 1,
498 .bpc = 6,
499 .size = {
500 .width = 256,
501 .height = 144,
502 },
503};
504
Stéphane Marchesina333f7a2014-05-23 19:27:59 -0700505static const struct drm_display_mode auo_b133xtn01_mode = {
506 .clock = 69500,
507 .hdisplay = 1366,
508 .hsync_start = 1366 + 48,
509 .hsync_end = 1366 + 48 + 32,
510 .htotal = 1366 + 48 + 32 + 20,
511 .vdisplay = 768,
512 .vsync_start = 768 + 3,
513 .vsync_end = 768 + 3 + 6,
514 .vtotal = 768 + 3 + 6 + 13,
515 .vrefresh = 60,
516};
517
518static const struct panel_desc auo_b133xtn01 = {
519 .modes = &auo_b133xtn01_mode,
520 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700521 .bpc = 6,
Stéphane Marchesina333f7a2014-05-23 19:27:59 -0700522 .size = {
523 .width = 293,
524 .height = 165,
525 },
526};
527
Ajay Kumar3e51d602014-07-31 23:12:12 +0530528static const struct drm_display_mode auo_b133htn01_mode = {
529 .clock = 150660,
530 .hdisplay = 1920,
531 .hsync_start = 1920 + 172,
532 .hsync_end = 1920 + 172 + 80,
533 .htotal = 1920 + 172 + 80 + 60,
534 .vdisplay = 1080,
535 .vsync_start = 1080 + 25,
536 .vsync_end = 1080 + 25 + 10,
537 .vtotal = 1080 + 25 + 10 + 10,
538 .vrefresh = 60,
539};
540
541static const struct panel_desc auo_b133htn01 = {
542 .modes = &auo_b133htn01_mode,
543 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +0100544 .bpc = 6,
Ajay Kumar3e51d602014-07-31 23:12:12 +0530545 .size = {
546 .width = 293,
547 .height = 165,
548 },
549 .delay = {
550 .prepare = 105,
551 .enable = 20,
552 .unprepare = 50,
553 },
554};
555
Philipp Zabeld47df632014-12-18 16:43:43 +0100556static const struct drm_display_mode avic_tm070ddh03_mode = {
557 .clock = 51200,
558 .hdisplay = 1024,
559 .hsync_start = 1024 + 160,
560 .hsync_end = 1024 + 160 + 4,
561 .htotal = 1024 + 160 + 4 + 156,
562 .vdisplay = 600,
563 .vsync_start = 600 + 17,
564 .vsync_end = 600 + 17 + 1,
565 .vtotal = 600 + 17 + 1 + 17,
566 .vrefresh = 60,
567};
568
569static const struct panel_desc avic_tm070ddh03 = {
570 .modes = &avic_tm070ddh03_mode,
571 .num_modes = 1,
572 .bpc = 8,
573 .size = {
574 .width = 154,
575 .height = 90,
576 },
577 .delay = {
578 .prepare = 20,
579 .enable = 200,
580 .disable = 200,
581 },
582};
583
Stephen Warren4c930752014-01-07 16:46:26 -0700584static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
585 .clock = 72070,
586 .hdisplay = 1366,
587 .hsync_start = 1366 + 58,
588 .hsync_end = 1366 + 58 + 58,
589 .htotal = 1366 + 58 + 58 + 58,
590 .vdisplay = 768,
591 .vsync_start = 768 + 4,
592 .vsync_end = 768 + 4 + 4,
593 .vtotal = 768 + 4 + 4 + 4,
594 .vrefresh = 60,
595};
596
597static const struct panel_desc chunghwa_claa101wa01a = {
598 .modes = &chunghwa_claa101wa01a_mode,
599 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700600 .bpc = 6,
Stephen Warren4c930752014-01-07 16:46:26 -0700601 .size = {
602 .width = 220,
603 .height = 120,
604 },
605};
606
Thierry Reding280921d2013-08-30 15:10:14 +0200607static const struct drm_display_mode chunghwa_claa101wb01_mode = {
608 .clock = 69300,
609 .hdisplay = 1366,
610 .hsync_start = 1366 + 48,
611 .hsync_end = 1366 + 48 + 32,
612 .htotal = 1366 + 48 + 32 + 20,
613 .vdisplay = 768,
614 .vsync_start = 768 + 16,
615 .vsync_end = 768 + 16 + 8,
616 .vtotal = 768 + 16 + 8 + 16,
617 .vrefresh = 60,
618};
619
620static const struct panel_desc chunghwa_claa101wb01 = {
621 .modes = &chunghwa_claa101wb01_mode,
622 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700623 .bpc = 6,
Thierry Reding280921d2013-08-30 15:10:14 +0200624 .size = {
625 .width = 223,
626 .height = 125,
627 },
628};
629
Stefan Agner26ab0062014-05-15 11:38:45 +0200630static const struct drm_display_mode edt_et057090dhu_mode = {
631 .clock = 25175,
632 .hdisplay = 640,
633 .hsync_start = 640 + 16,
634 .hsync_end = 640 + 16 + 30,
635 .htotal = 640 + 16 + 30 + 114,
636 .vdisplay = 480,
637 .vsync_start = 480 + 10,
638 .vsync_end = 480 + 10 + 3,
639 .vtotal = 480 + 10 + 3 + 32,
640 .vrefresh = 60,
641 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
642};
643
644static const struct panel_desc edt_et057090dhu = {
645 .modes = &edt_et057090dhu_mode,
646 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700647 .bpc = 6,
Stefan Agner26ab0062014-05-15 11:38:45 +0200648 .size = {
649 .width = 115,
650 .height = 86,
651 },
652};
653
Philipp Zabelfff5de42014-05-15 12:25:47 +0200654static const struct drm_display_mode edt_etm0700g0dh6_mode = {
655 .clock = 33260,
656 .hdisplay = 800,
657 .hsync_start = 800 + 40,
658 .hsync_end = 800 + 40 + 128,
659 .htotal = 800 + 40 + 128 + 88,
660 .vdisplay = 480,
661 .vsync_start = 480 + 10,
662 .vsync_end = 480 + 10 + 2,
663 .vtotal = 480 + 10 + 2 + 33,
664 .vrefresh = 60,
665 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
666};
667
668static const struct panel_desc edt_etm0700g0dh6 = {
669 .modes = &edt_etm0700g0dh6_mode,
670 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700671 .bpc = 6,
Philipp Zabelfff5de42014-05-15 12:25:47 +0200672 .size = {
673 .width = 152,
674 .height = 91,
675 },
676};
677
Boris BREZILLON102932b2014-06-05 15:53:32 +0200678static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
679 .clock = 32260,
680 .hdisplay = 800,
681 .hsync_start = 800 + 168,
682 .hsync_end = 800 + 168 + 64,
683 .htotal = 800 + 168 + 64 + 88,
684 .vdisplay = 480,
685 .vsync_start = 480 + 37,
686 .vsync_end = 480 + 37 + 2,
687 .vtotal = 480 + 37 + 2 + 8,
688 .vrefresh = 60,
689};
690
691static const struct panel_desc foxlink_fl500wvr00_a0t = {
692 .modes = &foxlink_fl500wvr00_a0t_mode,
693 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +0100694 .bpc = 8,
Boris BREZILLON102932b2014-06-05 15:53:32 +0200695 .size = {
696 .width = 108,
697 .height = 65,
698 },
Boris Brezillonbb276cb2014-07-22 13:35:47 +0200699 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
Boris BREZILLON102932b2014-06-05 15:53:32 +0200700};
701
Philipp Zabeld435a2a2014-11-19 10:29:55 +0100702static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
703 .clock = 9000,
704 .hdisplay = 480,
705 .hsync_start = 480 + 5,
706 .hsync_end = 480 + 5 + 1,
707 .htotal = 480 + 5 + 1 + 40,
708 .vdisplay = 272,
709 .vsync_start = 272 + 8,
710 .vsync_end = 272 + 8 + 1,
711 .vtotal = 272 + 8 + 1 + 8,
712 .vrefresh = 60,
713};
714
715static const struct panel_desc giantplus_gpg482739qs5 = {
716 .modes = &giantplus_gpg482739qs5_mode,
717 .num_modes = 1,
718 .bpc = 8,
719 .size = {
720 .width = 95,
721 .height = 54,
722 },
Philipp Zabel33536a02015-02-11 18:50:07 +0100723 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
Philipp Zabeld435a2a2014-11-19 10:29:55 +0100724};
725
Philipp Zabelab077252014-12-11 18:32:46 +0100726static const struct display_timing hannstar_hsd070pww1_timing = {
727 .pixelclock = { 64300000, 71100000, 82000000 },
728 .hactive = { 1280, 1280, 1280 },
729 .hfront_porch = { 1, 1, 10 },
730 .hback_porch = { 1, 1, 10 },
Philipp Zabeld901d2b2015-08-12 12:32:13 +0200731 /*
732 * According to the data sheet, the minimum horizontal blanking interval
733 * is 54 clocks (1 + 52 + 1), but tests with a Nitrogen6X have shown the
734 * minimum working horizontal blanking interval to be 60 clocks.
735 */
736 .hsync_len = { 58, 158, 661 },
Philipp Zabelab077252014-12-11 18:32:46 +0100737 .vactive = { 800, 800, 800 },
738 .vfront_porch = { 1, 1, 10 },
739 .vback_porch = { 1, 1, 10 },
740 .vsync_len = { 1, 21, 203 },
741 .flags = DISPLAY_FLAGS_DE_HIGH,
Philipp Zabela8532052014-10-23 16:31:06 +0200742};
743
744static const struct panel_desc hannstar_hsd070pww1 = {
Philipp Zabelab077252014-12-11 18:32:46 +0100745 .timings = &hannstar_hsd070pww1_timing,
746 .num_timings = 1,
Philipp Zabela8532052014-10-23 16:31:06 +0200747 .bpc = 6,
748 .size = {
749 .width = 151,
750 .height = 94,
751 },
Philipp Zabel58d6a7b2015-08-12 12:32:12 +0200752 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
Philipp Zabela8532052014-10-23 16:31:06 +0200753};
754
Eric Nelsonc0d607e2015-04-13 15:09:26 -0700755static const struct display_timing hannstar_hsd100pxn1_timing = {
756 .pixelclock = { 55000000, 65000000, 75000000 },
757 .hactive = { 1024, 1024, 1024 },
758 .hfront_porch = { 40, 40, 40 },
759 .hback_porch = { 220, 220, 220 },
760 .hsync_len = { 20, 60, 100 },
761 .vactive = { 768, 768, 768 },
762 .vfront_porch = { 7, 7, 7 },
763 .vback_porch = { 21, 21, 21 },
764 .vsync_len = { 10, 10, 10 },
765 .flags = DISPLAY_FLAGS_DE_HIGH,
766};
767
768static const struct panel_desc hannstar_hsd100pxn1 = {
769 .timings = &hannstar_hsd100pxn1_timing,
770 .num_timings = 1,
771 .bpc = 6,
772 .size = {
773 .width = 203,
774 .height = 152,
775 },
Philipp Zabel4946b042015-05-20 11:34:08 +0200776 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
Eric Nelsonc0d607e2015-04-13 15:09:26 -0700777};
778
Lucas Stach61ac0bf2014-11-06 17:44:35 +0100779static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
780 .clock = 33333,
781 .hdisplay = 800,
782 .hsync_start = 800 + 85,
783 .hsync_end = 800 + 85 + 86,
784 .htotal = 800 + 85 + 86 + 85,
785 .vdisplay = 480,
786 .vsync_start = 480 + 16,
787 .vsync_end = 480 + 16 + 13,
788 .vtotal = 480 + 16 + 13 + 16,
789 .vrefresh = 60,
790};
791
792static const struct panel_desc hitachi_tx23d38vm0caa = {
793 .modes = &hitachi_tx23d38vm0caa_mode,
794 .num_modes = 1,
795 .bpc = 6,
796 .size = {
797 .width = 195,
798 .height = 117,
799 },
800};
801
Nicolas Ferre41bcceb2015-03-19 14:43:01 +0100802static const struct drm_display_mode innolux_at043tn24_mode = {
803 .clock = 9000,
804 .hdisplay = 480,
805 .hsync_start = 480 + 2,
806 .hsync_end = 480 + 2 + 41,
807 .htotal = 480 + 2 + 41 + 2,
808 .vdisplay = 272,
809 .vsync_start = 272 + 2,
810 .vsync_end = 272 + 2 + 11,
811 .vtotal = 272 + 2 + 11 + 2,
812 .vrefresh = 60,
813 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
814};
815
816static const struct panel_desc innolux_at043tn24 = {
817 .modes = &innolux_at043tn24_mode,
818 .num_modes = 1,
819 .bpc = 8,
820 .size = {
821 .width = 95,
822 .height = 54,
823 },
824 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
825};
826
Riccardo Bortolato4fc24ab2016-04-20 15:37:15 +0200827static const struct drm_display_mode innolux_at070tn92_mode = {
828 .clock = 33333,
829 .hdisplay = 800,
830 .hsync_start = 800 + 210,
831 .hsync_end = 800 + 210 + 20,
832 .htotal = 800 + 210 + 20 + 46,
833 .vdisplay = 480,
834 .vsync_start = 480 + 22,
835 .vsync_end = 480 + 22 + 10,
836 .vtotal = 480 + 22 + 23 + 10,
837 .vrefresh = 60,
838};
839
840static const struct panel_desc innolux_at070tn92 = {
841 .modes = &innolux_at070tn92_mode,
842 .num_modes = 1,
843 .size = {
844 .width = 154,
845 .height = 86,
846 },
847 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
848};
849
Lucas Stachd731f662014-11-06 17:44:33 +0100850static const struct drm_display_mode innolux_g121i1_l01_mode = {
Thierry Reding0a2288c2014-07-03 14:02:59 +0200851 .clock = 71000,
Lucas Stachd731f662014-11-06 17:44:33 +0100852 .hdisplay = 1280,
853 .hsync_start = 1280 + 64,
854 .hsync_end = 1280 + 64 + 32,
855 .htotal = 1280 + 64 + 32 + 64,
856 .vdisplay = 800,
857 .vsync_start = 800 + 9,
858 .vsync_end = 800 + 9 + 6,
859 .vtotal = 800 + 9 + 6 + 9,
860 .vrefresh = 60,
861};
862
863static const struct panel_desc innolux_g121i1_l01 = {
864 .modes = &innolux_g121i1_l01_mode,
865 .num_modes = 1,
866 .bpc = 6,
867 .size = {
868 .width = 261,
869 .height = 163,
870 },
871};
872
Akshay Bhatf8fa17b2015-11-18 15:57:47 -0500873static const struct drm_display_mode innolux_g121x1_l03_mode = {
874 .clock = 65000,
875 .hdisplay = 1024,
876 .hsync_start = 1024 + 0,
877 .hsync_end = 1024 + 1,
878 .htotal = 1024 + 0 + 1 + 320,
879 .vdisplay = 768,
880 .vsync_start = 768 + 38,
881 .vsync_end = 768 + 38 + 1,
882 .vtotal = 768 + 38 + 1 + 0,
883 .vrefresh = 60,
Akshay Bhat2e8c5eb2016-03-01 18:06:54 -0500884 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
Akshay Bhatf8fa17b2015-11-18 15:57:47 -0500885};
886
887static const struct panel_desc innolux_g121x1_l03 = {
888 .modes = &innolux_g121x1_l03_mode,
889 .num_modes = 1,
890 .bpc = 6,
891 .size = {
892 .width = 246,
893 .height = 185,
894 },
895 .delay = {
896 .enable = 200,
897 .unprepare = 200,
898 .disable = 400,
899 },
900};
901
Thierry Reding0a2288c2014-07-03 14:02:59 +0200902static const struct drm_display_mode innolux_n116bge_mode = {
Daniel Kurtz7fe8c772014-09-02 10:56:46 +0800903 .clock = 76420,
Thierry Reding0a2288c2014-07-03 14:02:59 +0200904 .hdisplay = 1366,
Daniel Kurtz7fe8c772014-09-02 10:56:46 +0800905 .hsync_start = 1366 + 136,
906 .hsync_end = 1366 + 136 + 30,
907 .htotal = 1366 + 136 + 30 + 60,
Thierry Reding0a2288c2014-07-03 14:02:59 +0200908 .vdisplay = 768,
909 .vsync_start = 768 + 8,
Daniel Kurtz7fe8c772014-09-02 10:56:46 +0800910 .vsync_end = 768 + 8 + 12,
911 .vtotal = 768 + 8 + 12 + 12,
Thierry Reding0a2288c2014-07-03 14:02:59 +0200912 .vrefresh = 60,
913 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
914};
915
916static const struct panel_desc innolux_n116bge = {
917 .modes = &innolux_n116bge_mode,
918 .num_modes = 1,
919 .bpc = 6,
920 .size = {
921 .width = 256,
922 .height = 144,
923 },
924};
925
Alban Bedelea447392014-07-22 08:38:55 +0200926static const struct drm_display_mode innolux_n156bge_l21_mode = {
927 .clock = 69300,
928 .hdisplay = 1366,
929 .hsync_start = 1366 + 16,
930 .hsync_end = 1366 + 16 + 34,
931 .htotal = 1366 + 16 + 34 + 50,
932 .vdisplay = 768,
933 .vsync_start = 768 + 2,
934 .vsync_end = 768 + 2 + 6,
935 .vtotal = 768 + 2 + 6 + 12,
936 .vrefresh = 60,
937};
938
939static const struct panel_desc innolux_n156bge_l21 = {
940 .modes = &innolux_n156bge_l21_mode,
941 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700942 .bpc = 6,
Alban Bedelea447392014-07-22 08:38:55 +0200943 .size = {
944 .width = 344,
945 .height = 193,
946 },
947};
948
Michael Grzeschikbccac3f2015-03-19 12:22:44 +0100949static const struct drm_display_mode innolux_zj070na_01p_mode = {
950 .clock = 51501,
951 .hdisplay = 1024,
952 .hsync_start = 1024 + 128,
953 .hsync_end = 1024 + 128 + 64,
954 .htotal = 1024 + 128 + 64 + 128,
955 .vdisplay = 600,
956 .vsync_start = 600 + 16,
957 .vsync_end = 600 + 16 + 4,
958 .vtotal = 600 + 16 + 4 + 16,
959 .vrefresh = 60,
960};
961
962static const struct panel_desc innolux_zj070na_01p = {
963 .modes = &innolux_zj070na_01p_mode,
964 .num_modes = 1,
965 .bpc = 6,
966 .size = {
967 .width = 1024,
968 .height = 600,
969 },
970};
971
Lucas Stach8def22e2015-12-02 19:41:11 +0100972static const struct display_timing kyo_tcg121xglp_timing = {
973 .pixelclock = { 52000000, 65000000, 71000000 },
974 .hactive = { 1024, 1024, 1024 },
975 .hfront_porch = { 2, 2, 2 },
976 .hback_porch = { 2, 2, 2 },
977 .hsync_len = { 86, 124, 244 },
978 .vactive = { 768, 768, 768 },
979 .vfront_porch = { 2, 2, 2 },
980 .vback_porch = { 2, 2, 2 },
981 .vsync_len = { 6, 34, 73 },
982 .flags = DISPLAY_FLAGS_DE_HIGH,
983};
984
985static const struct panel_desc kyo_tcg121xglp = {
986 .timings = &kyo_tcg121xglp_timing,
987 .num_timings = 1,
988 .bpc = 8,
989 .size = {
990 .width = 246,
991 .height = 184,
992 },
993 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
994};
995
Heiko Schocherdd015002015-05-22 10:25:57 +0200996static const struct drm_display_mode lg_lb070wv8_mode = {
997 .clock = 33246,
998 .hdisplay = 800,
999 .hsync_start = 800 + 88,
1000 .hsync_end = 800 + 88 + 80,
1001 .htotal = 800 + 88 + 80 + 88,
1002 .vdisplay = 480,
1003 .vsync_start = 480 + 10,
1004 .vsync_end = 480 + 10 + 25,
1005 .vtotal = 480 + 10 + 25 + 10,
1006 .vrefresh = 60,
1007};
1008
1009static const struct panel_desc lg_lb070wv8 = {
1010 .modes = &lg_lb070wv8_mode,
1011 .num_modes = 1,
1012 .bpc = 16,
1013 .size = {
1014 .width = 151,
1015 .height = 91,
1016 },
1017 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1018};
1019
Jitao Shi690d8fa2016-02-22 19:01:44 +08001020static const struct drm_display_mode lg_lp120up1_mode = {
1021 .clock = 162300,
1022 .hdisplay = 1920,
1023 .hsync_start = 1920 + 40,
1024 .hsync_end = 1920 + 40 + 40,
1025 .htotal = 1920 + 40 + 40+ 80,
1026 .vdisplay = 1280,
1027 .vsync_start = 1280 + 4,
1028 .vsync_end = 1280 + 4 + 4,
1029 .vtotal = 1280 + 4 + 4 + 12,
1030 .vrefresh = 60,
1031};
1032
1033static const struct panel_desc lg_lp120up1 = {
1034 .modes = &lg_lp120up1_mode,
1035 .num_modes = 1,
1036 .bpc = 8,
1037 .size = {
1038 .width = 267,
1039 .height = 183,
1040 },
1041};
1042
Thierry Redingec7c5652013-11-15 15:59:32 +01001043static const struct drm_display_mode lg_lp129qe_mode = {
1044 .clock = 285250,
1045 .hdisplay = 2560,
1046 .hsync_start = 2560 + 48,
1047 .hsync_end = 2560 + 48 + 32,
1048 .htotal = 2560 + 48 + 32 + 80,
1049 .vdisplay = 1700,
1050 .vsync_start = 1700 + 3,
1051 .vsync_end = 1700 + 3 + 10,
1052 .vtotal = 1700 + 3 + 10 + 36,
1053 .vrefresh = 60,
1054};
1055
1056static const struct panel_desc lg_lp129qe = {
1057 .modes = &lg_lp129qe_mode,
1058 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -07001059 .bpc = 8,
Thierry Redingec7c5652013-11-15 15:59:32 +01001060 .size = {
1061 .width = 272,
1062 .height = 181,
1063 },
1064};
1065
jianwei wangc6e87f92015-07-29 16:30:02 +08001066static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
1067 .clock = 10870,
1068 .hdisplay = 480,
1069 .hsync_start = 480 + 2,
1070 .hsync_end = 480 + 2 + 41,
1071 .htotal = 480 + 2 + 41 + 2,
1072 .vdisplay = 272,
1073 .vsync_start = 272 + 2,
1074 .vsync_end = 272 + 2 + 4,
1075 .vtotal = 272 + 2 + 4 + 2,
1076 .vrefresh = 74,
Stefan Agner4bc390c2015-11-17 19:10:29 -08001077 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
jianwei wangc6e87f92015-07-29 16:30:02 +08001078};
1079
1080static const struct panel_desc nec_nl4827hc19_05b = {
1081 .modes = &nec_nl4827hc19_05b_mode,
1082 .num_modes = 1,
1083 .bpc = 8,
1084 .size = {
1085 .width = 95,
1086 .height = 54,
1087 },
Stefan Agner2c806612016-02-08 12:50:13 -08001088 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1089 .bus_flags = DRM_BUS_FLAG_PIXDATA_POSEDGE,
jianwei wangc6e87f92015-07-29 16:30:02 +08001090};
1091
Gary Bissona99fb622015-06-10 18:44:23 +02001092static const struct display_timing okaya_rs800480t_7x0gp_timing = {
1093 .pixelclock = { 30000000, 30000000, 40000000 },
1094 .hactive = { 800, 800, 800 },
1095 .hfront_porch = { 40, 40, 40 },
1096 .hback_porch = { 40, 40, 40 },
1097 .hsync_len = { 1, 48, 48 },
1098 .vactive = { 480, 480, 480 },
1099 .vfront_porch = { 13, 13, 13 },
1100 .vback_porch = { 29, 29, 29 },
1101 .vsync_len = { 3, 3, 3 },
1102 .flags = DISPLAY_FLAGS_DE_HIGH,
1103};
1104
1105static const struct panel_desc okaya_rs800480t_7x0gp = {
1106 .timings = &okaya_rs800480t_7x0gp_timing,
1107 .num_timings = 1,
1108 .bpc = 6,
1109 .size = {
1110 .width = 154,
1111 .height = 87,
1112 },
1113 .delay = {
1114 .prepare = 41,
1115 .enable = 50,
1116 .unprepare = 41,
1117 .disable = 50,
1118 },
1119 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1120};
1121
Maxime Ripardcf5c9e62016-03-23 17:38:34 +01001122static const struct drm_display_mode olimex_lcd_olinuxino_43ts_mode = {
1123 .clock = 9000,
1124 .hdisplay = 480,
1125 .hsync_start = 480 + 5,
1126 .hsync_end = 480 + 5 + 30,
1127 .htotal = 480 + 5 + 30 + 10,
1128 .vdisplay = 272,
1129 .vsync_start = 272 + 8,
1130 .vsync_end = 272 + 8 + 5,
1131 .vtotal = 272 + 8 + 5 + 3,
1132 .vrefresh = 60,
1133};
1134
1135static const struct panel_desc olimex_lcd_olinuxino_43ts = {
1136 .modes = &olimex_lcd_olinuxino_43ts_mode,
1137 .num_modes = 1,
1138 .size = {
1139 .width = 105,
1140 .height = 67,
1141 },
1142 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1143};
1144
Eric Anholte8b6f562016-03-24 17:23:48 -07001145/*
1146 * 800x480 CVT. The panel appears to be quite accepting, at least as far as
1147 * pixel clocks, but this is the timing that was being used in the Adafruit
1148 * installation instructions.
1149 */
1150static const struct drm_display_mode ontat_yx700wv03_mode = {
1151 .clock = 29500,
1152 .hdisplay = 800,
1153 .hsync_start = 824,
1154 .hsync_end = 896,
1155 .htotal = 992,
1156 .vdisplay = 480,
1157 .vsync_start = 483,
1158 .vsync_end = 493,
1159 .vtotal = 500,
1160 .vrefresh = 60,
1161 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1162};
1163
1164/*
1165 * Specification at:
1166 * https://www.adafruit.com/images/product-files/2406/c3163.pdf
1167 */
1168static const struct panel_desc ontat_yx700wv03 = {
1169 .modes = &ontat_yx700wv03_mode,
1170 .num_modes = 1,
1171 .bpc = 8,
1172 .size = {
1173 .width = 154,
1174 .height = 83,
1175 },
1176 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1177};
1178
Philipp Zabel725c9d42015-02-11 18:50:11 +01001179static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
1180 .clock = 25000,
1181 .hdisplay = 480,
1182 .hsync_start = 480 + 10,
1183 .hsync_end = 480 + 10 + 10,
1184 .htotal = 480 + 10 + 10 + 15,
1185 .vdisplay = 800,
1186 .vsync_start = 800 + 3,
1187 .vsync_end = 800 + 3 + 3,
1188 .vtotal = 800 + 3 + 3 + 3,
1189 .vrefresh = 60,
1190};
1191
1192static const struct panel_desc ortustech_com43h4m85ulc = {
1193 .modes = &ortustech_com43h4m85ulc_mode,
1194 .num_modes = 1,
1195 .bpc = 8,
1196 .size = {
1197 .width = 56,
1198 .height = 93,
1199 },
1200 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1201};
1202
Josh Wud2a6f0f2015-10-08 17:42:41 +02001203static const struct drm_display_mode qd43003c0_40_mode = {
1204 .clock = 9000,
1205 .hdisplay = 480,
1206 .hsync_start = 480 + 8,
1207 .hsync_end = 480 + 8 + 4,
1208 .htotal = 480 + 8 + 4 + 39,
1209 .vdisplay = 272,
1210 .vsync_start = 272 + 4,
1211 .vsync_end = 272 + 4 + 10,
1212 .vtotal = 272 + 4 + 10 + 2,
1213 .vrefresh = 60,
1214};
1215
1216static const struct panel_desc qd43003c0_40 = {
1217 .modes = &qd43003c0_40_mode,
1218 .num_modes = 1,
1219 .bpc = 8,
1220 .size = {
1221 .width = 95,
1222 .height = 53,
1223 },
1224 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1225};
1226
Marc Dietrich6d54e3d2013-12-21 21:38:12 +01001227static const struct drm_display_mode samsung_ltn101nt05_mode = {
1228 .clock = 54030,
1229 .hdisplay = 1024,
1230 .hsync_start = 1024 + 24,
1231 .hsync_end = 1024 + 24 + 136,
1232 .htotal = 1024 + 24 + 136 + 160,
1233 .vdisplay = 600,
1234 .vsync_start = 600 + 3,
1235 .vsync_end = 600 + 3 + 6,
1236 .vtotal = 600 + 3 + 6 + 61,
1237 .vrefresh = 60,
1238};
1239
1240static const struct panel_desc samsung_ltn101nt05 = {
1241 .modes = &samsung_ltn101nt05_mode,
1242 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -07001243 .bpc = 6,
Marc Dietrich6d54e3d2013-12-21 21:38:12 +01001244 .size = {
1245 .width = 1024,
1246 .height = 600,
1247 },
1248};
1249
Stéphane Marchesin0c934302015-03-18 10:52:18 +01001250static const struct drm_display_mode samsung_ltn140at29_301_mode = {
1251 .clock = 76300,
1252 .hdisplay = 1366,
1253 .hsync_start = 1366 + 64,
1254 .hsync_end = 1366 + 64 + 48,
1255 .htotal = 1366 + 64 + 48 + 128,
1256 .vdisplay = 768,
1257 .vsync_start = 768 + 2,
1258 .vsync_end = 768 + 2 + 5,
1259 .vtotal = 768 + 2 + 5 + 17,
1260 .vrefresh = 60,
1261};
1262
1263static const struct panel_desc samsung_ltn140at29_301 = {
1264 .modes = &samsung_ltn140at29_301_mode,
1265 .num_modes = 1,
1266 .bpc = 6,
1267 .size = {
1268 .width = 320,
1269 .height = 187,
1270 },
1271};
1272
Boris BREZILLON9c6615b2015-03-19 14:43:00 +01001273static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
1274 .clock = 33300,
1275 .hdisplay = 800,
1276 .hsync_start = 800 + 1,
1277 .hsync_end = 800 + 1 + 64,
1278 .htotal = 800 + 1 + 64 + 64,
1279 .vdisplay = 480,
1280 .vsync_start = 480 + 1,
1281 .vsync_end = 480 + 1 + 23,
1282 .vtotal = 480 + 1 + 23 + 22,
1283 .vrefresh = 60,
1284};
1285
1286static const struct panel_desc shelly_sca07010_bfn_lnn = {
1287 .modes = &shelly_sca07010_bfn_lnn_mode,
1288 .num_modes = 1,
1289 .size = {
1290 .width = 152,
1291 .height = 91,
1292 },
1293 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1294};
1295
Maciej S. Szmigiero06a9dc62016-02-13 22:52:03 +01001296static const struct display_timing urt_umsh_8596md_timing = {
1297 .pixelclock = { 33260000, 33260000, 33260000 },
1298 .hactive = { 800, 800, 800 },
1299 .hfront_porch = { 41, 41, 41 },
1300 .hback_porch = { 216 - 128, 216 - 128, 216 - 128 },
1301 .hsync_len = { 71, 128, 128 },
1302 .vactive = { 480, 480, 480 },
1303 .vfront_porch = { 10, 10, 10 },
1304 .vback_porch = { 35 - 2, 35 - 2, 35 - 2 },
1305 .vsync_len = { 2, 2, 2 },
1306 .flags = DISPLAY_FLAGS_DE_HIGH | DISPLAY_FLAGS_PIXDATA_NEGEDGE |
1307 DISPLAY_FLAGS_HSYNC_LOW | DISPLAY_FLAGS_VSYNC_LOW,
1308};
1309
1310static const struct panel_desc urt_umsh_8596md_lvds = {
1311 .timings = &urt_umsh_8596md_timing,
1312 .num_timings = 1,
1313 .bpc = 6,
1314 .size = {
1315 .width = 152,
1316 .height = 91,
1317 },
1318 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
1319};
1320
1321static const struct panel_desc urt_umsh_8596md_parallel = {
1322 .timings = &urt_umsh_8596md_timing,
1323 .num_timings = 1,
1324 .bpc = 6,
1325 .size = {
1326 .width = 152,
1327 .height = 91,
1328 },
1329 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1330};
1331
Thierry Reding280921d2013-08-30 15:10:14 +02001332static const struct of_device_id platform_of_match[] = {
1333 {
Philipp Zabel1c550fa12015-02-11 18:50:09 +01001334 .compatible = "ampire,am800480r3tmqwa1h",
1335 .data = &ampire_am800480r3tmqwa1h,
1336 }, {
Thierry Reding280921d2013-08-30 15:10:14 +02001337 .compatible = "auo,b101aw03",
1338 .data = &auo_b101aw03,
1339 }, {
Huang Lina531bc32015-02-28 10:18:58 +08001340 .compatible = "auo,b101ean01",
1341 .data = &auo_b101ean01,
1342 }, {
Rob Clarkdac746e2014-08-01 17:01:06 -04001343 .compatible = "auo,b101xtn01",
1344 .data = &auo_b101xtn01,
1345 }, {
Ajay Kumare35e3052014-09-01 15:40:02 +05301346 .compatible = "auo,b116xw03",
1347 .data = &auo_b116xw03,
1348 }, {
Ajay Kumar3e51d602014-07-31 23:12:12 +05301349 .compatible = "auo,b133htn01",
1350 .data = &auo_b133htn01,
1351 }, {
Stéphane Marchesina333f7a2014-05-23 19:27:59 -07001352 .compatible = "auo,b133xtn01",
1353 .data = &auo_b133xtn01,
1354 }, {
Philipp Zabeld47df632014-12-18 16:43:43 +01001355 .compatible = "avic,tm070ddh03",
1356 .data = &avic_tm070ddh03,
1357 }, {
Stephen Warren4c930752014-01-07 16:46:26 -07001358 .compatible = "chunghwa,claa101wa01a",
1359 .data = &chunghwa_claa101wa01a
1360 }, {
Thierry Reding280921d2013-08-30 15:10:14 +02001361 .compatible = "chunghwa,claa101wb01",
1362 .data = &chunghwa_claa101wb01
1363 }, {
Stefan Agner26ab0062014-05-15 11:38:45 +02001364 .compatible = "edt,et057090dhu",
1365 .data = &edt_et057090dhu,
1366 }, {
Philipp Zabelfff5de42014-05-15 12:25:47 +02001367 .compatible = "edt,et070080dh6",
1368 .data = &edt_etm0700g0dh6,
1369 }, {
1370 .compatible = "edt,etm0700g0dh6",
1371 .data = &edt_etm0700g0dh6,
1372 }, {
Boris BREZILLON102932b2014-06-05 15:53:32 +02001373 .compatible = "foxlink,fl500wvr00-a0t",
1374 .data = &foxlink_fl500wvr00_a0t,
1375 }, {
Philipp Zabeld435a2a2014-11-19 10:29:55 +01001376 .compatible = "giantplus,gpg482739qs5",
1377 .data = &giantplus_gpg482739qs5
1378 }, {
Philipp Zabela8532052014-10-23 16:31:06 +02001379 .compatible = "hannstar,hsd070pww1",
1380 .data = &hannstar_hsd070pww1,
1381 }, {
Eric Nelsonc0d607e2015-04-13 15:09:26 -07001382 .compatible = "hannstar,hsd100pxn1",
1383 .data = &hannstar_hsd100pxn1,
1384 }, {
Lucas Stach61ac0bf2014-11-06 17:44:35 +01001385 .compatible = "hit,tx23d38vm0caa",
1386 .data = &hitachi_tx23d38vm0caa
1387 }, {
Nicolas Ferre41bcceb2015-03-19 14:43:01 +01001388 .compatible = "innolux,at043tn24",
1389 .data = &innolux_at043tn24,
1390 }, {
Riccardo Bortolato4fc24ab2016-04-20 15:37:15 +02001391 .compatible = "innolux,at070tn92",
1392 .data = &innolux_at070tn92,
1393 }, {
Lucas Stachd731f662014-11-06 17:44:33 +01001394 .compatible ="innolux,g121i1-l01",
1395 .data = &innolux_g121i1_l01
1396 }, {
Akshay Bhatf8fa17b2015-11-18 15:57:47 -05001397 .compatible = "innolux,g121x1-l03",
1398 .data = &innolux_g121x1_l03,
1399 }, {
Thierry Reding0a2288c2014-07-03 14:02:59 +02001400 .compatible = "innolux,n116bge",
1401 .data = &innolux_n116bge,
1402 }, {
Alban Bedelea447392014-07-22 08:38:55 +02001403 .compatible = "innolux,n156bge-l21",
1404 .data = &innolux_n156bge_l21,
1405 }, {
Michael Grzeschikbccac3f2015-03-19 12:22:44 +01001406 .compatible = "innolux,zj070na-01p",
1407 .data = &innolux_zj070na_01p,
1408 }, {
Lucas Stach8def22e2015-12-02 19:41:11 +01001409 .compatible = "kyo,tcg121xglp",
1410 .data = &kyo_tcg121xglp,
1411 }, {
Heiko Schocherdd015002015-05-22 10:25:57 +02001412 .compatible = "lg,lb070wv8",
1413 .data = &lg_lb070wv8,
1414 }, {
Jitao Shi690d8fa2016-02-22 19:01:44 +08001415 .compatible = "lg,lp120up1",
1416 .data = &lg_lp120up1,
1417 }, {
Thierry Redingec7c5652013-11-15 15:59:32 +01001418 .compatible = "lg,lp129qe",
1419 .data = &lg_lp129qe,
1420 }, {
jianwei wangc6e87f92015-07-29 16:30:02 +08001421 .compatible = "nec,nl4827hc19-05b",
1422 .data = &nec_nl4827hc19_05b,
1423 }, {
Gary Bissona99fb622015-06-10 18:44:23 +02001424 .compatible = "okaya,rs800480t-7x0gp",
1425 .data = &okaya_rs800480t_7x0gp,
1426 }, {
Maxime Ripardcf5c9e62016-03-23 17:38:34 +01001427 .compatible = "olimex,lcd-olinuxino-43-ts",
1428 .data = &olimex_lcd_olinuxino_43ts,
1429 }, {
Eric Anholte8b6f562016-03-24 17:23:48 -07001430 .compatible = "ontat,yx700wv03",
1431 .data = &ontat_yx700wv03,
1432 }, {
Philipp Zabel725c9d42015-02-11 18:50:11 +01001433 .compatible = "ortustech,com43h4m85ulc",
1434 .data = &ortustech_com43h4m85ulc,
1435 }, {
Josh Wud2a6f0f2015-10-08 17:42:41 +02001436 .compatible = "qiaodian,qd43003c0-40",
1437 .data = &qd43003c0_40,
1438 }, {
Marc Dietrich6d54e3d2013-12-21 21:38:12 +01001439 .compatible = "samsung,ltn101nt05",
1440 .data = &samsung_ltn101nt05,
1441 }, {
Stéphane Marchesin0c934302015-03-18 10:52:18 +01001442 .compatible = "samsung,ltn140at29-301",
1443 .data = &samsung_ltn140at29_301,
1444 }, {
Boris BREZILLON9c6615b2015-03-19 14:43:00 +01001445 .compatible = "shelly,sca07010-bfn-lnn",
1446 .data = &shelly_sca07010_bfn_lnn,
1447 }, {
Maciej S. Szmigiero06a9dc62016-02-13 22:52:03 +01001448 .compatible = "urt,umsh-8596md-t",
1449 .data = &urt_umsh_8596md_parallel,
1450 }, {
1451 .compatible = "urt,umsh-8596md-1t",
1452 .data = &urt_umsh_8596md_parallel,
1453 }, {
1454 .compatible = "urt,umsh-8596md-7t",
1455 .data = &urt_umsh_8596md_parallel,
1456 }, {
1457 .compatible = "urt,umsh-8596md-11t",
1458 .data = &urt_umsh_8596md_lvds,
1459 }, {
1460 .compatible = "urt,umsh-8596md-19t",
1461 .data = &urt_umsh_8596md_lvds,
1462 }, {
1463 .compatible = "urt,umsh-8596md-20t",
1464 .data = &urt_umsh_8596md_parallel,
1465 }, {
Thierry Reding280921d2013-08-30 15:10:14 +02001466 /* sentinel */
1467 }
1468};
1469MODULE_DEVICE_TABLE(of, platform_of_match);
1470
1471static int panel_simple_platform_probe(struct platform_device *pdev)
1472{
1473 const struct of_device_id *id;
1474
1475 id = of_match_node(platform_of_match, pdev->dev.of_node);
1476 if (!id)
1477 return -ENODEV;
1478
1479 return panel_simple_probe(&pdev->dev, id->data);
1480}
1481
1482static int panel_simple_platform_remove(struct platform_device *pdev)
1483{
1484 return panel_simple_remove(&pdev->dev);
1485}
1486
Thierry Redingd02fd932014-04-29 17:21:21 +02001487static void panel_simple_platform_shutdown(struct platform_device *pdev)
1488{
1489 panel_simple_shutdown(&pdev->dev);
1490}
1491
Thierry Reding280921d2013-08-30 15:10:14 +02001492static struct platform_driver panel_simple_platform_driver = {
1493 .driver = {
1494 .name = "panel-simple",
Thierry Reding280921d2013-08-30 15:10:14 +02001495 .of_match_table = platform_of_match,
1496 },
1497 .probe = panel_simple_platform_probe,
1498 .remove = panel_simple_platform_remove,
Thierry Redingd02fd932014-04-29 17:21:21 +02001499 .shutdown = panel_simple_platform_shutdown,
Thierry Reding280921d2013-08-30 15:10:14 +02001500};
1501
Thierry Reding210fcd92013-11-22 19:27:11 +01001502struct panel_desc_dsi {
1503 struct panel_desc desc;
1504
Thierry Reding462658b2014-03-14 11:24:57 +01001505 unsigned long flags;
Thierry Reding210fcd92013-11-22 19:27:11 +01001506 enum mipi_dsi_pixel_format format;
1507 unsigned int lanes;
1508};
1509
Thierry Redingd718d792015-04-08 16:52:33 +02001510static const struct drm_display_mode auo_b080uan01_mode = {
1511 .clock = 154500,
1512 .hdisplay = 1200,
1513 .hsync_start = 1200 + 62,
1514 .hsync_end = 1200 + 62 + 4,
1515 .htotal = 1200 + 62 + 4 + 62,
1516 .vdisplay = 1920,
1517 .vsync_start = 1920 + 9,
1518 .vsync_end = 1920 + 9 + 2,
1519 .vtotal = 1920 + 9 + 2 + 8,
1520 .vrefresh = 60,
1521};
1522
1523static const struct panel_desc_dsi auo_b080uan01 = {
1524 .desc = {
1525 .modes = &auo_b080uan01_mode,
1526 .num_modes = 1,
1527 .bpc = 8,
1528 .size = {
1529 .width = 108,
1530 .height = 272,
1531 },
1532 },
1533 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1534 .format = MIPI_DSI_FMT_RGB888,
1535 .lanes = 4,
1536};
1537
Chris Zhongc8521962015-11-20 16:15:37 +08001538static const struct drm_display_mode boe_tv080wum_nl0_mode = {
1539 .clock = 160000,
1540 .hdisplay = 1200,
1541 .hsync_start = 1200 + 120,
1542 .hsync_end = 1200 + 120 + 20,
1543 .htotal = 1200 + 120 + 20 + 21,
1544 .vdisplay = 1920,
1545 .vsync_start = 1920 + 21,
1546 .vsync_end = 1920 + 21 + 3,
1547 .vtotal = 1920 + 21 + 3 + 18,
1548 .vrefresh = 60,
1549 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1550};
1551
1552static const struct panel_desc_dsi boe_tv080wum_nl0 = {
1553 .desc = {
1554 .modes = &boe_tv080wum_nl0_mode,
1555 .num_modes = 1,
1556 .size = {
1557 .width = 107,
1558 .height = 172,
1559 },
1560 },
1561 .flags = MIPI_DSI_MODE_VIDEO |
1562 MIPI_DSI_MODE_VIDEO_BURST |
1563 MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
1564 .format = MIPI_DSI_FMT_RGB888,
1565 .lanes = 4,
1566};
1567
Alexandre Courbot712ac1b2014-01-21 18:57:10 +09001568static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
1569 .clock = 71000,
1570 .hdisplay = 800,
1571 .hsync_start = 800 + 32,
1572 .hsync_end = 800 + 32 + 1,
1573 .htotal = 800 + 32 + 1 + 57,
1574 .vdisplay = 1280,
1575 .vsync_start = 1280 + 28,
1576 .vsync_end = 1280 + 28 + 1,
1577 .vtotal = 1280 + 28 + 1 + 14,
1578 .vrefresh = 60,
1579};
1580
1581static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
1582 .desc = {
1583 .modes = &lg_ld070wx3_sl01_mode,
1584 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +01001585 .bpc = 8,
Alexandre Courbot712ac1b2014-01-21 18:57:10 +09001586 .size = {
1587 .width = 94,
1588 .height = 151,
1589 },
1590 },
Alexandre Courbot5e4cc272014-07-08 21:32:12 +09001591 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
Alexandre Courbot712ac1b2014-01-21 18:57:10 +09001592 .format = MIPI_DSI_FMT_RGB888,
1593 .lanes = 4,
1594};
1595
Alexandre Courbot499ce852014-01-21 18:57:09 +09001596static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
1597 .clock = 67000,
1598 .hdisplay = 720,
1599 .hsync_start = 720 + 12,
1600 .hsync_end = 720 + 12 + 4,
1601 .htotal = 720 + 12 + 4 + 112,
1602 .vdisplay = 1280,
1603 .vsync_start = 1280 + 8,
1604 .vsync_end = 1280 + 8 + 4,
1605 .vtotal = 1280 + 8 + 4 + 12,
1606 .vrefresh = 60,
1607};
1608
1609static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
1610 .desc = {
1611 .modes = &lg_lh500wx1_sd03_mode,
1612 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +01001613 .bpc = 8,
Alexandre Courbot499ce852014-01-21 18:57:09 +09001614 .size = {
1615 .width = 62,
1616 .height = 110,
1617 },
1618 },
1619 .flags = MIPI_DSI_MODE_VIDEO,
1620 .format = MIPI_DSI_FMT_RGB888,
1621 .lanes = 4,
1622};
1623
Thierry Reding280921d2013-08-30 15:10:14 +02001624static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
1625 .clock = 157200,
1626 .hdisplay = 1920,
1627 .hsync_start = 1920 + 154,
1628 .hsync_end = 1920 + 154 + 16,
1629 .htotal = 1920 + 154 + 16 + 32,
1630 .vdisplay = 1200,
1631 .vsync_start = 1200 + 17,
1632 .vsync_end = 1200 + 17 + 2,
1633 .vtotal = 1200 + 17 + 2 + 16,
1634 .vrefresh = 60,
1635};
1636
Thierry Reding210fcd92013-11-22 19:27:11 +01001637static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
1638 .desc = {
1639 .modes = &panasonic_vvx10f004b00_mode,
1640 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +01001641 .bpc = 8,
Thierry Reding210fcd92013-11-22 19:27:11 +01001642 .size = {
1643 .width = 217,
1644 .height = 136,
1645 },
Thierry Reding280921d2013-08-30 15:10:14 +02001646 },
Alexandre Courbot5e4cc272014-07-08 21:32:12 +09001647 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
1648 MIPI_DSI_CLOCK_NON_CONTINUOUS,
Thierry Reding210fcd92013-11-22 19:27:11 +01001649 .format = MIPI_DSI_FMT_RGB888,
1650 .lanes = 4,
1651};
1652
Chris Zhongc8521962015-11-20 16:15:37 +08001653
Thierry Reding210fcd92013-11-22 19:27:11 +01001654static const struct of_device_id dsi_of_match[] = {
1655 {
Thierry Redingd718d792015-04-08 16:52:33 +02001656 .compatible = "auo,b080uan01",
1657 .data = &auo_b080uan01
1658 }, {
Chris Zhongc8521962015-11-20 16:15:37 +08001659 .compatible = "boe,tv080wum-nl0",
1660 .data = &boe_tv080wum_nl0
1661 }, {
Alexandre Courbot712ac1b2014-01-21 18:57:10 +09001662 .compatible = "lg,ld070wx3-sl01",
1663 .data = &lg_ld070wx3_sl01
1664 }, {
Alexandre Courbot499ce852014-01-21 18:57:09 +09001665 .compatible = "lg,lh500wx1-sd03",
1666 .data = &lg_lh500wx1_sd03
1667 }, {
Thierry Reding210fcd92013-11-22 19:27:11 +01001668 .compatible = "panasonic,vvx10f004b00",
1669 .data = &panasonic_vvx10f004b00
1670 }, {
1671 /* sentinel */
1672 }
1673};
1674MODULE_DEVICE_TABLE(of, dsi_of_match);
1675
1676static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
1677{
1678 const struct panel_desc_dsi *desc;
1679 const struct of_device_id *id;
1680 int err;
1681
1682 id = of_match_node(dsi_of_match, dsi->dev.of_node);
1683 if (!id)
1684 return -ENODEV;
1685
1686 desc = id->data;
1687
1688 err = panel_simple_probe(&dsi->dev, &desc->desc);
1689 if (err < 0)
1690 return err;
1691
Thierry Reding462658b2014-03-14 11:24:57 +01001692 dsi->mode_flags = desc->flags;
Thierry Reding210fcd92013-11-22 19:27:11 +01001693 dsi->format = desc->format;
1694 dsi->lanes = desc->lanes;
1695
1696 return mipi_dsi_attach(dsi);
1697}
1698
1699static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
1700{
1701 int err;
1702
1703 err = mipi_dsi_detach(dsi);
1704 if (err < 0)
1705 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
1706
1707 return panel_simple_remove(&dsi->dev);
1708}
1709
Thierry Redingd02fd932014-04-29 17:21:21 +02001710static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
1711{
1712 panel_simple_shutdown(&dsi->dev);
1713}
1714
Thierry Reding210fcd92013-11-22 19:27:11 +01001715static struct mipi_dsi_driver panel_simple_dsi_driver = {
1716 .driver = {
1717 .name = "panel-simple-dsi",
Thierry Reding210fcd92013-11-22 19:27:11 +01001718 .of_match_table = dsi_of_match,
1719 },
1720 .probe = panel_simple_dsi_probe,
1721 .remove = panel_simple_dsi_remove,
Thierry Redingd02fd932014-04-29 17:21:21 +02001722 .shutdown = panel_simple_dsi_shutdown,
Thierry Reding280921d2013-08-30 15:10:14 +02001723};
1724
1725static int __init panel_simple_init(void)
1726{
Thierry Reding210fcd92013-11-22 19:27:11 +01001727 int err;
1728
1729 err = platform_driver_register(&panel_simple_platform_driver);
1730 if (err < 0)
1731 return err;
1732
1733 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
1734 err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
1735 if (err < 0)
1736 return err;
1737 }
1738
1739 return 0;
Thierry Reding280921d2013-08-30 15:10:14 +02001740}
1741module_init(panel_simple_init);
1742
1743static void __exit panel_simple_exit(void)
1744{
Thierry Reding210fcd92013-11-22 19:27:11 +01001745 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
1746 mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
1747
Thierry Reding280921d2013-08-30 15:10:14 +02001748 platform_driver_unregister(&panel_simple_platform_driver);
1749}
1750module_exit(panel_simple_exit);
1751
1752MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1753MODULE_DESCRIPTION("DRM Driver for Simple Panels");
1754MODULE_LICENSE("GPL and additional rights");