aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2019-04-25 15:16:58 +0900
committerHiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>2019-05-17 13:46:28 +0900
commit54721f5956546419922e9d910e0afb3cac0a662d (patch)
treeef9d0598dc1cfbffad2c58ee3c61d7570e33f82d
parent91849f8e8d7151d0ff3e04bac71339b78b77b6e3 (diff)
downloadrenesas-bsp-54721f5956546419922e9d910e0afb3cac0a662d.tar.gz
ASoC: rsnd: fixup 6ch settings to 8ch
rsnd need to use 8ch clock settings for 6ch for TDM. Otherwise, it can't work correctly. This patch fixup it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org> (cherry picked from commit 66287def435315d9d8de740da4c543e37630b897) Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
-rw-r--r--sound/soc/sh/rcar/core.c18
-rw-r--r--sound/soc/sh/rcar/rsnd.h1
-rw-r--r--sound/soc/sh/rcar/ssi.c2
3 files changed, 16 insertions, 5 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index bc91b3cc27c87..e328d4706a907 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -241,6 +241,18 @@ int rsnd_runtime_channel_after_ctu_with_params(struct rsnd_dai_stream *io,
return chan;
}
+int rsnd_channel_normalization(int chan)
+{
+ if ((chan > 8) || (chan < 0))
+ return 0;
+
+ /* TDM Extend Mode needs 8ch */
+ if (chan == 6)
+ chan = 8;
+
+ return chan;
+}
+
int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io,
struct snd_pcm_hw_params *params)
{
@@ -253,11 +265,7 @@ int rsnd_runtime_channel_for_ssi_with_params(struct rsnd_dai_stream *io,
if (rsnd_runtime_is_ssi_multi(io))
chan /= rsnd_rdai_ssi_lane_get(rdai);
- /* TDM Extend Mode needs 8ch */
- if (chan == 6)
- chan = 8;
-
- return chan;
+ return rsnd_channel_normalization(chan);
}
int rsnd_runtime_is_ssi_multi(struct rsnd_dai_stream *io)
diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h
index c2ea3831d8b4b..5fe74898b360a 100644
--- a/sound/soc/sh/rcar/rsnd.h
+++ b/sound/soc/sh/rcar/rsnd.h
@@ -400,6 +400,7 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai,
struct device_node *playback,
struct device_node *capture);
+int rsnd_channel_normalization(int chan);
#define rsnd_runtime_channel_original(io) \
rsnd_runtime_channel_original_with_params(io, NULL)
int rsnd_runtime_channel_original_with_params(struct rsnd_dai_stream *io,
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index d9f02b096e2f6..66383d249fc3c 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -296,6 +296,8 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod,
return 0;
}
+ chan = rsnd_channel_normalization(chan);
+
main_rate = rsnd_ssi_clk_query(priv, rate, chan, &idx);
if (!main_rate) {
dev_err(dev, "unsupported clock rate\n");