Message ID | 1507036865-16122-1-git-send-email-shashank.sharma@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Tue, Oct 03, 2017 at 06:51:04PM +0530, Shashank Sharma wrote: > From the CI builds, its been observed that during a driver > reload/insert, dp dual mode read function sometimes fails to > read from dual mode devices (like LSPCON) 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) > > Cc: Ville Syrjala <ville.syrjala@linux.intel.com> > Cc: Imre Deak <imre.deak@intel.com> > Cc: Jani Nikula <jani.nikula@linux.intel.com> > Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> > --- > drivers/gpu/drm/drm_dp_dual_mode_helper.c | 12 ++++++++++-- > 1 file changed, 10 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/drm_dp_dual_mode_helper.c > index 0ef9011..725b298 100644 > --- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c > +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c > @@ -75,8 +75,16 @@ ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter, > }, > }; > int ret; > + int retry; > + > + for (retry = 0; retry < 6; retry++) { > + if (retry) > + usleep_range(500, 1000); > + ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs)); > + if (ret >= 0) > + break; > + } > > - ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs)); > if (ret < 0) > return ret; > if (ret != ARRAY_SIZE(msgs)) > @@ -420,7 +428,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter, > ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE, > &data, sizeof(data)); > if (ret < 0) { > - DRM_ERROR("LSPCON read(0x80, 0x41) failed\n"); > + DRM_DEBUG_KMS("LSPCON read(0x80, 0x41) failed\n"); > return -EFAULT; > } Ville's comment about the penalty for well working adapters still holds. Also I don't think we should care about possibly faulty external adapters until we see one. So this probably means moving the retry to drm_lspcon_get_mode() and lspcon_probe(). --Imre > > -- > 2.7.4 >
diff --git a/drivers/gpu/drm/drm_dp_dual_mode_helper.c b/drivers/gpu/drm/drm_dp_dual_mode_helper.c index 0ef9011..725b298 100644 --- a/drivers/gpu/drm/drm_dp_dual_mode_helper.c +++ b/drivers/gpu/drm/drm_dp_dual_mode_helper.c @@ -75,8 +75,16 @@ ssize_t drm_dp_dual_mode_read(struct i2c_adapter *adapter, }, }; int ret; + int retry; + + for (retry = 0; retry < 6; retry++) { + if (retry) + usleep_range(500, 1000); + ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs)); + if (ret >= 0) + break; + } - ret = i2c_transfer(adapter, msgs, ARRAY_SIZE(msgs)); if (ret < 0) return ret; if (ret != ARRAY_SIZE(msgs)) @@ -420,7 +428,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter, ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE, &data, sizeof(data)); if (ret < 0) { - DRM_ERROR("LSPCON read(0x80, 0x41) failed\n"); + DRM_DEBUG_KMS("LSPCON read(0x80, 0x41) failed\n"); return -EFAULT; }
From the CI builds, its been observed that during a driver reload/insert, dp dual mode read function sometimes fails to read from dual mode devices (like LSPCON) 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) Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Imre Deak <imre.deak@intel.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> --- drivers/gpu/drm/drm_dp_dual_mode_helper.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)