lkml.org 
[lkml]   [2017]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 2/2] ASoC: select sysclk clock from mlck clock provider in wm8994 driver
Date
When defined in device tree, MCLK1 and MCLK2 are used
as sysclk for aif1 and aif2 interfaces respectively.
If clock rate is let 0, the frequency provided by
wm8994_set_dai_sysclk() is used instead.

Signed-off-by: Olivier Moysan <olivier.moysan@st.com>
---
sound/soc/codecs/wm8994.c | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 21ffd64..7a84e37 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -11,6 +11,7 @@
* published by the Free Software Foundation.
*/

+#include <linux/clk.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
@@ -2376,18 +2377,35 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai,
{
struct snd_soc_codec *codec = dai->codec;
struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
+ struct wm8994 *control = wm8994->wm8994;
+ struct wm8994_pdata *pdata = &control->pdata;
+ unsigned long rate;
int i;

switch (dai->id) {
case 1:
+ if (pdata->mclk1) {
+ rate = clk_get_rate(pdata->mclk1);
+ if (rate)
+ freq = (unsigned int)rate;
+ clk_id = WM8994_SYSCLK_MCLK1;
+ }
+ break;
case 2:
+ if (pdata->mclk2) {
+ rate = clk_get_rate(pdata->mclk2);
+ if (rate)
+ freq = (unsigned int)rate;
+ clk_id = WM8994_SYSCLK_MCLK2;
+ }
break;
-
default:
/* AIF3 shares clocking with AIF1/2 */
return -EINVAL;
}

+ dev_info(codec->dev, "%s:.clock id %d\n", __func__, clk_id);
+
switch (clk_id) {
case WM8994_SYSCLK_MCLK1:
wm8994->sysclk[dai->id - 1] = WM8994_SYSCLK_MCLK1;
--
1.9.1
\
 
 \ /
  Last update: 2017-12-14 17:59    [W:0.054 / U:0.516 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site