linux-sound.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors
@ 2025-08-28  2:21 Kuninori Morimoto
  2025-08-28  2:21 ` [PATCH 1/4] ASoC: renesas: msiof: msiof_update_and_wait() checks whether reg was updated Kuninori Morimoto
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2025-08-28  2:21 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-sound


Hi Mark

Current Renesas MSIOF get unknown error when first used.
This patch-set will fixup this issue.

Kuninori Morimoto (4):
  ASoC: renesas: msiof: msiof_update_and_wait() checks whether reg was updated
  ASoC: renesas: msiof: tidyup error message
  ASoC: renesas: msiof: cleanup status clear method
  ASoC: renesas: msiof: start DMAC first

 sound/soc/renesas/rcar/msiof.c | 34 ++++++++++++++++++++++------------
 1 file changed, 22 insertions(+), 12 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/4] ASoC: renesas: msiof: msiof_update_and_wait() checks whether reg was updated
  2025-08-28  2:21 [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors Kuninori Morimoto
@ 2025-08-28  2:21 ` Kuninori Morimoto
  2025-08-28  2:21 ` [PATCH 2/4] ASoC: renesas: msiof: tidyup error message Kuninori Morimoto
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2025-08-28  2:21 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-sound

msiof_update_and_wait() updates reg and waits until the value was updated.
But, if the set value was same as current reg value, no update will be
happen. Check the value, and ignore waiting if no update.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/renesas/rcar/msiof.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/sound/soc/renesas/rcar/msiof.c b/sound/soc/renesas/rcar/msiof.c
index 36d31ab8ac6a..b7633ed3e3f0 100644
--- a/sound/soc/renesas/rcar/msiof.c
+++ b/sound/soc/renesas/rcar/msiof.c
@@ -82,13 +82,18 @@ struct msiof_priv {
 #define msiof_write(priv, reg, val)	iowrite32(val, (priv)->base + reg)
 #define msiof_status_clear(priv)	msiof_write(priv, SISTR, SISTR_ERR)
 
-static void msiof_update(struct msiof_priv *priv, u32 reg, u32 mask, u32 val)
+static int msiof_update(struct msiof_priv *priv, u32 reg, u32 mask, u32 val)
 {
 	u32 old = msiof_read(priv, reg);
 	u32 new = (old & ~mask) | (val & mask);
+	int updated = false;
 
-	if (old != new)
+	if (old != new) {
 		msiof_write(priv, reg, new);
+		updated = true;
+	}
+
+	return updated;
 }
 
 static void msiof_update_and_wait(struct msiof_priv *priv, u32 reg, u32 mask, u32 val, u32 expect)
@@ -96,7 +101,9 @@ static void msiof_update_and_wait(struct msiof_priv *priv, u32 reg, u32 mask, u3
 	u32 data;
 	int ret;
 
-	msiof_update(priv, reg, mask, val);
+	ret = msiof_update(priv, reg, mask, val);
+	if (!ret) /* no update */
+		return;
 
 	ret = readl_poll_timeout_atomic(priv->base + reg, data,
 					(data & mask) == expect, 1, 128);
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/4] ASoC: renesas: msiof: tidyup error message
  2025-08-28  2:21 [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors Kuninori Morimoto
  2025-08-28  2:21 ` [PATCH 1/4] ASoC: renesas: msiof: msiof_update_and_wait() checks whether reg was updated Kuninori Morimoto
@ 2025-08-28  2:21 ` Kuninori Morimoto
  2025-08-28  2:21 ` [PATCH 3/4] ASoC: renesas: msiof: cleanup status clear method Kuninori Morimoto
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2025-08-28  2:21 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-sound

