diff options
| author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
|---|---|---|
| committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2006-03-23 23:44:19 -0500 |
| commit | 1ebbe2b20091d306453a5cf480a87e6cd28ae76f (patch) | |
| tree | f5cd7a0fa69b8b1938cb5a0faed2e7b0628072a5 /sound/pci/ice1712/ice1712.c | |
| parent | ac58c9059da8886b5e8cde012a80266b18ca146e (diff) | |
| parent | 674a396c6d2ba0341ebdd7c1c9950f32f018e2dd (diff) | |
Merge branch 'linus'
Diffstat (limited to 'sound/pci/ice1712/ice1712.c')
| -rw-r--r-- | sound/pci/ice1712/ice1712.c | 68 |
1 files changed, 44 insertions, 24 deletions
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index ef6f18558c95..672e198317e1 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
| @@ -53,8 +53,10 @@ | |||
| 53 | #include <linux/interrupt.h> | 53 | #include <linux/interrupt.h> |
| 54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
| 55 | #include <linux/pci.h> | 55 | #include <linux/pci.h> |
| 56 | #include <linux/dma-mapping.h> | ||
| 56 | #include <linux/slab.h> | 57 | #include <linux/slab.h> |
| 57 | #include <linux/moduleparam.h> | 58 | #include <linux/moduleparam.h> |
| 59 | #include <linux/mutex.h> | ||
| 58 | #include <sound/core.h> | 60 | #include <sound/core.h> |
| 59 | #include <sound/cs8427.h> | 61 | #include <sound/cs8427.h> |
| 60 | #include <sound/info.h> | 62 | #include <sound/info.h> |
| @@ -82,10 +84,11 @@ MODULE_SUPPORTED_DEVICE("{" | |||
| 82 | 84 | ||
| 83 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 85 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
| 84 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ | 86 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ |
| 85 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ | 87 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ |
| 86 | static char *model[SNDRV_CARDS]; | 88 | static char *model[SNDRV_CARDS]; |
| 87 | static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ | 89 | static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ |
| 88 | static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transciever reset timeout value in msec */ | 90 | static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transciever reset timeout value in msec */ |
| 91 | static int dxr_enable[SNDRV_CARDS]; /* DXR enable for DMX6FIRE */ | ||
| 89 | 92 | ||
| 90 | module_param_array(index, int, NULL, 0444); | 93 | module_param_array(index, int, NULL, 0444); |
| 91 | MODULE_PARM_DESC(index, "Index value for ICE1712 soundcard."); | 94 | MODULE_PARM_DESC(index, "Index value for ICE1712 soundcard."); |
| @@ -99,6 +102,8 @@ module_param_array(cs8427_timeout, int, NULL, 0444); | |||
| 99 | MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec resolution."); | 102 | MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec resolution."); |
| 100 | module_param_array(model, charp, NULL, 0444); | 103 | module_param_array(model, charp, NULL, 0444); |
| 101 | MODULE_PARM_DESC(model, "Use the given board model."); | 104 | MODULE_PARM_DESC(model, "Use the given board model."); |
| 105 | module_param_array(dxr_enable, int, NULL, 0444); | ||
| 106 | MODULE_PARM_DESC(dxr_enable, "Enable DXR support for Terratec DMX6FIRE."); | ||
| 102 | 107 | ||
| 103 | 108 | ||
| 104 | static struct pci_device_id snd_ice1712_ids[] = { | 109 | static struct pci_device_id snd_ice1712_ids[] = { |
| @@ -316,7 +321,6 @@ static void snd_ice1712_set_gpio_data(struct snd_ice1712 *ice, unsigned int val) | |||
| 316 | inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ | 321 | inb(ICEREG(ice, DATA)); /* dummy read for pci-posting */ |
| 317 | } | 322 | } |
| 318 | 323 | ||
| 319 | |||
| 320 | /* | 324 | /* |
| 321 | * | 325 | * |
| 322 | * CS8427 interface | 326 | * CS8427 interface |
| @@ -396,6 +400,20 @@ int __devinit snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr) | |||
| 396 | return 0; | 400 | return 0; |
| 397 | } | 401 | } |
| 398 | 402 | ||
| 403 | static void snd_ice1712_set_input_clock_source(struct snd_ice1712 *ice, int spdif_is_master) | ||
| 404 | { | ||
| 405 | /* change CS8427 clock source too */ | ||
| 406 | if (ice->cs8427) | ||
| 407 | snd_ice1712_cs8427_set_input_clock(ice, spdif_is_master); | ||
| 408 | /* notify ak4524 chip as well */ | ||
| 409 | if (spdif_is_master) { | ||
| 410 | unsigned int i; | ||
| 411 | for (i = 0; i < ice->akm_codecs; i++) { | ||
| 412 | if (ice->akm[i].ops.set_rate_val) | ||
| 413 | ice->akm[i].ops.set_rate_val(&ice->akm[i], 0); | ||
| 414 | } | ||
| 415 | } | ||
| 416 | } | ||
| 399 | 417 | ||
| 400 | /* | 418 | /* |
| 401 | * Interrupt handler | 419 | * Interrupt handler |
| @@ -1567,6 +1585,9 @@ static void snd_ice1712_proc_read(struct snd_info_entry *entry, | |||
| 1567 | snd_iprintf(buffer, " CAPTURE : 0x%08x\n", inl(ICEMT(ice, ROUTE_CAPTURE))); | 1585 | snd_iprintf(buffer, " CAPTURE : 0x%08x\n", inl(ICEMT(ice, ROUTE_CAPTURE))); |
| 1568 | snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT))); | 1586 | snd_iprintf(buffer, " SPDOUT : 0x%04x\n", (unsigned)inw(ICEMT(ice, ROUTE_SPDOUT))); |
| 1569 | snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE))); | 1587 | snd_iprintf(buffer, " RATE : 0x%02x\n", (unsigned)inb(ICEMT(ice, RATE))); |
| 1588 | snd_iprintf(buffer, " GPIO_DATA : 0x%02x\n", (unsigned)snd_ice1712_get_gpio_data(ice)); | ||
| 1589 | snd_iprintf(buffer, " GPIO_WRITE_MASK : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_WRITE_MASK)); | ||
| 1590 | snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION)); | ||
| 1570 | } | 1591 | } |
| 1571 | 1592 | ||
| 1572 | static void __devinit snd_ice1712_proc_init(struct snd_ice1712 * ice) | 1593 | static void __devinit snd_ice1712_proc_init(struct snd_ice1712 * ice) |
| @@ -1856,20 +1877,8 @@ static int snd_ice1712_pro_internal_clock_put(struct snd_kcontrol *kcontrol, | |||
| 1856 | spin_unlock_irq(&ice->reg_lock); | 1877 | spin_unlock_irq(&ice->reg_lock); |
| 1857 | 1878 | ||
| 1858 | if ((oval & ICE1712_SPDIF_MASTER) != | 1879 | if ((oval & ICE1712_SPDIF_MASTER) != |
| 1859 | (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) { | 1880 | (inb(ICEMT(ice, RATE)) & ICE1712_SPDIF_MASTER)) |
| 1860 | /* change CS8427 clock source too */ | 1881 | snd_ice1712_set_input_clock_source(ice, is_spdif_master(ice)); |
| 1861 | if (ice->cs8427) { | ||
| 1862 | snd_ice1712_cs8427_set_input_clock(ice, is_spdif_master(ice)); | ||
| 1863 | } | ||
| 1864 | /* notify ak4524 chip as well */ | ||
| 1865 | if (is_spdif_master(ice)) { | ||
| 1866 | unsigned int i; | ||
| 1867 | for (i = 0; i < ice->akm_codecs; i++) { | ||
| 1868 | if (ice->akm[i].ops.set_rate_val) | ||
| 1869 | ice->akm[i].ops.set_rate_val(&ice->akm[i], 0); | ||
| 1870 | } | ||
| 1871 | } | ||
| 1872 | } | ||
| 1873 | 1882 | ||
| 1874 | return change; | 1883 | return change; |
| 1875 | } | 1884 | } |
| @@ -2388,7 +2397,13 @@ static int __devinit snd_ice1712_chip_init(struct snd_ice1712 *ice) | |||
| 2388 | udelay(200); | 2397 | udelay(200); |
| 2389 | outb(ICE1712_NATIVE, ICEREG(ice, CONTROL)); | 2398 | outb(ICE1712_NATIVE, ICEREG(ice, CONTROL)); |
| 2390 | udelay(200); | 2399 | udelay(200); |
| 2391 | pci_write_config_byte(ice->pci, 0x60, ice->eeprom.data[ICE_EEP1_CODEC]); | 2400 | if (ice->eeprom.subvendor == ICE1712_SUBDEVICE_DMX6FIRE && !ice->dxr_enable) { |
| 2401 | /* Limit active ADCs and DACs to 6; */ | ||
| 2402 | /* Note: DXR extension not supported */ | ||
| 2403 | pci_write_config_byte(ice->pci, 0x60, 0x0a); | ||
| 2404 | } else { | ||
| 2405 | pci_write_config_byte(ice->pci, 0x60, ice->eeprom.data[ICE_EEP1_CODEC]); | ||
| 2406 | } | ||
| 2392 | pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]); | 2407 | pci_write_config_byte(ice->pci, 0x61, ice->eeprom.data[ICE_EEP1_ACLINK]); |
| 2393 | pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]); | 2408 | pci_write_config_byte(ice->pci, 0x62, ice->eeprom.data[ICE_EEP1_I2SID]); |
| 2394 | pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]); | 2409 | pci_write_config_byte(ice->pci, 0x63, ice->eeprom.data[ICE_EEP1_SPDIF]); |
| @@ -2524,6 +2539,7 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
| 2524 | const char *modelname, | 2539 | const char *modelname, |
| 2525 | int omni, | 2540 | int omni, |
| 2526 | int cs8427_timeout, | 2541 | int cs8427_timeout, |
| 2542 | int dxr_enable, | ||
| 2527 | struct snd_ice1712 ** r_ice1712) | 2543 | struct snd_ice1712 ** r_ice1712) |
| 2528 | { | 2544 | { |
| 2529 | struct snd_ice1712 *ice; | 2545 | struct snd_ice1712 *ice; |
| @@ -2538,8 +2554,8 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
| 2538 | if ((err = pci_enable_device(pci)) < 0) | 2554 | if ((err = pci_enable_device(pci)) < 0) |
| 2539 | return err; | 2555 | return err; |
| 2540 | /* check, if we can restrict PCI DMA transfers to 28 bits */ | 2556 | /* check, if we can restrict PCI DMA transfers to 28 bits */ |
| 2541 | if (pci_set_dma_mask(pci, 0x0fffffff) < 0 || | 2557 | if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || |
| 2542 | pci_set_consistent_dma_mask(pci, 0x0fffffff) < 0) { | 2558 | pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { |
| 2543 | snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); | 2559 | snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); |
| 2544 | pci_disable_device(pci); | 2560 | pci_disable_device(pci); |
| 2545 | return -ENXIO; | 2561 | return -ENXIO; |
| @@ -2556,10 +2572,11 @@ static int __devinit snd_ice1712_create(struct snd_card *card, | |||
| 2556 | else if (cs8427_timeout > 1000) | 2572 | else if (cs8427_timeout > 1000) |
| 2557 | cs8427_timeout = 1000; | 2573 | cs8427_timeout = 1000; |
| 2558 | ice->cs8427_timeout = cs8427_timeout; | 2574 | ice->cs8427_timeout = cs8427_timeout; |
| 2575 | ice->dxr_enable = dxr_enable; | ||
| 2559 | spin_lock_init(&ice->reg_lock); | 2576 | spin_lock_init(&ice->reg_lock); |
| 2560 | init_MUTEX(&ice->gpio_mutex); | 2577 | mutex_init(&ice->gpio_mutex); |
| 2561 | init_MUTEX(&ice->i2c_mutex); | 2578 | mutex_init(&ice->i2c_mutex); |
| 2562 | init_MUTEX(&ice->open_mutex); | 2579 | mutex_init(&ice->open_mutex); |
| 2563 | ice->gpio.set_mask = snd_ice1712_set_gpio_mask; | 2580 | ice->gpio.set_mask = snd_ice1712_set_gpio_mask; |
| 2564 | ice->gpio.set_dir = snd_ice1712_set_gpio_dir; | 2581 | ice->gpio.set_dir = snd_ice1712_set_gpio_dir; |
| 2565 | ice->gpio.set_data = snd_ice1712_set_gpio_data; | 2582 | ice->gpio.set_data = snd_ice1712_set_gpio_data; |
| @@ -2658,7 +2675,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, | |||
| 2658 | strcpy(card->shortname, "ICEnsemble ICE1712"); | 2675 | strcpy(card->shortname, "ICEnsemble ICE1712"); |
| 2659 | 2676 | ||
| 2660 | if ((err = snd_ice1712_create(card, pci, model[dev], omni[dev], | 2677 | if ((err = snd_ice1712_create(card, pci, model[dev], omni[dev], |
| 2661 | cs8427_timeout[dev], &ice)) < 0) { | 2678 | cs8427_timeout[dev], dxr_enable[dev], |
| 2679 | &ice)) < 0) { | ||
| 2662 | snd_card_free(card); | 2680 | snd_card_free(card); |
| 2663 | return err; | 2681 | return err; |
| 2664 | } | 2682 | } |
| @@ -2735,6 +2753,8 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, | |||
| 2735 | } | 2753 | } |
| 2736 | } | 2754 | } |
| 2737 | 2755 | ||
| 2756 | snd_ice1712_set_input_clock_source(ice, 0); | ||
| 2757 | |||
| 2738 | sprintf(card->longname, "%s at 0x%lx, irq %i", | 2758 | sprintf(card->longname, "%s at 0x%lx, irq %i", |
| 2739 | card->shortname, ice->port, ice->irq); | 2759 | card->shortname, ice->port, ice->irq); |
| 2740 | 2760 | ||
