aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorArnaud Pouliquen <arnaud.pouliquen@st.com>2015-06-05 10:19:06 +0200
committerLeo Wang <leozwang@google.com>2016-01-28 00:27:01 +0000
commit1a10995369339936c3dae5a07dcd7b2867c4c5c7 (patch)
tree3d0b69437e8e583f5873e2e19b812c5716cc9e1e /sound
parent5993c53b30f12b82cb5bd4077f7a2802ad97c7d8 (diff)
downloadv4.1-1a10995369339936c3dae5a07dcd7b2867c4c5c7.tar.gz
UPSTREAM: ASoC: simple card: set cpu-dai sysclk with mclk-fs
Allows to request a specific mclk frequency per cpu_dai. To support some codecs with mclk provided by the cpu_dai, the mclk rate must be set depending on frame rate. 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 e22579713ae1384a3dff545369cebe42b01370fa) Signed-off-by: Caesar Wang <wxt@rock-chips.com> Change-Id: I1a3aa7c97164f49e6fe7c133606ac052072bb1c6
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/generic/simple-card.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index c87e58504a6..8496efc93d8 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -75,6 +75,7 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
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;
int ret = 0;
@@ -83,8 +84,16 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream,
mclk = params_rate(params) * priv->mclk_fs;
ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
SND_SOC_CLOCK_IN);
+ if (ret && ret != -ENOTSUPP)
+ goto err;
+
+ ret = snd_soc_dai_set_sysclk(cpu_dai, 0, mclk,
+ SND_SOC_CLOCK_OUT);
+ if (ret && ret != -ENOTSUPP)
+ goto err;
}
+err:
return ret;
}