diff options
Diffstat (limited to 'sound/soc')
-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 |
3 files changed, 48 insertions, 34 deletions
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" |