diff options
Diffstat (limited to 'sound/pci/hda/hda_intel.c')
-rw-r--r-- | sound/pci/hda/hda_intel.c | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 6fe696e53ea6..9d1412a9f2f8 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -47,23 +47,24 @@ | |||
47 | #include "hda_codec.h" | 47 | #include "hda_codec.h" |
48 | 48 | ||
49 | 49 | ||
50 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; | 50 | static int index = SNDRV_DEFAULT_IDX1; |
51 | static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; | 51 | static char *id = SNDRV_DEFAULT_STR1; |
52 | static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; | 52 | static char *model; |
53 | static char *model[SNDRV_CARDS]; | 53 | static int position_fix; |
54 | static int position_fix[SNDRV_CARDS]; | ||
55 | 54 | ||
56 | module_param_array(index, int, NULL, 0444); | 55 | module_param(index, int, 0444); |
57 | MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); | 56 | MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); |
58 | module_param_array(id, charp, NULL, 0444); | 57 | module_param(id, charp, 0444); |
59 | MODULE_PARM_DESC(id, "ID string for Intel HD audio interface."); | 58 | MODULE_PARM_DESC(id, "ID string for Intel HD audio interface."); |
60 | module_param_array(enable, bool, NULL, 0444); | 59 | module_param(model, charp, 0444); |
61 | MODULE_PARM_DESC(enable, "Enable Intel HD audio interface."); | ||
62 | module_param_array(model, charp, NULL, 0444); | ||
63 | MODULE_PARM_DESC(model, "Use the given board model."); | 60 | MODULE_PARM_DESC(model, "Use the given board model."); |
64 | module_param_array(position_fix, int, NULL, 0444); | 61 | module_param(position_fix, int, 0444); |
65 | MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)."); | 62 | MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)."); |
66 | 63 | ||
64 | /* just for backward compatibility */ | ||
65 | static int enable; | ||
66 | module_param(enable, bool, 0444); | ||
67 | |||
67 | MODULE_LICENSE("GPL"); | 68 | MODULE_LICENSE("GPL"); |
68 | MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," | 69 | MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," |
69 | "{Intel, ICH6M}," | 70 | "{Intel, ICH6M}," |
@@ -223,6 +224,9 @@ enum { | |||
223 | #define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42 | 224 | #define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42 |
224 | #define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02 | 225 | #define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02 |
225 | 226 | ||
227 | /* Defines for Nvidia HDA support */ | ||
228 | #define NVIDIA_HDA_TRANSREG_ADDR 0x4e | ||
229 | #define NVIDIA_HDA_ENABLE_COHBITS 0x0f | ||
226 | 230 | ||
227 | /* | 231 | /* |
228 | * Use CORB/RIRB for communication from/to codecs. | 232 | * Use CORB/RIRB for communication from/to codecs. |
@@ -328,6 +332,7 @@ enum { | |||
328 | AZX_DRIVER_VIA, | 332 | AZX_DRIVER_VIA, |
329 | AZX_DRIVER_SIS, | 333 | AZX_DRIVER_SIS, |
330 | AZX_DRIVER_ULI, | 334 | AZX_DRIVER_ULI, |
335 | AZX_DRIVER_NVIDIA, | ||
331 | }; | 336 | }; |
332 | 337 | ||
333 | static char *driver_short_names[] __devinitdata = { | 338 | static char *driver_short_names[] __devinitdata = { |
@@ -335,7 +340,8 @@ static char *driver_short_names[] __devinitdata = { | |||
335 | [AZX_DRIVER_ATI] = "HDA ATI SB", | 340 | [AZX_DRIVER_ATI] = "HDA ATI SB", |
336 | [AZX_DRIVER_VIA] = "HDA VIA VT82xx", | 341 | [AZX_DRIVER_VIA] = "HDA VIA VT82xx", |
337 | [AZX_DRIVER_SIS] = "HDA SIS966", | 342 | [AZX_DRIVER_SIS] = "HDA SIS966", |
338 | [AZX_DRIVER_ULI] = "HDA ULI M5461" | 343 | [AZX_DRIVER_ULI] = "HDA ULI M5461", |
344 | [AZX_DRIVER_NVIDIA] = "HDA NVidia", | ||
339 | }; | 345 | }; |
340 | 346 | ||
341 | /* | 347 | /* |
@@ -710,14 +716,14 @@ static void azx_stream_stop(azx_t *chip, azx_dev_t *azx_dev) | |||
710 | */ | 716 | */ |
711 | static void azx_init_chip(azx_t *chip) | 717 | static void azx_init_chip(azx_t *chip) |
712 | { | 718 | { |
713 | unsigned char tcsel_reg, ati_misc_cntl2; | 719 | unsigned char reg; |
714 | 720 | ||
715 | /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) | 721 | /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) |
716 | * TCSEL == Traffic Class Select Register, which sets PCI express QOS | 722 | * TCSEL == Traffic Class Select Register, which sets PCI express QOS |
717 | * Ensuring these bits are 0 clears playback static on some HD Audio codecs | 723 | * Ensuring these bits are 0 clears playback static on some HD Audio codecs |
718 | */ | 724 | */ |
719 | pci_read_config_byte (chip->pci, ICH6_PCIREG_TCSEL, &tcsel_reg); | 725 | pci_read_config_byte (chip->pci, ICH6_PCIREG_TCSEL, ®); |
720 | pci_write_config_byte(chip->pci, ICH6_PCIREG_TCSEL, tcsel_reg & 0xf8); | 726 | pci_write_config_byte(chip->pci, ICH6_PCIREG_TCSEL, reg & 0xf8); |
721 | 727 | ||
722 | /* reset controller */ | 728 | /* reset controller */ |
723 | azx_reset(chip); | 729 | azx_reset(chip); |
@@ -733,13 +739,21 @@ static void azx_init_chip(azx_t *chip) | |||
733 | azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr); | 739 | azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr); |
734 | azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr)); | 740 | azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr)); |
735 | 741 | ||
736 | /* For ATI SB450 azalia HD audio, we need to enable snoop */ | 742 | switch (chip->driver_type) { |
737 | if (chip->driver_type == AZX_DRIVER_ATI) { | 743 | case AZX_DRIVER_ATI: |
744 | /* For ATI SB450 azalia HD audio, we need to enable snoop */ | ||
738 | pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, | 745 | pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, |
739 | &ati_misc_cntl2); | 746 | ®); |
740 | pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, | 747 | pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, |
741 | (ati_misc_cntl2 & 0xf8) | ATI_SB450_HDAUDIO_ENABLE_SNOOP); | 748 | (reg & 0xf8) | ATI_SB450_HDAUDIO_ENABLE_SNOOP); |
742 | } | 749 | break; |
750 | case AZX_DRIVER_NVIDIA: | ||
751 | /* For NVIDIA HDA, enable snoop */ | ||
752 | pci_read_config_byte(chip->pci,NVIDIA_HDA_TRANSREG_ADDR, ®); | ||
753 | pci_write_config_byte(chip->pci,NVIDIA_HDA_TRANSREG_ADDR, | ||
754 | (reg & 0xf0) | NVIDIA_HDA_ENABLE_COHBITS); | ||
755 | break; | ||
756 | } | ||
743 | } | 757 | } |
744 | 758 | ||
745 | 759 | ||
@@ -1264,6 +1278,7 @@ static int __devinit azx_pcm_create(azx_t *chip) | |||
1264 | err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev); | 1278 | err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev); |
1265 | if (err < 0) | 1279 | if (err < 0) |
1266 | return err; | 1280 | return err; |
1281 | chip->pcm[pcm_dev]->dev_class = SNDRV_PCM_CLASS_MODEM; | ||
1267 | pcm_dev++; | 1282 | pcm_dev++; |
1268 | } | 1283 | } |
1269 | } | 1284 | } |
@@ -1530,32 +1545,24 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, | |||
1530 | 1545 | ||
1531 | static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | 1546 | static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) |
1532 | { | 1547 | { |
1533 | static int dev; | ||
1534 | snd_card_t *card; | 1548 | snd_card_t *card; |
1535 | azx_t *chip; | 1549 | azx_t *chip; |
1536 | int err = 0; | 1550 | int err = 0; |
1537 | 1551 | ||
1538 | if (dev >= SNDRV_CARDS) | 1552 | card = snd_card_new(index, id, THIS_MODULE, 0); |
1539 | return -ENODEV; | ||
1540 | if (! enable[dev]) { | ||
1541 | dev++; | ||
1542 | return -ENOENT; | ||
1543 | } | ||
1544 | |||
1545 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | ||
1546 | if (NULL == card) { | 1553 | if (NULL == card) { |
1547 | snd_printk(KERN_ERR SFX "Error creating card!\n"); | 1554 | snd_printk(KERN_ERR SFX "Error creating card!\n"); |
1548 | return -ENOMEM; | 1555 | return -ENOMEM; |
1549 | } | 1556 | } |
1550 | 1557 | ||
1551 | if ((err = azx_create(card, pci, position_fix[dev], pci_id->driver_data, | 1558 | if ((err = azx_create(card, pci, position_fix, pci_id->driver_data, |
1552 | &chip)) < 0) { | 1559 | &chip)) < 0) { |
1553 | snd_card_free(card); | 1560 | snd_card_free(card); |
1554 | return err; | 1561 | return err; |
1555 | } | 1562 | } |
1556 | 1563 | ||
1557 | /* create codec instances */ | 1564 | /* create codec instances */ |
1558 | if ((err = azx_codec_create(chip, model[dev])) < 0) { | 1565 | if ((err = azx_codec_create(chip, model)) < 0) { |
1559 | snd_card_free(card); | 1566 | snd_card_free(card); |
1560 | return err; | 1567 | return err; |
1561 | } | 1568 | } |
@@ -1581,7 +1588,6 @@ static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id * | |||
1581 | } | 1588 | } |
1582 | 1589 | ||
1583 | pci_set_drvdata(pci, card); | 1590 | pci_set_drvdata(pci, card); |
1584 | dev++; | ||
1585 | 1591 | ||
1586 | return err; | 1592 | return err; |
1587 | } | 1593 | } |
@@ -1601,6 +1607,8 @@ static struct pci_device_id azx_ids[] = { | |||
1601 | { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ | 1607 | { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ |
1602 | { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ | 1608 | { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ |
1603 | { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ | 1609 | { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ |
1610 | { 0x10de, 0x026c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA 026c */ | ||
1611 | { 0x10de, 0x0371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA 0371 */ | ||
1604 | { 0, } | 1612 | { 0, } |
1605 | }; | 1613 | }; |
1606 | MODULE_DEVICE_TABLE(pci, azx_ids); | 1614 | MODULE_DEVICE_TABLE(pci, azx_ids); |