linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH linux-next 09/10] ASoC: rsnd: add busif property to dai stream
@ 2018-09-27  5:12 jiada_wang
  2018-09-28  0:21 ` Kuninori Morimoto
  0 siblings, 1 reply; 3+ messages in thread
From: jiada_wang @ 2018-09-27  5:12 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, kuninori.morimoto.gx
  Cc: jiada_wang, twischer, dragos_tarcatu, alsa-devel, linux-kernel

From: Jiada Wang <jiada_wang@mentor.com>

SSI may use different busif for data transfer, this patch
adds busif property to each dai stream, to indicate the
busif used by playback/capture stream.

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

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 40d7dc4f7839..aee3132c72b9 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -560,6 +560,14 @@ struct rsnd_dai *rsnd_rdai_get(struct rsnd_priv *priv, int id)
 	return priv->rdai + id;
 }
 
+struct rsnd_kctrl_cfg_s *rsnd_busif_get(struct rsnd_priv *priv, int id)
+{
+	if ((id < 0) || (id >= 2 * rsnd_rdai_nr(priv)))
+		return NULL;
+
+	return priv->busif + id;
+}
+
 static struct snd_soc_dai_driver
 *rsnd_daidrv_get(struct rsnd_priv *priv, int id)
 {
@@ -1045,6 +1053,9 @@ static void __rsnd_dai_probe(struct rsnd_priv *priv,
 	io_playback	= &rdai->playback;
 	io_capture	= &rdai->capture;
 
+	io_playback->busif = rsnd_busif_get(priv, dai_i);
+	io_capture->busif  = rsnd_busif_get(priv, rsnd_rdai_nr(priv) + dai_i);
+
 	snprintf(rdai->name, RSND_DAI_NAME_SIZE, "rsnd-dai.%d", dai_i);
 
 	rdai->priv	= priv;
@@ -1108,6 +1119,7 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)
 	struct snd_soc_dai_driver *rdrv;
 	struct device *dev = rsnd_priv_to_dev(priv);
 	struct rsnd_dai *rdai;
+	struct rsnd_kctrl_cfg_s *busif;
 	int nr;
 	int is_graph;
 	int dai_i;
@@ -1123,12 +1135,14 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)
 
 	rdrv = devm_kcalloc(dev, nr, sizeof(*rdrv), GFP_KERNEL);
 	rdai = devm_kcalloc(dev, nr, sizeof(*rdai), GFP_KERNEL);
-	if (!rdrv || !rdai)
+	busif = devm_kcalloc(dev, 2 * nr, sizeof(*busif), GFP_KERNEL);
+	if (!rdrv || !rdai || !busif)
 		return -ENOMEM;
 
 	priv->rdai_nr	= nr;
 	priv->daidrv	= rdrv;
 	priv->rdai	= rdai;
+	priv->busif	= busif;
 
 	/*
 	 * parse all dai
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index 4464d1d0a042..59b6d89d8edc 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -456,6 +456,7 @@ struct rsnd_dai_stream {
 	struct rsnd_mod *dma;
 	struct rsnd_dai *rdai;
 	struct device *dmac_dev; /* for IPMMU */
+	struct rsnd_kctrl_cfg_s *busif;
 	u32 parent_ssi_status;
 };
 #define rsnd_io_to_mod(io, i)	((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
@@ -629,6 +630,8 @@ struct rsnd_priv {
 	 */
 	struct snd_soc_dai_driver *daidrv;
 	struct rsnd_dai *rdai;
+	struct rsnd_kctrl_cfg_s *busif;
+
 	int rdai_nr;
 };
 
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 75a3d15084c2..4ac4b5b75ae2 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -154,7 +154,10 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
 
 int rsnd_ssi_get_busif(struct rsnd_dai_stream *io)
 {
-	return 0; /* BUSIF0 only for now */
+	if (!rsnd_ssi_use_busif(io))
+		return 0;
+
+	return io->busif->val;
 }
 
 static void rsnd_ssi_status_clear(struct rsnd_mod *mod)
-- 
2.17.0


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

* Re: [PATCH linux-next 09/10] ASoC: rsnd: add busif property to dai stream
  2018-09-27  5:12 [PATCH linux-next 09/10] ASoC: rsnd: add busif property to dai stream jiada_wang
@ 2018-09-28  0:21 ` Kuninori Morimoto
  2018-10-02  7:58   ` Jiada Wang
  0 siblings, 1 reply; 3+ messages in thread
From: Kuninori Morimoto @ 2018-09-28  0:21 UTC (permalink / raw)
  To: jiada_wang
  Cc: lgirdwood, broonie, perex, tiwai, twischer, dragos_tarcatu,
	alsa-devel, linux-kernel


Hi Jiada


> SSI may use different busif for data transfer, this patch
> adds busif property to each dai stream, to indicate the
> busif used by playback/capture stream.
(snip)
> +	io_playback->busif = rsnd_busif_get(priv, dai_i);
> +	io_capture->busif  = rsnd_busif_get(priv, rsnd_rdai_nr(priv) + dai_i);
(snip)
> +	busif = devm_kcalloc(dev, 2 * nr, sizeof(*busif), GFP_KERNEL);
(snip)
> @@ -456,6 +456,7 @@ struct rsnd_dai_stream {
>  	struct rsnd_mod *dma;
>  	struct rsnd_dai *rdai;
>  	struct device *dmac_dev; /* for IPMMU */
> +	struct rsnd_kctrl_cfg_s *busif;
>  	u32 parent_ssi_status;
>  };

It looks very complex to me.
Why don't you just have "busif" on rsnd_dai_stream, instead of "*busif" ?

>  int rsnd_ssi_get_busif(struct rsnd_dai_stream *io)
>  {
> -	return 0; /* BUSIF0 only for now */
> +	if (!rsnd_ssi_use_busif(io))
> +		return 0;
> +
> +	return io->busif->val;
>  }

Who/How update val ?


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

* Re: [PATCH linux-next 09/10] ASoC: rsnd: add busif property to dai stream
  2018-09-28  0:21 ` Kuninori Morimoto
