Skip to contentSkip to conversation

drm/i915: Retry few time if gpiod_get fails during intel_dsi_init

PATCH In review Shobhit Kumar 4 participants 6 messages Jan 19, 2016 – Jan 20, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Retry few time if gpiod_get fails during intel_dsi_init

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.

---
 drivers/gpu/drm/i915/intel_dsi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +5 -1
index 91cef35..e309ef6 100644
@@ -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;
 		}
Signature · 6 lines
1.9.1

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 9 lines · Shobhit Kumar

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.

Maybe we should play with initcalls here but I was not sure how it will impact if I change it for PMIC driver. IIRC, this discussion came up from Daniel at the time of original patches also but somehow did not close decidedly and has come back as a regression.

Regards
Shobhit

Quoted 17 lines
---
  drivers/gpu/drm/i915/intel_dsi.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -0
index 91cef35..e309ef6 100644
@@ -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 {

drivers/gpu/drm/i915/intel_dsi.c void intel_dsi_init(struct drm_device *dev) · line 1205

Quoted 10 lines
drivers/gpu/drm/i915/intel_dsi.c +3 -1
  		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;
  		}

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 11 lines · Shobhit
Quoted 9 lines · Shobhit Kumar

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.

Quoted 4 lines

Maybe we should play with initcalls here but I was not sure how it will impact if I change it for PMIC driver. IIRC, this discussion came up from Daniel at the time of original patches also but somehow did not close decidedly and has come back as a regression.

The correct way to handle this is to bail out with -EPROBE_DEFER. This is how this is meant to be, no amount of random retrying will fix this properly for such dynamic inter-module depencies.

And yes this is going to be a world-class test for our module load unwind code.
-Daniel

Quoted 34 lines

Regards
Shobhit

Quoted 17 lines
---
 drivers/gpu/drm/i915/intel_dsi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -0
index 91cef35..e309ef6 100644
@@ -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 {

drivers/gpu/drm/i915/intel_dsi.c void intel_dsi_init(struct drm_device *dev) · line 1205

Quoted 10 lines
drivers/gpu/drm/i915/intel_dsi.c +3 -1
 		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;
 		}

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Shobhit
Quoted 9 lines · Shobhit Kumar

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.

Quoted 8 lines
Quoted 4 lines

Maybe we should play with initcalls here but I was not sure how it will impact if I change it for PMIC driver. IIRC, this discussion came up from Daniel at the time of original patches also but somehow did not close decidedly and has come back as a regression.

The correct way to handle this is to bail out with -EPROBE_DEFER. This is how this is meant to be, no amount of random retrying will fix this properly for such dynamic inter-module depencies.

Yeah, you are right, retries are working pretty randomly. I made a quick changes all the way up to i915_driver_load returning -EPROBE_DEFER form intel_setup_outputs and it seems to work.

Quoted 3 lines

And yes this is going to be a world-class test for our module load unwind code.

Well it seems to be working :) Will have a cleaned up patch for review. Also need to take care of this in the LPSS_PWM patches as well.

Regards
Shobhit

Quoted 37 lines

-Daniel

Quoted 34 lines

Regards
Shobhit

Quoted 17 lines
---
  drivers/gpu/drm/i915/intel_dsi.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_dsi.c +2 -0
index 91cef35..e309ef6 100644
@@ -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 {

drivers/gpu/drm/i915/intel_dsi.c void intel_dsi_init(struct drm_device *dev) · line 1205

Quoted 10 lines
drivers/gpu/drm/i915/intel_dsi.c +3 -1
  		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;
  		}

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 28 lines · Shobhit
Quoted 12 lines · Daniel Vetter
Quoted 11 lines · Shobhit
Quoted 9 lines · Shobhit Kumar

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.

Quoted 8 lines
Quoted 4 lines

Maybe we should play with initcalls here but I was not sure how it will impact if I change it for PMIC driver. IIRC, this discussion came up from Daniel at the time of original patches also but somehow did not close decidedly and has come back as a regression.

The correct way to handle this is to bail out with -EPROBE_DEFER. This is how this is meant to be, no amount of random retrying will fix this properly for such dynamic inter-module depencies.

Yeah, you are right, retries are working pretty randomly. I made a quick changes all the way up to i915_driver_load returning -EPROBE_DEFER form intel_setup_outputs and it seems to work.

Quoted 1 line
Quoted 5 lines
Quoted 2 lines

And yes this is going to be a world-class test for our module load unwind code.

Well it seems to be working :) Will have a cleaned up patch for review. Also need to take care of this in the LPSS_PWM patches as well.

You're extremely lucky then I'd say. Let's see whether CI agrees and then merge this ;-)

Cheers, Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#5 lore raw

✓ Fi.CI.BAT: success for drm/i915: Retry few time if gpiod_get fails during intel_dsi_init

In reply to Shobhit Kumar
== Summary ==

== Summary ==

Built on 20c388faff9d8c41ab27e825c685526561b892a2 drm-intel-nightly: 2016y-01m-19d-13h-31m-46s UTC integration manifest

Test gem_storedw_loop:

        Subgroup basic-render:
                dmesg-warn -> PASS       (skl-i5k-2) UNSTABLE
bdw-nuci7        total:140  pass:131  dwarn:0   dfail:0   fail:0   skip:9  
bsw-nuc-2        total:143  pass:117  dwarn:2   dfail:0   fail:0   skip:24 
byt-nuc          total:143  pass:125  dwarn:3   dfail:0   fail:0   skip:15 
hsw-brixbox      total:143  pass:136  dwarn:0   dfail:0   fail:0   skip:7  
hsw-gt2          total:143  pass:139  dwarn:0   dfail:0   fail:0   skip:4  
ilk-hp8440p      total:143  pass:102  dwarn:3   dfail:0   fail:0   skip:38 
skl-i5k-2        total:143  pass:134  dwarn:1   dfail:0   fail:0   skip:8  
snb-dellxps      total:143  pass:124  dwarn:5   dfail:0   fail:0   skip:14 
snb-x220t        total:143  pass:124  dwarn:5   dfail:0   fail:1   skip:13 

Results at /archive/results/CI_IGT_test/Patchwork_1222/

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx