[Intel-gfx] [PATCH] drm/i915: Retry few time if gpiod_get fails during intel_dsi_init

Shobhit Kumar shobhit.kumar at intel.com
Tue Jan 19 07:15:00 PST 2016

INTEL_SOC_PMIC is loading later than I915 failing the gpiod_get and
pwm_get calls in i915. Add a retry to give time for the INTEL_SOC_PMIC
to load. This was fine till now but broke in latest kernel. Maybe load
time for the INTEL_SOC_PMIC has increased.

Since the lookup tables for GPIO (panel enable) and PWM both are
exported by same intel_soc_pmic driver, just retrying for the driver to
load in intel_dsi_init is sufficient. By the time we come to
setup_backlight, pwm would have been exported as well.

Signed-off-by: Shobhit Kumar <shobhit.kumar at intel.com>
 drivers/gpu/drm/i915/intel_dsi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
index 91cef35..e309ef6 100644
--- a/drivers/gpu/drm/i915/intel_dsi.c
+++ b/drivers/gpu/drm/i915/intel_dsi.c
@@ -1192,10 +1192,14 @@ void intel_dsi_init(struct drm_device *dev)
 	 * Panel control.
 	if (dev_priv->vbt.dsi.config->pwm_blc == PPS_BLC_PMIC) {
+		int retry = 4;
+		do {
 		intel_dsi->gpio_panel =
 			gpiod_get(dev->dev, "panel", GPIOD_OUT_HIGH);
+			msleep(50);
+		} while (IS_ERR(intel_dsi->gpio_panel) && --retry);
-		if (IS_ERR(intel_dsi->gpio_panel)) {
+		if (!retry) {
 			DRM_ERROR("Failed to own gpio for panel control\n");
 			intel_dsi->gpio_panel = NULL;

More information about the Intel-gfx mailing list