diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/arm/pxa2xx-ac97.c | 49 | ||||
-rw-r--r-- | sound/soc/at91/eti_b1_wm8731.c | 30 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-ac97.c | 51 | ||||
-rw-r--r-- | sound/soc/pxa/pxa2xx-i2s.c | 1 |
4 files changed, 89 insertions, 42 deletions
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c index 5d86e6809752..8704e2825b10 100644 --- a/sound/arm/pxa2xx-ac97.c +++ b/sound/arm/pxa2xx-ac97.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
17 | #include <linux/interrupt.h> | 17 | #include <linux/interrupt.h> |
18 | #include <linux/wait.h> | 18 | #include <linux/wait.h> |
19 | #include <linux/clk.h> | ||
19 | #include <linux/delay.h> | 20 | #include <linux/delay.h> |
20 | 21 | ||
21 | #include <sound/core.h> | 22 | #include <sound/core.h> |
@@ -27,6 +28,7 @@ | |||
27 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
28 | #include <asm/hardware.h> | 29 | #include <asm/hardware.h> |
29 | #include <asm/arch/pxa-regs.h> | 30 | #include <asm/arch/pxa-regs.h> |
31 | #include <asm/arch/pxa2xx-gpio.h> | ||
30 | #include <asm/arch/audio.h> | 32 | #include <asm/arch/audio.h> |
31 | 33 | ||
32 | #include "pxa2xx-pcm.h" | 34 | #include "pxa2xx-pcm.h" |
@@ -35,6 +37,10 @@ | |||
35 | static DEFINE_MUTEX(car_mutex); | 37 | static DEFINE_MUTEX(car_mutex); |
36 | static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); | 38 | static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); |
37 | static volatile long gsr_bits; | 39 | static volatile long gsr_bits; |
40 | static struct clk *ac97_clk; | ||
41 | #ifdef CONFIG_PXA27x | ||
42 | static struct clk *ac97conf_clk; | ||
43 | #endif | ||
38 | 44 | ||
39 | /* | 45 | /* |
40 | * Beware PXA27x bugs: | 46 | * Beware PXA27x bugs: |
@@ -112,9 +118,9 @@ static void pxa2xx_ac97_reset(struct snd_ac97 *ac97) | |||
112 | gsr_bits = 0; | 118 | gsr_bits = 0; |
113 | #ifdef CONFIG_PXA27x | 119 | #ifdef CONFIG_PXA27x |
114 | /* PXA27x Developers Manual section 13.5.2.2.1 */ | 120 | /* PXA27x Developers Manual section 13.5.2.2.1 */ |
115 | pxa_set_cken(CKEN_AC97CONF, 1); | 121 | clk_enable(ac97conf_clk); |
116 | udelay(5); | 122 | udelay(5); |
117 | pxa_set_cken(CKEN_AC97CONF, 0); | 123 | clk_disable(ac97conf_clk); |
118 | GCR = GCR_COLD_RST; | 124 | GCR = GCR_COLD_RST; |
119 | udelay(50); | 125 | udelay(50); |
120 | #else | 126 | #else |
@@ -259,7 +265,7 @@ static int pxa2xx_ac97_do_suspend(struct snd_card *card, pm_message_t state) | |||
259 | if (platform_ops && platform_ops->suspend) | 265 | if (platform_ops && platform_ops->suspend) |
260 | platform_ops->suspend(platform_ops->priv); | 266 | platform_ops->suspend(platform_ops->priv); |
261 | GCR |= GCR_ACLINK_OFF; | 267 | GCR |= GCR_ACLINK_OFF; |
262 | pxa_set_cken(CKEN_AC97, 0); | 268 | clk_disable(ac97_clk); |
263 | 269 | ||
264 | return 0; | 270 | return 0; |
265 | } | 271 | } |
@@ -268,7 +274,7 @@ static int pxa2xx_ac97_do_resume(struct snd_card *card) | |||
268 | { | 274 | { |
269 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; | 275 | pxa2xx_audio_ops_t *platform_ops = card->dev->platform_data; |
270 | 276 | ||
271 | pxa_set_cken(CKEN_AC97, 1); | 277 | clk_enable(ac97_clk); |
272 | if (platform_ops && platform_ops->resume) | 278 | if (platform_ops && platform_ops->resume) |
273 | platform_ops->resume(platform_ops->priv); | 279 | platform_ops->resume(platform_ops->priv); |
274 | snd_ac97_resume(pxa2xx_ac97_ac97); | 280 | snd_ac97_resume(pxa2xx_ac97_ac97); |
@@ -335,8 +341,21 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) | |||
335 | #ifdef CONFIG_PXA27x | 341 | #ifdef CONFIG_PXA27x |
336 | /* Use GPIO 113 as AC97 Reset on Bulverde */ | 342 | /* Use GPIO 113 as AC97 Reset on Bulverde */ |
337 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); | 343 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); |
344 | ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); | ||
345 | if (IS_ERR(ac97conf_clk)) { | ||
346 | ret = PTR_ERR(ac97conf_clk); | ||
347 | ac97conf_clk = NULL; | ||
348 | goto err; | ||
349 | } | ||
338 | #endif | 350 | #endif |
339 | pxa_set_cken(CKEN_AC97, 1); | 351 | |
352 | ac97_clk = clk_get(&dev->dev, "AC97CLK"); | ||
353 | if (IS_ERR(ac97_clk)) { | ||
354 | ret = PTR_ERR(ac97_clk); | ||
355 | ac97_clk = NULL; | ||
356 | goto err; | ||
357 | } | ||
358 | clk_enable(ac97_clk); | ||
340 | 359 | ||
341 | ret = snd_ac97_bus(card, 0, &pxa2xx_ac97_ops, NULL, &ac97_bus); | 360 | ret = snd_ac97_bus(card, 0, &pxa2xx_ac97_ops, NULL, &ac97_bus); |
342 | if (ret) | 361 | if (ret) |
@@ -361,11 +380,19 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) | |||
361 | err: | 380 | err: |
362 | if (card) | 381 | if (card) |
363 | snd_card_free(card); | 382 | snd_card_free(card); |
364 | if (CKEN & (1 << CKEN_AC97)) { | 383 | if (ac97_clk) { |
365 | GCR |= GCR_ACLINK_OFF; | 384 | GCR |= GCR_ACLINK_OFF; |
366 | free_irq(IRQ_AC97, NULL); | 385 | free_irq(IRQ_AC97, NULL); |
367 | pxa_set_cken(CKEN_AC97, 0); | 386 | clk_disable(ac97_clk); |
387 | clk_put(ac97_clk); | ||
388 | ac97_clk = NULL; | ||
389 | } | ||
390 | #ifdef CONFIG_PXA27x | ||
391 | if (ac97conf_clk) { | ||
392 | clk_put(ac97conf_clk); | ||
393 | ac97conf_clk = NULL; | ||
368 | } | 394 | } |
395 | #endif | ||
369 | return ret; | 396 | return ret; |
370 | } | 397 | } |
371 | 398 | ||
@@ -378,7 +405,13 @@ static int __devexit pxa2xx_ac97_remove(struct platform_device *dev) | |||
378 | platform_set_drvdata(dev, NULL); | 405 | platform_set_drvdata(dev, NULL); |
379 | GCR |= GCR_ACLINK_OFF; | 406 | GCR |= GCR_ACLINK_OFF; |
380 | free_irq(IRQ_AC97, NULL); | 407 | free_irq(IRQ_AC97, NULL); |
381 | pxa_set_cken(CKEN_AC97, 0); | 408 | clk_disable(ac97_clk); |
409 | clk_put(ac97_clk); | ||
410 | ac97_clk = NULL; | ||
411 | #ifdef CONFIG_PXA27x | ||
412 | clk_put(ac97conf_clk); | ||
413 | ac97conf_clk = NULL; | ||
414 | #endif | ||
382 | } | 415 | } |
383 | 416 | ||
384 | return 0; | 417 | return 0; |
diff --git a/sound/soc/at91/eti_b1_wm8731.c b/sound/soc/at91/eti_b1_wm8731.c index ad3ad9d662f8..1347dcf3f80b 100644 --- a/sound/soc/at91/eti_b1_wm8731.c +++ b/sound/soc/at91/eti_b1_wm8731.c | |||
@@ -33,8 +33,7 @@ | |||
33 | #include <sound/soc.h> | 33 | #include <sound/soc.h> |
34 | #include <sound/soc-dapm.h> | 34 | #include <sound/soc-dapm.h> |
35 | 35 | ||
36 | #include <asm/arch/hardware.h> | 36 | #include <asm/hardware.h> |
37 | #include <asm/arch/at91_pio.h> | ||
38 | #include <asm/arch/gpio.h> | 37 | #include <asm/arch/gpio.h> |
39 | 38 | ||
40 | #include "../codecs/wm8731.h" | 39 | #include "../codecs/wm8731.h" |
@@ -47,13 +46,6 @@ | |||
47 | #define DBG(x...) | 46 | #define DBG(x...) |
48 | #endif | 47 | #endif |
49 | 48 | ||
50 | #define AT91_PIO_TF1 (1 << (AT91_PIN_PB6 - PIN_BASE) % 32) | ||
51 | #define AT91_PIO_TK1 (1 << (AT91_PIN_PB7 - PIN_BASE) % 32) | ||
52 | #define AT91_PIO_TD1 (1 << (AT91_PIN_PB8 - PIN_BASE) % 32) | ||
53 | #define AT91_PIO_RD1 (1 << (AT91_PIN_PB9 - PIN_BASE) % 32) | ||
54 | #define AT91_PIO_RK1 (1 << (AT91_PIN_PB10 - PIN_BASE) % 32) | ||
55 | #define AT91_PIO_RF1 (1 << (AT91_PIN_PB11 - PIN_BASE) % 32) | ||
56 | |||
57 | static struct clk *pck1_clk; | 49 | static struct clk *pck1_clk; |
58 | static struct clk *pllb_clk; | 50 | static struct clk *pllb_clk; |
59 | 51 | ||
@@ -276,7 +268,6 @@ static struct platform_device *eti_b1_snd_device; | |||
276 | static int __init eti_b1_init(void) | 268 | static int __init eti_b1_init(void) |
277 | { | 269 | { |
278 | int ret; | 270 | int ret; |
279 | u32 ssc_pio_lines; | ||
280 | struct at91_ssc_periph *ssc = eti_b1_dai.cpu_dai->private_data; | 271 | struct at91_ssc_periph *ssc = eti_b1_dai.cpu_dai->private_data; |
281 | 272 | ||
282 | if (!request_mem_region(AT91RM9200_BASE_SSC1, SZ_16K, "soc-audio")) { | 273 | if (!request_mem_region(AT91RM9200_BASE_SSC1, SZ_16K, "soc-audio")) { |
@@ -310,19 +301,12 @@ static int __init eti_b1_init(void) | |||
310 | goto fail_io_unmap; | 301 | goto fail_io_unmap; |
311 | } | 302 | } |
312 | 303 | ||
313 | ssc_pio_lines = AT91_PIO_TF1 | AT91_PIO_TK1 | AT91_PIO_TD1 | 304 | at91_set_A_periph(AT91_PIN_PB6, 0); /* TF1 */ |
314 | | AT91_PIO_RD1 /* | AT91_PIO_RK1 */ | AT91_PIO_RF1; | 305 | at91_set_A_periph(AT91_PIN_PB7, 0); /* TK1 */ |
315 | 306 | at91_set_A_periph(AT91_PIN_PB8, 0); /* TD1 */ | |
316 | /* Reset all PIO registers and assign lines to peripheral A */ | 307 | at91_set_A_periph(AT91_PIN_PB9, 0); /* RD1 */ |
317 | at91_sys_write(AT91_PIOB + PIO_PDR, ssc_pio_lines); | 308 | /* at91_set_A_periph(AT91_PIN_PB10, 0);*/ /* RK1 */ |
318 | at91_sys_write(AT91_PIOB + PIO_ODR, ssc_pio_lines); | 309 | at91_set_A_periph(AT91_PIN_PB11, 0); /* RF1 */ |
319 | at91_sys_write(AT91_PIOB + PIO_IFDR, ssc_pio_lines); | ||
320 | at91_sys_write(AT91_PIOB + PIO_CODR, ssc_pio_lines); | ||
321 | at91_sys_write(AT91_PIOB + PIO_IDR, ssc_pio_lines); | ||
322 | at91_sys_write(AT91_PIOB + PIO_MDDR, ssc_pio_lines); | ||
323 | at91_sys_write(AT91_PIOB + PIO_PUDR, ssc_pio_lines); | ||
324 | at91_sys_write(AT91_PIOB + PIO_ASR, ssc_pio_lines); | ||
325 | at91_sys_write(AT91_PIOB + PIO_OWDR, ssc_pio_lines); | ||
326 | 310 | ||
327 | /* | 311 | /* |
328 | * Set PCK1 parent to PLLB and its rate to 12 Mhz. | 312 | * Set PCK1 parent to PLLB and its rate to 12 Mhz. |
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c index 815c15336255..e17379998802 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> |
@@ -27,6 +28,7 @@ | |||
27 | #include <linux/mutex.h> | 28 | #include <linux/mutex.h> |
28 | #include <asm/hardware.h> | 29 | #include <asm/hardware.h> |
29 | #include <asm/arch/pxa-regs.h> | 30 | #include <asm/arch/pxa-regs.h> |
31 | #include <asm/arch/pxa2xx-gpio.h> | ||
30 | #include <asm/arch/audio.h> | 32 | #include <asm/arch/audio.h> |
31 | 33 | ||
32 | #include "pxa2xx-pcm.h" | 34 | #include "pxa2xx-pcm.h" |
@@ -35,6 +37,10 @@ | |||
35 | static DEFINE_MUTEX(car_mutex); | 37 | static DEFINE_MUTEX(car_mutex); |
36 | static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); | 38 | static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); |
37 | static volatile long gsr_bits; | 39 | static volatile long gsr_bits; |
40 | static struct clk *ac97_clk; | ||
41 | #ifdef CONFIG_PXA27x | ||
42 | static struct clk *ac97conf_clk; | ||
43 | #endif | ||
38 | 44 | ||
39 | /* | 45 | /* |
40 | * Beware PXA27x bugs: | 46 | * Beware PXA27x bugs: |
@@ -159,9 +165,9 @@ static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97) | |||
159 | gsr_bits = 0; | 165 | gsr_bits = 0; |
160 | #ifdef CONFIG_PXA27x | 166 | #ifdef CONFIG_PXA27x |
161 | /* PXA27x Developers Manual section 13.5.2.2.1 */ | 167 | /* PXA27x Developers Manual section 13.5.2.2.1 */ |
162 | pxa_set_cken(CKEN_AC97CONF, 1); | 168 | clk_enable(ac97conf_clk); |
163 | udelay(5); | 169 | udelay(5); |
164 | pxa_set_cken(CKEN_AC97CONF, 0); | 170 | clk_disable(ac97conf_clk); |
165 | GCR = GCR_COLD_RST; | 171 | GCR = GCR_COLD_RST; |
166 | udelay(50); | 172 | udelay(50); |
167 | #else | 173 | #else |
@@ -255,7 +261,7 @@ static int pxa2xx_ac97_suspend(struct platform_device *pdev, | |||
255 | struct snd_soc_cpu_dai *dai) | 261 | struct snd_soc_cpu_dai *dai) |
256 | { | 262 | { |
257 | GCR |= GCR_ACLINK_OFF; | 263 | GCR |= GCR_ACLINK_OFF; |
258 | pxa_set_cken(CKEN_AC97, 0); | 264 | clk_disable(ac97_clk); |
259 | return 0; | 265 | return 0; |
260 | } | 266 | } |
261 | 267 | ||
@@ -270,7 +276,7 @@ static int pxa2xx_ac97_resume(struct platform_device *pdev, | |||
270 | /* Use GPIO 113 as AC97 Reset on Bulverde */ | 276 | /* Use GPIO 113 as AC97 Reset on Bulverde */ |
271 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); | 277 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); |
272 | #endif | 278 | #endif |
273 | pxa_set_cken(CKEN_AC97, 1); | 279 | clk_enable(ac97_clk); |
274 | return 0; | 280 | return 0; |
275 | } | 281 | } |
276 | 282 | ||
@@ -294,16 +300,33 @@ static int pxa2xx_ac97_probe(struct platform_device *pdev) | |||
294 | #ifdef CONFIG_PXA27x | 300 | #ifdef CONFIG_PXA27x |
295 | /* Use GPIO 113 as AC97 Reset on Bulverde */ | 301 | /* Use GPIO 113 as AC97 Reset on Bulverde */ |
296 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); | 302 | pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT); |
303 | |||
304 | ac97conf_clk = clk_get(&pdev->dev, "AC97CONFCLK"); | ||
305 | if (IS_ERR(ac97conf_clk)) { | ||
306 | ret = PTR_ERR(ac97conf_clk); | ||
307 | ac97conf_clk = NULL; | ||
308 | goto err_irq; | ||
309 | } | ||
297 | #endif | 310 | #endif |
298 | pxa_set_cken(CKEN_AC97, 1); | 311 | ac97_clk = clk_get(&pdev->dev, "AC97CLK"); |
312 | if (IS_ERR(ac97_clk)) { | ||
313 | ret = PTR_ERR(ac97_clk); | ||
314 | ac97_clk = NULL; | ||
315 | goto err_irq; | ||
316 | } | ||
317 | clk_enable(ac97_clk); | ||
299 | return 0; | 318 | return 0; |
300 | 319 | ||
301 | err: | 320 | err_irq: |
302 | if (CKEN & (1 << CKEN_AC97)) { | 321 | GCR |= GCR_ACLINK_OFF; |
303 | GCR |= GCR_ACLINK_OFF; | 322 | #ifdef CONFIG_PXA27x |
304 | free_irq(IRQ_AC97, NULL); | 323 | if (ac97conf_clk) { |
305 | pxa_set_cken(CKEN_AC97, 0); | 324 | clk_put(ac97conf_clk); |
325 | ac97conf_clk = NULL; | ||
306 | } | 326 | } |
327 | #endif | ||
328 | free_irq(IRQ_AC97, NULL); | ||
329 | err: | ||
307 | return ret; | 330 | return ret; |
308 | } | 331 | } |
309 | 332 | ||
@@ -311,7 +334,13 @@ static void pxa2xx_ac97_remove(struct platform_device *pdev) | |||
311 | { | 334 | { |
312 | GCR |= GCR_ACLINK_OFF; | 335 | GCR |= GCR_ACLINK_OFF; |
313 | free_irq(IRQ_AC97, NULL); | 336 | free_irq(IRQ_AC97, NULL); |
314 | pxa_set_cken(CKEN_AC97, 0); | 337 | #ifdef CONFIG_PXA27x |
338 | clk_put(ac97conf_clk); | ||
339 | ac97conf_clk = NULL; | ||
340 | #endif | ||
341 | clk_disable(ac97_clk); | ||
342 | clk_put(ac97_clk); | ||
343 | ac97_clk = NULL; | ||
315 | } | 344 | } |
316 | 345 | ||
317 | static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, | 346 | static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, |
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c index 692b90002489..425071030970 100644 --- a/sound/soc/pxa/pxa2xx-i2s.c +++ b/sound/soc/pxa/pxa2xx-i2s.c | |||
@@ -25,6 +25,7 @@ | |||
25 | 25 | ||
26 | #include <asm/hardware.h> | 26 | #include <asm/hardware.h> |
27 | #include <asm/arch/pxa-regs.h> | 27 | #include <asm/arch/pxa-regs.h> |
28 | #include <asm/arch/pxa2xx-gpio.h> | ||
28 | #include <asm/arch/audio.h> | 29 | #include <asm/arch/audio.h> |
29 | 30 | ||
30 | #include "pxa2xx-pcm.h" | 31 | #include "pxa2xx-pcm.h" |