linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jerome Brunet <jbrunet@baylibre.com>
To: Andrzej Hajda <a.hajda@samsung.com>,
	Neil Armstrong <narmstrong@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: [PATCH v2 6/8] drm/bridge: dw-hdmi-i2s: reset audio fifo before applying new params
Date: Mon, 12 Aug 2019 14:07:24 +0200	[thread overview]
Message-ID: <20190812120726.1528-7-jbrunet@baylibre.com> (raw)
In-Reply-To: <20190812120726.1528-1-jbrunet@baylibre.com>

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>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 6 ++++--
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.h           | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
index 0864dee8d180..41bee0099578 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
@@ -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,
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h
index 091d7c28aa17..a272fa393ae6 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.h
@@ -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 */
-- 
2.21.0


  parent reply	other threads:[~2019-08-12 12:08 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12 12:07 [PATCH v2 0/8] drm/bridge: dw-hdmi: improve i2s support Jerome Brunet
2019-08-12 12:07 ` [PATCH v2 1/8] drm/bridge: dw-hdmi-i2s: support more i2s format Jerome Brunet
2019-08-12 12:07 ` [PATCH v2 2/8] drm/bridge: dw-hdmi: move audio channel setup out of ahb Jerome Brunet
2019-08-12 12:07 ` [PATCH v2 3/8] drm/bridge: dw-hdmi: set channel count in the infoframes Jerome Brunet
2019-08-12 12:07 ` [PATCH v2 4/8] drm/bridge: dw-hdmi-i2s: enable lpcm multi channels Jerome Brunet
2019-08-12 12:07 ` [PATCH v2 5/8] drm/bridge: dw-hdmi-i2s: set the channel allocation Jerome Brunet
2019-08-12 12:07 ` Jerome Brunet [this message]
2019-08-12 12:07 ` [PATCH v2 7/8] drm/bridge: dw-hdmi-i2s: enable only the required i2s lanes Jerome Brunet
2019-08-12 12:07 ` [PATCH v2 8/8] drm/bridge: dw-hdmi-i2s: add .get_eld support Jerome Brunet
2019-08-12 12:50   ` [RESEND PATCH " Jerome Brunet
2019-08-14 10:08     ` Jonas Karlman
2019-08-14 13:05       ` Neil Armstrong
2019-08-12 12:19 ` [PATCH v2 0/8] drm/bridge: dw-hdmi: improve i2s support Neil Armstrong
2019-08-12 12:35   ` Jerome Brunet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190812120726.1528-7-jbrunet@baylibre.com \
    --to=jbrunet@baylibre.com \
    --cc=a.hajda@samsung.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jonas@kwiboo.se \
    --cc=khilman@baylibre.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=narmstrong@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).