The meesage was strange. tidyup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/renesas/rcar/msiof.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/renesas/rcar/msiof.c b/sound/soc/renesas/rcar/msiof.c
index b7633ed3e3f0..56bf64e55ba3 100644
--- a/sound/soc/renesas/rcar/msiof.c
+++ b/sound/soc/renesas/rcar/msiof.c
@@ -218,7 +218,7 @@ static int msiof_hw_stop(struct snd_soc_component *component,
 	if (priv->err_syc[substream->stream] ||
 	    priv->err_ovf[substream->stream] ||
 	    priv->err_udf[substream->stream])
-		dev_warn(dev, "FSERR(%s) = %d, FOVF = %d, FUDF = %d\n",
+		dev_warn(dev, "%s: FSERR = %d, FOVF = %d, FUDF = %d\n",
 			 snd_pcm_direction_name(substream->stream),
 			 priv->err_syc[substream->stream],
 			 priv->err_ovf[substream->stream],
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/4] ASoC: renesas: msiof: cleanup status clear method
  2025-08-28  2:21 [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors Kuninori Morimoto
  2025-08-28  2:21 ` [PATCH 1/4] ASoC: renesas: msiof: msiof_update_and_wait() checks whether reg was updated Kuninori Morimoto
  2025-08-28  2:21 ` [PATCH 2/4] ASoC: renesas: msiof: tidyup error message Kuninori Morimoto
@ 2025-08-28  2:21 ` Kuninori Morimoto
  2025-08-28  2:22 ` [PATCH 4/4] ASoC: renesas: msiof: start DMAC first Kuninori Morimoto
  2025-08-28 21:00 ` [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2025-08-28  2:21 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-sound

Current MSIOF driver clear status 1) after starting HW, and 2) clear all
status. But it should be 1') before starting HW, 2') clear necessary
status only. Cleanup it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/renesas/rcar/msiof.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/sound/soc/renesas/rcar/msiof.c b/sound/soc/renesas/rcar/msiof.c
index 56bf64e55ba3..90ca3357392e 100644
--- a/sound/soc/renesas/rcar/msiof.c
+++ b/sound/soc/renesas/rcar/msiof.c
@@ -37,7 +37,6 @@
 /* SISTR */
 #define SISTR_ERR_TX	(SISTR_TFSERR | SISTR_TFOVF | SISTR_TFUDF)
 #define SISTR_ERR_RX	(SISTR_RFSERR | SISTR_RFOVF | SISTR_RFUDF)
-#define SISTR_ERR	(SISTR_ERR_TX | SISTR_ERR_RX)
 
 /*
  * The data on memory in 24bit case is located at <right> side
@@ -80,7 +79,6 @@ struct msiof_priv {
 #define msiof_is_play(substream)	((substream)->stream == SNDRV_PCM_STREAM_PLAYBACK)
 #define msiof_read(priv, reg)		ioread32((priv)->base + reg)
 #define msiof_write(priv, reg, val)	iowrite32(val, (priv)->base + reg)
-#define msiof_status_clear(priv)	msiof_write(priv, SISTR, SISTR_ERR)
 
 static int msiof_update(struct msiof_priv *priv, u32 reg, u32 mask, u32 val)
 {
@@ -174,6 +172,13 @@ static int msiof_hw_start(struct snd_soc_component *component,
 		val = SIIER_RDREQE | SIIER_RDMAE | SISTR_ERR_RX;
 	msiof_update(priv, SIIER, val, val);
 
+	/* clear status */
+	if (is_play)
+		val = SISTR_ERR_TX;
+	else
+		val = SISTR_ERR_RX;
+	msiof_update(priv, SISTR, val, val);
+
 	/* SICTR */
 	if (is_play)
 		val = SICTR_TXE | SICTR_TEDG;
@@ -181,8 +186,6 @@ static int msiof_hw_start(struct snd_soc_component *component,
 		val = SICTR_RXE | SICTR_REDG;
 	msiof_update_and_wait(priv, SICTR, val, val, val);
 
-	msiof_status_clear(priv);
-
 	/* Start DMAC */
 	snd_dmaengine_pcm_trigger(substream, cmd);
 
@@ -439,7 +442,7 @@ static irqreturn_t msiof_interrupt(int irq, void *data)
 	spin_lock(&priv->lock);
 
 	sistr = msiof_read(priv, SISTR);
-	msiof_status_clear(priv);
+	msiof_write(priv, SISTR, SISTR_ERR_TX | SISTR_ERR_RX);
 
 	spin_unlock(&priv->lock);
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/4] ASoC: renesas: msiof: start DMAC first
  2025-08-28  2:21 [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors Kuninori Morimoto
                   ` (2 preceding siblings ...)
  2025-08-28  2:21 ` [PATCH 3/4] ASoC: renesas: msiof: cleanup status clear method Kuninori Morimoto
@ 2025-08-28  2:22 ` Kuninori Morimoto
  2025-08-28 21:00 ` [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Kuninori Morimoto @ 2025-08-28  2:22 UTC (permalink / raw)
  To: Mark Brown; +Cc: linux-sound

MSIOF needs to start DMAC before starting HW.
It will get unknown error at 1st using without this patch.
	Playback: FSERR = 0, FOVF = 0, FUDF = 1
	Capture: FSERR = 1, FOVF = 0, FUDF = 0

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/renesas/rcar/msiof.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/renesas/rcar/msiof.c b/sound/soc/renesas/rcar/msiof.c
index 90ca3357392e..77e1dadec14d 100644
--- a/sound/soc/renesas/rcar/msiof.c
+++ b/sound/soc/renesas/rcar/msiof.c
@@ -136,6 +136,9 @@ static int msiof_hw_start(struct snd_soc_component *component,
 	priv->err_ovf[substream->stream] =
 	priv->err_udf[substream->stream] = 0;
 
+	/* Start DMAC */
+	snd_dmaengine_pcm_trigger(substream, cmd);
+
 	/* SITMDRx */
 	if (is_play) {
 		val = SITMDR1_PCON |
@@ -186,9 +189,6 @@ static int msiof_hw_start(struct snd_soc_component *component,
 		val = SICTR_RXE | SICTR_REDG;
 	msiof_update_and_wait(priv, SICTR, val, val, val);
 
-	/* Start DMAC */
-	snd_dmaengine_pcm_trigger(substream, cmd);
-
 	return 0;
 }
 
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors
  2025-08-28  2:21 [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors Kuninori Morimoto
                   ` (3 preceding siblings ...)
  2025-08-28  2:22 ` [PATCH 4/4] ASoC: renesas: msiof: start DMAC first Kuninori Morimoto
@ 2025-08-28 21:00 ` Mark Brown
  4 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-08-28 21:00 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: linux-sound

On Thu, 28 Aug 2025 02:21:19 +0000, Kuninori Morimoto wrote:
> Current Renesas MSIOF get unknown error when first used.
> This patch-set will fixup this issue.
> 
> Kuninori Morimoto (4):
>   ASoC: renesas: msiof: msiof_update_and_wait() checks whether reg was updated
>   ASoC: renesas: msiof: tidyup error message
>   ASoC: renesas: msiof: cleanup status clear method
>   ASoC: renesas: msiof: start DMAC first
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/4] ASoC: renesas: msiof: msiof_update_and_wait() checks whether reg was updated
      commit: 042e57d59b3e7f44014da23e62911ae9b591953a
[2/4] ASoC: renesas: msiof: tidyup error message
      commit: d3593ac41aaf31db9d6d28cacd584330c769a4a6
[3/4] ASoC: renesas: msiof: cleanup status clear method
      commit: d092b70d7b54321ff481226fe6bc2a6aaa91519f
[4/4] ASoC: renesas: msiof: start DMAC first
      commit: edb5c1f885207d1d74e8a1528e6937e02829ee6e

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-08-28 21:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-28  2:21 [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors Kuninori Morimoto
2025-08-28  2:21 ` [PATCH 1/4] ASoC: renesas: msiof: msiof_update_and_wait() checks whether reg was updated Kuninori Morimoto
2025-08-28  2:21 ` [PATCH 2/4] ASoC: renesas: msiof: tidyup error message Kuninori Morimoto
2025-08-28  2:21 ` [PATCH 3/4] ASoC: renesas: msiof: cleanup status clear method Kuninori Morimoto
2025-08-28  2:22 ` [PATCH 4/4] ASoC: renesas: msiof: start DMAC first Kuninori Morimoto
2025-08-28 21:00 ` [PATCH 0/4] ASoC: renesas: msiof: Make small adjustments to avoid errors Mark Brown

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).