aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyo Kataoka <ryo.kataoka.wt@renesas.com>2019-07-11 21:15:16 +0900
committerRyo Kataoka <ryo.kataoka.wt@renesas.com>2019-07-11 21:15:16 +0900
commit9aa6649bb252b987708de0d2eba078ad3ef7aff4 (patch)
treeef9d0598dc1cfbffad2c58ee3c61d7570e33f82d
parent1f12f0466c7782ef7f44481ecf08db5e77448c7f (diff)
parent54721f5956546419922e9d910e0afb3cac0a662d (diff)
downloadrenesas-bsp-9aa6649bb252b987708de0d2eba078ad3ef7aff4.tar.gz
Merge branch 'rcar-3.9.4/audio.rc2' into v4.14.75-ltsi/rcar-3.9.6
* rcar-3.9.4/audio.rc2: ASoC: rsnd: fixup 6ch settings to 8ch ASoC: rsnd: src: Avoid a potential deadlock
-rw-r--r--sound/soc/sh/rcar/core.c20
-rw-r--r--sound/soc/sh/rcar/rsnd.h6
-rw-r--r--sound/soc/sh/rcar/src.c9
-rw-r--r--sound/soc/sh/rcar/ssi.c2
4 files changed, 24 insertions, 13 deletions
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 27b647efa440a..e328d4706a907 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -112,6 +112,8 @@ static const struct of_device_id rsnd_of_match[] = {
{ .compatible = "renesas,rcar_sound-gen1", .data = (void *)RSND_GEN1 },
{ .compatible = "renesas,rcar_sound-gen2", .data = (void *)RSND_GEN2 },
{ .compatible = "renesas,rcar_sound-gen3", .data = (void *)RSND_GEN3 },
+ /* Special Handling */
+ { .compatible = "renesas,rcar_sound-r8a77990", .data = (void *)(RSND_GEN3 | RSND_SOC_E) },
{},
};
MODULE_DEVICE_TABLE(of, rsnd_of_match);
@@ -239,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)
{
@@ -251,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 5a0bf0a984d3f..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,
@@ -541,6 +542,8 @@ struct rsnd_priv {
#define RSND_GEN1 (1 << 0)
#define RSND_GEN2 (2 << 0)
#define RSND_GEN3 (3 << 0)
+#define RSND_SOC_MASK (0xFF << 4)
+#define RSND_SOC_E (1 << 4) /* E1/E2/E3 */
/*
* below value will be filled on rsnd_gen_probe()
@@ -613,6 +616,9 @@ struct rsnd_priv {
#define rsnd_is_gen1(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN1)
#define rsnd_is_gen2(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN2)
#define rsnd_is_gen3(priv) (((priv)->flags & RSND_GEN_MASK) == RSND_GEN3)
+#define rsnd_is_e3(priv) (((priv)->flags & \
+ (RSND_GEN_MASK | RSND_SOC_MASK)) == \
+ (RSND_GEN3 | RSND_SOC_E))
#define rsnd_flags_has(p, f) ((p)->flags & (f))
#define rsnd_flags_set(p, f) ((p)->flags |= (f))
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index c31cc99f71d2e..938b934ea84cf 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -18,7 +18,6 @@
*/
#include "rsnd.h"
-#include <linux/sys_soc.h>
#define SRC_NAME "src"
@@ -228,18 +227,12 @@ const static u32 chan222222[] = {
0x00000006, /* 1 to 2 */
};
-static const struct soc_device_attribute ov_soc[] = {
- { .soc_id = "r8a77990" }, /* E3 */
- { /* sentinel */ }
-};
-
static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,
struct rsnd_mod *mod)
{
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
struct device *dev = rsnd_priv_to_dev(priv);
struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
- const struct soc_device_attribute *soc = soc_device_match(ov_soc);
int is_play = rsnd_io_is_play(io);
int use_src = 0;
u32 fin, fout;
@@ -346,7 +339,7 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,
/*
* E3 need to overwrite
*/
- if (soc)
+ if (rsnd_is_e3(priv))
switch (rsnd_mod_id(mod)) {
case 0:
case 4:
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");