MLK-18605-13 drm/panel: rm67191: enable 'video-mode' config
authorFancy Fang <chen.fang@nxp.com>
Fri, 13 Jul 2018 11:41:53 +0000 (19:41 +0800)
committerLeonard Crestez <leonard.crestez@nxp.com>
Wed, 17 Apr 2019 23:51:34 +0000 (02:51 +0300)
Try to get the 'video-mode' property from dtb to guide
the required video mode configuration. The possible video
modes are:
0. Burst mode
1. Non-burst mode with sync event
2. Non-burst mode with sync pulse

Signed-off-by: Fancy Fang <chen.fang@nxp.com>
(cherry picked from commit e920436e2174d72eac28f0fb09f1fcdc68add9d9)

drivers/gpu/drm/panel/panel-raydium-rm67191.c

index 74dc68f..940f780 100644 (file)
@@ -544,6 +544,7 @@ static int rad_panel_probe(struct mipi_dsi_device *dsi)
        struct rad_panel *panel;
        struct backlight_properties bl_props;
        int ret;
+       u32 video_mode;
 
        panel = devm_kzalloc(&dsi->dev, sizeof(*panel), GFP_KERNEL);
        if (!panel)
@@ -557,6 +558,27 @@ static int rad_panel_probe(struct mipi_dsi_device *dsi)
        dsi->mode_flags =  MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO |
                           MIPI_DSI_CLOCK_NON_CONTINUOUS;
 
+       ret = of_property_read_u32(np, "video-mode", &video_mode);
+       if (!ret) {
+               switch (video_mode) {
+               case 0:
+                       /* burst mode */
+                       dsi->mode_flags |= MIPI_DSI_MODE_VIDEO_BURST;
+                       break;
+               case 1:
+                       /* non-burst mode with sync event */
+                       break;
+               case 2:
+                       /* non-burst mode with sync pulse */
+                       dsi->mode_flags |= MIPI_DSI_MODE_VIDEO_SYNC_PULSE;
+                       break;
+               default:
+                       dev_warn(dev, "invalid video mode %d\n", video_mode);
+                       break;
+
+               }
+       }
+
        ret = of_property_read_u32(np, "dsi-lanes", &dsi->lanes);
        if (ret < 0) {
                dev_err(dev, "Failed to get dsi-lanes property (%d)\n", ret);