blob: c2aeb89cb8515e1724220eedd60c4c6ea5027748 [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
36struct panel_desc {
37 const struct drm_display_mode *modes;
38 unsigned int num_modes;
39
Stéphane Marchesin0208d512014-06-19 18:18:28 -070040 unsigned int bpc;
41
Thierry Reding280921d2013-08-30 15:10:14 +020042 struct {
43 unsigned int width;
44 unsigned int height;
45 } size;
Ajay Kumarf673c372014-07-31 23:12:11 +053046
47 /**
48 * @prepare: the time (in milliseconds) that it takes for the panel to
49 * become ready and start receiving video data
50 * @enable: the time (in milliseconds) that it takes for the panel to
51 * display the first valid frame after starting to receive
52 * video data
53 * @disable: the time (in milliseconds) that it takes for the panel to
54 * turn the display off (no content is visible)
55 * @unprepare: the time (in milliseconds) that it takes for the panel
56 * to power itself down completely
57 */
58 struct {
59 unsigned int prepare;
60 unsigned int enable;
61 unsigned int disable;
62 unsigned int unprepare;
63 } delay;
Boris Brezillon795f7ab2014-07-22 13:33:59 +020064
65 u32 bus_format;
Thierry Reding280921d2013-08-30 15:10:14 +020066};
67
Thierry Reding280921d2013-08-30 15:10:14 +020068struct panel_simple {
69 struct drm_panel base;
Ajay Kumar613a6332014-07-31 23:12:10 +053070 bool prepared;
Thierry Reding280921d2013-08-30 15:10:14 +020071 bool enabled;
72
73 const struct panel_desc *desc;
74
75 struct backlight_device *backlight;
76 struct regulator *supply;
77 struct i2c_adapter *ddc;
78
Alexandre Courbotcfdf0542014-03-01 14:00:58 +090079 struct gpio_desc *enable_gpio;
Thierry Reding280921d2013-08-30 15:10:14 +020080};
81
82static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
83{
84 return container_of(panel, struct panel_simple, base);
85}
86
87static int panel_simple_get_fixed_modes(struct panel_simple *panel)
88{
89 struct drm_connector *connector = panel->base.connector;
90 struct drm_device *drm = panel->base.drm;
91 struct drm_display_mode *mode;
92 unsigned int i, num = 0;
93
94 if (!panel->desc)
95 return 0;
96
97 for (i = 0; i < panel->desc->num_modes; i++) {
98 const struct drm_display_mode *m = &panel->desc->modes[i];
99
100 mode = drm_mode_duplicate(drm, m);
101 if (!mode) {
102 dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
103 m->hdisplay, m->vdisplay, m->vrefresh);
104 continue;
105 }
106
107 drm_mode_set_name(mode);
108
109 drm_mode_probed_add(connector, mode);
110 num++;
111 }
112
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700113 connector->display_info.bpc = panel->desc->bpc;
Thierry Reding280921d2013-08-30 15:10:14 +0200114 connector->display_info.width_mm = panel->desc->size.width;
115 connector->display_info.height_mm = panel->desc->size.height;
Boris Brezillon795f7ab2014-07-22 13:33:59 +0200116 if (panel->desc->bus_format)
117 drm_display_info_set_bus_formats(&connector->display_info,
118 &panel->desc->bus_format, 1);
Thierry Reding280921d2013-08-30 15:10:14 +0200119
120 return num;
121}
122
123static int panel_simple_disable(struct drm_panel *panel)
124{
125 struct panel_simple *p = to_panel_simple(panel);
126
127 if (!p->enabled)
128 return 0;
129
130 if (p->backlight) {
131 p->backlight->props.power = FB_BLANK_POWERDOWN;
132 backlight_update_status(p->backlight);
133 }
134
Ajay Kumarf673c372014-07-31 23:12:11 +0530135 if (p->desc->delay.disable)
136 msleep(p->desc->delay.disable);
137
Thierry Reding280921d2013-08-30 15:10:14 +0200138 p->enabled = false;
139
140 return 0;
141}
142
Ajay Kumarc0e1d172014-07-31 23:12:04 +0530143static int panel_simple_unprepare(struct drm_panel *panel)
144{
Ajay Kumar613a6332014-07-31 23:12:10 +0530145 struct panel_simple *p = to_panel_simple(panel);
146
147 if (!p->prepared)
148 return 0;
149
150 if (p->enable_gpio)
151 gpiod_set_value_cansleep(p->enable_gpio, 0);
152
153 regulator_disable(p->supply);
154
Ajay Kumarf673c372014-07-31 23:12:11 +0530155 if (p->desc->delay.unprepare)
156 msleep(p->desc->delay.unprepare);
157
Ajay Kumar613a6332014-07-31 23:12:10 +0530158 p->prepared = false;
159
Ajay Kumarc0e1d172014-07-31 23:12:04 +0530160 return 0;
161}
162
163static int panel_simple_prepare(struct drm_panel *panel)
164{
Thierry Reding280921d2013-08-30 15:10:14 +0200165 struct panel_simple *p = to_panel_simple(panel);
166 int err;
167
Ajay Kumar613a6332014-07-31 23:12:10 +0530168 if (p->prepared)
Thierry Reding280921d2013-08-30 15:10:14 +0200169 return 0;
170
171 err = regulator_enable(p->supply);
172 if (err < 0) {
173 dev_err(panel->dev, "failed to enable supply: %d\n", err);
174 return err;
175 }
176
Alexandre Courbotcfdf0542014-03-01 14:00:58 +0900177 if (p->enable_gpio)
Thierry Reding15c1a912014-03-14 12:03:47 +0100178 gpiod_set_value_cansleep(p->enable_gpio, 1);
Thierry Reding280921d2013-08-30 15:10:14 +0200179
Ajay Kumarf673c372014-07-31 23:12:11 +0530180 if (p->desc->delay.prepare)
181 msleep(p->desc->delay.prepare);
182
Ajay Kumar613a6332014-07-31 23:12:10 +0530183 p->prepared = true;
184
185 return 0;
186}
187
188static int panel_simple_enable(struct drm_panel *panel)
189{
190 struct panel_simple *p = to_panel_simple(panel);
191
192 if (p->enabled)
193 return 0;
194
Ajay Kumarf673c372014-07-31 23:12:11 +0530195 if (p->desc->delay.enable)
196 msleep(p->desc->delay.enable);
197
Thierry Reding280921d2013-08-30 15:10:14 +0200198 if (p->backlight) {
199 p->backlight->props.power = FB_BLANK_UNBLANK;
200 backlight_update_status(p->backlight);
201 }
202
203 p->enabled = true;
204
205 return 0;
206}
207
208static int panel_simple_get_modes(struct drm_panel *panel)
209{
210 struct panel_simple *p = to_panel_simple(panel);
211 int num = 0;
212
213 /* probe EDID if a DDC bus is available */
214 if (p->ddc) {
215 struct edid *edid = drm_get_edid(panel->connector, p->ddc);
Stephen Warren70bf6872014-01-09 11:37:34 -0700216 drm_mode_connector_update_edid_property(panel->connector, edid);
Thierry Reding280921d2013-08-30 15:10:14 +0200217 if (edid) {
218 num += drm_add_edid_modes(panel->connector, edid);
219 kfree(edid);
220 }
221 }
222
223 /* add hard-coded panel modes */
224 num += panel_simple_get_fixed_modes(p);
225
226 return num;
227}
228
229static const struct drm_panel_funcs panel_simple_funcs = {
230 .disable = panel_simple_disable,
Ajay Kumarc0e1d172014-07-31 23:12:04 +0530231 .unprepare = panel_simple_unprepare,
232 .prepare = panel_simple_prepare,
Thierry Reding280921d2013-08-30 15:10:14 +0200233 .enable = panel_simple_enable,
234 .get_modes = panel_simple_get_modes,
235};
236
237static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
238{
239 struct device_node *backlight, *ddc;
240 struct panel_simple *panel;
Thierry Reding280921d2013-08-30 15:10:14 +0200241 int err;
242
243 panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
244 if (!panel)
245 return -ENOMEM;
246
247 panel->enabled = false;
Ajay Kumar613a6332014-07-31 23:12:10 +0530248 panel->prepared = false;
Thierry Reding280921d2013-08-30 15:10:14 +0200249 panel->desc = desc;
250
251 panel->supply = devm_regulator_get(dev, "power");
252 if (IS_ERR(panel->supply))
253 return PTR_ERR(panel->supply);
254
Alexandre Courbota61400d2014-10-23 17:16:58 +0900255 panel->enable_gpio = devm_gpiod_get_optional(dev, "enable",
256 GPIOD_OUT_LOW);
Alexandre Courbotcfdf0542014-03-01 14:00:58 +0900257 if (IS_ERR(panel->enable_gpio)) {
258 err = PTR_ERR(panel->enable_gpio);
Alexandre Courbot9746c612014-07-25 23:47:25 +0900259 dev_err(dev, "failed to request GPIO: %d\n", err);
260 return err;
261 }
Thierry Reding280921d2013-08-30 15:10:14 +0200262
Thierry Reding280921d2013-08-30 15:10:14 +0200263 backlight = of_parse_phandle(dev->of_node, "backlight", 0);
264 if (backlight) {
265 panel->backlight = of_find_backlight_by_node(backlight);
266 of_node_put(backlight);
267
Alexandre Courbotcfdf0542014-03-01 14:00:58 +0900268 if (!panel->backlight)
269 return -EPROBE_DEFER;
Thierry Reding280921d2013-08-30 15:10:14 +0200270 }
271
272 ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
273 if (ddc) {
274 panel->ddc = of_find_i2c_adapter_by_node(ddc);
275 of_node_put(ddc);
276
277 if (!panel->ddc) {
278 err = -EPROBE_DEFER;
279 goto free_backlight;
280 }
281 }
282
283 drm_panel_init(&panel->base);
284 panel->base.dev = dev;
285 panel->base.funcs = &panel_simple_funcs;
286
287 err = drm_panel_add(&panel->base);
288 if (err < 0)
289 goto free_ddc;
290
291 dev_set_drvdata(dev, panel);
292
293 return 0;
294
295free_ddc:
296 if (panel->ddc)
297 put_device(&panel->ddc->dev);
298free_backlight:
299 if (panel->backlight)
300 put_device(&panel->backlight->dev);
Thierry Reding280921d2013-08-30 15:10:14 +0200301
302 return err;
303}
304
305static int panel_simple_remove(struct device *dev)
306{
307 struct panel_simple *panel = dev_get_drvdata(dev);
308
309 drm_panel_detach(&panel->base);
310 drm_panel_remove(&panel->base);
311
312 panel_simple_disable(&panel->base);
313
314 if (panel->ddc)
315 put_device(&panel->ddc->dev);
316
317 if (panel->backlight)
318 put_device(&panel->backlight->dev);
319
Thierry Reding280921d2013-08-30 15:10:14 +0200320 return 0;
321}
322
Thierry Redingd02fd932014-04-29 17:21:21 +0200323static void panel_simple_shutdown(struct device *dev)
324{
325 struct panel_simple *panel = dev_get_drvdata(dev);
326
327 panel_simple_disable(&panel->base);
328}
329
Thierry Reding280921d2013-08-30 15:10:14 +0200330static const struct drm_display_mode auo_b101aw03_mode = {
331 .clock = 51450,
332 .hdisplay = 1024,
333 .hsync_start = 1024 + 156,
334 .hsync_end = 1024 + 156 + 8,
335 .htotal = 1024 + 156 + 8 + 156,
336 .vdisplay = 600,
337 .vsync_start = 600 + 16,
338 .vsync_end = 600 + 16 + 6,
339 .vtotal = 600 + 16 + 6 + 16,
340 .vrefresh = 60,
341};
342
343static const struct panel_desc auo_b101aw03 = {
344 .modes = &auo_b101aw03_mode,
345 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700346 .bpc = 6,
Thierry Reding280921d2013-08-30 15:10:14 +0200347 .size = {
348 .width = 223,
349 .height = 125,
350 },
351};
352
Huang Lina531bc32015-02-28 10:18:58 +0800353static const struct drm_display_mode auo_b101ean01_mode = {
354 .clock = 72500,
355 .hdisplay = 1280,
356 .hsync_start = 1280 + 119,
357 .hsync_end = 1280 + 119 + 32,
358 .htotal = 1280 + 119 + 32 + 21,
359 .vdisplay = 800,
360 .vsync_start = 800 + 4,
361 .vsync_end = 800 + 4 + 20,
362 .vtotal = 800 + 4 + 20 + 8,
363 .vrefresh = 60,
364};
365
366static const struct panel_desc auo_b101ean01 = {
367 .modes = &auo_b101ean01_mode,
368 .num_modes = 1,
369 .bpc = 6,
370 .size = {
371 .width = 217,
372 .height = 136,
373 },
374};
375
Rob Clarkdac746e2014-08-01 17:01:06 -0400376static const struct drm_display_mode auo_b101xtn01_mode = {
377 .clock = 72000,
378 .hdisplay = 1366,
379 .hsync_start = 1366 + 20,
380 .hsync_end = 1366 + 20 + 70,
381 .htotal = 1366 + 20 + 70,
382 .vdisplay = 768,
383 .vsync_start = 768 + 14,
384 .vsync_end = 768 + 14 + 42,
385 .vtotal = 768 + 14 + 42,
386 .vrefresh = 60,
387 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
388};
389
390static const struct panel_desc auo_b101xtn01 = {
391 .modes = &auo_b101xtn01_mode,
392 .num_modes = 1,
393 .bpc = 6,
394 .size = {
395 .width = 223,
396 .height = 125,
397 },
398};
399
Ajay Kumare35e3052014-09-01 15:40:02 +0530400static const struct drm_display_mode auo_b116xw03_mode = {
401 .clock = 70589,
402 .hdisplay = 1366,
403 .hsync_start = 1366 + 40,
404 .hsync_end = 1366 + 40 + 40,
405 .htotal = 1366 + 40 + 40 + 32,
406 .vdisplay = 768,
407 .vsync_start = 768 + 10,
408 .vsync_end = 768 + 10 + 12,
409 .vtotal = 768 + 10 + 12 + 6,
410 .vrefresh = 60,
411};
412
413static const struct panel_desc auo_b116xw03 = {
414 .modes = &auo_b116xw03_mode,
415 .num_modes = 1,
416 .bpc = 6,
417 .size = {
418 .width = 256,
419 .height = 144,
420 },
421};
422
Stéphane Marchesina333f7a2014-05-23 19:27:59 -0700423static const struct drm_display_mode auo_b133xtn01_mode = {
424 .clock = 69500,
425 .hdisplay = 1366,
426 .hsync_start = 1366 + 48,
427 .hsync_end = 1366 + 48 + 32,
428 .htotal = 1366 + 48 + 32 + 20,
429 .vdisplay = 768,
430 .vsync_start = 768 + 3,
431 .vsync_end = 768 + 3 + 6,
432 .vtotal = 768 + 3 + 6 + 13,
433 .vrefresh = 60,
434};
435
436static const struct panel_desc auo_b133xtn01 = {
437 .modes = &auo_b133xtn01_mode,
438 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700439 .bpc = 6,
Stéphane Marchesina333f7a2014-05-23 19:27:59 -0700440 .size = {
441 .width = 293,
442 .height = 165,
443 },
444};
445
Ajay Kumar3e51d602014-07-31 23:12:12 +0530446static const struct drm_display_mode auo_b133htn01_mode = {
447 .clock = 150660,
448 .hdisplay = 1920,
449 .hsync_start = 1920 + 172,
450 .hsync_end = 1920 + 172 + 80,
451 .htotal = 1920 + 172 + 80 + 60,
452 .vdisplay = 1080,
453 .vsync_start = 1080 + 25,
454 .vsync_end = 1080 + 25 + 10,
455 .vtotal = 1080 + 25 + 10 + 10,
456 .vrefresh = 60,
457};
458
459static const struct panel_desc auo_b133htn01 = {
460 .modes = &auo_b133htn01_mode,
461 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +0100462 .bpc = 6,
Ajay Kumar3e51d602014-07-31 23:12:12 +0530463 .size = {
464 .width = 293,
465 .height = 165,
466 },
467 .delay = {
468 .prepare = 105,
469 .enable = 20,
470 .unprepare = 50,
471 },
472};
473
Philipp Zabeld47df632014-12-18 16:43:43 +0100474static const struct drm_display_mode avic_tm070ddh03_mode = {
475 .clock = 51200,
476 .hdisplay = 1024,
477 .hsync_start = 1024 + 160,
478 .hsync_end = 1024 + 160 + 4,
479 .htotal = 1024 + 160 + 4 + 156,
480 .vdisplay = 600,
481 .vsync_start = 600 + 17,
482 .vsync_end = 600 + 17 + 1,
483 .vtotal = 600 + 17 + 1 + 17,
484 .vrefresh = 60,
485};
486
487static const struct panel_desc avic_tm070ddh03 = {
488 .modes = &avic_tm070ddh03_mode,
489 .num_modes = 1,
490 .bpc = 8,
491 .size = {
492 .width = 154,
493 .height = 90,
494 },
495 .delay = {
496 .prepare = 20,
497 .enable = 200,
498 .disable = 200,
499 },
500};
501
Stephen Warren4c930752014-01-07 16:46:26 -0700502static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
503 .clock = 72070,
504 .hdisplay = 1366,
505 .hsync_start = 1366 + 58,
506 .hsync_end = 1366 + 58 + 58,
507 .htotal = 1366 + 58 + 58 + 58,
508 .vdisplay = 768,
509 .vsync_start = 768 + 4,
510 .vsync_end = 768 + 4 + 4,
511 .vtotal = 768 + 4 + 4 + 4,
512 .vrefresh = 60,
513};
514
515static const struct panel_desc chunghwa_claa101wa01a = {
516 .modes = &chunghwa_claa101wa01a_mode,
517 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700518 .bpc = 6,
Stephen Warren4c930752014-01-07 16:46:26 -0700519 .size = {
520 .width = 220,
521 .height = 120,
522 },
523};
524
Thierry Reding280921d2013-08-30 15:10:14 +0200525static const struct drm_display_mode chunghwa_claa101wb01_mode = {
526 .clock = 69300,
527 .hdisplay = 1366,
528 .hsync_start = 1366 + 48,
529 .hsync_end = 1366 + 48 + 32,
530 .htotal = 1366 + 48 + 32 + 20,
531 .vdisplay = 768,
532 .vsync_start = 768 + 16,
533 .vsync_end = 768 + 16 + 8,
534 .vtotal = 768 + 16 + 8 + 16,
535 .vrefresh = 60,
536};
537
538static const struct panel_desc chunghwa_claa101wb01 = {
539 .modes = &chunghwa_claa101wb01_mode,
540 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700541 .bpc = 6,
Thierry Reding280921d2013-08-30 15:10:14 +0200542 .size = {
543 .width = 223,
544 .height = 125,
545 },
546};
547
Stefan Agner26ab0062014-05-15 11:38:45 +0200548static const struct drm_display_mode edt_et057090dhu_mode = {
549 .clock = 25175,
550 .hdisplay = 640,
551 .hsync_start = 640 + 16,
552 .hsync_end = 640 + 16 + 30,
553 .htotal = 640 + 16 + 30 + 114,
554 .vdisplay = 480,
555 .vsync_start = 480 + 10,
556 .vsync_end = 480 + 10 + 3,
557 .vtotal = 480 + 10 + 3 + 32,
558 .vrefresh = 60,
559 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
560};
561
562static const struct panel_desc edt_et057090dhu = {
563 .modes = &edt_et057090dhu_mode,
564 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700565 .bpc = 6,
Stefan Agner26ab0062014-05-15 11:38:45 +0200566 .size = {
567 .width = 115,
568 .height = 86,
569 },
570};
571
Philipp Zabelfff5de42014-05-15 12:25:47 +0200572static const struct drm_display_mode edt_etm0700g0dh6_mode = {
573 .clock = 33260,
574 .hdisplay = 800,
575 .hsync_start = 800 + 40,
576 .hsync_end = 800 + 40 + 128,
577 .htotal = 800 + 40 + 128 + 88,
578 .vdisplay = 480,
579 .vsync_start = 480 + 10,
580 .vsync_end = 480 + 10 + 2,
581 .vtotal = 480 + 10 + 2 + 33,
582 .vrefresh = 60,
583 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
584};
585
586static const struct panel_desc edt_etm0700g0dh6 = {
587 .modes = &edt_etm0700g0dh6_mode,
588 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700589 .bpc = 6,
Philipp Zabelfff5de42014-05-15 12:25:47 +0200590 .size = {
591 .width = 152,
592 .height = 91,
593 },
594};
595
Boris BREZILLON102932b2014-06-05 15:53:32 +0200596static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
597 .clock = 32260,
598 .hdisplay = 800,
599 .hsync_start = 800 + 168,
600 .hsync_end = 800 + 168 + 64,
601 .htotal = 800 + 168 + 64 + 88,
602 .vdisplay = 480,
603 .vsync_start = 480 + 37,
604 .vsync_end = 480 + 37 + 2,
605 .vtotal = 480 + 37 + 2 + 8,
606 .vrefresh = 60,
607};
608
609static const struct panel_desc foxlink_fl500wvr00_a0t = {
610 .modes = &foxlink_fl500wvr00_a0t_mode,
611 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +0100612 .bpc = 8,
Boris BREZILLON102932b2014-06-05 15:53:32 +0200613 .size = {
614 .width = 108,
615 .height = 65,
616 },
Boris Brezillonbb276cb2014-07-22 13:35:47 +0200617 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
Boris BREZILLON102932b2014-06-05 15:53:32 +0200618};
619
Philipp Zabeld435a2a2014-11-19 10:29:55 +0100620static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
621 .clock = 9000,
622 .hdisplay = 480,
623 .hsync_start = 480 + 5,
624 .hsync_end = 480 + 5 + 1,
625 .htotal = 480 + 5 + 1 + 40,
626 .vdisplay = 272,
627 .vsync_start = 272 + 8,
628 .vsync_end = 272 + 8 + 1,
629 .vtotal = 272 + 8 + 1 + 8,
630 .vrefresh = 60,
631};
632
633static const struct panel_desc giantplus_gpg482739qs5 = {
634 .modes = &giantplus_gpg482739qs5_mode,
635 .num_modes = 1,
636 .bpc = 8,
637 .size = {
638 .width = 95,
639 .height = 54,
640 },
Philipp Zabel33536a02015-02-11 18:50:07 +0100641 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
Philipp Zabeld435a2a2014-11-19 10:29:55 +0100642};
643
Philipp Zabela8532052014-10-23 16:31:06 +0200644static const struct drm_display_mode hannstar_hsd070pww1_mode = {
645 .clock = 71100,
646 .hdisplay = 1280,
647 .hsync_start = 1280 + 1,
648 .hsync_end = 1280 + 1 + 158,
649 .htotal = 1280 + 1 + 158 + 1,
650 .vdisplay = 800,
651 .vsync_start = 800 + 1,
652 .vsync_end = 800 + 1 + 21,
653 .vtotal = 800 + 1 + 21 + 1,
654 .vrefresh = 60,
655};
656
657static const struct panel_desc hannstar_hsd070pww1 = {
658 .modes = &hannstar_hsd070pww1_mode,
659 .num_modes = 1,
660 .bpc = 6,
661 .size = {
662 .width = 151,
663 .height = 94,
664 },
665};
666
Lucas Stach61ac0bf2014-11-06 17:44:35 +0100667static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
668 .clock = 33333,
669 .hdisplay = 800,
670 .hsync_start = 800 + 85,
671 .hsync_end = 800 + 85 + 86,
672 .htotal = 800 + 85 + 86 + 85,
673 .vdisplay = 480,
674 .vsync_start = 480 + 16,
675 .vsync_end = 480 + 16 + 13,
676 .vtotal = 480 + 16 + 13 + 16,
677 .vrefresh = 60,
678};
679
680static const struct panel_desc hitachi_tx23d38vm0caa = {
681 .modes = &hitachi_tx23d38vm0caa_mode,
682 .num_modes = 1,
683 .bpc = 6,
684 .size = {
685 .width = 195,
686 .height = 117,
687 },
688};
689
Nicolas Ferre41bcceb2015-03-19 14:43:01 +0100690static const struct drm_display_mode innolux_at043tn24_mode = {
691 .clock = 9000,
692 .hdisplay = 480,
693 .hsync_start = 480 + 2,
694 .hsync_end = 480 + 2 + 41,
695 .htotal = 480 + 2 + 41 + 2,
696 .vdisplay = 272,
697 .vsync_start = 272 + 2,
698 .vsync_end = 272 + 2 + 11,
699 .vtotal = 272 + 2 + 11 + 2,
700 .vrefresh = 60,
701 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
702};
703
704static const struct panel_desc innolux_at043tn24 = {
705 .modes = &innolux_at043tn24_mode,
706 .num_modes = 1,
707 .bpc = 8,
708 .size = {
709 .width = 95,
710 .height = 54,
711 },
712 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
713};
714
Lucas Stachd731f662014-11-06 17:44:33 +0100715static const struct drm_display_mode innolux_g121i1_l01_mode = {
Thierry Reding0a2288c2014-07-03 14:02:59 +0200716 .clock = 71000,
Lucas Stachd731f662014-11-06 17:44:33 +0100717 .hdisplay = 1280,
718 .hsync_start = 1280 + 64,
719 .hsync_end = 1280 + 64 + 32,
720 .htotal = 1280 + 64 + 32 + 64,
721 .vdisplay = 800,
722 .vsync_start = 800 + 9,
723 .vsync_end = 800 + 9 + 6,
724 .vtotal = 800 + 9 + 6 + 9,
725 .vrefresh = 60,
726};
727
728static const struct panel_desc innolux_g121i1_l01 = {
729 .modes = &innolux_g121i1_l01_mode,
730 .num_modes = 1,
731 .bpc = 6,
732 .size = {
733 .width = 261,
734 .height = 163,
735 },
736};
737
Thierry Reding0a2288c2014-07-03 14:02:59 +0200738static const struct drm_display_mode innolux_n116bge_mode = {
Daniel Kurtz7fe8c772014-09-02 10:56:46 +0800739 .clock = 76420,
Thierry Reding0a2288c2014-07-03 14:02:59 +0200740 .hdisplay = 1366,
Daniel Kurtz7fe8c772014-09-02 10:56:46 +0800741 .hsync_start = 1366 + 136,
742 .hsync_end = 1366 + 136 + 30,
743 .htotal = 1366 + 136 + 30 + 60,
Thierry Reding0a2288c2014-07-03 14:02:59 +0200744 .vdisplay = 768,
745 .vsync_start = 768 + 8,
Daniel Kurtz7fe8c772014-09-02 10:56:46 +0800746 .vsync_end = 768 + 8 + 12,
747 .vtotal = 768 + 8 + 12 + 12,
Thierry Reding0a2288c2014-07-03 14:02:59 +0200748 .vrefresh = 60,
749 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
750};
751
752static const struct panel_desc innolux_n116bge = {
753 .modes = &innolux_n116bge_mode,
754 .num_modes = 1,
755 .bpc = 6,
756 .size = {
757 .width = 256,
758 .height = 144,
759 },
760};
761
Alban Bedelea447392014-07-22 08:38:55 +0200762static const struct drm_display_mode innolux_n156bge_l21_mode = {
763 .clock = 69300,
764 .hdisplay = 1366,
765 .hsync_start = 1366 + 16,
766 .hsync_end = 1366 + 16 + 34,
767 .htotal = 1366 + 16 + 34 + 50,
768 .vdisplay = 768,
769 .vsync_start = 768 + 2,
770 .vsync_end = 768 + 2 + 6,
771 .vtotal = 768 + 2 + 6 + 12,
772 .vrefresh = 60,
773};
774
775static const struct panel_desc innolux_n156bge_l21 = {
776 .modes = &innolux_n156bge_l21_mode,
777 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700778 .bpc = 6,
Alban Bedelea447392014-07-22 08:38:55 +0200779 .size = {
780 .width = 344,
781 .height = 193,
782 },
783};
784
Michael Grzeschikbccac3f2015-03-19 12:22:44 +0100785static const struct drm_display_mode innolux_zj070na_01p_mode = {
786 .clock = 51501,
787 .hdisplay = 1024,
788 .hsync_start = 1024 + 128,
789 .hsync_end = 1024 + 128 + 64,
790 .htotal = 1024 + 128 + 64 + 128,
791 .vdisplay = 600,
792 .vsync_start = 600 + 16,
793 .vsync_end = 600 + 16 + 4,
794 .vtotal = 600 + 16 + 4 + 16,
795 .vrefresh = 60,
796};
797
798static const struct panel_desc innolux_zj070na_01p = {
799 .modes = &innolux_zj070na_01p_mode,
800 .num_modes = 1,
801 .bpc = 6,
802 .size = {
803 .width = 1024,
804 .height = 600,
805 },
806};
807
Thierry Redingec7c5652013-11-15 15:59:32 +0100808static const struct drm_display_mode lg_lp129qe_mode = {
809 .clock = 285250,
810 .hdisplay = 2560,
811 .hsync_start = 2560 + 48,
812 .hsync_end = 2560 + 48 + 32,
813 .htotal = 2560 + 48 + 32 + 80,
814 .vdisplay = 1700,
815 .vsync_start = 1700 + 3,
816 .vsync_end = 1700 + 3 + 10,
817 .vtotal = 1700 + 3 + 10 + 36,
818 .vrefresh = 60,
819};
820
821static const struct panel_desc lg_lp129qe = {
822 .modes = &lg_lp129qe_mode,
823 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700824 .bpc = 8,
Thierry Redingec7c5652013-11-15 15:59:32 +0100825 .size = {
826 .width = 272,
827 .height = 181,
828 },
829};
830
Marc Dietrich6d54e3d2013-12-21 21:38:12 +0100831static const struct drm_display_mode samsung_ltn101nt05_mode = {
832 .clock = 54030,
833 .hdisplay = 1024,
834 .hsync_start = 1024 + 24,
835 .hsync_end = 1024 + 24 + 136,
836 .htotal = 1024 + 24 + 136 + 160,
837 .vdisplay = 600,
838 .vsync_start = 600 + 3,
839 .vsync_end = 600 + 3 + 6,
840 .vtotal = 600 + 3 + 6 + 61,
841 .vrefresh = 60,
842};
843
844static const struct panel_desc samsung_ltn101nt05 = {
845 .modes = &samsung_ltn101nt05_mode,
846 .num_modes = 1,
Stéphane Marchesin0208d512014-06-19 18:18:28 -0700847 .bpc = 6,
Marc Dietrich6d54e3d2013-12-21 21:38:12 +0100848 .size = {
849 .width = 1024,
850 .height = 600,
851 },
852};
853
Stéphane Marchesin0c934302015-03-18 10:52:18 +0100854static const struct drm_display_mode samsung_ltn140at29_301_mode = {
855 .clock = 76300,
856 .hdisplay = 1366,
857 .hsync_start = 1366 + 64,
858 .hsync_end = 1366 + 64 + 48,
859 .htotal = 1366 + 64 + 48 + 128,
860 .vdisplay = 768,
861 .vsync_start = 768 + 2,
862 .vsync_end = 768 + 2 + 5,
863 .vtotal = 768 + 2 + 5 + 17,
864 .vrefresh = 60,
865};
866
867static const struct panel_desc samsung_ltn140at29_301 = {
868 .modes = &samsung_ltn140at29_301_mode,
869 .num_modes = 1,
870 .bpc = 6,
871 .size = {
872 .width = 320,
873 .height = 187,
874 },
875};
876
Boris BREZILLON9c6615b2015-03-19 14:43:00 +0100877static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
878 .clock = 33300,
879 .hdisplay = 800,
880 .hsync_start = 800 + 1,
881 .hsync_end = 800 + 1 + 64,
882 .htotal = 800 + 1 + 64 + 64,
883 .vdisplay = 480,
884 .vsync_start = 480 + 1,
885 .vsync_end = 480 + 1 + 23,
886 .vtotal = 480 + 1 + 23 + 22,
887 .vrefresh = 60,
888};
889
890static const struct panel_desc shelly_sca07010_bfn_lnn = {
891 .modes = &shelly_sca07010_bfn_lnn_mode,
892 .num_modes = 1,
893 .size = {
894 .width = 152,
895 .height = 91,
896 },
897 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
898};
899
Thierry Reding280921d2013-08-30 15:10:14 +0200900static const struct of_device_id platform_of_match[] = {
901 {
902 .compatible = "auo,b101aw03",
903 .data = &auo_b101aw03,
904 }, {
Huang Lina531bc32015-02-28 10:18:58 +0800905 .compatible = "auo,b101ean01",
906 .data = &auo_b101ean01,
907 }, {
Rob Clarkdac746e2014-08-01 17:01:06 -0400908 .compatible = "auo,b101xtn01",
909 .data = &auo_b101xtn01,
910 }, {
Ajay Kumare35e3052014-09-01 15:40:02 +0530911 .compatible = "auo,b116xw03",
912 .data = &auo_b116xw03,
913 }, {
Ajay Kumar3e51d602014-07-31 23:12:12 +0530914 .compatible = "auo,b133htn01",
915 .data = &auo_b133htn01,
916 }, {
Stéphane Marchesina333f7a2014-05-23 19:27:59 -0700917 .compatible = "auo,b133xtn01",
918 .data = &auo_b133xtn01,
919 }, {
Philipp Zabeld47df632014-12-18 16:43:43 +0100920 .compatible = "avic,tm070ddh03",
921 .data = &avic_tm070ddh03,
922 }, {
Stephen Warren4c930752014-01-07 16:46:26 -0700923 .compatible = "chunghwa,claa101wa01a",
924 .data = &chunghwa_claa101wa01a
925 }, {
Thierry Reding280921d2013-08-30 15:10:14 +0200926 .compatible = "chunghwa,claa101wb01",
927 .data = &chunghwa_claa101wb01
928 }, {
Stefan Agner26ab0062014-05-15 11:38:45 +0200929 .compatible = "edt,et057090dhu",
930 .data = &edt_et057090dhu,
931 }, {
Philipp Zabelfff5de42014-05-15 12:25:47 +0200932 .compatible = "edt,et070080dh6",
933 .data = &edt_etm0700g0dh6,
934 }, {
935 .compatible = "edt,etm0700g0dh6",
936 .data = &edt_etm0700g0dh6,
937 }, {
Boris BREZILLON102932b2014-06-05 15:53:32 +0200938 .compatible = "foxlink,fl500wvr00-a0t",
939 .data = &foxlink_fl500wvr00_a0t,
940 }, {
Philipp Zabeld435a2a2014-11-19 10:29:55 +0100941 .compatible = "giantplus,gpg482739qs5",
942 .data = &giantplus_gpg482739qs5
943 }, {
Philipp Zabela8532052014-10-23 16:31:06 +0200944 .compatible = "hannstar,hsd070pww1",
945 .data = &hannstar_hsd070pww1,
946 }, {
Lucas Stach61ac0bf2014-11-06 17:44:35 +0100947 .compatible = "hit,tx23d38vm0caa",
948 .data = &hitachi_tx23d38vm0caa
949 }, {
Nicolas Ferre41bcceb2015-03-19 14:43:01 +0100950 .compatible = "innolux,at043tn24",
951 .data = &innolux_at043tn24,
952 }, {
Lucas Stachd731f662014-11-06 17:44:33 +0100953 .compatible ="innolux,g121i1-l01",
954 .data = &innolux_g121i1_l01
955 }, {
Thierry Reding0a2288c2014-07-03 14:02:59 +0200956 .compatible = "innolux,n116bge",
957 .data = &innolux_n116bge,
958 }, {
Alban Bedelea447392014-07-22 08:38:55 +0200959 .compatible = "innolux,n156bge-l21",
960 .data = &innolux_n156bge_l21,
961 }, {
Michael Grzeschikbccac3f2015-03-19 12:22:44 +0100962 .compatible = "innolux,zj070na-01p",
963 .data = &innolux_zj070na_01p,
964 }, {
Thierry Redingec7c5652013-11-15 15:59:32 +0100965 .compatible = "lg,lp129qe",
966 .data = &lg_lp129qe,
967 }, {
Marc Dietrich6d54e3d2013-12-21 21:38:12 +0100968 .compatible = "samsung,ltn101nt05",
969 .data = &samsung_ltn101nt05,
970 }, {
Stéphane Marchesin0c934302015-03-18 10:52:18 +0100971 .compatible = "samsung,ltn140at29-301",
972 .data = &samsung_ltn140at29_301,
973 }, {
Boris BREZILLON9c6615b2015-03-19 14:43:00 +0100974 .compatible = "shelly,sca07010-bfn-lnn",
975 .data = &shelly_sca07010_bfn_lnn,
976 }, {
Thierry Reding280921d2013-08-30 15:10:14 +0200977 /* sentinel */
978 }
979};
980MODULE_DEVICE_TABLE(of, platform_of_match);
981
982static int panel_simple_platform_probe(struct platform_device *pdev)
983{
984 const struct of_device_id *id;
985
986 id = of_match_node(platform_of_match, pdev->dev.of_node);
987 if (!id)
988 return -ENODEV;
989
990 return panel_simple_probe(&pdev->dev, id->data);
991}
992
993static int panel_simple_platform_remove(struct platform_device *pdev)
994{
995 return panel_simple_remove(&pdev->dev);
996}
997
Thierry Redingd02fd932014-04-29 17:21:21 +0200998static void panel_simple_platform_shutdown(struct platform_device *pdev)
999{
1000 panel_simple_shutdown(&pdev->dev);
1001}
1002
Thierry Reding280921d2013-08-30 15:10:14 +02001003static struct platform_driver panel_simple_platform_driver = {
1004 .driver = {
1005 .name = "panel-simple",
Thierry Reding280921d2013-08-30 15:10:14 +02001006 .of_match_table = platform_of_match,
1007 },
1008 .probe = panel_simple_platform_probe,
1009 .remove = panel_simple_platform_remove,
Thierry Redingd02fd932014-04-29 17:21:21 +02001010 .shutdown = panel_simple_platform_shutdown,
Thierry Reding280921d2013-08-30 15:10:14 +02001011};
1012
Thierry Reding210fcd92013-11-22 19:27:11 +01001013struct panel_desc_dsi {
1014 struct panel_desc desc;
1015
Thierry Reding462658b2014-03-14 11:24:57 +01001016 unsigned long flags;
Thierry Reding210fcd92013-11-22 19:27:11 +01001017 enum mipi_dsi_pixel_format format;
1018 unsigned int lanes;
1019};
1020
Alexandre Courbot712ac1b2014-01-21 18:57:10 +09001021static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
1022 .clock = 71000,
1023 .hdisplay = 800,
1024 .hsync_start = 800 + 32,
1025 .hsync_end = 800 + 32 + 1,
1026 .htotal = 800 + 32 + 1 + 57,
1027 .vdisplay = 1280,
1028 .vsync_start = 1280 + 28,
1029 .vsync_end = 1280 + 28 + 1,
1030 .vtotal = 1280 + 28 + 1 + 14,
1031 .vrefresh = 60,
1032};
1033
1034static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
1035 .desc = {
1036 .modes = &lg_ld070wx3_sl01_mode,
1037 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +01001038 .bpc = 8,
Alexandre Courbot712ac1b2014-01-21 18:57:10 +09001039 .size = {
1040 .width = 94,
1041 .height = 151,
1042 },
1043 },
Alexandre Courbot5e4cc272014-07-08 21:32:12 +09001044 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
Alexandre Courbot712ac1b2014-01-21 18:57:10 +09001045 .format = MIPI_DSI_FMT_RGB888,
1046 .lanes = 4,
1047};
1048
Alexandre Courbot499ce852014-01-21 18:57:09 +09001049static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
1050 .clock = 67000,
1051 .hdisplay = 720,
1052 .hsync_start = 720 + 12,
1053 .hsync_end = 720 + 12 + 4,
1054 .htotal = 720 + 12 + 4 + 112,
1055 .vdisplay = 1280,
1056 .vsync_start = 1280 + 8,
1057 .vsync_end = 1280 + 8 + 4,
1058 .vtotal = 1280 + 8 + 4 + 12,
1059 .vrefresh = 60,
1060};
1061
1062static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
1063 .desc = {
1064 .modes = &lg_lh500wx1_sd03_mode,
1065 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +01001066 .bpc = 8,
Alexandre Courbot499ce852014-01-21 18:57:09 +09001067 .size = {
1068 .width = 62,
1069 .height = 110,
1070 },
1071 },
1072 .flags = MIPI_DSI_MODE_VIDEO,
1073 .format = MIPI_DSI_FMT_RGB888,
1074 .lanes = 4,
1075};
1076
Thierry Reding280921d2013-08-30 15:10:14 +02001077static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
1078 .clock = 157200,
1079 .hdisplay = 1920,
1080 .hsync_start = 1920 + 154,
1081 .hsync_end = 1920 + 154 + 16,
1082 .htotal = 1920 + 154 + 16 + 32,
1083 .vdisplay = 1200,
1084 .vsync_start = 1200 + 17,
1085 .vsync_end = 1200 + 17 + 2,
1086 .vtotal = 1200 + 17 + 2 + 16,
1087 .vrefresh = 60,
1088};
1089
Thierry Reding210fcd92013-11-22 19:27:11 +01001090static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
1091 .desc = {
1092 .modes = &panasonic_vvx10f004b00_mode,
1093 .num_modes = 1,
Thierry Redingd7a839c2014-11-06 10:11:01 +01001094 .bpc = 8,
Thierry Reding210fcd92013-11-22 19:27:11 +01001095 .size = {
1096 .width = 217,
1097 .height = 136,
1098 },
Thierry Reding280921d2013-08-30 15:10:14 +02001099 },
Alexandre Courbot5e4cc272014-07-08 21:32:12 +09001100 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
1101 MIPI_DSI_CLOCK_NON_CONTINUOUS,
Thierry Reding210fcd92013-11-22 19:27:11 +01001102 .format = MIPI_DSI_FMT_RGB888,
1103 .lanes = 4,
1104};
1105
1106static const struct of_device_id dsi_of_match[] = {
1107 {
Alexandre Courbot712ac1b2014-01-21 18:57:10 +09001108 .compatible = "lg,ld070wx3-sl01",
1109 .data = &lg_ld070wx3_sl01
1110 }, {
Alexandre Courbot499ce852014-01-21 18:57:09 +09001111 .compatible = "lg,lh500wx1-sd03",
1112 .data = &lg_lh500wx1_sd03
1113 }, {
Thierry Reding210fcd92013-11-22 19:27:11 +01001114 .compatible = "panasonic,vvx10f004b00",
1115 .data = &panasonic_vvx10f004b00
1116 }, {
1117 /* sentinel */
1118 }
1119};
1120MODULE_DEVICE_TABLE(of, dsi_of_match);
1121
1122static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
1123{
1124 const struct panel_desc_dsi *desc;
1125 const struct of_device_id *id;
1126 int err;
1127
1128 id = of_match_node(dsi_of_match, dsi->dev.of_node);
1129 if (!id)
1130 return -ENODEV;
1131
1132 desc = id->data;
1133
1134 err = panel_simple_probe(&dsi->dev, &desc->desc);
1135 if (err < 0)
1136 return err;
1137
Thierry Reding462658b2014-03-14 11:24:57 +01001138 dsi->mode_flags = desc->flags;
Thierry Reding210fcd92013-11-22 19:27:11 +01001139 dsi->format = desc->format;
1140 dsi->lanes = desc->lanes;
1141
1142 return mipi_dsi_attach(dsi);
1143}
1144
1145static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
1146{
1147 int err;
1148
1149 err = mipi_dsi_detach(dsi);
1150 if (err < 0)
1151 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
1152
1153 return panel_simple_remove(&dsi->dev);
1154}
1155
Thierry Redingd02fd932014-04-29 17:21:21 +02001156static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
1157{
1158 panel_simple_shutdown(&dsi->dev);
1159}
1160
Thierry Reding210fcd92013-11-22 19:27:11 +01001161static struct mipi_dsi_driver panel_simple_dsi_driver = {
1162 .driver = {
1163 .name = "panel-simple-dsi",
Thierry Reding210fcd92013-11-22 19:27:11 +01001164 .of_match_table = dsi_of_match,
1165 },
1166 .probe = panel_simple_dsi_probe,
1167 .remove = panel_simple_dsi_remove,
Thierry Redingd02fd932014-04-29 17:21:21 +02001168 .shutdown = panel_simple_dsi_shutdown,
Thierry Reding280921d2013-08-30 15:10:14 +02001169};
1170
1171static int __init panel_simple_init(void)
1172{
Thierry Reding210fcd92013-11-22 19:27:11 +01001173 int err;
1174
1175 err = platform_driver_register(&panel_simple_platform_driver);
1176 if (err < 0)
1177 return err;
1178
1179 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
1180 err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
1181 if (err < 0)
1182 return err;
1183 }
1184
1185 return 0;
Thierry Reding280921d2013-08-30 15:10:14 +02001186}
1187module_init(panel_simple_init);
1188
1189static void __exit panel_simple_exit(void)
1190{
Thierry Reding210fcd92013-11-22 19:27:11 +01001191 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
1192 mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
1193
Thierry Reding280921d2013-08-30 15:10:14 +02001194 platform_driver_unregister(&panel_simple_platform_driver);
1195}
1196module_exit(panel_simple_exit);
1197
1198MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1199MODULE_DESCRIPTION("DRM Driver for Simple Panels");
1200MODULE_LICENSE("GPL and additional rights");