aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c51
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c1
2 files changed, 41 insertions, 11 deletions
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 @@
35static DEFINE_MUTEX(car_mutex); 37static DEFINE_MUTEX(car_mutex);
36static DECLARE_WAIT_QUEUE_HEAD(gsr_wq); 38static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
37static volatile long gsr_bits; 39static volatile long gsr_bits;
40static struct clk *ac97_clk;
41#ifdef CONFIG_PXA27x
42static 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
317static int pxa2xx_ac97_hw_params(struct snd_pcm_substream *substream, 346static 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"