diff mbox

[v1,1/1] ASoC: rsnd: ssi: Fix issue in dma data address assignment

Message ID 1513832314-29727-1-git-send-email-jiada_wang@mentor.com (mailing list archive)
State New, archived
Headers show

Commit Message

Wang, Jiada Dec. 21, 2017, 4:58 a.m. UTC
From: Jiada Wang <jiada_wang@mentor.com>

Same SSI device may be used in different dai links,
by only having one dma struct in rsnd_ssi, after the first
instance's dma config be initilized, the following instances
can no longer configure dma, this causes issue, when their
dma data address are different from the first instance.

This patch by introduces two dma struct in rdai, each SSI
instance in a dai link is assigned with two dma struct,
to store dma configuration for playback and capture.

Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
 sound/soc/sh/rcar/rsnd.h |    2 ++
 sound/soc/sh/rcar/ssi.c  |    6 +++---
 2 files changed, 5 insertions(+), 3 deletions(-)

Comments

Kuninori Morimoto Dec. 21, 2017, 6:42 a.m. UTC | #1
Hi Jiada

Thank you for your patch

> Same SSI device may be used in different dai links,
> by only having one dma struct in rsnd_ssi, after the first
> instance's dma config be initilized, the following instances
> can no longer configure dma, this causes issue, when their
> dma data address are different from the first instance.
> 
> This patch by introduces two dma struct in rdai, each SSI
> instance in a dai link is assigned with two dma struct,
> to store dma configuration for playback and capture.
> 
> Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
> ---
(snip)
> @@ -876,7 +876,7 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
>  		return ret;
>  
>  	/* SSI probe might be called many times in MUX multi path */
> -	ret = rsnd_dma_attach(io, mod, &ssi->dma);
> +	ret = rsnd_dma_attach(io, mod, &rdai->dma[is_play]);
>  
>  	return ret;
>  }

Some cases, same SSI might be used on different dai links.
In my understanding, it happen if you uses MIXer.
But, are you using same SSI for both playback and capture ??

Best regards
---
Kuninori Morimoto
diff mbox

Patch

diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 57cd2bc..a26156c 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -459,6 +459,8 @@  struct rsnd_dai {
 	unsigned int frm_clk_inv:1;
 	unsigned int sys_delay:1;
 	unsigned int data_alignment:1;
+
+	struct rsnd_mod *dma[2];
 };
 
 #define rsnd_rdai_nr(priv) ((priv)->rdai_nr)
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index fece1e5f..4e97065 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -66,7 +66,6 @@ 
 
 struct rsnd_ssi {
 	struct rsnd_mod mod;
-	struct rsnd_mod *dma;
 
 	u32 flags;
 	u32 cr_own;
@@ -861,7 +860,8 @@  static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
 			      struct rsnd_dai_stream *io,
 			      struct rsnd_priv *priv)
 {
-	struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+	struct rsnd_dai *rdai = rsnd_io_to_rdai(io);
+	int is_play = rsnd_io_is_play(io);
 	int ret;
 
 	/*
@@ -876,7 +876,7 @@  static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
 		return ret;
 
 	/* SSI probe might be called many times in MUX multi path */
-	ret = rsnd_dma_attach(io, mod, &ssi->dma);
+	ret = rsnd_dma_attach(io, mod, &rdai->dma[is_play]);
 
 	return ret;
 }