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>
36 #include <video/display_timing.h>
37 #include <video/mipi_display.h>
38 #include <video/of_display_timing.h>
39 #include <video/videomode.h>
42 u8 dtype; /* data type */
44 u8 dlen; /* payload len */
48 struct dsi_ctrl_hdr dchdr;
52 struct dsi_panel_cmds {
55 struct dsi_cmd_desc *cmds;
60 const struct drm_display_mode *modes;
61 unsigned int num_modes;
62 const struct display_timing *timings;
63 unsigned int num_timings;
73 * @reset: the time (in milliseconds) indicates the delay time
74 * after the panel to operate reset gpio
75 * @init: the time (in milliseconds) that it takes for the panel to
76 * power on and dsi host can send command to panel
77 * @prepare: the time (in milliseconds) that it takes for the panel to
78 * become ready and start receiving video data
79 * @enable: the time (in milliseconds) that it takes for the panel to
80 * display the first valid frame after starting to receive
82 * @disable: the time (in milliseconds) that it takes for the panel to
83 * turn the display off (no content is visible)
84 * @unprepare: the time (in milliseconds) that it takes for the panel
85 * to power itself down completely
93 unsigned int unprepare;
100 struct drm_panel base;
101 struct mipi_dsi_device *dsi;
106 const struct panel_desc *desc;
108 struct backlight_device *backlight;
109 struct regulator *supply;
110 struct i2c_adapter *ddc;
112 struct gpio_desc *enable_gpio;
113 struct gpio_desc *reset_gpio;
115 struct dsi_panel_cmds *on_cmds;
116 struct dsi_panel_cmds *off_cmds;
119 static inline struct panel_simple *to_panel_simple(struct drm_panel *panel)
121 return container_of(panel, struct panel_simple, base);
124 static void panel_simple_dsi_cmds_cleanup(struct panel_simple *p)
127 kfree(p->on_cmds->buf);
128 kfree(p->on_cmds->cmds);
132 kfree(p->off_cmds->buf);
133 kfree(p->off_cmds->cmds);
137 static int panel_simple_dsi_parse_dcs_cmds(struct device *dev,
138 const u8 *data, int blen,
139 struct dsi_panel_cmds *pcmds)
143 struct dsi_ctrl_hdr *dchdr;
149 buf = kmemdup(data, blen, GFP_KERNEL);
153 /* scan dcs commands */
157 while (len > sizeof(*dchdr)) {
158 dchdr = (struct dsi_ctrl_hdr *)bp;
160 if (dchdr->dlen > len) {
161 dev_err(dev, "%s: error, len=%d", __func__,
166 bp += sizeof(*dchdr);
167 len -= sizeof(*dchdr);
174 dev_err(dev, "%s: dcs_cmd=%x len=%d error!",
175 __func__, buf[0], blen);
180 pcmds->cmds = kcalloc(cnt, sizeof(struct dsi_cmd_desc), GFP_KERNEL);
186 pcmds->cmd_cnt = cnt;
192 for (i = 0; i < cnt; i++) {
193 dchdr = (struct dsi_ctrl_hdr *)bp;
194 len -= sizeof(*dchdr);
195 bp += sizeof(*dchdr);
196 pcmds->cmds[i].dchdr = *dchdr;
197 pcmds->cmds[i].payload = bp;
202 dev_info(dev, "%s: dcs_cmd=%x len=%d, cmd_cnt=%d\n", __func__,
203 pcmds->buf[0], pcmds->blen, pcmds->cmd_cnt);
207 static int panel_simple_dsi_send_cmds(struct panel_simple *panel,
208 struct dsi_panel_cmds *cmds)
210 struct mipi_dsi_device *dsi = panel->dsi;
216 for (i = 0; i < cmds->cmd_cnt; i++) {
217 struct dsi_cmd_desc *cmd = &cmds->cmds[i];
219 switch (cmd->dchdr.dtype) {
220 case MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM:
221 case MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM:
222 case MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM:
223 case MIPI_DSI_GENERIC_LONG_WRITE:
224 err = mipi_dsi_generic_write(dsi, cmd->payload,
227 case MIPI_DSI_DCS_SHORT_WRITE:
228 case MIPI_DSI_DCS_SHORT_WRITE_PARAM:
229 case MIPI_DSI_DCS_LONG_WRITE:
230 err = mipi_dsi_dcs_write_buffer(dsi, cmd->payload,
238 dev_err(panel->dev, "failed to write dcs cmd: %d\n",
242 msleep(cmd->dchdr.wait);
248 static int panel_simple_get_fixed_modes(struct panel_simple *panel)
250 struct drm_connector *connector = panel->base.connector;
251 struct drm_device *drm = panel->base.drm;
252 struct drm_display_mode *mode;
253 unsigned int i, num = 0;
258 for (i = 0; i < panel->desc->num_timings; i++) {
259 const struct display_timing *dt = &panel->desc->timings[i];
262 videomode_from_timing(dt, &vm);
263 mode = drm_mode_create(drm);
265 dev_err(drm->dev, "failed to add mode %ux%u\n",
266 dt->hactive.typ, dt->vactive.typ);
270 drm_display_mode_from_videomode(&vm, mode);
271 drm_mode_set_name(mode);
273 drm_mode_probed_add(connector, mode);
277 for (i = 0; i < panel->desc->num_modes; i++) {
278 const struct drm_display_mode *m = &panel->desc->modes[i];
280 mode = drm_mode_duplicate(drm, m);
282 dev_err(drm->dev, "failed to add mode %ux%u@%u\n",
283 m->hdisplay, m->vdisplay, m->vrefresh);
287 drm_mode_set_name(mode);
289 drm_mode_probed_add(connector, mode);
293 connector->display_info.bpc = panel->desc->bpc;
294 connector->display_info.width_mm = panel->desc->size.width;
295 connector->display_info.height_mm = panel->desc->size.height;
296 if (panel->desc->bus_format)
297 drm_display_info_set_bus_formats(&connector->display_info,
298 &panel->desc->bus_format, 1);
303 static int panel_simple_of_get_native_mode(struct panel_simple *panel)
305 struct drm_connector *connector = panel->base.connector;
306 struct drm_device *drm = panel->base.drm;
307 struct drm_display_mode *mode;
308 struct device_node *timings_np;
311 timings_np = of_get_child_by_name(panel->dev->of_node,
314 dev_dbg(panel->dev, "failed to find display-timings node\n");
318 of_node_put(timings_np);
319 mode = drm_mode_create(drm);
323 ret = of_get_drm_display_mode(panel->dev->of_node, mode,
326 dev_dbg(panel->dev, "failed to find dts display timings\n");
327 drm_mode_destroy(drm, mode);
331 drm_mode_set_name(mode);
332 mode->type |= DRM_MODE_TYPE_PREFERRED;
333 drm_mode_probed_add(connector, mode);
338 static int panel_simple_loader_protect(struct drm_panel *panel, bool on)
340 struct panel_simple *p = to_panel_simple(panel);
344 err = regulator_enable(p->supply);
346 dev_err(panel->dev, "failed to enable supply: %d\n",
351 regulator_disable(p->supply);
357 static int panel_simple_disable(struct drm_panel *panel)
359 struct panel_simple *p = to_panel_simple(panel);
365 p->backlight->props.power = FB_BLANK_POWERDOWN;
366 backlight_update_status(p->backlight);
369 if (p->desc && p->desc->delay.disable)
370 msleep(p->desc->delay.disable);
377 static int panel_simple_unprepare(struct drm_panel *panel)
379 struct panel_simple *p = to_panel_simple(panel);
386 err = panel_simple_dsi_send_cmds(p, p->off_cmds);
388 dev_err(p->dev, "failed to send off cmds\n");
392 gpiod_direction_output(p->reset_gpio, 1);
395 gpiod_direction_output(p->enable_gpio, 0);
397 regulator_disable(p->supply);
399 if (p->desc && p->desc->delay.unprepare)
400 msleep(p->desc->delay.unprepare);
407 static int panel_simple_prepare(struct drm_panel *panel)
409 struct panel_simple *p = to_panel_simple(panel);
415 err = regulator_enable(p->supply);
417 dev_err(panel->dev, "failed to enable supply: %d\n", err);
422 gpiod_direction_output(p->enable_gpio, 1);
424 if (p->desc && p->desc->delay.prepare)
425 msleep(p->desc->delay.prepare);
428 gpiod_direction_output(p->reset_gpio, 1);
430 if (p->desc && p->desc->delay.reset)
431 msleep(p->desc->delay.reset);
434 gpiod_direction_output(p->reset_gpio, 0);
436 if (p->desc && p->desc->delay.init)
437 msleep(p->desc->delay.init);
446 static int panel_simple_enable(struct drm_panel *panel)
448 struct panel_simple *p = to_panel_simple(panel);
454 if (p->desc && p->desc->delay.enable)
455 msleep(p->desc->delay.enable);
458 err = panel_simple_dsi_send_cmds(p, p->on_cmds);
460 dev_err(p->dev, "failed to send on cmds\n");
464 p->backlight->props.power = FB_BLANK_UNBLANK;
465 backlight_update_status(p->backlight);
473 static int panel_simple_get_modes(struct drm_panel *panel)
475 struct panel_simple *p = to_panel_simple(panel);
478 /* add device node plane modes */
479 num += panel_simple_of_get_native_mode(p);
481 /* add hard-coded panel modes */
482 num += panel_simple_get_fixed_modes(p);
484 /* probe EDID if a DDC bus is available */
486 struct edid *edid = drm_get_edid(panel->connector, p->ddc);
487 drm_mode_connector_update_edid_property(panel->connector, edid);
489 num += drm_add_edid_modes(panel->connector, edid);
497 static int panel_simple_get_timings(struct drm_panel *panel,
498 unsigned int num_timings,
499 struct display_timing *timings)
501 struct panel_simple *p = to_panel_simple(panel);
507 if (p->desc->num_timings < num_timings)
508 num_timings = p->desc->num_timings;
511 for (i = 0; i < num_timings; i++)
512 timings[i] = p->desc->timings[i];
514 return p->desc->num_timings;
517 static const struct drm_panel_funcs panel_simple_funcs = {
518 .loader_protect = panel_simple_loader_protect,
519 .disable = panel_simple_disable,
520 .unprepare = panel_simple_unprepare,
521 .prepare = panel_simple_prepare,
522 .enable = panel_simple_enable,
523 .get_modes = panel_simple_get_modes,
524 .get_timings = panel_simple_get_timings,
527 static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
529 struct device_node *backlight, *ddc;
530 struct panel_simple *panel;
531 struct panel_desc *of_desc;
535 panel = devm_kzalloc(dev, sizeof(*panel), GFP_KERNEL);
540 of_desc = devm_kzalloc(dev, sizeof(*of_desc), GFP_KERNEL);
542 of_desc = devm_kmemdup(dev, desc, sizeof(*of_desc), GFP_KERNEL);
544 if (!of_property_read_u32(dev->of_node, "bus-format", &val))
545 of_desc->bus_format = val;
546 if (!of_property_read_u32(dev->of_node, "prepare-delay-ms", &val))
547 of_desc->delay.prepare = val;
548 if (!of_property_read_u32(dev->of_node, "enable-delay-ms", &val))
549 of_desc->delay.enable = val;
550 if (!of_property_read_u32(dev->of_node, "disable-delay-ms", &val))
551 of_desc->delay.disable = val;
552 if (!of_property_read_u32(dev->of_node, "unprepare-delay-ms", &val))
553 of_desc->delay.unprepare = val;
554 if (!of_property_read_u32(dev->of_node, "reset-delay-ms", &val))
555 of_desc->delay.reset = val;
556 if (!of_property_read_u32(dev->of_node, "init-delay-ms", &val))
557 of_desc->delay.init = val;
559 panel->enabled = false;
560 panel->prepared = false;
561 panel->desc = of_desc;
564 panel->supply = devm_regulator_get(dev, "power");
565 if (IS_ERR(panel->supply))
566 return PTR_ERR(panel->supply);
568 panel->enable_gpio = devm_gpiod_get_optional(dev, "enable", 0);
569 if (IS_ERR(panel->enable_gpio)) {
570 err = PTR_ERR(panel->enable_gpio);
571 dev_err(dev, "failed to request enable GPIO: %d\n", err);
575 panel->reset_gpio = devm_gpiod_get_optional(dev, "reset", 0);
576 if (IS_ERR(panel->reset_gpio)) {
577 err = PTR_ERR(panel->reset_gpio);
578 dev_err(dev, "failed to request reset GPIO: %d\n", err);
582 backlight = of_parse_phandle(dev->of_node, "backlight", 0);
584 panel->backlight = of_find_backlight_by_node(backlight);
585 of_node_put(backlight);
587 if (!panel->backlight)
588 return -EPROBE_DEFER;
591 ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
593 panel->ddc = of_find_i2c_adapter_by_node(ddc);
602 drm_panel_init(&panel->base);
603 panel->base.dev = dev;
604 panel->base.funcs = &panel_simple_funcs;
606 err = drm_panel_add(&panel->base);
610 dev_set_drvdata(dev, panel);
616 put_device(&panel->ddc->dev);
618 if (panel->backlight)
619 put_device(&panel->backlight->dev);
624 static int panel_simple_remove(struct device *dev)
626 struct panel_simple *panel = dev_get_drvdata(dev);
628 drm_panel_detach(&panel->base);
629 drm_panel_remove(&panel->base);
631 panel_simple_disable(&panel->base);
634 put_device(&panel->ddc->dev);
636 if (panel->backlight)
637 put_device(&panel->backlight->dev);
639 panel_simple_dsi_cmds_cleanup(panel);
644 static void panel_simple_shutdown(struct device *dev)
646 struct panel_simple *panel = dev_get_drvdata(dev);
648 panel_simple_disable(&panel->base);
651 static const struct drm_display_mode ampire_am800480r3tmqwa1h_mode = {
654 .hsync_start = 800 + 0,
655 .hsync_end = 800 + 0 + 255,
656 .htotal = 800 + 0 + 255 + 0,
658 .vsync_start = 480 + 2,
659 .vsync_end = 480 + 2 + 45,
660 .vtotal = 480 + 2 + 45 + 0,
662 .flags = DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC,
665 static const struct panel_desc ampire_am800480r3tmqwa1h = {
666 .modes = &ire_am800480r3tmqwa1h_mode,
673 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
676 static const struct drm_display_mode auo_b101aw03_mode = {
679 .hsync_start = 1024 + 156,
680 .hsync_end = 1024 + 156 + 8,
681 .htotal = 1024 + 156 + 8 + 156,
683 .vsync_start = 600 + 16,
684 .vsync_end = 600 + 16 + 6,
685 .vtotal = 600 + 16 + 6 + 16,
689 static const struct panel_desc auo_b101aw03 = {
690 .modes = &auo_b101aw03_mode,
699 static const struct drm_display_mode auo_b101ean01_mode = {
702 .hsync_start = 1280 + 119,
703 .hsync_end = 1280 + 119 + 32,
704 .htotal = 1280 + 119 + 32 + 21,
706 .vsync_start = 800 + 4,
707 .vsync_end = 800 + 4 + 20,
708 .vtotal = 800 + 4 + 20 + 8,
712 static const struct panel_desc auo_b101ean01 = {
713 .modes = &auo_b101ean01_mode,
722 static const struct drm_display_mode auo_b101ew05_mode = {
725 .hsync_start = 1280 + 18,
726 .hsync_end = 1280 + 18 + 100,
727 .htotal = 1280 + 18 + 100 + 10,
729 .vsync_start = 800 + 6,
730 .vsync_end = 800 + 6 + 8,
731 .vtotal = 800 + 6 + 8 + 2,
735 static const struct panel_desc auo_b101ew05 = {
736 .modes = &auo_b101ew05_mode,
745 static const struct drm_display_mode auo_b101xtn01_mode = {
748 .hsync_start = 1366 + 20,
749 .hsync_end = 1366 + 20 + 70,
750 .htotal = 1366 + 20 + 70,
752 .vsync_start = 768 + 14,
753 .vsync_end = 768 + 14 + 42,
754 .vtotal = 768 + 14 + 42,
756 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
759 static const struct panel_desc auo_b101xtn01 = {
760 .modes = &auo_b101xtn01_mode,
769 static const struct drm_display_mode auo_b116xw03_mode = {
772 .hsync_start = 1366 + 40,
773 .hsync_end = 1366 + 40 + 40,
774 .htotal = 1366 + 40 + 40 + 32,
776 .vsync_start = 768 + 10,
777 .vsync_end = 768 + 10 + 12,
778 .vtotal = 768 + 10 + 12 + 6,
782 static const struct panel_desc auo_b116xw03 = {
783 .modes = &auo_b116xw03_mode,
792 static const struct drm_display_mode auo_b125han03_mode = {
795 .hsync_start = 1920 + 48,
796 .hsync_end = 1920 + 48 + 32,
797 .htotal = 1920 + 48 + 32 + 140,
799 .vsync_start = 1080 + 2,
800 .vsync_end = 1080 + 2 + 5,
801 .vtotal = 1080 + 2 + 5 + 57,
803 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
806 static const struct panel_desc auo_b125han03 = {
807 .modes = &auo_b125han03_mode,
814 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
817 static const struct drm_display_mode auo_b133xtn01_mode = {
820 .hsync_start = 1366 + 48,
821 .hsync_end = 1366 + 48 + 32,
822 .htotal = 1366 + 48 + 32 + 20,
824 .vsync_start = 768 + 3,
825 .vsync_end = 768 + 3 + 6,
826 .vtotal = 768 + 3 + 6 + 13,
830 static const struct panel_desc auo_b133xtn01 = {
831 .modes = &auo_b133xtn01_mode,
840 static const struct drm_display_mode auo_b133htn01_mode = {
843 .hsync_start = 1920 + 172,
844 .hsync_end = 1920 + 172 + 80,
845 .htotal = 1920 + 172 + 80 + 60,
847 .vsync_start = 1080 + 25,
848 .vsync_end = 1080 + 25 + 10,
849 .vtotal = 1080 + 25 + 10 + 10,
853 static const struct panel_desc auo_b133htn01 = {
854 .modes = &auo_b133htn01_mode,
868 static const struct drm_display_mode avic_tm070ddh03_mode = {
871 .hsync_start = 1024 + 160,
872 .hsync_end = 1024 + 160 + 4,
873 .htotal = 1024 + 160 + 4 + 156,
875 .vsync_start = 600 + 17,
876 .vsync_end = 600 + 17 + 1,
877 .vtotal = 600 + 17 + 1 + 17,
881 static const struct panel_desc avic_tm070ddh03 = {
882 .modes = &avic_tm070ddh03_mode,
896 static const struct drm_display_mode boe_nv125fhm_n73_mode = {
899 .hsync_start = 1366 + 80,
900 .hsync_end = 1366 + 80 + 20,
901 .htotal = 1366 + 80 + 20 + 60,
903 .vsync_start = 768 + 12,
904 .vsync_end = 768 + 12 + 2,
905 .vtotal = 768 + 12 + 2 + 8,
907 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
910 static const struct panel_desc boe_nv125fhm_n73 = {
911 .modes = &boe_nv125fhm_n73_mode,
921 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
924 static const struct drm_display_mode chunghwa_claa070wp03xg_mode = {
927 .hsync_start = 800 + 24,
928 .hsync_end = 800 + 24 + 16,
929 .htotal = 800 + 24 + 16 + 24,
931 .vsync_start = 1280 + 2,
932 .vsync_end = 1280 + 2 + 2,
933 .vtotal = 1280 + 2 + 2 + 4,
937 static const struct panel_desc chunghwa_claa070wp03xg = {
938 .modes = &chunghwa_claa070wp03xg_mode,
947 static const struct drm_display_mode chunghwa_claa101wa01a_mode = {
950 .hsync_start = 1366 + 58,
951 .hsync_end = 1366 + 58 + 58,
952 .htotal = 1366 + 58 + 58 + 58,
954 .vsync_start = 768 + 4,
955 .vsync_end = 768 + 4 + 4,
956 .vtotal = 768 + 4 + 4 + 4,
960 static const struct panel_desc chunghwa_claa101wa01a = {
961 .modes = &chunghwa_claa101wa01a_mode,
970 static const struct drm_display_mode chunghwa_claa101wb01_mode = {
973 .hsync_start = 1366 + 48,
974 .hsync_end = 1366 + 48 + 32,
975 .htotal = 1366 + 48 + 32 + 20,
977 .vsync_start = 768 + 16,
978 .vsync_end = 768 + 16 + 8,
979 .vtotal = 768 + 16 + 8 + 16,
983 static const struct panel_desc chunghwa_claa101wb01 = {
984 .modes = &chunghwa_claa101wb01_mode,
993 static const struct drm_display_mode edt_et057090dhu_mode = {
996 .hsync_start = 640 + 16,
997 .hsync_end = 640 + 16 + 30,
998 .htotal = 640 + 16 + 30 + 114,
1000 .vsync_start = 480 + 10,
1001 .vsync_end = 480 + 10 + 3,
1002 .vtotal = 480 + 10 + 3 + 32,
1004 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1007 static const struct panel_desc edt_et057090dhu = {
1008 .modes = &edt_et057090dhu_mode,
1017 static const struct drm_display_mode edt_etm0700g0dh6_mode = {
1020 .hsync_start = 800 + 40,
1021 .hsync_end = 800 + 40 + 128,
1022 .htotal = 800 + 40 + 128 + 88,
1024 .vsync_start = 480 + 10,
1025 .vsync_end = 480 + 10 + 2,
1026 .vtotal = 480 + 10 + 2 + 33,
1028 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
1031 static const struct panel_desc edt_etm0700g0dh6 = {
1032 .modes = &edt_etm0700g0dh6_mode,
1041 static const struct drm_display_mode foxlink_fl500wvr00_a0t_mode = {
1044 .hsync_start = 800 + 168,
1045 .hsync_end = 800 + 168 + 64,
1046 .htotal = 800 + 168 + 64 + 88,
1048 .vsync_start = 480 + 37,
1049 .vsync_end = 480 + 37 + 2,
1050 .vtotal = 480 + 37 + 2 + 8,
1054 static const struct panel_desc foxlink_fl500wvr00_a0t = {
1055 .modes = &foxlink_fl500wvr00_a0t_mode,
1062 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1065 static const struct drm_display_mode giantplus_gpg482739qs5_mode = {
1068 .hsync_start = 480 + 5,
1069 .hsync_end = 480 + 5 + 1,
1070 .htotal = 480 + 5 + 1 + 40,
1072 .vsync_start = 272 + 8,
1073 .vsync_end = 272 + 8 + 1,
1074 .vtotal = 272 + 8 + 1 + 8,
1078 static const struct panel_desc giantplus_gpg482739qs5 = {
1079 .modes = &giantplus_gpg482739qs5_mode,
1086 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1089 static const struct display_timing hannstar_hsd070pww1_timing = {
1090 .pixelclock = { 64300000, 71100000, 82000000 },
1091 .hactive = { 1280, 1280, 1280 },
1092 .hfront_porch = { 1, 1, 10 },
1093 .hback_porch = { 1, 1, 10 },
1095 * According to the data sheet, the minimum horizontal blanking interval
1096 * is 54 clocks (1 + 52 + 1), but tests with a Nitrogen6X have shown the
1097 * minimum working horizontal blanking interval to be 60 clocks.
1099 .hsync_len = { 58, 158, 661 },
1100 .vactive = { 800, 800, 800 },
1101 .vfront_porch = { 1, 1, 10 },
1102 .vback_porch = { 1, 1, 10 },
1103 .vsync_len = { 1, 21, 203 },
1104 .flags = DISPLAY_FLAGS_DE_HIGH,
1107 static const struct panel_desc hannstar_hsd070pww1 = {
1108 .timings = &hannstar_hsd070pww1_timing,
1115 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
1118 static const struct display_timing hannstar_hsd100pxn1_timing = {
1119 .pixelclock = { 55000000, 65000000, 75000000 },
1120 .hactive = { 1024, 1024, 1024 },
1121 .hfront_porch = { 40, 40, 40 },
1122 .hback_porch = { 220, 220, 220 },
1123 .hsync_len = { 20, 60, 100 },
1124 .vactive = { 768, 768, 768 },
1125 .vfront_porch = { 7, 7, 7 },
1126 .vback_porch = { 21, 21, 21 },
1127 .vsync_len = { 10, 10, 10 },
1128 .flags = DISPLAY_FLAGS_DE_HIGH,
1131 static const struct panel_desc hannstar_hsd100pxn1 = {
1132 .timings = &hannstar_hsd100pxn1_timing,
1139 .bus_format = MEDIA_BUS_FMT_RGB666_1X7X3_SPWG,
1142 static const struct drm_display_mode hitachi_tx23d38vm0caa_mode = {
1145 .hsync_start = 800 + 85,
1146 .hsync_end = 800 + 85 + 86,
1147 .htotal = 800 + 85 + 86 + 85,
1149 .vsync_start = 480 + 16,
1150 .vsync_end = 480 + 16 + 13,
1151 .vtotal = 480 + 16 + 13 + 16,
1155 static const struct panel_desc hitachi_tx23d38vm0caa = {
1156 .modes = &hitachi_tx23d38vm0caa_mode,
1165 static const struct drm_display_mode innolux_at043tn24_mode = {
1168 .hsync_start = 480 + 2,
1169 .hsync_end = 480 + 2 + 41,
1170 .htotal = 480 + 2 + 41 + 2,
1172 .vsync_start = 272 + 2,
1173 .vsync_end = 272 + 2 + 11,
1174 .vtotal = 272 + 2 + 11 + 2,
1176 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
1179 static const struct panel_desc innolux_at043tn24 = {
1180 .modes = &innolux_at043tn24_mode,
1187 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1190 static const struct drm_display_mode innolux_g121i1_l01_mode = {
1193 .hsync_start = 1280 + 64,
1194 .hsync_end = 1280 + 64 + 32,
1195 .htotal = 1280 + 64 + 32 + 64,
1197 .vsync_start = 800 + 9,
1198 .vsync_end = 800 + 9 + 6,
1199 .vtotal = 800 + 9 + 6 + 9,
1203 static const struct panel_desc innolux_g121i1_l01 = {
1204 .modes = &innolux_g121i1_l01_mode,
1213 static const struct drm_display_mode innolux_n116bge_mode = {
1216 .hsync_start = 1366 + 136,
1217 .hsync_end = 1366 + 136 + 30,
1218 .htotal = 1366 + 136 + 30 + 60,
1220 .vsync_start = 768 + 8,
1221 .vsync_end = 768 + 8 + 12,
1222 .vtotal = 768 + 8 + 12 + 12,
1224 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
1227 static const struct panel_desc innolux_n116bge = {
1228 .modes = &innolux_n116bge_mode,
1237 static const struct drm_display_mode innolux_n125hce_mode = {
1240 .hsync_start = 1920 + 80,
1241 .hsync_end = 1920 + 80 + 30,
1242 .htotal = 1920 + 80 + 30 + 50,
1244 .vsync_start = 1080 + 12,
1245 .vsync_end = 1080 + 12 + 4,
1246 .vtotal = 1080 + 12 + 4 + 16,
1248 .flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
1251 static const struct panel_desc innolux_n125hce = {
1252 .modes = &innolux_n125hce_mode,
1263 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1266 static const struct drm_display_mode innolux_n156bge_l21_mode = {
1269 .hsync_start = 1366 + 16,
1270 .hsync_end = 1366 + 16 + 34,
1271 .htotal = 1366 + 16 + 34 + 50,
1273 .vsync_start = 768 + 2,
1274 .vsync_end = 768 + 2 + 6,
1275 .vtotal = 768 + 2 + 6 + 12,
1279 static const struct panel_desc innolux_n156bge_l21 = {
1280 .modes = &innolux_n156bge_l21_mode,
1289 static const struct drm_display_mode innolux_zj070na_01p_mode = {
1292 .hsync_start = 1024 + 128,
1293 .hsync_end = 1024 + 128 + 64,
1294 .htotal = 1024 + 128 + 64 + 128,
1296 .vsync_start = 600 + 16,
1297 .vsync_end = 600 + 16 + 4,
1298 .vtotal = 600 + 16 + 4 + 16,
1302 static const struct panel_desc innolux_zj070na_01p = {
1303 .modes = &innolux_zj070na_01p_mode,
1312 static const struct drm_display_mode lg_lb070wv8_mode = {
1315 .hsync_start = 800 + 88,
1316 .hsync_end = 800 + 88 + 80,
1317 .htotal = 800 + 88 + 80 + 88,
1319 .vsync_start = 480 + 10,
1320 .vsync_end = 480 + 10 + 25,
1321 .vtotal = 480 + 10 + 25 + 10,
1325 static const struct panel_desc lg_lb070wv8 = {
1326 .modes = &lg_lb070wv8_mode,
1333 .bus_format = MEDIA_BUS_FMT_RGB888_1X7X4_SPWG,
1336 static const struct drm_display_mode sharp_lcd_f402_mode = {
1339 .hsync_start = 1536 + 12,
1340 .hsync_end = 1536 + 12 + 48,
1341 .htotal = 1536 + 12 + 48 + 16,
1343 .vsync_start = 2048 + 8,
1344 .vsync_end = 2048 + 8 + 8,
1345 .vtotal = 2048 + 8 + 8 + 4,
1347 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1350 static const struct panel_desc sharp_lcd_f402 = {
1351 .modes = &sharp_lcd_f402_mode,
1358 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1361 static const struct drm_display_mode lg_lp079qx1_sp0v_mode = {
1364 .hsync_start = 1536 + 12,
1365 .hsync_end = 1536 + 12 + 16,
1366 .htotal = 1536 + 12 + 16 + 48,
1368 .vsync_start = 2048 + 8,
1369 .vsync_end = 2048 + 8 + 4,
1370 .vtotal = 2048 + 8 + 4 + 8,
1372 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1375 static const struct panel_desc lg_lp079qx1_sp0v = {
1376 .modes = &lg_lp079qx1_sp0v_mode,
1382 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1385 static const struct drm_display_mode lg_lp097qx1_spa1_mode = {
1388 .hsync_start = 2048 + 150,
1389 .hsync_end = 2048 + 150 + 5,
1390 .htotal = 2048 + 150 + 5 + 5,
1392 .vsync_start = 1536 + 3,
1393 .vsync_end = 1536 + 3 + 1,
1394 .vtotal = 1536 + 3 + 1 + 9,
1398 static const struct panel_desc lg_lp097qx1_spa1 = {
1399 .modes = &lg_lp097qx1_spa1_mode,
1407 static const struct drm_display_mode lg_lp129qe_mode = {
1410 .hsync_start = 2560 + 48,
1411 .hsync_end = 2560 + 48 + 32,
1412 .htotal = 2560 + 48 + 32 + 80,
1414 .vsync_start = 1700 + 3,
1415 .vsync_end = 1700 + 3 + 10,
1416 .vtotal = 1700 + 3 + 10 + 36,
1420 static const struct panel_desc lg_lp129qe = {
1421 .modes = &lg_lp129qe_mode,
1430 static const struct drm_display_mode nec_nl4827hc19_05b_mode = {
1433 .hsync_start = 480 + 2,
1434 .hsync_end = 480 + 2 + 41,
1435 .htotal = 480 + 2 + 41 + 2,
1437 .vsync_start = 272 + 2,
1438 .vsync_end = 272 + 2 + 4,
1439 .vtotal = 272 + 2 + 4 + 2,
1443 static const struct panel_desc nec_nl4827hc19_05b = {
1444 .modes = &nec_nl4827hc19_05b_mode,
1451 .bus_format = MEDIA_BUS_FMT_RGB888_1X24
1454 static const struct display_timing okaya_rs800480t_7x0gp_timing = {
1455 .pixelclock = { 30000000, 30000000, 40000000 },
1456 .hactive = { 800, 800, 800 },
1457 .hfront_porch = { 40, 40, 40 },
1458 .hback_porch = { 40, 40, 40 },
1459 .hsync_len = { 1, 48, 48 },
1460 .vactive = { 480, 480, 480 },
1461 .vfront_porch = { 13, 13, 13 },
1462 .vback_porch = { 29, 29, 29 },
1463 .vsync_len = { 3, 3, 3 },
1464 .flags = DISPLAY_FLAGS_DE_HIGH,
1467 static const struct panel_desc okaya_rs800480t_7x0gp = {
1468 .timings = &okaya_rs800480t_7x0gp_timing,
1481 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1484 static const struct drm_display_mode ortustech_com43h4m85ulc_mode = {
1487 .hsync_start = 480 + 10,
1488 .hsync_end = 480 + 10 + 10,
1489 .htotal = 480 + 10 + 10 + 15,
1491 .vsync_start = 800 + 3,
1492 .vsync_end = 800 + 3 + 3,
1493 .vtotal = 800 + 3 + 3 + 3,
1497 static const struct panel_desc ortustech_com43h4m85ulc = {
1498 .modes = &ortustech_com43h4m85ulc_mode,
1505 .bus_format = MEDIA_BUS_FMT_RGB888_1X24,
1508 static const struct drm_display_mode samsung_lsn122dl01_c01_mode = {
1511 .hsync_start = 2560 + 48,
1512 .hsync_end = 2560 + 48 + 32,
1513 .htotal = 2560 + 48 + 32 + 80,
1515 .vsync_start = 1600 + 2,
1516 .vsync_end = 1600 + 2 + 5,
1517 .vtotal = 1600 + 2 + 5 + 57,
1521 static const struct panel_desc samsung_lsn122dl01_c01 = {
1522 .modes = &samsung_lsn122dl01_c01_mode,
1530 static const struct drm_display_mode samsung_ltn101nt05_mode = {
1533 .hsync_start = 1024 + 24,
1534 .hsync_end = 1024 + 24 + 136,
1535 .htotal = 1024 + 24 + 136 + 160,
1537 .vsync_start = 600 + 3,
1538 .vsync_end = 600 + 3 + 6,
1539 .vtotal = 600 + 3 + 6 + 61,
1543 static const struct panel_desc samsung_ltn101nt05 = {
1544 .modes = &samsung_ltn101nt05_mode,
1553 static const struct drm_display_mode samsung_ltn140at29_301_mode = {
1556 .hsync_start = 1366 + 64,
1557 .hsync_end = 1366 + 64 + 48,
1558 .htotal = 1366 + 64 + 48 + 128,
1560 .vsync_start = 768 + 2,
1561 .vsync_end = 768 + 2 + 5,
1562 .vtotal = 768 + 2 + 5 + 17,
1566 static const struct panel_desc samsung_ltn140at29_301 = {
1567 .modes = &samsung_ltn140at29_301_mode,
1576 static const struct drm_display_mode shelly_sca07010_bfn_lnn_mode = {
1579 .hsync_start = 800 + 1,
1580 .hsync_end = 800 + 1 + 64,
1581 .htotal = 800 + 1 + 64 + 64,
1583 .vsync_start = 480 + 1,
1584 .vsync_end = 480 + 1 + 23,
1585 .vtotal = 480 + 1 + 23 + 22,
1589 static const struct panel_desc shelly_sca07010_bfn_lnn = {
1590 .modes = &shelly_sca07010_bfn_lnn_mode,
1596 .bus_format = MEDIA_BUS_FMT_RGB666_1X18,
1599 static const struct of_device_id platform_of_match[] = {
1601 .compatible = "simple-panel",
1604 .compatible = "ampire,am800480r3tmqwa1h",
1605 .data = &ire_am800480r3tmqwa1h,
1607 .compatible = "auo,b101aw03",
1608 .data = &auo_b101aw03,
1610 .compatible = "auo,b101ean01",
1611 .data = &auo_b101ean01,
1613 .compatible = "auo,b101ew05",
1614 .data = &auo_b101ew05,
1616 .compatible = "auo,b101xtn01",
1617 .data = &auo_b101xtn01,
1619 .compatible = "auo,b116xw03",
1620 .data = &auo_b116xw03,
1622 .compatible = "auo,b125han03",
1623 .data = &auo_b125han03,
1625 .compatible = "auo,b133htn01",
1626 .data = &auo_b133htn01,
1628 .compatible = "auo,b133xtn01",
1629 .data = &auo_b133xtn01,
1631 .compatible = "avic,tm070ddh03",
1632 .data = &avic_tm070ddh03,
1634 .compatible = "boe,nv125fhm-n73",
1635 .data = &boe_nv125fhm_n73,
1637 .compatible = "chunghwa,claa070wp03xg",
1638 .data = &chunghwa_claa070wp03xg,
1640 .compatible = "chunghwa,claa101wa01a",
1641 .data = &chunghwa_claa101wa01a
1643 .compatible = "chunghwa,claa101wb01",
1644 .data = &chunghwa_claa101wb01
1646 .compatible = "edt,et057090dhu",
1647 .data = &edt_et057090dhu,
1649 .compatible = "edt,et070080dh6",
1650 .data = &edt_etm0700g0dh6,
1652 .compatible = "edt,etm0700g0dh6",
1653 .data = &edt_etm0700g0dh6,
1655 .compatible = "foxlink,fl500wvr00-a0t",
1656 .data = &foxlink_fl500wvr00_a0t,
1658 .compatible = "giantplus,gpg482739qs5",
1659 .data = &giantplus_gpg482739qs5
1661 .compatible = "hannstar,hsd070pww1",
1662 .data = &hannstar_hsd070pww1,
1664 .compatible = "hannstar,hsd100pxn1",
1665 .data = &hannstar_hsd100pxn1,
1667 .compatible = "hit,tx23d38vm0caa",
1668 .data = &hitachi_tx23d38vm0caa
1670 .compatible = "innolux,at043tn24",
1671 .data = &innolux_at043tn24,
1673 .compatible ="innolux,g121i1-l01",
1674 .data = &innolux_g121i1_l01
1676 .compatible = "innolux,n116bge",
1677 .data = &innolux_n116bge,
1679 .compatible = "innolux,n125hce",
1680 .data = &innolux_n125hce,
1682 .compatible = "innolux,n156bge-l21",
1683 .data = &innolux_n156bge_l21,
1685 .compatible = "innolux,zj070na-01p",
1686 .data = &innolux_zj070na_01p,
1688 .compatible = "lg,lb070wv8",
1689 .data = &lg_lb070wv8,
1691 .compatible = "lg,lp079qx1-sp0v",
1692 .data = &lg_lp079qx1_sp0v,
1694 .compatible = "sharp,lcd-f402",
1695 .data = &sharp_lcd_f402,
1697 .compatible = "lg,lp097qx1-spa1",
1698 .data = &lg_lp097qx1_spa1,
1700 .compatible = "lg,lp129qe",
1701 .data = &lg_lp129qe,
1703 .compatible = "nec,nl4827hc19-05b",
1704 .data = &nec_nl4827hc19_05b,
1706 .compatible = "okaya,rs800480t-7x0gp",
1707 .data = &okaya_rs800480t_7x0gp,
1709 .compatible = "ortustech,com43h4m85ulc",
1710 .data = &ortustech_com43h4m85ulc,
1712 .compatible = "samsung,lsn122dl01-c01",
1713 .data = &samsung_lsn122dl01_c01,
1715 .compatible = "samsung,ltn101nt05",
1716 .data = &samsung_ltn101nt05,
1718 .compatible = "samsung,ltn140at29-301",
1719 .data = &samsung_ltn140at29_301,
1721 .compatible = "sharp,lcd-f402",
1722 .data = &sharp_lcd_f402,
1724 .compatible = "shelly,sca07010-bfn-lnn",
1725 .data = &shelly_sca07010_bfn_lnn,
1730 MODULE_DEVICE_TABLE(of, platform_of_match);
1732 static int panel_simple_platform_probe(struct platform_device *pdev)
1734 const struct of_device_id *id;
1736 id = of_match_node(platform_of_match, pdev->dev.of_node);
1740 return panel_simple_probe(&pdev->dev, id->data);
1743 static int panel_simple_platform_remove(struct platform_device *pdev)
1745 return panel_simple_remove(&pdev->dev);
1748 static void panel_simple_platform_shutdown(struct platform_device *pdev)
1750 panel_simple_shutdown(&pdev->dev);
1753 static struct platform_driver panel_simple_platform_driver = {
1755 .name = "panel-simple",
1756 .of_match_table = platform_of_match,
1758 .probe = panel_simple_platform_probe,
1759 .remove = panel_simple_platform_remove,
1760 .shutdown = panel_simple_platform_shutdown,
1763 struct panel_desc_dsi {
1764 struct panel_desc desc;
1766 unsigned long flags;
1767 enum mipi_dsi_pixel_format format;
1771 static const struct drm_display_mode auo_b080uan01_mode = {
1774 .hsync_start = 1200 + 62,
1775 .hsync_end = 1200 + 62 + 4,
1776 .htotal = 1200 + 62 + 4 + 62,
1778 .vsync_start = 1920 + 9,
1779 .vsync_end = 1920 + 9 + 2,
1780 .vtotal = 1920 + 9 + 2 + 8,
1784 static const struct panel_desc_dsi auo_b080uan01 = {
1786 .modes = &auo_b080uan01_mode,
1794 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1795 .format = MIPI_DSI_FMT_RGB888,
1799 static const struct drm_display_mode boe_tv080wum_nl0_mode = {
1802 .hsync_start = 1200 + 120,
1803 .hsync_end = 1200 + 120 + 20,
1804 .htotal = 1200 + 120 + 20 + 21,
1806 .vsync_start = 1920 + 21,
1807 .vsync_end = 1920 + 21 + 3,
1808 .vtotal = 1920 + 21 + 3 + 18,
1810 .flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC,
1813 static const struct panel_desc_dsi boe_tv080wum_nl0 = {
1815 .modes = &boe_tv080wum_nl0_mode,
1822 .flags = MIPI_DSI_MODE_VIDEO |
1823 MIPI_DSI_MODE_VIDEO_BURST |
1824 MIPI_DSI_MODE_VIDEO_SYNC_PULSE,
1825 .format = MIPI_DSI_FMT_RGB888,
1829 static const struct drm_display_mode lg_ld070wx3_sl01_mode = {
1832 .hsync_start = 800 + 32,
1833 .hsync_end = 800 + 32 + 1,
1834 .htotal = 800 + 32 + 1 + 57,
1836 .vsync_start = 1280 + 28,
1837 .vsync_end = 1280 + 28 + 1,
1838 .vtotal = 1280 + 28 + 1 + 14,
1842 static const struct panel_desc_dsi lg_ld070wx3_sl01 = {
1844 .modes = &lg_ld070wx3_sl01_mode,
1852 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_CLOCK_NON_CONTINUOUS,
1853 .format = MIPI_DSI_FMT_RGB888,
1857 static const struct drm_display_mode lg_lh500wx1_sd03_mode = {
1860 .hsync_start = 720 + 12,
1861 .hsync_end = 720 + 12 + 4,
1862 .htotal = 720 + 12 + 4 + 112,
1864 .vsync_start = 1280 + 8,
1865 .vsync_end = 1280 + 8 + 4,
1866 .vtotal = 1280 + 8 + 4 + 12,
1870 static const struct panel_desc_dsi lg_lh500wx1_sd03 = {
1872 .modes = &lg_lh500wx1_sd03_mode,
1880 .flags = MIPI_DSI_MODE_VIDEO,
1881 .format = MIPI_DSI_FMT_RGB888,
1885 static const struct drm_display_mode panasonic_vvx10f004b00_mode = {
1888 .hsync_start = 1920 + 154,
1889 .hsync_end = 1920 + 154 + 16,
1890 .htotal = 1920 + 154 + 16 + 32,
1892 .vsync_start = 1200 + 17,
1893 .vsync_end = 1200 + 17 + 2,
1894 .vtotal = 1200 + 17 + 2 + 16,
1898 static const struct panel_desc_dsi panasonic_vvx10f004b00 = {
1900 .modes = &panasonic_vvx10f004b00_mode,
1908 .flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
1909 MIPI_DSI_CLOCK_NON_CONTINUOUS,
1910 .format = MIPI_DSI_FMT_RGB888,
1915 static const struct of_device_id dsi_of_match[] = {
1917 .compatible = "simple-panel-dsi",
1920 .compatible = "auo,b080uan01",
1921 .data = &auo_b080uan01
1923 .compatible = "boe,tv080wum-nl0",
1924 .data = &boe_tv080wum_nl0
1926 .compatible = "lg,ld070wx3-sl01",
1927 .data = &lg_ld070wx3_sl01
1929 .compatible = "lg,lh500wx1-sd03",
1930 .data = &lg_lh500wx1_sd03
1932 .compatible = "panasonic,vvx10f004b00",
1933 .data = &panasonic_vvx10f004b00
1938 MODULE_DEVICE_TABLE(of, dsi_of_match);
1940 static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
1942 struct panel_simple *panel;
1943 const struct panel_desc_dsi *desc;
1944 const struct of_device_id *id;
1945 const struct panel_desc *pdesc;
1951 id = of_match_node(dsi_of_match, dsi->dev.of_node);
1958 dsi->mode_flags = desc->flags;
1959 dsi->format = desc->format;
1960 dsi->lanes = desc->lanes;
1961 pdesc = &desc->desc;
1966 err = panel_simple_probe(&dsi->dev, pdesc);
1970 panel = dev_get_drvdata(&dsi->dev);
1973 if (!of_property_read_u32(dsi->dev.of_node, "dsi,flags", &val))
1974 dsi->mode_flags = val;
1976 if (!of_property_read_u32(dsi->dev.of_node, "dsi,format", &val))
1979 if (!of_property_read_u32(dsi->dev.of_node, "dsi,lanes", &val))
1982 data = of_get_property(dsi->dev.of_node, "panel-init-sequence", &len);
1984 panel->on_cmds = devm_kzalloc(&dsi->dev,
1985 sizeof(*panel->on_cmds),
1987 if (!panel->on_cmds)
1990 err = panel_simple_dsi_parse_dcs_cmds(&dsi->dev, data, len,
1993 dev_err(&dsi->dev, "failed to parse panel init sequence\n");
1998 data = of_get_property(dsi->dev.of_node, "panel-exit-sequence", &len);
2000 panel->off_cmds = devm_kzalloc(&dsi->dev,
2001 sizeof(*panel->off_cmds),
2003 if (!panel->off_cmds)
2006 err = panel_simple_dsi_parse_dcs_cmds(&dsi->dev, data, len,
2009 dev_err(&dsi->dev, "failed to parse panel exit sequence\n");
2014 return mipi_dsi_attach(dsi);
2017 static int panel_simple_dsi_remove(struct mipi_dsi_device *dsi)
2021 err = mipi_dsi_detach(dsi);
2023 dev_err(&dsi->dev, "failed to detach from DSI host: %d\n", err);
2025 return panel_simple_remove(&dsi->dev);
2028 static void panel_simple_dsi_shutdown(struct mipi_dsi_device *dsi)
2030 panel_simple_shutdown(&dsi->dev);
2033 static struct mipi_dsi_driver panel_simple_dsi_driver = {
2035 .name = "panel-simple-dsi",
2036 .of_match_table = dsi_of_match,
2038 .probe = panel_simple_dsi_probe,
2039 .remove = panel_simple_dsi_remove,
2040 .shutdown = panel_simple_dsi_shutdown,
2043 static int __init panel_simple_init(void)
2047 err = platform_driver_register(&panel_simple_platform_driver);
2051 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI)) {
2052 err = mipi_dsi_driver_register(&panel_simple_dsi_driver);
2059 module_init(panel_simple_init);
2061 static void __exit panel_simple_exit(void)
2063 if (IS_ENABLED(CONFIG_DRM_MIPI_DSI))
2064 mipi_dsi_driver_unregister(&panel_simple_dsi_driver);
2066 platform_driver_unregister(&panel_simple_platform_driver);
2068 module_exit(panel_simple_exit);
2070 MODULE_AUTHOR("Thierry Reding <treding@nvidia.com>");
2071 MODULE_DESCRIPTION("DRM Driver for Simple Panels");
2072 MODULE_LICENSE("GPL and additional rights");