diff mbox

ASoC: rsnd: rsnd_ssi_is_multi_slave() macro uses rsnd_ssi_multi_slaves()

Message ID 87io1ynzbc.wl%kuninori.morimoto.gx@renesas.com (mailing list archive)
State Accepted
Commit c308abe45e2a7bc58e22d9b6d04dccf76a1b2012
Headers show

Commit Message

Kuninori Morimoto Feb. 9, 2016, 7:04 a.m. UTC
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

b4c83b171 ("ASoC: rsnd: add Multi channel support") added
Multi channel support, and current rsnd_ssi_is_multi_slave()'s check
method is !SSI equals SSIM1/2/3. But, SSI parent also hit to this macro.
Because of this reason, some stream which needs SSI parent clock
can't work correctly. This patch uses rsnd_ssi_multi_slaves() to
solve this issue. This issue was reported by Dung.

Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
>> Dung-san

Can you please check/test this patch ?

 sound/soc/sh/rcar/ssi.c | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

Comments

Nguyen Viet Dung Feb. 9, 2016, 10:10 a.m. UTC | #1
Hi,

I have checked the problem(can't record) with this patch on Salvator-X 
board.
result is OK(can record correctly).

Best regards,
Nguyen Viet Dung

On 2016?02?09? 16:04, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> b4c83b171 ("ASoC: rsnd: add Multi channel support") added
> Multi channel support, and current rsnd_ssi_is_multi_slave()'s check
> method is !SSI equals SSIM1/2/3. But, SSI parent also hit to this macro.
> Because of this reason, some stream which needs SSI parent clock
> can't work correctly. This patch uses rsnd_ssi_multi_slaves() to
> solve this issue. This issue was reported by Dung.
>
> Reported-by: Nguyen Viet Dung <nv-dung@jinso.co.jp>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> ---
>>> Dung-san
> Can you please check/test this patch ?
>
>   sound/soc/sh/rcar/ssi.c | 16 ++--------------
>   1 file changed, 2 insertions(+), 14 deletions(-)
>
> diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
> index 7ee89da..72e8420 100644
> --- a/sound/soc/sh/rcar/ssi.c
> +++ b/sound/soc/sh/rcar/ssi.c
> @@ -96,7 +96,8 @@ struct rsnd_ssi {
>   #define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod)
>   #define rsnd_ssi_mode_flags(p) ((p)->flags)
>   #define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io))
> -#define rsnd_ssi_is_multi_slave(ssi, io) ((mod) != rsnd_io_to_mod_ssi(io))
> +#define rsnd_ssi_is_multi_slave(mod, io) \
> +	(rsnd_ssi_multi_slaves(io) & (1 << rsnd_mod_id(mod)))
>   
>   int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
>   {
> @@ -175,9 +176,6 @@ static int rsnd_ssi_irq_disable(struct rsnd_mod *ssi_mod)
>   u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io)
>   {
>   	struct rsnd_mod *mod;
> -	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
> -	struct rsnd_priv *priv = rsnd_io_to_priv(io);
> -	struct device *dev = rsnd_priv_to_dev(priv);
>   	enum rsnd_mod_type types[] = {
>   		RSND_MOD_SSIM1,
>   		RSND_MOD_SSIM2,
> @@ -185,16 +183,6 @@ u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io)
>   	};
>   	int i, mask;
>   
> -	switch (runtime->channels) {
> -	case 2: /* Multi channel is not needed for Stereo */
> -		return 0;
> -	case 6:
> -		break;
> -	default:
> -		dev_err(dev, "unsupported channel\n");
> -		return 0;
> -	}
> -
>   	mask = 0;
>   	for (i = 0; i < ARRAY_SIZE(types); i++) {
>   		mod = rsnd_io_to_mod(io, types[i]);
diff mbox

Patch

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 7ee89da..72e8420 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -96,7 +96,8 @@  struct rsnd_ssi {
 #define rsnd_mod_to_ssi(_mod) container_of((_mod), struct rsnd_ssi, mod)
 #define rsnd_ssi_mode_flags(p) ((p)->flags)
 #define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io))
-#define rsnd_ssi_is_multi_slave(ssi, io) ((mod) != rsnd_io_to_mod_ssi(io))
+#define rsnd_ssi_is_multi_slave(mod, io) \
+	(rsnd_ssi_multi_slaves(io) & (1 << rsnd_mod_id(mod)))
 
 int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
 {
@@ -175,9 +176,6 @@  static int rsnd_ssi_irq_disable(struct rsnd_mod *ssi_mod)
 u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io)
 {
 	struct rsnd_mod *mod;
-	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
-	struct rsnd_priv *priv = rsnd_io_to_priv(io);
-	struct device *dev = rsnd_priv_to_dev(priv);
 	enum rsnd_mod_type types[] = {
 		RSND_MOD_SSIM1,
 		RSND_MOD_SSIM2,
@@ -185,16 +183,6 @@  u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io)
 	};
 	int i, mask;
 
-	switch (runtime->channels) {
-	case 2: /* Multi channel is not needed for Stereo */
-		return 0;
-	case 6:
-		break;
-	default:
-		dev_err(dev, "unsupported channel\n");
-		return 0;
-	}
-
 	mask = 0;
 	for (i = 0; i < ARRAY_SIZE(types); i++) {
 		mod = rsnd_io_to_mod(io, types[i]);