@ 2018-10-02  7:58   ` Jiada Wang
  0 siblings, 0 replies; 3+ messages in thread
From: Jiada Wang @ 2018-10-02  7:58 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: lgirdwood, broonie, perex, tiwai, twischer, dragos_tarcatu,
	alsa-devel, linux-kernel

Hi Morimoto-san


On 2018/09/28 9:21, Kuninori Morimoto wrote:
> Hi Jiada
>
>
>> SSI may use different busif for data transfer, this patch
>> adds busif property to each dai stream, to indicate the
>> busif used by playback/capture stream.
> (snip)
>> +	io_playback->busif = rsnd_busif_get(priv, dai_i);
>> +	io_capture->busif  = rsnd_busif_get(priv, rsnd_rdai_nr(priv) + dai_i);
> (snip)
>> +	busif = devm_kcalloc(dev, 2 * nr, sizeof(*busif), GFP_KERNEL);
> (snip)
>> @@ -456,6 +456,7 @@ struct rsnd_dai_stream {
>>   	struct rsnd_mod *dma;
>>   	struct rsnd_dai *rdai;
>>   	struct device *dmac_dev; /* for IPMMU */
>> +	struct rsnd_kctrl_cfg_s *busif;
>>   	u32 parent_ssi_status;
>>   };
> It looks very complex to me.
> Why don't you just have "busif" on rsnd_dai_stream, instead of "*busif" ?
yes, it can be replaced with *busif instead,
but it will result in some reorder of declarations in rsnd.h
will update this patch in v2 patch set.

  Thanks,
Jiada
>>   int rsnd_ssi_get_busif(struct rsnd_dai_stream *io)
>>   {
>> -	return 0; /* BUSIF0 only for now */
>> +	if (!rsnd_ssi_use_busif(io))
>> +		return 0;
>> +
>> +	return io->busif->val;
>>   }
> Who/How update val ?
>


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

end of thread, other threads:[~2018-10-02  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-27  5:12 [PATCH linux-next 09/10] ASoC: rsnd: add busif property to dai stream jiada_wang
2018-09-28  0:21 ` Kuninori Morimoto
2018-10-02  7:58   ` Jiada Wang

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