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

From: jiada_wang
Date: Wed Dec 20 2017 - 23:58:51 EST


From: Jiada Wang <jiada_wang@xxxxxxxxxx>

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@xxxxxxxxxx>
---
sound/soc/sh/rcar/rsnd.h | 2 ++
sound/soc/sh/rcar/ssi.c | 6 +++---
2 files changed, 5 insertions(+), 3 deletions(-)

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;
}
--
1.7.9.5