aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorArnaud Pouliquen <arnaud.pouliquen@st.com>2015-06-05 10:19:05 +0200
committerLeo Wang <leozwang@google.com>2016-01-28 00:27:16 +0000
commit359fcb7574d2f924b999cd10e748e0813f48f869 (patch)
treeae7b763af9c9d7dab2e9f1708d8ca444605316c0 /sound
parent1a10995369339936c3dae5a07dcd7b2867c4c5c7 (diff)
downloadv4.1-359fcb7574d2f924b999cd10e748e0813f48f869.tar.gz
UPSTREAM: ASoC: simple card: Add mclk-fs property in dai-link
Add mclk-fs ratio property per dai-link sub node. This will allow to manage several codecs with different ratio. Signed-off-by: Arnaud Pouliquen <arnaud.pouliquen@st.com> Signed-off-by: Mark Brown <broonie@kernel.org> Bug: 25923642 Patchset: update upstream simple card at here. (cherry picked from git.kernel.org torvalds/linux.git master commit 85a4bfd895778960dc2d655087ac7ff442b6ab9e) Signed-off-by: Caesar Wang <wxt@rock-chips.com> Change-Id: I88c68eb826ecd82ca50b7ee09d2cf10e63ed8b7a
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 8496efc93d8..3ff76d41943 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -26,6 +26,7 @@ struct simple_card_data {
struct simple_dai_props {
struct asoc_simple_dai cpu_dai;
struct asoc_simple_dai codec_dai;
+ unsigned int mclk_fs;
} *dai_props;
unsigned int mclk_fs;
int gpio_hp_det;
@@ -77,11 +78,18 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card);
- unsigned int mclk;
+ struct simple_dai_props *dai_props =
+ &priv->dai_props[rtd - rtd->card->rtd];
+ unsigned int mclk, mclk_fs = 0;
int ret = 0;
- if (priv->mclk_fs) {
- mclk = params_rate(params) * priv->mclk_fs;
+ if (priv->mclk_fs)
+ mclk_fs = priv->mclk_fs;
+ else if (dai_props->mclk_fs)
+ mclk_fs = dai_props->mclk_fs;
+
+ if (mclk_fs) {
+ mclk = params_rate(params) * mclk_fs;
ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
SND_SOC_CLOCK_IN);
if (ret && ret != -ENOTSUPP)
@@ -322,6 +330,7 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
char prop[128];
char *prefix = "";
int ret, cpu_args;
+ u32 val;
/* For single DAI link & old style of DT node */
if (is_top_level_node)
@@ -347,6 +356,9 @@ static int asoc_simple_card_dai_link_of(struct device_node *node,
if (ret < 0)
goto dai_link_of_err;
+ if (!of_property_read_u32(node, "mclk-fs", &val))
+ dai_props->mclk_fs = val;
+
ret = asoc_simple_card_sub_parse_of(cpu, &dai_props->cpu_dai,
&dai_link->cpu_of_node,
&dai_link->cpu_dai_name,