drm: Add retries for lspcon mode detection
Subsystems (2)
PATCH v4 1/3 drm: Add retries for lspcon mode detection
From the CI builds, its been observed that during a driver reload/insert, dp dual mode read function sometimes fails to read from LSPCON device over i2c-over-aux channel.
This patch:
- adds some delay and few retries, allowing a scope for these devices to settle down and respond.
- changes one error log's level from ERROR->DEBUG as we want to call it an error only after all the retries are exhausted.
V2: Addressed review comments from Jani (for loop for retry)
V3: Addressed review comments from Imre (break on partial read too)
V3: Addressed review comments from Ville/Imre (Add the retries
exclusively for LSPCON, not for all dp_dual_mode devices)
V4: Added r-b from Imre, sending it to dri-devel (Jani)
--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/drm_dp_dual_mode_helper.c +13 -3
@@ -410,6 +410,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter, {u8 data;int ret =0 ; +int retry;if (!mode) {DRM_ERROR ("NULL input\n" );
@@ -417,10 +418,19 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter, }/* Read Status: i2c over aux */ - ret =drm_dp_dual_mode_read (adapter,DP_DUAL_MODE_LSPCON_CURRENT_MODE , - &data,sizeof (data)); +for (retry =0 ; retry <6 ; retry++) { +if (retry) +usleep_range (500 ,1000 ); + + ret =drm_dp_dual_mode_read (adapter, +DP_DUAL_MODE_LSPCON_CURRENT_MODE , + &data,sizeof (data)); +if (!ret) +break ; + } +if (ret <0 ) { -DRM_ERROR ("LSPCON read(0x80, 0x41) failed\n" ); +DRM_DEBUG_KMS ("LSPCON read(0x80, 0x41) failed\n" );return -EFAULT ; }
Signature · 6 lines
2.7.4 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 16 lines · Shashank Sharma
From the CI builds, its been observed that during a driver reload/insert, dp dual mode read function sometimes fails to read from LSPCON device over i2c-over-aux channel.
This patch:
- adds some delay and few retries, allowing a scope for these devices to settle down and respond.
- changes one error log's level fromERROR->DEBUGas we want to call it an error only after all the retries are exhausted.V2: Addressed review comments from Jani (for loop for retry)
V3: Addressed review comments from Imre (break on partial read too)
V3: Addressed review comments from Ville/Imre (Add the retries
exclusively for LSPCON, not for alldp_dual_modedevices)
V4: Added r-b from Imre, sending it to dri-devel (Jani)
Quoted 6 lines
Cc Ville Syrjala <[email protected]>Cc Imre Deak <[email protected]>Cc Jani Nikula <[email protected]>Reviewed-by Imre Deak <[email protected]>Signed-off-by Shashank Sharma <[email protected]>
Pushed via drm-intel with Dave's IRC ack. Thanks for the patch and review.
BR,
Jani.
Quoted 38 lines
--- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)drivers/gpu/drm/drm_dp_dual_mode_helper.c +13
-3@@ -410,6 +410,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter, {u8 data;int ret =0 ; +int retry;if (!mode) {DRM_ERROR ("NULL input\n" );@@ -417,10 +418,19 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter, }/* Read Status: i2c over aux */ - ret =drm_dp_dual_mode_read (adapter,DP_DUAL_MODE_LSPCON_CURRENT_MODE , - &data,sizeof (data)); +for (retry =0 ; retry <6 ; retry++) { +if (retry) +usleep_range (500 ,1000 ); + + ret =drm_dp_dual_mode_read (adapter, +DP_DUAL_MODE_LSPCON_CURRENT_MODE , + &data,sizeof (data)); +if (!ret) +break ; + } +if (ret <0 ) { -DRM_ERROR ("LSPCON read(0x80, 0x41) failed\n" ); +DRM_DEBUG_KMS ("LSPCON read(0x80, 0x41) failed\n" );return -EFAULT ; }
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx