drm/msm/dsi-staging: turn gpio off if panel reset fails
Fix error path to undo gpio changes if panel reset fails.
Change-Id: I753215fb10651dbe2adbef730d8ef31ee5f32eac
Signed-off-by: Lloyd Atkinson <latkinso@codeaurora.org>
diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c
index a060861..fbe6f1b 100644
--- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c
+++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c
@@ -185,7 +185,7 @@
rc = dsi_pwr_enable_regulator(&panel->power_info, true);
if (rc) {
pr_err("[%s] failed to enable vregs, rc=%d\n", panel->name, rc);
- goto error;
+ goto exit;
}
rc = dsi_panel_set_pinctrl_state(panel, true);
@@ -197,16 +197,24 @@
rc = dsi_panel_reset(panel);
if (rc) {
pr_err("[%s] failed to reset panel, rc=%d\n", panel->name, rc);
- goto error_disable_pinctrl;
+ goto error_disable_gpio;
}
- /* TODO: backlight */
- goto error;
-error_disable_pinctrl:
+ goto exit;
+
+error_disable_gpio:
+ if (gpio_is_valid(panel->reset_config.disp_en_gpio))
+ gpio_set_value(panel->reset_config.disp_en_gpio, 0);
+
+ if (gpio_is_valid(panel->bl_config.en_gpio))
+ gpio_set_value(panel->bl_config.en_gpio, 0);
+
(void)dsi_panel_set_pinctrl_state(panel, false);
+
error_disable_vregs:
(void)dsi_pwr_enable_regulator(&panel->power_info, false);
-error:
+
+exit:
return rc;
}
@@ -217,9 +225,6 @@
if (gpio_is_valid(panel->reset_config.disp_en_gpio))
gpio_set_value(panel->reset_config.disp_en_gpio, 0);
- if (gpio_is_valid(panel->reset_config.disp_en_gpio))
- gpio_set_value(panel->reset_config.disp_en_gpio, 0);
-
if (gpio_is_valid(panel->reset_config.reset_gpio))
gpio_set_value(panel->reset_config.reset_gpio, 0);