drm/bridge: dw-hdmi-i2s: reset audio fifo before applying new params
authorJerome Brunet <jbrunet@baylibre.com>
Mon, 12 Aug 2019 12:07:24 +0000 (14:07 +0200)
committerNeil Armstrong <narmstrong@baylibre.com>
Wed, 14 Aug 2019 13:03:28 +0000 (15:03 +0200)
When changing the audio hw params, reset the audio fifo to make sure
any old remaining data is flushed.

The databook mentions that such reset should be followed by a reset of
the i2s block to make sure the samples stay aligned

Reviewed-by: Jonas Karlman <jonas@kwiboo.se>
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190812120726.1528-7-jbrunet@baylibre.com
drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
drivers/gpu/drm/bridge/synopsys/dw-hdmi.h

index 0864dee..41bee00 100644 (file)
@@ -49,6 +49,10 @@ static int dw_hdmi_i2s_hw_params(struct device *dev, void *data,
                return -EINVAL;
        }
 
+       /* Reset the FIFOs before applying new params */
+       hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0);
+       hdmi_write(audio, (u8)~HDMI_MC_SWRSTZ_I2SSWRST_REQ, HDMI_MC_SWRSTZ);
+
        inputclkfs      = HDMI_AUD_INPUTCLKFS_64FS;
        conf0           = HDMI_AUD_CONF0_I2S_ALL_ENABLE;
 
@@ -102,8 +106,6 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data)
        struct dw_hdmi *hdmi = audio->hdmi;
 
        dw_hdmi_audio_disable(hdmi);
-
-       hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0);
 }
 
 static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
index 091d7c2..a272fa3 100644 (file)
@@ -940,6 +940,7 @@ enum {
        HDMI_MC_CLKDIS_PIXELCLK_DISABLE = 0x1,
 
 /* MC_SWRSTZ field values */
+       HDMI_MC_SWRSTZ_I2SSWRST_REQ = 0x08,
        HDMI_MC_SWRSTZ_TMDSSWRST_REQ = 0x02,
 
 /* MC_FLOWCTRL field values */