2 * Copyright (C) 2013, NVIDIA Corporation. All rights reserved.
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:
11 * The above copyright notice and this permission notice (including the
12 * next paragraph) shall be included in all copies or substantial portions
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.
24 #include <linux/backlight.h>
25 #include <linux/gpio/consumer.h>
26 #include <linux/module.h>
27 #include <linux/of_platform.h>
28 #include <linux/platform_device.h>
29 #include <linux/regulator/consumer.h>
32 #include <drm/drm_crtc.h>
33 #include <drm/drm_mipi_dsi.h>
34 #include <drm/drm_panel.h>
37 const struct drm_display_mode
*modes
;
38 unsigned int num_modes
;
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
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
62 unsigned int unprepare
;
69 struct drm_panel base
;
73 const struct panel_desc
*desc
;
75 struct backlight_device
*backlight
;
76 struct regulator
*supply
;
77 struct i2c_adapter
*ddc
;
79 struct gpio_desc
*enable_gpio
;
82 static inline struct panel_simple
*to_panel_simple(struct drm_panel
*panel
)
84 return container_of(panel
, struct panel_simple
, base
);
87 static int panel_simple_get_fixed_modes(struct panel_simple
*panel
)
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;
97 for (i
= 0; i
< panel
->desc
->num_modes
; i
++) {
98 const struct drm_display_mode
*m
= &panel
->desc
->modes
[i
];
100 mode
= drm_mode_duplicate(drm
, m
);
102 dev_err(drm
->dev
, "failed to add mode %ux%u@%u\n",
103 m
->hdisplay
, m
->vdisplay
, m
->vrefresh
);
107 drm_mode_set_name(mode
);
109 drm_mode_probed_add(connector
, mode
);
113 connector
->display_info
.bpc
= panel
->desc
->bpc
;
114 connector
->display_info
.width_mm
= panel
->desc
->size
.width
;
115 connector
->display_info
.height_mm
= panel
->desc
->size
.height
;
116 if (panel
->desc
->bus_format
)
117 drm_display_info_set_bus_formats(&connector
->display_info
,
118 &panel
->desc
->bus_format
, 1);
123 static int panel_simple_disable(struct drm_panel
*panel
)
125 struct panel_simple
*p
= to_panel_simple(panel
);
131 p
->backlight
->props
.power
= FB_BLANK_POWERDOWN
;
132 backlight_update_status(p
->backlight
);
135 if (p
->desc
->delay
.disable
)
136 msleep(p
->desc
->delay
.disable
);
143 static int panel_simple_unprepare(struct drm_panel
*panel
)
145 struct panel_simple
*p
= to_panel_simple(panel
);
151 gpiod_set_value_cansleep(p
->enable_gpio
, 0);
153 regulator_disable(p
->supply
);
155 if (p
->desc
->delay
.unprepare
)
156 msleep(p
->desc
->delay
.unprepare
);
163 static int panel_simple_prepare(struct drm_panel
*panel
)
165 struct panel_simple
*p
= to_panel_simple(panel
);
171 err
= regulator_enable(p
->supply
);
173 dev_err(panel
->dev
, "failed to enable supply: %d\n", err
);
178 gpiod_set_value_cansleep(p
->enable_gpio
, 1);
180 if (p
->desc
->delay
.prepare
)
181 msleep(p
->desc
->delay
.prepare
);
188 static int panel_simple_enable(struct drm_panel
*panel
)
190 struct panel_simple
*p
= to_panel_simple(panel
);
195 if (p
->desc
->delay
.enable
)
196 msleep(p
->desc
->delay
.enable
);
199 p
->backlight
->props
.power
= FB_BLANK_UNBLANK
;
200 backlight_update_status(p
->backlight
);
208 static int panel_simple_get_modes(struct drm_panel
*panel
)
210 struct panel_simple
*p
= to_panel_simple(panel
);
213 /* probe EDID if a DDC bus is available */
215 struct edid
*edid
= drm_get_edid(panel
->connector
, p
->ddc
);
216 drm_mode_connector_update_edid_property(panel
->connector
, edid
);
218 num
+= drm_add_edid_modes(panel
->connector
, edid
);
223 /* add hard-coded panel modes */
224 num
+= panel_simple_get_fixed_modes(p
);
229 static const struct drm_panel_funcs panel_simple_funcs
= {
230 .disable
= panel_simple_disable
,
231 .unprepare
= panel_simple_unprepare
,
232 .prepare
= panel_simple_prepare
,
233 .enable
= panel_simple_enable
,
234 .get_modes
= panel_simple_get_modes
,
237 static int panel_simple_probe(struct device
*dev
, const struct panel_desc
*desc
)
239 struct device_node
*backlight
, *ddc
;
240 struct panel_simple
*panel
;
243 panel
= devm_kzalloc(dev
, sizeof(*panel
), GFP_KERNEL
);
247 panel
->enabled
= false;
248 panel
->prepared
= false;
251 panel
->supply
= devm_regulator_get(dev
, "power");
252 if (IS_ERR(panel
->supply
))
253 return PTR_ERR(panel
->supply
);
255 panel
->enable_gpio
= devm_gpiod_get_optional(dev
, "enable",
257 if (IS_ERR(panel
->enable_gpio
)) {
258 err
= PTR_ERR(panel
->enable_gpio
);
259 dev_err(dev
, "failed to request GPIO: %d\n", err
);
263 backlight
= of_parse_phandle(dev
->of_node
, "backlight", 0);
265 panel
->backlight
= of_find_backlight_by_node(backlight
);
266 of_node_put(backlight
);
268 if (!panel
->backlight
)
269 return -EPROBE_DEFER
;
272 ddc
= of_parse_phandle(dev
->of_node
, "ddc-i2c-bus", 0);
274 panel
->ddc
= of_find_i2c_adapter_by_node(ddc
);
283 drm_panel_init(&panel
->base
);
284 panel
->base
.dev
= dev
;
285 panel
->base
.funcs
= &panel_simple_funcs
;
287 err
= drm_panel_add(&panel
->base
);
291 dev_set_drvdata(dev
, panel
);
297 put_device(&panel
->ddc
->dev
);
299 if (panel
->backlight
)
300 put_device(&panel
->backlight
->dev
);
305 static int panel_simple_remove(struct device
*dev
)
307 struct panel_simple
*panel
= dev_get_drvdata(dev
);
309 drm_panel_detach(&panel
->base
);
310 drm_panel_remove(&panel
->base
);
312 panel_simple_disable(&panel
->base
);
315 put_device(&panel
->ddc
->dev
);
317 if (panel
->backlight
)
318 put_device(&panel
->backlight
->dev
);
323 static void panel_simple_shutdown(struct device
*dev
)
325 struct panel_simple
*panel
= dev_get_drvdata(dev
);
327 panel_simple_disable(&panel
->base
);
330 static const struct drm_display_mode auo_b101aw03_mode
= {
333 .hsync_start
= 1024 + 156,
334 .hsync_end
= 1024 + 156 + 8,
335 .htotal
= 1024 + 156 + 8 + 156,
337 .vsync_start
= 600 + 16,
338 .vsync_end
= 600 + 16 + 6,
339 .vtotal
= 600 + 16 + 6 + 16,
343 static const struct panel_desc auo_b101aw03
= {
344 .modes
= &auo_b101aw03_mode
,
353 static const struct drm_display_mode auo_b101xtn01_mode
= {
356 .hsync_start
= 1366 + 20,
357 .hsync_end
= 1366 + 20 + 70,
358 .htotal
= 1366 + 20 + 70,
360 .vsync_start
= 768 + 14,
361 .vsync_end
= 768 + 14 + 42,
362 .vtotal
= 768 + 14 + 42,
364 .flags
= DRM_MODE_FLAG_NVSYNC
| DRM_MODE_FLAG_NHSYNC
,
367 static const struct panel_desc auo_b101xtn01
= {
368 .modes
= &auo_b101xtn01_mode
,
377 static const struct drm_display_mode auo_b116xw03_mode
= {
380 .hsync_start
= 1366 + 40,
381 .hsync_end
= 1366 + 40 + 40,
382 .htotal
= 1366 + 40 + 40 + 32,
384 .vsync_start
= 768 + 10,
385 .vsync_end
= 768 + 10 + 12,
386 .vtotal
= 768 + 10 + 12 + 6,
390 static const struct panel_desc auo_b116xw03
= {
391 .modes
= &auo_b116xw03_mode
,
400 static const struct drm_display_mode auo_b133xtn01_mode
= {
403 .hsync_start
= 1366 + 48,
404 .hsync_end
= 1366 + 48 + 32,
405 .htotal
= 1366 + 48 + 32 + 20,
407 .vsync_start
= 768 + 3,
408 .vsync_end
= 768 + 3 + 6,
409 .vtotal
= 768 + 3 + 6 + 13,
413 static const struct panel_desc auo_b133xtn01
= {
414 .modes
= &auo_b133xtn01_mode
,
423 static const struct drm_display_mode auo_b133htn01_mode
= {
426 .hsync_start
= 1920 + 172,
427 .hsync_end
= 1920 + 172 + 80,
428 .htotal
= 1920 + 172 + 80 + 60,
430 .vsync_start
= 1080 + 25,
431 .vsync_end
= 1080 + 25 + 10,
432 .vtotal
= 1080 + 25 + 10 + 10,
436 static const struct panel_desc auo_b133htn01
= {
437 .modes
= &auo_b133htn01_mode
,
451 static const struct drm_display_mode avic_tm070ddh03_mode
= {
454 .hsync_start
= 1024 + 160,
455 .hsync_end
= 1024 + 160 + 4,
456 .htotal
= 1024 + 160 + 4 + 156,
458 .vsync_start
= 600 + 17,
459 .vsync_end
= 600 + 17 + 1,
460 .vtotal
= 600 + 17 + 1 + 17,
464 static const struct panel_desc avic_tm070ddh03
= {
465 .modes
= &avic_tm070ddh03_mode
,
479 static const struct drm_display_mode chunghwa_claa101wa01a_mode
= {
482 .hsync_start
= 1366 + 58,
483 .hsync_end
= 1366 + 58 + 58,
484 .htotal
= 1366 + 58 + 58 + 58,
486 .vsync_start
= 768 + 4,
487 .vsync_end
= 768 + 4 + 4,
488 .vtotal
= 768 + 4 + 4 + 4,
492 static const struct panel_desc chunghwa_claa101wa01a
= {
493 .modes
= &chunghwa_claa101wa01a_mode
,
502 static const struct drm_display_mode chunghwa_claa101wb01_mode
= {
505 .hsync_start
= 1366 + 48,
506 .hsync_end
= 1366 + 48 + 32,
507 .htotal
= 1366 + 48 + 32 + 20,
509 .vsync_start
= 768 + 16,
510 .vsync_end
= 768 + 16 + 8,
511 .vtotal
= 768 + 16 + 8 + 16,
515 static const struct panel_desc chunghwa_claa101wb01
= {
516 .modes
= &chunghwa_claa101wb01_mode
,
525 static const struct drm_display_mode edt_et057090dhu_mode
= {
528 .hsync_start
= 640 + 16,
529 .hsync_end
= 640 + 16 + 30,
530 .htotal
= 640 + 16 + 30 + 114,
532 .vsync_start
= 480 + 10,
533 .vsync_end
= 480 + 10 + 3,
534 .vtotal
= 480 + 10 + 3 + 32,
536 .flags
= DRM_MODE_FLAG_NVSYNC
| DRM_MODE_FLAG_NHSYNC
,
539 static const struct panel_desc edt_et057090dhu
= {
540 .modes
= &edt_et057090dhu_mode
,
549 static const struct drm_display_mode edt_etm0700g0dh6_mode
= {
552 .hsync_start
= 800 + 40,
553 .hsync_end
= 800 + 40 + 128,
554 .htotal
= 800 + 40 + 128 + 88,
556 .vsync_start
= 480 + 10,
557 .vsync_end
= 480 + 10 + 2,
558 .vtotal
= 480 + 10 + 2 + 33,
560 .flags
= DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
,
563 static const struct panel_desc edt_etm0700g0dh6
= {
564 .modes
= &edt_etm0700g0dh6_mode
,
573 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode
= {
576 .hsync_start
= 800 + 168,
577 .hsync_end
= 800 + 168 + 64,
578 .htotal
= 800 + 168 + 64 + 88,
580 .vsync_start
= 480 + 37,
581 .vsync_end
= 480 + 37 + 2,
582 .vtotal
= 480 + 37 + 2 + 8,
586 static const struct panel_desc foxlink_fl500wvr00_a0t
= {
587 .modes
= &foxlink_fl500wvr00_a0t_mode
,
594 .bus_format
= MEDIA_BUS_FMT_RGB888_1X24
,
597 static const struct drm_display_mode giantplus_gpg482739qs5_mode
= {
600 .hsync_start
= 480 + 5,
601 .hsync_end
= 480 + 5 + 1,
602 .htotal
= 480 + 5 + 1 + 40,
604 .vsync_start
= 272 + 8,
605 .vsync_end
= 272 + 8 + 1,
606 .vtotal
= 272 + 8 + 1 + 8,
610 static const struct panel_desc giantplus_gpg482739qs5
= {
611 .modes
= &giantplus_gpg482739qs5_mode
,
620 static const struct drm_display_mode hannstar_hsd070pww1_mode
= {
623 .hsync_start
= 1280 + 1,
624 .hsync_end
= 1280 + 1 + 158,
625 .htotal
= 1280 + 1 + 158 + 1,
627 .vsync_start
= 800 + 1,
628 .vsync_end
= 800 + 1 + 21,
629 .vtotal
= 800 + 1 + 21 + 1,
633 static const struct panel_desc hannstar_hsd070pww1
= {
634 .modes
= &hannstar_hsd070pww1_mode
,
643 static const struct drm_display_mode hitachi_tx23d38vm0caa_mode
= {
646 .hsync_start
= 800 + 85,
647 .hsync_end
= 800 + 85 + 86,
648 .htotal
= 800 + 85 + 86 + 85,
650 .vsync_start
= 480 + 16,
651 .vsync_end
= 480 + 16 + 13,
652 .vtotal
= 480 + 16 + 13 + 16,
656 static const struct panel_desc hitachi_tx23d38vm0caa
= {
657 .modes
= &hitachi_tx23d38vm0caa_mode
,
666 static const struct drm_display_mode innolux_g121i1_l01_mode
= {
669 .hsync_start
= 1280 + 64,
670 .hsync_end
= 1280 + 64 + 32,
671 .htotal
= 1280 + 64 + 32 + 64,
673 .vsync_start
= 800 + 9,
674 .vsync_end
= 800 + 9 + 6,
675 .vtotal
= 800 + 9 + 6 + 9,
679 static const struct panel_desc innolux_g121i1_l01
= {
680 .modes
= &innolux_g121i1_l01_mode
,
689 static const struct drm_display_mode innolux_n116bge_mode
= {
692 .hsync_start
= 1366 + 136,
693 .hsync_end
= 1366 + 136 + 30,
694 .htotal
= 1366 + 136 + 30 + 60,
696 .vsync_start
= 768 + 8,
697 .vsync_end
= 768 + 8 + 12,
698 .vtotal
= 768 + 8 + 12 + 12,
700 .flags
= DRM_MODE_FLAG_NHSYNC
| DRM_MODE_FLAG_NVSYNC
,
703 static const struct panel_desc innolux_n116bge
= {
704 .modes
= &innolux_n116bge_mode
,
713 static const struct drm_display_mode innolux_n156bge_l21_mode
= {
716 .hsync_start
= 1366 + 16,
717 .hsync_end
= 1366 + 16 + 34,
718 .htotal
= 1366 + 16 + 34 + 50,
720 .vsync_start
= 768 + 2,
721 .vsync_end
= 768 + 2 + 6,
722 .vtotal
= 768 + 2 + 6 + 12,
726 static const struct panel_desc innolux_n156bge_l21
= {
727 .modes
= &innolux_n156bge_l21_mode
,
736 static const struct drm_display_mode lg_lp129qe_mode
= {
739 .hsync_start
= 2560 + 48,
740 .hsync_end
= 2560 + 48 + 32,
741 .htotal
= 2560 + 48 + 32 + 80,
743 .vsync_start
= 1700 + 3,
744 .vsync_end
= 1700 + 3 + 10,
745 .vtotal
= 1700 + 3 + 10 + 36,
749 static const struct panel_desc lg_lp129qe
= {
750 .modes
= &lg_lp129qe_mode
,
759 static const struct drm_display_mode samsung_ltn101nt05_mode
= {
762 .hsync_start
= 1024 + 24,
763 .hsync_end
= 1024 + 24 + 136,
764 .htotal
= 1024 + 24 + 136 + 160,
766 .vsync_start
= 600 + 3,
767 .vsync_end
= 600 + 3 + 6,
768 .vtotal
= 600 + 3 + 6 + 61,
772 static const struct panel_desc samsung_ltn101nt05
= {
773 .modes
= &samsung_ltn101nt05_mode
,
782 static const struct of_device_id platform_of_match
[] = {
784 .compatible
= "auo,b101aw03",
785 .data
= &auo_b101aw03
,
787 .compatible
= "auo,b101xtn01",
788 .data
= &auo_b101xtn01
,
790 .compatible
= "auo,b116xw03",
791 .data
= &auo_b116xw03
,
793 .compatible
= "auo,b133htn01",
794 .data
= &auo_b133htn01
,
796 .compatible
= "auo,b133xtn01",
797 .data
= &auo_b133xtn01
,
799 .compatible
= "avic,tm070ddh03",
800 .data
= &avic_tm070ddh03
,
802 .compatible
= "chunghwa,claa101wa01a",
803 .data
= &chunghwa_claa101wa01a
805 .compatible
= "chunghwa,claa101wb01",
806 .data
= &chunghwa_claa101wb01
808 .compatible
= "edt,et057090dhu",
809 .data
= &edt_et057090dhu
,
811 .compatible
= "edt,et070080dh6",
812 .data
= &edt_etm0700g0dh6
,
814 .compatible
= "edt,etm0700g0dh6",
815 .data
= &edt_etm0700g0dh6
,
817 .compatible
= "foxlink,fl500wvr00-a0t",
818 .data
= &foxlink_fl500wvr00_a0t
,
820 .compatible
= "giantplus,gpg482739qs5",
821 .data
= &giantplus_gpg482739qs5
823 .compatible
= "hannstar,hsd070pww1",
824 .data
= &hannstar_hsd070pww1
,
826 .compatible
= "hit,tx23d38vm0caa",
827 .data
= &hitachi_tx23d38vm0caa
829 .compatible
="innolux,g121i1-l01",
830 .data
= &innolux_g121i1_l01
832 .compatible
= "innolux,n116bge",
833 .data
= &innolux_n116bge
,
835 .compatible
= "innolux,n156bge-l21",
836 .data
= &innolux_n156bge_l21
,
838 .compatible
= "lg,lp129qe",
841 .compatible
= "samsung,ltn101nt05",
842 .data
= &samsung_ltn101nt05
,
847 MODULE_DEVICE_TABLE(of
, platform_of_match
);
849 static int panel_simple_platform_probe(struct platform_device
*pdev
)
851 const struct of_device_id
*id
;
853 id
= of_match_node(platform_of_match
, pdev
->dev
.of_node
);
857 return panel_simple_probe(&pdev
->dev
, id
->data
);
860 static int panel_simple_platform_remove(struct platform_device
*pdev
)
862 return panel_simple_remove(&pdev
->dev
);
865 static void panel_simple_platform_shutdown(struct platform_device
*pdev
)
867 panel_simple_shutdown(&pdev
->dev
);
870 static struct platform_driver panel_simple_platform_driver
= {
872 .name
= "panel-simple",
873 .of_match_table
= platform_of_match
,
875 .probe
= panel_simple_platform_probe
,
876 .remove
= panel_simple_platform_remove
,
877 .shutdown
= panel_simple_platform_shutdown
,
880 struct panel_desc_dsi
{
881 struct panel_desc desc
;
884 enum mipi_dsi_pixel_format format
;
888 static const struct drm_display_mode lg_ld070wx3_sl01_mode
= {
891 .hsync_start
= 800 + 32,
892 .hsync_end
= 800 + 32 + 1,
893 .htotal
= 800 + 32 + 1 + 57,
895 .vsync_start
= 1280 + 28,
896 .vsync_end
= 1280 + 28 + 1,
897 .vtotal
= 1280 + 28 + 1 + 14,
901 static const struct panel_desc_dsi lg_ld070wx3_sl01
= {
903 .modes
= &lg_ld070wx3_sl01_mode
,
911 .flags
= MIPI_DSI_MODE_VIDEO
| MIPI_DSI_CLOCK_NON_CONTINUOUS
,
912 .format
= MIPI_DSI_FMT_RGB888
,
916 static const struct drm_display_mode lg_lh500wx1_sd03_mode
= {
919 .hsync_start
= 720 + 12,
920 .hsync_end
= 720 + 12 + 4,
921 .htotal
= 720 + 12 + 4 + 112,
923 .vsync_start
= 1280 + 8,
924 .vsync_end
= 1280 + 8 + 4,
925 .vtotal
= 1280 + 8 + 4 + 12,
929 static const struct panel_desc_dsi lg_lh500wx1_sd03
= {
931 .modes
= &lg_lh500wx1_sd03_mode
,
939 .flags
= MIPI_DSI_MODE_VIDEO
,
940 .format
= MIPI_DSI_FMT_RGB888
,
944 static const struct drm_display_mode panasonic_vvx10f004b00_mode
= {
947 .hsync_start
= 1920 + 154,
948 .hsync_end
= 1920 + 154 + 16,
949 .htotal
= 1920 + 154 + 16 + 32,
951 .vsync_start
= 1200 + 17,
952 .vsync_end
= 1200 + 17 + 2,
953 .vtotal
= 1200 + 17 + 2 + 16,
957 static const struct panel_desc_dsi panasonic_vvx10f004b00
= {
959 .modes
= &panasonic_vvx10f004b00_mode
,
967 .flags
= MIPI_DSI_MODE_VIDEO
| MIPI_DSI_MODE_VIDEO_SYNC_PULSE
|
968 MIPI_DSI_CLOCK_NON_CONTINUOUS
,
969 .format
= MIPI_DSI_FMT_RGB888
,
973 static const struct of_device_id dsi_of_match
[] = {
975 .compatible
= "lg,ld070wx3-sl01",
976 .data
= &lg_ld070wx3_sl01
978 .compatible
= "lg,lh500wx1-sd03",
979 .data
= &lg_lh500wx1_sd03
981 .compatible
= "panasonic,vvx10f004b00",
982 .data
= &panasonic_vvx10f004b00
987 MODULE_DEVICE_TABLE(of
, dsi_of_match
);
989 static int panel_simple_dsi_probe(struct mipi_dsi_device
*dsi
)
991 const struct panel_desc_dsi
*desc
;
992 const struct of_device_id
*id
;
995 id
= of_match_node(dsi_of_match
, dsi
->dev
.of_node
);
1001 err
= panel_simple_probe(&dsi
->dev
, &desc
->desc
);
1005 dsi
->mode_flags
= desc
->flags
;
1006 dsi
->format
= desc
->format
;
1007 dsi
->lanes
= desc
->lanes
;
1009 return mipi_dsi_attach(dsi
);
1012 static int panel_simple_dsi_remove(struct mipi_dsi_device
*dsi
)
1016 err
= mipi_dsi_detach(dsi
);
1018 dev_err(&dsi
->dev
, "failed to detach from DSI host: %d\n", err
);
1020 return panel_simple_remove(&dsi
->dev
);
1023 static void panel_simple_dsi_shutdown(struct mipi_dsi_device
*dsi
)
1025 panel_simple_shutdown(&dsi
->dev
);
1028 static struct mipi_dsi_driver panel_simple_dsi_driver
= {
1030 .name
= "panel-simple-dsi",
1031 .of_match_table
= dsi_of_match
,
1033 .probe
= panel_simple_dsi_probe
,
1034 .remove
= panel_simple_dsi_remove
,
1035 .shutdown
= panel_simple_dsi_shutdown
,
1038 static int __init
panel_simple_init(void)
1042 err
= platform_driver_register(&panel_simple_platform_driver
);
1046 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI
)) {
1047 err
= mipi_dsi_driver_register(&panel_simple_dsi_driver
);
1054 module_init(panel_simple_init
);
1056 static void __exit
panel_simple_exit(void)
1058 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI
))
1059 mipi_dsi_driver_unregister(&panel_simple_dsi_driver
);
1061 platform_driver_unregister(&panel_simple_platform_driver
);
1063 module_exit(panel_simple_exit
);
1065 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
1066 MODULE_DESCRIPTION("DRM Driver for Simple Panels");
1067 MODULE_LICENSE("GPL and additional rights");