mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-23 20:53:53 +08:00
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) Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102294 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102295 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102359 Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=103186 Cc: Ville Syrjala <ville.syrjala@linux.intel.com> Cc: Imre Deak <imre.deak@intel.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Reviewed-by: Imre Deak <imre.deak@intel.com> Acked-by: Dave Airlie <airlied@gmail.com> Signed-off-by: Shashank Sharma <shashank.sharma@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/1507826408-19322-1-git-send-email-shashank.sharma@intel.com
This commit is contained in:
parent
8f5f63d558
commit
f687e25a7a
@ -410,6 +410,7 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
|
|||||||
{
|
{
|
||||||
u8 data;
|
u8 data;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int retry;
|
||||||
|
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
DRM_ERROR("NULL input\n");
|
DRM_ERROR("NULL input\n");
|
||||||
@ -417,10 +418,19 @@ int drm_lspcon_get_mode(struct i2c_adapter *adapter,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Read Status: i2c over aux */
|
/* Read Status: i2c over aux */
|
||||||
ret = drm_dp_dual_mode_read(adapter, DP_DUAL_MODE_LSPCON_CURRENT_MODE,
|
for (retry = 0; retry < 6; retry++) {
|
||||||
&data, sizeof(data));
|
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) {
|
if (ret < 0) {
|
||||||
DRM_ERROR("LSPCON read(0x80, 0x41) failed\n");
|
DRM_DEBUG_KMS("LSPCON read(0x80, 0x41) failed\n");
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user