aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/pxa')
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 815c15336255..711b916e58a6 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -15,6 +15,7 @@
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/wait.h> 17#include <linux/wait.h>
18#include <linux/clk.h>
18#include <linux/delay.h> 19#include <linux/delay.h>
19 20
20#include <sound/core.h> 21#include <sound/core.h>
@@ -35,6 +36,10 @@
35static DEFINE_MUTEX(car_mutex); 36static DEFINE_MUTEX(car_mutex);
36static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); 37static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
37static volatile long gsr_bits; 38static volatile long gsr_bits;
39static struct clk *ac97_clk;
40#ifdef CONFIG_PXA27x
41static struct clk *ac97conf_clk;
42#endif
38 43
39/* 44/*
40 * Beware PXA27x bugs: 45 * Beware PXA27x bugs:
@@ -159,9 +164,9 @@ static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
159 gsr_bits = 0; 164 gsr_bits = 0;
160#ifdef CONFIG_PXA27x 165#ifdef CONFIG_PXA27x
161 /* PXA27x Developers Manual section 13.5.2.2.1 */ 166 /* PXA27x Developers Manual section 13.5.2.2.1 */
162 pxa_set_cken(CKEN_AC97CONF, 1); 167 clk_enable(ac97conf_clk);
163 udelay(5); 168 udelay(5);
164 pxa_set_cken(CKEN_AC97CONF, 0); 169 clk_disable(ac97conf_clk);
165 GCR = GCR_COLD_RST; 170 GCR = GCR_COLD_RST;
166 udelay(50); 171 udelay(50);
167#else 172#else
@@ -255,7 +260,7 @@ static int pxa2xx_ac97_suspend(struct platform_device *pdev,
255 struct snd_soc_cpu_dai *dai) 260 struct snd_soc_cpu_dai *dai)
256{ 261{
257 GCR |= GCR_ACLINK_OFF; 262 GCR |= GCR_ACLINK_OFF;
258 pxa_set_cken(CKEN_AC97, 0); 263 clk_disable(ac97_clk);
259 return 0; 264 return 0;
260} 265}
261 266
@@ -270,7 +275,7 @@ static int pxa2xx_ac97_resume(struct platform_device *pdev,
270 /* Use GPIO 113 as AC97 Reset on Bulverde */ 275 /* Use GPIO 113 as AC97 Reset on Bulverde */
271 pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); 276 pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
272#endif 277#endif
273 pxa_set_cken(CKEN_AC97, 1); 278 clk_enable(ac97_clk);
274 return 0; 279 return 0;
275} 280}
276 281
@@ -294,16 +299,32 @@ static int pxa2xx_ac97_probe(struct platform_device *pdev)
294#ifdef CONFIG_PXA27x 299#ifdef CONFIG_PXA27x
295 /* Use GPIO 113 as AC97 Reset on Bulverde */ 300 /* Use GPIO 113 as AC97 Reset on Bulverde */
296 pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); 301 pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
302
303 ac97conf_clk = clk_get(&pdev->dev, "AC97CONFCLK");
304 if (IS_ERR(ac97conf_clk)) {
305 ret = PTR_ERR(ac97conf_clk);
306 ac97conf_clk = NULL;
307 goto err_irq;
308 }
297#endif 309#endif
298 pxa_set_cken(CKEN_AC97, 1); 310 ac97_clk = clk_get(&pdev->dev, "AC97CLK");
311 if (IS_ERR(ac97_clk)) {
312 ret = PTR_ERR(ac97_clk);
313 ac97_clk = NULL;
314 goto err_irq;
315 }
299 return 0; 316 return 0;
300 317
301 err: 318 err_irq:
302 if (CKEN & (1 << CKEN_AC97)) { 319 GCR |= GCR_ACLINK_OFF;
303 GCR |= GCR_ACLINK_OFF; 320#ifdef CONFIG_PXA27x
304 free_irq(IRQ_AC97, NULL); 321 if (ac97conf_clk) {
305 pxa_set_cken(CKEN_AC97, 0); 322 clk_put(ac97conf_clk);
323 ac97conf_clk = NULL;
306 } 324 }
325#endif
326 free_irq(IRQ_AC97, NULL);
327 err:
307 return ret; 328 return ret;
308} 329}
309 330
@@ -311,7 +332,13 @@ static void pxa2xx_ac97_remove(struct platform_device *pdev)
311{ 332{
312 GCR |= GCR_ACLINK_OFF; 333 GCR |= GCR_ACLINK_OFF;
313 free_irq(IRQ_AC97, NULL); 334 free_irq(IRQ_AC97, NULL);
314 pxa_set_cken(CKEN_AC97, 0); 335#ifdef CONFIG_PXA27x
336 clk_put(ac97conf_clk);
337 ac97conf_clk = NULL;
338#endif
339 clk_disable(ac97_clk);
340 clk_put(ac97_clk);
341 ac97_clk = NULL;
315} 342}
316 343
317static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, 344static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream,