aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/samsung/speyside.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/samsung/speyside.c')
-rw-r--r--sound/soc/samsung/speyside.c61
1 files changed, 48 insertions, 13 deletions
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index 360a333cb7c0..d6dee4d02036 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -20,24 +20,29 @@
20#define WM8915_HPSEL_GPIO 214 20#define WM8915_HPSEL_GPIO 214
21 21
22static int speyside_set_bias_level(struct snd_soc_card *card, 22static int speyside_set_bias_level(struct snd_soc_card *card,
23 struct snd_soc_dapm_context *dapm,
23 enum snd_soc_bias_level level) 24 enum snd_soc_bias_level level)
24{ 25{
25 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; 26 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
26 int ret; 27 int ret;
27 28
29 if (dapm->dev != codec_dai->dev)
30 return 0;
31
28 switch (level) { 32 switch (level) {
29 case SND_SOC_BIAS_STANDBY: 33 case SND_SOC_BIAS_STANDBY:
30 ret = snd_soc_dai_set_sysclk(codec_dai, WM8915_SYSCLK_MCLK1, 34 ret = snd_soc_dai_set_sysclk(codec_dai, WM8915_SYSCLK_MCLK2,
31 32768, SND_SOC_CLOCK_IN); 35 32768, SND_SOC_CLOCK_IN);
32 if (ret < 0) 36 if (ret < 0)
33 return ret; 37 return ret;
34 38
35 ret = snd_soc_dai_set_pll(codec_dai, WM8915_FLL_MCLK1, 39 ret = snd_soc_dai_set_pll(codec_dai, WM8915_FLL_MCLK2,
36 0, 0, 0); 40 0, 0, 0);
37 if (ret < 0) { 41 if (ret < 0) {
38 pr_err("Failed to stop FLL\n"); 42 pr_err("Failed to stop FLL\n");
39 return ret; 43 return ret;
40 } 44 }
45 break;
41 46
42 default: 47 default:
43 break; 48 break;
@@ -46,6 +51,45 @@ static int speyside_set_bias_level(struct snd_soc_card *card,
46 return 0; 51 return 0;
47} 52}
48 53
54static int speyside_set_bias_level_post(struct snd_soc_card *card,
55 struct snd_soc_dapm_context *dapm,
56 enum snd_soc_bias_level level)
57{
58 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
59 int ret;
60
61 if (dapm->dev != codec_dai->dev)
62 return 0;
63
64 switch (level) {
65 case SND_SOC_BIAS_PREPARE:
66 if (card->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
67 ret = snd_soc_dai_set_pll(codec_dai, 0,
68 WM8915_FLL_MCLK2,
69 32768, 48000 * 256);
70 if (ret < 0) {
71 pr_err("Failed to start FLL\n");
72 return ret;
73 }
74
75 ret = snd_soc_dai_set_sysclk(codec_dai,
76 WM8915_SYSCLK_FLL,
77 48000 * 256,
78 SND_SOC_CLOCK_IN);
79 if (ret < 0)
80 return ret;
81 }
82 break;
83
84 default:
85 break;
86 }
87
88 card->dapm.bias_level = level;
89
90 return 0;
91}
92
49static int speyside_hw_params(struct snd_pcm_substream *substream, 93static int speyside_hw_params(struct snd_pcm_substream *substream,
50 struct snd_pcm_hw_params *params) 94 struct snd_pcm_hw_params *params)
51{ 95{
@@ -66,16 +110,6 @@ static int speyside_hw_params(struct snd_pcm_substream *substream,
66 if (ret < 0) 110 if (ret < 0)
67 return ret; 111 return ret;
68 112
69 ret = snd_soc_dai_set_pll(codec_dai, 0, WM8915_FLL_MCLK1,
70 32768, 256 * 48000);
71 if (ret < 0)
72 return ret;
73
74 ret = snd_soc_dai_set_sysclk(codec_dai, WM8915_SYSCLK_FLL,
75 256 * 48000, SND_SOC_CLOCK_IN);
76 if (ret < 0)
77 return ret;
78
79 return 0; 113 return 0;
80} 114}
81 115
@@ -127,7 +161,7 @@ static int speyside_wm8915_init(struct snd_soc_pcm_runtime *rtd)
127 struct snd_soc_codec *codec = rtd->codec; 161 struct snd_soc_codec *codec = rtd->codec;
128 int ret; 162 int ret;
129 163
130 ret = snd_soc_dai_set_sysclk(dai, WM8915_SYSCLK_MCLK1, 32768, 0); 164 ret = snd_soc_dai_set_sysclk(dai, WM8915_SYSCLK_MCLK2, 32768, 0);
131 if (ret < 0) 165 if (ret < 0)
132 return ret; 166 return ret;
133 167
@@ -267,6 +301,7 @@ static struct snd_soc_card speyside = {
267 .num_configs = ARRAY_SIZE(speyside_codec_conf), 301 .num_configs = ARRAY_SIZE(speyside_codec_conf),
268 302
269 .set_bias_level = speyside_set_bias_level, 303 .set_bias_level = speyside_set_bias_level,
304 .set_bias_level_post = speyside_set_bias_level_post,
270 305
271 .controls = controls, 306 .controls = controls,
272 .num_controls = ARRAY_SIZE(controls), 307 .num_controls = ARRAY_SIZE(controls),