]> nv-tegra.nvidia Code Review - linux-2.6.git/blobdiff - sound/pci/ctxfi/cthw20k2.c
ALSA: ctxfi - Remove PAGE_SIZE limitation
[linux-2.6.git] / sound / pci / ctxfi / cthw20k2.c
index cdcb75cc33b68d4f6cab4140f61539b1dca2b41c..349728765f2c6068e4dbe39521d29cf49c41c8e1 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/string.h>
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
+#include <linux/delay.h>
 
 #define CT_XFI_DMA_MASK                DMA_BIT_MASK(32) /* 32 bits */
 
@@ -1143,7 +1144,7 @@ static int hw_daio_init(struct hw *hw, const struct daio_conf *info)
                hw_write_20kx(hw, AUDIO_IO_TX_BLRCLK, 0x11111111);
                hw_write_20kx(hw, AUDIO_IO_RX_BLRCLK, 0);
        } else {
-               printk(KERN_ALERT "ERROR!!! Invalid sampling rate!!!\n");
+               printk(KERN_ALERT "ctxfi: ERROR!!! Invalid sampling rate!!!\n");
                return -EINVAL;
        }
 
@@ -1196,24 +1197,16 @@ static int hw_trn_init(struct hw *hw, const struct trn_conf *info)
 
        /* Set up device page table */
        if ((~0UL) == info->vm_pgt_phys) {
-               printk(KERN_ALERT "Wrong device page table page address!!!\n");
+               printk(KERN_ALERT "ctxfi: "
+                      "Wrong device page table page address!!!\n");
                return -1;
        }
 
        vmctl = 0x80000C0F;  /* 32-bit, 4k-size page */
-#if BITS_PER_LONG == 64
-       ptp_phys_low = info->vm_pgt_phys & ((1UL<<32)-1);
-       ptp_phys_high = (info->vm_pgt_phys>>32) & ((1UL<<32)-1);
-       vmctl |= (3<<8);
-#elif BITS_PER_LONG == 32
-       ptp_phys_low = info->vm_pgt_phys & (~0UL);
-       ptp_phys_high = 0;
-#else
-#      error "Unknown BITS_PER_LONG!"
-#endif
-#if PAGE_SIZE == 8192
-#      error "Don't support 8k-page!"
-#endif
+       ptp_phys_low = (u32)info->vm_pgt_phys;
+       ptp_phys_high = upper_32_bits(info->vm_pgt_phys);
+       if (sizeof(void *) == 8) /* 64bit address */
+               vmctl |= (3 << 8);
        /* Write page table physical address to all PTPAL registers */
        for (i = 0; i < 64; i++) {
                hw_write_20kx(hw, VMEM_PTPAL+(16*i), ptp_phys_low);
@@ -1313,7 +1306,7 @@ static int hw_pll_init(struct hw *hw, unsigned int rsr)
                break;
        }
        if (i >= 1000) {
-               printk(KERN_ALERT "PLL initialization failed!!!\n");
+               printk(KERN_ALERT "ctxfi: PLL initialization failed!!!\n");
                return -EBUSY;
        }
 
@@ -1337,7 +1330,7 @@ static int hw_auto_init(struct hw *hw)
                        break;
        }
        if (!get_field(gctl, GCTL_AID)) {
-               printk(KERN_ALERT "Card Auto-init failed!!!\n");
+               printk(KERN_ALERT "ctxfi: Card Auto-init failed!!!\n");
                return -EBUSY;
        }
 
@@ -1761,7 +1754,7 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
        /* Initialize I2C */
        err = I2CInit(hw, 0x1A, 1, 1);
        if (err < 0) {
-               printk(KERN_ALERT "Failure to acquire I2C!!!\n");
+               printk(KERN_ALERT "ctxfi: Failure to acquire I2C!!!\n");
                goto error;
        }
 
@@ -1781,7 +1774,7 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
                I2CWrite(hw, MAKE_WM8775_ADDR(WM8775_MMC, 0x0A),
                                                MAKE_WM8775_DATA(0x0A));
        } else {
-               printk(KERN_ALERT "Invalid master sampling "
+               printk(KERN_ALERT "ctxfi: Invalid master sampling "
                                  "rate (msr %d)!!!\n", info->msr);
                err = -EINVAL;
                goto error;
@@ -1819,7 +1812,7 @@ static int hw_adc_init(struct hw *hw, const struct adc_conf *info)
                I2CWrite(hw, MAKE_WM8775_ADDR(WM8775_AADCR, 0xCF),
                                MAKE_WM8775_DATA(0xCF)); /* No boost */
        } else {
-               printk(KERN_ALERT "ERROR!!! Invalid input mux!!!\n");
+               printk(KERN_ALERT "ctxfi: ERROR!!! Invalid input mux!!!\n");
                err = -EINVAL;
                goto error;
        }
@@ -1851,7 +1844,7 @@ static int hw_card_start(struct hw *hw)
        dma_mask = CT_XFI_DMA_MASK;
        if (pci_set_dma_mask(pci, dma_mask) < 0 ||
            pci_set_consistent_dma_mask(pci, dma_mask) < 0) {
-               printk(KERN_ERR "architecture does not support PCI "
+               printk(KERN_ERR "ctxfi: architecture does not support PCI "
                "busmaster DMA with mask 0x%x\n", dma_mask);
                err = -ENXIO;
                goto error1;