]> err.no Git - linux-2.6/blobdiff - sound/pci/bt87x.c
[ALSA] ice1712 - Fix word clock status control on Delta 1010LT
[linux-2.6] / sound / pci / bt87x.c
index 10c8af1b736b143954bfece83752b2e9f798e568..2dba752faf4e6281a2a31bddf4a0998197f4d535 100644 (file)
@@ -149,6 +149,7 @@ MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards");
 
 /* Cards with configuration information */
 enum snd_bt87x_boardid {
+       SND_BT87X_BOARD_UNKNOWN,
        SND_BT87X_BOARD_GENERIC,        /* both an & dig interfaces, 32kHz */
        SND_BT87X_BOARD_ANALOG,         /* board with no external A/D */
        SND_BT87X_BOARD_OSPREY2x0,
@@ -164,7 +165,10 @@ struct snd_bt87x_board {
        unsigned no_digital:1;  /* No digital input */
 };
 
-static const __devinitdata struct snd_bt87x_board snd_bt87x_boards[] = {
+static __devinitdata struct snd_bt87x_board snd_bt87x_boards[] = {
+       [SND_BT87X_BOARD_UNKNOWN] = {
+               .dig_rate = 32000, /* just a guess */
+       },
        [SND_BT87X_BOARD_GENERIC] = {
                .dig_rate = 32000,
        },
@@ -377,7 +381,7 @@ static struct snd_pcm_hardware snd_bt87x_analog_hw = {
 
 static int snd_bt87x_set_digital_hw(struct snd_bt87x *chip, struct snd_pcm_runtime *runtime)
 {
-       chip->reg_control |= CTL_DA_IOM_DA;
+       chip->reg_control |= CTL_DA_IOM_DA | CTL_A_PWRDN;
        runtime->hw = snd_bt87x_digital_hw;
        runtime->hw.rates = snd_pcm_rate_to_rate_bit(chip->board.dig_rate);
        runtime->hw.rate_min = chip->board.dig_rate;
@@ -398,7 +402,7 @@ static int snd_bt87x_set_analog_hw(struct snd_bt87x *chip, struct snd_pcm_runtim
                .rats = &analog_clock
        };
 
-       chip->reg_control &= ~CTL_DA_IOM_DA;
+       chip->reg_control &= ~(CTL_DA_IOM_DA | CTL_A_PWRDN);
        runtime->hw = snd_bt87x_analog_hw;
        return snd_pcm_hw_constraint_ratnums(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                             &constraint_rates);
@@ -437,6 +441,11 @@ static int snd_bt87x_close(struct snd_pcm_substream *substream)
 {
        struct snd_bt87x *chip = snd_pcm_substream_chip(substream);
 
+       spin_lock_irq(&chip->reg_lock);
+       chip->reg_control |= CTL_A_PWRDN;
+       snd_bt87x_writel(chip, REG_GPIO_DMA_CTL, chip->reg_control);
+       spin_unlock_irq(&chip->reg_lock);
+
        chip->substream = NULL;
        clear_bit(0, &chip->opened);
        smp_mb__after_clear_bit();
@@ -751,7 +760,8 @@ static int __devinit snd_bt87x_create(struct snd_card *card,
                goto fail;
        }
 
-       chip->reg_control = CTL_DA_ES2 | CTL_PKTP_16 | (15 << CTL_DA_SDR_SHIFT);
+       chip->reg_control = CTL_A_PWRDN | CTL_DA_ES2 |
+                           CTL_PKTP_16 | (15 << CTL_DA_SDR_SHIFT);
        chip->interrupt_mask = MY_INTERRUPTS;
        snd_bt87x_writel(chip, REG_GPIO_DMA_CTL, chip->reg_control);
        snd_bt87x_writel(chip, REG_INT_MASK, 0);
@@ -838,7 +848,7 @@ static int __devinit snd_bt87x_detect_card(struct pci_dev *pci)
        int i;
        const struct pci_device_id *supported;
 
-       supported = pci_match_device(&driver, pci);
+       supported = pci_match_id(snd_bt87x_ids, pci);
        if (supported && supported->driver_data > 0)
                return supported->driver_data;
 
@@ -855,7 +865,7 @@ static int __devinit snd_bt87x_detect_card(struct pci_dev *pci)
        snd_printk(KERN_DEBUG "please mail id, board name, and, "
                   "if it works, the correct digital_rate option to "
                   "<alsa-devel@alsa-project.org>\n");
-       return SND_BT87X_BOARD_GENERIC;
+       return SND_BT87X_BOARD_UNKNOWN;
 }
 
 static int __devinit snd_bt87x_probe(struct pci_dev *pci,
@@ -953,8 +963,8 @@ static void __devexit snd_bt87x_remove(struct pci_dev *pci)
 /* default entries for all Bt87x cards - it's not exported */
 /* driver_data is set to 0 to call detection */
 static struct pci_device_id snd_bt87x_default_ids[] __devinitdata = {
-       BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, PCI_ANY_ID, PCI_ANY_ID, GENERIC),
-       BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, PCI_ANY_ID, PCI_ANY_ID, GENERIC),
+       BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, PCI_ANY_ID, PCI_ANY_ID, UNKNOWN),
+       BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, PCI_ANY_ID, PCI_ANY_ID, UNKNOWN),
        { }
 };