]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/arm/pxa2xx-ac97.c
Merge branch 'for-rmk' of git://source.mvista.com/git/linux-davinci-2.6.git
[linux-2.6-omap-h63xx.git] / sound / arm / pxa2xx-ac97.c
index 490729799e5955afc0584e3f2a37f37fe65dcdfe..714b3baa4be776ddcec323e4871cdbec0c6be44a 100644 (file)
 
 #include <asm/irq.h>
 #include <linux/mutex.h>
-#include <asm/hardware.h>
-#include <asm/arch/pxa-regs.h>
-#include <asm/arch/pxa2xx-gpio.h>
-#include <asm/arch/audio.h>
+#include <mach/hardware.h>
+#include <mach/pxa-regs.h>
+#include <mach/pxa2xx-gpio.h>
+#include <mach/audio.h>
 
 #include "pxa2xx-pcm.h"
 
@@ -112,6 +112,16 @@ static void pxa2xx_ac97_write(struct snd_ac97 *ac97, unsigned short reg, unsigne
 static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
 {
        /* First, try cold reset */
+#ifdef CONFIG_PXA3xx
+       int timeout;
+
+       /* Hold CLKBPB for 100us */
+       GCR = 0;
+       GCR = GCR_CLKBPB;
+       udelay(100);
+       GCR = 0;
+#endif
+
        GCR &=  GCR_COLD_RST;  /* clear everything but nCRST */
        GCR &= ~GCR_COLD_RST;  /* then assert nCRST */
 
@@ -123,6 +133,14 @@ static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
        clk_disable(ac97conf_clk);
        GCR = GCR_COLD_RST;
        udelay(50);
+#elif defined(CONFIG_PXA3xx)
+       timeout = 1000;
+       /* Can't use interrupts on PXA3xx */
+       GCR &= ~(GCR_PRIRDY_IEN|GCR_SECRDY_IEN);
+
+       GCR = GCR_WARM_RST | GCR_COLD_RST;
+       while (!(GSR & (GSR_PCR | GSR_SCR)) && timeout--)
+               mdelay(10);
 #else
        GCR = GCR_COLD_RST;
        GCR |= GCR_CDONE_IE|GCR_SDONE_IE;
@@ -143,6 +161,12 @@ static void pxa2xx_ac97_reset(struct snd_ac97 *ac97)
                GCR |= GCR_WARM_RST;
                pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
                udelay(500);
+#elif defined(CONFIG_PXA3xx)
+               timeout = 100;
+               /* Can't use interrupts */
+               GCR |= GCR_WARM_RST;
+               while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
+                       mdelay(1);
 #else
                GCR |= GCR_WARM_RST|GCR_PRIRDY_IEN|GCR_SECRDY_IEN;
                wait_event_timeout(gsr_wq, gsr_bits & (GSR_PCR | GSR_SCR), 1);
@@ -191,7 +215,7 @@ static struct snd_ac97_bus_ops pxa2xx_ac97_ops = {
 static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = {
        .name                   = "AC97 PCM out",
        .dev_addr               = __PREG(PCDR),
-       .drcmr                  = &DRCMRTXPCDR,
+       .drcmr                  = &DRCMR(12),
        .dcmd                   = DCMD_INCSRCADDR | DCMD_FLOWTRG |
                                  DCMD_BURST32 | DCMD_WIDTH4,
 };
@@ -199,7 +223,7 @@ static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_out = {
 static struct pxa2xx_pcm_dma_params pxa2xx_ac97_pcm_in = {
        .name                   = "AC97 PCM in",
        .dev_addr               = __PREG(PCDR),
-       .drcmr                  = &DRCMRRXPCDR,
+       .drcmr                  = &DRCMR(11),
        .dcmd                   = DCMD_INCTRGADDR | DCMD_FLOWSRC |
                                  DCMD_BURST32 | DCMD_WIDTH4,
 };
@@ -424,6 +448,7 @@ static struct platform_driver pxa2xx_ac97_driver = {
        .resume         = pxa2xx_ac97_resume,
        .driver         = {
                .name   = "pxa2xx-ac97",
+               .owner  = THIS_MODULE,
        },
 };
 
@@ -443,3 +468,4 @@ module_exit(pxa2xx_ac97_exit);
 MODULE_AUTHOR("Nicolas Pitre");
 MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip");
 MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:pxa2xx-ac97");