diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-08 13:26:16 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-07-08 13:41:05 -0400 |
commit | 96fd6d471b2c953df5379a356be04f8c8f8b4bdf (patch) | |
tree | b5643d8ba7ca6f1c514e32c6412d51b4d2ae91ae /sound/soc/atmel | |
parent | 22df8eb4fe293d67c98732e02a2dbef0d9c6cd96 (diff) |
ASoC: Configure WM8731 SYSCLK at startup on AT91SAM9G20-EK
The system clock is currently fixed by the driver and this avoids
the need for us to handle errors with enabling and disabling MCLK
(which was incorrect previously so this fixes bugs in error
handling).
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/atmel')
-rw-r--r-- | sound/soc/atmel/sam9g20_wm8731.c | 35 |
1 files changed, 10 insertions, 25 deletions
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c index ba93df79f265..130b12118d4f 100644 --- a/sound/soc/atmel/sam9g20_wm8731.c +++ b/sound/soc/atmel/sam9g20_wm8731.c | |||
@@ -65,29 +65,6 @@ | |||
65 | 65 | ||
66 | static struct clk *mclk; | 66 | static struct clk *mclk; |
67 | 67 | ||
68 | static int at91sam9g20ek_startup(struct snd_pcm_substream *substream) | ||
69 | { | ||
70 | struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); | ||
71 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | ||
72 | int ret; | ||
73 | |||
74 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, | ||
75 | MCLK_RATE, SND_SOC_CLOCK_IN); | ||
76 | if (ret < 0) { | ||
77 | clk_disable(mclk); | ||
78 | return ret; | ||
79 | } | ||
80 | |||
81 | return 0; | ||
82 | } | ||
83 | |||
84 | static void at91sam9g20ek_shutdown(struct snd_pcm_substream *substream) | ||
85 | { | ||
86 | struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); | ||
87 | |||
88 | dev_dbg(rtd->socdev->dev, "shutdown"); | ||
89 | } | ||
90 | |||
91 | static int at91sam9g20ek_hw_params(struct snd_pcm_substream *substream, | 68 | static int at91sam9g20ek_hw_params(struct snd_pcm_substream *substream, |
92 | struct snd_pcm_hw_params *params) | 69 | struct snd_pcm_hw_params *params) |
93 | { | 70 | { |
@@ -112,9 +89,7 @@ static int at91sam9g20ek_hw_params(struct snd_pcm_substream *substream, | |||
112 | } | 89 | } |
113 | 90 | ||
114 | static struct snd_soc_ops at91sam9g20ek_ops = { | 91 | static struct snd_soc_ops at91sam9g20ek_ops = { |
115 | .startup = at91sam9g20ek_startup, | ||
116 | .hw_params = at91sam9g20ek_hw_params, | 92 | .hw_params = at91sam9g20ek_hw_params, |
117 | .shutdown = at91sam9g20ek_shutdown, | ||
118 | }; | 93 | }; |
119 | 94 | ||
120 | static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card, | 95 | static int at91sam9g20ek_set_bias_level(struct snd_soc_card *card, |
@@ -163,10 +138,20 @@ static const struct snd_soc_dapm_route intercon[] = { | |||
163 | */ | 138 | */ |
164 | static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec) | 139 | static int at91sam9g20ek_wm8731_init(struct snd_soc_codec *codec) |
165 | { | 140 | { |
141 | struct snd_soc_dai *codec_dai = &codec->dai[0]; | ||
142 | int ret; | ||
143 | |||
166 | printk(KERN_DEBUG | 144 | printk(KERN_DEBUG |
167 | "at91sam9g20ek_wm8731 " | 145 | "at91sam9g20ek_wm8731 " |
168 | ": at91sam9g20ek_wm8731_init() called\n"); | 146 | ": at91sam9g20ek_wm8731_init() called\n"); |
169 | 147 | ||
148 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK, | ||
149 | MCLK_RATE, SND_SOC_CLOCK_IN); | ||
150 | if (ret < 0) { | ||
151 | printk(KERN_ERR "Failed to set WM8731 SYSCLK: %d\n", ret); | ||
152 | return ret; | ||
153 | } | ||
154 | |||
170 | /* Add specific widgets */ | 155 | /* Add specific widgets */ |
171 | snd_soc_dapm_new_controls(codec, at91sam9g20ek_dapm_widgets, | 156 | snd_soc_dapm_new_controls(codec, at91sam9g20ek_dapm_widgets, |
172 | ARRAY_SIZE(at91sam9g20ek_dapm_widgets)); | 157 | ARRAY_SIZE(at91sam9g20ek_dapm_widgets)); |