drm/rockchip: dw-mipi-dsi: add delay for panel power on
authorxubilv <xbl@rock-chips.com>
Thu, 13 Jul 2017 11:40:00 +0000 (19:40 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Thu, 20 Jul 2017 11:09:36 +0000 (19:09 +0800)
Change-Id: Ife1a3c421dd192fc76b1ff6c84dbfe4afb1b0a54
Signed-off-by: xubilv <xbl@rock-chips.com>
drivers/gpu/drm/panel/panel-simple.c

index 50406eb9f99c950cbf95e831507823d8e03753ae..64eba22c02faa90cc8eccc1149aa03d7ce349521 100644 (file)
@@ -70,6 +70,10 @@ struct panel_desc {
        } size;
 
        /**
+        * @reset: the time (in milliseconds) indicates the delay time
+        *         after the panel to operate reset gpio
+        * @init: the time (in milliseconds) that it takes for the panel to
+        *           power on and dsi host can send command to panel
         * @prepare: the time (in milliseconds) that it takes for the panel to
         *           become ready and start receiving video data
         * @enable: the time (in milliseconds) that it takes for the panel to
@@ -81,6 +85,8 @@ struct panel_desc {
         *             to power itself down completely
         */
        struct {
+               unsigned int reset;
+               unsigned int init;
                unsigned int prepare;
                unsigned int enable;
                unsigned int disable;
@@ -105,7 +111,6 @@ struct panel_simple {
 
        struct gpio_desc *enable_gpio;
        struct gpio_desc *reset_gpio;
-       unsigned int reset_delay;
 
        struct dsi_panel_cmds *on_cmds;
        struct dsi_panel_cmds *off_cmds;
@@ -422,12 +427,15 @@ static int panel_simple_prepare(struct drm_panel *panel)
        if (p->reset_gpio)
                gpiod_direction_output(p->reset_gpio, 1);
 
-       if (p->reset_delay)
-               msleep(p->reset_delay);
+       if (p->desc && p->desc->delay.reset)
+               msleep(p->desc->delay.reset);
 
        if (p->reset_gpio)
                gpiod_direction_output(p->reset_gpio, 0);
 
+       if (p->desc && p->desc->delay.init)
+               msleep(p->desc->delay.init);
+
        if (p->on_cmds) {
                err = panel_simple_dsi_send_cmds(p, p->on_cmds);
                if (err)
@@ -540,6 +548,10 @@ static int panel_simple_probe(struct device *dev, const struct panel_desc *desc)
                of_desc->delay.disable = val;
        if (!of_property_read_u32(dev->of_node, "delay,unprepare", &val))
                of_desc->delay.unprepare = val;
+       if (!of_property_read_u32(dev->of_node, "delay,reset", &val))
+               of_desc->delay.reset = val;
+       if (!of_property_read_u32(dev->of_node, "delay,init", &val))
+               of_desc->delay.init = val;
 
        panel->enabled = false;
        panel->prepared = false;
@@ -1961,9 +1973,6 @@ static int panel_simple_dsi_probe(struct mipi_dsi_device *dsi)
        if (!of_property_read_u32(dsi->dev.of_node, "dsi,lanes", &val))
                dsi->lanes = val;
 
-       if (!of_property_read_u32(dsi->dev.of_node, "reset-delay-ms", &val))
-               panel->reset_delay = val;
-
        data = of_get_property(dsi->dev.of_node, "panel-init-sequence", &len);
        if (data) {
                panel->on_cmds = devm_kzalloc(&dsi->dev,