Skip to content

Commit

Permalink
drm/msm/dp: retry 3 times if set sink to D0 poweer state failed
Browse files Browse the repository at this point in the history
Bring sink out of D3 (power down) mode into D0 (normal operation) mode
by setting DP_SET_POWER_D0 bit to DP_SET_POWER dpcd register. This
patch will retry 3 times if written to DP_SET_POWER register failed.

Changes in v5:
-- split into two patches

Signed-off-by: Kuogee Hsieh <quic_khsieh@quicinc.com>
Patchwork: https://patchwork.freedesktop.org/patch/502536/
Link: https://lore.kernel.org/r/1662999830-13916-4-git-send-email-quic_khsieh@quicinc.com
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
  • Loading branch information
Kuogee Hsieh authored and Dmitry Baryshkov committed Nov 2, 2022
1 parent d54c518 commit af309c0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions drivers/gpu/drm/msm/dp/dp_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ static int dp_aux_link_power_up(struct drm_dp_aux *aux,
{
u8 value;
ssize_t len;
int i;

if (link->revision < 0x11)
return 0;
Expand All @@ -61,11 +62,13 @@ static int dp_aux_link_power_up(struct drm_dp_aux *aux,
value &= ~DP_SET_POWER_MASK;
value |= DP_SET_POWER_D0;

len = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
if (len < 0)
return len;

usleep_range(1000, 2000);
/* retry for 1ms to give the sink time to wake up */
for (i = 0; i < 3; i++) {
len = drm_dp_dpcd_writeb(aux, DP_SET_POWER, value);
usleep_range(1000, 2000);
if (len == 1)
break;
}

return 0;
}
Expand Down

0 comments on commit af309c0

Please sign in to comment.