Skip to content

Commit

Permalink
drm: xlnx: zynqmp_dp: Fix kernel dump messages when the DP cable is d…
Browse files Browse the repository at this point in the history
…isconnected

Below error message is shown when the DP cable is disconnected.

[  108.780458] zynqmp-display fd4a0000.display: failed to write a byte to the DPCD: -19

This error message will confuse the user because the aux channel is not
present after unplugging the cable, so any read / write operation to the
DPCD register will fail.

So adding a drm_dp_dpcd_readb() before we write to the DPCD register. And
if the read fails, skip dpcd_writeb and continue in the function to power
down phy and disable the audio to avoid a false alarm message.

Signed-off-by: Hsuan-Yu Lin <[email protected]>
Reviewed-by: Portia Stephens <[email protected]>
Reviewed-by: Vishal Sagar <[email protected]>
  • Loading branch information
x86driver authored and michalsimek committed Jun 10, 2022
1 parent 96ed0d8 commit fef0aa5
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions drivers/gpu/drm/xlnx/zynqmp_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1649,15 +1649,20 @@ static void zynqmp_dp_encoder_disable(struct drm_encoder *encoder)
struct zynqmp_dp *dp = encoder_to_dp(encoder);
void __iomem *iomem = dp->iomem;
int ret;
u8 pwr;

dp->enabled = false;
cancel_delayed_work(&dp->hpd_work);
zynqmp_dp_write(iomem, ZYNQMP_DP_TX_ENABLE_MAIN_STREAM, 0);
ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, DP_SET_POWER_D3);
if (ret < 0) {
dev_err(dp->dev, "failed to write a byte to the DPCD: %d\n",
ret);
return;
ret = drm_dp_dpcd_readb(&dp->aux, DP_SET_POWER, &pwr);
/* Do write only if read succeeds */
if (ret >= 0) {
ret = drm_dp_dpcd_writeb(&dp->aux, DP_SET_POWER, DP_SET_POWER_D3);
if (ret < 0) {
dev_err(dp->dev, "failed to write a byte to the DPCD: %d\n",
ret);
return;
}
}
zynqmp_dp_write(iomem, ZYNQMP_DP_TX_PHY_POWER_DOWN,
ZYNQMP_DP_TX_PHY_POWER_DOWN_ALL);
Expand Down

0 comments on commit fef0aa5

Please sign in to comment.