From: <jiada_wang@mentor.com>
To: <lgirdwood@gmail.com>, <broonie@kernel.org>, <perex@perex.cz>,
<tiwai@suse.com>, <kuninori.morimoto.gx@renesas.com>
Cc: <jiada_wang@mentor.com>, <twischer@de.adit-jv.com>,
<dragos_tarcatu@mentor.com>, <alsa-devel@alsa-project.org>,
<linux-kernel@vger.kernel.org>
Subject: [PATCH linux-next 10/10] ASoC: rsnd: Add kctrl to configure dai's busif
Date: Thu, 27 Sep 2018 14:12:29 +0900 [thread overview]
Message-ID: <20180927051229.18080-1-jiada_wang@mentor.com> (raw)
From: Jiada Wang <jiada_wang@mentor.com>
ssi0, ssi1, ssi2, ssi3, ssi4 and ssi9 have busif0 to busif7,
currently only busif0 is used by all ssi.
But tdm split and tdm ex-split mode, which require busif1 to
busif7.
This patch adds kctrl in ssi for dai-link, to make it possible
to configure the busif used by each dai-link.
Also adds rsnd_dma_addr_update() interface to make it possible
to update dma data address when there is change in condition
of dai connection.
Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
---
sound/soc/sh/rcar/dma.c | 32 ++++++++++++++++++++++++++++++++
sound/soc/sh/rcar/rsnd.h | 2 ++
sound/soc/sh/rcar/ssi.c | 31 ++++++++++++++++++++++++++++++-
3 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index 6d1947515dc8..8c284fd73fc1 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -792,6 +792,38 @@ int rsnd_dma_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod,
return rsnd_dai_connect(*dma_mod, io, (*dma_mod)->type);
}
+void rsnd_dma_addr_update(struct rsnd_dai_stream *io,
+ struct rsnd_mod *mod,
+ struct rsnd_mod *dma_mod)
+{
+ struct rsnd_mod *mod_from = NULL;
+ struct rsnd_mod *mod_to = NULL;
+ struct rsnd_priv *priv = rsnd_io_to_priv(io);
+ struct rsnd_dma_ctrl *dmac = rsnd_priv_to_dmac(priv);
+ struct device *dev = rsnd_priv_to_dev(priv);
+ int is_play = rsnd_io_is_play(io);
+ struct rsnd_dma *dma = rsnd_mod_to_dma(dma_mod);
+
+ if (!dmac)
+ return;
+
+ rsnd_dma_of_path(mod, io, is_play, &mod_from, &mod_to);
+
+ dma->src_addr = rsnd_dma_addr(io, mod_from, is_play, 1);
+ dma->dst_addr = rsnd_dma_addr(io, mod_to, is_play, 0);
+
+ if (mod_from && mod_to) {
+ struct rsnd_dmapp *dmapp = rsnd_dma_to_dmapp(dma);
+
+ dmapp->chcr = rsnd_dmapp_get_chcr(io, mod_from, mod_to) |
+ PDMACHCR_DE;
+ }
+
+ dev_dbg(dev, "%s[%d] %pad -> %pad\n",
+ rsnd_mod_name(mod), rsnd_mod_id(mod),
+ &dma->src_addr, &dma->dst_addr);
+}
+
int rsnd_dma_probe(struct rsnd_priv *priv)
{
struct platform_device *pdev = rsnd_priv_to_pdev(priv);
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 59b6d89d8edc..6c16d8403f7a 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -233,6 +233,8 @@ u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, struct rsnd_mod *mod);
*/
int rsnd_dma_attach(struct rsnd_dai_stream *io,
struct rsnd_mod *mod, struct rsnd_mod **dma_mod);
+void rsnd_dma_addr_update(struct rsnd_dai_stream *io,
+ struct rsnd_mod *mod, struct rsnd_mod *dma_mod);
int rsnd_dma_probe(struct rsnd_priv *priv);
struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node,
struct rsnd_mod *mod, char *name);
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 4ac4b5b75ae2..b469db238697 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -160,6 +160,15 @@ int rsnd_ssi_get_busif(struct rsnd_dai_stream *io)
return io->busif->val;
}
+static void rsnd_ssi_set_busif(struct rsnd_dai_stream *io,
+ struct rsnd_mod *mod)
+{
+ if (!rsnd_ssi_use_busif(io))
+ return;
+
+ rsnd_dma_addr_update(io, mod, io->dma);
+}
+
static void rsnd_ssi_status_clear(struct rsnd_mod *mod)
{
rsnd_mod_write(mod, SSISR, 0);
@@ -718,6 +727,10 @@ static int rsnd_ssi_pcm_new(struct rsnd_mod *mod,
struct rsnd_dai_stream *io,
struct snd_soc_pcm_runtime *rtd)
{
+ int is_play = rsnd_io_is_play(io);
+ int id = rsnd_mod_id(mod);
+ int ret = 0;
+
/*
* rsnd_rdai_is_clk_master() will be enabled after set_fmt,
* and, pcm_new will be called after it.
@@ -725,7 +738,23 @@ static int rsnd_ssi_pcm_new(struct rsnd_mod *mod,
*/
rsnd_ssi_parent_attach(mod, io);
- return 0;
+ if (!rsnd_ssi_use_busif(io))
+ return 0;
+
+ if (rsnd_ssi_is_multi_slave(mod, io))
+ return 0;
+
+ /* SSI5 to SSI8 only have one BUSIF */
+ if (id <= 4 || id == 9)
+ ret = rsnd_kctrl_new_s(mod, io, rtd,
+ is_play ?
+ "SSI Out BUSIF" :
+ "SSI In BUSIF",
+ rsnd_kctrl_accept_anytime,
+ rsnd_ssi_set_busif,
+ io->busif, 7);
+
+ return ret;
}
static int rsnd_ssi_common_probe(struct rsnd_mod *mod,
--
2.17.0
next reply other threads:[~2018-09-27 5:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-27 5:12 jiada_wang [this message]
2018-09-28 0:29 ` Kuninori Morimoto
2018-10-02 8:19 ` Jiada Wang
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=20180927051229.18080-1-jiada_wang@mentor.com \
--to=jiada_wang@mentor.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dragos_tarcatu@mentor.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=twischer@de.adit-jv.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
all inboxes | Powered by JetHome®