summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInha Song <ideal.song@samsung.com>2015-03-11 02:04:45 (GMT)
committerChanho Park <chanho61.park@samsung.com>2015-03-24 07:52:04 (GMT)
commit5b5a24c867634c0cca439711d47042e1df5c190d (patch)
treea5bb4cfbce43a417b26b3a695a5afd42bbc85db3
parent3fd097d293fc708b58cd7c9a761f9c818e2ad093 (diff)
downloadlinux-3.10-5b5a24c867634c0cca439711d47042e1df5c190d.zip
linux-3.10-5b5a24c867634c0cca439711d47042e1df5c190d.tar.gz
linux-3.10-5b5a24c867634c0cca439711d47042e1df5c190d.tar.bz2
ASoC: samsung: Add 32khz clock control logic for codec mclk2refs/changes/05/36705/3
This patch add 32khz clock control logic for codec's master clock 2(MCLK2). WM1811 codec can use MCLK1 and MCLK2 as FLL's source clocks. Change-Id: Ifc57ae1772db9a905b0d1c101442ccf649d53c6b Signed-off-by: Inha Song <ideal.song@samsung.com>
-rw-r--r--sound/soc/samsung/trats2_wm1811.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/sound/soc/samsung/trats2_wm1811.c b/sound/soc/samsung/trats2_wm1811.c
index 9de4fc3..631c966 100644
--- a/sound/soc/samsung/trats2_wm1811.c
+++ b/sound/soc/samsung/trats2_wm1811.c
@@ -111,6 +111,7 @@ struct trats2_wm1811 {
struct snd_soc_jack jack;
struct snd_soc_codec *codec;
struct clk *codec_mclk;
+ struct clk *codec_32khz;
int gpio_mic_bias[MIC_MAX];
int gpio_vps_en;
@@ -867,6 +868,12 @@ static int machine_init_paiftx(struct snd_soc_pcm_runtime *rtd)
if (ret < 0)
return ret;
+ ret = clk_prepare_enable(machine->codec_32khz);
+ if (ret < 0) {
+ clk_disable_unprepare(machine->codec_mclk);
+ return ret;
+ }
+
ret = snd_soc_add_card_controls(card, card_controls,
ARRAY_SIZE(card_controls));
if (ret != 0)
@@ -1151,6 +1158,7 @@ static int machine_card_suspend_post(struct snd_soc_card *card)
codec_micd_set_rate(codec);
clk_disable_unprepare(machine->codec_mclk);
+ clk_disable_unprepare(machine->codec_32khz);
}
snd_soc_dapm_sync(&codec->dapm);
@@ -1165,8 +1173,10 @@ static int machine_card_resume_pre(struct snd_soc_card *card)
int reg = 0;
int ret;
- if (!codec->active)
+ if (!codec->active) {
clk_prepare_enable(machine->codec_mclk);
+ clk_prepare_enable(machine->codec_32khz);
+ }
/* change sysclk from mclk2 to pll out of mclk1 */
ret = snd_soc_dai_set_pll(aif1_dai, WM8994_FLL1,
@@ -1290,6 +1300,12 @@ static int trats2_wm1811_probe(struct platform_device *pdev)
return PTR_ERR(machine->codec_mclk);
}
+ machine->codec_32khz = clk_get(&pdev->dev, "32khz");
+ if (IS_ERR(machine->codec_32khz)) {
+ dev_err(&pdev->dev, "failed to get 32khz clock\n");
+ return PTR_ERR(machine->codec_32khz);
+ }
+
out_mux = clk_get(&pdev->dev, "out-mux");
if (IS_ERR(out_mux)) {
dev_err(&pdev->dev, "failed to get out mux clock\n");
@@ -1335,6 +1351,7 @@ static int trats2_wm1811_remove(struct platform_device *pdev)
snd_soc_unregister_card(card);
clk_put(machine->codec_mclk);
+ clk_put(machine->codec_32khz);
clk_put(machine->clk_pll);
return 0;
}