[1/3] ASoC: codecs: msm8916-wcd-digital: add support to set_sysclk

Message ID 20170717135410.26812-2-srinivas.kandagatla@linaro.org
State New
Headers show
Series
  • ASoC: codecs: msm8916-wcd-digital: Fix dmic support
Related show

Commit Message

Srinivas Kandagatla July 17, 2017, 1:54 p.m.
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>


This patch adds support to set_sysclk() which can let the sound
card driver to set default mclk rate. In this case MCLK for
internal audio codec is expected to be at 9.6MHz by default.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>

---
 sound/soc/codecs/msm8916-wcd-digital.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

-- 
2.11.0

Comments

Mark Brown July 17, 2017, 2:44 p.m. | #1
On Mon, Jul 17, 2017 at 03:54:08PM +0200, srinivas.kandagatla@linaro.org wrote:

> +static int msm8916_set_dai_sysclk(struct snd_soc_dai *dai,

> +				 int clk_id, unsigned int freq, int dir)

> +{

> +	struct msm8916_wcd_digital_priv *p = dev_get_drvdata(dai->codec->dev);

> +

> +	clk_set_rate(p->mclk, freq);


This is ignoring the return value.
Srinivas Kandagatla July 17, 2017, 2:52 p.m. | #2
On 17/07/17 15:44, Mark Brown wrote:
> On Mon, Jul 17, 2017 at 03:54:08PM +0200, srinivas.kandagatla@linaro.org wrote:

> 

>> +static int msm8916_set_dai_sysclk(struct snd_soc_dai *dai,

>> +				 int clk_id, unsigned int freq, int dir)

>> +{

>> +	struct msm8916_wcd_digital_priv *p = dev_get_drvdata(dai->codec->dev);

>> +

>> +	clk_set_rate(p->mclk, freq);

> 

> This is ignoring the return value.

> 

Thanks, I will take care of it in next version.

--srini

Patch

diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c
index f690442af8c9..126a0ee8aded 100644
--- a/sound/soc/codecs/msm8916-wcd-digital.c
+++ b/sound/soc/codecs/msm8916-wcd-digital.c
@@ -568,6 +568,16 @@  static int msm8916_wcd_digital_codec_probe(struct snd_soc_codec *codec)
 	return 0;
 }
 
+static int msm8916_set_dai_sysclk(struct snd_soc_dai *dai,
+				 int clk_id, unsigned int freq, int dir)
+{
+	struct msm8916_wcd_digital_priv *p = dev_get_drvdata(dai->codec->dev);
+
+	clk_set_rate(p->mclk, freq);
+
+	return 0;
+}
+
 static int msm8916_wcd_digital_hw_params(struct snd_pcm_substream *substream,
 					 struct snd_pcm_hw_params *params,
 					 struct snd_soc_dai *dai)
@@ -792,6 +802,7 @@  static struct snd_soc_dai_ops msm8916_wcd_digital_dai_ops = {
 	.startup = msm8916_wcd_digital_startup,
 	.shutdown = msm8916_wcd_digital_shutdown,
 	.hw_params = msm8916_wcd_digital_hw_params,
+	.set_sysclk = msm8916_set_dai_sysclk,
 };
 
 static struct snd_soc_dai_driver msm8916_wcd_digital_dai[] = {