drm/bridge: dw-hdmi: Restore audio when setting a mode
diff mbox series

Message ID 20191001010020.122134-1-cychiang@chromium.org
State New
Headers show
  • drm/bridge: dw-hdmi: Restore audio when setting a mode
Related show

Commit Message

Cheng-yi Chiang Oct. 1, 2019, 1 a.m. UTC
From: Daniel Kurtz <djkurtz@chromium.org>

When setting a new display mode, dw_hdmi_setup() calls
dw_hdmi_enable_video_path(), which disables all hdmi clocks, including
the audio clock.

We should only (re-)enable the audio clock if audio was already enabled
when setting the new mode.

Without this patch, on RK3288, there will be HDMI audio on some monitors
if i2s was played to headphone when the monitor was plugged.
ACER H277HU and ASUS PB278 are two of the monitors showing this issue.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index aa7efd4da1c8..c60e951122c9 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -1982,6 +1982,15 @@  static void hdmi_disable_overflow_interrupts(struct dw_hdmi *hdmi)
+static void dw_hdmi_audio_restore(struct dw_hdmi *hdmi)
+	mutex_lock(&hdmi->audio_mutex);
+	hdmi_enable_audio_clk(hdmi, hdmi->audio_enable);
+	mutex_unlock(&hdmi->audio_mutex);
 static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
 	int ret;
@@ -2045,7 +2054,7 @@  static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
 		/* HDMI Initialization Step E - Configure audio */
-		hdmi_enable_audio_clk(hdmi, true);
+		dw_hdmi_audio_restore(hdmi);
 	/* not for DVI mode */