diff options
author | James Morris <jmorris@namei.org> | 2009-03-26 17:28:11 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-03-26 17:28:11 -0400 |
commit | 1987f17d2266e882862528841429b5bf67bc8fe5 (patch) | |
tree | 5c3fbee88018ab7259a18c10e6320e575d0ed679 /sound/pci | |
parent | 7198e2eeb44b3fe7cc97f997824002da47a9c644 (diff) | |
parent | 0384e2959127a56d0640505d004d8dd92f9c29f5 (diff) |
Merge branch 'master' into next
Diffstat (limited to 'sound/pci')
112 files changed, 4658 insertions, 2343 deletions
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 82b9bddcdcd6..ca25e6179d76 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig | |||
@@ -400,6 +400,26 @@ config SND_INDIGODJ | |||
400 | To compile this driver as a module, choose M here: the module | 400 | To compile this driver as a module, choose M here: the module |
401 | will be called snd-indigodj | 401 | will be called snd-indigodj |
402 | 402 | ||
403 | config SND_INDIGOIOX | ||
404 | tristate "(Echoaudio) Indigo IOx" | ||
405 | select FW_LOADER | ||
406 | select SND_PCM | ||
407 | help | ||
408 | Say 'Y' or 'M' to include support for Echoaudio Indigo IOx. | ||
409 | |||
410 | To compile this driver as a module, choose M here: the module | ||
411 | will be called snd-indigoiox | ||
412 | |||
413 | config SND_INDIGODJX | ||
414 | tristate "(Echoaudio) Indigo DJx" | ||
415 | select FW_LOADER | ||
416 | select SND_PCM | ||
417 | help | ||
418 | Say 'Y' or 'M' to include support for Echoaudio Indigo DJx. | ||
419 | |||
420 | To compile this driver as a module, choose M here: the module | ||
421 | will be called snd-indigodjx | ||
422 | |||
403 | config SND_EMU10K1 | 423 | config SND_EMU10K1 |
404 | tristate "Emu10k1 (SB Live!, Audigy, E-mu APS)" | 424 | tristate "Emu10k1 (SB Live!, Audigy, E-mu APS)" |
405 | select FW_LOADER | 425 | select FW_LOADER |
@@ -744,7 +764,8 @@ config SND_VIRTUOSO | |||
744 | select SND_OXYGEN_LIB | 764 | select SND_OXYGEN_LIB |
745 | help | 765 | help |
746 | Say Y here to include support for sound cards based on the | 766 | Say Y here to include support for sound cards based on the |
747 | Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2 and D2X. | 767 | Asus AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, and |
768 | Essence STX. | ||
748 | Support for the HDAV1.3 (Deluxe) is very experimental. | 769 | Support for the HDAV1.3 (Deluxe) is very experimental. |
749 | 770 | ||
750 | To compile this driver as a module, choose M here: the module | 771 | To compile this driver as a module, choose M here: the module |
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index e2b843b4f9d0..97ee127ac33d 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -143,6 +143,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = { | |||
143 | { 0x43525970, 0xfffffff8, "CS4202", NULL, NULL }, | 143 | { 0x43525970, 0xfffffff8, "CS4202", NULL, NULL }, |
144 | { 0x43585421, 0xffffffff, "HSD11246", NULL, NULL }, // SmartMC II | 144 | { 0x43585421, 0xffffffff, "HSD11246", NULL, NULL }, // SmartMC II |
145 | { 0x43585428, 0xfffffff8, "Cx20468", patch_conexant, NULL }, // SmartAMC fixme: the mask might be different | 145 | { 0x43585428, 0xfffffff8, "Cx20468", patch_conexant, NULL }, // SmartAMC fixme: the mask might be different |
146 | { 0x43585430, 0xffffffff, "Cx20468-31", patch_conexant, NULL }, | ||
146 | { 0x43585431, 0xffffffff, "Cx20551", patch_cx20551, NULL }, | 147 | { 0x43585431, 0xffffffff, "Cx20551", patch_cx20551, NULL }, |
147 | { 0x44543031, 0xfffffff0, "DT0398", NULL, NULL }, | 148 | { 0x44543031, 0xfffffff0, "DT0398", NULL, NULL }, |
148 | { 0x454d4328, 0xffffffff, "EM28028", NULL, NULL }, // same as TR28028? | 149 | { 0x454d4328, 0xffffffff, "EM28028", NULL, NULL }, // same as TR28028? |
@@ -383,7 +384,7 @@ int snd_ac97_update_bits(struct snd_ac97 *ac97, unsigned short reg, unsigned sho | |||
383 | 384 | ||
384 | EXPORT_SYMBOL(snd_ac97_update_bits); | 385 | EXPORT_SYMBOL(snd_ac97_update_bits); |
385 | 386 | ||
386 | /* no lock version - see snd_ac97_updat_bits() */ | 387 | /* no lock version - see snd_ac97_update_bits() */ |
387 | int snd_ac97_update_bits_nolock(struct snd_ac97 *ac97, unsigned short reg, | 388 | int snd_ac97_update_bits_nolock(struct snd_ac97 *ac97, unsigned short reg, |
388 | unsigned short mask, unsigned short value) | 389 | unsigned short mask, unsigned short value) |
389 | { | 390 | { |
@@ -1643,7 +1644,10 @@ static int snd_ac97_modem_build(struct snd_card *card, struct snd_ac97 * ac97) | |||
1643 | { | 1644 | { |
1644 | int err, idx; | 1645 | int err, idx; |
1645 | 1646 | ||
1646 | //printk("AC97_GPIO_CFG = %x\n",snd_ac97_read(ac97,AC97_GPIO_CFG)); | 1647 | /* |
1648 | printk(KERN_DEBUG "AC97_GPIO_CFG = %x\n", | ||
1649 | snd_ac97_read(ac97,AC97_GPIO_CFG)); | ||
1650 | */ | ||
1647 | snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH)); | 1651 | snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH)); |
1648 | snd_ac97_write(ac97, AC97_GPIO_POLARITY, 0xffff & ~(AC97_GPIO_LINE1_OH)); | 1652 | snd_ac97_write(ac97, AC97_GPIO_POLARITY, 0xffff & ~(AC97_GPIO_LINE1_OH)); |
1649 | snd_ac97_write(ac97, AC97_GPIO_STICKY, 0xffff); | 1653 | snd_ac97_write(ac97, AC97_GPIO_STICKY, 0xffff); |
diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c index 060ea59d5f02..73b17d526c8b 100644 --- a/sound/pci/ac97/ac97_proc.c +++ b/sound/pci/ac97/ac97_proc.c | |||
@@ -125,6 +125,8 @@ static void snd_ac97_proc_read_main(struct snd_ac97 *ac97, struct snd_info_buffe | |||
125 | snd_iprintf(buffer, "PCI Subsys Device: 0x%04x\n\n", | 125 | snd_iprintf(buffer, "PCI Subsys Device: 0x%04x\n\n", |
126 | ac97->subsystem_device); | 126 | ac97->subsystem_device); |
127 | 127 | ||
128 | snd_iprintf(buffer, "Flags: %x\n", ac97->flags); | ||
129 | |||
128 | if ((ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23) { | 130 | if ((ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23) { |
129 | val = snd_ac97_read(ac97, AC97_INT_PAGING); | 131 | val = snd_ac97_read(ac97, AC97_INT_PAGING); |
130 | snd_ac97_update_bits(ac97, AC97_INT_PAGING, | 132 | snd_ac97_update_bits(ac97, AC97_INT_PAGING, |
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index a7f38e63303f..d1f242bd0ac5 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c | |||
@@ -995,10 +995,10 @@ snd_ad1889_probe(struct pci_dev *pci, | |||
995 | } | 995 | } |
996 | 996 | ||
997 | /* (2) */ | 997 | /* (2) */ |
998 | card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0); | 998 | err = snd_card_create(index[devno], id[devno], THIS_MODULE, 0, &card); |
999 | /* XXX REVISIT: we can probably allocate chip in this call */ | 999 | /* XXX REVISIT: we can probably allocate chip in this call */ |
1000 | if (card == NULL) | 1000 | if (err < 0) |
1001 | return -ENOMEM; | 1001 | return err; |
1002 | 1002 | ||
1003 | strcpy(card->driver, "AD1889"); | 1003 | strcpy(card->driver, "AD1889"); |
1004 | strcpy(card->shortname, "Analog Devices AD1889"); | 1004 | strcpy(card->shortname, "Analog Devices AD1889"); |
diff --git a/sound/pci/ak4531_codec.c b/sound/pci/ak4531_codec.c index 0f819ddb3ebf..fd135e3d8a84 100644 --- a/sound/pci/ak4531_codec.c +++ b/sound/pci/ak4531_codec.c | |||
@@ -51,7 +51,8 @@ static void snd_ak4531_dump(struct snd_ak4531 *ak4531) | |||
51 | int idx; | 51 | int idx; |
52 | 52 | ||
53 | for (idx = 0; idx < 0x19; idx++) | 53 | for (idx = 0; idx < 0x19; idx++) |
54 | printk("ak4531 0x%x: 0x%x\n", idx, ak4531->regs[idx]); | 54 | printk(KERN_DEBUG "ak4531 0x%x: 0x%x\n", |
55 | idx, ak4531->regs[idx]); | ||
55 | } | 56 | } |
56 | 57 | ||
57 | #endif | 58 | #endif |
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index 1a0fd65ec280..4edf270a7809 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c | |||
@@ -2142,7 +2142,7 @@ static int __devinit snd_ali_resources(struct snd_ali *codec) | |||
2142 | { | 2142 | { |
2143 | int err; | 2143 | int err; |
2144 | 2144 | ||
2145 | snd_ali_printk("resouces allocation ...\n"); | 2145 | snd_ali_printk("resources allocation ...\n"); |
2146 | err = pci_request_regions(codec->pci, "ALI 5451"); | 2146 | err = pci_request_regions(codec->pci, "ALI 5451"); |
2147 | if (err < 0) | 2147 | if (err < 0) |
2148 | return err; | 2148 | return err; |
@@ -2154,7 +2154,7 @@ static int __devinit snd_ali_resources(struct snd_ali *codec) | |||
2154 | return -EBUSY; | 2154 | return -EBUSY; |
2155 | } | 2155 | } |
2156 | codec->irq = codec->pci->irq; | 2156 | codec->irq = codec->pci->irq; |
2157 | snd_ali_printk("resouces allocated.\n"); | 2157 | snd_ali_printk("resources allocated.\n"); |
2158 | return 0; | 2158 | return 0; |
2159 | } | 2159 | } |
2160 | static int snd_ali_dev_free(struct snd_device *device) | 2160 | static int snd_ali_dev_free(struct snd_device *device) |
@@ -2307,9 +2307,9 @@ static int __devinit snd_ali_probe(struct pci_dev *pci, | |||
2307 | 2307 | ||
2308 | snd_ali_printk("probe ...\n"); | 2308 | snd_ali_printk("probe ...\n"); |
2309 | 2309 | ||
2310 | card = snd_card_new(index, id, THIS_MODULE, 0); | 2310 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
2311 | if (!card) | 2311 | if (err < 0) |
2312 | return -ENOMEM; | 2312 | return err; |
2313 | 2313 | ||
2314 | err = snd_ali_create(card, pci, pcm_channels, spdif, &codec); | 2314 | err = snd_ali_create(card, pci, pcm_channels, spdif, &codec); |
2315 | if (err < 0) | 2315 | if (err < 0) |
diff --git a/sound/pci/als300.c b/sound/pci/als300.c index 8df6824b51cd..009b4c8225a5 100644 --- a/sound/pci/als300.c +++ b/sound/pci/als300.c | |||
@@ -91,7 +91,7 @@ | |||
91 | #define DEBUG_PLAY_REC 0 | 91 | #define DEBUG_PLAY_REC 0 |
92 | 92 | ||
93 | #if DEBUG_CALLS | 93 | #if DEBUG_CALLS |
94 | #define snd_als300_dbgcalls(format, args...) printk(format, ##args) | 94 | #define snd_als300_dbgcalls(format, args...) printk(KERN_DEBUG format, ##args) |
95 | #define snd_als300_dbgcallenter() printk(KERN_ERR "--> %s\n", __func__) | 95 | #define snd_als300_dbgcallenter() printk(KERN_ERR "--> %s\n", __func__) |
96 | #define snd_als300_dbgcallleave() printk(KERN_ERR "<-- %s\n", __func__) | 96 | #define snd_als300_dbgcallleave() printk(KERN_ERR "<-- %s\n", __func__) |
97 | #else | 97 | #else |
@@ -812,10 +812,10 @@ static int __devinit snd_als300_probe(struct pci_dev *pci, | |||
812 | return -ENOENT; | 812 | return -ENOENT; |
813 | } | 813 | } |
814 | 814 | ||
815 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 815 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
816 | 816 | ||
817 | if (card == NULL) | 817 | if (err < 0) |
818 | return -ENOMEM; | 818 | return err; |
819 | 819 | ||
820 | chip_type = pci_id->driver_data; | 820 | chip_type = pci_id->driver_data; |
821 | 821 | ||
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c index ba570053d4d5..542a0c65a92c 100644 --- a/sound/pci/als4000.c +++ b/sound/pci/als4000.c | |||
@@ -889,12 +889,13 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci, | |||
889 | pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO); | 889 | pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO); |
890 | pci_set_master(pci); | 890 | pci_set_master(pci); |
891 | 891 | ||
892 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 892 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
893 | sizeof(*acard) /* private_data: acard */); | 893 | sizeof(*acard) /* private_data: acard */, |
894 | if (card == NULL) { | 894 | &card); |
895 | if (err < 0) { | ||
895 | pci_release_regions(pci); | 896 | pci_release_regions(pci); |
896 | pci_disable_device(pci); | 897 | pci_disable_device(pci); |
897 | return -ENOMEM; | 898 | return err; |
898 | } | 899 | } |
899 | 900 | ||
900 | acard = card->private_data; | 901 | acard = card->private_data; |
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 226fe8237d31..9ce8548c03e4 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c | |||
@@ -1645,9 +1645,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1645 | struct atiixp *chip; | 1645 | struct atiixp *chip; |
1646 | int err; | 1646 | int err; |
1647 | 1647 | ||
1648 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1648 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1649 | if (card == NULL) | 1649 | if (err < 0) |
1650 | return -ENOMEM; | 1650 | return err; |
1651 | 1651 | ||
1652 | strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); | 1652 | strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); |
1653 | strcpy(card->shortname, "ATI IXP"); | 1653 | strcpy(card->shortname, "ATI IXP"); |
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index 0e6e5cc1c501..c3136cccc559 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c | |||
@@ -1288,9 +1288,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci, | |||
1288 | struct atiixp_modem *chip; | 1288 | struct atiixp_modem *chip; |
1289 | int err; | 1289 | int err; |
1290 | 1290 | ||
1291 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1291 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1292 | if (card == NULL) | 1292 | if (err < 0) |
1293 | return -ENOMEM; | 1293 | return err; |
1294 | 1294 | ||
1295 | strcpy(card->driver, "ATIIXP-MODEM"); | 1295 | strcpy(card->driver, "ATIIXP-MODEM"); |
1296 | strcpy(card->shortname, "ATI IXP Modem"); | 1296 | strcpy(card->shortname, "ATI IXP Modem"); |
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c index a36d4d1fd419..9ec122383eef 100644 --- a/sound/pci/au88x0/au88x0.c +++ b/sound/pci/au88x0/au88x0.c | |||
@@ -250,9 +250,9 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
250 | return -ENOENT; | 250 | return -ENOENT; |
251 | } | 251 | } |
252 | // (2) | 252 | // (2) |
253 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 253 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
254 | if (card == NULL) | 254 | if (err < 0) |
255 | return -ENOMEM; | 255 | return err; |
256 | 256 | ||
257 | // (3) | 257 | // (3) |
258 | if ((err = snd_vortex_create(card, pci, &chip)) < 0) { | 258 | if ((err = snd_vortex_create(card, pci, &chip)) < 0) { |
diff --git a/sound/pci/au88x0/au88x0_a3d.c b/sound/pci/au88x0/au88x0_a3d.c index 649849e540d3..f4aa8ff6f5f9 100644 --- a/sound/pci/au88x0/au88x0_a3d.c +++ b/sound/pci/au88x0/au88x0_a3d.c | |||
@@ -462,9 +462,10 @@ static void a3dsrc_ZeroSliceIO(a3dsrc_t * a) | |||
462 | /* Reset Single A3D source. */ | 462 | /* Reset Single A3D source. */ |
463 | static void a3dsrc_ZeroState(a3dsrc_t * a) | 463 | static void a3dsrc_ZeroState(a3dsrc_t * a) |
464 | { | 464 | { |
465 | 465 | /* | |
466 | //printk("vortex: ZeroState slice: %d, source %d\n", a->slice, a->source); | 466 | printk(KERN_DEBUG "vortex: ZeroState slice: %d, source %d\n", |
467 | 467 | a->slice, a->source); | |
468 | */ | ||
468 | a3dsrc_SetAtmosState(a, 0, 0, 0, 0); | 469 | a3dsrc_SetAtmosState(a, 0, 0, 0, 0); |
469 | a3dsrc_SetHrtfState(a, A3dHrirZeros, A3dHrirZeros); | 470 | a3dsrc_SetHrtfState(a, A3dHrirZeros, A3dHrirZeros); |
470 | a3dsrc_SetItdDline(a, A3dItdDlineZeros); | 471 | a3dsrc_SetItdDline(a, A3dItdDlineZeros); |
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c index b070e5714514..3906f5afe27a 100644 --- a/sound/pci/au88x0/au88x0_core.c +++ b/sound/pci/au88x0/au88x0_core.c | |||
@@ -1135,7 +1135,10 @@ vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma, | |||
1135 | snd_pcm_sgbuf_get_addr(dma->substream, 0)); | 1135 | snd_pcm_sgbuf_get_addr(dma->substream, 0)); |
1136 | break; | 1136 | break; |
1137 | } | 1137 | } |
1138 | //printk("vortex: cfg0 = 0x%x\nvortex: cfg1=0x%x\n", dma->cfg0, dma->cfg1); | 1138 | /* |
1139 | printk(KERN_DEBUG "vortex: cfg0 = 0x%x\nvortex: cfg1=0x%x\n", | ||
1140 | dma->cfg0, dma->cfg1); | ||
1141 | */ | ||
1139 | hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFCFG0 + (adbdma << 3), dma->cfg0); | 1142 | hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFCFG0 + (adbdma << 3), dma->cfg0); |
1140 | hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFCFG1 + (adbdma << 3), dma->cfg1); | 1143 | hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFCFG1 + (adbdma << 3), dma->cfg1); |
1141 | 1144 | ||
@@ -1959,7 +1962,7 @@ vortex_connect_codecplay(vortex_t * vortex, int en, unsigned char mixers[]) | |||
1959 | ADB_CODECOUT(0 + 4)); | 1962 | ADB_CODECOUT(0 + 4)); |
1960 | vortex_connection_mix_adb(vortex, en, 0x11, mixers[3], | 1963 | vortex_connection_mix_adb(vortex, en, 0x11, mixers[3], |
1961 | ADB_CODECOUT(1 + 4)); | 1964 | ADB_CODECOUT(1 + 4)); |
1962 | //printk("SDAC detected "); | 1965 | /* printk(KERN_DEBUG "SDAC detected "); */ |
1963 | } | 1966 | } |
1964 | #else | 1967 | #else |
1965 | // Use plain direct output to codec. | 1968 | // Use plain direct output to codec. |
@@ -2013,7 +2016,11 @@ vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype) | |||
2013 | resmap[restype] |= (1 << i); | 2016 | resmap[restype] |= (1 << i); |
2014 | else | 2017 | else |
2015 | vortex->dma_adb[i].resources[restype] |= (1 << i); | 2018 | vortex->dma_adb[i].resources[restype] |= (1 << i); |
2016 | //printk("vortex: ResManager: type %d out %d\n", restype, i); | 2019 | /* |
2020 | printk(KERN_DEBUG | ||
2021 | "vortex: ResManager: type %d out %d\n", | ||
2022 | restype, i); | ||
2023 | */ | ||
2017 | return i; | 2024 | return i; |
2018 | } | 2025 | } |
2019 | } | 2026 | } |
@@ -2024,7 +2031,11 @@ vortex_adb_checkinout(vortex_t * vortex, int resmap[], int out, int restype) | |||
2024 | for (i = 0; i < qty; i++) { | 2031 | for (i = 0; i < qty; i++) { |
2025 | if (resmap[restype] & (1 << i)) { | 2032 | if (resmap[restype] & (1 << i)) { |
2026 | resmap[restype] &= ~(1 << i); | 2033 | resmap[restype] &= ~(1 << i); |
2027 | //printk("vortex: ResManager: type %d in %d\n",restype, i); | 2034 | /* |
2035 | printk(KERN_DEBUG | ||
2036 | "vortex: ResManager: type %d in %d\n", | ||
2037 | restype, i); | ||
2038 | */ | ||
2028 | return i; | 2039 | return i; |
2029 | } | 2040 | } |
2030 | } | 2041 | } |
@@ -2789,7 +2800,7 @@ vortex_translateformat(vortex_t * vortex, char bits, char nch, int encod) | |||
2789 | { | 2800 | { |
2790 | int a, this_194; | 2801 | int a, this_194; |
2791 | 2802 | ||
2792 | if ((bits != 8) || (bits != 16)) | 2803 | if ((bits != 8) && (bits != 16)) |
2793 | return -1; | 2804 | return -1; |
2794 | 2805 | ||
2795 | switch (encod) { | 2806 | switch (encod) { |
diff --git a/sound/pci/au88x0/au88x0_synth.c b/sound/pci/au88x0/au88x0_synth.c index 978b856f5621..2805e34bd41d 100644 --- a/sound/pci/au88x0/au88x0_synth.c +++ b/sound/pci/au88x0/au88x0_synth.c | |||
@@ -213,38 +213,59 @@ vortex_wt_SetReg(vortex_t * vortex, unsigned char reg, int wt, | |||
213 | switch (reg) { | 213 | switch (reg) { |
214 | /* Voice specific parameters */ | 214 | /* Voice specific parameters */ |
215 | case 0: /* running */ | 215 | case 0: /* running */ |
216 | //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_RUN(wt), (int)val); | 216 | /* |
217 | printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", | ||
218 | WT_RUN(wt), (int)val); | ||
219 | */ | ||
217 | hwwrite(vortex->mmio, WT_RUN(wt), val); | 220 | hwwrite(vortex->mmio, WT_RUN(wt), val); |
218 | return 0xc; | 221 | return 0xc; |
219 | break; | 222 | break; |
220 | case 1: /* param 0 */ | 223 | case 1: /* param 0 */ |
221 | //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_PARM(wt,0), (int)val); | 224 | /* |
225 | printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", | ||
226 | WT_PARM(wt,0), (int)val); | ||
227 | */ | ||
222 | hwwrite(vortex->mmio, WT_PARM(wt, 0), val); | 228 | hwwrite(vortex->mmio, WT_PARM(wt, 0), val); |
223 | return 0xc; | 229 | return 0xc; |
224 | break; | 230 | break; |
225 | case 2: /* param 1 */ | 231 | case 2: /* param 1 */ |
226 | //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_PARM(wt,1), (int)val); | 232 | /* |
233 | printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", | ||
234 | WT_PARM(wt,1), (int)val); | ||
235 | */ | ||
227 | hwwrite(vortex->mmio, WT_PARM(wt, 1), val); | 236 | hwwrite(vortex->mmio, WT_PARM(wt, 1), val); |
228 | return 0xc; | 237 | return 0xc; |
229 | break; | 238 | break; |
230 | case 3: /* param 2 */ | 239 | case 3: /* param 2 */ |
231 | //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_PARM(wt,2), (int)val); | 240 | /* |
241 | printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", | ||
242 | WT_PARM(wt,2), (int)val); | ||
243 | */ | ||
232 | hwwrite(vortex->mmio, WT_PARM(wt, 2), val); | 244 | hwwrite(vortex->mmio, WT_PARM(wt, 2), val); |
233 | return 0xc; | 245 | return 0xc; |
234 | break; | 246 | break; |
235 | case 4: /* param 3 */ | 247 | case 4: /* param 3 */ |
236 | //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_PARM(wt,3), (int)val); | 248 | /* |
249 | printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", | ||
250 | WT_PARM(wt,3), (int)val); | ||
251 | */ | ||
237 | hwwrite(vortex->mmio, WT_PARM(wt, 3), val); | 252 | hwwrite(vortex->mmio, WT_PARM(wt, 3), val); |
238 | return 0xc; | 253 | return 0xc; |
239 | break; | 254 | break; |
240 | case 6: /* mute */ | 255 | case 6: /* mute */ |
241 | //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_MUTE(wt), (int)val); | 256 | /* |
257 | printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", | ||
258 | WT_MUTE(wt), (int)val); | ||
259 | */ | ||
242 | hwwrite(vortex->mmio, WT_MUTE(wt), val); | 260 | hwwrite(vortex->mmio, WT_MUTE(wt), val); |
243 | return 0xc; | 261 | return 0xc; |
244 | break; | 262 | break; |
245 | case 0xb: | 263 | case 0xb: |
246 | { /* delay */ | 264 | { /* delay */ |
247 | //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", WT_DELAY(wt,0), (int)val); | 265 | /* |
266 | printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", | ||
267 | WT_DELAY(wt,0), (int)val); | ||
268 | */ | ||
248 | hwwrite(vortex->mmio, WT_DELAY(wt, 3), val); | 269 | hwwrite(vortex->mmio, WT_DELAY(wt, 3), val); |
249 | hwwrite(vortex->mmio, WT_DELAY(wt, 2), val); | 270 | hwwrite(vortex->mmio, WT_DELAY(wt, 2), val); |
250 | hwwrite(vortex->mmio, WT_DELAY(wt, 1), val); | 271 | hwwrite(vortex->mmio, WT_DELAY(wt, 1), val); |
@@ -272,7 +293,9 @@ vortex_wt_SetReg(vortex_t * vortex, unsigned char reg, int wt, | |||
272 | return 0; | 293 | return 0; |
273 | break; | 294 | break; |
274 | } | 295 | } |
275 | //printk("vortex: WT SetReg(0x%x) = 0x%08x\n", ecx, (int)val); | 296 | /* |
297 | printk(KERN_DEBUG "vortex: WT SetReg(0x%x) = 0x%08x\n", ecx, (int)val); | ||
298 | */ | ||
276 | hwwrite(vortex->mmio, ecx, val); | 299 | hwwrite(vortex->mmio, ecx, val); |
277 | return 1; | 300 | return 1; |
278 | } | 301 | } |
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c index c7c54e7748e9..8eea29fc42fe 100644 --- a/sound/pci/aw2/aw2-alsa.c +++ b/sound/pci/aw2/aw2-alsa.c | |||
@@ -368,9 +368,9 @@ static int __devinit snd_aw2_probe(struct pci_dev *pci, | |||
368 | } | 368 | } |
369 | 369 | ||
370 | /* (2) Create card instance */ | 370 | /* (2) Create card instance */ |
371 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 371 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
372 | if (card == NULL) | 372 | if (err < 0) |
373 | return -ENOMEM; | 373 | return err; |
374 | 374 | ||
375 | /* (3) Create main component */ | 375 | /* (3) Create main component */ |
376 | err = snd_aw2_create(card, pci, &chip); | 376 | err = snd_aw2_create(card, pci, &chip); |
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index 333007c523a1..e9e9b5821d41 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -211,25 +211,25 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
211 | #endif | 211 | #endif |
212 | 212 | ||
213 | #if DEBUG_MIXER | 213 | #if DEBUG_MIXER |
214 | #define snd_azf3328_dbgmixer(format, args...) printk(format, ##args) | 214 | #define snd_azf3328_dbgmixer(format, args...) printk(KERN_DEBUG format, ##args) |
215 | #else | 215 | #else |
216 | #define snd_azf3328_dbgmixer(format, args...) | 216 | #define snd_azf3328_dbgmixer(format, args...) |
217 | #endif | 217 | #endif |
218 | 218 | ||
219 | #if DEBUG_PLAY_REC | 219 | #if DEBUG_PLAY_REC |
220 | #define snd_azf3328_dbgplay(format, args...) printk(KERN_ERR format, ##args) | 220 | #define snd_azf3328_dbgplay(format, args...) printk(KERN_DEBUG format, ##args) |
221 | #else | 221 | #else |
222 | #define snd_azf3328_dbgplay(format, args...) | 222 | #define snd_azf3328_dbgplay(format, args...) |
223 | #endif | 223 | #endif |
224 | 224 | ||
225 | #if DEBUG_MISC | 225 | #if DEBUG_MISC |
226 | #define snd_azf3328_dbgtimer(format, args...) printk(KERN_ERR format, ##args) | 226 | #define snd_azf3328_dbgtimer(format, args...) printk(KERN_DEBUG format, ##args) |
227 | #else | 227 | #else |
228 | #define snd_azf3328_dbgtimer(format, args...) | 228 | #define snd_azf3328_dbgtimer(format, args...) |
229 | #endif | 229 | #endif |
230 | 230 | ||
231 | #if DEBUG_GAME | 231 | #if DEBUG_GAME |
232 | #define snd_azf3328_dbggame(format, args...) printk(KERN_ERR format, ##args) | 232 | #define snd_azf3328_dbggame(format, args...) printk(KERN_DEBUG format, ##args) |
233 | #else | 233 | #else |
234 | #define snd_azf3328_dbggame(format, args...) | 234 | #define snd_azf3328_dbggame(format, args...) |
235 | #endif | 235 | #endif |
@@ -2216,9 +2216,9 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2216 | return -ENOENT; | 2216 | return -ENOENT; |
2217 | } | 2217 | } |
2218 | 2218 | ||
2219 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2219 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2220 | if (card == NULL) | 2220 | if (err < 0) |
2221 | return -ENOMEM; | 2221 | return err; |
2222 | 2222 | ||
2223 | strcpy(card->driver, "AZF3328"); | 2223 | strcpy(card->driver, "AZF3328"); |
2224 | strcpy(card->shortname, "Aztech AZF3328 (PCI168)"); | 2224 | strcpy(card->shortname, "Aztech AZF3328 (PCI168)"); |
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c index 1aa1c0402540..a299340519df 100644 --- a/sound/pci/bt87x.c +++ b/sound/pci/bt87x.c | |||
@@ -888,9 +888,9 @@ static int __devinit snd_bt87x_probe(struct pci_dev *pci, | |||
888 | return -ENOENT; | 888 | return -ENOENT; |
889 | } | 889 | } |
890 | 890 | ||
891 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 891 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
892 | if (!card) | 892 | if (err < 0) |
893 | return -ENOMEM; | 893 | return err; |
894 | 894 | ||
895 | err = snd_bt87x_create(card, pci, &chip); | 895 | err = snd_bt87x_create(card, pci, &chip); |
896 | if (err < 0) | 896 | if (err < 0) |
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c index 0e62205d4081..df757575798a 100644 --- a/sound/pci/ca0106/ca0106_main.c +++ b/sound/pci/ca0106/ca0106_main.c | |||
@@ -255,6 +255,14 @@ static struct snd_ca0106_details ca0106_chip_details[] = { | |||
255 | .gpio_type = 2, | 255 | .gpio_type = 2, |
256 | .i2c_adc = 1, | 256 | .i2c_adc = 1, |
257 | .spi_dac = 1 } , | 257 | .spi_dac = 1 } , |
258 | /* Giga-byte GA-G1975X mobo | ||
259 | * Novell bnc#395807 | ||
260 | */ | ||
261 | /* FIXME: the GPIO and I2C setting aren't tested well */ | ||
262 | { .serial = 0x1458a006, | ||
263 | .name = "Giga-byte GA-G1975X", | ||
264 | .gpio_type = 1, | ||
265 | .i2c_adc = 1 }, | ||
258 | /* Shuttle XPC SD31P which has an onboard Creative Labs | 266 | /* Shuttle XPC SD31P which has an onboard Creative Labs |
259 | * Sound Blaster Live! 24-bit EAX | 267 | * Sound Blaster Live! 24-bit EAX |
260 | * high-definition 7.1 audio processor". | 268 | * high-definition 7.1 audio processor". |
@@ -404,7 +412,9 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, | |||
404 | } | 412 | } |
405 | 413 | ||
406 | tmp = reg << 25 | value << 16; | 414 | tmp = reg << 25 | value << 16; |
407 | // snd_printk("I2C-write:reg=0x%x, value=0x%x\n", reg, value); | 415 | /* |
416 | snd_printk(KERN_DEBUG "I2C-write:reg=0x%x, value=0x%x\n", reg, value); | ||
417 | */ | ||
408 | /* Not sure what this I2C channel controls. */ | 418 | /* Not sure what this I2C channel controls. */ |
409 | /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ | 419 | /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ |
410 | 420 | ||
@@ -422,7 +432,7 @@ int snd_ca0106_i2c_write(struct snd_ca0106 *emu, | |||
422 | /* Wait till the transaction ends */ | 432 | /* Wait till the transaction ends */ |
423 | while (1) { | 433 | while (1) { |
424 | status = snd_ca0106_ptr_read(emu, I2C_A, 0); | 434 | status = snd_ca0106_ptr_read(emu, I2C_A, 0); |
425 | //snd_printk("I2C:status=0x%x\n", status); | 435 | /*snd_printk(KERN_DEBUG "I2C:status=0x%x\n", status);*/ |
426 | timeout++; | 436 | timeout++; |
427 | if ((status & I2C_A_ADC_START) == 0) | 437 | if ((status & I2C_A_ADC_START) == 0) |
428 | break; | 438 | break; |
@@ -521,7 +531,10 @@ static int snd_ca0106_pcm_open_playback_channel(struct snd_pcm_substream *substr | |||
521 | channel->number = channel_id; | 531 | channel->number = channel_id; |
522 | 532 | ||
523 | channel->use = 1; | 533 | channel->use = 1; |
524 | //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); | 534 | /* |
535 | printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", | ||
536 | channel_id, chip, channel); | ||
537 | */ | ||
525 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; | 538 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; |
526 | channel->epcm = epcm; | 539 | channel->epcm = epcm; |
527 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 540 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) |
@@ -614,7 +627,10 @@ static int snd_ca0106_pcm_open_capture_channel(struct snd_pcm_substream *substre | |||
614 | channel->number = channel_id; | 627 | channel->number = channel_id; |
615 | 628 | ||
616 | channel->use = 1; | 629 | channel->use = 1; |
617 | //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); | 630 | /* |
631 | printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", | ||
632 | channel_id, chip, channel); | ||
633 | */ | ||
618 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; | 634 | //channel->interrupt = snd_ca0106_pcm_channel_interrupt; |
619 | channel->epcm = epcm; | 635 | channel->epcm = epcm; |
620 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 636 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) |
@@ -705,9 +721,20 @@ static int snd_ca0106_pcm_prepare_playback(struct snd_pcm_substream *substream) | |||
705 | u32 reg71; | 721 | u32 reg71; |
706 | int i; | 722 | int i; |
707 | 723 | ||
708 | //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); | 724 | #if 0 /* debug */ |
709 | //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); | 725 | snd_printk(KERN_DEBUG |
710 | //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | 726 | "prepare:channel_number=%d, rate=%d, format=0x%x, " |
727 | "channels=%d, buffer_size=%ld, period_size=%ld, " | ||
728 | "periods=%u, frames_to_bytes=%d\n", | ||
729 | channel, runtime->rate, runtime->format, | ||
730 | runtime->channels, runtime->buffer_size, | ||
731 | runtime->period_size, runtime->periods, | ||
732 | frames_to_bytes(runtime, 1)); | ||
733 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", | ||
734 | runtime->dma_addr, runtime->dma_area, table_base); | ||
735 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", | ||
736 | emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | ||
737 | #endif /* debug */ | ||
711 | /* Rate can be set per channel. */ | 738 | /* Rate can be set per channel. */ |
712 | /* reg40 control host to fifo */ | 739 | /* reg40 control host to fifo */ |
713 | /* reg71 controls DAC rate. */ | 740 | /* reg71 controls DAC rate. */ |
@@ -799,9 +826,20 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) | |||
799 | u32 reg71_set = 0; | 826 | u32 reg71_set = 0; |
800 | u32 reg71; | 827 | u32 reg71; |
801 | 828 | ||
802 | //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); | 829 | #if 0 /* debug */ |
803 | //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); | 830 | snd_printk(KERN_DEBUG |
804 | //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | 831 | "prepare:channel_number=%d, rate=%d, format=0x%x, " |
832 | "channels=%d, buffer_size=%ld, period_size=%ld, " | ||
833 | "periods=%u, frames_to_bytes=%d\n", | ||
834 | channel, runtime->rate, runtime->format, | ||
835 | runtime->channels, runtime->buffer_size, | ||
836 | runtime->period_size, runtime->periods, | ||
837 | frames_to_bytes(runtime, 1)); | ||
838 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", | ||
839 | runtime->dma_addr, runtime->dma_area, table_base); | ||
840 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", | ||
841 | emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); | ||
842 | #endif /* debug */ | ||
805 | /* reg71 controls ADC rate. */ | 843 | /* reg71 controls ADC rate. */ |
806 | switch (runtime->rate) { | 844 | switch (runtime->rate) { |
807 | case 44100: | 845 | case 44100: |
@@ -846,7 +884,14 @@ static int snd_ca0106_pcm_prepare_capture(struct snd_pcm_substream *substream) | |||
846 | } | 884 | } |
847 | 885 | ||
848 | 886 | ||
849 | //printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, frames_to_bytes(runtime, 1)); | 887 | /* |
888 | printk(KERN_DEBUG | ||
889 | "prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, " | ||
890 | "buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n", | ||
891 | channel, runtime->rate, runtime->format, runtime->channels, | ||
892 | runtime->buffer_size, runtime->period_size, | ||
893 | frames_to_bytes(runtime, 1)); | ||
894 | */ | ||
850 | snd_ca0106_ptr_write(emu, 0x13, channel, 0); | 895 | snd_ca0106_ptr_write(emu, 0x13, channel, 0); |
851 | snd_ca0106_ptr_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); | 896 | snd_ca0106_ptr_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); |
852 | snd_ca0106_ptr_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes | 897 | snd_ca0106_ptr_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes |
@@ -888,13 +933,13 @@ static int snd_ca0106_pcm_trigger_playback(struct snd_pcm_substream *substream, | |||
888 | runtime = s->runtime; | 933 | runtime = s->runtime; |
889 | epcm = runtime->private_data; | 934 | epcm = runtime->private_data; |
890 | channel = epcm->channel_id; | 935 | channel = epcm->channel_id; |
891 | /* snd_printk("channel=%d\n",channel); */ | 936 | /* snd_printk(KERN_DEBUG "channel=%d\n", channel); */ |
892 | epcm->running = running; | 937 | epcm->running = running; |
893 | basic |= (0x1 << channel); | 938 | basic |= (0x1 << channel); |
894 | extended |= (0x10 << channel); | 939 | extended |= (0x10 << channel); |
895 | snd_pcm_trigger_done(s, substream); | 940 | snd_pcm_trigger_done(s, substream); |
896 | } | 941 | } |
897 | /* snd_printk("basic=0x%x, extended=0x%x\n",basic, extended); */ | 942 | /* snd_printk(KERN_DEBUG "basic=0x%x, extended=0x%x\n",basic, extended); */ |
898 | 943 | ||
899 | switch (cmd) { | 944 | switch (cmd) { |
900 | case SNDRV_PCM_TRIGGER_START: | 945 | case SNDRV_PCM_TRIGGER_START: |
@@ -972,8 +1017,13 @@ snd_ca0106_pcm_pointer_playback(struct snd_pcm_substream *substream) | |||
972 | ptr=ptr2; | 1017 | ptr=ptr2; |
973 | if (ptr >= runtime->buffer_size) | 1018 | if (ptr >= runtime->buffer_size) |
974 | ptr -= runtime->buffer_size; | 1019 | ptr -= runtime->buffer_size; |
975 | //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); | 1020 | /* |
976 | 1021 | printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " | |
1022 | "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", | ||
1023 | ptr1, ptr2, ptr, (int)runtime->buffer_size, | ||
1024 | (int)runtime->period_size, (int)runtime->frame_bits, | ||
1025 | (int)runtime->rate); | ||
1026 | */ | ||
977 | return ptr; | 1027 | return ptr; |
978 | } | 1028 | } |
979 | 1029 | ||
@@ -995,8 +1045,13 @@ snd_ca0106_pcm_pointer_capture(struct snd_pcm_substream *substream) | |||
995 | ptr=ptr2; | 1045 | ptr=ptr2; |
996 | if (ptr >= runtime->buffer_size) | 1046 | if (ptr >= runtime->buffer_size) |
997 | ptr -= runtime->buffer_size; | 1047 | ptr -= runtime->buffer_size; |
998 | //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); | 1048 | /* |
999 | 1049 | printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " | |
1050 | "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", | ||
1051 | ptr1, ptr2, ptr, (int)runtime->buffer_size, | ||
1052 | (int)runtime->period_size, (int)runtime->frame_bits, | ||
1053 | (int)runtime->rate); | ||
1054 | */ | ||
1000 | return ptr; | 1055 | return ptr; |
1001 | } | 1056 | } |
1002 | 1057 | ||
@@ -1181,8 +1236,12 @@ static irqreturn_t snd_ca0106_interrupt(int irq, void *dev_id) | |||
1181 | return IRQ_NONE; | 1236 | return IRQ_NONE; |
1182 | 1237 | ||
1183 | stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); | 1238 | stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); |
1184 | //snd_printk("interrupt status = 0x%08x, stat76=0x%08x\n", status, stat76); | 1239 | /* |
1185 | //snd_printk("ptr=0x%08x\n",snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); | 1240 | snd_printk(KERN_DEBUG "interrupt status = 0x%08x, stat76=0x%08x\n", |
1241 | status, stat76); | ||
1242 | snd_printk(KERN_DEBUG "ptr=0x%08x\n", | ||
1243 | snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); | ||
1244 | */ | ||
1186 | mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ | 1245 | mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ |
1187 | for(i = 0; i < 4; i++) { | 1246 | for(i = 0; i < 4; i++) { |
1188 | pchannel = &(chip->playback_channels[i]); | 1247 | pchannel = &(chip->playback_channels[i]); |
@@ -1470,7 +1529,7 @@ static void ca0106_init_chip(struct snd_ca0106 *chip, int resume) | |||
1470 | int size, n; | 1529 | int size, n; |
1471 | 1530 | ||
1472 | size = ARRAY_SIZE(i2c_adc_init); | 1531 | size = ARRAY_SIZE(i2c_adc_init); |
1473 | /* snd_printk("I2C:array size=0x%x\n", size); */ | 1532 | /* snd_printk(KERN_DEBUG "I2C:array size=0x%x\n", size); */ |
1474 | for (n = 0; n < size; n++) | 1533 | for (n = 0; n < size; n++) |
1475 | snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], | 1534 | snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], |
1476 | i2c_adc_init[n][1]); | 1535 | i2c_adc_init[n][1]); |
@@ -1707,9 +1766,9 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci, | |||
1707 | return -ENOENT; | 1766 | return -ENOENT; |
1708 | } | 1767 | } |
1709 | 1768 | ||
1710 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1769 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1711 | if (card == NULL) | 1770 | if (err < 0) |
1712 | return -ENOMEM; | 1771 | return err; |
1713 | 1772 | ||
1714 | err = snd_ca0106_create(dev, card, pci, &chip); | 1773 | err = snd_ca0106_create(dev, card, pci, &chip); |
1715 | if (err < 0) | 1774 | if (err < 0) |
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 1a74ca62c314..c7899c32aba1 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -3272,9 +3272,9 @@ static int __devinit snd_cmipci_probe(struct pci_dev *pci, | |||
3272 | return -ENOENT; | 3272 | return -ENOENT; |
3273 | } | 3273 | } |
3274 | 3274 | ||
3275 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 3275 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
3276 | if (card == NULL) | 3276 | if (err < 0) |
3277 | return -ENOMEM; | 3277 | return err; |
3278 | 3278 | ||
3279 | switch (pci->device) { | 3279 | switch (pci->device) { |
3280 | case PCI_DEVICE_ID_CMEDIA_CM8738: | 3280 | case PCI_DEVICE_ID_CMEDIA_CM8738: |
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index 192e7842e181..f6286f84a221 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c | |||
@@ -834,7 +834,11 @@ static snd_pcm_uframes_t snd_cs4281_pointer(struct snd_pcm_substream *substream) | |||
834 | struct cs4281_dma *dma = runtime->private_data; | 834 | struct cs4281_dma *dma = runtime->private_data; |
835 | struct cs4281 *chip = snd_pcm_substream_chip(substream); | 835 | struct cs4281 *chip = snd_pcm_substream_chip(substream); |
836 | 836 | ||
837 | // printk("DCC = 0x%x, buffer_size = 0x%x, jiffies = %li\n", snd_cs4281_peekBA0(chip, dma->regDCC), runtime->buffer_size, jiffies); | 837 | /* |
838 | printk(KERN_DEBUG "DCC = 0x%x, buffer_size = 0x%x, jiffies = %li\n", | ||
839 | snd_cs4281_peekBA0(chip, dma->regDCC), runtime->buffer_size, | ||
840 | jiffies); | ||
841 | */ | ||
838 | return runtime->buffer_size - | 842 | return runtime->buffer_size - |
839 | snd_cs4281_peekBA0(chip, dma->regDCC) - 1; | 843 | snd_cs4281_peekBA0(chip, dma->regDCC) - 1; |
840 | } | 844 | } |
@@ -1925,9 +1929,9 @@ static int __devinit snd_cs4281_probe(struct pci_dev *pci, | |||
1925 | return -ENOENT; | 1929 | return -ENOENT; |
1926 | } | 1930 | } |
1927 | 1931 | ||
1928 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1932 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1929 | if (card == NULL) | 1933 | if (err < 0) |
1930 | return -ENOMEM; | 1934 | return err; |
1931 | 1935 | ||
1932 | if ((err = snd_cs4281_create(card, pci, &chip, dual_codec[dev])) < 0) { | 1936 | if ((err = snd_cs4281_create(card, pci, &chip, dual_codec[dev])) < 0) { |
1933 | snd_card_free(card); | 1937 | snd_card_free(card); |
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c index e876b3263e46..c9b3e3d48cbc 100644 --- a/sound/pci/cs46xx/cs46xx.c +++ b/sound/pci/cs46xx/cs46xx.c | |||
@@ -88,9 +88,9 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci, | |||
88 | return -ENOENT; | 88 | return -ENOENT; |
89 | } | 89 | } |
90 | 90 | ||
91 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 91 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
92 | if (card == NULL) | 92 | if (err < 0) |
93 | return -ENOMEM; | 93 | return err; |
94 | if ((err = snd_cs46xx_create(card, pci, | 94 | if ((err = snd_cs46xx_create(card, pci, |
95 | external_amp[dev], thinkpad[dev], | 95 | external_amp[dev], thinkpad[dev], |
96 | &chip)) < 0) { | 96 | &chip)) < 0) { |
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index 8ab07aa63652..1be96ead4244 100644 --- a/sound/pci/cs46xx/cs46xx_lib.c +++ b/sound/pci/cs46xx/cs46xx_lib.c | |||
@@ -194,7 +194,7 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip, | |||
194 | * ACSDA = Status Data Register = 474h | 194 | * ACSDA = Status Data Register = 474h |
195 | */ | 195 | */ |
196 | #if 0 | 196 | #if 0 |
197 | printk("e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg, | 197 | printk(KERN_DEBUG "e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg, |
198 | snd_cs46xx_peekBA0(chip, BA0_ACSDA), | 198 | snd_cs46xx_peekBA0(chip, BA0_ACSDA), |
199 | snd_cs46xx_peekBA0(chip, BA0_ACCAD)); | 199 | snd_cs46xx_peekBA0(chip, BA0_ACCAD)); |
200 | #endif | 200 | #endif |
@@ -428,8 +428,8 @@ static int cs46xx_wait_for_fifo(struct snd_cs46xx * chip,int retry_timeout) | |||
428 | } | 428 | } |
429 | 429 | ||
430 | if(status & SERBST_WBSY) { | 430 | if(status & SERBST_WBSY) { |
431 | snd_printk( KERN_ERR "cs46xx: failure waiting for FIFO command to complete\n"); | 431 | snd_printk(KERN_ERR "cs46xx: failure waiting for " |
432 | 432 | "FIFO command to complete\n"); | |
433 | return -EINVAL; | 433 | return -EINVAL; |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/sound/pci/cs46xx/cs46xx_lib.h b/sound/pci/cs46xx/cs46xx_lib.h index 018a7de56017..4eb55aa33612 100644 --- a/sound/pci/cs46xx/cs46xx_lib.h +++ b/sound/pci/cs46xx/cs46xx_lib.h | |||
@@ -62,7 +62,11 @@ static inline void snd_cs46xx_poke(struct snd_cs46xx *chip, unsigned long reg, u | |||
62 | unsigned int bank = reg >> 16; | 62 | unsigned int bank = reg >> 16; |
63 | unsigned int offset = reg & 0xffff; | 63 | unsigned int offset = reg & 0xffff; |
64 | 64 | ||
65 | /*if (bank == 0) printk("snd_cs46xx_poke: %04X - %08X\n",reg >> 2,val); */ | 65 | /* |
66 | if (bank == 0) | ||
67 | printk(KERN_DEBUG "snd_cs46xx_poke: %04X - %08X\n", | ||
68 | reg >> 2,val); | ||
69 | */ | ||
66 | writel(val, chip->region.idx[bank+1].remap_addr + offset); | 70 | writel(val, chip->region.idx[bank+1].remap_addr + offset); |
67 | } | 71 | } |
68 | 72 | ||
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c index 6dea5b5cc774..dc464321d0f3 100644 --- a/sound/pci/cs5530.c +++ b/sound/pci/cs5530.c | |||
@@ -258,10 +258,10 @@ static int __devinit snd_cs5530_probe(struct pci_dev *pci, | |||
258 | return -ENOENT; | 258 | return -ENOENT; |
259 | } | 259 | } |
260 | 260 | ||
261 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 261 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
262 | 262 | ||
263 | if (card == NULL) | 263 | if (err < 0) |
264 | return -ENOMEM; | 264 | return err; |
265 | 265 | ||
266 | err = snd_cs5530_create(card, pci, &chip); | 266 | err = snd_cs5530_create(card, pci, &chip); |
267 | if (err < 0) { | 267 | if (err < 0) { |
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c index 826e6dec2e97..c89ed1f5bc2b 100644 --- a/sound/pci/cs5535audio/cs5535audio.c +++ b/sound/pci/cs5535audio/cs5535audio.c | |||
@@ -312,7 +312,7 @@ static int __devinit snd_cs5535audio_create(struct snd_card *card, | |||
312 | 312 | ||
313 | if (request_irq(pci->irq, snd_cs5535audio_interrupt, | 313 | if (request_irq(pci->irq, snd_cs5535audio_interrupt, |
314 | IRQF_SHARED, "CS5535 Audio", cs5535au)) { | 314 | IRQF_SHARED, "CS5535 Audio", cs5535au)) { |
315 | snd_printk("unable to grab IRQ %d\n", pci->irq); | 315 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
316 | err = -EBUSY; | 316 | err = -EBUSY; |
317 | goto sndfail; | 317 | goto sndfail; |
318 | } | 318 | } |
@@ -353,9 +353,9 @@ static int __devinit snd_cs5535audio_probe(struct pci_dev *pci, | |||
353 | return -ENOENT; | 353 | return -ENOENT; |
354 | } | 354 | } |
355 | 355 | ||
356 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 356 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
357 | if (card == NULL) | 357 | if (err < 0) |
358 | return -ENOMEM; | 358 | return err; |
359 | 359 | ||
360 | if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0) | 360 | if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0) |
361 | goto probefail_out; | 361 | goto probefail_out; |
diff --git a/sound/pci/echoaudio/Makefile b/sound/pci/echoaudio/Makefile index 7b576aeb3f8d..1361de77e0cd 100644 --- a/sound/pci/echoaudio/Makefile +++ b/sound/pci/echoaudio/Makefile | |||
@@ -15,6 +15,8 @@ snd-echo3g-objs := echo3g.o | |||
15 | snd-indigo-objs := indigo.o | 15 | snd-indigo-objs := indigo.o |
16 | snd-indigoio-objs := indigoio.o | 16 | snd-indigoio-objs := indigoio.o |
17 | snd-indigodj-objs := indigodj.o | 17 | snd-indigodj-objs := indigodj.o |
18 | snd-indigoiox-objs := indigoiox.o | ||
19 | snd-indigodjx-objs := indigodjx.o | ||
18 | 20 | ||
19 | obj-$(CONFIG_SND_DARLA20) += snd-darla20.o | 21 | obj-$(CONFIG_SND_DARLA20) += snd-darla20.o |
20 | obj-$(CONFIG_SND_GINA20) += snd-gina20.o | 22 | obj-$(CONFIG_SND_GINA20) += snd-gina20.o |
@@ -28,3 +30,5 @@ obj-$(CONFIG_SND_ECHO3G) += snd-echo3g.o | |||
28 | obj-$(CONFIG_SND_INDIGO) += snd-indigo.o | 30 | obj-$(CONFIG_SND_INDIGO) += snd-indigo.o |
29 | obj-$(CONFIG_SND_INDIGOIO) += snd-indigoio.o | 31 | obj-$(CONFIG_SND_INDIGOIO) += snd-indigoio.o |
30 | obj-$(CONFIG_SND_INDIGODJ) += snd-indigodj.o | 32 | obj-$(CONFIG_SND_INDIGODJ) += snd-indigodj.o |
33 | obj-$(CONFIG_SND_INDIGOIOX) += snd-indigoiox.o | ||
34 | obj-$(CONFIG_SND_INDIGODJX) += snd-indigodjx.o | ||
diff --git a/sound/pci/echoaudio/echo3g_dsp.c b/sound/pci/echoaudio/echo3g_dsp.c index 417e25add82b..57967e580571 100644 --- a/sound/pci/echoaudio/echo3g_dsp.c +++ b/sound/pci/echoaudio/echo3g_dsp.c | |||
@@ -56,7 +56,7 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
56 | } | 56 | } |
57 | 57 | ||
58 | chip->comm_page->e3g_frq_register = | 58 | chip->comm_page->e3g_frq_register = |
59 | __constant_cpu_to_le32((E3G_MAGIC_NUMBER / 48000) - 2); | 59 | cpu_to_le32((E3G_MAGIC_NUMBER / 48000) - 2); |
60 | chip->device_id = device_id; | 60 | chip->device_id = device_id; |
61 | chip->subdevice_id = subdevice_id; | 61 | chip->subdevice_id = subdevice_id; |
62 | chip->bad_board = TRUE; | 62 | chip->bad_board = TRUE; |
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c index 8dbc5c4ba421..da2065cd2c0d 100644 --- a/sound/pci/echoaudio/echoaudio.c +++ b/sound/pci/echoaudio/echoaudio.c | |||
@@ -950,6 +950,8 @@ static int __devinit snd_echo_new_pcm(struct echoaudio *chip) | |||
950 | Control interface | 950 | Control interface |
951 | ******************************************************************************/ | 951 | ******************************************************************************/ |
952 | 952 | ||
953 | #ifndef ECHOCARD_HAS_VMIXER | ||
954 | |||
953 | /******************* PCM output volume *******************/ | 955 | /******************* PCM output volume *******************/ |
954 | static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol, | 956 | static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol, |
955 | struct snd_ctl_elem_info *uinfo) | 957 | struct snd_ctl_elem_info *uinfo) |
@@ -1001,18 +1003,6 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol, | |||
1001 | return changed; | 1003 | return changed; |
1002 | } | 1004 | } |
1003 | 1005 | ||
1004 | #ifdef ECHOCARD_HAS_VMIXER | ||
1005 | /* On Vmixer cards this one controls the line-out volume */ | ||
1006 | static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = { | ||
1007 | .name = "Line Playback Volume", | ||
1008 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1009 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, | ||
1010 | .info = snd_echo_output_gain_info, | ||
1011 | .get = snd_echo_output_gain_get, | ||
1012 | .put = snd_echo_output_gain_put, | ||
1013 | .tlv = {.p = db_scale_output_gain}, | ||
1014 | }; | ||
1015 | #else | ||
1016 | static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { | 1006 | static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { |
1017 | .name = "PCM Playback Volume", | 1007 | .name = "PCM Playback Volume", |
1018 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1008 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -1022,6 +1012,7 @@ static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { | |||
1022 | .put = snd_echo_output_gain_put, | 1012 | .put = snd_echo_output_gain_put, |
1023 | .tlv = {.p = db_scale_output_gain}, | 1013 | .tlv = {.p = db_scale_output_gain}, |
1024 | }; | 1014 | }; |
1015 | |||
1025 | #endif | 1016 | #endif |
1026 | 1017 | ||
1027 | 1018 | ||
@@ -1997,9 +1988,9 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, | |||
1997 | 1988 | ||
1998 | DE_INIT(("Echoaudio driver starting...\n")); | 1989 | DE_INIT(("Echoaudio driver starting...\n")); |
1999 | i = 0; | 1990 | i = 0; |
2000 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1991 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2001 | if (card == NULL) | 1992 | if (err < 0) |
2002 | return -ENOMEM; | 1993 | return err; |
2003 | 1994 | ||
2004 | snd_card_set_dev(card, &pci->dev); | 1995 | snd_card_set_dev(card, &pci->dev); |
2005 | 1996 | ||
@@ -2037,8 +2028,6 @@ static int __devinit snd_echo_probe(struct pci_dev *pci, | |||
2037 | 2028 | ||
2038 | #ifdef ECHOCARD_HAS_VMIXER | 2029 | #ifdef ECHOCARD_HAS_VMIXER |
2039 | snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip); | 2030 | snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip); |
2040 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_output_gain, chip))) < 0) | ||
2041 | goto ctl_error; | ||
2042 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0) | 2031 | if ((err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip))) < 0) |
2043 | goto ctl_error; | 2032 | goto ctl_error; |
2044 | #else | 2033 | #else |
diff --git a/sound/pci/echoaudio/echoaudio.h b/sound/pci/echoaudio/echoaudio.h index 1c88e051abf2..f9490ae36c2e 100644 --- a/sound/pci/echoaudio/echoaudio.h +++ b/sound/pci/echoaudio/echoaudio.h | |||
@@ -189,6 +189,9 @@ | |||
189 | #define INDIGO 0x0090 | 189 | #define INDIGO 0x0090 |
190 | #define INDIGO_IO 0x00a0 | 190 | #define INDIGO_IO 0x00a0 |
191 | #define INDIGO_DJ 0x00b0 | 191 | #define INDIGO_DJ 0x00b0 |
192 | #define DC8 0x00c0 | ||
193 | #define INDIGO_IOX 0x00d0 | ||
194 | #define INDIGO_DJX 0x00e0 | ||
192 | #define ECHO3G 0x0100 | 195 | #define ECHO3G 0x0100 |
193 | 196 | ||
194 | 197 | ||
diff --git a/sound/pci/echoaudio/echoaudio_3g.c b/sound/pci/echoaudio/echoaudio_3g.c index c3736bbd819e..e32a74897921 100644 --- a/sound/pci/echoaudio/echoaudio_3g.c +++ b/sound/pci/echoaudio/echoaudio_3g.c | |||
@@ -40,8 +40,7 @@ static int check_asic_status(struct echoaudio *chip) | |||
40 | if (wait_handshake(chip)) | 40 | if (wait_handshake(chip)) |
41 | return -EIO; | 41 | return -EIO; |
42 | 42 | ||
43 | chip->comm_page->ext_box_status = | 43 | chip->comm_page->ext_box_status = cpu_to_le32(E3G_ASIC_NOT_LOADED); |
44 | __constant_cpu_to_le32(E3G_ASIC_NOT_LOADED); | ||
45 | chip->asic_loaded = FALSE; | 44 | chip->asic_loaded = FALSE; |
46 | clear_handshake(chip); | 45 | clear_handshake(chip); |
47 | send_vector(chip, DSP_VC_TEST_ASIC); | 46 | send_vector(chip, DSP_VC_TEST_ASIC); |
diff --git a/sound/pci/echoaudio/echoaudio_dsp.c b/sound/pci/echoaudio/echoaudio_dsp.c index be0e18192de3..4df51ef5e095 100644 --- a/sound/pci/echoaudio/echoaudio_dsp.c +++ b/sound/pci/echoaudio/echoaudio_dsp.c | |||
@@ -926,11 +926,11 @@ static int init_dsp_comm_page(struct echoaudio *chip) | |||
926 | 926 | ||
927 | /* Init the comm page */ | 927 | /* Init the comm page */ |
928 | chip->comm_page->comm_size = | 928 | chip->comm_page->comm_size = |
929 | __constant_cpu_to_le32(sizeof(struct comm_page)); | 929 | cpu_to_le32(sizeof(struct comm_page)); |
930 | chip->comm_page->handshake = 0xffffffff; | 930 | chip->comm_page->handshake = 0xffffffff; |
931 | chip->comm_page->midi_out_free_count = | 931 | chip->comm_page->midi_out_free_count = |
932 | __constant_cpu_to_le32(DSP_MIDI_OUT_FIFO_SIZE); | 932 | cpu_to_le32(DSP_MIDI_OUT_FIFO_SIZE); |
933 | chip->comm_page->sample_rate = __constant_cpu_to_le32(44100); | 933 | chip->comm_page->sample_rate = cpu_to_le32(44100); |
934 | chip->sample_rate = 44100; | 934 | chip->sample_rate = 44100; |
935 | 935 | ||
936 | /* Set line levels so we don't blast any inputs on startup */ | 936 | /* Set line levels so we don't blast any inputs on startup */ |
diff --git a/sound/pci/echoaudio/echoaudio_dsp.h b/sound/pci/echoaudio/echoaudio_dsp.h index e352f3ae292c..cb7d75a0a503 100644 --- a/sound/pci/echoaudio/echoaudio_dsp.h +++ b/sound/pci/echoaudio/echoaudio_dsp.h | |||
@@ -576,8 +576,13 @@ SET_LAYLA24_FREQUENCY_REG command. | |||
576 | #define E3G_ASIC_NOT_LOADED 0xffff | 576 | #define E3G_ASIC_NOT_LOADED 0xffff |
577 | #define E3G_BOX_TYPE_MASK 0xf0 | 577 | #define E3G_BOX_TYPE_MASK 0xf0 |
578 | 578 | ||
579 | #define EXT_3GBOX_NC 0x01 | 579 | /* Indigo express control register values */ |
580 | #define EXT_3GBOX_NOT_SET 0x02 | 580 | #define INDIGO_EXPRESS_32000 0x02 |
581 | #define INDIGO_EXPRESS_44100 0x01 | ||
582 | #define INDIGO_EXPRESS_48000 0x00 | ||
583 | #define INDIGO_EXPRESS_DOUBLE_SPEED 0x10 | ||
584 | #define INDIGO_EXPRESS_QUAD_SPEED 0x04 | ||
585 | #define INDIGO_EXPRESS_CLOCK_MASK 0x17 | ||
581 | 586 | ||
582 | 587 | ||
583 | /* | 588 | /* |
diff --git a/sound/pci/echoaudio/gina20_dsp.c b/sound/pci/echoaudio/gina20_dsp.c index db6c952e9d7f..3f1e7475faea 100644 --- a/sound/pci/echoaudio/gina20_dsp.c +++ b/sound/pci/echoaudio/gina20_dsp.c | |||
@@ -208,10 +208,10 @@ static int set_professional_spdif(struct echoaudio *chip, char prof) | |||
208 | DE_ACT(("set_professional_spdif %d\n", prof)); | 208 | DE_ACT(("set_professional_spdif %d\n", prof)); |
209 | if (prof) | 209 | if (prof) |
210 | chip->comm_page->flags |= | 210 | chip->comm_page->flags |= |
211 | __constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); | 211 | cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); |
212 | else | 212 | else |
213 | chip->comm_page->flags &= | 213 | chip->comm_page->flags &= |
214 | ~__constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); | 214 | ~cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); |
215 | chip->professional_spdif = prof; | 215 | chip->professional_spdif = prof; |
216 | return update_flags(chip); | 216 | return update_flags(chip); |
217 | } | 217 | } |
diff --git a/sound/pci/echoaudio/indigo_dsp.c b/sound/pci/echoaudio/indigo_dsp.c index f05e39f7aad9..0b2cd9c86277 100644 --- a/sound/pci/echoaudio/indigo_dsp.c +++ b/sound/pci/echoaudio/indigo_dsp.c | |||
@@ -63,18 +63,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
63 | if ((err = init_line_levels(chip)) < 0) | 63 | if ((err = init_line_levels(chip)) < 0) |
64 | return err; | 64 | return err; |
65 | 65 | ||
66 | /* Default routing of the virtual channels: all vchannels are routed | ||
67 | to the stereo output */ | ||
68 | set_vmixer_gain(chip, 0, 0, 0); | ||
69 | set_vmixer_gain(chip, 1, 1, 0); | ||
70 | set_vmixer_gain(chip, 0, 2, 0); | ||
71 | set_vmixer_gain(chip, 1, 3, 0); | ||
72 | set_vmixer_gain(chip, 0, 4, 0); | ||
73 | set_vmixer_gain(chip, 1, 5, 0); | ||
74 | set_vmixer_gain(chip, 0, 6, 0); | ||
75 | set_vmixer_gain(chip, 1, 7, 0); | ||
76 | err = update_vmixer_level(chip); | ||
77 | |||
78 | DE_INIT(("init_hw done\n")); | 66 | DE_INIT(("init_hw done\n")); |
79 | return err; | 67 | return err; |
80 | } | 68 | } |
diff --git a/sound/pci/echoaudio/indigo_express_dsp.c b/sound/pci/echoaudio/indigo_express_dsp.c new file mode 100644 index 000000000000..9ab625e15652 --- /dev/null +++ b/sound/pci/echoaudio/indigo_express_dsp.c | |||
@@ -0,0 +1,119 @@ | |||
1 | /************************************************************************ | ||
2 | |||
3 | This file is part of Echo Digital Audio's generic driver library. | ||
4 | Copyright Echo Digital Audio Corporation (c) 1998 - 2005 | ||
5 | All rights reserved | ||
6 | www.echoaudio.com | ||
7 | |||
8 | This library is free software; you can redistribute it and/or | ||
9 | modify it under the terms of the GNU Lesser General Public | ||
10 | License as published by the Free Software Foundation; either | ||
11 | version 2.1 of the License, or (at your option) any later version. | ||
12 | |||
13 | This library is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | Lesser General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU Lesser General Public | ||
19 | License along with this library; if not, write to the Free Software | ||
20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | |||
22 | ************************************************************************* | ||
23 | |||
24 | Translation from C++ and adaptation for use in ALSA-Driver | ||
25 | were made by Giuliano Pochini <pochini@shiny.it> | ||
26 | |||
27 | *************************************************************************/ | ||
28 | |||
29 | static int set_sample_rate(struct echoaudio *chip, u32 rate) | ||
30 | { | ||
31 | u32 clock, control_reg, old_control_reg; | ||
32 | |||
33 | if (wait_handshake(chip)) | ||
34 | return -EIO; | ||
35 | |||
36 | old_control_reg = le32_to_cpu(chip->comm_page->control_register); | ||
37 | control_reg = old_control_reg & ~INDIGO_EXPRESS_CLOCK_MASK; | ||
38 | |||
39 | switch (rate) { | ||
40 | case 32000: | ||
41 | clock = INDIGO_EXPRESS_32000; | ||
42 | break; | ||
43 | case 44100: | ||
44 | clock = INDIGO_EXPRESS_44100; | ||
45 | break; | ||
46 | case 48000: | ||
47 | clock = INDIGO_EXPRESS_48000; | ||
48 | break; | ||
49 | case 64000: | ||
50 | clock = INDIGO_EXPRESS_32000|INDIGO_EXPRESS_DOUBLE_SPEED; | ||
51 | break; | ||
52 | case 88200: | ||
53 | clock = INDIGO_EXPRESS_44100|INDIGO_EXPRESS_DOUBLE_SPEED; | ||
54 | break; | ||
55 | case 96000: | ||
56 | clock = INDIGO_EXPRESS_48000|INDIGO_EXPRESS_DOUBLE_SPEED; | ||
57 | break; | ||
58 | default: | ||
59 | return -EINVAL; | ||
60 | } | ||
61 | |||
62 | control_reg |= clock; | ||
63 | if (control_reg != old_control_reg) { | ||
64 | chip->comm_page->control_register = cpu_to_le32(control_reg); | ||
65 | chip->sample_rate = rate; | ||
66 | clear_handshake(chip); | ||
67 | return send_vector(chip, DSP_VC_UPDATE_CLOCKS); | ||
68 | } | ||
69 | return 0; | ||
70 | } | ||
71 | |||
72 | |||
73 | |||
74 | /* This function routes the sound from a virtual channel to a real output */ | ||
75 | static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe, | ||
76 | int gain) | ||
77 | { | ||
78 | int index; | ||
79 | |||
80 | if (snd_BUG_ON(pipe >= num_pipes_out(chip) || | ||
81 | output >= num_busses_out(chip))) | ||
82 | return -EINVAL; | ||
83 | |||
84 | if (wait_handshake(chip)) | ||
85 | return -EIO; | ||
86 | |||
87 | chip->vmixer_gain[output][pipe] = gain; | ||
88 | index = output * num_pipes_out(chip) + pipe; | ||
89 | chip->comm_page->vmixer[index] = gain; | ||
90 | |||
91 | DE_ACT(("set_vmixer_gain: pipe %d, out %d = %d\n", pipe, output, gain)); | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | |||
96 | |||
97 | /* Tell the DSP to read and update virtual mixer levels in comm page. */ | ||
98 | static int update_vmixer_level(struct echoaudio *chip) | ||
99 | { | ||
100 | if (wait_handshake(chip)) | ||
101 | return -EIO; | ||
102 | clear_handshake(chip); | ||
103 | return send_vector(chip, DSP_VC_SET_VMIXER_GAIN); | ||
104 | } | ||
105 | |||
106 | |||
107 | |||
108 | static u32 detect_input_clocks(const struct echoaudio *chip) | ||
109 | { | ||
110 | return ECHO_CLOCK_BIT_INTERNAL; | ||
111 | } | ||
112 | |||
113 | |||
114 | |||
115 | /* The IndigoIO has no ASIC. Just do nothing */ | ||
116 | static int load_asic(struct echoaudio *chip) | ||
117 | { | ||
118 | return 0; | ||
119 | } | ||
diff --git a/sound/pci/echoaudio/indigodj_dsp.c b/sound/pci/echoaudio/indigodj_dsp.c index 90730a5ecb42..08392916691e 100644 --- a/sound/pci/echoaudio/indigodj_dsp.c +++ b/sound/pci/echoaudio/indigodj_dsp.c | |||
@@ -63,18 +63,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
63 | if ((err = init_line_levels(chip)) < 0) | 63 | if ((err = init_line_levels(chip)) < 0) |
64 | return err; | 64 | return err; |
65 | 65 | ||
66 | /* Default routing of the virtual channels: vchannels 0-3 and | ||
67 | vchannels 4-7 are routed to real channels 0-4 */ | ||
68 | set_vmixer_gain(chip, 0, 0, 0); | ||
69 | set_vmixer_gain(chip, 1, 1, 0); | ||
70 | set_vmixer_gain(chip, 2, 2, 0); | ||
71 | set_vmixer_gain(chip, 3, 3, 0); | ||
72 | set_vmixer_gain(chip, 0, 4, 0); | ||
73 | set_vmixer_gain(chip, 1, 5, 0); | ||
74 | set_vmixer_gain(chip, 2, 6, 0); | ||
75 | set_vmixer_gain(chip, 3, 7, 0); | ||
76 | err = update_vmixer_level(chip); | ||
77 | |||
78 | DE_INIT(("init_hw done\n")); | 66 | DE_INIT(("init_hw done\n")); |
79 | return err; | 67 | return err; |
80 | } | 68 | } |
diff --git a/sound/pci/echoaudio/indigodjx.c b/sound/pci/echoaudio/indigodjx.c new file mode 100644 index 000000000000..3482ef69f491 --- /dev/null +++ b/sound/pci/echoaudio/indigodjx.c | |||
@@ -0,0 +1,107 @@ | |||
1 | /* | ||
2 | * ALSA driver for Echoaudio soundcards. | ||
3 | * Copyright (C) 2009 Giuliano Pochini <pochini@shiny.it> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | */ | ||
18 | |||
19 | #define INDIGO_FAMILY | ||
20 | #define ECHOCARD_INDIGO_DJX | ||
21 | #define ECHOCARD_NAME "Indigo DJx" | ||
22 | #define ECHOCARD_HAS_SUPER_INTERLEAVE | ||
23 | #define ECHOCARD_HAS_VMIXER | ||
24 | #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 | ||
25 | |||
26 | /* Pipe indexes */ | ||
27 | #define PX_ANALOG_OUT 0 /* 8 */ | ||
28 | #define PX_DIGITAL_OUT 8 /* 0 */ | ||
29 | #define PX_ANALOG_IN 8 /* 0 */ | ||
30 | #define PX_DIGITAL_IN 8 /* 0 */ | ||
31 | #define PX_NUM 8 | ||
32 | |||
33 | /* Bus indexes */ | ||
34 | #define BX_ANALOG_OUT 0 /* 4 */ | ||
35 | #define BX_DIGITAL_OUT 4 /* 0 */ | ||
36 | #define BX_ANALOG_IN 4 /* 0 */ | ||
37 | #define BX_DIGITAL_IN 4 /* 0 */ | ||
38 | #define BX_NUM 4 | ||
39 | |||
40 | |||
41 | #include <linux/delay.h> | ||
42 | #include <linux/init.h> | ||
43 | #include <linux/interrupt.h> | ||
44 | #include <linux/pci.h> | ||
45 | #include <linux/slab.h> | ||
46 | #include <linux/moduleparam.h> | ||
47 | #include <linux/firmware.h> | ||
48 | #include <linux/io.h> | ||
49 | #include <sound/core.h> | ||
50 | #include <sound/info.h> | ||
51 | #include <sound/control.h> | ||
52 | #include <sound/tlv.h> | ||
53 | #include <sound/pcm.h> | ||
54 | #include <sound/pcm_params.h> | ||
55 | #include <sound/asoundef.h> | ||
56 | #include <sound/initval.h> | ||
57 | #include <asm/atomic.h> | ||
58 | #include "echoaudio.h" | ||
59 | |||
60 | MODULE_FIRMWARE("ea/loader_dsp.fw"); | ||
61 | MODULE_FIRMWARE("ea/indigo_djx_dsp.fw"); | ||
62 | |||
63 | #define FW_361_LOADER 0 | ||
64 | #define FW_INDIGO_DJX_DSP 1 | ||
65 | |||
66 | static const struct firmware card_fw[] = { | ||
67 | {0, "loader_dsp.fw"}, | ||
68 | {0, "indigo_djx_dsp.fw"} | ||
69 | }; | ||
70 | |||
71 | static struct pci_device_id snd_echo_ids[] = { | ||
72 | {0x1057, 0x3410, 0xECC0, 0x00E0, 0, 0, 0}, /* Indigo DJx*/ | ||
73 | {0,} | ||
74 | }; | ||
75 | |||
76 | static struct snd_pcm_hardware pcm_hardware_skel = { | ||
77 | .info = SNDRV_PCM_INFO_MMAP | | ||
78 | SNDRV_PCM_INFO_INTERLEAVED | | ||
79 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | ||
80 | SNDRV_PCM_INFO_MMAP_VALID | | ||
81 | SNDRV_PCM_INFO_PAUSE | | ||
82 | SNDRV_PCM_INFO_SYNC_START, | ||
83 | .formats = SNDRV_PCM_FMTBIT_U8 | | ||
84 | SNDRV_PCM_FMTBIT_S16_LE | | ||
85 | SNDRV_PCM_FMTBIT_S24_3LE | | ||
86 | SNDRV_PCM_FMTBIT_S32_LE | | ||
87 | SNDRV_PCM_FMTBIT_S32_BE, | ||
88 | .rates = SNDRV_PCM_RATE_32000 | | ||
89 | SNDRV_PCM_RATE_44100 | | ||
90 | SNDRV_PCM_RATE_48000 | | ||
91 | SNDRV_PCM_RATE_88200 | | ||
92 | SNDRV_PCM_RATE_96000, | ||
93 | .rate_min = 32000, | ||
94 | .rate_max = 96000, | ||
95 | .channels_min = 1, | ||
96 | .channels_max = 4, | ||
97 | .buffer_bytes_max = 262144, | ||
98 | .period_bytes_min = 32, | ||
99 | .period_bytes_max = 131072, | ||
100 | .periods_min = 2, | ||
101 | .periods_max = 220, | ||
102 | }; | ||
103 | |||
104 | #include "indigodjx_dsp.c" | ||
105 | #include "indigo_express_dsp.c" | ||
106 | #include "echoaudio_dsp.c" | ||
107 | #include "echoaudio.c" | ||
diff --git a/sound/pci/echoaudio/indigodjx_dsp.c b/sound/pci/echoaudio/indigodjx_dsp.c new file mode 100644 index 000000000000..f591fc2ed960 --- /dev/null +++ b/sound/pci/echoaudio/indigodjx_dsp.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /************************************************************************ | ||
2 | |||
3 | This file is part of Echo Digital Audio's generic driver library. | ||
4 | Copyright Echo Digital Audio Corporation (c) 1998 - 2005 | ||
5 | All rights reserved | ||
6 | www.echoaudio.com | ||
7 | |||
8 | This library is free software; you can redistribute it and/or | ||
9 | modify it under the terms of the GNU Lesser General Public | ||
10 | License as published by the Free Software Foundation; either | ||
11 | version 2.1 of the License, or (at your option) any later version. | ||
12 | |||
13 | This library is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | Lesser General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU Lesser General Public | ||
19 | License along with this library; if not, write to the Free Software | ||
20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | |||
22 | ************************************************************************* | ||
23 | |||
24 | Translation from C++ and adaptation for use in ALSA-Driver | ||
25 | were made by Giuliano Pochini <pochini@shiny.it> | ||
26 | |||
27 | *************************************************************************/ | ||
28 | |||
29 | static int update_vmixer_level(struct echoaudio *chip); | ||
30 | static int set_vmixer_gain(struct echoaudio *chip, u16 output, | ||
31 | u16 pipe, int gain); | ||
32 | |||
33 | |||
34 | static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | ||
35 | { | ||
36 | int err; | ||
37 | |||
38 | DE_INIT(("init_hw() - Indigo DJx\n")); | ||
39 | if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_DJX)) | ||
40 | return -ENODEV; | ||
41 | |||
42 | err = init_dsp_comm_page(chip); | ||
43 | if (err < 0) { | ||
44 | DE_INIT(("init_hw - could not initialize DSP comm page\n")); | ||
45 | return err; | ||
46 | } | ||
47 | |||
48 | chip->device_id = device_id; | ||
49 | chip->subdevice_id = subdevice_id; | ||
50 | chip->bad_board = TRUE; | ||
51 | chip->dsp_code_to_load = &card_fw[FW_INDIGO_DJX_DSP]; | ||
52 | /* Since this card has no ASIC, mark it as loaded so everything | ||
53 | works OK */ | ||
54 | chip->asic_loaded = TRUE; | ||
55 | chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; | ||
56 | |||
57 | err = load_firmware(chip); | ||
58 | if (err < 0) | ||
59 | return err; | ||
60 | chip->bad_board = FALSE; | ||
61 | |||
62 | err = init_line_levels(chip); | ||
63 | if (err < 0) | ||
64 | return err; | ||
65 | |||
66 | DE_INIT(("init_hw done\n")); | ||
67 | return err; | ||
68 | } | ||
diff --git a/sound/pci/echoaudio/indigoio_dsp.c b/sound/pci/echoaudio/indigoio_dsp.c index a7e09ec21079..0604c8a85223 100644 --- a/sound/pci/echoaudio/indigoio_dsp.c +++ b/sound/pci/echoaudio/indigoio_dsp.c | |||
@@ -63,18 +63,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
63 | if ((err = init_line_levels(chip)) < 0) | 63 | if ((err = init_line_levels(chip)) < 0) |
64 | return err; | 64 | return err; |
65 | 65 | ||
66 | /* Default routing of the virtual channels: all vchannels are routed | ||
67 | to the stereo output */ | ||
68 | set_vmixer_gain(chip, 0, 0, 0); | ||
69 | set_vmixer_gain(chip, 1, 1, 0); | ||
70 | set_vmixer_gain(chip, 0, 2, 0); | ||
71 | set_vmixer_gain(chip, 1, 3, 0); | ||
72 | set_vmixer_gain(chip, 0, 4, 0); | ||
73 | set_vmixer_gain(chip, 1, 5, 0); | ||
74 | set_vmixer_gain(chip, 0, 6, 0); | ||
75 | set_vmixer_gain(chip, 1, 7, 0); | ||
76 | err = update_vmixer_level(chip); | ||
77 | |||
78 | DE_INIT(("init_hw done\n")); | 66 | DE_INIT(("init_hw done\n")); |
79 | return err; | 67 | return err; |
80 | } | 68 | } |
diff --git a/sound/pci/echoaudio/indigoiox.c b/sound/pci/echoaudio/indigoiox.c new file mode 100644 index 000000000000..aebee27a40ff --- /dev/null +++ b/sound/pci/echoaudio/indigoiox.c | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | * ALSA driver for Echoaudio soundcards. | ||
3 | * Copyright (C) 2009 Giuliano Pochini <pochini@shiny.it> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | * | ||
14 | * You should have received a copy of the GNU General Public License | ||
15 | * along with this program; if not, write to the Free Software | ||
16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
17 | */ | ||
18 | |||
19 | #define INDIGO_FAMILY | ||
20 | #define ECHOCARD_INDIGO_IOX | ||
21 | #define ECHOCARD_NAME "Indigo IOx" | ||
22 | #define ECHOCARD_HAS_MONITOR | ||
23 | #define ECHOCARD_HAS_SUPER_INTERLEAVE | ||
24 | #define ECHOCARD_HAS_VMIXER | ||
25 | #define ECHOCARD_HAS_STEREO_BIG_ENDIAN32 | ||
26 | |||
27 | /* Pipe indexes */ | ||
28 | #define PX_ANALOG_OUT 0 /* 8 */ | ||
29 | #define PX_DIGITAL_OUT 8 /* 0 */ | ||
30 | #define PX_ANALOG_IN 8 /* 2 */ | ||
31 | #define PX_DIGITAL_IN 10 /* 0 */ | ||
32 | #define PX_NUM 10 | ||
33 | |||
34 | /* Bus indexes */ | ||
35 | #define BX_ANALOG_OUT 0 /* 2 */ | ||
36 | #define BX_DIGITAL_OUT 2 /* 0 */ | ||
37 | #define BX_ANALOG_IN 2 /* 2 */ | ||
38 | #define BX_DIGITAL_IN 4 /* 0 */ | ||
39 | #define BX_NUM 4 | ||
40 | |||
41 | |||
42 | #include <linux/delay.h> | ||
43 | #include <linux/init.h> | ||
44 | #include <linux/interrupt.h> | ||
45 | #include <linux/pci.h> | ||
46 | #include <linux/slab.h> | ||
47 | #include <linux/moduleparam.h> | ||
48 | #include <linux/firmware.h> | ||
49 | #include <linux/io.h> | ||
50 | #include <sound/core.h> | ||
51 | #include <sound/info.h> | ||
52 | #include <sound/control.h> | ||
53 | #include <sound/tlv.h> | ||
54 | #include <sound/pcm.h> | ||
55 | #include <sound/pcm_params.h> | ||
56 | #include <sound/asoundef.h> | ||
57 | #include <sound/initval.h> | ||
58 | #include <asm/atomic.h> | ||
59 | #include "echoaudio.h" | ||
60 | |||
61 | MODULE_FIRMWARE("ea/loader_dsp.fw"); | ||
62 | MODULE_FIRMWARE("ea/indigo_iox_dsp.fw"); | ||
63 | |||
64 | #define FW_361_LOADER 0 | ||
65 | #define FW_INDIGO_IOX_DSP 1 | ||
66 | |||
67 | static const struct firmware card_fw[] = { | ||
68 | {0, "loader_dsp.fw"}, | ||
69 | {0, "indigo_iox_dsp.fw"} | ||
70 | }; | ||
71 | |||
72 | static struct pci_device_id snd_echo_ids[] = { | ||
73 | {0x1057, 0x3410, 0xECC0, 0x00D0, 0, 0, 0}, /* Indigo IOx */ | ||
74 | {0,} | ||
75 | }; | ||
76 | |||
77 | static struct snd_pcm_hardware pcm_hardware_skel = { | ||
78 | .info = SNDRV_PCM_INFO_MMAP | | ||
79 | SNDRV_PCM_INFO_INTERLEAVED | | ||
80 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | ||
81 | SNDRV_PCM_INFO_MMAP_VALID | | ||
82 | SNDRV_PCM_INFO_PAUSE | | ||
83 | SNDRV_PCM_INFO_SYNC_START, | ||
84 | .formats = SNDRV_PCM_FMTBIT_U8 | | ||
85 | SNDRV_PCM_FMTBIT_S16_LE | | ||
86 | SNDRV_PCM_FMTBIT_S24_3LE | | ||
87 | SNDRV_PCM_FMTBIT_S32_LE | | ||
88 | SNDRV_PCM_FMTBIT_S32_BE, | ||
89 | .rates = SNDRV_PCM_RATE_32000 | | ||
90 | SNDRV_PCM_RATE_44100 | | ||
91 | SNDRV_PCM_RATE_48000 | | ||
92 | SNDRV_PCM_RATE_88200 | | ||
93 | SNDRV_PCM_RATE_96000, | ||
94 | .rate_min = 32000, | ||
95 | .rate_max = 96000, | ||
96 | .channels_min = 1, | ||
97 | .channels_max = 8, | ||
98 | .buffer_bytes_max = 262144, | ||
99 | .period_bytes_min = 32, | ||
100 | .period_bytes_max = 131072, | ||
101 | .periods_min = 2, | ||
102 | .periods_max = 220, | ||
103 | }; | ||
104 | |||
105 | #include "indigoiox_dsp.c" | ||
106 | #include "indigo_express_dsp.c" | ||
107 | #include "echoaudio_dsp.c" | ||
108 | #include "echoaudio.c" | ||
109 | |||
diff --git a/sound/pci/echoaudio/indigoiox_dsp.c b/sound/pci/echoaudio/indigoiox_dsp.c new file mode 100644 index 000000000000..f357521c79e6 --- /dev/null +++ b/sound/pci/echoaudio/indigoiox_dsp.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /************************************************************************ | ||
2 | |||
3 | This file is part of Echo Digital Audio's generic driver library. | ||
4 | Copyright Echo Digital Audio Corporation (c) 1998 - 2005 | ||
5 | All rights reserved | ||
6 | www.echoaudio.com | ||
7 | |||
8 | This library is free software; you can redistribute it and/or | ||
9 | modify it under the terms of the GNU Lesser General Public | ||
10 | License as published by the Free Software Foundation; either | ||
11 | version 2.1 of the License, or (at your option) any later version. | ||
12 | |||
13 | This library is distributed in the hope that it will be useful, | ||
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
16 | Lesser General Public License for more details. | ||
17 | |||
18 | You should have received a copy of the GNU Lesser General Public | ||
19 | License along with this library; if not, write to the Free Software | ||
20 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | |||
22 | ************************************************************************* | ||
23 | |||
24 | Translation from C++ and adaptation for use in ALSA-Driver | ||
25 | were made by Giuliano Pochini <pochini@shiny.it> | ||
26 | |||
27 | *************************************************************************/ | ||
28 | |||
29 | static int update_vmixer_level(struct echoaudio *chip); | ||
30 | static int set_vmixer_gain(struct echoaudio *chip, u16 output, | ||
31 | u16 pipe, int gain); | ||
32 | |||
33 | |||
34 | static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | ||
35 | { | ||
36 | int err; | ||
37 | |||
38 | DE_INIT(("init_hw() - Indigo IOx\n")); | ||
39 | if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO_IOX)) | ||
40 | return -ENODEV; | ||
41 | |||
42 | err = init_dsp_comm_page(chip); | ||
43 | if (err < 0) { | ||
44 | DE_INIT(("init_hw - could not initialize DSP comm page\n")); | ||
45 | return err; | ||
46 | } | ||
47 | |||
48 | chip->device_id = device_id; | ||
49 | chip->subdevice_id = subdevice_id; | ||
50 | chip->bad_board = TRUE; | ||
51 | chip->dsp_code_to_load = &card_fw[FW_INDIGO_IOX_DSP]; | ||
52 | /* Since this card has no ASIC, mark it as loaded so everything | ||
53 | works OK */ | ||
54 | chip->asic_loaded = TRUE; | ||
55 | chip->input_clock_types = ECHO_CLOCK_BIT_INTERNAL; | ||
56 | |||
57 | err = load_firmware(chip); | ||
58 | if (err < 0) | ||
59 | return err; | ||
60 | chip->bad_board = FALSE; | ||
61 | |||
62 | err = init_line_levels(chip); | ||
63 | if (err < 0) | ||
64 | return err; | ||
65 | |||
66 | DE_INIT(("init_hw done\n")); | ||
67 | return err; | ||
68 | } | ||
diff --git a/sound/pci/echoaudio/layla20_dsp.c b/sound/pci/echoaudio/layla20_dsp.c index ede75c6ca0fb..83750e9fd7b4 100644 --- a/sound/pci/echoaudio/layla20_dsp.c +++ b/sound/pci/echoaudio/layla20_dsp.c | |||
@@ -284,10 +284,10 @@ static int set_professional_spdif(struct echoaudio *chip, char prof) | |||
284 | DE_ACT(("set_professional_spdif %d\n", prof)); | 284 | DE_ACT(("set_professional_spdif %d\n", prof)); |
285 | if (prof) | 285 | if (prof) |
286 | chip->comm_page->flags |= | 286 | chip->comm_page->flags |= |
287 | __constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); | 287 | cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); |
288 | else | 288 | else |
289 | chip->comm_page->flags &= | 289 | chip->comm_page->flags &= |
290 | ~__constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); | 290 | ~cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); |
291 | chip->professional_spdif = prof; | 291 | chip->professional_spdif = prof; |
292 | return update_flags(chip); | 292 | return update_flags(chip); |
293 | } | 293 | } |
diff --git a/sound/pci/echoaudio/mia_dsp.c b/sound/pci/echoaudio/mia_dsp.c index 227386602f9b..551405114cbc 100644 --- a/sound/pci/echoaudio/mia_dsp.c +++ b/sound/pci/echoaudio/mia_dsp.c | |||
@@ -69,18 +69,6 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id) | |||
69 | if ((err = init_line_levels(chip))) | 69 | if ((err = init_line_levels(chip))) |
70 | return err; | 70 | return err; |
71 | 71 | ||
72 | /* Default routing of the virtual channels: vchannels 0-3 go to analog | ||
73 | outputs and vchannels 4-7 go to S/PDIF outputs */ | ||
74 | set_vmixer_gain(chip, 0, 0, 0); | ||
75 | set_vmixer_gain(chip, 1, 1, 0); | ||
76 | set_vmixer_gain(chip, 0, 2, 0); | ||
77 | set_vmixer_gain(chip, 1, 3, 0); | ||
78 | set_vmixer_gain(chip, 2, 4, 0); | ||
79 | set_vmixer_gain(chip, 3, 5, 0); | ||
80 | set_vmixer_gain(chip, 2, 6, 0); | ||
81 | set_vmixer_gain(chip, 3, 7, 0); | ||
82 | err = update_vmixer_level(chip); | ||
83 | |||
84 | DE_INIT(("init_hw done\n")); | 72 | DE_INIT(("init_hw done\n")); |
85 | return err; | 73 | return err; |
86 | } | 74 | } |
@@ -222,10 +210,10 @@ static int set_professional_spdif(struct echoaudio *chip, char prof) | |||
222 | DE_ACT(("set_professional_spdif %d\n", prof)); | 210 | DE_ACT(("set_professional_spdif %d\n", prof)); |
223 | if (prof) | 211 | if (prof) |
224 | chip->comm_page->flags |= | 212 | chip->comm_page->flags |= |
225 | __constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); | 213 | cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); |
226 | else | 214 | else |
227 | chip->comm_page->flags &= | 215 | chip->comm_page->flags &= |
228 | ~__constant_cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); | 216 | ~cpu_to_le32(DSP_FLAG_PROFESSIONAL_SPDIF); |
229 | chip->professional_spdif = prof; | 217 | chip->professional_spdif = prof; |
230 | return update_flags(chip); | 218 | return update_flags(chip); |
231 | } | 219 | } |
diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c index 77bf2a83d997..a953d142cb4b 100644 --- a/sound/pci/echoaudio/midi.c +++ b/sound/pci/echoaudio/midi.c | |||
@@ -44,10 +44,10 @@ static int enable_midi_input(struct echoaudio *chip, char enable) | |||
44 | if (enable) { | 44 | if (enable) { |
45 | chip->mtc_state = MIDI_IN_STATE_NORMAL; | 45 | chip->mtc_state = MIDI_IN_STATE_NORMAL; |
46 | chip->comm_page->flags |= | 46 | chip->comm_page->flags |= |
47 | __constant_cpu_to_le32(DSP_FLAG_MIDI_INPUT); | 47 | cpu_to_le32(DSP_FLAG_MIDI_INPUT); |
48 | } else | 48 | } else |
49 | chip->comm_page->flags &= | 49 | chip->comm_page->flags &= |
50 | ~__constant_cpu_to_le32(DSP_FLAG_MIDI_INPUT); | 50 | ~cpu_to_le32(DSP_FLAG_MIDI_INPUT); |
51 | 51 | ||
52 | clear_handshake(chip); | 52 | clear_handshake(chip); |
53 | return send_vector(chip, DSP_VC_UPDATE_FLAGS); | 53 | return send_vector(chip, DSP_VC_UPDATE_FLAGS); |
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c index 8354c1a83312..c7f3b994101c 100644 --- a/sound/pci/emu10k1/emu10k1.c +++ b/sound/pci/emu10k1/emu10k1.c | |||
@@ -114,9 +114,9 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci, | |||
114 | return -ENOENT; | 114 | return -ENOENT; |
115 | } | 115 | } |
116 | 116 | ||
117 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 117 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
118 | if (card == NULL) | 118 | if (err < 0) |
119 | return -ENOMEM; | 119 | return err; |
120 | if (max_buffer_size[dev] < 32) | 120 | if (max_buffer_size[dev] < 32) |
121 | max_buffer_size[dev] = 32; | 121 | max_buffer_size[dev] = 32; |
122 | else if (max_buffer_size[dev] > 1024) | 122 | else if (max_buffer_size[dev] > 1024) |
diff --git a/sound/pci/emu10k1/emu10k1_callback.c b/sound/pci/emu10k1/emu10k1_callback.c index 0e649dcdbf64..7ef949d99a50 100644 --- a/sound/pci/emu10k1/emu10k1_callback.c +++ b/sound/pci/emu10k1/emu10k1_callback.c | |||
@@ -103,7 +103,10 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw) | |||
103 | int ch; | 103 | int ch; |
104 | vp = &emu->voices[best[i].voice]; | 104 | vp = &emu->voices[best[i].voice]; |
105 | if ((ch = vp->ch) < 0) { | 105 | if ((ch = vp->ch) < 0) { |
106 | //printk("synth_get_voice: ch < 0 (%d) ??", i); | 106 | /* |
107 | printk(KERN_WARNING | ||
108 | "synth_get_voice: ch < 0 (%d) ??", i); | ||
109 | */ | ||
107 | continue; | 110 | continue; |
108 | } | 111 | } |
109 | vp->emu->num_voices--; | 112 | vp->emu->num_voices--; |
@@ -335,7 +338,7 @@ start_voice(struct snd_emux_voice *vp) | |||
335 | return -EINVAL; | 338 | return -EINVAL; |
336 | emem->map_locked++; | 339 | emem->map_locked++; |
337 | if (snd_emu10k1_memblk_map(hw, emem) < 0) { | 340 | if (snd_emu10k1_memblk_map(hw, emem) < 0) { |
338 | // printk("emu: cannot map!\n"); | 341 | /* printk(KERN_ERR "emu: cannot map!\n"); */ |
339 | return -ENOMEM; | 342 | return -ENOMEM; |
340 | } | 343 | } |
341 | mapped_offset = snd_emu10k1_memblk_offset(emem) >> 1; | 344 | mapped_offset = snd_emu10k1_memblk_offset(emem) >> 1; |
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c index 101a1c13a20d..f18bd6207c50 100644 --- a/sound/pci/emu10k1/emu10k1_main.c +++ b/sound/pci/emu10k1/emu10k1_main.c | |||
@@ -711,8 +711,7 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, const char *filena | |||
711 | static int emu1010_firmware_thread(void *data) | 711 | static int emu1010_firmware_thread(void *data) |
712 | { | 712 | { |
713 | struct snd_emu10k1 *emu = data; | 713 | struct snd_emu10k1 *emu = data; |
714 | int tmp, tmp2; | 714 | u32 tmp, tmp2, reg; |
715 | int reg; | ||
716 | int err; | 715 | int err; |
717 | 716 | ||
718 | for (;;) { | 717 | for (;;) { |
@@ -758,7 +757,8 @@ static int emu1010_firmware_thread(void *data) | |||
758 | snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); | 757 | snd_printk(KERN_INFO "emu1010: Audio Dock Firmware loaded\n"); |
759 | snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); | 758 | snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); |
760 | snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); | 759 | snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); |
761 | snd_printk("Audio Dock ver:%d.%d\n", tmp, tmp2); | 760 | snd_printk(KERN_INFO "Audio Dock ver: %u.%u\n", |
761 | tmp, tmp2); | ||
762 | /* Sync clocking between 1010 and Dock */ | 762 | /* Sync clocking between 1010 and Dock */ |
763 | /* Allow DLL to settle */ | 763 | /* Allow DLL to settle */ |
764 | msleep(10); | 764 | msleep(10); |
@@ -804,8 +804,7 @@ static int emu1010_firmware_thread(void *data) | |||
804 | static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) | 804 | static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) |
805 | { | 805 | { |
806 | unsigned int i; | 806 | unsigned int i; |
807 | int tmp, tmp2; | 807 | u32 tmp, tmp2, reg; |
808 | int reg; | ||
809 | int err; | 808 | int err; |
810 | const char *filename = NULL; | 809 | const char *filename = NULL; |
811 | 810 | ||
@@ -887,7 +886,7 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu) | |||
887 | snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); | 886 | snd_printk(KERN_INFO "emu1010: Hana Firmware loaded\n"); |
888 | snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp); | 887 | snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp); |
889 | snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2); | 888 | snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2); |
890 | snd_printk("emu1010: Hana version: %d.%d\n", tmp, tmp2); | 889 | snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2); |
891 | /* Enable 48Volt power to Audio Dock */ | 890 | /* Enable 48Volt power to Audio Dock */ |
892 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON); | 891 | snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON); |
893 | 892 | ||
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 5ff4dbb62dad..31542adc6b7e 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c | |||
@@ -1544,9 +1544,9 @@ static int __devinit snd_emu10k1x_probe(struct pci_dev *pci, | |||
1544 | return -ENOENT; | 1544 | return -ENOENT; |
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1547 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1548 | if (card == NULL) | 1548 | if (err < 0) |
1549 | return -ENOMEM; | 1549 | return err; |
1550 | 1550 | ||
1551 | if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) { | 1551 | if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) { |
1552 | snd_card_free(card); | 1552 | snd_card_free(card); |
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c index 7dba08f0ab8e..191e1cd9997d 100644 --- a/sound/pci/emu10k1/emufx.c +++ b/sound/pci/emu10k1/emufx.c | |||
@@ -1519,7 +1519,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) | |||
1519 | /* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */ | 1519 | /* A_PUT_STEREO_OUTPUT(A_EXTOUT_FRONT_L, A_EXTOUT_FRONT_R, playback + SND_EMU10K1_PLAYBACK_CHANNELS); */ |
1520 | if (emu->card_capabilities->emu_model) { | 1520 | if (emu->card_capabilities->emu_model) { |
1521 | /* EMU1010 Outputs from PCM Front, Rear, Center, LFE, Side */ | 1521 | /* EMU1010 Outputs from PCM Front, Rear, Center, LFE, Side */ |
1522 | snd_printk("EMU outputs on\n"); | 1522 | snd_printk(KERN_INFO "EMU outputs on\n"); |
1523 | for (z = 0; z < 8; z++) { | 1523 | for (z = 0; z < 8; z++) { |
1524 | if (emu->card_capabilities->ca0108_chip) { | 1524 | if (emu->card_capabilities->ca0108_chip) { |
1525 | A_OP(icode, &ptr, iACC3, A3_EMU32OUT(z), A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + z), A_C_00000000, A_C_00000000); | 1525 | A_OP(icode, &ptr, iACC3, A3_EMU32OUT(z), A_GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + z), A_C_00000000, A_C_00000000); |
@@ -1567,7 +1567,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) | |||
1567 | 1567 | ||
1568 | if (emu->card_capabilities->emu_model) { | 1568 | if (emu->card_capabilities->emu_model) { |
1569 | if (emu->card_capabilities->ca0108_chip) { | 1569 | if (emu->card_capabilities->ca0108_chip) { |
1570 | snd_printk("EMU2 inputs on\n"); | 1570 | snd_printk(KERN_INFO "EMU2 inputs on\n"); |
1571 | for (z = 0; z < 0x10; z++) { | 1571 | for (z = 0; z < 0x10; z++) { |
1572 | snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, | 1572 | snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, |
1573 | bit_shifter16, | 1573 | bit_shifter16, |
@@ -1575,10 +1575,13 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input)) | |||
1575 | A_FXBUS2(z*2) ); | 1575 | A_FXBUS2(z*2) ); |
1576 | } | 1576 | } |
1577 | } else { | 1577 | } else { |
1578 | snd_printk("EMU inputs on\n"); | 1578 | snd_printk(KERN_INFO "EMU inputs on\n"); |
1579 | /* Capture 16 (originally 8) channels of S32_LE sound */ | 1579 | /* Capture 16 (originally 8) channels of S32_LE sound */ |
1580 | 1580 | ||
1581 | /* printk("emufx.c: gpr=0x%x, tmp=0x%x\n",gpr, tmp); */ | 1581 | /* |
1582 | printk(KERN_DEBUG "emufx.c: gpr=0x%x, tmp=0x%x\n", | ||
1583 | gpr, tmp); | ||
1584 | */ | ||
1582 | /* For the EMU1010: How to get 32bit values from the DSP. High 16bits into L, low 16bits into R. */ | 1585 | /* For the EMU1010: How to get 32bit values from the DSP. High 16bits into L, low 16bits into R. */ |
1583 | /* A_P16VIN(0) is delayed by one sample, | 1586 | /* A_P16VIN(0) is delayed by one sample, |
1584 | * so all other A_P16VIN channels will need to also be delayed | 1587 | * so all other A_P16VIN channels will need to also be delayed |
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c index cf9276ddad42..78f62fd404c2 100644 --- a/sound/pci/emu10k1/emupcm.c +++ b/sound/pci/emu10k1/emupcm.c | |||
@@ -44,7 +44,7 @@ static void snd_emu10k1_pcm_interrupt(struct snd_emu10k1 *emu, | |||
44 | if (epcm->substream == NULL) | 44 | if (epcm->substream == NULL) |
45 | return; | 45 | return; |
46 | #if 0 | 46 | #if 0 |
47 | printk("IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n", | 47 | printk(KERN_DEBUG "IRQ: position = 0x%x, period = 0x%x, size = 0x%x\n", |
48 | epcm->substream->runtime->hw->pointer(emu, epcm->substream), | 48 | epcm->substream->runtime->hw->pointer(emu, epcm->substream), |
49 | snd_pcm_lib_period_bytes(epcm->substream), | 49 | snd_pcm_lib_period_bytes(epcm->substream), |
50 | snd_pcm_lib_buffer_bytes(epcm->substream)); | 50 | snd_pcm_lib_buffer_bytes(epcm->substream)); |
@@ -146,7 +146,11 @@ static int snd_emu10k1_pcm_channel_alloc(struct snd_emu10k1_pcm * epcm, int voic | |||
146 | 1, | 146 | 1, |
147 | &epcm->extra); | 147 | &epcm->extra); |
148 | if (err < 0) { | 148 | if (err < 0) { |
149 | /* printk("pcm_channel_alloc: failed extra: voices=%d, frame=%d\n", voices, frame); */ | 149 | /* |
150 | printk(KERN_DEBUG "pcm_channel_alloc: " | ||
151 | "failed extra: voices=%d, frame=%d\n", | ||
152 | voices, frame); | ||
153 | */ | ||
150 | for (i = 0; i < voices; i++) { | 154 | for (i = 0; i < voices; i++) { |
151 | snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); | 155 | snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); |
152 | epcm->voices[i] = NULL; | 156 | epcm->voices[i] = NULL; |
@@ -737,7 +741,10 @@ static int snd_emu10k1_playback_trigger(struct snd_pcm_substream *substream, | |||
737 | struct snd_emu10k1_pcm_mixer *mix; | 741 | struct snd_emu10k1_pcm_mixer *mix; |
738 | int result = 0; | 742 | int result = 0; |
739 | 743 | ||
740 | /* printk("trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n", (int)emu, cmd, substream->ops->pointer(substream)); */ | 744 | /* |
745 | printk(KERN_DEBUG "trigger - emu10k1 = 0x%x, cmd = %i, pointer = %i\n", | ||
746 | (int)emu, cmd, substream->ops->pointer(substream)) | ||
747 | */ | ||
741 | spin_lock(&emu->reg_lock); | 748 | spin_lock(&emu->reg_lock); |
742 | switch (cmd) { | 749 | switch (cmd) { |
743 | case SNDRV_PCM_TRIGGER_START: | 750 | case SNDRV_PCM_TRIGGER_START: |
@@ -786,7 +793,10 @@ static int snd_emu10k1_capture_trigger(struct snd_pcm_substream *substream, | |||
786 | /* hmm this should cause full and half full interrupt to be raised? */ | 793 | /* hmm this should cause full and half full interrupt to be raised? */ |
787 | outl(epcm->capture_ipr, emu->port + IPR); | 794 | outl(epcm->capture_ipr, emu->port + IPR); |
788 | snd_emu10k1_intr_enable(emu, epcm->capture_inte); | 795 | snd_emu10k1_intr_enable(emu, epcm->capture_inte); |
789 | /* printk("adccr = 0x%x, adcbs = 0x%x\n", epcm->adccr, epcm->adcbs); */ | 796 | /* |
797 | printk(KERN_DEBUG "adccr = 0x%x, adcbs = 0x%x\n", | ||
798 | epcm->adccr, epcm->adcbs); | ||
799 | */ | ||
790 | switch (epcm->type) { | 800 | switch (epcm->type) { |
791 | case CAPTURE_AC97ADC: | 801 | case CAPTURE_AC97ADC: |
792 | snd_emu10k1_ptr_write(emu, ADCCR, 0, epcm->capture_cr_val); | 802 | snd_emu10k1_ptr_write(emu, ADCCR, 0, epcm->capture_cr_val); |
@@ -857,7 +867,11 @@ static snd_pcm_uframes_t snd_emu10k1_playback_pointer(struct snd_pcm_substream * | |||
857 | ptr -= runtime->buffer_size; | 867 | ptr -= runtime->buffer_size; |
858 | } | 868 | } |
859 | #endif | 869 | #endif |
860 | /* printk("ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n", ptr, runtime->buffer_size, runtime->period_size); */ | 870 | /* |
871 | printk(KERN_DEBUG | ||
872 | "ptr = 0x%x, buffer_size = 0x%x, period_size = 0x%x\n", | ||
873 | ptr, runtime->buffer_size, runtime->period_size); | ||
874 | */ | ||
861 | return ptr; | 875 | return ptr; |
862 | } | 876 | } |
863 | 877 | ||
@@ -1546,7 +1560,11 @@ static void snd_emu10k1_fx8010_playback_tram_poke1(unsigned short *dst_left, | |||
1546 | unsigned int count, | 1560 | unsigned int count, |
1547 | unsigned int tram_shift) | 1561 | unsigned int tram_shift) |
1548 | { | 1562 | { |
1549 | /* printk("tram_poke1: dst_left = 0x%p, dst_right = 0x%p, src = 0x%p, count = 0x%x\n", dst_left, dst_right, src, count); */ | 1563 | /* |
1564 | printk(KERN_DEBUG "tram_poke1: dst_left = 0x%p, dst_right = 0x%p, " | ||
1565 | "src = 0x%p, count = 0x%x\n", | ||
1566 | dst_left, dst_right, src, count); | ||
1567 | */ | ||
1550 | if ((tram_shift & 1) == 0) { | 1568 | if ((tram_shift & 1) == 0) { |
1551 | while (count--) { | 1569 | while (count--) { |
1552 | *dst_left-- = *src++; | 1570 | *dst_left-- = *src++; |
@@ -1623,7 +1641,12 @@ static int snd_emu10k1_fx8010_playback_prepare(struct snd_pcm_substream *substre | |||
1623 | struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; | 1641 | struct snd_emu10k1_fx8010_pcm *pcm = &emu->fx8010.pcm[substream->number]; |
1624 | unsigned int i; | 1642 | unsigned int i; |
1625 | 1643 | ||
1626 | /* printk("prepare: etram_pages = 0x%p, dma_area = 0x%x, buffer_size = 0x%x (0x%x)\n", emu->fx8010.etram_pages, runtime->dma_area, runtime->buffer_size, runtime->buffer_size << 2); */ | 1644 | /* |
1645 | printk(KERN_DEBUG "prepare: etram_pages = 0x%p, dma_area = 0x%x, " | ||
1646 | "buffer_size = 0x%x (0x%x)\n", | ||
1647 | emu->fx8010.etram_pages, runtime->dma_area, | ||
1648 | runtime->buffer_size, runtime->buffer_size << 2); | ||
1649 | */ | ||
1627 | memset(&pcm->pcm_rec, 0, sizeof(pcm->pcm_rec)); | 1650 | memset(&pcm->pcm_rec, 0, sizeof(pcm->pcm_rec)); |
1628 | pcm->pcm_rec.hw_buffer_size = pcm->buffer_size * 2; /* byte size */ | 1651 | pcm->pcm_rec.hw_buffer_size = pcm->buffer_size * 2; /* byte size */ |
1629 | pcm->pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream); | 1652 | pcm->pcm_rec.sw_buffer_size = snd_pcm_lib_buffer_bytes(substream); |
diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c index b5a802bdeb7c..4bfc31d1b281 100644 --- a/sound/pci/emu10k1/io.c +++ b/sound/pci/emu10k1/io.c | |||
@@ -226,7 +226,9 @@ int snd_emu10k1_i2c_write(struct snd_emu10k1 *emu, | |||
226 | break; | 226 | break; |
227 | 227 | ||
228 | if (timeout > 1000) { | 228 | if (timeout > 1000) { |
229 | snd_printk("emu10k1:I2C:timeout status=0x%x\n", status); | 229 | snd_printk(KERN_WARNING |
230 | "emu10k1:I2C:timeout status=0x%x\n", | ||
231 | status); | ||
230 | break; | 232 | break; |
231 | } | 233 | } |
232 | } | 234 | } |
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c index 749a21b6bd06..e617acaf10e3 100644 --- a/sound/pci/emu10k1/p16v.c +++ b/sound/pci/emu10k1/p16v.c | |||
@@ -168,7 +168,7 @@ static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime) | |||
168 | struct snd_emu10k1_pcm *epcm = runtime->private_data; | 168 | struct snd_emu10k1_pcm *epcm = runtime->private_data; |
169 | 169 | ||
170 | if (epcm) { | 170 | if (epcm) { |
171 | //snd_printk("epcm free: %p\n", epcm); | 171 | /* snd_printk(KERN_DEBUG "epcm free: %p\n", epcm); */ |
172 | kfree(epcm); | 172 | kfree(epcm); |
173 | } | 173 | } |
174 | } | 174 | } |
@@ -183,14 +183,16 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea | |||
183 | int err; | 183 | int err; |
184 | 184 | ||
185 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); | 185 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
186 | //snd_printk("epcm kcalloc: %p\n", epcm); | 186 | /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */ |
187 | 187 | ||
188 | if (epcm == NULL) | 188 | if (epcm == NULL) |
189 | return -ENOMEM; | 189 | return -ENOMEM; |
190 | epcm->emu = emu; | 190 | epcm->emu = emu; |
191 | epcm->substream = substream; | 191 | epcm->substream = substream; |
192 | //snd_printk("epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); | 192 | /* |
193 | 193 | snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", | |
194 | substream->pcm->device, channel_id); | ||
195 | */ | ||
194 | runtime->private_data = epcm; | 196 | runtime->private_data = epcm; |
195 | runtime->private_free = snd_p16v_pcm_free_substream; | 197 | runtime->private_free = snd_p16v_pcm_free_substream; |
196 | 198 | ||
@@ -200,10 +202,15 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea | |||
200 | channel->number = channel_id; | 202 | channel->number = channel_id; |
201 | 203 | ||
202 | channel->use=1; | 204 | channel->use=1; |
203 | //snd_printk("p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); | 205 | #if 0 /* debug */ |
204 | //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); | 206 | snd_printk(KERN_DEBUG |
205 | //channel->interrupt = snd_p16v_pcm_channel_interrupt; | 207 | "p16v: open channel_id=%d, channel=%p, use=0x%x\n", |
206 | channel->epcm=epcm; | 208 | channel_id, channel, channel->use); |
209 | printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", | ||
210 | channel_id, chip, channel); | ||
211 | #endif /* debug */ | ||
212 | /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */ | ||
213 | channel->epcm = epcm; | ||
207 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 214 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) |
208 | return err; | 215 | return err; |
209 | 216 | ||
@@ -224,14 +231,16 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream | |||
224 | int err; | 231 | int err; |
225 | 232 | ||
226 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); | 233 | epcm = kzalloc(sizeof(*epcm), GFP_KERNEL); |
227 | //snd_printk("epcm kcalloc: %p\n", epcm); | 234 | /* snd_printk(KERN_DEBUG "epcm kcalloc: %p\n", epcm); */ |
228 | 235 | ||
229 | if (epcm == NULL) | 236 | if (epcm == NULL) |
230 | return -ENOMEM; | 237 | return -ENOMEM; |
231 | epcm->emu = emu; | 238 | epcm->emu = emu; |
232 | epcm->substream = substream; | 239 | epcm->substream = substream; |
233 | //snd_printk("epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); | 240 | /* |
234 | 241 | snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", | |
242 | substream->pcm->device, channel_id); | ||
243 | */ | ||
235 | runtime->private_data = epcm; | 244 | runtime->private_data = epcm; |
236 | runtime->private_free = snd_p16v_pcm_free_substream; | 245 | runtime->private_free = snd_p16v_pcm_free_substream; |
237 | 246 | ||
@@ -241,10 +250,15 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream | |||
241 | channel->number = channel_id; | 250 | channel->number = channel_id; |
242 | 251 | ||
243 | channel->use=1; | 252 | channel->use=1; |
244 | //snd_printk("p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); | 253 | #if 0 /* debug */ |
245 | //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); | 254 | snd_printk(KERN_DEBUG |
246 | //channel->interrupt = snd_p16v_pcm_channel_interrupt; | 255 | "p16v: open channel_id=%d, channel=%p, use=0x%x\n", |
247 | channel->epcm=epcm; | 256 | channel_id, channel, channel->use); |
257 | printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n", | ||
258 | channel_id, chip, channel); | ||
259 | #endif /* debug */ | ||
260 | /* channel->interrupt = snd_p16v_pcm_channel_interrupt; */ | ||
261 | channel->epcm = epcm; | ||
248 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) | 262 | if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) |
249 | return err; | 263 | return err; |
250 | 264 | ||
@@ -334,9 +348,19 @@ static int snd_p16v_pcm_prepare_playback(struct snd_pcm_substream *substream) | |||
334 | int i; | 348 | int i; |
335 | u32 tmp; | 349 | u32 tmp; |
336 | 350 | ||
337 | //snd_printk("prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, periods=%u, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, runtime->periods, frames_to_bytes(runtime, 1)); | 351 | #if 0 /* debug */ |
338 | //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); | 352 | snd_printk(KERN_DEBUG "prepare:channel_number=%d, rate=%d, " |
339 | //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->p16v_buffer.addr, emu->p16v_buffer.area, emu->p16v_buffer.bytes); | 353 | "format=0x%x, channels=%d, buffer_size=%ld, " |
354 | "period_size=%ld, periods=%u, frames_to_bytes=%d\n", | ||
355 | channel, runtime->rate, runtime->format, runtime->channels, | ||
356 | runtime->buffer_size, runtime->period_size, | ||
357 | runtime->periods, frames_to_bytes(runtime, 1)); | ||
358 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n", | ||
359 | runtime->dma_addr, runtime->dma_area, table_base); | ||
360 | snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n", | ||
361 | emu->p16v_buffer.addr, emu->p16v_buffer.area, | ||
362 | emu->p16v_buffer.bytes); | ||
363 | #endif /* debug */ | ||
340 | tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); | 364 | tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); |
341 | switch (runtime->rate) { | 365 | switch (runtime->rate) { |
342 | case 44100: | 366 | case 44100: |
@@ -379,7 +403,15 @@ static int snd_p16v_pcm_prepare_capture(struct snd_pcm_substream *substream) | |||
379 | struct snd_pcm_runtime *runtime = substream->runtime; | 403 | struct snd_pcm_runtime *runtime = substream->runtime; |
380 | int channel = substream->pcm->device - emu->p16v_device_offset; | 404 | int channel = substream->pcm->device - emu->p16v_device_offset; |
381 | u32 tmp; | 405 | u32 tmp; |
382 | //printk("prepare capture:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size, frames_to_bytes(runtime, 1)); | 406 | |
407 | /* | ||
408 | printk(KERN_DEBUG "prepare capture:channel_number=%d, rate=%d, " | ||
409 | "format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, " | ||
410 | "frames_to_bytes=%d\n", | ||
411 | channel, runtime->rate, runtime->format, runtime->channels, | ||
412 | runtime->buffer_size, runtime->period_size, | ||
413 | frames_to_bytes(runtime, 1)); | ||
414 | */ | ||
383 | tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); | 415 | tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); |
384 | switch (runtime->rate) { | 416 | switch (runtime->rate) { |
385 | case 44100: | 417 | case 44100: |
@@ -459,13 +491,13 @@ static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream, | |||
459 | runtime = s->runtime; | 491 | runtime = s->runtime; |
460 | epcm = runtime->private_data; | 492 | epcm = runtime->private_data; |
461 | channel = substream->pcm->device-emu->p16v_device_offset; | 493 | channel = substream->pcm->device-emu->p16v_device_offset; |
462 | //snd_printk("p16v channel=%d\n",channel); | 494 | /* snd_printk(KERN_DEBUG "p16v channel=%d\n", channel); */ |
463 | epcm->running = running; | 495 | epcm->running = running; |
464 | basic |= (0x1<<channel); | 496 | basic |= (0x1<<channel); |
465 | inte |= (INTE2_PLAYBACK_CH_0_LOOP<<channel); | 497 | inte |= (INTE2_PLAYBACK_CH_0_LOOP<<channel); |
466 | snd_pcm_trigger_done(s, substream); | 498 | snd_pcm_trigger_done(s, substream); |
467 | } | 499 | } |
468 | //snd_printk("basic=0x%x, inte=0x%x\n",basic, inte); | 500 | /* snd_printk(KERN_DEBUG "basic=0x%x, inte=0x%x\n", basic, inte); */ |
469 | 501 | ||
470 | switch (cmd) { | 502 | switch (cmd) { |
471 | case SNDRV_PCM_TRIGGER_START: | 503 | case SNDRV_PCM_TRIGGER_START: |
@@ -558,8 +590,13 @@ snd_p16v_pcm_pointer_capture(struct snd_pcm_substream *substream) | |||
558 | ptr -= runtime->buffer_size; | 590 | ptr -= runtime->buffer_size; |
559 | printk(KERN_WARNING "buffer capture limited!\n"); | 591 | printk(KERN_WARNING "buffer capture limited!\n"); |
560 | } | 592 | } |
561 | //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate); | 593 | /* |
562 | 594 | printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, " | |
595 | "buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", | ||
596 | ptr1, ptr2, ptr, (int)runtime->buffer_size, | ||
597 | (int)runtime->period_size, (int)runtime->frame_bits, | ||
598 | (int)runtime->rate); | ||
599 | */ | ||
563 | return ptr; | 600 | return ptr; |
564 | } | 601 | } |
565 | 602 | ||
@@ -592,7 +629,10 @@ int snd_p16v_free(struct snd_emu10k1 *chip) | |||
592 | // release the data | 629 | // release the data |
593 | if (chip->p16v_buffer.area) { | 630 | if (chip->p16v_buffer.area) { |
594 | snd_dma_free_pages(&chip->p16v_buffer); | 631 | snd_dma_free_pages(&chip->p16v_buffer); |
595 | //snd_printk("period lables free: %p\n", &chip->p16v_buffer); | 632 | /* |
633 | snd_printk(KERN_DEBUG "period lables free: %p\n", | ||
634 | &chip->p16v_buffer); | ||
635 | */ | ||
596 | } | 636 | } |
597 | return 0; | 637 | return 0; |
598 | } | 638 | } |
@@ -604,7 +644,7 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * | |||
604 | int err; | 644 | int err; |
605 | int capture=1; | 645 | int capture=1; |
606 | 646 | ||
607 | //snd_printk("snd_p16v_pcm called. device=%d\n", device); | 647 | /* snd_printk("KERN_DEBUG snd_p16v_pcm called. device=%d\n", device); */ |
608 | emu->p16v_device_offset = device; | 648 | emu->p16v_device_offset = device; |
609 | if (rpcm) | 649 | if (rpcm) |
610 | *rpcm = NULL; | 650 | *rpcm = NULL; |
@@ -631,7 +671,10 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * | |||
631 | snd_dma_pci_data(emu->pci), | 671 | snd_dma_pci_data(emu->pci), |
632 | ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) | 672 | ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) |
633 | return err; | 673 | return err; |
634 | //snd_printk("preallocate playback substream: err=%d\n", err); | 674 | /* |
675 | snd_printk(KERN_DEBUG | ||
676 | "preallocate playback substream: err=%d\n", err); | ||
677 | */ | ||
635 | } | 678 | } |
636 | 679 | ||
637 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; | 680 | for (substream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
@@ -642,7 +685,10 @@ int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm * | |||
642 | snd_dma_pci_data(emu->pci), | 685 | snd_dma_pci_data(emu->pci), |
643 | 65536 - 64, 65536 - 64)) < 0) | 686 | 65536 - 64, 65536 - 64)) < 0) |
644 | return err; | 687 | return err; |
645 | //snd_printk("preallocate capture substream: err=%d\n", err); | 688 | /* |
689 | snd_printk(KERN_DEBUG | ||
690 | "preallocate capture substream: err=%d\n", err); | ||
691 | */ | ||
646 | } | 692 | } |
647 | 693 | ||
648 | if (rpcm) | 694 | if (rpcm) |
diff --git a/sound/pci/emu10k1/voice.c b/sound/pci/emu10k1/voice.c index d7300a1aa262..20b8da250bd0 100644 --- a/sound/pci/emu10k1/voice.c +++ b/sound/pci/emu10k1/voice.c | |||
@@ -53,7 +53,10 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, | |||
53 | *rvoice = NULL; | 53 | *rvoice = NULL; |
54 | first_voice = last_voice = 0; | 54 | first_voice = last_voice = 0; |
55 | for (i = emu->next_free_voice, j = 0; j < NUM_G ; i += number, j += number) { | 55 | for (i = emu->next_free_voice, j = 0; j < NUM_G ; i += number, j += number) { |
56 | // printk("i %d j %d next free %d!\n", i, j, emu->next_free_voice); | 56 | /* |
57 | printk(KERN_DEBUG "i %d j %d next free %d!\n", | ||
58 | i, j, emu->next_free_voice); | ||
59 | */ | ||
57 | i %= NUM_G; | 60 | i %= NUM_G; |
58 | 61 | ||
59 | /* stereo voices must be even/odd */ | 62 | /* stereo voices must be even/odd */ |
@@ -71,7 +74,7 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, | |||
71 | } | 74 | } |
72 | } | 75 | } |
73 | if (!skip) { | 76 | if (!skip) { |
74 | // printk("allocated voice %d\n", i); | 77 | /* printk(KERN_DEBUG "allocated voice %d\n", i); */ |
75 | first_voice = i; | 78 | first_voice = i; |
76 | last_voice = (i + number) % NUM_G; | 79 | last_voice = (i + number) % NUM_G; |
77 | emu->next_free_voice = last_voice; | 80 | emu->next_free_voice = last_voice; |
@@ -84,7 +87,10 @@ static int voice_alloc(struct snd_emu10k1 *emu, int type, int number, | |||
84 | 87 | ||
85 | for (i = 0; i < number; i++) { | 88 | for (i = 0; i < number; i++) { |
86 | voice = &emu->voices[(first_voice + i) % NUM_G]; | 89 | voice = &emu->voices[(first_voice + i) % NUM_G]; |
87 | // printk("voice alloc - %i, %i of %i\n", voice->number, idx-first_voice+1, number); | 90 | /* |
91 | printk(kERN_DEBUG "voice alloc - %i, %i of %i\n", | ||
92 | voice->number, idx-first_voice+1, number); | ||
93 | */ | ||
88 | voice->use = 1; | 94 | voice->use = 1; |
89 | switch (type) { | 95 | switch (type) { |
90 | case EMU10K1_PCM: | 96 | case EMU10K1_PCM: |
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 9bf95367c882..18f4d1e98c46 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -584,7 +584,8 @@ static void snd_es1370_codec_write(struct snd_ak4531 *ak4531, | |||
584 | unsigned long end_time = jiffies + HZ / 10; | 584 | unsigned long end_time = jiffies + HZ / 10; |
585 | 585 | ||
586 | #if 0 | 586 | #if 0 |
587 | printk("CODEC WRITE: reg = 0x%x, val = 0x%x (0x%x), creg = 0x%x\n", | 587 | printk(KERN_DEBUG |
588 | "CODEC WRITE: reg = 0x%x, val = 0x%x (0x%x), creg = 0x%x\n", | ||
588 | reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); | 589 | reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); |
589 | #endif | 590 | #endif |
590 | do { | 591 | do { |
@@ -2409,9 +2410,9 @@ static int __devinit snd_audiopci_probe(struct pci_dev *pci, | |||
2409 | return -ENOENT; | 2410 | return -ENOENT; |
2410 | } | 2411 | } |
2411 | 2412 | ||
2412 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2413 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2413 | if (card == NULL) | 2414 | if (err < 0) |
2414 | return -ENOMEM; | 2415 | return err; |
2415 | 2416 | ||
2416 | if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) { | 2417 | if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) { |
2417 | snd_card_free(card); | 2418 | snd_card_free(card); |
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c index 4cd9a1faaecc..dd63b132fb8e 100644 --- a/sound/pci/es1938.c +++ b/sound/pci/es1938.c | |||
@@ -1673,18 +1673,22 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id) | |||
1673 | 1673 | ||
1674 | status = inb(SLIO_REG(chip, IRQCONTROL)); | 1674 | status = inb(SLIO_REG(chip, IRQCONTROL)); |
1675 | #if 0 | 1675 | #if 0 |
1676 | printk("Es1938debug - interrupt status: =0x%x\n", status); | 1676 | printk(KERN_DEBUG "Es1938debug - interrupt status: =0x%x\n", status); |
1677 | #endif | 1677 | #endif |
1678 | 1678 | ||
1679 | /* AUDIO 1 */ | 1679 | /* AUDIO 1 */ |
1680 | if (status & 0x10) { | 1680 | if (status & 0x10) { |
1681 | #if 0 | 1681 | #if 0 |
1682 | printk("Es1938debug - AUDIO channel 1 interrupt\n"); | 1682 | printk(KERN_DEBUG |
1683 | printk("Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", | 1683 | "Es1938debug - AUDIO channel 1 interrupt\n"); |
1684 | printk(KERN_DEBUG | ||
1685 | "Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", | ||
1684 | inw(SLDM_REG(chip, DMACOUNT))); | 1686 | inw(SLDM_REG(chip, DMACOUNT))); |
1685 | printk("Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n", | 1687 | printk(KERN_DEBUG |
1688 | "Es1938debug - AUDIO channel 1 DMAC DMA base: %u\n", | ||
1686 | inl(SLDM_REG(chip, DMAADDR))); | 1689 | inl(SLDM_REG(chip, DMAADDR))); |
1687 | printk("Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n", | 1690 | printk(KERN_DEBUG |
1691 | "Es1938debug - AUDIO channel 1 DMAC DMA status: 0x%x\n", | ||
1688 | inl(SLDM_REG(chip, DMASTATUS))); | 1692 | inl(SLDM_REG(chip, DMASTATUS))); |
1689 | #endif | 1693 | #endif |
1690 | /* clear irq */ | 1694 | /* clear irq */ |
@@ -1699,10 +1703,13 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id) | |||
1699 | /* AUDIO 2 */ | 1703 | /* AUDIO 2 */ |
1700 | if (status & 0x20) { | 1704 | if (status & 0x20) { |
1701 | #if 0 | 1705 | #if 0 |
1702 | printk("Es1938debug - AUDIO channel 2 interrupt\n"); | 1706 | printk(KERN_DEBUG |
1703 | printk("Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", | 1707 | "Es1938debug - AUDIO channel 2 interrupt\n"); |
1708 | printk(KERN_DEBUG | ||
1709 | "Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", | ||
1704 | inw(SLIO_REG(chip, AUDIO2DMACOUNT))); | 1710 | inw(SLIO_REG(chip, AUDIO2DMACOUNT))); |
1705 | printk("Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n", | 1711 | printk(KERN_DEBUG |
1712 | "Es1938debug - AUDIO channel 2 DMAC DMA base: %u\n", | ||
1706 | inl(SLIO_REG(chip, AUDIO2DMAADDR))); | 1713 | inl(SLIO_REG(chip, AUDIO2DMAADDR))); |
1707 | 1714 | ||
1708 | #endif | 1715 | #endif |
@@ -1799,9 +1806,9 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci, | |||
1799 | return -ENOENT; | 1806 | return -ENOENT; |
1800 | } | 1807 | } |
1801 | 1808 | ||
1802 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1809 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1803 | if (card == NULL) | 1810 | if (err < 0) |
1804 | return -ENOMEM; | 1811 | return err; |
1805 | for (idx = 0; idx < 5; idx++) { | 1812 | for (idx = 0; idx < 5; idx++) { |
1806 | if (pci_resource_start(pci, idx) == 0 || | 1813 | if (pci_resource_start(pci, idx) == 0 || |
1807 | !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { | 1814 | !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { |
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c index e9c3794bbcb8..dc97e8116141 100644 --- a/sound/pci/es1968.c +++ b/sound/pci/es1968.c | |||
@@ -2645,9 +2645,9 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci, | |||
2645 | return -ENOENT; | 2645 | return -ENOENT; |
2646 | } | 2646 | } |
2647 | 2647 | ||
2648 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2648 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2649 | if (!card) | 2649 | if (err < 0) |
2650 | return -ENOMEM; | 2650 | return err; |
2651 | 2651 | ||
2652 | if (total_bufsize[dev] < 128) | 2652 | if (total_bufsize[dev] < 128) |
2653 | total_bufsize[dev] = 128; | 2653 | total_bufsize[dev] = 128; |
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c index c129f9e2072c..60cdb9e0b68d 100644 --- a/sound/pci/fm801.c +++ b/sound/pci/fm801.c | |||
@@ -1468,9 +1468,9 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci, | |||
1468 | return -ENOENT; | 1468 | return -ENOENT; |
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1471 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1472 | if (card == NULL) | 1472 | if (err < 0) |
1473 | return -ENOMEM; | 1473 | return err; |
1474 | if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], &chip)) < 0) { | 1474 | if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], &chip)) < 0) { |
1475 | snd_card_free(card); | 1475 | snd_card_free(card); |
1476 | return err; | 1476 | return err; |
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c index 960fd7970384..4de5bacd3929 100644 --- a/sound/pci/hda/hda_beep.c +++ b/sound/pci/hda/hda_beep.c | |||
@@ -138,6 +138,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec) | |||
138 | 138 | ||
139 | input_unregister_device(beep->dev); | 139 | input_unregister_device(beep->dev); |
140 | kfree(beep); | 140 | kfree(beep); |
141 | codec->beep = NULL; | ||
141 | } | 142 | } |
142 | } | 143 | } |
143 | EXPORT_SYMBOL_HDA(snd_hda_detach_beep_device); | 144 | EXPORT_SYMBOL_HDA(snd_hda_detach_beep_device); |
diff --git a/sound/pci/hda/hda_beep.h b/sound/pci/hda/hda_beep.h index b9679f081cae..51bf6a5daf39 100644 --- a/sound/pci/hda/hda_beep.h +++ b/sound/pci/hda/hda_beep.h | |||
@@ -39,7 +39,7 @@ struct hda_beep { | |||
39 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid); | 39 | int snd_hda_attach_beep_device(struct hda_codec *codec, int nid); |
40 | void snd_hda_detach_beep_device(struct hda_codec *codec); | 40 | void snd_hda_detach_beep_device(struct hda_codec *codec); |
41 | #else | 41 | #else |
42 | #define snd_hda_attach_beep_device(...) | 42 | #define snd_hda_attach_beep_device(...) 0 |
43 | #define snd_hda_detach_beep_device(...) | 43 | #define snd_hda_detach_beep_device(...) |
44 | #endif | 44 | #endif |
45 | #endif | 45 | #endif |
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index d03f99298be9..a4e5e5952115 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -647,9 +647,9 @@ static void /*__devinit*/ setup_fg_nodes(struct hda_codec *codec) | |||
647 | 647 | ||
648 | total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); | 648 | total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); |
649 | for (i = 0; i < total_nodes; i++, nid++) { | 649 | for (i = 0; i < total_nodes; i++, nid++) { |
650 | unsigned int func; | 650 | codec->function_id = snd_hda_param_read(codec, nid, |
651 | func = snd_hda_param_read(codec, nid, AC_PAR_FUNCTION_TYPE); | 651 | AC_PAR_FUNCTION_TYPE) & 0xff; |
652 | switch (func & 0xff) { | 652 | switch (codec->function_id) { |
653 | case AC_GRP_AUDIO_FUNCTION: | 653 | case AC_GRP_AUDIO_FUNCTION: |
654 | codec->afg = nid; | 654 | codec->afg = nid; |
655 | break; | 655 | break; |
@@ -682,11 +682,140 @@ static int read_widget_caps(struct hda_codec *codec, hda_nid_t fg_node) | |||
682 | return 0; | 682 | return 0; |
683 | } | 683 | } |
684 | 684 | ||
685 | /* read all pin default configurations and save codec->init_pins */ | ||
686 | static int read_pin_defaults(struct hda_codec *codec) | ||
687 | { | ||
688 | int i; | ||
689 | hda_nid_t nid = codec->start_nid; | ||
690 | |||
691 | for (i = 0; i < codec->num_nodes; i++, nid++) { | ||
692 | struct hda_pincfg *pin; | ||
693 | unsigned int wcaps = get_wcaps(codec, nid); | ||
694 | unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >> | ||
695 | AC_WCAP_TYPE_SHIFT; | ||
696 | if (wid_type != AC_WID_PIN) | ||
697 | continue; | ||
698 | pin = snd_array_new(&codec->init_pins); | ||
699 | if (!pin) | ||
700 | return -ENOMEM; | ||
701 | pin->nid = nid; | ||
702 | pin->cfg = snd_hda_codec_read(codec, nid, 0, | ||
703 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
704 | } | ||
705 | return 0; | ||
706 | } | ||
707 | |||
708 | /* look up the given pin config list and return the item matching with NID */ | ||
709 | static struct hda_pincfg *look_up_pincfg(struct hda_codec *codec, | ||
710 | struct snd_array *array, | ||
711 | hda_nid_t nid) | ||
712 | { | ||
713 | int i; | ||
714 | for (i = 0; i < array->used; i++) { | ||
715 | struct hda_pincfg *pin = snd_array_elem(array, i); | ||
716 | if (pin->nid == nid) | ||
717 | return pin; | ||
718 | } | ||
719 | return NULL; | ||
720 | } | ||
721 | |||
722 | /* write a config value for the given NID */ | ||
723 | static void set_pincfg(struct hda_codec *codec, hda_nid_t nid, | ||
724 | unsigned int cfg) | ||
725 | { | ||
726 | int i; | ||
727 | for (i = 0; i < 4; i++) { | ||
728 | snd_hda_codec_write(codec, nid, 0, | ||
729 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, | ||
730 | cfg & 0xff); | ||
731 | cfg >>= 8; | ||
732 | } | ||
733 | } | ||
734 | |||
735 | /* set the current pin config value for the given NID. | ||
736 | * the value is cached, and read via snd_hda_codec_get_pincfg() | ||
737 | */ | ||
738 | int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, | ||
739 | hda_nid_t nid, unsigned int cfg) | ||
740 | { | ||
741 | struct hda_pincfg *pin; | ||
742 | unsigned int oldcfg; | ||
743 | |||
744 | oldcfg = snd_hda_codec_get_pincfg(codec, nid); | ||
745 | pin = look_up_pincfg(codec, list, nid); | ||
746 | if (!pin) { | ||
747 | pin = snd_array_new(list); | ||
748 | if (!pin) | ||
749 | return -ENOMEM; | ||
750 | pin->nid = nid; | ||
751 | } | ||
752 | pin->cfg = cfg; | ||
753 | |||
754 | /* change only when needed; e.g. if the pincfg is already present | ||
755 | * in user_pins[], don't write it | ||
756 | */ | ||
757 | cfg = snd_hda_codec_get_pincfg(codec, nid); | ||
758 | if (oldcfg != cfg) | ||
759 | set_pincfg(codec, nid, cfg); | ||
760 | return 0; | ||
761 | } | ||
762 | |||
763 | int snd_hda_codec_set_pincfg(struct hda_codec *codec, | ||
764 | hda_nid_t nid, unsigned int cfg) | ||
765 | { | ||
766 | return snd_hda_add_pincfg(codec, &codec->driver_pins, nid, cfg); | ||
767 | } | ||
768 | EXPORT_SYMBOL_HDA(snd_hda_codec_set_pincfg); | ||
769 | |||
770 | /* get the current pin config value of the given pin NID */ | ||
771 | unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) | ||
772 | { | ||
773 | struct hda_pincfg *pin; | ||
774 | |||
775 | #ifdef CONFIG_SND_HDA_HWDEP | ||
776 | pin = look_up_pincfg(codec, &codec->user_pins, nid); | ||
777 | if (pin) | ||
778 | return pin->cfg; | ||
779 | #endif | ||
780 | pin = look_up_pincfg(codec, &codec->driver_pins, nid); | ||
781 | if (pin) | ||
782 | return pin->cfg; | ||
783 | pin = look_up_pincfg(codec, &codec->init_pins, nid); | ||
784 | if (pin) | ||
785 | return pin->cfg; | ||
786 | return 0; | ||
787 | } | ||
788 | EXPORT_SYMBOL_HDA(snd_hda_codec_get_pincfg); | ||
789 | |||
790 | /* restore all current pin configs */ | ||
791 | static void restore_pincfgs(struct hda_codec *codec) | ||
792 | { | ||
793 | int i; | ||
794 | for (i = 0; i < codec->init_pins.used; i++) { | ||
795 | struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); | ||
796 | set_pincfg(codec, pin->nid, | ||
797 | snd_hda_codec_get_pincfg(codec, pin->nid)); | ||
798 | } | ||
799 | } | ||
685 | 800 | ||
686 | static void init_hda_cache(struct hda_cache_rec *cache, | 801 | static void init_hda_cache(struct hda_cache_rec *cache, |
687 | unsigned int record_size); | 802 | unsigned int record_size); |
688 | static void free_hda_cache(struct hda_cache_rec *cache); | 803 | static void free_hda_cache(struct hda_cache_rec *cache); |
689 | 804 | ||
805 | /* restore the initial pin cfgs and release all pincfg lists */ | ||
806 | static void restore_init_pincfgs(struct hda_codec *codec) | ||
807 | { | ||
808 | /* first free driver_pins and user_pins, then call restore_pincfg | ||
809 | * so that only the values in init_pins are restored | ||
810 | */ | ||
811 | snd_array_free(&codec->driver_pins); | ||
812 | #ifdef CONFIG_SND_HDA_HWDEP | ||
813 | snd_array_free(&codec->user_pins); | ||
814 | #endif | ||
815 | restore_pincfgs(codec); | ||
816 | snd_array_free(&codec->init_pins); | ||
817 | } | ||
818 | |||
690 | /* | 819 | /* |
691 | * codec destructor | 820 | * codec destructor |
692 | */ | 821 | */ |
@@ -694,6 +823,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
694 | { | 823 | { |
695 | if (!codec) | 824 | if (!codec) |
696 | return; | 825 | return; |
826 | restore_init_pincfgs(codec); | ||
697 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 827 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
698 | cancel_delayed_work(&codec->power_work); | 828 | cancel_delayed_work(&codec->power_work); |
699 | flush_workqueue(codec->bus->workq); | 829 | flush_workqueue(codec->bus->workq); |
@@ -712,6 +842,9 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
712 | kfree(codec); | 842 | kfree(codec); |
713 | } | 843 | } |
714 | 844 | ||
845 | static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | ||
846 | unsigned int power_state); | ||
847 | |||
715 | /** | 848 | /** |
716 | * snd_hda_codec_new - create a HDA codec | 849 | * snd_hda_codec_new - create a HDA codec |
717 | * @bus: the bus to assign | 850 | * @bus: the bus to assign |
@@ -751,6 +884,8 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
751 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); | 884 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); |
752 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); | 885 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); |
753 | snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); | 886 | snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); |
887 | snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); | ||
888 | snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); | ||
754 | if (codec->bus->modelname) { | 889 | if (codec->bus->modelname) { |
755 | codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL); | 890 | codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL); |
756 | if (!codec->modelname) { | 891 | if (!codec->modelname) { |
@@ -787,15 +922,18 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
787 | setup_fg_nodes(codec); | 922 | setup_fg_nodes(codec); |
788 | if (!codec->afg && !codec->mfg) { | 923 | if (!codec->afg && !codec->mfg) { |
789 | snd_printdd("hda_codec: no AFG or MFG node found\n"); | 924 | snd_printdd("hda_codec: no AFG or MFG node found\n"); |
790 | snd_hda_codec_free(codec); | 925 | err = -ENODEV; |
791 | return -ENODEV; | 926 | goto error; |
792 | } | 927 | } |
793 | 928 | ||
794 | if (read_widget_caps(codec, codec->afg ? codec->afg : codec->mfg) < 0) { | 929 | err = read_widget_caps(codec, codec->afg ? codec->afg : codec->mfg); |
930 | if (err < 0) { | ||
795 | snd_printk(KERN_ERR "hda_codec: cannot malloc\n"); | 931 | snd_printk(KERN_ERR "hda_codec: cannot malloc\n"); |
796 | snd_hda_codec_free(codec); | 932 | goto error; |
797 | return -ENOMEM; | ||
798 | } | 933 | } |
934 | err = read_pin_defaults(codec); | ||
935 | if (err < 0) | ||
936 | goto error; | ||
799 | 937 | ||
800 | if (!codec->subsystem_id) { | 938 | if (!codec->subsystem_id) { |
801 | hda_nid_t nid = codec->afg ? codec->afg : codec->mfg; | 939 | hda_nid_t nid = codec->afg ? codec->afg : codec->mfg; |
@@ -806,12 +944,15 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
806 | if (bus->modelname) | 944 | if (bus->modelname) |
807 | codec->modelname = kstrdup(bus->modelname, GFP_KERNEL); | 945 | codec->modelname = kstrdup(bus->modelname, GFP_KERNEL); |
808 | 946 | ||
947 | /* power-up all before initialization */ | ||
948 | hda_set_power_state(codec, | ||
949 | codec->afg ? codec->afg : codec->mfg, | ||
950 | AC_PWRST_D0); | ||
951 | |||
809 | if (do_init) { | 952 | if (do_init) { |
810 | err = snd_hda_codec_configure(codec); | 953 | err = snd_hda_codec_configure(codec); |
811 | if (err < 0) { | 954 | if (err < 0) |
812 | snd_hda_codec_free(codec); | 955 | goto error; |
813 | return err; | ||
814 | } | ||
815 | } | 956 | } |
816 | snd_hda_codec_proc_new(codec); | 957 | snd_hda_codec_proc_new(codec); |
817 | 958 | ||
@@ -824,6 +965,10 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr | |||
824 | if (codecp) | 965 | if (codecp) |
825 | *codecp = codec; | 966 | *codecp = codec; |
826 | return 0; | 967 | return 0; |
968 | |||
969 | error: | ||
970 | snd_hda_codec_free(codec); | ||
971 | return err; | ||
827 | } | 972 | } |
828 | EXPORT_SYMBOL_HDA(snd_hda_codec_new); | 973 | EXPORT_SYMBOL_HDA(snd_hda_codec_new); |
829 | 974 | ||
@@ -907,6 +1052,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); | |||
907 | 1052 | ||
908 | /* FIXME: more better hash key? */ | 1053 | /* FIXME: more better hash key? */ |
909 | #define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) | 1054 | #define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) |
1055 | #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) | ||
910 | #define INFO_AMP_CAPS (1<<0) | 1056 | #define INFO_AMP_CAPS (1<<0) |
911 | #define INFO_AMP_VOL(ch) (1 << (1 + (ch))) | 1057 | #define INFO_AMP_VOL(ch) (1 << (1 + (ch))) |
912 | 1058 | ||
@@ -997,6 +1143,21 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | |||
997 | } | 1143 | } |
998 | EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps); | 1144 | EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps); |
999 | 1145 | ||
1146 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid) | ||
1147 | { | ||
1148 | struct hda_amp_info *info; | ||
1149 | |||
1150 | info = get_alloc_amp_hash(codec, HDA_HASH_PINCAP_KEY(nid)); | ||
1151 | if (!info) | ||
1152 | return 0; | ||
1153 | if (!info->head.val) { | ||
1154 | info->amp_caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
1155 | info->head.val |= INFO_AMP_CAPS; | ||
1156 | } | ||
1157 | return info->amp_caps; | ||
1158 | } | ||
1159 | EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps); | ||
1160 | |||
1000 | /* | 1161 | /* |
1001 | * read the current volume to info | 1162 | * read the current volume to info |
1002 | * if the cache exists, read the cache value. | 1163 | * if the cache exists, read the cache value. |
@@ -1120,6 +1281,7 @@ int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, | |||
1120 | u16 nid = get_amp_nid(kcontrol); | 1281 | u16 nid = get_amp_nid(kcontrol); |
1121 | u8 chs = get_amp_channels(kcontrol); | 1282 | u8 chs = get_amp_channels(kcontrol); |
1122 | int dir = get_amp_direction(kcontrol); | 1283 | int dir = get_amp_direction(kcontrol); |
1284 | unsigned int ofs = get_amp_offset(kcontrol); | ||
1123 | u32 caps; | 1285 | u32 caps; |
1124 | 1286 | ||
1125 | caps = query_amp_caps(codec, nid, dir); | 1287 | caps = query_amp_caps(codec, nid, dir); |
@@ -1131,6 +1293,8 @@ int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, | |||
1131 | kcontrol->id.name); | 1293 | kcontrol->id.name); |
1132 | return -EINVAL; | 1294 | return -EINVAL; |
1133 | } | 1295 | } |
1296 | if (ofs < caps) | ||
1297 | caps -= ofs; | ||
1134 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | 1298 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
1135 | uinfo->count = chs == 3 ? 2 : 1; | 1299 | uinfo->count = chs == 3 ? 2 : 1; |
1136 | uinfo->value.integer.min = 0; | 1300 | uinfo->value.integer.min = 0; |
@@ -1139,6 +1303,32 @@ int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, | |||
1139 | } | 1303 | } |
1140 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_info); | 1304 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_info); |
1141 | 1305 | ||
1306 | |||
1307 | static inline unsigned int | ||
1308 | read_amp_value(struct hda_codec *codec, hda_nid_t nid, | ||
1309 | int ch, int dir, int idx, unsigned int ofs) | ||
1310 | { | ||
1311 | unsigned int val; | ||
1312 | val = snd_hda_codec_amp_read(codec, nid, ch, dir, idx); | ||
1313 | val &= HDA_AMP_VOLMASK; | ||
1314 | if (val >= ofs) | ||
1315 | val -= ofs; | ||
1316 | else | ||
1317 | val = 0; | ||
1318 | return val; | ||
1319 | } | ||
1320 | |||
1321 | static inline int | ||
1322 | update_amp_value(struct hda_codec *codec, hda_nid_t nid, | ||
1323 | int ch, int dir, int idx, unsigned int ofs, | ||
1324 | unsigned int val) | ||
1325 | { | ||
1326 | if (val > 0) | ||
1327 | val += ofs; | ||
1328 | return snd_hda_codec_amp_update(codec, nid, ch, dir, idx, | ||
1329 | HDA_AMP_VOLMASK, val); | ||
1330 | } | ||
1331 | |||
1142 | int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, | 1332 | int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, |
1143 | struct snd_ctl_elem_value *ucontrol) | 1333 | struct snd_ctl_elem_value *ucontrol) |
1144 | { | 1334 | { |
@@ -1147,14 +1337,13 @@ int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, | |||
1147 | int chs = get_amp_channels(kcontrol); | 1337 | int chs = get_amp_channels(kcontrol); |
1148 | int dir = get_amp_direction(kcontrol); | 1338 | int dir = get_amp_direction(kcontrol); |
1149 | int idx = get_amp_index(kcontrol); | 1339 | int idx = get_amp_index(kcontrol); |
1340 | unsigned int ofs = get_amp_offset(kcontrol); | ||
1150 | long *valp = ucontrol->value.integer.value; | 1341 | long *valp = ucontrol->value.integer.value; |
1151 | 1342 | ||
1152 | if (chs & 1) | 1343 | if (chs & 1) |
1153 | *valp++ = snd_hda_codec_amp_read(codec, nid, 0, dir, idx) | 1344 | *valp++ = read_amp_value(codec, nid, 0, dir, idx, ofs); |
1154 | & HDA_AMP_VOLMASK; | ||
1155 | if (chs & 2) | 1345 | if (chs & 2) |
1156 | *valp = snd_hda_codec_amp_read(codec, nid, 1, dir, idx) | 1346 | *valp = read_amp_value(codec, nid, 1, dir, idx, ofs); |
1157 | & HDA_AMP_VOLMASK; | ||
1158 | return 0; | 1347 | return 0; |
1159 | } | 1348 | } |
1160 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_get); | 1349 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_get); |
@@ -1167,18 +1356,17 @@ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, | |||
1167 | int chs = get_amp_channels(kcontrol); | 1356 | int chs = get_amp_channels(kcontrol); |
1168 | int dir = get_amp_direction(kcontrol); | 1357 | int dir = get_amp_direction(kcontrol); |
1169 | int idx = get_amp_index(kcontrol); | 1358 | int idx = get_amp_index(kcontrol); |
1359 | unsigned int ofs = get_amp_offset(kcontrol); | ||
1170 | long *valp = ucontrol->value.integer.value; | 1360 | long *valp = ucontrol->value.integer.value; |
1171 | int change = 0; | 1361 | int change = 0; |
1172 | 1362 | ||
1173 | snd_hda_power_up(codec); | 1363 | snd_hda_power_up(codec); |
1174 | if (chs & 1) { | 1364 | if (chs & 1) { |
1175 | change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, | 1365 | change = update_amp_value(codec, nid, 0, dir, idx, ofs, *valp); |
1176 | 0x7f, *valp); | ||
1177 | valp++; | 1366 | valp++; |
1178 | } | 1367 | } |
1179 | if (chs & 2) | 1368 | if (chs & 2) |
1180 | change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, | 1369 | change |= update_amp_value(codec, nid, 1, dir, idx, ofs, *valp); |
1181 | 0x7f, *valp); | ||
1182 | snd_hda_power_down(codec); | 1370 | snd_hda_power_down(codec); |
1183 | return change; | 1371 | return change; |
1184 | } | 1372 | } |
@@ -1190,6 +1378,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |||
1190 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 1378 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
1191 | hda_nid_t nid = get_amp_nid(kcontrol); | 1379 | hda_nid_t nid = get_amp_nid(kcontrol); |
1192 | int dir = get_amp_direction(kcontrol); | 1380 | int dir = get_amp_direction(kcontrol); |
1381 | unsigned int ofs = get_amp_offset(kcontrol); | ||
1193 | u32 caps, val1, val2; | 1382 | u32 caps, val1, val2; |
1194 | 1383 | ||
1195 | if (size < 4 * sizeof(unsigned int)) | 1384 | if (size < 4 * sizeof(unsigned int)) |
@@ -1198,6 +1387,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |||
1198 | val2 = (caps & AC_AMPCAP_STEP_SIZE) >> AC_AMPCAP_STEP_SIZE_SHIFT; | 1387 | val2 = (caps & AC_AMPCAP_STEP_SIZE) >> AC_AMPCAP_STEP_SIZE_SHIFT; |
1199 | val2 = (val2 + 1) * 25; | 1388 | val2 = (val2 + 1) * 25; |
1200 | val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT); | 1389 | val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT); |
1390 | val1 += ofs; | ||
1201 | val1 = ((int)val1) * ((int)val2); | 1391 | val1 = ((int)val1) * ((int)val2); |
1202 | if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv)) | 1392 | if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv)) |
1203 | return -EFAULT; | 1393 | return -EFAULT; |
@@ -1268,7 +1458,6 @@ int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl) | |||
1268 | } | 1458 | } |
1269 | EXPORT_SYMBOL_HDA(snd_hda_ctl_add); | 1459 | EXPORT_SYMBOL_HDA(snd_hda_ctl_add); |
1270 | 1460 | ||
1271 | #ifdef CONFIG_SND_HDA_RECONFIG | ||
1272 | /* Clear all controls assigned to the given codec */ | 1461 | /* Clear all controls assigned to the given codec */ |
1273 | void snd_hda_ctls_clear(struct hda_codec *codec) | 1462 | void snd_hda_ctls_clear(struct hda_codec *codec) |
1274 | { | 1463 | { |
@@ -1279,9 +1468,52 @@ void snd_hda_ctls_clear(struct hda_codec *codec) | |||
1279 | snd_array_free(&codec->mixers); | 1468 | snd_array_free(&codec->mixers); |
1280 | } | 1469 | } |
1281 | 1470 | ||
1282 | void snd_hda_codec_reset(struct hda_codec *codec) | 1471 | /* pseudo device locking |
1472 | * toggle card->shutdown to allow/disallow the device access (as a hack) | ||
1473 | */ | ||
1474 | static int hda_lock_devices(struct snd_card *card) | ||
1283 | { | 1475 | { |
1284 | int i; | 1476 | spin_lock(&card->files_lock); |
1477 | if (card->shutdown) { | ||
1478 | spin_unlock(&card->files_lock); | ||
1479 | return -EINVAL; | ||
1480 | } | ||
1481 | card->shutdown = 1; | ||
1482 | spin_unlock(&card->files_lock); | ||
1483 | return 0; | ||
1484 | } | ||
1485 | |||
1486 | static void hda_unlock_devices(struct snd_card *card) | ||
1487 | { | ||
1488 | spin_lock(&card->files_lock); | ||
1489 | card->shutdown = 0; | ||
1490 | spin_unlock(&card->files_lock); | ||
1491 | } | ||
1492 | |||
1493 | int snd_hda_codec_reset(struct hda_codec *codec) | ||
1494 | { | ||
1495 | struct snd_card *card = codec->bus->card; | ||
1496 | int i, pcm; | ||
1497 | |||
1498 | if (hda_lock_devices(card) < 0) | ||
1499 | return -EBUSY; | ||
1500 | /* check whether the codec isn't used by any mixer or PCM streams */ | ||
1501 | if (!list_empty(&card->ctl_files)) { | ||
1502 | hda_unlock_devices(card); | ||
1503 | return -EBUSY; | ||
1504 | } | ||
1505 | for (pcm = 0; pcm < codec->num_pcms; pcm++) { | ||
1506 | struct hda_pcm *cpcm = &codec->pcm_info[pcm]; | ||
1507 | if (!cpcm->pcm) | ||
1508 | continue; | ||
1509 | if (cpcm->pcm->streams[0].substream_opened || | ||
1510 | cpcm->pcm->streams[1].substream_opened) { | ||
1511 | hda_unlock_devices(card); | ||
1512 | return -EBUSY; | ||
1513 | } | ||
1514 | } | ||
1515 | |||
1516 | /* OK, let it free */ | ||
1285 | 1517 | ||
1286 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 1518 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
1287 | cancel_delayed_work(&codec->power_work); | 1519 | cancel_delayed_work(&codec->power_work); |
@@ -1291,8 +1523,7 @@ void snd_hda_codec_reset(struct hda_codec *codec) | |||
1291 | /* relase PCMs */ | 1523 | /* relase PCMs */ |
1292 | for (i = 0; i < codec->num_pcms; i++) { | 1524 | for (i = 0; i < codec->num_pcms; i++) { |
1293 | if (codec->pcm_info[i].pcm) { | 1525 | if (codec->pcm_info[i].pcm) { |
1294 | snd_device_free(codec->bus->card, | 1526 | snd_device_free(card, codec->pcm_info[i].pcm); |
1295 | codec->pcm_info[i].pcm); | ||
1296 | clear_bit(codec->pcm_info[i].device, | 1527 | clear_bit(codec->pcm_info[i].device, |
1297 | codec->bus->pcm_dev_bits); | 1528 | codec->bus->pcm_dev_bits); |
1298 | } | 1529 | } |
@@ -1305,13 +1536,22 @@ void snd_hda_codec_reset(struct hda_codec *codec) | |||
1305 | free_hda_cache(&codec->cmd_cache); | 1536 | free_hda_cache(&codec->cmd_cache); |
1306 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); | 1537 | init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); |
1307 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); | 1538 | init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); |
1539 | /* free only driver_pins so that init_pins + user_pins are restored */ | ||
1540 | snd_array_free(&codec->driver_pins); | ||
1541 | restore_pincfgs(codec); | ||
1308 | codec->num_pcms = 0; | 1542 | codec->num_pcms = 0; |
1309 | codec->pcm_info = NULL; | 1543 | codec->pcm_info = NULL; |
1310 | codec->preset = NULL; | 1544 | codec->preset = NULL; |
1545 | memset(&codec->patch_ops, 0, sizeof(codec->patch_ops)); | ||
1546 | codec->slave_dig_outs = NULL; | ||
1547 | codec->spdif_status_reset = 0; | ||
1311 | module_put(codec->owner); | 1548 | module_put(codec->owner); |
1312 | codec->owner = NULL; | 1549 | codec->owner = NULL; |
1550 | |||
1551 | /* allow device access again */ | ||
1552 | hda_unlock_devices(card); | ||
1553 | return 0; | ||
1313 | } | 1554 | } |
1314 | #endif /* CONFIG_SND_HDA_RECONFIG */ | ||
1315 | 1555 | ||
1316 | /* create a virtual master control and add slaves */ | 1556 | /* create a virtual master control and add slaves */ |
1317 | int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | 1557 | int snd_hda_add_vmaster(struct hda_codec *codec, char *name, |
@@ -1336,15 +1576,20 @@ int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
1336 | 1576 | ||
1337 | for (s = slaves; *s; s++) { | 1577 | for (s = slaves; *s; s++) { |
1338 | struct snd_kcontrol *sctl; | 1578 | struct snd_kcontrol *sctl; |
1339 | 1579 | int i = 0; | |
1340 | sctl = snd_hda_find_mixer_ctl(codec, *s); | 1580 | for (;;) { |
1341 | if (!sctl) { | 1581 | sctl = _snd_hda_find_mixer_ctl(codec, *s, i); |
1342 | snd_printdd("Cannot find slave %s, skipped\n", *s); | 1582 | if (!sctl) { |
1343 | continue; | 1583 | if (!i) |
1584 | snd_printdd("Cannot find slave %s, " | ||
1585 | "skipped\n", *s); | ||
1586 | break; | ||
1587 | } | ||
1588 | err = snd_ctl_add_slave(kctl, sctl); | ||
1589 | if (err < 0) | ||
1590 | return err; | ||
1591 | i++; | ||
1344 | } | 1592 | } |
1345 | err = snd_ctl_add_slave(kctl, sctl); | ||
1346 | if (err < 0) | ||
1347 | return err; | ||
1348 | } | 1593 | } |
1349 | return 0; | 1594 | return 0; |
1350 | } | 1595 | } |
@@ -1955,6 +2200,8 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
1955 | } | 2200 | } |
1956 | for (dig_mix = dig_in_ctls; dig_mix->name; dig_mix++) { | 2201 | for (dig_mix = dig_in_ctls; dig_mix->name; dig_mix++) { |
1957 | kctl = snd_ctl_new1(dig_mix, codec); | 2202 | kctl = snd_ctl_new1(dig_mix, codec); |
2203 | if (!kctl) | ||
2204 | return -ENOMEM; | ||
1958 | kctl->private_value = nid; | 2205 | kctl->private_value = nid; |
1959 | err = snd_hda_ctl_add(codec, kctl); | 2206 | err = snd_hda_ctl_add(codec, kctl); |
1960 | if (err < 0) | 2207 | if (err < 0) |
@@ -2074,8 +2321,7 @@ static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, | |||
2074 | * don't power down the widget if it controls | 2321 | * don't power down the widget if it controls |
2075 | * eapd and EAPD_BTLENABLE is set. | 2322 | * eapd and EAPD_BTLENABLE is set. |
2076 | */ | 2323 | */ |
2077 | pincap = snd_hda_param_read(codec, nid, | 2324 | pincap = snd_hda_query_pin_caps(codec, nid); |
2078 | AC_PAR_PIN_CAP); | ||
2079 | if (pincap & AC_PINCAP_EAPD) { | 2325 | if (pincap & AC_PINCAP_EAPD) { |
2080 | int eapd = snd_hda_codec_read(codec, | 2326 | int eapd = snd_hda_codec_read(codec, |
2081 | nid, 0, | 2327 | nid, 0, |
@@ -2144,6 +2390,7 @@ static void hda_call_codec_resume(struct hda_codec *codec) | |||
2144 | hda_set_power_state(codec, | 2390 | hda_set_power_state(codec, |
2145 | codec->afg ? codec->afg : codec->mfg, | 2391 | codec->afg ? codec->afg : codec->mfg, |
2146 | AC_PWRST_D0); | 2392 | AC_PWRST_D0); |
2393 | restore_pincfgs(codec); /* restore all current pin configs */ | ||
2147 | hda_exec_init_verbs(codec); | 2394 | hda_exec_init_verbs(codec); |
2148 | if (codec->patch_ops.resume) | 2395 | if (codec->patch_ops.resume) |
2149 | codec->patch_ops.resume(codec); | 2396 | codec->patch_ops.resume(codec); |
@@ -2171,8 +2418,16 @@ int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) | |||
2171 | 2418 | ||
2172 | list_for_each_entry(codec, &bus->codec_list, list) { | 2419 | list_for_each_entry(codec, &bus->codec_list, list) { |
2173 | int err = snd_hda_codec_build_controls(codec); | 2420 | int err = snd_hda_codec_build_controls(codec); |
2174 | if (err < 0) | 2421 | if (err < 0) { |
2175 | return err; | 2422 | printk(KERN_ERR "hda_codec: cannot build controls" |
2423 | "for #%d (error %d)\n", codec->addr, err); | ||
2424 | err = snd_hda_codec_reset(codec); | ||
2425 | if (err < 0) { | ||
2426 | printk(KERN_ERR | ||
2427 | "hda_codec: cannot revert codec\n"); | ||
2428 | return err; | ||
2429 | } | ||
2430 | } | ||
2176 | } | 2431 | } |
2177 | return 0; | 2432 | return 0; |
2178 | } | 2433 | } |
@@ -2181,19 +2436,12 @@ EXPORT_SYMBOL_HDA(snd_hda_build_controls); | |||
2181 | int snd_hda_codec_build_controls(struct hda_codec *codec) | 2436 | int snd_hda_codec_build_controls(struct hda_codec *codec) |
2182 | { | 2437 | { |
2183 | int err = 0; | 2438 | int err = 0; |
2184 | /* fake as if already powered-on */ | ||
2185 | hda_keep_power_on(codec); | ||
2186 | /* then fire up */ | ||
2187 | hda_set_power_state(codec, | ||
2188 | codec->afg ? codec->afg : codec->mfg, | ||
2189 | AC_PWRST_D0); | ||
2190 | hda_exec_init_verbs(codec); | 2439 | hda_exec_init_verbs(codec); |
2191 | /* continue to initialize... */ | 2440 | /* continue to initialize... */ |
2192 | if (codec->patch_ops.init) | 2441 | if (codec->patch_ops.init) |
2193 | err = codec->patch_ops.init(codec); | 2442 | err = codec->patch_ops.init(codec); |
2194 | if (!err && codec->patch_ops.build_controls) | 2443 | if (!err && codec->patch_ops.build_controls) |
2195 | err = codec->patch_ops.build_controls(codec); | 2444 | err = codec->patch_ops.build_controls(codec); |
2196 | snd_hda_power_down(codec); | ||
2197 | if (err < 0) | 2445 | if (err < 0) |
2198 | return err; | 2446 | return err; |
2199 | return 0; | 2447 | return 0; |
@@ -2306,12 +2554,11 @@ EXPORT_SYMBOL_HDA(snd_hda_calc_stream_format); | |||
2306 | static int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, | 2554 | static int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, |
2307 | u32 *ratesp, u64 *formatsp, unsigned int *bpsp) | 2555 | u32 *ratesp, u64 *formatsp, unsigned int *bpsp) |
2308 | { | 2556 | { |
2309 | int i; | 2557 | unsigned int i, val, wcaps; |
2310 | unsigned int val, streams; | ||
2311 | 2558 | ||
2312 | val = 0; | 2559 | val = 0; |
2313 | if (nid != codec->afg && | 2560 | wcaps = get_wcaps(codec, nid); |
2314 | (get_wcaps(codec, nid) & AC_WCAP_FORMAT_OVRD)) { | 2561 | if (nid != codec->afg && (wcaps & AC_WCAP_FORMAT_OVRD)) { |
2315 | val = snd_hda_param_read(codec, nid, AC_PAR_PCM); | 2562 | val = snd_hda_param_read(codec, nid, AC_PAR_PCM); |
2316 | if (val == -1) | 2563 | if (val == -1) |
2317 | return -EIO; | 2564 | return -EIO; |
@@ -2325,15 +2572,20 @@ static int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, | |||
2325 | if (val & (1 << i)) | 2572 | if (val & (1 << i)) |
2326 | rates |= rate_bits[i].alsa_bits; | 2573 | rates |= rate_bits[i].alsa_bits; |
2327 | } | 2574 | } |
2575 | if (rates == 0) { | ||
2576 | snd_printk(KERN_ERR "hda_codec: rates == 0 " | ||
2577 | "(nid=0x%x, val=0x%x, ovrd=%i)\n", | ||
2578 | nid, val, | ||
2579 | (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0); | ||
2580 | return -EIO; | ||
2581 | } | ||
2328 | *ratesp = rates; | 2582 | *ratesp = rates; |
2329 | } | 2583 | } |
2330 | 2584 | ||
2331 | if (formatsp || bpsp) { | 2585 | if (formatsp || bpsp) { |
2332 | u64 formats = 0; | 2586 | u64 formats = 0; |
2333 | unsigned int bps; | 2587 | unsigned int streams, bps; |
2334 | unsigned int wcaps; | ||
2335 | 2588 | ||
2336 | wcaps = get_wcaps(codec, nid); | ||
2337 | streams = snd_hda_param_read(codec, nid, AC_PAR_STREAM); | 2589 | streams = snd_hda_param_read(codec, nid, AC_PAR_STREAM); |
2338 | if (streams == -1) | 2590 | if (streams == -1) |
2339 | return -EIO; | 2591 | return -EIO; |
@@ -2386,6 +2638,15 @@ static int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, | |||
2386 | formats |= SNDRV_PCM_FMTBIT_U8; | 2638 | formats |= SNDRV_PCM_FMTBIT_U8; |
2387 | bps = 8; | 2639 | bps = 8; |
2388 | } | 2640 | } |
2641 | if (formats == 0) { | ||
2642 | snd_printk(KERN_ERR "hda_codec: formats == 0 " | ||
2643 | "(nid=0x%x, val=0x%x, ovrd=%i, " | ||
2644 | "streams=0x%x)\n", | ||
2645 | nid, val, | ||
2646 | (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0, | ||
2647 | streams); | ||
2648 | return -EIO; | ||
2649 | } | ||
2389 | if (formatsp) | 2650 | if (formatsp) |
2390 | *formatsp = formats; | 2651 | *formatsp = formats; |
2391 | if (bpsp) | 2652 | if (bpsp) |
@@ -2501,12 +2762,16 @@ static int hda_pcm_default_cleanup(struct hda_pcm_stream *hinfo, | |||
2501 | static int set_pcm_default_values(struct hda_codec *codec, | 2762 | static int set_pcm_default_values(struct hda_codec *codec, |
2502 | struct hda_pcm_stream *info) | 2763 | struct hda_pcm_stream *info) |
2503 | { | 2764 | { |
2765 | int err; | ||
2766 | |||
2504 | /* query support PCM information from the given NID */ | 2767 | /* query support PCM information from the given NID */ |
2505 | if (info->nid && (!info->rates || !info->formats)) { | 2768 | if (info->nid && (!info->rates || !info->formats)) { |
2506 | snd_hda_query_supported_pcm(codec, info->nid, | 2769 | err = snd_hda_query_supported_pcm(codec, info->nid, |
2507 | info->rates ? NULL : &info->rates, | 2770 | info->rates ? NULL : &info->rates, |
2508 | info->formats ? NULL : &info->formats, | 2771 | info->formats ? NULL : &info->formats, |
2509 | info->maxbps ? NULL : &info->maxbps); | 2772 | info->maxbps ? NULL : &info->maxbps); |
2773 | if (err < 0) | ||
2774 | return err; | ||
2510 | } | 2775 | } |
2511 | if (info->ops.open == NULL) | 2776 | if (info->ops.open == NULL) |
2512 | info->ops.open = hda_pcm_default_open_close; | 2777 | info->ops.open = hda_pcm_default_open_close; |
@@ -2549,13 +2814,10 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) | |||
2549 | for (i = 0; i < ARRAY_SIZE(audio_idx); i++) { | 2814 | for (i = 0; i < ARRAY_SIZE(audio_idx); i++) { |
2550 | dev = audio_idx[i]; | 2815 | dev = audio_idx[i]; |
2551 | if (!test_bit(dev, bus->pcm_dev_bits)) | 2816 | if (!test_bit(dev, bus->pcm_dev_bits)) |
2552 | break; | 2817 | goto ok; |
2553 | } | ||
2554 | if (i >= ARRAY_SIZE(audio_idx)) { | ||
2555 | snd_printk(KERN_WARNING "Too many audio devices\n"); | ||
2556 | return -EAGAIN; | ||
2557 | } | 2818 | } |
2558 | break; | 2819 | snd_printk(KERN_WARNING "Too many audio devices\n"); |
2820 | return -EAGAIN; | ||
2559 | case HDA_PCM_TYPE_SPDIF: | 2821 | case HDA_PCM_TYPE_SPDIF: |
2560 | case HDA_PCM_TYPE_HDMI: | 2822 | case HDA_PCM_TYPE_HDMI: |
2561 | case HDA_PCM_TYPE_MODEM: | 2823 | case HDA_PCM_TYPE_MODEM: |
@@ -2570,6 +2832,7 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type) | |||
2570 | snd_printk(KERN_WARNING "Invalid PCM type %d\n", type); | 2832 | snd_printk(KERN_WARNING "Invalid PCM type %d\n", type); |
2571 | return -EINVAL; | 2833 | return -EINVAL; |
2572 | } | 2834 | } |
2835 | ok: | ||
2573 | set_bit(dev, bus->pcm_dev_bits); | 2836 | set_bit(dev, bus->pcm_dev_bits); |
2574 | return dev; | 2837 | return dev; |
2575 | } | 2838 | } |
@@ -2606,24 +2869,36 @@ int snd_hda_codec_build_pcms(struct hda_codec *codec) | |||
2606 | if (!codec->patch_ops.build_pcms) | 2869 | if (!codec->patch_ops.build_pcms) |
2607 | return 0; | 2870 | return 0; |
2608 | err = codec->patch_ops.build_pcms(codec); | 2871 | err = codec->patch_ops.build_pcms(codec); |
2609 | if (err < 0) | 2872 | if (err < 0) { |
2610 | return err; | 2873 | printk(KERN_ERR "hda_codec: cannot build PCMs" |
2874 | "for #%d (error %d)\n", codec->addr, err); | ||
2875 | err = snd_hda_codec_reset(codec); | ||
2876 | if (err < 0) { | ||
2877 | printk(KERN_ERR | ||
2878 | "hda_codec: cannot revert codec\n"); | ||
2879 | return err; | ||
2880 | } | ||
2881 | } | ||
2611 | } | 2882 | } |
2612 | for (pcm = 0; pcm < codec->num_pcms; pcm++) { | 2883 | for (pcm = 0; pcm < codec->num_pcms; pcm++) { |
2613 | struct hda_pcm *cpcm = &codec->pcm_info[pcm]; | 2884 | struct hda_pcm *cpcm = &codec->pcm_info[pcm]; |
2614 | int dev; | 2885 | int dev; |
2615 | 2886 | ||
2616 | if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams) | 2887 | if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams) |
2617 | return 0; /* no substreams assigned */ | 2888 | continue; /* no substreams assigned */ |
2618 | 2889 | ||
2619 | if (!cpcm->pcm) { | 2890 | if (!cpcm->pcm) { |
2620 | dev = get_empty_pcm_device(codec->bus, cpcm->pcm_type); | 2891 | dev = get_empty_pcm_device(codec->bus, cpcm->pcm_type); |
2621 | if (dev < 0) | 2892 | if (dev < 0) |
2622 | return 0; | 2893 | continue; /* no fatal error */ |
2623 | cpcm->device = dev; | 2894 | cpcm->device = dev; |
2624 | err = snd_hda_attach_pcm(codec, cpcm); | 2895 | err = snd_hda_attach_pcm(codec, cpcm); |
2625 | if (err < 0) | 2896 | if (err < 0) { |
2626 | return err; | 2897 | printk(KERN_ERR "hda_codec: cannot attach " |
2898 | "PCM stream %d for codec #%d\n", | ||
2899 | dev, codec->addr); | ||
2900 | continue; /* no fatal error */ | ||
2901 | } | ||
2627 | } | 2902 | } |
2628 | } | 2903 | } |
2629 | return 0; | 2904 | return 0; |
@@ -3324,8 +3599,7 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
3324 | if (ignore_nids && is_in_nid_list(nid, ignore_nids)) | 3599 | if (ignore_nids && is_in_nid_list(nid, ignore_nids)) |
3325 | continue; | 3600 | continue; |
3326 | 3601 | ||
3327 | def_conf = snd_hda_codec_read(codec, nid, 0, | 3602 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
3328 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
3329 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) | 3603 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
3330 | continue; | 3604 | continue; |
3331 | loc = get_defcfg_location(def_conf); | 3605 | loc = get_defcfg_location(def_conf); |
@@ -3401,10 +3675,22 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
3401 | cfg->input_pins[AUTO_PIN_AUX] = nid; | 3675 | cfg->input_pins[AUTO_PIN_AUX] = nid; |
3402 | break; | 3676 | break; |
3403 | case AC_JACK_SPDIF_OUT: | 3677 | case AC_JACK_SPDIF_OUT: |
3404 | cfg->dig_out_pin = nid; | 3678 | case AC_JACK_DIG_OTHER_OUT: |
3679 | if (cfg->dig_outs >= ARRAY_SIZE(cfg->dig_out_pins)) | ||
3680 | continue; | ||
3681 | cfg->dig_out_pins[cfg->dig_outs] = nid; | ||
3682 | cfg->dig_out_type[cfg->dig_outs] = | ||
3683 | (loc == AC_JACK_LOC_HDMI) ? | ||
3684 | HDA_PCM_TYPE_HDMI : HDA_PCM_TYPE_SPDIF; | ||
3685 | cfg->dig_outs++; | ||
3405 | break; | 3686 | break; |
3406 | case AC_JACK_SPDIF_IN: | 3687 | case AC_JACK_SPDIF_IN: |
3688 | case AC_JACK_DIG_OTHER_IN: | ||
3407 | cfg->dig_in_pin = nid; | 3689 | cfg->dig_in_pin = nid; |
3690 | if (loc == AC_JACK_LOC_HDMI) | ||
3691 | cfg->dig_in_type = HDA_PCM_TYPE_HDMI; | ||
3692 | else | ||
3693 | cfg->dig_in_type = HDA_PCM_TYPE_SPDIF; | ||
3408 | break; | 3694 | break; |
3409 | } | 3695 | } |
3410 | } | 3696 | } |
@@ -3510,6 +3796,9 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
3510 | cfg->hp_pins[1], cfg->hp_pins[2], | 3796 | cfg->hp_pins[1], cfg->hp_pins[2], |
3511 | cfg->hp_pins[3], cfg->hp_pins[4]); | 3797 | cfg->hp_pins[3], cfg->hp_pins[4]); |
3512 | snd_printd(" mono: mono_out=0x%x\n", cfg->mono_out_pin); | 3798 | snd_printd(" mono: mono_out=0x%x\n", cfg->mono_out_pin); |
3799 | if (cfg->dig_outs) | ||
3800 | snd_printd(" dig-out=0x%x/0x%x\n", | ||
3801 | cfg->dig_out_pins[0], cfg->dig_out_pins[1]); | ||
3513 | snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x," | 3802 | snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x," |
3514 | " cd=0x%x, aux=0x%x\n", | 3803 | " cd=0x%x, aux=0x%x\n", |
3515 | cfg->input_pins[AUTO_PIN_MIC], | 3804 | cfg->input_pins[AUTO_PIN_MIC], |
@@ -3518,6 +3807,8 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, | |||
3518 | cfg->input_pins[AUTO_PIN_FRONT_LINE], | 3807 | cfg->input_pins[AUTO_PIN_FRONT_LINE], |
3519 | cfg->input_pins[AUTO_PIN_CD], | 3808 | cfg->input_pins[AUTO_PIN_CD], |
3520 | cfg->input_pins[AUTO_PIN_AUX]); | 3809 | cfg->input_pins[AUTO_PIN_AUX]); |
3810 | if (cfg->dig_in_pin) | ||
3811 | snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin); | ||
3521 | 3812 | ||
3522 | return 0; | 3813 | return 0; |
3523 | } | 3814 | } |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 09a332ada0c6..2fdecf4b0eb6 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -739,6 +739,7 @@ struct hda_codec { | |||
739 | hda_nid_t mfg; /* MFG node id */ | 739 | hda_nid_t mfg; /* MFG node id */ |
740 | 740 | ||
741 | /* ids */ | 741 | /* ids */ |
742 | u32 function_id; | ||
742 | u32 vendor_id; | 743 | u32 vendor_id; |
743 | u32 subsystem_id; | 744 | u32 subsystem_id; |
744 | u32 revision_id; | 745 | u32 revision_id; |
@@ -778,11 +779,14 @@ struct hda_codec { | |||
778 | unsigned short spdif_ctls; /* SPDIF control bits */ | 779 | unsigned short spdif_ctls; /* SPDIF control bits */ |
779 | unsigned int spdif_in_enable; /* SPDIF input enable? */ | 780 | unsigned int spdif_in_enable; /* SPDIF input enable? */ |
780 | hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ | 781 | hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ |
782 | struct snd_array init_pins; /* initial (BIOS) pin configurations */ | ||
783 | struct snd_array driver_pins; /* pin configs set by codec parser */ | ||
781 | 784 | ||
782 | #ifdef CONFIG_SND_HDA_HWDEP | 785 | #ifdef CONFIG_SND_HDA_HWDEP |
783 | struct snd_hwdep *hwdep; /* assigned hwdep device */ | 786 | struct snd_hwdep *hwdep; /* assigned hwdep device */ |
784 | struct snd_array init_verbs; /* additional init verbs */ | 787 | struct snd_array init_verbs; /* additional init verbs */ |
785 | struct snd_array hints; /* additional hints */ | 788 | struct snd_array hints; /* additional hints */ |
789 | struct snd_array user_pins; /* default pin configs to override */ | ||
786 | #endif | 790 | #endif |
787 | 791 | ||
788 | /* misc flags */ | 792 | /* misc flags */ |
@@ -790,6 +794,9 @@ struct hda_codec { | |||
790 | * status change | 794 | * status change |
791 | * (e.g. Realtek codecs) | 795 | * (e.g. Realtek codecs) |
792 | */ | 796 | */ |
797 | unsigned int pin_amp_workaround:1; /* pin out-amp takes index | ||
798 | * (e.g. Conexant codecs) | ||
799 | */ | ||
793 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 800 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
794 | unsigned int power_on :1; /* current (global) power-state */ | 801 | unsigned int power_on :1; /* current (global) power-state */ |
795 | unsigned int power_transition :1; /* power-state in transition */ | 802 | unsigned int power_transition :1; /* power-state in transition */ |
@@ -855,6 +862,18 @@ void snd_hda_codec_resume_cache(struct hda_codec *codec); | |||
855 | #define snd_hda_sequence_write_cache snd_hda_sequence_write | 862 | #define snd_hda_sequence_write_cache snd_hda_sequence_write |
856 | #endif | 863 | #endif |
857 | 864 | ||
865 | /* the struct for codec->pin_configs */ | ||
866 | struct hda_pincfg { | ||
867 | hda_nid_t nid; | ||
868 | unsigned int cfg; | ||
869 | }; | ||
870 | |||
871 | unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid); | ||
872 | int snd_hda_codec_set_pincfg(struct hda_codec *codec, hda_nid_t nid, | ||
873 | unsigned int cfg); | ||
874 | int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, | ||
875 | hda_nid_t nid, unsigned int cfg); /* for hwdep */ | ||
876 | |||
858 | /* | 877 | /* |
859 | * Mixer | 878 | * Mixer |
860 | */ | 879 | */ |
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index 65745e96dc70..1d5797a96682 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -144,9 +144,9 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid | |||
144 | node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 144 | node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
145 | 145 | ||
146 | if (node->type == AC_WID_PIN) { | 146 | if (node->type == AC_WID_PIN) { |
147 | node->pin_caps = snd_hda_param_read(codec, node->nid, AC_PAR_PIN_CAP); | 147 | node->pin_caps = snd_hda_query_pin_caps(codec, node->nid); |
148 | node->pin_ctl = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 148 | node->pin_ctl = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
149 | node->def_cfg = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | 149 | node->def_cfg = snd_hda_codec_get_pincfg(codec, node->nid); |
150 | } | 150 | } |
151 | 151 | ||
152 | if (node->wid_caps & AC_WCAP_OUT_AMP) { | 152 | if (node->wid_caps & AC_WCAP_OUT_AMP) { |
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c index 4ae51dcb81af..1c57505c2874 100644 --- a/sound/pci/hda/hda_hwdep.c +++ b/sound/pci/hda/hda_hwdep.c | |||
@@ -30,6 +30,12 @@ | |||
30 | #include <sound/hda_hwdep.h> | 30 | #include <sound/hda_hwdep.h> |
31 | #include <sound/minors.h> | 31 | #include <sound/minors.h> |
32 | 32 | ||
33 | /* hint string pair */ | ||
34 | struct hda_hint { | ||
35 | const char *key; | ||
36 | const char *val; /* contained in the same alloc as key */ | ||
37 | }; | ||
38 | |||
33 | /* | 39 | /* |
34 | * write/read an out-of-bound verb | 40 | * write/read an out-of-bound verb |
35 | */ | 41 | */ |
@@ -99,16 +105,17 @@ static int hda_hwdep_open(struct snd_hwdep *hw, struct file *file) | |||
99 | 105 | ||
100 | static void clear_hwdep_elements(struct hda_codec *codec) | 106 | static void clear_hwdep_elements(struct hda_codec *codec) |
101 | { | 107 | { |
102 | char **head; | ||
103 | int i; | 108 | int i; |
104 | 109 | ||
105 | /* clear init verbs */ | 110 | /* clear init verbs */ |
106 | snd_array_free(&codec->init_verbs); | 111 | snd_array_free(&codec->init_verbs); |
107 | /* clear hints */ | 112 | /* clear hints */ |
108 | head = codec->hints.list; | 113 | for (i = 0; i < codec->hints.used; i++) { |
109 | for (i = 0; i < codec->hints.used; i++, head++) | 114 | struct hda_hint *hint = snd_array_elem(&codec->hints, i); |
110 | kfree(*head); | 115 | kfree(hint->key); /* we don't need to free hint->val */ |
116 | } | ||
111 | snd_array_free(&codec->hints); | 117 | snd_array_free(&codec->hints); |
118 | snd_array_free(&codec->user_pins); | ||
112 | } | 119 | } |
113 | 120 | ||
114 | static void hwdep_free(struct snd_hwdep *hwdep) | 121 | static void hwdep_free(struct snd_hwdep *hwdep) |
@@ -140,7 +147,8 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) | |||
140 | #endif | 147 | #endif |
141 | 148 | ||
142 | snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32); | 149 | snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32); |
143 | snd_array_init(&codec->hints, sizeof(char *), 32); | 150 | snd_array_init(&codec->hints, sizeof(struct hda_hint), 32); |
151 | snd_array_init(&codec->user_pins, sizeof(struct hda_pincfg), 16); | ||
144 | 152 | ||
145 | return 0; | 153 | return 0; |
146 | } | 154 | } |
@@ -153,7 +161,13 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) | |||
153 | 161 | ||
154 | static int clear_codec(struct hda_codec *codec) | 162 | static int clear_codec(struct hda_codec *codec) |
155 | { | 163 | { |
156 | snd_hda_codec_reset(codec); | 164 | int err; |
165 | |||
166 | err = snd_hda_codec_reset(codec); | ||
167 | if (err < 0) { | ||
168 | snd_printk(KERN_ERR "The codec is being used, can't free.\n"); | ||
169 | return err; | ||
170 | } | ||
157 | clear_hwdep_elements(codec); | 171 | clear_hwdep_elements(codec); |
158 | return 0; | 172 | return 0; |
159 | } | 173 | } |
@@ -162,20 +176,29 @@ static int reconfig_codec(struct hda_codec *codec) | |||
162 | { | 176 | { |
163 | int err; | 177 | int err; |
164 | 178 | ||
179 | snd_hda_power_up(codec); | ||
165 | snd_printk(KERN_INFO "hda-codec: reconfiguring\n"); | 180 | snd_printk(KERN_INFO "hda-codec: reconfiguring\n"); |
166 | snd_hda_codec_reset(codec); | 181 | err = snd_hda_codec_reset(codec); |
182 | if (err < 0) { | ||
183 | snd_printk(KERN_ERR | ||
184 | "The codec is being used, can't reconfigure.\n"); | ||
185 | goto error; | ||
186 | } | ||
167 | err = snd_hda_codec_configure(codec); | 187 | err = snd_hda_codec_configure(codec); |
168 | if (err < 0) | 188 | if (err < 0) |
169 | return err; | 189 | goto error; |
170 | /* rebuild PCMs */ | 190 | /* rebuild PCMs */ |
171 | err = snd_hda_codec_build_pcms(codec); | 191 | err = snd_hda_codec_build_pcms(codec); |
172 | if (err < 0) | 192 | if (err < 0) |
173 | return err; | 193 | goto error; |
174 | /* rebuild mixers */ | 194 | /* rebuild mixers */ |
175 | err = snd_hda_codec_build_controls(codec); | 195 | err = snd_hda_codec_build_controls(codec); |
176 | if (err < 0) | 196 | if (err < 0) |
177 | return err; | 197 | goto error; |
178 | return snd_card_register(codec->bus->card); | 198 | err = snd_card_register(codec->bus->card); |
199 | error: | ||
200 | snd_hda_power_down(codec); | ||
201 | return err; | ||
179 | } | 202 | } |
180 | 203 | ||
181 | /* | 204 | /* |
@@ -271,6 +294,22 @@ static ssize_t type##_store(struct device *dev, \ | |||
271 | CODEC_ACTION_STORE(reconfig); | 294 | CODEC_ACTION_STORE(reconfig); |
272 | CODEC_ACTION_STORE(clear); | 295 | CODEC_ACTION_STORE(clear); |
273 | 296 | ||
297 | static ssize_t init_verbs_show(struct device *dev, | ||
298 | struct device_attribute *attr, | ||
299 | char *buf) | ||
300 | { | ||
301 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
302 | struct hda_codec *codec = hwdep->private_data; | ||
303 | int i, len = 0; | ||
304 | for (i = 0; i < codec->init_verbs.used; i++) { | ||
305 | struct hda_verb *v = snd_array_elem(&codec->init_verbs, i); | ||
306 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
307 | "0x%02x 0x%03x 0x%04x\n", | ||
308 | v->nid, v->verb, v->param); | ||
309 | } | ||
310 | return len; | ||
311 | } | ||
312 | |||
274 | static ssize_t init_verbs_store(struct device *dev, | 313 | static ssize_t init_verbs_store(struct device *dev, |
275 | struct device_attribute *attr, | 314 | struct device_attribute *attr, |
276 | const char *buf, size_t count) | 315 | const char *buf, size_t count) |
@@ -293,26 +332,157 @@ static ssize_t init_verbs_store(struct device *dev, | |||
293 | return count; | 332 | return count; |
294 | } | 333 | } |
295 | 334 | ||
335 | static ssize_t hints_show(struct device *dev, | ||
336 | struct device_attribute *attr, | ||
337 | char *buf) | ||
338 | { | ||
339 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
340 | struct hda_codec *codec = hwdep->private_data; | ||
341 | int i, len = 0; | ||
342 | for (i = 0; i < codec->hints.used; i++) { | ||
343 | struct hda_hint *hint = snd_array_elem(&codec->hints, i); | ||
344 | len += snprintf(buf + len, PAGE_SIZE - len, | ||
345 | "%s = %s\n", hint->key, hint->val); | ||
346 | } | ||
347 | return len; | ||
348 | } | ||
349 | |||
350 | static struct hda_hint *get_hint(struct hda_codec *codec, const char *key) | ||
351 | { | ||
352 | int i; | ||
353 | |||
354 | for (i = 0; i < codec->hints.used; i++) { | ||
355 | struct hda_hint *hint = snd_array_elem(&codec->hints, i); | ||
356 | if (!strcmp(hint->key, key)) | ||
357 | return hint; | ||
358 | } | ||
359 | return NULL; | ||
360 | } | ||
361 | |||
362 | static void remove_trail_spaces(char *str) | ||
363 | { | ||
364 | char *p; | ||
365 | if (!*str) | ||
366 | return; | ||
367 | p = str + strlen(str) - 1; | ||
368 | for (; isspace(*p); p--) { | ||
369 | *p = 0; | ||
370 | if (p == str) | ||
371 | return; | ||
372 | } | ||
373 | } | ||
374 | |||
375 | #define MAX_HINTS 1024 | ||
376 | |||
296 | static ssize_t hints_store(struct device *dev, | 377 | static ssize_t hints_store(struct device *dev, |
297 | struct device_attribute *attr, | 378 | struct device_attribute *attr, |
298 | const char *buf, size_t count) | 379 | const char *buf, size_t count) |
299 | { | 380 | { |
300 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | 381 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); |
301 | struct hda_codec *codec = hwdep->private_data; | 382 | struct hda_codec *codec = hwdep->private_data; |
302 | char *p; | 383 | char *key, *val; |
303 | char **hint; | 384 | struct hda_hint *hint; |
304 | 385 | ||
305 | if (!*buf || isspace(*buf) || *buf == '#' || *buf == '\n') | 386 | while (isspace(*buf)) |
387 | buf++; | ||
388 | if (!*buf || *buf == '#' || *buf == '\n') | ||
306 | return count; | 389 | return count; |
307 | p = kstrndup_noeol(buf, 1024); | 390 | if (*buf == '=') |
308 | if (!p) | 391 | return -EINVAL; |
392 | key = kstrndup_noeol(buf, 1024); | ||
393 | if (!key) | ||
309 | return -ENOMEM; | 394 | return -ENOMEM; |
310 | hint = snd_array_new(&codec->hints); | 395 | /* extract key and val */ |
396 | val = strchr(key, '='); | ||
397 | if (!val) { | ||
398 | kfree(key); | ||
399 | return -EINVAL; | ||
400 | } | ||
401 | *val++ = 0; | ||
402 | while (isspace(*val)) | ||
403 | val++; | ||
404 | remove_trail_spaces(key); | ||
405 | remove_trail_spaces(val); | ||
406 | hint = get_hint(codec, key); | ||
407 | if (hint) { | ||
408 | /* replace */ | ||
409 | kfree(hint->key); | ||
410 | hint->key = key; | ||
411 | hint->val = val; | ||
412 | return count; | ||
413 | } | ||
414 | /* allocate a new hint entry */ | ||
415 | if (codec->hints.used >= MAX_HINTS) | ||
416 | hint = NULL; | ||
417 | else | ||
418 | hint = snd_array_new(&codec->hints); | ||
311 | if (!hint) { | 419 | if (!hint) { |
312 | kfree(p); | 420 | kfree(key); |
313 | return -ENOMEM; | 421 | return -ENOMEM; |
314 | } | 422 | } |
315 | *hint = p; | 423 | hint->key = key; |
424 | hint->val = val; | ||
425 | return count; | ||
426 | } | ||
427 | |||
428 | static ssize_t pin_configs_show(struct hda_codec *codec, | ||
429 | struct snd_array *list, | ||
430 | char *buf) | ||
431 | { | ||
432 | int i, len = 0; | ||
433 | for (i = 0; i < list->used; i++) { | ||
434 | struct hda_pincfg *pin = snd_array_elem(list, i); | ||
435 | len += sprintf(buf + len, "0x%02x 0x%08x\n", | ||
436 | pin->nid, pin->cfg); | ||
437 | } | ||
438 | return len; | ||
439 | } | ||
440 | |||
441 | static ssize_t init_pin_configs_show(struct device *dev, | ||
442 | struct device_attribute *attr, | ||
443 | char *buf) | ||
444 | { | ||
445 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
446 | struct hda_codec *codec = hwdep->private_data; | ||
447 | return pin_configs_show(codec, &codec->init_pins, buf); | ||
448 | } | ||
449 | |||
450 | static ssize_t user_pin_configs_show(struct device *dev, | ||
451 | struct device_attribute *attr, | ||
452 | char *buf) | ||
453 | { | ||
454 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
455 | struct hda_codec *codec = hwdep->private_data; | ||
456 | return pin_configs_show(codec, &codec->user_pins, buf); | ||
457 | } | ||
458 | |||
459 | static ssize_t driver_pin_configs_show(struct device *dev, | ||
460 | struct device_attribute *attr, | ||
461 | char *buf) | ||
462 | { | ||
463 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
464 | struct hda_codec *codec = hwdep->private_data; | ||
465 | return pin_configs_show(codec, &codec->driver_pins, buf); | ||
466 | } | ||
467 | |||
468 | #define MAX_PIN_CONFIGS 32 | ||
469 | |||
470 | static ssize_t user_pin_configs_store(struct device *dev, | ||
471 | struct device_attribute *attr, | ||
472 | const char *buf, size_t count) | ||
473 | { | ||
474 | struct snd_hwdep *hwdep = dev_get_drvdata(dev); | ||
475 | struct hda_codec *codec = hwdep->private_data; | ||
476 | int nid, cfg; | ||
477 | int err; | ||
478 | |||
479 | if (sscanf(buf, "%i %i", &nid, &cfg) != 2) | ||
480 | return -EINVAL; | ||
481 | if (!nid) | ||
482 | return -EINVAL; | ||
483 | err = snd_hda_add_pincfg(codec, &codec->user_pins, nid, cfg); | ||
484 | if (err < 0) | ||
485 | return err; | ||
316 | return count; | 486 | return count; |
317 | } | 487 | } |
318 | 488 | ||
@@ -331,8 +501,11 @@ static struct device_attribute codec_attrs[] = { | |||
331 | CODEC_ATTR_RO(mfg), | 501 | CODEC_ATTR_RO(mfg), |
332 | CODEC_ATTR_RW(name), | 502 | CODEC_ATTR_RW(name), |
333 | CODEC_ATTR_RW(modelname), | 503 | CODEC_ATTR_RW(modelname), |
334 | CODEC_ATTR_WO(init_verbs), | 504 | CODEC_ATTR_RW(init_verbs), |
335 | CODEC_ATTR_WO(hints), | 505 | CODEC_ATTR_RW(hints), |
506 | CODEC_ATTR_RO(init_pin_configs), | ||
507 | CODEC_ATTR_RW(user_pin_configs), | ||
508 | CODEC_ATTR_RO(driver_pin_configs), | ||
336 | CODEC_ATTR_WO(reconfig), | 509 | CODEC_ATTR_WO(reconfig), |
337 | CODEC_ATTR_WO(clear), | 510 | CODEC_ATTR_WO(clear), |
338 | }; | 511 | }; |
@@ -351,4 +524,29 @@ int snd_hda_hwdep_add_sysfs(struct hda_codec *codec) | |||
351 | return 0; | 524 | return 0; |
352 | } | 525 | } |
353 | 526 | ||
527 | /* | ||
528 | * Look for hint string | ||
529 | */ | ||
530 | const char *snd_hda_get_hint(struct hda_codec *codec, const char *key) | ||
531 | { | ||
532 | struct hda_hint *hint = get_hint(codec, key); | ||
533 | return hint ? hint->val : NULL; | ||
534 | } | ||
535 | EXPORT_SYMBOL_HDA(snd_hda_get_hint); | ||
536 | |||
537 | int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) | ||
538 | { | ||
539 | const char *p = snd_hda_get_hint(codec, key); | ||
540 | if (!p || !*p) | ||
541 | return -ENOENT; | ||
542 | switch (toupper(*p)) { | ||
543 | case 'T': /* true */ | ||
544 | case 'Y': /* yes */ | ||
545 | case '1': | ||
546 | return 1; | ||
547 | } | ||
548 | return 0; | ||
549 | } | ||
550 | EXPORT_SYMBOL_HDA(snd_hda_get_bool_hint); | ||
551 | |||
354 | #endif /* CONFIG_SND_HDA_RECONFIG */ | 552 | #endif /* CONFIG_SND_HDA_RECONFIG */ |
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index f3b5723c2859..30829ee920c3 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c | |||
@@ -381,6 +381,7 @@ struct azx { | |||
381 | 381 | ||
382 | /* HD codec */ | 382 | /* HD codec */ |
383 | unsigned short codec_mask; | 383 | unsigned short codec_mask; |
384 | int codec_probe_mask; /* copied from probe_mask option */ | ||
384 | struct hda_bus *bus; | 385 | struct hda_bus *bus; |
385 | 386 | ||
386 | /* CORB/RIRB */ | 387 | /* CORB/RIRB */ |
@@ -858,13 +859,18 @@ static void azx_stream_start(struct azx *chip, struct azx_dev *azx_dev) | |||
858 | SD_CTL_DMA_START | SD_INT_MASK); | 859 | SD_CTL_DMA_START | SD_INT_MASK); |
859 | } | 860 | } |
860 | 861 | ||
861 | /* stop a stream */ | 862 | /* stop DMA */ |
862 | static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev) | 863 | static void azx_stream_clear(struct azx *chip, struct azx_dev *azx_dev) |
863 | { | 864 | { |
864 | /* stop DMA */ | ||
865 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & | 865 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & |
866 | ~(SD_CTL_DMA_START | SD_INT_MASK)); | 866 | ~(SD_CTL_DMA_START | SD_INT_MASK)); |
867 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */ | 867 | azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */ |
868 | } | ||
869 | |||
870 | /* stop a stream */ | ||
871 | static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev) | ||
872 | { | ||
873 | azx_stream_clear(chip, azx_dev); | ||
868 | /* disable SIE */ | 874 | /* disable SIE */ |
869 | azx_writeb(chip, INTCTL, | 875 | azx_writeb(chip, INTCTL, |
870 | azx_readb(chip, INTCTL) & ~(1 << azx_dev->index)); | 876 | azx_readb(chip, INTCTL) & ~(1 << azx_dev->index)); |
@@ -1075,8 +1081,7 @@ static int azx_setup_periods(struct azx *chip, | |||
1075 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | 1081 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
1076 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | 1082 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
1077 | 1083 | ||
1078 | period_bytes = snd_pcm_lib_period_bytes(substream); | 1084 | period_bytes = azx_dev->period_bytes; |
1079 | azx_dev->period_bytes = period_bytes; | ||
1080 | periods = azx_dev->bufsize / period_bytes; | 1085 | periods = azx_dev->bufsize / period_bytes; |
1081 | 1086 | ||
1082 | /* program the initial BDL entries */ | 1087 | /* program the initial BDL entries */ |
@@ -1123,24 +1128,17 @@ static int azx_setup_periods(struct azx *chip, | |||
1123 | error: | 1128 | error: |
1124 | snd_printk(KERN_ERR "Too many BDL entries: buffer=%d, period=%d\n", | 1129 | snd_printk(KERN_ERR "Too many BDL entries: buffer=%d, period=%d\n", |
1125 | azx_dev->bufsize, period_bytes); | 1130 | azx_dev->bufsize, period_bytes); |
1126 | /* reset */ | ||
1127 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | ||
1128 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | ||
1129 | return -EINVAL; | 1131 | return -EINVAL; |
1130 | } | 1132 | } |
1131 | 1133 | ||
1132 | /* | 1134 | /* reset stream */ |
1133 | * set up the SD for streaming | 1135 | static void azx_stream_reset(struct azx *chip, struct azx_dev *azx_dev) |
1134 | */ | ||
1135 | static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | ||
1136 | { | 1136 | { |
1137 | unsigned char val; | 1137 | unsigned char val; |
1138 | int timeout; | 1138 | int timeout; |
1139 | 1139 | ||
1140 | /* make sure the run bit is zero for SD */ | 1140 | azx_stream_clear(chip, azx_dev); |
1141 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & | 1141 | |
1142 | ~SD_CTL_DMA_START); | ||
1143 | /* reset stream */ | ||
1144 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) | | 1142 | azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) | |
1145 | SD_CTL_STREAM_RESET); | 1143 | SD_CTL_STREAM_RESET); |
1146 | udelay(3); | 1144 | udelay(3); |
@@ -1157,7 +1155,15 @@ static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | |||
1157 | while (((val = azx_sd_readb(azx_dev, SD_CTL)) & SD_CTL_STREAM_RESET) && | 1155 | while (((val = azx_sd_readb(azx_dev, SD_CTL)) & SD_CTL_STREAM_RESET) && |
1158 | --timeout) | 1156 | --timeout) |
1159 | ; | 1157 | ; |
1158 | } | ||
1160 | 1159 | ||
1160 | /* | ||
1161 | * set up the SD for streaming | ||
1162 | */ | ||
1163 | static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) | ||
1164 | { | ||
1165 | /* make sure the run bit is zero for SD */ | ||
1166 | azx_stream_clear(chip, azx_dev); | ||
1161 | /* program the stream_tag */ | 1167 | /* program the stream_tag */ |
1162 | azx_sd_writel(azx_dev, SD_CTL, | 1168 | azx_sd_writel(azx_dev, SD_CTL, |
1163 | (azx_sd_readl(azx_dev, SD_CTL) & ~SD_CTL_STREAM_TAG_MASK)| | 1169 | (azx_sd_readl(azx_dev, SD_CTL) & ~SD_CTL_STREAM_TAG_MASK)| |
@@ -1228,7 +1234,6 @@ static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] __devinitdata = { | |||
1228 | }; | 1234 | }; |
1229 | 1235 | ||
1230 | static int __devinit azx_codec_create(struct azx *chip, const char *model, | 1236 | static int __devinit azx_codec_create(struct azx *chip, const char *model, |
1231 | unsigned int codec_probe_mask, | ||
1232 | int no_init) | 1237 | int no_init) |
1233 | { | 1238 | { |
1234 | struct hda_bus_template bus_temp; | 1239 | struct hda_bus_template bus_temp; |
@@ -1261,7 +1266,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1261 | 1266 | ||
1262 | /* First try to probe all given codec slots */ | 1267 | /* First try to probe all given codec slots */ |
1263 | for (c = 0; c < max_slots; c++) { | 1268 | for (c = 0; c < max_slots; c++) { |
1264 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { | 1269 | if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { |
1265 | if (probe_codec(chip, c) < 0) { | 1270 | if (probe_codec(chip, c) < 0) { |
1266 | /* Some BIOSen give you wrong codec addresses | 1271 | /* Some BIOSen give you wrong codec addresses |
1267 | * that don't exist | 1272 | * that don't exist |
@@ -1285,7 +1290,7 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model, | |||
1285 | 1290 | ||
1286 | /* Then create codec instances */ | 1291 | /* Then create codec instances */ |
1287 | for (c = 0; c < max_slots; c++) { | 1292 | for (c = 0; c < max_slots; c++) { |
1288 | if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { | 1293 | if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { |
1289 | struct hda_codec *codec; | 1294 | struct hda_codec *codec; |
1290 | err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); | 1295 | err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); |
1291 | if (err < 0) | 1296 | if (err < 0) |
@@ -1403,6 +1408,8 @@ static int azx_pcm_open(struct snd_pcm_substream *substream) | |||
1403 | runtime->private_data = azx_dev; | 1408 | runtime->private_data = azx_dev; |
1404 | snd_pcm_set_sync(substream); | 1409 | snd_pcm_set_sync(substream); |
1405 | mutex_unlock(&chip->open_mutex); | 1410 | mutex_unlock(&chip->open_mutex); |
1411 | |||
1412 | azx_stream_reset(chip, azx_dev); | ||
1406 | return 0; | 1413 | return 0; |
1407 | } | 1414 | } |
1408 | 1415 | ||
@@ -1429,6 +1436,11 @@ static int azx_pcm_close(struct snd_pcm_substream *substream) | |||
1429 | static int azx_pcm_hw_params(struct snd_pcm_substream *substream, | 1436 | static int azx_pcm_hw_params(struct snd_pcm_substream *substream, |
1430 | struct snd_pcm_hw_params *hw_params) | 1437 | struct snd_pcm_hw_params *hw_params) |
1431 | { | 1438 | { |
1439 | struct azx_dev *azx_dev = get_azx_dev(substream); | ||
1440 | |||
1441 | azx_dev->bufsize = 0; | ||
1442 | azx_dev->period_bytes = 0; | ||
1443 | azx_dev->format_val = 0; | ||
1432 | return snd_pcm_lib_malloc_pages(substream, | 1444 | return snd_pcm_lib_malloc_pages(substream, |
1433 | params_buffer_bytes(hw_params)); | 1445 | params_buffer_bytes(hw_params)); |
1434 | } | 1446 | } |
@@ -1443,6 +1455,9 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream) | |||
1443 | azx_sd_writel(azx_dev, SD_BDLPL, 0); | 1455 | azx_sd_writel(azx_dev, SD_BDLPL, 0); |
1444 | azx_sd_writel(azx_dev, SD_BDLPU, 0); | 1456 | azx_sd_writel(azx_dev, SD_BDLPU, 0); |
1445 | azx_sd_writel(azx_dev, SD_CTL, 0); | 1457 | azx_sd_writel(azx_dev, SD_CTL, 0); |
1458 | azx_dev->bufsize = 0; | ||
1459 | azx_dev->period_bytes = 0; | ||
1460 | azx_dev->format_val = 0; | ||
1446 | 1461 | ||
1447 | hinfo->ops.cleanup(hinfo, apcm->codec, substream); | 1462 | hinfo->ops.cleanup(hinfo, apcm->codec, substream); |
1448 | 1463 | ||
@@ -1456,23 +1471,37 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream) | |||
1456 | struct azx_dev *azx_dev = get_azx_dev(substream); | 1471 | struct azx_dev *azx_dev = get_azx_dev(substream); |
1457 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; | 1472 | struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; |
1458 | struct snd_pcm_runtime *runtime = substream->runtime; | 1473 | struct snd_pcm_runtime *runtime = substream->runtime; |
1474 | unsigned int bufsize, period_bytes, format_val; | ||
1475 | int err; | ||
1459 | 1476 | ||
1460 | azx_dev->bufsize = snd_pcm_lib_buffer_bytes(substream); | 1477 | format_val = snd_hda_calc_stream_format(runtime->rate, |
1461 | azx_dev->format_val = snd_hda_calc_stream_format(runtime->rate, | 1478 | runtime->channels, |
1462 | runtime->channels, | 1479 | runtime->format, |
1463 | runtime->format, | 1480 | hinfo->maxbps); |
1464 | hinfo->maxbps); | 1481 | if (!format_val) { |
1465 | if (!azx_dev->format_val) { | ||
1466 | snd_printk(KERN_ERR SFX | 1482 | snd_printk(KERN_ERR SFX |
1467 | "invalid format_val, rate=%d, ch=%d, format=%d\n", | 1483 | "invalid format_val, rate=%d, ch=%d, format=%d\n", |
1468 | runtime->rate, runtime->channels, runtime->format); | 1484 | runtime->rate, runtime->channels, runtime->format); |
1469 | return -EINVAL; | 1485 | return -EINVAL; |
1470 | } | 1486 | } |
1471 | 1487 | ||
1488 | bufsize = snd_pcm_lib_buffer_bytes(substream); | ||
1489 | period_bytes = snd_pcm_lib_period_bytes(substream); | ||
1490 | |||
1472 | snd_printdd("azx_pcm_prepare: bufsize=0x%x, format=0x%x\n", | 1491 | snd_printdd("azx_pcm_prepare: bufsize=0x%x, format=0x%x\n", |
1473 | azx_dev->bufsize, azx_dev->format_val); | 1492 | bufsize, format_val); |
1474 | if (azx_setup_periods(chip, substream, azx_dev) < 0) | 1493 | |
1475 | return -EINVAL; | 1494 | if (bufsize != azx_dev->bufsize || |
1495 | period_bytes != azx_dev->period_bytes || | ||
1496 | format_val != azx_dev->format_val) { | ||
1497 | azx_dev->bufsize = bufsize; | ||
1498 | azx_dev->period_bytes = period_bytes; | ||
1499 | azx_dev->format_val = format_val; | ||
1500 | err = azx_setup_periods(chip, substream, azx_dev); | ||
1501 | if (err < 0) | ||
1502 | return err; | ||
1503 | } | ||
1504 | |||
1476 | azx_setup_controller(chip, azx_dev); | 1505 | azx_setup_controller(chip, azx_dev); |
1477 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 1506 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
1478 | azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; | 1507 | azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; |
@@ -2100,25 +2129,36 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = { | |||
2100 | SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), | 2129 | SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), |
2101 | /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ | 2130 | /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ |
2102 | SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), | 2131 | SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), |
2103 | /* conflict of ALC268 in slot#3 (digital I/O); a temporary fix */ | 2132 | /* forced codec slots */ |
2104 | SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba laptop", 0x03), | 2133 | SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103), |
2105 | {} | 2134 | {} |
2106 | }; | 2135 | }; |
2107 | 2136 | ||
2137 | #define AZX_FORCE_CODEC_MASK 0x100 | ||
2138 | |||
2108 | static void __devinit check_probe_mask(struct azx *chip, int dev) | 2139 | static void __devinit check_probe_mask(struct azx *chip, int dev) |
2109 | { | 2140 | { |
2110 | const struct snd_pci_quirk *q; | 2141 | const struct snd_pci_quirk *q; |
2111 | 2142 | ||
2112 | if (probe_mask[dev] == -1) { | 2143 | chip->codec_probe_mask = probe_mask[dev]; |
2144 | if (chip->codec_probe_mask == -1) { | ||
2113 | q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); | 2145 | q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); |
2114 | if (q) { | 2146 | if (q) { |
2115 | printk(KERN_INFO | 2147 | printk(KERN_INFO |
2116 | "hda_intel: probe_mask set to 0x%x " | 2148 | "hda_intel: probe_mask set to 0x%x " |
2117 | "for device %04x:%04x\n", | 2149 | "for device %04x:%04x\n", |
2118 | q->value, q->subvendor, q->subdevice); | 2150 | q->value, q->subvendor, q->subdevice); |
2119 | probe_mask[dev] = q->value; | 2151 | chip->codec_probe_mask = q->value; |
2120 | } | 2152 | } |
2121 | } | 2153 | } |
2154 | |||
2155 | /* check forced option */ | ||
2156 | if (chip->codec_probe_mask != -1 && | ||
2157 | (chip->codec_probe_mask & AZX_FORCE_CODEC_MASK)) { | ||
2158 | chip->codec_mask = chip->codec_probe_mask & 0xff; | ||
2159 | printk(KERN_INFO "hda_intel: codec_mask forced to 0x%x\n", | ||
2160 | chip->codec_mask); | ||
2161 | } | ||
2122 | } | 2162 | } |
2123 | 2163 | ||
2124 | 2164 | ||
@@ -2347,10 +2387,10 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2347 | return -ENOENT; | 2387 | return -ENOENT; |
2348 | } | 2388 | } |
2349 | 2389 | ||
2350 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2390 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2351 | if (!card) { | 2391 | if (err < 0) { |
2352 | snd_printk(KERN_ERR SFX "Error creating card!\n"); | 2392 | snd_printk(KERN_ERR SFX "Error creating card!\n"); |
2353 | return -ENOMEM; | 2393 | return err; |
2354 | } | 2394 | } |
2355 | 2395 | ||
2356 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); | 2396 | err = azx_create(card, pci, dev, pci_id->driver_data, &chip); |
@@ -2359,8 +2399,7 @@ static int __devinit azx_probe(struct pci_dev *pci, | |||
2359 | card->private_data = chip; | 2399 | card->private_data = chip; |
2360 | 2400 | ||
2361 | /* create codec instances */ | 2401 | /* create codec instances */ |
2362 | err = azx_codec_create(chip, model[dev], probe_mask[dev], | 2402 | err = azx_codec_create(chip, model[dev], probe_only[dev]); |
2363 | probe_only[dev]); | ||
2364 | if (err < 0) | 2403 | if (err < 0) |
2365 | goto out_free; | 2404 | goto out_free; |
2366 | 2405 | ||
@@ -2457,10 +2496,10 @@ static struct pci_device_id azx_ids[] = { | |||
2457 | { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, | 2496 | { PCI_DEVICE(0x10de, 0x0ac1), .driver_data = AZX_DRIVER_NVIDIA }, |
2458 | { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, | 2497 | { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, |
2459 | { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, | 2498 | { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, |
2460 | { PCI_DEVICE(0x10de, 0x0bd4), .driver_data = AZX_DRIVER_NVIDIA }, | 2499 | { PCI_DEVICE(0x10de, 0x0d94), .driver_data = AZX_DRIVER_NVIDIA }, |
2461 | { PCI_DEVICE(0x10de, 0x0bd5), .driver_data = AZX_DRIVER_NVIDIA }, | 2500 | { PCI_DEVICE(0x10de, 0x0d95), .driver_data = AZX_DRIVER_NVIDIA }, |
2462 | { PCI_DEVICE(0x10de, 0x0bd6), .driver_data = AZX_DRIVER_NVIDIA }, | 2501 | { PCI_DEVICE(0x10de, 0x0d96), .driver_data = AZX_DRIVER_NVIDIA }, |
2463 | { PCI_DEVICE(0x10de, 0x0bd7), .driver_data = AZX_DRIVER_NVIDIA }, | 2502 | { PCI_DEVICE(0x10de, 0x0d97), .driver_data = AZX_DRIVER_NVIDIA }, |
2464 | /* Teradici */ | 2503 | /* Teradici */ |
2465 | { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, | 2504 | { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, |
2466 | /* AMD Generic, PCI class code and Vendor ID for HD Audio */ | 2505 | /* AMD Generic, PCI class code and Vendor ID for HD Audio */ |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 44f189cb97ae..83349013b4df 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -26,8 +26,10 @@ | |||
26 | /* | 26 | /* |
27 | * for mixer controls | 27 | * for mixer controls |
28 | */ | 28 | */ |
29 | #define HDA_COMPOSE_AMP_VAL_OFS(nid,chs,idx,dir,ofs) \ | ||
30 | ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19) | ((ofs)<<23)) | ||
29 | #define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) \ | 31 | #define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) \ |
30 | ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19)) | 32 | HDA_COMPOSE_AMP_VAL_OFS(nid, chs, idx, dir, 0) |
31 | /* mono volume with index (index=0,1,...) (channel=1,2) */ | 33 | /* mono volume with index (index=0,1,...) (channel=1,2) */ |
32 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ | 34 | #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ |
33 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ | 35 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ |
@@ -96,7 +98,7 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, | |||
96 | const char *name); | 98 | const char *name); |
97 | int snd_hda_add_vmaster(struct hda_codec *codec, char *name, | 99 | int snd_hda_add_vmaster(struct hda_codec *codec, char *name, |
98 | unsigned int *tlv, const char **slaves); | 100 | unsigned int *tlv, const char **slaves); |
99 | void snd_hda_codec_reset(struct hda_codec *codec); | 101 | int snd_hda_codec_reset(struct hda_codec *codec); |
100 | int snd_hda_codec_configure(struct hda_codec *codec); | 102 | int snd_hda_codec_configure(struct hda_codec *codec); |
101 | 103 | ||
102 | /* amp value bits */ | 104 | /* amp value bits */ |
@@ -134,7 +136,7 @@ extern struct hda_ctl_ops snd_hda_bind_sw; /* for bind-switch */ | |||
134 | 136 | ||
135 | struct hda_bind_ctls { | 137 | struct hda_bind_ctls { |
136 | struct hda_ctl_ops *ops; | 138 | struct hda_ctl_ops *ops; |
137 | long values[]; | 139 | unsigned long values[]; |
138 | }; | 140 | }; |
139 | 141 | ||
140 | int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol, | 142 | int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol, |
@@ -227,6 +229,7 @@ struct hda_multi_out { | |||
227 | hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */ | 229 | hda_nid_t hp_nid; /* optional DAC for HP, 0 when not exists */ |
228 | hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */ | 230 | hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */ |
229 | hda_nid_t dig_out_nid; /* digital out audio widget */ | 231 | hda_nid_t dig_out_nid; /* digital out audio widget */ |
232 | hda_nid_t *slave_dig_outs; | ||
230 | int max_channels; /* currently supported analog channels */ | 233 | int max_channels; /* currently supported analog channels */ |
231 | int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ | 234 | int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ |
232 | int no_share_stream; /* don't share a stream with multiple pins */ | 235 | int no_share_stream; /* don't share a stream with multiple pins */ |
@@ -354,9 +357,12 @@ struct auto_pin_cfg { | |||
354 | int line_out_type; /* AUTO_PIN_XXX_OUT */ | 357 | int line_out_type; /* AUTO_PIN_XXX_OUT */ |
355 | hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; | 358 | hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; |
356 | hda_nid_t input_pins[AUTO_PIN_LAST]; | 359 | hda_nid_t input_pins[AUTO_PIN_LAST]; |
357 | hda_nid_t dig_out_pin; | 360 | int dig_outs; |
361 | hda_nid_t dig_out_pins[2]; | ||
358 | hda_nid_t dig_in_pin; | 362 | hda_nid_t dig_in_pin; |
359 | hda_nid_t mono_out_pin; | 363 | hda_nid_t mono_out_pin; |
364 | int dig_out_type[2]; /* HDA_PCM_TYPE_XXX */ | ||
365 | int dig_in_type; /* HDA_PCM_TYPE_XXX */ | ||
360 | }; | 366 | }; |
361 | 367 | ||
362 | #define get_defcfg_connect(cfg) \ | 368 | #define get_defcfg_connect(cfg) \ |
@@ -405,6 +411,7 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid) | |||
405 | u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); | 411 | u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); |
406 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | 412 | int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, |
407 | unsigned int caps); | 413 | unsigned int caps); |
414 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); | ||
408 | 415 | ||
409 | int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl); | 416 | int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl); |
410 | void snd_hda_ctls_clear(struct hda_codec *codec); | 417 | void snd_hda_ctls_clear(struct hda_codec *codec); |
@@ -427,6 +434,23 @@ static inline int snd_hda_hwdep_add_sysfs(struct hda_codec *codec) | |||
427 | } | 434 | } |
428 | #endif | 435 | #endif |
429 | 436 | ||
437 | #ifdef CONFIG_SND_HDA_RECONFIG | ||
438 | const char *snd_hda_get_hint(struct hda_codec *codec, const char *key); | ||
439 | int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key); | ||
440 | #else | ||
441 | static inline | ||
442 | const char *snd_hda_get_hint(struct hda_codec *codec, const char *key) | ||
443 | { | ||
444 | return NULL; | ||
445 | } | ||
446 | |||
447 | static inline | ||
448 | int snd_hda_get_bool_hint(struct hda_codec *codec, const char *key) | ||
449 | { | ||
450 | return -ENOENT; | ||
451 | } | ||
452 | #endif | ||
453 | |||
430 | /* | 454 | /* |
431 | * power-management | 455 | * power-management |
432 | */ | 456 | */ |
@@ -458,6 +482,7 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, | |||
458 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) | 482 | #define get_amp_channels(kc) (((kc)->private_value >> 16) & 0x3) |
459 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) | 483 | #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) |
460 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) | 484 | #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) |
485 | #define get_amp_offset(kc) (((kc)->private_value >> 23) & 0x3f) | ||
461 | 486 | ||
462 | /* | 487 | /* |
463 | * CEA Short Audio Descriptor data | 488 | * CEA Short Audio Descriptor data |
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index 144b85276d5a..93d7499350c6 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c | |||
@@ -399,8 +399,10 @@ static void print_conn_list(struct snd_info_buffer *buffer, | |||
399 | { | 399 | { |
400 | int c, curr = -1; | 400 | int c, curr = -1; |
401 | 401 | ||
402 | if (conn_len > 1 && wid_type != AC_WID_AUD_MIX && | 402 | if (conn_len > 1 && |
403 | wid_type != AC_WID_VOL_KNB) | 403 | wid_type != AC_WID_AUD_MIX && |
404 | wid_type != AC_WID_VOL_KNB && | ||
405 | wid_type != AC_WID_POWER) | ||
404 | curr = snd_hda_codec_read(codec, nid, 0, | 406 | curr = snd_hda_codec_read(codec, nid, 0, |
405 | AC_VERB_GET_CONNECT_SEL, 0); | 407 | AC_VERB_GET_CONNECT_SEL, 0); |
406 | snd_iprintf(buffer, " Connection: %d\n", conn_len); | 408 | snd_iprintf(buffer, " Connection: %d\n", conn_len); |
@@ -467,8 +469,9 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
467 | snd_iprintf(buffer, "Codec: %s\n", | 469 | snd_iprintf(buffer, "Codec: %s\n", |
468 | codec->name ? codec->name : "Not Set"); | 470 | codec->name ? codec->name : "Not Set"); |
469 | snd_iprintf(buffer, "Address: %d\n", codec->addr); | 471 | snd_iprintf(buffer, "Address: %d\n", codec->addr); |
470 | snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id); | 472 | snd_iprintf(buffer, "Function Id: 0x%x\n", codec->function_id); |
471 | snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id); | 473 | snd_iprintf(buffer, "Vendor Id: 0x%08x\n", codec->vendor_id); |
474 | snd_iprintf(buffer, "Subsystem Id: 0x%08x\n", codec->subsystem_id); | ||
472 | snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); | 475 | snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); |
473 | 476 | ||
474 | if (codec->mfg) | 477 | if (codec->mfg) |
@@ -554,8 +557,14 @@ static void print_codec_info(struct snd_info_entry *entry, | |||
554 | snd_iprintf(buffer, " Amp-Out caps: "); | 557 | snd_iprintf(buffer, " Amp-Out caps: "); |
555 | print_amp_caps(buffer, codec, nid, HDA_OUTPUT); | 558 | print_amp_caps(buffer, codec, nid, HDA_OUTPUT); |
556 | snd_iprintf(buffer, " Amp-Out vals: "); | 559 | snd_iprintf(buffer, " Amp-Out vals: "); |
557 | print_amp_vals(buffer, codec, nid, HDA_OUTPUT, | 560 | if (wid_type == AC_WID_PIN && |
558 | wid_caps & AC_WCAP_STEREO, 1); | 561 | codec->pin_amp_workaround) |
562 | print_amp_vals(buffer, codec, nid, HDA_OUTPUT, | ||
563 | wid_caps & AC_WCAP_STEREO, | ||
564 | conn_len); | ||
565 | else | ||
566 | print_amp_vals(buffer, codec, nid, HDA_OUTPUT, | ||
567 | wid_caps & AC_WCAP_STEREO, 1); | ||
559 | } | 568 | } |
560 | 569 | ||
561 | switch (wid_type) { | 570 | switch (wid_type) { |
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c index e48612323aa0..5bb48ee8b6c6 100644 --- a/sound/pci/hda/patch_analog.c +++ b/sound/pci/hda/patch_analog.c | |||
@@ -27,11 +27,12 @@ | |||
27 | #include <sound/core.h> | 27 | #include <sound/core.h> |
28 | #include "hda_codec.h" | 28 | #include "hda_codec.h" |
29 | #include "hda_local.h" | 29 | #include "hda_local.h" |
30 | #include "hda_beep.h" | ||
30 | 31 | ||
31 | struct ad198x_spec { | 32 | struct ad198x_spec { |
32 | struct snd_kcontrol_new *mixers[5]; | 33 | struct snd_kcontrol_new *mixers[5]; |
33 | int num_mixers; | 34 | int num_mixers; |
34 | 35 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | |
35 | const struct hda_verb *init_verbs[5]; /* initialization verbs | 36 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
36 | * don't forget NULL termination! | 37 | * don't forget NULL termination! |
37 | */ | 38 | */ |
@@ -154,6 +155,16 @@ static const char *ad_slave_sws[] = { | |||
154 | 155 | ||
155 | static void ad198x_free_kctls(struct hda_codec *codec); | 156 | static void ad198x_free_kctls(struct hda_codec *codec); |
156 | 157 | ||
158 | /* additional beep mixers; the actual parameters are overwritten at build */ | ||
159 | static struct snd_kcontrol_new ad_beep_mixer[] = { | ||
160 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT), | ||
161 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_OUTPUT), | ||
162 | { } /* end */ | ||
163 | }; | ||
164 | |||
165 | #define set_beep_amp(spec, nid, idx, dir) \ | ||
166 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir)) /* mono */ | ||
167 | |||
157 | static int ad198x_build_controls(struct hda_codec *codec) | 168 | static int ad198x_build_controls(struct hda_codec *codec) |
158 | { | 169 | { |
159 | struct ad198x_spec *spec = codec->spec; | 170 | struct ad198x_spec *spec = codec->spec; |
@@ -181,6 +192,21 @@ static int ad198x_build_controls(struct hda_codec *codec) | |||
181 | return err; | 192 | return err; |
182 | } | 193 | } |
183 | 194 | ||
195 | /* create beep controls if needed */ | ||
196 | if (spec->beep_amp) { | ||
197 | struct snd_kcontrol_new *knew; | ||
198 | for (knew = ad_beep_mixer; knew->name; knew++) { | ||
199 | struct snd_kcontrol *kctl; | ||
200 | kctl = snd_ctl_new1(knew, codec); | ||
201 | if (!kctl) | ||
202 | return -ENOMEM; | ||
203 | kctl->private_value = spec->beep_amp; | ||
204 | err = snd_hda_ctl_add(codec, kctl); | ||
205 | if (err < 0) | ||
206 | return err; | ||
207 | } | ||
208 | } | ||
209 | |||
184 | /* if we have no master control, let's create it */ | 210 | /* if we have no master control, let's create it */ |
185 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | 211 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { |
186 | unsigned int vmaster_tlv[4]; | 212 | unsigned int vmaster_tlv[4]; |
@@ -406,7 +432,8 @@ static void ad198x_free(struct hda_codec *codec) | |||
406 | return; | 432 | return; |
407 | 433 | ||
408 | ad198x_free_kctls(codec); | 434 | ad198x_free_kctls(codec); |
409 | kfree(codec->spec); | 435 | kfree(spec); |
436 | snd_hda_detach_beep_device(codec); | ||
410 | } | 437 | } |
411 | 438 | ||
412 | static struct hda_codec_ops ad198x_patch_ops = { | 439 | static struct hda_codec_ops ad198x_patch_ops = { |
@@ -545,8 +572,6 @@ static struct snd_kcontrol_new ad1986a_mixers[] = { | |||
545 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 572 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
546 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 573 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
547 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 574 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
548 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), | ||
549 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
550 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), | 575 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), |
551 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), | 576 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), |
552 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 577 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
@@ -610,8 +635,7 @@ static struct snd_kcontrol_new ad1986a_laptop_mixers[] = { | |||
610 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 635 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
611 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 636 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
612 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 637 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
613 | /* HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), | 638 | /* |
614 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
615 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), | 639 | HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), |
616 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), */ | 640 | HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), */ |
617 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 641 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
@@ -809,8 +833,6 @@ static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = { | |||
809 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 833 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
810 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 834 | HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
811 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), | 835 | HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), |
812 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x18, 0x0, HDA_OUTPUT), | ||
813 | HDA_CODEC_MUTE("Beep Playback Switch", 0x18, 0x0, HDA_OUTPUT), | ||
814 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), | 836 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), |
815 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), | 837 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), |
816 | { | 838 | { |
@@ -1002,10 +1024,8 @@ static struct snd_pci_quirk ad1986a_cfg_tbl[] = { | |||
1002 | SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD), | 1024 | SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba", AD1986A_LAPTOP_EAPD), |
1003 | SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), | 1025 | SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), |
1004 | SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), | 1026 | SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), |
1005 | SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_SAMSUNG), | ||
1006 | SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_SAMSUNG), | ||
1007 | SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_SAMSUNG), | ||
1008 | SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), | 1027 | SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), |
1028 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_SAMSUNG), | ||
1009 | SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), | 1029 | SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), |
1010 | SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP), | 1030 | SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP), |
1011 | SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), | 1031 | SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), |
@@ -1027,15 +1047,14 @@ static struct hda_amp_list ad1986a_loopbacks[] = { | |||
1027 | 1047 | ||
1028 | static int is_jack_available(struct hda_codec *codec, hda_nid_t nid) | 1048 | static int is_jack_available(struct hda_codec *codec, hda_nid_t nid) |
1029 | { | 1049 | { |
1030 | unsigned int conf = snd_hda_codec_read(codec, nid, 0, | 1050 | unsigned int conf = snd_hda_codec_get_pincfg(codec, nid); |
1031 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
1032 | return get_defcfg_connect(conf) != AC_JACK_PORT_NONE; | 1051 | return get_defcfg_connect(conf) != AC_JACK_PORT_NONE; |
1033 | } | 1052 | } |
1034 | 1053 | ||
1035 | static int patch_ad1986a(struct hda_codec *codec) | 1054 | static int patch_ad1986a(struct hda_codec *codec) |
1036 | { | 1055 | { |
1037 | struct ad198x_spec *spec; | 1056 | struct ad198x_spec *spec; |
1038 | int board_config; | 1057 | int err, board_config; |
1039 | 1058 | ||
1040 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 1059 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1041 | if (spec == NULL) | 1060 | if (spec == NULL) |
@@ -1043,6 +1062,13 @@ static int patch_ad1986a(struct hda_codec *codec) | |||
1043 | 1062 | ||
1044 | codec->spec = spec; | 1063 | codec->spec = spec; |
1045 | 1064 | ||
1065 | err = snd_hda_attach_beep_device(codec, 0x19); | ||
1066 | if (err < 0) { | ||
1067 | ad198x_free(codec); | ||
1068 | return err; | ||
1069 | } | ||
1070 | set_beep_amp(spec, 0x18, 0, HDA_OUTPUT); | ||
1071 | |||
1046 | spec->multiout.max_channels = 6; | 1072 | spec->multiout.max_channels = 6; |
1047 | spec->multiout.num_dacs = ARRAY_SIZE(ad1986a_dac_nids); | 1073 | spec->multiout.num_dacs = ARRAY_SIZE(ad1986a_dac_nids); |
1048 | spec->multiout.dac_nids = ad1986a_dac_nids; | 1074 | spec->multiout.dac_nids = ad1986a_dac_nids; |
@@ -1222,8 +1248,6 @@ static struct snd_kcontrol_new ad1983_mixers[] = { | |||
1222 | HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), | 1248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), |
1223 | HDA_CODEC_VOLUME("Line Playback Volume", 0x13, 0x0, HDA_OUTPUT), | 1249 | HDA_CODEC_VOLUME("Line Playback Volume", 0x13, 0x0, HDA_OUTPUT), |
1224 | HDA_CODEC_MUTE("Line Playback Switch", 0x13, 0x0, HDA_OUTPUT), | 1250 | HDA_CODEC_MUTE("Line Playback Switch", 0x13, 0x0, HDA_OUTPUT), |
1225 | HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x10, 1, 0x0, HDA_OUTPUT), | ||
1226 | HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x10, 1, 0x0, HDA_OUTPUT), | ||
1227 | HDA_CODEC_VOLUME("Mic Boost", 0x0c, 0x0, HDA_OUTPUT), | 1251 | HDA_CODEC_VOLUME("Mic Boost", 0x0c, 0x0, HDA_OUTPUT), |
1228 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), | 1252 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
1229 | HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), | 1253 | HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), |
@@ -1294,6 +1318,7 @@ static struct hda_amp_list ad1983_loopbacks[] = { | |||
1294 | static int patch_ad1983(struct hda_codec *codec) | 1318 | static int patch_ad1983(struct hda_codec *codec) |
1295 | { | 1319 | { |
1296 | struct ad198x_spec *spec; | 1320 | struct ad198x_spec *spec; |
1321 | int err; | ||
1297 | 1322 | ||
1298 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 1323 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1299 | if (spec == NULL) | 1324 | if (spec == NULL) |
@@ -1301,6 +1326,13 @@ static int patch_ad1983(struct hda_codec *codec) | |||
1301 | 1326 | ||
1302 | codec->spec = spec; | 1327 | codec->spec = spec; |
1303 | 1328 | ||
1329 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
1330 | if (err < 0) { | ||
1331 | ad198x_free(codec); | ||
1332 | return err; | ||
1333 | } | ||
1334 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
1335 | |||
1304 | spec->multiout.max_channels = 2; | 1336 | spec->multiout.max_channels = 2; |
1305 | spec->multiout.num_dacs = ARRAY_SIZE(ad1983_dac_nids); | 1337 | spec->multiout.num_dacs = ARRAY_SIZE(ad1983_dac_nids); |
1306 | spec->multiout.dac_nids = ad1983_dac_nids; | 1338 | spec->multiout.dac_nids = ad1983_dac_nids; |
@@ -1370,8 +1402,6 @@ static struct snd_kcontrol_new ad1981_mixers[] = { | |||
1370 | HDA_CODEC_MUTE("Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), | 1402 | HDA_CODEC_MUTE("Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), |
1371 | HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), | 1403 | HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), |
1372 | HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), | 1404 | HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), |
1373 | HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
1374 | HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x0d, 1, 0x0, HDA_OUTPUT), | ||
1375 | HDA_CODEC_VOLUME("Front Mic Boost", 0x08, 0x0, HDA_INPUT), | 1405 | HDA_CODEC_VOLUME("Front Mic Boost", 0x08, 0x0, HDA_INPUT), |
1376 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x0, HDA_INPUT), | 1406 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x0, HDA_INPUT), |
1377 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), | 1407 | HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), |
@@ -1416,8 +1446,8 @@ static struct hda_verb ad1981_init_verbs[] = { | |||
1416 | {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | 1446 | {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, |
1417 | {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, | 1447 | {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, |
1418 | /* Mic boost: 0dB */ | 1448 | /* Mic boost: 0dB */ |
1419 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | 1449 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1420 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, | 1450 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
1421 | /* Record selector: Front mic */ | 1451 | /* Record selector: Front mic */ |
1422 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, | 1452 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, |
1423 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, | 1453 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, |
@@ -1682,10 +1712,10 @@ static struct snd_pci_quirk ad1981_cfg_tbl[] = { | |||
1682 | SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), | 1712 | SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), |
1683 | SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD), | 1713 | SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD), |
1684 | /* All HP models */ | 1714 | /* All HP models */ |
1685 | SND_PCI_QUIRK(0x103c, 0, "HP nx", AD1981_HP), | 1715 | SND_PCI_QUIRK_VENDOR(0x103c, "HP nx", AD1981_HP), |
1686 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), | 1716 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), |
1687 | /* Lenovo Thinkpad T60/X60/Z6xx */ | 1717 | /* Lenovo Thinkpad T60/X60/Z6xx */ |
1688 | SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD), | 1718 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1981_THINKPAD), |
1689 | /* HP nx6320 (reversed SSID, H/W bug) */ | 1719 | /* HP nx6320 (reversed SSID, H/W bug) */ |
1690 | SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_HP), | 1720 | SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_HP), |
1691 | {} | 1721 | {} |
@@ -1694,7 +1724,7 @@ static struct snd_pci_quirk ad1981_cfg_tbl[] = { | |||
1694 | static int patch_ad1981(struct hda_codec *codec) | 1724 | static int patch_ad1981(struct hda_codec *codec) |
1695 | { | 1725 | { |
1696 | struct ad198x_spec *spec; | 1726 | struct ad198x_spec *spec; |
1697 | int board_config; | 1727 | int err, board_config; |
1698 | 1728 | ||
1699 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 1729 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
1700 | if (spec == NULL) | 1730 | if (spec == NULL) |
@@ -1702,6 +1732,13 @@ static int patch_ad1981(struct hda_codec *codec) | |||
1702 | 1732 | ||
1703 | codec->spec = spec; | 1733 | codec->spec = spec; |
1704 | 1734 | ||
1735 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
1736 | if (err < 0) { | ||
1737 | ad198x_free(codec); | ||
1738 | return err; | ||
1739 | } | ||
1740 | set_beep_amp(spec, 0x0d, 0, HDA_OUTPUT); | ||
1741 | |||
1705 | spec->multiout.max_channels = 2; | 1742 | spec->multiout.max_channels = 2; |
1706 | spec->multiout.num_dacs = ARRAY_SIZE(ad1981_dac_nids); | 1743 | spec->multiout.num_dacs = ARRAY_SIZE(ad1981_dac_nids); |
1707 | spec->multiout.dac_nids = ad1981_dac_nids; | 1744 | spec->multiout.dac_nids = ad1981_dac_nids; |
@@ -1988,9 +2025,6 @@ static struct snd_kcontrol_new ad1988_6stack_mixers2[] = { | |||
1988 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), | 2025 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), |
1989 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), | 2026 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), |
1990 | 2027 | ||
1991 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
1992 | HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
1993 | |||
1994 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 2028 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
1995 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 2029 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
1996 | 2030 | ||
@@ -2034,9 +2068,6 @@ static struct snd_kcontrol_new ad1988_3stack_mixers2[] = { | |||
2034 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), | 2068 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x4, HDA_INPUT), |
2035 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), | 2069 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), |
2036 | 2070 | ||
2037 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
2038 | HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
2039 | |||
2040 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 2071 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
2041 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 2072 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
2042 | 2073 | ||
@@ -2066,9 +2097,6 @@ static struct snd_kcontrol_new ad1988_laptop_mixers[] = { | |||
2066 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT), | 2097 | HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT), |
2067 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT), | 2098 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT), |
2068 | 2099 | ||
2069 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
2070 | HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
2071 | |||
2072 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), | 2100 | HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), |
2073 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 2101 | HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
2074 | 2102 | ||
@@ -2297,10 +2325,6 @@ static struct hda_verb ad1988_capture_init_verbs[] = { | |||
2297 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2325 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2298 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2326 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2299 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2327 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2300 | /* ADCs; muted */ | ||
2301 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2302 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2303 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2304 | 2328 | ||
2305 | { } | 2329 | { } |
2306 | }; | 2330 | }; |
@@ -2408,10 +2432,6 @@ static struct hda_verb ad1988_3stack_init_verbs[] = { | |||
2408 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2432 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2409 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2433 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2410 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2434 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2411 | /* ADCs; muted */ | ||
2412 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2413 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2414 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2415 | /* Analog Mix output amp */ | 2435 | /* Analog Mix output amp */ |
2416 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ | 2436 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ |
2417 | { } | 2437 | { } |
@@ -2483,10 +2503,6 @@ static struct hda_verb ad1988_laptop_init_verbs[] = { | |||
2483 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2503 | {0x0c, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2484 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2504 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2485 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, | 2505 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, |
2486 | /* ADCs; muted */ | ||
2487 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2488 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2489 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
2490 | /* Analog Mix output amp */ | 2506 | /* Analog Mix output amp */ |
2491 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ | 2507 | {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ |
2492 | { } | 2508 | { } |
@@ -2890,7 +2906,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec) | |||
2890 | 2906 | ||
2891 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 2907 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
2892 | 2908 | ||
2893 | if (spec->autocfg.dig_out_pin) | 2909 | if (spec->autocfg.dig_outs) |
2894 | spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; | 2910 | spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; |
2895 | if (spec->autocfg.dig_in_pin) | 2911 | if (spec->autocfg.dig_in_pin) |
2896 | spec->dig_in_nid = AD1988_SPDIF_IN; | 2912 | spec->dig_in_nid = AD1988_SPDIF_IN; |
@@ -2940,7 +2956,7 @@ static struct snd_pci_quirk ad1988_cfg_tbl[] = { | |||
2940 | static int patch_ad1988(struct hda_codec *codec) | 2956 | static int patch_ad1988(struct hda_codec *codec) |
2941 | { | 2957 | { |
2942 | struct ad198x_spec *spec; | 2958 | struct ad198x_spec *spec; |
2943 | int board_config; | 2959 | int err, board_config; |
2944 | 2960 | ||
2945 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 2961 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
2946 | if (spec == NULL) | 2962 | if (spec == NULL) |
@@ -2960,7 +2976,7 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2960 | 2976 | ||
2961 | if (board_config == AD1988_AUTO) { | 2977 | if (board_config == AD1988_AUTO) { |
2962 | /* automatic parse from the BIOS config */ | 2978 | /* automatic parse from the BIOS config */ |
2963 | int err = ad1988_parse_auto_config(codec); | 2979 | err = ad1988_parse_auto_config(codec); |
2964 | if (err < 0) { | 2980 | if (err < 0) { |
2965 | ad198x_free(codec); | 2981 | ad198x_free(codec); |
2966 | return err; | 2982 | return err; |
@@ -2970,6 +2986,13 @@ static int patch_ad1988(struct hda_codec *codec) | |||
2970 | } | 2986 | } |
2971 | } | 2987 | } |
2972 | 2988 | ||
2989 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
2990 | if (err < 0) { | ||
2991 | ad198x_free(codec); | ||
2992 | return err; | ||
2993 | } | ||
2994 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
2995 | |||
2973 | switch (board_config) { | 2996 | switch (board_config) { |
2974 | case AD1988_6STACK: | 2997 | case AD1988_6STACK: |
2975 | case AD1988_6STACK_DIG: | 2998 | case AD1988_6STACK_DIG: |
@@ -3126,12 +3149,6 @@ static struct snd_kcontrol_new ad1884_base_mixers[] = { | |||
3126 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | 3149 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x01, HDA_INPUT), |
3127 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), | 3150 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), |
3128 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), | 3151 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), |
3129 | /* | ||
3130 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3131 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3132 | HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT), | ||
3133 | HDA_CODEC_MUTE("Digital Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT), | ||
3134 | */ | ||
3135 | HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), | 3152 | HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), |
3136 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | 3153 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), |
3137 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3154 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3204,10 +3221,10 @@ static struct hda_verb ad1884_init_verbs[] = { | |||
3204 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, | 3221 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, |
3205 | /* Port-B (front mic) pin */ | 3222 | /* Port-B (front mic) pin */ |
3206 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3223 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3207 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3224 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3208 | /* Port-C (rear mic) pin */ | 3225 | /* Port-C (rear mic) pin */ |
3209 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3226 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3210 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3227 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3211 | /* Analog mixer; mute as default */ | 3228 | /* Analog mixer; mute as default */ |
3212 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | 3229 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, |
3213 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | 3230 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, |
@@ -3240,7 +3257,7 @@ static const char *ad1884_slave_vols[] = { | |||
3240 | "CD Playback Volume", | 3257 | "CD Playback Volume", |
3241 | "Internal Mic Playback Volume", | 3258 | "Internal Mic Playback Volume", |
3242 | "Docking Mic Playback Volume" | 3259 | "Docking Mic Playback Volume" |
3243 | "Beep Playback Volume", | 3260 | /* "Beep Playback Volume", */ |
3244 | "IEC958 Playback Volume", | 3261 | "IEC958 Playback Volume", |
3245 | NULL | 3262 | NULL |
3246 | }; | 3263 | }; |
@@ -3248,6 +3265,7 @@ static const char *ad1884_slave_vols[] = { | |||
3248 | static int patch_ad1884(struct hda_codec *codec) | 3265 | static int patch_ad1884(struct hda_codec *codec) |
3249 | { | 3266 | { |
3250 | struct ad198x_spec *spec; | 3267 | struct ad198x_spec *spec; |
3268 | int err; | ||
3251 | 3269 | ||
3252 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 3270 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
3253 | if (spec == NULL) | 3271 | if (spec == NULL) |
@@ -3255,6 +3273,13 @@ static int patch_ad1884(struct hda_codec *codec) | |||
3255 | 3273 | ||
3256 | codec->spec = spec; | 3274 | codec->spec = spec; |
3257 | 3275 | ||
3276 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
3277 | if (err < 0) { | ||
3278 | ad198x_free(codec); | ||
3279 | return err; | ||
3280 | } | ||
3281 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
3282 | |||
3258 | spec->multiout.max_channels = 2; | 3283 | spec->multiout.max_channels = 2; |
3259 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884_dac_nids); | 3284 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884_dac_nids); |
3260 | spec->multiout.dac_nids = ad1884_dac_nids; | 3285 | spec->multiout.dac_nids = ad1884_dac_nids; |
@@ -3321,8 +3346,6 @@ static struct snd_kcontrol_new ad1984_thinkpad_mixers[] = { | |||
3321 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | 3346 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), |
3322 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), | 3347 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), |
3323 | HDA_CODEC_VOLUME("Docking Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3348 | HDA_CODEC_VOLUME("Docking Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
3324 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3325 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3326 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3349 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
3327 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), | 3350 | HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), |
3328 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), | 3351 | HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT), |
@@ -3358,7 +3381,7 @@ static struct hda_verb ad1984_thinkpad_init_verbs[] = { | |||
3358 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3381 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3359 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3382 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
3360 | /* docking mic boost */ | 3383 | /* docking mic boost */ |
3361 | {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3384 | {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
3362 | /* Analog mixer - docking mic; mute as default */ | 3385 | /* Analog mixer - docking mic; mute as default */ |
3363 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, | 3386 | {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, |
3364 | /* enable EAPD bit */ | 3387 | /* enable EAPD bit */ |
@@ -3379,10 +3402,6 @@ static struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = { | |||
3379 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | 3402 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT), |
3380 | HDA_CODEC_VOLUME("Line-In Playback Volume", 0x20, 0x01, HDA_INPUT), | 3403 | HDA_CODEC_VOLUME("Line-In Playback Volume", 0x20, 0x01, HDA_INPUT), |
3381 | HDA_CODEC_MUTE("Line-In Playback Switch", 0x20, 0x01, HDA_INPUT), | 3404 | HDA_CODEC_MUTE("Line-In Playback Switch", 0x20, 0x01, HDA_INPUT), |
3382 | /* | ||
3383 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3384 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3385 | */ | ||
3386 | HDA_CODEC_VOLUME("Line-In Boost", 0x15, 0x0, HDA_INPUT), | 3405 | HDA_CODEC_VOLUME("Line-In Boost", 0x15, 0x0, HDA_INPUT), |
3387 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | 3406 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), |
3388 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3407 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3468,7 +3487,7 @@ static const char *ad1984_models[AD1984_MODELS] = { | |||
3468 | 3487 | ||
3469 | static struct snd_pci_quirk ad1984_cfg_tbl[] = { | 3488 | static struct snd_pci_quirk ad1984_cfg_tbl[] = { |
3470 | /* Lenovo Thinkpad T61/X61 */ | 3489 | /* Lenovo Thinkpad T61/X61 */ |
3471 | SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1984_THINKPAD), | 3490 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1984_THINKPAD), |
3472 | SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP), | 3491 | SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP), |
3473 | {} | 3492 | {} |
3474 | }; | 3493 | }; |
@@ -3561,8 +3580,6 @@ static struct snd_kcontrol_new ad1884a_base_mixers[] = { | |||
3561 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | 3580 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x04, HDA_INPUT), |
3562 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), | 3581 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), |
3563 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), | 3582 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), |
3564 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3565 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3566 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), | 3583 | HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), |
3567 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), | 3584 | HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), |
3568 | HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3585 | HDA_CODEC_VOLUME("Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
@@ -3622,10 +3639,10 @@ static struct hda_verb ad1884a_init_verbs[] = { | |||
3622 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3639 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
3623 | /* Port-B (front mic) pin */ | 3640 | /* Port-B (front mic) pin */ |
3624 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3641 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3625 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3642 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3626 | /* Port-C (rear line-in) pin */ | 3643 | /* Port-C (rear line-in) pin */ |
3627 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 3644 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
3628 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3645 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
3629 | /* Port-E (rear mic) pin */ | 3646 | /* Port-E (rear mic) pin */ |
3630 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | 3647 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, |
3631 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 3648 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
@@ -3695,8 +3712,6 @@ static struct snd_kcontrol_new ad1884a_laptop_mixers[] = { | |||
3695 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), | 3712 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x20, 0x01, HDA_INPUT), |
3696 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), | 3713 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), |
3697 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), | 3714 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), |
3698 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3699 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3700 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | 3715 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), |
3701 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), | 3716 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), |
3702 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), | 3717 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x25, 0x0, HDA_OUTPUT), |
@@ -3724,8 +3739,6 @@ static struct snd_kcontrol_new ad1884a_mobile_mixers[] = { | |||
3724 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), | 3739 | HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT), |
3725 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), | 3740 | HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), |
3726 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | 3741 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), |
3727 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3728 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3729 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), | 3742 | HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), |
3730 | HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT), | 3743 | HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT), |
3731 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3744 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3836,8 +3849,6 @@ static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = { | |||
3836 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), | 3849 | HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), |
3837 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), | 3850 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), |
3838 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), | 3851 | HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), |
3839 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT), | ||
3840 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT), | ||
3841 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), | 3852 | HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), |
3842 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), | 3853 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), |
3843 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), | 3854 | HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -3911,9 +3922,9 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | |||
3911 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), | 3922 | SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), |
3912 | SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), | 3923 | SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), |
3913 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), | 3924 | SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), |
3914 | SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP), | 3925 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x3070, "HP", AD1884A_MOBILE), |
3915 | SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), | 3926 | SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x30e0, "HP laptop", AD1884A_LAPTOP), |
3916 | SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), | 3927 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP), |
3917 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), | 3928 | SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), |
3918 | {} | 3929 | {} |
3919 | }; | 3930 | }; |
@@ -3921,7 +3932,7 @@ static struct snd_pci_quirk ad1884a_cfg_tbl[] = { | |||
3921 | static int patch_ad1884a(struct hda_codec *codec) | 3932 | static int patch_ad1884a(struct hda_codec *codec) |
3922 | { | 3933 | { |
3923 | struct ad198x_spec *spec; | 3934 | struct ad198x_spec *spec; |
3924 | int board_config; | 3935 | int err, board_config; |
3925 | 3936 | ||
3926 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 3937 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
3927 | if (spec == NULL) | 3938 | if (spec == NULL) |
@@ -3929,6 +3940,13 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
3929 | 3940 | ||
3930 | codec->spec = spec; | 3941 | codec->spec = spec; |
3931 | 3942 | ||
3943 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
3944 | if (err < 0) { | ||
3945 | ad198x_free(codec); | ||
3946 | return err; | ||
3947 | } | ||
3948 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
3949 | |||
3932 | spec->multiout.max_channels = 2; | 3950 | spec->multiout.max_channels = 2; |
3933 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884a_dac_nids); | 3951 | spec->multiout.num_dacs = ARRAY_SIZE(ad1884a_dac_nids); |
3934 | spec->multiout.dac_nids = ad1884a_dac_nids; | 3952 | spec->multiout.dac_nids = ad1884a_dac_nids; |
@@ -3966,6 +3984,14 @@ static int patch_ad1884a(struct hda_codec *codec) | |||
3966 | spec->multiout.dig_out_nid = 0; | 3984 | spec->multiout.dig_out_nid = 0; |
3967 | codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; | 3985 | codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; |
3968 | codec->patch_ops.init = ad1884a_hp_init; | 3986 | codec->patch_ops.init = ad1884a_hp_init; |
3987 | /* set the upper-limit for mixer amp to 0dB for avoiding the | ||
3988 | * possible damage by overloading | ||
3989 | */ | ||
3990 | snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, | ||
3991 | (0x17 << AC_AMPCAP_OFFSET_SHIFT) | | ||
3992 | (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | | ||
3993 | (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | | ||
3994 | (1 << AC_AMPCAP_MUTE_SHIFT)); | ||
3969 | break; | 3995 | break; |
3970 | case AD1884A_THINKPAD: | 3996 | case AD1884A_THINKPAD: |
3971 | spec->mixers[0] = ad1984a_thinkpad_mixers; | 3997 | spec->mixers[0] = ad1984a_thinkpad_mixers; |
@@ -4083,8 +4109,6 @@ static struct snd_kcontrol_new ad1882_loopback_mixers[] = { | |||
4083 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT), | 4109 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x04, HDA_INPUT), |
4084 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), | 4110 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), |
4085 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), | 4111 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), |
4086 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), | ||
4087 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), | ||
4088 | { } /* end */ | 4112 | { } /* end */ |
4089 | }; | 4113 | }; |
4090 | 4114 | ||
@@ -4097,8 +4121,6 @@ static struct snd_kcontrol_new ad1882a_loopback_mixers[] = { | |||
4097 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), | 4121 | HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x01, HDA_INPUT), |
4098 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), | 4122 | HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), |
4099 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), | 4123 | HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), |
4100 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT), | ||
4101 | HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT), | ||
4102 | HDA_CODEC_VOLUME("Digital Mic Boost", 0x1f, 0x0, HDA_INPUT), | 4124 | HDA_CODEC_VOLUME("Digital Mic Boost", 0x1f, 0x0, HDA_INPUT), |
4103 | { } /* end */ | 4125 | { } /* end */ |
4104 | }; | 4126 | }; |
@@ -4257,7 +4279,7 @@ static const char *ad1882_models[AD1986A_MODELS] = { | |||
4257 | static int patch_ad1882(struct hda_codec *codec) | 4279 | static int patch_ad1882(struct hda_codec *codec) |
4258 | { | 4280 | { |
4259 | struct ad198x_spec *spec; | 4281 | struct ad198x_spec *spec; |
4260 | int board_config; | 4282 | int err, board_config; |
4261 | 4283 | ||
4262 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 4284 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
4263 | if (spec == NULL) | 4285 | if (spec == NULL) |
@@ -4265,6 +4287,13 @@ static int patch_ad1882(struct hda_codec *codec) | |||
4265 | 4287 | ||
4266 | codec->spec = spec; | 4288 | codec->spec = spec; |
4267 | 4289 | ||
4290 | err = snd_hda_attach_beep_device(codec, 0x10); | ||
4291 | if (err < 0) { | ||
4292 | ad198x_free(codec); | ||
4293 | return err; | ||
4294 | } | ||
4295 | set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); | ||
4296 | |||
4268 | spec->multiout.max_channels = 6; | 4297 | spec->multiout.max_channels = 6; |
4269 | spec->multiout.num_dacs = 3; | 4298 | spec->multiout.num_dacs = 3; |
4270 | spec->multiout.dac_nids = ad1882_dac_nids; | 4299 | spec->multiout.dac_nids = ad1882_dac_nids; |
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index f3ebe837f2d5..c921264bbd71 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -680,13 +680,13 @@ static int patch_cmi9880(struct hda_codec *codec) | |||
680 | struct auto_pin_cfg cfg; | 680 | struct auto_pin_cfg cfg; |
681 | 681 | ||
682 | /* collect pin default configuration */ | 682 | /* collect pin default configuration */ |
683 | port_e = snd_hda_codec_read(codec, 0x0f, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | 683 | port_e = snd_hda_codec_get_pincfg(codec, 0x0f); |
684 | port_f = snd_hda_codec_read(codec, 0x10, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | 684 | port_f = snd_hda_codec_get_pincfg(codec, 0x10); |
685 | spec->front_panel = 1; | 685 | spec->front_panel = 1; |
686 | if (get_defcfg_connect(port_e) == AC_JACK_PORT_NONE || | 686 | if (get_defcfg_connect(port_e) == AC_JACK_PORT_NONE || |
687 | get_defcfg_connect(port_f) == AC_JACK_PORT_NONE) { | 687 | get_defcfg_connect(port_f) == AC_JACK_PORT_NONE) { |
688 | port_g = snd_hda_codec_read(codec, 0x1f, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | 688 | port_g = snd_hda_codec_get_pincfg(codec, 0x1f); |
689 | port_h = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | 689 | port_h = snd_hda_codec_get_pincfg(codec, 0x20); |
690 | spec->channel_modes = cmi9880_channel_modes; | 690 | spec->channel_modes = cmi9880_channel_modes; |
691 | /* no front panel */ | 691 | /* no front panel */ |
692 | if (get_defcfg_connect(port_g) == AC_JACK_PORT_NONE || | 692 | if (get_defcfg_connect(port_g) == AC_JACK_PORT_NONE || |
@@ -703,8 +703,8 @@ static int patch_cmi9880(struct hda_codec *codec) | |||
703 | spec->multiout.max_channels = cmi9880_channel_modes[0].channels; | 703 | spec->multiout.max_channels = cmi9880_channel_modes[0].channels; |
704 | } else { | 704 | } else { |
705 | spec->input_mux = &cmi9880_basic_mux; | 705 | spec->input_mux = &cmi9880_basic_mux; |
706 | port_spdifi = snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | 706 | port_spdifi = snd_hda_codec_get_pincfg(codec, 0x13); |
707 | port_spdifo = snd_hda_codec_read(codec, 0x12, 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | 707 | port_spdifo = snd_hda_codec_get_pincfg(codec, 0x12); |
708 | if (get_defcfg_connect(port_spdifo) != AC_JACK_PORT_NONE) | 708 | if (get_defcfg_connect(port_spdifo) != AC_JACK_PORT_NONE) |
709 | spec->multiout.dig_out_nid = CMI_DIG_OUT_NID; | 709 | spec->multiout.dig_out_nid = CMI_DIG_OUT_NID; |
710 | if (get_defcfg_connect(port_spdifi) != AC_JACK_PORT_NONE) | 710 | if (get_defcfg_connect(port_spdifi) != AC_JACK_PORT_NONE) |
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 0177ef8f4c9e..1f2ad76ca94b 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -58,6 +58,7 @@ struct conexant_spec { | |||
58 | 58 | ||
59 | struct snd_kcontrol_new *mixers[5]; | 59 | struct snd_kcontrol_new *mixers[5]; |
60 | int num_mixers; | 60 | int num_mixers; |
61 | hda_nid_t vmaster_nid; | ||
61 | 62 | ||
62 | const struct hda_verb *init_verbs[5]; /* initialization verbs | 63 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
63 | * don't forget NULL | 64 | * don't forget NULL |
@@ -72,6 +73,7 @@ struct conexant_spec { | |||
72 | */ | 73 | */ |
73 | unsigned int cur_eapd; | 74 | unsigned int cur_eapd; |
74 | unsigned int hp_present; | 75 | unsigned int hp_present; |
76 | unsigned int no_auto_mic; | ||
75 | unsigned int need_dac_fix; | 77 | unsigned int need_dac_fix; |
76 | 78 | ||
77 | /* capture */ | 79 | /* capture */ |
@@ -461,6 +463,29 @@ static void conexant_free(struct hda_codec *codec) | |||
461 | kfree(codec->spec); | 463 | kfree(codec->spec); |
462 | } | 464 | } |
463 | 465 | ||
466 | static struct snd_kcontrol_new cxt_capture_mixers[] = { | ||
467 | { | ||
468 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
469 | .name = "Capture Source", | ||
470 | .info = conexant_mux_enum_info, | ||
471 | .get = conexant_mux_enum_get, | ||
472 | .put = conexant_mux_enum_put | ||
473 | }, | ||
474 | {} | ||
475 | }; | ||
476 | |||
477 | static const char *slave_vols[] = { | ||
478 | "Headphone Playback Volume", | ||
479 | "Speaker Playback Volume", | ||
480 | NULL | ||
481 | }; | ||
482 | |||
483 | static const char *slave_sws[] = { | ||
484 | "Headphone Playback Switch", | ||
485 | "Speaker Playback Switch", | ||
486 | NULL | ||
487 | }; | ||
488 | |||
464 | static int conexant_build_controls(struct hda_codec *codec) | 489 | static int conexant_build_controls(struct hda_codec *codec) |
465 | { | 490 | { |
466 | struct conexant_spec *spec = codec->spec; | 491 | struct conexant_spec *spec = codec->spec; |
@@ -488,6 +513,32 @@ static int conexant_build_controls(struct hda_codec *codec) | |||
488 | if (err < 0) | 513 | if (err < 0) |
489 | return err; | 514 | return err; |
490 | } | 515 | } |
516 | |||
517 | /* if we have no master control, let's create it */ | ||
518 | if (spec->vmaster_nid && | ||
519 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | ||
520 | unsigned int vmaster_tlv[4]; | ||
521 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | ||
522 | HDA_OUTPUT, vmaster_tlv); | ||
523 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | ||
524 | vmaster_tlv, slave_vols); | ||
525 | if (err < 0) | ||
526 | return err; | ||
527 | } | ||
528 | if (spec->vmaster_nid && | ||
529 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | ||
530 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", | ||
531 | NULL, slave_sws); | ||
532 | if (err < 0) | ||
533 | return err; | ||
534 | } | ||
535 | |||
536 | if (spec->input_mux) { | ||
537 | err = snd_hda_add_new_ctls(codec, cxt_capture_mixers); | ||
538 | if (err < 0) | ||
539 | return err; | ||
540 | } | ||
541 | |||
491 | return 0; | 542 | return 0; |
492 | } | 543 | } |
493 | 544 | ||
@@ -719,13 +770,6 @@ static void cxt5045_hp_unsol_event(struct hda_codec *codec, | |||
719 | } | 770 | } |
720 | 771 | ||
721 | static struct snd_kcontrol_new cxt5045_mixers[] = { | 772 | static struct snd_kcontrol_new cxt5045_mixers[] = { |
722 | { | ||
723 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
724 | .name = "Capture Source", | ||
725 | .info = conexant_mux_enum_info, | ||
726 | .get = conexant_mux_enum_get, | ||
727 | .put = conexant_mux_enum_put | ||
728 | }, | ||
729 | HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), | 773 | HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), |
730 | HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), | 774 | HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), |
731 | HDA_CODEC_VOLUME("Ext Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), | 775 | HDA_CODEC_VOLUME("Ext Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), |
@@ -759,13 +803,6 @@ static struct snd_kcontrol_new cxt5045_benq_mixers[] = { | |||
759 | }; | 803 | }; |
760 | 804 | ||
761 | static struct snd_kcontrol_new cxt5045_mixers_hp530[] = { | 805 | static struct snd_kcontrol_new cxt5045_mixers_hp530[] = { |
762 | { | ||
763 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
764 | .name = "Capture Source", | ||
765 | .info = conexant_mux_enum_info, | ||
766 | .get = conexant_mux_enum_get, | ||
767 | .put = conexant_mux_enum_put | ||
768 | }, | ||
769 | HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), | 806 | HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), |
770 | HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), | 807 | HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), |
771 | HDA_CODEC_VOLUME("Ext Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), | 808 | HDA_CODEC_VOLUME("Ext Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), |
@@ -1002,15 +1039,9 @@ static const char *cxt5045_models[CXT5045_MODELS] = { | |||
1002 | }; | 1039 | }; |
1003 | 1040 | ||
1004 | static struct snd_pci_quirk cxt5045_cfg_tbl[] = { | 1041 | static struct snd_pci_quirk cxt5045_cfg_tbl[] = { |
1005 | SND_PCI_QUIRK(0x103c, 0x30a5, "HP", CXT5045_LAPTOP_HPSENSE), | ||
1006 | SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV Series", CXT5045_LAPTOP_HPSENSE), | ||
1007 | SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2120", CXT5045_LAPTOP_HPSENSE), | ||
1008 | SND_PCI_QUIRK(0x103c, 0x30b7, "HP DV6000Z", CXT5045_LAPTOP_HPSENSE), | ||
1009 | SND_PCI_QUIRK(0x103c, 0x30bb, "HP DV8000", CXT5045_LAPTOP_HPSENSE), | ||
1010 | SND_PCI_QUIRK(0x103c, 0x30cd, "HP DV Series", CXT5045_LAPTOP_HPSENSE), | ||
1011 | SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV9533EG", CXT5045_LAPTOP_HPSENSE), | ||
1012 | SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), | 1042 | SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), |
1013 | SND_PCI_QUIRK(0x103c, 0x30d9, "HP Spartan", CXT5045_LAPTOP_HPSENSE), | 1043 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", |
1044 | CXT5045_LAPTOP_HPSENSE), | ||
1014 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE), | 1045 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE), |
1015 | SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), | 1046 | SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), |
1016 | SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), | 1047 | SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), |
@@ -1020,8 +1051,8 @@ static struct snd_pci_quirk cxt5045_cfg_tbl[] = { | |||
1020 | SND_PCI_QUIRK(0x1509, 0x1e40, "FIC", CXT5045_LAPTOP_HPMICSENSE), | 1051 | SND_PCI_QUIRK(0x1509, 0x1e40, "FIC", CXT5045_LAPTOP_HPMICSENSE), |
1021 | SND_PCI_QUIRK(0x1509, 0x2f05, "FIC", CXT5045_LAPTOP_HPMICSENSE), | 1052 | SND_PCI_QUIRK(0x1509, 0x2f05, "FIC", CXT5045_LAPTOP_HPMICSENSE), |
1022 | SND_PCI_QUIRK(0x1509, 0x2f06, "FIC", CXT5045_LAPTOP_HPMICSENSE), | 1053 | SND_PCI_QUIRK(0x1509, 0x2f06, "FIC", CXT5045_LAPTOP_HPMICSENSE), |
1023 | SND_PCI_QUIRK(0x1631, 0xc106, "Packard Bell", CXT5045_LAPTOP_HPMICSENSE), | 1054 | SND_PCI_QUIRK_MASK(0x1631, 0xff00, 0xc100, "Packard Bell", |
1024 | SND_PCI_QUIRK(0x1631, 0xc107, "Packard Bell", CXT5045_LAPTOP_HPMICSENSE), | 1055 | CXT5045_LAPTOP_HPMICSENSE), |
1025 | SND_PCI_QUIRK(0x8086, 0x2111, "Conexant Reference board", CXT5045_LAPTOP_HPSENSE), | 1056 | SND_PCI_QUIRK(0x8086, 0x2111, "Conexant Reference board", CXT5045_LAPTOP_HPSENSE), |
1026 | {} | 1057 | {} |
1027 | }; | 1058 | }; |
@@ -1035,6 +1066,7 @@ static int patch_cxt5045(struct hda_codec *codec) | |||
1035 | if (!spec) | 1066 | if (!spec) |
1036 | return -ENOMEM; | 1067 | return -ENOMEM; |
1037 | codec->spec = spec; | 1068 | codec->spec = spec; |
1069 | codec->pin_amp_workaround = 1; | ||
1038 | 1070 | ||
1039 | spec->multiout.max_channels = 2; | 1071 | spec->multiout.max_channels = 2; |
1040 | spec->multiout.num_dacs = ARRAY_SIZE(cxt5045_dac_nids); | 1072 | spec->multiout.num_dacs = ARRAY_SIZE(cxt5045_dac_nids); |
@@ -1134,7 +1166,7 @@ static int patch_cxt5045(struct hda_codec *codec) | |||
1134 | /* Conexant 5047 specific */ | 1166 | /* Conexant 5047 specific */ |
1135 | #define CXT5047_SPDIF_OUT 0x11 | 1167 | #define CXT5047_SPDIF_OUT 0x11 |
1136 | 1168 | ||
1137 | static hda_nid_t cxt5047_dac_nids[2] = { 0x10, 0x1c }; | 1169 | static hda_nid_t cxt5047_dac_nids[1] = { 0x10 }; /* 0x1c */ |
1138 | static hda_nid_t cxt5047_adc_nids[1] = { 0x12 }; | 1170 | static hda_nid_t cxt5047_adc_nids[1] = { 0x12 }; |
1139 | static hda_nid_t cxt5047_capsrc_nids[1] = { 0x1a }; | 1171 | static hda_nid_t cxt5047_capsrc_nids[1] = { 0x1a }; |
1140 | 1172 | ||
@@ -1142,20 +1174,6 @@ static struct hda_channel_mode cxt5047_modes[1] = { | |||
1142 | { 2, NULL }, | 1174 | { 2, NULL }, |
1143 | }; | 1175 | }; |
1144 | 1176 | ||
1145 | static struct hda_input_mux cxt5047_capture_source = { | ||
1146 | .num_items = 1, | ||
1147 | .items = { | ||
1148 | { "Mic", 0x2 }, | ||
1149 | } | ||
1150 | }; | ||
1151 | |||
1152 | static struct hda_input_mux cxt5047_hp_capture_source = { | ||
1153 | .num_items = 1, | ||
1154 | .items = { | ||
1155 | { "ExtMic", 0x2 }, | ||
1156 | } | ||
1157 | }; | ||
1158 | |||
1159 | static struct hda_input_mux cxt5047_toshiba_capture_source = { | 1177 | static struct hda_input_mux cxt5047_toshiba_capture_source = { |
1160 | .num_items = 2, | 1178 | .num_items = 2, |
1161 | .items = { | 1179 | .items = { |
@@ -1179,7 +1197,11 @@ static int cxt5047_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |||
1179 | * the headphone jack | 1197 | * the headphone jack |
1180 | */ | 1198 | */ |
1181 | bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE; | 1199 | bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE; |
1182 | snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, | 1200 | /* NOTE: Conexat codec needs the index for *OUTPUT* amp of |
1201 | * pin widgets unlike other codecs. In this case, we need to | ||
1202 | * set index 0x01 for the volume from the mixer amp 0x19. | ||
1203 | */ | ||
1204 | snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0x01, | ||
1183 | HDA_AMP_MUTE, bits); | 1205 | HDA_AMP_MUTE, bits); |
1184 | bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE; | 1206 | bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE; |
1185 | snd_hda_codec_amp_stereo(codec, 0x13, HDA_OUTPUT, 0, | 1207 | snd_hda_codec_amp_stereo(codec, 0x13, HDA_OUTPUT, 0, |
@@ -1187,16 +1209,6 @@ static int cxt5047_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |||
1187 | return 1; | 1209 | return 1; |
1188 | } | 1210 | } |
1189 | 1211 | ||
1190 | /* bind volumes of both NID 0x13 (Headphones) and 0x1d (Speakers) */ | ||
1191 | static struct hda_bind_ctls cxt5047_bind_master_vol = { | ||
1192 | .ops = &snd_hda_bind_vol, | ||
1193 | .values = { | ||
1194 | HDA_COMPOSE_AMP_VAL(0x13, 3, 0, HDA_OUTPUT), | ||
1195 | HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT), | ||
1196 | 0 | ||
1197 | }, | ||
1198 | }; | ||
1199 | |||
1200 | /* mute internal speaker if HP is plugged */ | 1212 | /* mute internal speaker if HP is plugged */ |
1201 | static void cxt5047_hp_automute(struct hda_codec *codec) | 1213 | static void cxt5047_hp_automute(struct hda_codec *codec) |
1202 | { | 1214 | { |
@@ -1207,27 +1219,8 @@ static void cxt5047_hp_automute(struct hda_codec *codec) | |||
1207 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | 1219 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; |
1208 | 1220 | ||
1209 | bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; | 1221 | bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; |
1210 | snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, | 1222 | /* See the note in cxt5047_hp_master_sw_put */ |
1211 | HDA_AMP_MUTE, bits); | 1223 | snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0x01, |
1212 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ | ||
1213 | snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0, | ||
1214 | HDA_AMP_MUTE, bits); | ||
1215 | } | ||
1216 | |||
1217 | /* mute internal speaker if HP is plugged */ | ||
1218 | static void cxt5047_hp2_automute(struct hda_codec *codec) | ||
1219 | { | ||
1220 | struct conexant_spec *spec = codec->spec; | ||
1221 | unsigned int bits; | ||
1222 | |||
1223 | spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, | ||
1224 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
1225 | |||
1226 | bits = spec->hp_present ? HDA_AMP_MUTE : 0; | ||
1227 | snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, | ||
1228 | HDA_AMP_MUTE, bits); | ||
1229 | /* Mute/Unmute PCM 2 for good measure - some systems need this */ | ||
1230 | snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0, | ||
1231 | HDA_AMP_MUTE, bits); | 1224 | HDA_AMP_MUTE, bits); |
1232 | } | 1225 | } |
1233 | 1226 | ||
@@ -1268,55 +1261,14 @@ static void cxt5047_hp_unsol_event(struct hda_codec *codec, | |||
1268 | } | 1261 | } |
1269 | } | 1262 | } |
1270 | 1263 | ||
1271 | /* unsolicited event for HP jack sensing - non-EAPD systems */ | 1264 | static struct snd_kcontrol_new cxt5047_base_mixers[] = { |
1272 | static void cxt5047_hp2_unsol_event(struct hda_codec *codec, | 1265 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x19, 0x02, HDA_INPUT), |
1273 | unsigned int res) | 1266 | HDA_CODEC_MUTE("Mic Playback Switch", 0x19, 0x02, HDA_INPUT), |
1274 | { | 1267 | HDA_CODEC_VOLUME("Mic Boost", 0x1a, 0x0, HDA_OUTPUT), |
1275 | res >>= 26; | ||
1276 | switch (res) { | ||
1277 | case CONEXANT_HP_EVENT: | ||
1278 | cxt5047_hp2_automute(codec); | ||
1279 | break; | ||
1280 | case CONEXANT_MIC_EVENT: | ||
1281 | cxt5047_hp_automic(codec); | ||
1282 | break; | ||
1283 | } | ||
1284 | } | ||
1285 | |||
1286 | static struct snd_kcontrol_new cxt5047_mixers[] = { | ||
1287 | HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), | ||
1288 | HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), | ||
1289 | HDA_CODEC_VOLUME("Mic Gain Volume", 0x1a, 0x0, HDA_OUTPUT), | ||
1290 | HDA_CODEC_MUTE("Mic Gain Switch", 0x1a, 0x0, HDA_OUTPUT), | ||
1291 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), | 1268 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), |
1292 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), | 1269 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), |
1293 | HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), | 1270 | HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), |
1294 | HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), | 1271 | HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), |
1295 | HDA_CODEC_VOLUME("PCM-2 Volume", 0x1c, 0x00, HDA_OUTPUT), | ||
1296 | HDA_CODEC_MUTE("PCM-2 Switch", 0x1c, 0x00, HDA_OUTPUT), | ||
1297 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x00, HDA_OUTPUT), | ||
1298 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x1d, 0x00, HDA_OUTPUT), | ||
1299 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), | ||
1300 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x13, 0x00, HDA_OUTPUT), | ||
1301 | |||
1302 | {} | ||
1303 | }; | ||
1304 | |||
1305 | static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = { | ||
1306 | { | ||
1307 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1308 | .name = "Capture Source", | ||
1309 | .info = conexant_mux_enum_info, | ||
1310 | .get = conexant_mux_enum_get, | ||
1311 | .put = conexant_mux_enum_put | ||
1312 | }, | ||
1313 | HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), | ||
1314 | HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), | ||
1315 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), | ||
1316 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), | ||
1317 | HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), | ||
1318 | HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), | ||
1319 | HDA_BIND_VOL("Master Playback Volume", &cxt5047_bind_master_vol), | ||
1320 | { | 1272 | { |
1321 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1273 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1322 | .name = "Master Playback Switch", | 1274 | .name = "Master Playback Switch", |
@@ -1329,29 +1281,15 @@ static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = { | |||
1329 | {} | 1281 | {} |
1330 | }; | 1282 | }; |
1331 | 1283 | ||
1332 | static struct snd_kcontrol_new cxt5047_hp_mixers[] = { | 1284 | static struct snd_kcontrol_new cxt5047_hp_spk_mixers[] = { |
1333 | { | 1285 | /* See the note in cxt5047_hp_master_sw_put */ |
1334 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1286 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x01, HDA_OUTPUT), |
1335 | .name = "Capture Source", | 1287 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), |
1336 | .info = conexant_mux_enum_info, | 1288 | {} |
1337 | .get = conexant_mux_enum_get, | 1289 | }; |
1338 | .put = conexant_mux_enum_put | 1290 | |
1339 | }, | 1291 | static struct snd_kcontrol_new cxt5047_hp_only_mixers[] = { |
1340 | HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), | ||
1341 | HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19,0x02,HDA_INPUT), | ||
1342 | HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), | ||
1343 | HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), | ||
1344 | HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), | ||
1345 | HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), | ||
1346 | HDA_CODEC_VOLUME("Master Playback Volume", 0x13, 0x00, HDA_OUTPUT), | 1292 | HDA_CODEC_VOLUME("Master Playback Volume", 0x13, 0x00, HDA_OUTPUT), |
1347 | { | ||
1348 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1349 | .name = "Master Playback Switch", | ||
1350 | .info = cxt_eapd_info, | ||
1351 | .get = cxt_eapd_get, | ||
1352 | .put = cxt5047_hp_master_sw_put, | ||
1353 | .private_value = 0x13, | ||
1354 | }, | ||
1355 | { } /* end */ | 1293 | { } /* end */ |
1356 | }; | 1294 | }; |
1357 | 1295 | ||
@@ -1362,8 +1300,8 @@ static struct hda_verb cxt5047_init_verbs[] = { | |||
1362 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 }, | 1300 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN|AC_PINCTL_VREF_50 }, |
1363 | /* HP, Speaker */ | 1301 | /* HP, Speaker */ |
1364 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, | 1302 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, |
1365 | {0x13, AC_VERB_SET_CONNECT_SEL,0x1}, | 1303 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, /* mixer(0x19) */ |
1366 | {0x1d, AC_VERB_SET_CONNECT_SEL,0x0}, | 1304 | {0x1d, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mixer(0x19) */ |
1367 | /* Record selector: Mic */ | 1305 | /* Record selector: Mic */ |
1368 | {0x12, AC_VERB_SET_CONNECT_SEL,0x03}, | 1306 | {0x12, AC_VERB_SET_CONNECT_SEL,0x03}, |
1369 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, | 1307 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, |
@@ -1383,30 +1321,7 @@ static struct hda_verb cxt5047_init_verbs[] = { | |||
1383 | 1321 | ||
1384 | /* configuration for Toshiba Laptops */ | 1322 | /* configuration for Toshiba Laptops */ |
1385 | static struct hda_verb cxt5047_toshiba_init_verbs[] = { | 1323 | static struct hda_verb cxt5047_toshiba_init_verbs[] = { |
1386 | {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0 }, /* default on */ | 1324 | {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0}, /* default off */ |
1387 | /* pin sensing on HP and Mic jacks */ | ||
1388 | {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, | ||
1389 | {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT}, | ||
1390 | /* Speaker routing */ | ||
1391 | {0x1d, AC_VERB_SET_CONNECT_SEL,0x1}, | ||
1392 | {} | ||
1393 | }; | ||
1394 | |||
1395 | /* configuration for HP Laptops */ | ||
1396 | static struct hda_verb cxt5047_hp_init_verbs[] = { | ||
1397 | /* pin sensing on HP jack */ | ||
1398 | {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, | ||
1399 | /* 0x13 is actually shared by both HP and speaker; | ||
1400 | * setting the connection to 0 (=0x19) makes the master volume control | ||
1401 | * working mysteriouslly... | ||
1402 | */ | ||
1403 | {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
1404 | /* Record selector: Ext Mic */ | ||
1405 | {0x12, AC_VERB_SET_CONNECT_SEL,0x03}, | ||
1406 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, | ||
1407 | AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17}, | ||
1408 | /* Speaker routing */ | ||
1409 | {0x1d, AC_VERB_SET_CONNECT_SEL,0x1}, | ||
1410 | {} | 1325 | {} |
1411 | }; | 1326 | }; |
1412 | 1327 | ||
@@ -1571,11 +1486,9 @@ static const char *cxt5047_models[CXT5047_MODELS] = { | |||
1571 | }; | 1486 | }; |
1572 | 1487 | ||
1573 | static struct snd_pci_quirk cxt5047_cfg_tbl[] = { | 1488 | static struct snd_pci_quirk cxt5047_cfg_tbl[] = { |
1574 | SND_PCI_QUIRK(0x103c, 0x30a0, "HP DV1000", CXT5047_LAPTOP), | ||
1575 | SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), | 1489 | SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), |
1576 | SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP), | 1490 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", |
1577 | SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z", CXT5047_LAPTOP), | 1491 | CXT5047_LAPTOP), |
1578 | SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6700", CXT5047_LAPTOP), | ||
1579 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD), | 1492 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD), |
1580 | {} | 1493 | {} |
1581 | }; | 1494 | }; |
@@ -1589,6 +1502,7 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
1589 | if (!spec) | 1502 | if (!spec) |
1590 | return -ENOMEM; | 1503 | return -ENOMEM; |
1591 | codec->spec = spec; | 1504 | codec->spec = spec; |
1505 | codec->pin_amp_workaround = 1; | ||
1592 | 1506 | ||
1593 | spec->multiout.max_channels = 2; | 1507 | spec->multiout.max_channels = 2; |
1594 | spec->multiout.num_dacs = ARRAY_SIZE(cxt5047_dac_nids); | 1508 | spec->multiout.num_dacs = ARRAY_SIZE(cxt5047_dac_nids); |
@@ -1597,9 +1511,8 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
1597 | spec->num_adc_nids = 1; | 1511 | spec->num_adc_nids = 1; |
1598 | spec->adc_nids = cxt5047_adc_nids; | 1512 | spec->adc_nids = cxt5047_adc_nids; |
1599 | spec->capsrc_nids = cxt5047_capsrc_nids; | 1513 | spec->capsrc_nids = cxt5047_capsrc_nids; |
1600 | spec->input_mux = &cxt5047_capture_source; | ||
1601 | spec->num_mixers = 1; | 1514 | spec->num_mixers = 1; |
1602 | spec->mixers[0] = cxt5047_mixers; | 1515 | spec->mixers[0] = cxt5047_base_mixers; |
1603 | spec->num_init_verbs = 1; | 1516 | spec->num_init_verbs = 1; |
1604 | spec->init_verbs[0] = cxt5047_init_verbs; | 1517 | spec->init_verbs[0] = cxt5047_init_verbs; |
1605 | spec->spdif_route = 0; | 1518 | spec->spdif_route = 0; |
@@ -1613,21 +1526,22 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
1613 | cxt5047_cfg_tbl); | 1526 | cxt5047_cfg_tbl); |
1614 | switch (board_config) { | 1527 | switch (board_config) { |
1615 | case CXT5047_LAPTOP: | 1528 | case CXT5047_LAPTOP: |
1616 | codec->patch_ops.unsol_event = cxt5047_hp2_unsol_event; | 1529 | spec->num_mixers = 2; |
1530 | spec->mixers[1] = cxt5047_hp_spk_mixers; | ||
1531 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | ||
1617 | break; | 1532 | break; |
1618 | case CXT5047_LAPTOP_HP: | 1533 | case CXT5047_LAPTOP_HP: |
1619 | spec->input_mux = &cxt5047_hp_capture_source; | 1534 | spec->num_mixers = 2; |
1620 | spec->num_init_verbs = 2; | 1535 | spec->mixers[1] = cxt5047_hp_only_mixers; |
1621 | spec->init_verbs[1] = cxt5047_hp_init_verbs; | ||
1622 | spec->mixers[0] = cxt5047_hp_mixers; | ||
1623 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | 1536 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; |
1624 | codec->patch_ops.init = cxt5047_hp_init; | 1537 | codec->patch_ops.init = cxt5047_hp_init; |
1625 | break; | 1538 | break; |
1626 | case CXT5047_LAPTOP_EAPD: | 1539 | case CXT5047_LAPTOP_EAPD: |
1627 | spec->input_mux = &cxt5047_toshiba_capture_source; | 1540 | spec->input_mux = &cxt5047_toshiba_capture_source; |
1541 | spec->num_mixers = 2; | ||
1542 | spec->mixers[1] = cxt5047_hp_spk_mixers; | ||
1628 | spec->num_init_verbs = 2; | 1543 | spec->num_init_verbs = 2; |
1629 | spec->init_verbs[1] = cxt5047_toshiba_init_verbs; | 1544 | spec->init_verbs[1] = cxt5047_toshiba_init_verbs; |
1630 | spec->mixers[0] = cxt5047_toshiba_mixers; | ||
1631 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | 1545 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; |
1632 | break; | 1546 | break; |
1633 | #ifdef CONFIG_SND_DEBUG | 1547 | #ifdef CONFIG_SND_DEBUG |
@@ -1638,6 +1552,7 @@ static int patch_cxt5047(struct hda_codec *codec) | |||
1638 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; | 1552 | codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; |
1639 | #endif | 1553 | #endif |
1640 | } | 1554 | } |
1555 | spec->vmaster_nid = 0x13; | ||
1641 | return 0; | 1556 | return 0; |
1642 | } | 1557 | } |
1643 | 1558 | ||
@@ -1673,8 +1588,11 @@ static int cxt5051_hp_master_sw_put(struct snd_kcontrol *kcontrol, | |||
1673 | /* toggle input of built-in and mic jack appropriately */ | 1588 | /* toggle input of built-in and mic jack appropriately */ |
1674 | static void cxt5051_portb_automic(struct hda_codec *codec) | 1589 | static void cxt5051_portb_automic(struct hda_codec *codec) |
1675 | { | 1590 | { |
1591 | struct conexant_spec *spec = codec->spec; | ||
1676 | unsigned int present; | 1592 | unsigned int present; |
1677 | 1593 | ||
1594 | if (spec->no_auto_mic) | ||
1595 | return; | ||
1678 | present = snd_hda_codec_read(codec, 0x17, 0, | 1596 | present = snd_hda_codec_read(codec, 0x17, 0, |
1679 | AC_VERB_GET_PIN_SENSE, 0) & | 1597 | AC_VERB_GET_PIN_SENSE, 0) & |
1680 | AC_PINSENSE_PRESENCE; | 1598 | AC_PINSENSE_PRESENCE; |
@@ -1690,6 +1608,8 @@ static void cxt5051_portc_automic(struct hda_codec *codec) | |||
1690 | unsigned int present; | 1608 | unsigned int present; |
1691 | hda_nid_t new_adc; | 1609 | hda_nid_t new_adc; |
1692 | 1610 | ||
1611 | if (spec->no_auto_mic) | ||
1612 | return; | ||
1693 | present = snd_hda_codec_read(codec, 0x18, 0, | 1613 | present = snd_hda_codec_read(codec, 0x18, 0, |
1694 | AC_VERB_GET_PIN_SENSE, 0) & | 1614 | AC_VERB_GET_PIN_SENSE, 0) & |
1695 | AC_PINSENSE_PRESENCE; | 1615 | AC_PINSENSE_PRESENCE; |
@@ -1776,6 +1696,22 @@ static struct snd_kcontrol_new cxt5051_hp_mixers[] = { | |||
1776 | {} | 1696 | {} |
1777 | }; | 1697 | }; |
1778 | 1698 | ||
1699 | static struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = { | ||
1700 | HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x00, HDA_INPUT), | ||
1701 | HDA_CODEC_MUTE("Mic Switch", 0x14, 0x00, HDA_INPUT), | ||
1702 | HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT), | ||
1703 | { | ||
1704 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
1705 | .name = "Master Playback Switch", | ||
1706 | .info = cxt_eapd_info, | ||
1707 | .get = cxt_eapd_get, | ||
1708 | .put = cxt5051_hp_master_sw_put, | ||
1709 | .private_value = 0x1a, | ||
1710 | }, | ||
1711 | |||
1712 | {} | ||
1713 | }; | ||
1714 | |||
1779 | static struct hda_verb cxt5051_init_verbs[] = { | 1715 | static struct hda_verb cxt5051_init_verbs[] = { |
1780 | /* Line in, Mic */ | 1716 | /* Line in, Mic */ |
1781 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, | 1717 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, |
@@ -1806,6 +1742,66 @@ static struct hda_verb cxt5051_init_verbs[] = { | |||
1806 | { } /* end */ | 1742 | { } /* end */ |
1807 | }; | 1743 | }; |
1808 | 1744 | ||
1745 | static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = { | ||
1746 | /* Line in, Mic */ | ||
1747 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, | ||
1748 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1749 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0}, | ||
1750 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0}, | ||
1751 | /* SPK */ | ||
1752 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1753 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1754 | /* HP, Amp */ | ||
1755 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1756 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1757 | /* DAC1 */ | ||
1758 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1759 | /* Record selector: Int mic */ | ||
1760 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44}, | ||
1761 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x1}, | ||
1762 | /* SPDIF route: PCM */ | ||
1763 | {0x1c, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
1764 | /* EAPD */ | ||
1765 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ | ||
1766 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | ||
1767 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, | ||
1768 | { } /* end */ | ||
1769 | }; | ||
1770 | |||
1771 | static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = { | ||
1772 | /* Line in, Mic */ | ||
1773 | {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, | ||
1774 | {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1775 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, | ||
1776 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, | ||
1777 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
1778 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, | ||
1779 | /* SPK */ | ||
1780 | {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, | ||
1781 | {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1782 | /* HP, Amp */ | ||
1783 | {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1784 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1785 | /* Docking HP */ | ||
1786 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
1787 | {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
1788 | /* DAC1 */ | ||
1789 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
1790 | /* Record selector: Int mic */ | ||
1791 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44}, | ||
1792 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44}, | ||
1793 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44}, | ||
1794 | /* SPDIF route: PCM */ | ||
1795 | {0x1c, AC_VERB_SET_CONNECT_SEL, 0x0}, | ||
1796 | /* EAPD */ | ||
1797 | {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ | ||
1798 | {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | ||
1799 | {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, | ||
1800 | {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTC_EVENT}, | ||
1801 | {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, | ||
1802 | { } /* end */ | ||
1803 | }; | ||
1804 | |||
1809 | /* initialize jack-sensing, too */ | 1805 | /* initialize jack-sensing, too */ |
1810 | static int cxt5051_init(struct hda_codec *codec) | 1806 | static int cxt5051_init(struct hda_codec *codec) |
1811 | { | 1807 | { |
@@ -1823,18 +1819,24 @@ static int cxt5051_init(struct hda_codec *codec) | |||
1823 | enum { | 1819 | enum { |
1824 | CXT5051_LAPTOP, /* Laptops w/ EAPD support */ | 1820 | CXT5051_LAPTOP, /* Laptops w/ EAPD support */ |
1825 | CXT5051_HP, /* no docking */ | 1821 | CXT5051_HP, /* no docking */ |
1822 | CXT5051_HP_DV6736, /* HP without mic switch */ | ||
1823 | CXT5051_LENOVO_X200, /* Lenovo X200 laptop */ | ||
1826 | CXT5051_MODELS | 1824 | CXT5051_MODELS |
1827 | }; | 1825 | }; |
1828 | 1826 | ||
1829 | static const char *cxt5051_models[CXT5051_MODELS] = { | 1827 | static const char *cxt5051_models[CXT5051_MODELS] = { |
1830 | [CXT5051_LAPTOP] = "laptop", | 1828 | [CXT5051_LAPTOP] = "laptop", |
1831 | [CXT5051_HP] = "hp", | 1829 | [CXT5051_HP] = "hp", |
1830 | [CXT5051_HP_DV6736] = "hp-dv6736", | ||
1831 | [CXT5051_LENOVO_X200] = "lenovo-x200", | ||
1832 | }; | 1832 | }; |
1833 | 1833 | ||
1834 | static struct snd_pci_quirk cxt5051_cfg_tbl[] = { | 1834 | static struct snd_pci_quirk cxt5051_cfg_tbl[] = { |
1835 | SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6736", CXT5051_HP_DV6736), | ||
1835 | SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", | 1836 | SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", |
1836 | CXT5051_LAPTOP), | 1837 | CXT5051_LAPTOP), |
1837 | SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP), | 1838 | SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP), |
1839 | SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT5051_LENOVO_X200), | ||
1838 | {} | 1840 | {} |
1839 | }; | 1841 | }; |
1840 | 1842 | ||
@@ -1847,6 +1849,7 @@ static int patch_cxt5051(struct hda_codec *codec) | |||
1847 | if (!spec) | 1849 | if (!spec) |
1848 | return -ENOMEM; | 1850 | return -ENOMEM; |
1849 | codec->spec = spec; | 1851 | codec->spec = spec; |
1852 | codec->pin_amp_workaround = 1; | ||
1850 | 1853 | ||
1851 | codec->patch_ops = conexant_patch_ops; | 1854 | codec->patch_ops = conexant_patch_ops; |
1852 | codec->patch_ops.init = cxt5051_init; | 1855 | codec->patch_ops.init = cxt5051_init; |
@@ -1867,17 +1870,22 @@ static int patch_cxt5051(struct hda_codec *codec) | |||
1867 | spec->cur_adc = 0; | 1870 | spec->cur_adc = 0; |
1868 | spec->cur_adc_idx = 0; | 1871 | spec->cur_adc_idx = 0; |
1869 | 1872 | ||
1873 | codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; | ||
1874 | |||
1870 | board_config = snd_hda_check_board_config(codec, CXT5051_MODELS, | 1875 | board_config = snd_hda_check_board_config(codec, CXT5051_MODELS, |
1871 | cxt5051_models, | 1876 | cxt5051_models, |
1872 | cxt5051_cfg_tbl); | 1877 | cxt5051_cfg_tbl); |
1873 | switch (board_config) { | 1878 | switch (board_config) { |
1874 | case CXT5051_HP: | 1879 | case CXT5051_HP: |
1875 | codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; | ||
1876 | spec->mixers[0] = cxt5051_hp_mixers; | 1880 | spec->mixers[0] = cxt5051_hp_mixers; |
1877 | break; | 1881 | break; |
1878 | default: | 1882 | case CXT5051_HP_DV6736: |
1879 | case CXT5051_LAPTOP: | 1883 | spec->init_verbs[0] = cxt5051_hp_dv6736_init_verbs; |
1880 | codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; | 1884 | spec->mixers[0] = cxt5051_hp_dv6736_mixers; |
1885 | spec->no_auto_mic = 1; | ||
1886 | break; | ||
1887 | case CXT5051_LENOVO_X200: | ||
1888 | spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs; | ||
1881 | break; | 1889 | break; |
1882 | } | 1890 | } |
1883 | 1891 | ||
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 6c26afcb8262..82097790f6f3 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <sound/core.h> | 30 | #include <sound/core.h> |
31 | #include "hda_codec.h" | 31 | #include "hda_codec.h" |
32 | #include "hda_local.h" | 32 | #include "hda_local.h" |
33 | #include "hda_beep.h" | ||
33 | 34 | ||
34 | #define ALC880_FRONT_EVENT 0x01 | 35 | #define ALC880_FRONT_EVENT 0x01 |
35 | #define ALC880_DCVOL_EVENT 0x02 | 36 | #define ALC880_DCVOL_EVENT 0x02 |
@@ -77,6 +78,7 @@ enum { | |||
77 | ALC260_ACER, | 78 | ALC260_ACER, |
78 | ALC260_WILL, | 79 | ALC260_WILL, |
79 | ALC260_REPLACER_672V, | 80 | ALC260_REPLACER_672V, |
81 | ALC260_FAVORIT100, | ||
80 | #ifdef CONFIG_SND_DEBUG | 82 | #ifdef CONFIG_SND_DEBUG |
81 | ALC260_TEST, | 83 | ALC260_TEST, |
82 | #endif | 84 | #endif |
@@ -103,6 +105,7 @@ enum { | |||
103 | ALC262_NEC, | 105 | ALC262_NEC, |
104 | ALC262_TOSHIBA_S06, | 106 | ALC262_TOSHIBA_S06, |
105 | ALC262_TOSHIBA_RX1, | 107 | ALC262_TOSHIBA_RX1, |
108 | ALC262_TYAN, | ||
106 | ALC262_AUTO, | 109 | ALC262_AUTO, |
107 | ALC262_MODEL_LAST /* last tag */ | 110 | ALC262_MODEL_LAST /* last tag */ |
108 | }; | 111 | }; |
@@ -238,6 +241,13 @@ enum { | |||
238 | ALC883_MODEL_LAST, | 241 | ALC883_MODEL_LAST, |
239 | }; | 242 | }; |
240 | 243 | ||
244 | /* styles of capture selection */ | ||
245 | enum { | ||
246 | CAPT_MUX = 0, /* only mux based */ | ||
247 | CAPT_MIX, /* only mixer based */ | ||
248 | CAPT_1MUX_MIX, /* first mux and other mixers */ | ||
249 | }; | ||
250 | |||
241 | /* for GPIO Poll */ | 251 | /* for GPIO Poll */ |
242 | #define GPIO_MASK 0x03 | 252 | #define GPIO_MASK 0x03 |
243 | 253 | ||
@@ -246,6 +256,7 @@ struct alc_spec { | |||
246 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ | 256 | struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ |
247 | unsigned int num_mixers; | 257 | unsigned int num_mixers; |
248 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ | 258 | struct snd_kcontrol_new *cap_mixer; /* capture mixer */ |
259 | unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ | ||
249 | 260 | ||
250 | const struct hda_verb *init_verbs[5]; /* initialization verbs | 261 | const struct hda_verb *init_verbs[5]; /* initialization verbs |
251 | * don't forget NULL | 262 | * don't forget NULL |
@@ -269,13 +280,15 @@ struct alc_spec { | |||
269 | * dig_out_nid and hp_nid are optional | 280 | * dig_out_nid and hp_nid are optional |
270 | */ | 281 | */ |
271 | hda_nid_t alt_dac_nid; | 282 | hda_nid_t alt_dac_nid; |
283 | hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ | ||
284 | int dig_out_type; | ||
272 | 285 | ||
273 | /* capture */ | 286 | /* capture */ |
274 | unsigned int num_adc_nids; | 287 | unsigned int num_adc_nids; |
275 | hda_nid_t *adc_nids; | 288 | hda_nid_t *adc_nids; |
276 | hda_nid_t *capsrc_nids; | 289 | hda_nid_t *capsrc_nids; |
277 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ | 290 | hda_nid_t dig_in_nid; /* digital-in NID; optional */ |
278 | unsigned char is_mix_capture; /* matrix-style capture (non-mux) */ | 291 | int capture_style; /* capture style (CAPT_*) */ |
279 | 292 | ||
280 | /* capture source */ | 293 | /* capture source */ |
281 | unsigned int num_mux_defs; | 294 | unsigned int num_mux_defs; |
@@ -293,7 +306,7 @@ struct alc_spec { | |||
293 | /* dynamic controls, init_verbs and input_mux */ | 306 | /* dynamic controls, init_verbs and input_mux */ |
294 | struct auto_pin_cfg autocfg; | 307 | struct auto_pin_cfg autocfg; |
295 | struct snd_array kctls; | 308 | struct snd_array kctls; |
296 | struct hda_input_mux private_imux; | 309 | struct hda_input_mux private_imux[3]; |
297 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; | 310 | hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; |
298 | 311 | ||
299 | /* hooks */ | 312 | /* hooks */ |
@@ -305,6 +318,9 @@ struct alc_spec { | |||
305 | unsigned int jack_present: 1; | 318 | unsigned int jack_present: 1; |
306 | unsigned int master_sw: 1; | 319 | unsigned int master_sw: 1; |
307 | 320 | ||
321 | /* other flags */ | ||
322 | unsigned int no_analog :1; /* digital I/O only */ | ||
323 | |||
308 | /* for virtual master */ | 324 | /* for virtual master */ |
309 | hda_nid_t vmaster_nid; | 325 | hda_nid_t vmaster_nid; |
310 | #ifdef CONFIG_SND_HDA_POWER_SAVE | 326 | #ifdef CONFIG_SND_HDA_POWER_SAVE |
@@ -314,13 +330,6 @@ struct alc_spec { | |||
314 | /* for PLL fix */ | 330 | /* for PLL fix */ |
315 | hda_nid_t pll_nid; | 331 | hda_nid_t pll_nid; |
316 | unsigned int pll_coef_idx, pll_coef_bit; | 332 | unsigned int pll_coef_idx, pll_coef_bit; |
317 | |||
318 | #ifdef SND_HDA_NEEDS_RESUME | ||
319 | #define ALC_MAX_PINS 16 | ||
320 | unsigned int num_pins; | ||
321 | hda_nid_t pin_nids[ALC_MAX_PINS]; | ||
322 | unsigned int pin_cfgs[ALC_MAX_PINS]; | ||
323 | #endif | ||
324 | }; | 333 | }; |
325 | 334 | ||
326 | /* | 335 | /* |
@@ -336,6 +345,7 @@ struct alc_config_preset { | |||
336 | hda_nid_t *dac_nids; | 345 | hda_nid_t *dac_nids; |
337 | hda_nid_t dig_out_nid; /* optional */ | 346 | hda_nid_t dig_out_nid; /* optional */ |
338 | hda_nid_t hp_nid; /* optional */ | 347 | hda_nid_t hp_nid; /* optional */ |
348 | hda_nid_t *slave_dig_outs; | ||
339 | unsigned int num_adc_nids; | 349 | unsigned int num_adc_nids; |
340 | hda_nid_t *adc_nids; | 350 | hda_nid_t *adc_nids; |
341 | hda_nid_t *capsrc_nids; | 351 | hda_nid_t *capsrc_nids; |
@@ -392,7 +402,8 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, | |||
392 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; | 402 | mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; |
393 | imux = &spec->input_mux[mux_idx]; | 403 | imux = &spec->input_mux[mux_idx]; |
394 | 404 | ||
395 | if (spec->is_mix_capture) { | 405 | if (spec->capture_style && |
406 | !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { | ||
396 | /* Matrix-mixer style (e.g. ALC882) */ | 407 | /* Matrix-mixer style (e.g. ALC882) */ |
397 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; | 408 | unsigned int *cur_val = &spec->cur_mux[adc_idx]; |
398 | unsigned int i, idx; | 409 | unsigned int i, idx; |
@@ -750,6 +761,24 @@ static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol, | |||
750 | #endif /* CONFIG_SND_DEBUG */ | 761 | #endif /* CONFIG_SND_DEBUG */ |
751 | 762 | ||
752 | /* | 763 | /* |
764 | * set up the input pin config (depending on the given auto-pin type) | ||
765 | */ | ||
766 | static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, | ||
767 | int auto_pin_type) | ||
768 | { | ||
769 | unsigned int val = PIN_IN; | ||
770 | |||
771 | if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { | ||
772 | unsigned int pincap; | ||
773 | pincap = snd_hda_query_pin_caps(codec, nid); | ||
774 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; | ||
775 | if (pincap & AC_PINCAP_VREF_80) | ||
776 | val = PIN_VREF80; | ||
777 | } | ||
778 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); | ||
779 | } | ||
780 | |||
781 | /* | ||
753 | */ | 782 | */ |
754 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) | 783 | static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) |
755 | { | 784 | { |
@@ -810,6 +839,7 @@ static void setup_preset(struct alc_spec *spec, | |||
810 | spec->multiout.num_dacs = preset->num_dacs; | 839 | spec->multiout.num_dacs = preset->num_dacs; |
811 | spec->multiout.dac_nids = preset->dac_nids; | 840 | spec->multiout.dac_nids = preset->dac_nids; |
812 | spec->multiout.dig_out_nid = preset->dig_out_nid; | 841 | spec->multiout.dig_out_nid = preset->dig_out_nid; |
842 | spec->multiout.slave_dig_outs = preset->slave_dig_outs; | ||
813 | spec->multiout.hp_nid = preset->hp_nid; | 843 | spec->multiout.hp_nid = preset->hp_nid; |
814 | 844 | ||
815 | spec->num_mux_defs = preset->num_mux_defs; | 845 | spec->num_mux_defs = preset->num_mux_defs; |
@@ -921,7 +951,7 @@ static void alc_mic_automute(struct hda_codec *codec) | |||
921 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); | 951 | HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); |
922 | } | 952 | } |
923 | #else | 953 | #else |
924 | #define alc_mic_automute(codec) /* NOP */ | 954 | #define alc_mic_automute(codec) do {} while(0) /* NOP */ |
925 | #endif /* disabled */ | 955 | #endif /* disabled */ |
926 | 956 | ||
927 | /* unsolicited event for HP jack sensing */ | 957 | /* unsolicited event for HP jack sensing */ |
@@ -952,7 +982,7 @@ static void alc888_coef_init(struct hda_codec *codec) | |||
952 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); | 982 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 0); |
953 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); | 983 | tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); |
954 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); | 984 | snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); |
955 | if ((tmp & 0xf0) == 2) | 985 | if ((tmp & 0xf0) == 0x20) |
956 | /* alc888S-VC */ | 986 | /* alc888S-VC */ |
957 | snd_hda_codec_read(codec, 0x20, 0, | 987 | snd_hda_codec_read(codec, 0x20, 0, |
958 | AC_VERB_SET_PROC_COEF, 0x830); | 988 | AC_VERB_SET_PROC_COEF, 0x830); |
@@ -991,8 +1021,7 @@ static void alc_subsystem_id(struct hda_codec *codec, | |||
991 | nid = 0x1d; | 1021 | nid = 0x1d; |
992 | if (codec->vendor_id == 0x10ec0260) | 1022 | if (codec->vendor_id == 0x10ec0260) |
993 | nid = 0x17; | 1023 | nid = 0x17; |
994 | ass = snd_hda_codec_read(codec, nid, 0, | 1024 | ass = snd_hda_codec_get_pincfg(codec, nid); |
995 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
996 | if (!(ass & 1) && !(ass & 0x100000)) | 1025 | if (!(ass & 1) && !(ass & 0x100000)) |
997 | return; | 1026 | return; |
998 | if ((ass >> 30) != 1) /* no physical connection */ | 1027 | if ((ass >> 30) != 1) /* no physical connection */ |
@@ -1166,16 +1195,8 @@ static void alc_fix_pincfg(struct hda_codec *codec, | |||
1166 | return; | 1195 | return; |
1167 | 1196 | ||
1168 | cfg = pinfix[quirk->value]; | 1197 | cfg = pinfix[quirk->value]; |
1169 | for (; cfg->nid; cfg++) { | 1198 | for (; cfg->nid; cfg++) |
1170 | int i; | 1199 | snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); |
1171 | u32 val = cfg->val; | ||
1172 | for (i = 0; i < 4; i++) { | ||
1173 | snd_hda_codec_write(codec, cfg->nid, 0, | ||
1174 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, | ||
1175 | val & 0xff); | ||
1176 | val >>= 8; | ||
1177 | } | ||
1178 | } | ||
1179 | } | 1200 | } |
1180 | 1201 | ||
1181 | /* | 1202 | /* |
@@ -1375,8 +1396,6 @@ static struct snd_kcontrol_new alc888_base_mixer[] = { | |||
1375 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 1396 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
1376 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | 1397 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
1377 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 1398 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
1378 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
1379 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
1380 | { } /* end */ | 1399 | { } /* end */ |
1381 | }; | 1400 | }; |
1382 | 1401 | ||
@@ -1483,8 +1502,6 @@ static struct snd_kcontrol_new alc880_three_stack_mixer[] = { | |||
1483 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 1502 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
1484 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), | 1503 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), |
1485 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), | 1504 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), |
1486 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
1487 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
1488 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), | 1505 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), |
1489 | { | 1506 | { |
1490 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1507 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -1578,8 +1595,7 @@ static int alc_cap_sw_put(struct snd_kcontrol *kcontrol, | |||
1578 | snd_hda_mixer_amp_switch_put); | 1595 | snd_hda_mixer_amp_switch_put); |
1579 | } | 1596 | } |
1580 | 1597 | ||
1581 | #define DEFINE_CAPMIX(num) \ | 1598 | #define _DEFINE_CAPMIX(num) \ |
1582 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | ||
1583 | { \ | 1599 | { \ |
1584 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 1600 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1585 | .name = "Capture Switch", \ | 1601 | .name = "Capture Switch", \ |
@@ -1600,7 +1616,9 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |||
1600 | .get = alc_cap_vol_get, \ | 1616 | .get = alc_cap_vol_get, \ |
1601 | .put = alc_cap_vol_put, \ | 1617 | .put = alc_cap_vol_put, \ |
1602 | .tlv = { .c = alc_cap_vol_tlv }, \ | 1618 | .tlv = { .c = alc_cap_vol_tlv }, \ |
1603 | }, \ | 1619 | } |
1620 | |||
1621 | #define _DEFINE_CAPSRC(num) \ | ||
1604 | { \ | 1622 | { \ |
1605 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 1623 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
1606 | /* .name = "Capture Source", */ \ | 1624 | /* .name = "Capture Source", */ \ |
@@ -1609,15 +1627,28 @@ static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | |||
1609 | .info = alc_mux_enum_info, \ | 1627 | .info = alc_mux_enum_info, \ |
1610 | .get = alc_mux_enum_get, \ | 1628 | .get = alc_mux_enum_get, \ |
1611 | .put = alc_mux_enum_put, \ | 1629 | .put = alc_mux_enum_put, \ |
1612 | }, \ | 1630 | } |
1613 | { } /* end */ \ | 1631 | |
1632 | #define DEFINE_CAPMIX(num) \ | ||
1633 | static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ | ||
1634 | _DEFINE_CAPMIX(num), \ | ||
1635 | _DEFINE_CAPSRC(num), \ | ||
1636 | { } /* end */ \ | ||
1637 | } | ||
1638 | |||
1639 | #define DEFINE_CAPMIX_NOSRC(num) \ | ||
1640 | static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ | ||
1641 | _DEFINE_CAPMIX(num), \ | ||
1642 | { } /* end */ \ | ||
1614 | } | 1643 | } |
1615 | 1644 | ||
1616 | /* up to three ADCs */ | 1645 | /* up to three ADCs */ |
1617 | DEFINE_CAPMIX(1); | 1646 | DEFINE_CAPMIX(1); |
1618 | DEFINE_CAPMIX(2); | 1647 | DEFINE_CAPMIX(2); |
1619 | DEFINE_CAPMIX(3); | 1648 | DEFINE_CAPMIX(3); |
1620 | 1649 | DEFINE_CAPMIX_NOSRC(1); | |
1650 | DEFINE_CAPMIX_NOSRC(2); | ||
1651 | DEFINE_CAPMIX_NOSRC(3); | ||
1621 | 1652 | ||
1622 | /* | 1653 | /* |
1623 | * ALC880 5-stack model | 1654 | * ALC880 5-stack model |
@@ -1706,8 +1737,6 @@ static struct snd_kcontrol_new alc880_six_stack_mixer[] = { | |||
1706 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 1737 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
1707 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 1738 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
1708 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 1739 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
1709 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
1710 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
1711 | { | 1740 | { |
1712 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1741 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1713 | .name = "Channel Mode", | 1742 | .name = "Channel Mode", |
@@ -1884,13 +1913,6 @@ static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { | |||
1884 | { } /* end */ | 1913 | { } /* end */ |
1885 | }; | 1914 | }; |
1886 | 1915 | ||
1887 | /* additional mixers to alc880_asus_mixer */ | ||
1888 | static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { | ||
1889 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
1890 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
1891 | { } /* end */ | ||
1892 | }; | ||
1893 | |||
1894 | /* TCL S700 */ | 1916 | /* TCL S700 */ |
1895 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { | 1917 | static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { |
1896 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 1918 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
@@ -1923,8 +1945,6 @@ static struct snd_kcontrol_new alc880_uniwill_mixer[] = { | |||
1923 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 1945 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
1924 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 1946 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
1925 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 1947 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
1926 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
1927 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
1928 | { | 1948 | { |
1929 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1949 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1930 | .name = "Channel Mode", | 1950 | .name = "Channel Mode", |
@@ -1999,6 +2019,13 @@ static const char *alc_slave_sws[] = { | |||
1999 | 2019 | ||
2000 | static void alc_free_kctls(struct hda_codec *codec); | 2020 | static void alc_free_kctls(struct hda_codec *codec); |
2001 | 2021 | ||
2022 | /* additional beep mixers; the actual parameters are overwritten at build */ | ||
2023 | static struct snd_kcontrol_new alc_beep_mixer[] = { | ||
2024 | HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), | ||
2025 | HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), | ||
2026 | { } /* end */ | ||
2027 | }; | ||
2028 | |||
2002 | static int alc_build_controls(struct hda_codec *codec) | 2029 | static int alc_build_controls(struct hda_codec *codec) |
2003 | { | 2030 | { |
2004 | struct alc_spec *spec = codec->spec; | 2031 | struct alc_spec *spec = codec->spec; |
@@ -2020,11 +2047,13 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2020 | spec->multiout.dig_out_nid); | 2047 | spec->multiout.dig_out_nid); |
2021 | if (err < 0) | 2048 | if (err < 0) |
2022 | return err; | 2049 | return err; |
2023 | err = snd_hda_create_spdif_share_sw(codec, | 2050 | if (!spec->no_analog) { |
2024 | &spec->multiout); | 2051 | err = snd_hda_create_spdif_share_sw(codec, |
2025 | if (err < 0) | 2052 | &spec->multiout); |
2026 | return err; | 2053 | if (err < 0) |
2027 | spec->multiout.share_spdif = 1; | 2054 | return err; |
2055 | spec->multiout.share_spdif = 1; | ||
2056 | } | ||
2028 | } | 2057 | } |
2029 | if (spec->dig_in_nid) { | 2058 | if (spec->dig_in_nid) { |
2030 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); | 2059 | err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); |
@@ -2032,8 +2061,24 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2032 | return err; | 2061 | return err; |
2033 | } | 2062 | } |
2034 | 2063 | ||
2064 | /* create beep controls if needed */ | ||
2065 | if (spec->beep_amp) { | ||
2066 | struct snd_kcontrol_new *knew; | ||
2067 | for (knew = alc_beep_mixer; knew->name; knew++) { | ||
2068 | struct snd_kcontrol *kctl; | ||
2069 | kctl = snd_ctl_new1(knew, codec); | ||
2070 | if (!kctl) | ||
2071 | return -ENOMEM; | ||
2072 | kctl->private_value = spec->beep_amp; | ||
2073 | err = snd_hda_ctl_add(codec, kctl); | ||
2074 | if (err < 0) | ||
2075 | return err; | ||
2076 | } | ||
2077 | } | ||
2078 | |||
2035 | /* if we have no master control, let's create it */ | 2079 | /* if we have no master control, let's create it */ |
2036 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | 2080 | if (!spec->no_analog && |
2081 | !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { | ||
2037 | unsigned int vmaster_tlv[4]; | 2082 | unsigned int vmaster_tlv[4]; |
2038 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, | 2083 | snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, |
2039 | HDA_OUTPUT, vmaster_tlv); | 2084 | HDA_OUTPUT, vmaster_tlv); |
@@ -2042,7 +2087,8 @@ static int alc_build_controls(struct hda_codec *codec) | |||
2042 | if (err < 0) | 2087 | if (err < 0) |
2043 | return err; | 2088 | return err; |
2044 | } | 2089 | } |
2045 | if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | 2090 | if (!spec->no_analog && |
2091 | !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { | ||
2046 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", | 2092 | err = snd_hda_add_vmaster(codec, "Master Playback Switch", |
2047 | NULL, alc_slave_sws); | 2093 | NULL, alc_slave_sws); |
2048 | if (err < 0) | 2094 | if (err < 0) |
@@ -2951,6 +2997,14 @@ static int alc880_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
2951 | stream_tag, format, substream); | 2997 | stream_tag, format, substream); |
2952 | } | 2998 | } |
2953 | 2999 | ||
3000 | static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | ||
3001 | struct hda_codec *codec, | ||
3002 | struct snd_pcm_substream *substream) | ||
3003 | { | ||
3004 | struct alc_spec *spec = codec->spec; | ||
3005 | return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); | ||
3006 | } | ||
3007 | |||
2954 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, | 3008 | static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, |
2955 | struct hda_codec *codec, | 3009 | struct hda_codec *codec, |
2956 | struct snd_pcm_substream *substream) | 3010 | struct snd_pcm_substream *substream) |
@@ -3034,7 +3088,8 @@ static struct hda_pcm_stream alc880_pcm_digital_playback = { | |||
3034 | .ops = { | 3088 | .ops = { |
3035 | .open = alc880_dig_playback_pcm_open, | 3089 | .open = alc880_dig_playback_pcm_open, |
3036 | .close = alc880_dig_playback_pcm_close, | 3090 | .close = alc880_dig_playback_pcm_close, |
3037 | .prepare = alc880_dig_playback_pcm_prepare | 3091 | .prepare = alc880_dig_playback_pcm_prepare, |
3092 | .cleanup = alc880_dig_playback_pcm_cleanup | ||
3038 | }, | 3093 | }, |
3039 | }; | 3094 | }; |
3040 | 3095 | ||
@@ -3061,6 +3116,9 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
3061 | codec->num_pcms = 1; | 3116 | codec->num_pcms = 1; |
3062 | codec->pcm_info = info; | 3117 | codec->pcm_info = info; |
3063 | 3118 | ||
3119 | if (spec->no_analog) | ||
3120 | goto skip_analog; | ||
3121 | |||
3064 | info->name = spec->stream_name_analog; | 3122 | info->name = spec->stream_name_analog; |
3065 | if (spec->stream_analog_playback) { | 3123 | if (spec->stream_analog_playback) { |
3066 | if (snd_BUG_ON(!spec->multiout.dac_nids)) | 3124 | if (snd_BUG_ON(!spec->multiout.dac_nids)) |
@@ -3084,12 +3142,17 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
3084 | } | 3142 | } |
3085 | } | 3143 | } |
3086 | 3144 | ||
3145 | skip_analog: | ||
3087 | /* SPDIF for stream index #1 */ | 3146 | /* SPDIF for stream index #1 */ |
3088 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { | 3147 | if (spec->multiout.dig_out_nid || spec->dig_in_nid) { |
3089 | codec->num_pcms = 2; | 3148 | codec->num_pcms = 2; |
3149 | codec->slave_dig_outs = spec->multiout.slave_dig_outs; | ||
3090 | info = spec->pcm_rec + 1; | 3150 | info = spec->pcm_rec + 1; |
3091 | info->name = spec->stream_name_digital; | 3151 | info->name = spec->stream_name_digital; |
3092 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | 3152 | if (spec->dig_out_type) |
3153 | info->pcm_type = spec->dig_out_type; | ||
3154 | else | ||
3155 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | ||
3093 | if (spec->multiout.dig_out_nid && | 3156 | if (spec->multiout.dig_out_nid && |
3094 | spec->stream_digital_playback) { | 3157 | spec->stream_digital_playback) { |
3095 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); | 3158 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); |
@@ -3104,6 +3167,9 @@ static int alc_build_pcms(struct hda_codec *codec) | |||
3104 | codec->spdif_status_reset = 1; | 3167 | codec->spdif_status_reset = 1; |
3105 | } | 3168 | } |
3106 | 3169 | ||
3170 | if (spec->no_analog) | ||
3171 | return 0; | ||
3172 | |||
3107 | /* If the use of more than one ADC is requested for the current | 3173 | /* If the use of more than one ADC is requested for the current |
3108 | * model, configure a second analog capture-only PCM. | 3174 | * model, configure a second analog capture-only PCM. |
3109 | */ | 3175 | */ |
@@ -3162,65 +3228,17 @@ static void alc_free(struct hda_codec *codec) | |||
3162 | 3228 | ||
3163 | alc_free_kctls(codec); | 3229 | alc_free_kctls(codec); |
3164 | kfree(spec); | 3230 | kfree(spec); |
3165 | codec->spec = NULL; /* to be sure */ | 3231 | snd_hda_detach_beep_device(codec); |
3166 | } | 3232 | } |
3167 | 3233 | ||
3168 | #ifdef SND_HDA_NEEDS_RESUME | 3234 | #ifdef SND_HDA_NEEDS_RESUME |
3169 | static void store_pin_configs(struct hda_codec *codec) | ||
3170 | { | ||
3171 | struct alc_spec *spec = codec->spec; | ||
3172 | hda_nid_t nid, end_nid; | ||
3173 | |||
3174 | end_nid = codec->start_nid + codec->num_nodes; | ||
3175 | for (nid = codec->start_nid; nid < end_nid; nid++) { | ||
3176 | unsigned int wid_caps = get_wcaps(codec, nid); | ||
3177 | unsigned int wid_type = | ||
3178 | (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | ||
3179 | if (wid_type != AC_WID_PIN) | ||
3180 | continue; | ||
3181 | if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids)) | ||
3182 | break; | ||
3183 | spec->pin_nids[spec->num_pins] = nid; | ||
3184 | spec->pin_cfgs[spec->num_pins] = | ||
3185 | snd_hda_codec_read(codec, nid, 0, | ||
3186 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
3187 | spec->num_pins++; | ||
3188 | } | ||
3189 | } | ||
3190 | |||
3191 | static void resume_pin_configs(struct hda_codec *codec) | ||
3192 | { | ||
3193 | struct alc_spec *spec = codec->spec; | ||
3194 | int i; | ||
3195 | |||
3196 | for (i = 0; i < spec->num_pins; i++) { | ||
3197 | hda_nid_t pin_nid = spec->pin_nids[i]; | ||
3198 | unsigned int pin_config = spec->pin_cfgs[i]; | ||
3199 | snd_hda_codec_write(codec, pin_nid, 0, | ||
3200 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, | ||
3201 | pin_config & 0x000000ff); | ||
3202 | snd_hda_codec_write(codec, pin_nid, 0, | ||
3203 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, | ||
3204 | (pin_config & 0x0000ff00) >> 8); | ||
3205 | snd_hda_codec_write(codec, pin_nid, 0, | ||
3206 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, | ||
3207 | (pin_config & 0x00ff0000) >> 16); | ||
3208 | snd_hda_codec_write(codec, pin_nid, 0, | ||
3209 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, | ||
3210 | pin_config >> 24); | ||
3211 | } | ||
3212 | } | ||
3213 | |||
3214 | static int alc_resume(struct hda_codec *codec) | 3235 | static int alc_resume(struct hda_codec *codec) |
3215 | { | 3236 | { |
3216 | resume_pin_configs(codec); | ||
3217 | codec->patch_ops.init(codec); | 3237 | codec->patch_ops.init(codec); |
3218 | snd_hda_codec_resume_amp(codec); | 3238 | snd_hda_codec_resume_amp(codec); |
3219 | snd_hda_codec_resume_cache(codec); | 3239 | snd_hda_codec_resume_cache(codec); |
3220 | return 0; | 3240 | return 0; |
3221 | } | 3241 | } |
3222 | #else | ||
3223 | #define store_pin_configs(codec) | ||
3224 | #endif | 3242 | #endif |
3225 | 3243 | ||
3226 | /* | 3244 | /* |
@@ -3559,7 +3577,7 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = { | |||
3559 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), | 3577 | SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), |
3560 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), | 3578 | SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), |
3561 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), | 3579 | SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), |
3562 | SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */ | 3580 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ |
3563 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), | 3581 | SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), |
3564 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), | 3582 | SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), |
3565 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), | 3583 | SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), |
@@ -3602,7 +3620,8 @@ static struct snd_pci_quirk alc880_cfg_tbl[] = { | |||
3602 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), | 3620 | SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), |
3603 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), | 3621 | SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), |
3604 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), | 3622 | SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), |
3605 | SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ | 3623 | /* default Intel */ |
3624 | SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), | ||
3606 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), | 3625 | SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), |
3607 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), | 3626 | SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), |
3608 | {} | 3627 | {} |
@@ -3782,7 +3801,7 @@ static struct alc_config_preset alc880_presets[] = { | |||
3782 | .input_mux = &alc880_capture_source, | 3801 | .input_mux = &alc880_capture_source, |
3783 | }, | 3802 | }, |
3784 | [ALC880_UNIWILL_DIG] = { | 3803 | [ALC880_UNIWILL_DIG] = { |
3785 | .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, | 3804 | .mixers = { alc880_asus_mixer }, |
3786 | .init_verbs = { alc880_volume_init_verbs, | 3805 | .init_verbs = { alc880_volume_init_verbs, |
3787 | alc880_pin_asus_init_verbs }, | 3806 | alc880_pin_asus_init_verbs }, |
3788 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), | 3807 | .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), |
@@ -3820,8 +3839,7 @@ static struct alc_config_preset alc880_presets[] = { | |||
3820 | .init_hook = alc880_uniwill_p53_hp_automute, | 3839 | .init_hook = alc880_uniwill_p53_hp_automute, |
3821 | }, | 3840 | }, |
3822 | [ALC880_FUJITSU] = { | 3841 | [ALC880_FUJITSU] = { |
3823 | .mixers = { alc880_fujitsu_mixer, | 3842 | .mixers = { alc880_fujitsu_mixer }, |
3824 | alc880_pcbeep_mixer, }, | ||
3825 | .init_verbs = { alc880_volume_init_verbs, | 3843 | .init_verbs = { alc880_volume_init_verbs, |
3826 | alc880_uniwill_p53_init_verbs, | 3844 | alc880_uniwill_p53_init_verbs, |
3827 | alc880_beep_init_verbs }, | 3845 | alc880_beep_init_verbs }, |
@@ -4114,7 +4132,7 @@ static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, | |||
4114 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, | 4132 | static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, |
4115 | const struct auto_pin_cfg *cfg) | 4133 | const struct auto_pin_cfg *cfg) |
4116 | { | 4134 | { |
4117 | struct hda_input_mux *imux = &spec->private_imux; | 4135 | struct hda_input_mux *imux = &spec->private_imux[0]; |
4118 | int i, err, idx; | 4136 | int i, err, idx; |
4119 | 4137 | ||
4120 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 4138 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
@@ -4202,11 +4220,9 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) | |||
4202 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 4220 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
4203 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 4221 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
4204 | if (alc880_is_input_pin(nid)) { | 4222 | if (alc880_is_input_pin(nid)) { |
4205 | snd_hda_codec_write(codec, nid, 0, | 4223 | alc_set_input_pin(codec, nid, i); |
4206 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 4224 | if (nid != ALC880_PIN_CD_NID && |
4207 | i <= AUTO_PIN_FRONT_MIC ? | 4225 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
4208 | PIN_VREF80 : PIN_IN); | ||
4209 | if (nid != ALC880_PIN_CD_NID) | ||
4210 | snd_hda_codec_write(codec, nid, 0, | 4226 | snd_hda_codec_write(codec, nid, 0, |
4211 | AC_VERB_SET_AMP_GAIN_MUTE, | 4227 | AC_VERB_SET_AMP_GAIN_MUTE, |
4212 | AMP_OUT_MUTE); | 4228 | AMP_OUT_MUTE); |
@@ -4221,7 +4237,7 @@ static void alc880_auto_init_analog_input(struct hda_codec *codec) | |||
4221 | static int alc880_parse_auto_config(struct hda_codec *codec) | 4237 | static int alc880_parse_auto_config(struct hda_codec *codec) |
4222 | { | 4238 | { |
4223 | struct alc_spec *spec = codec->spec; | 4239 | struct alc_spec *spec = codec->spec; |
4224 | int err; | 4240 | int i, err; |
4225 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; | 4241 | static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; |
4226 | 4242 | ||
4227 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | 4243 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
@@ -4252,8 +4268,23 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
4252 | 4268 | ||
4253 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 4269 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
4254 | 4270 | ||
4255 | if (spec->autocfg.dig_out_pin) | 4271 | /* check multiple SPDIF-out (for recent codecs) */ |
4256 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | 4272 | for (i = 0; i < spec->autocfg.dig_outs; i++) { |
4273 | hda_nid_t dig_nid; | ||
4274 | err = snd_hda_get_connections(codec, | ||
4275 | spec->autocfg.dig_out_pins[i], | ||
4276 | &dig_nid, 1); | ||
4277 | if (err < 0) | ||
4278 | continue; | ||
4279 | if (!i) | ||
4280 | spec->multiout.dig_out_nid = dig_nid; | ||
4281 | else { | ||
4282 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | ||
4283 | spec->slave_dig_outs[i - 1] = dig_nid; | ||
4284 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) | ||
4285 | break; | ||
4286 | } | ||
4287 | } | ||
4257 | if (spec->autocfg.dig_in_pin) | 4288 | if (spec->autocfg.dig_in_pin) |
4258 | spec->dig_in_nid = ALC880_DIGIN_NID; | 4289 | spec->dig_in_nid = ALC880_DIGIN_NID; |
4259 | 4290 | ||
@@ -4263,9 +4294,8 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
4263 | add_verb(spec, alc880_volume_init_verbs); | 4294 | add_verb(spec, alc880_volume_init_verbs); |
4264 | 4295 | ||
4265 | spec->num_mux_defs = 1; | 4296 | spec->num_mux_defs = 1; |
4266 | spec->input_mux = &spec->private_imux; | 4297 | spec->input_mux = &spec->private_imux[0]; |
4267 | 4298 | ||
4268 | store_pin_configs(codec); | ||
4269 | return 1; | 4299 | return 1; |
4270 | } | 4300 | } |
4271 | 4301 | ||
@@ -4280,21 +4310,33 @@ static void alc880_auto_init(struct hda_codec *codec) | |||
4280 | alc_inithook(codec); | 4310 | alc_inithook(codec); |
4281 | } | 4311 | } |
4282 | 4312 | ||
4283 | /* | ||
4284 | * OK, here we have finally the patch for ALC880 | ||
4285 | */ | ||
4286 | |||
4287 | static void set_capture_mixer(struct alc_spec *spec) | 4313 | static void set_capture_mixer(struct alc_spec *spec) |
4288 | { | 4314 | { |
4289 | static struct snd_kcontrol_new *caps[3] = { | 4315 | static struct snd_kcontrol_new *caps[2][3] = { |
4290 | alc_capture_mixer1, | 4316 | { alc_capture_mixer_nosrc1, |
4291 | alc_capture_mixer2, | 4317 | alc_capture_mixer_nosrc2, |
4292 | alc_capture_mixer3, | 4318 | alc_capture_mixer_nosrc3 }, |
4319 | { alc_capture_mixer1, | ||
4320 | alc_capture_mixer2, | ||
4321 | alc_capture_mixer3 }, | ||
4293 | }; | 4322 | }; |
4294 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) | 4323 | if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { |
4295 | spec->cap_mixer = caps[spec->num_adc_nids - 1]; | 4324 | int mux; |
4325 | if (spec->input_mux && spec->input_mux->num_items > 1) | ||
4326 | mux = 1; | ||
4327 | else | ||
4328 | mux = 0; | ||
4329 | spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; | ||
4330 | } | ||
4296 | } | 4331 | } |
4297 | 4332 | ||
4333 | #define set_beep_amp(spec, nid, idx, dir) \ | ||
4334 | ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) | ||
4335 | |||
4336 | /* | ||
4337 | * OK, here we have finally the patch for ALC880 | ||
4338 | */ | ||
4339 | |||
4298 | static int patch_alc880(struct hda_codec *codec) | 4340 | static int patch_alc880(struct hda_codec *codec) |
4299 | { | 4341 | { |
4300 | struct alc_spec *spec; | 4342 | struct alc_spec *spec; |
@@ -4330,6 +4372,12 @@ static int patch_alc880(struct hda_codec *codec) | |||
4330 | } | 4372 | } |
4331 | } | 4373 | } |
4332 | 4374 | ||
4375 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
4376 | if (err < 0) { | ||
4377 | alc_free(codec); | ||
4378 | return err; | ||
4379 | } | ||
4380 | |||
4333 | if (board_config != ALC880_AUTO) | 4381 | if (board_config != ALC880_AUTO) |
4334 | setup_preset(spec, &alc880_presets[board_config]); | 4382 | setup_preset(spec, &alc880_presets[board_config]); |
4335 | 4383 | ||
@@ -4356,6 +4404,7 @@ static int patch_alc880(struct hda_codec *codec) | |||
4356 | } | 4404 | } |
4357 | } | 4405 | } |
4358 | set_capture_mixer(spec); | 4406 | set_capture_mixer(spec); |
4407 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
4359 | 4408 | ||
4360 | spec->vmaster_nid = 0x0c; | 4409 | spec->vmaster_nid = 0x0c; |
4361 | 4410 | ||
@@ -4463,6 +4512,26 @@ static struct hda_input_mux alc260_acer_capture_sources[2] = { | |||
4463 | }, | 4512 | }, |
4464 | }, | 4513 | }, |
4465 | }; | 4514 | }; |
4515 | |||
4516 | /* Maxdata Favorit 100XS */ | ||
4517 | static struct hda_input_mux alc260_favorit100_capture_sources[2] = { | ||
4518 | { | ||
4519 | .num_items = 2, | ||
4520 | .items = { | ||
4521 | { "Line/Mic", 0x0 }, | ||
4522 | { "CD", 0x4 }, | ||
4523 | }, | ||
4524 | }, | ||
4525 | { | ||
4526 | .num_items = 3, | ||
4527 | .items = { | ||
4528 | { "Line/Mic", 0x0 }, | ||
4529 | { "CD", 0x4 }, | ||
4530 | { "Mixer", 0x5 }, | ||
4531 | }, | ||
4532 | }, | ||
4533 | }; | ||
4534 | |||
4466 | /* | 4535 | /* |
4467 | * This is just place-holder, so there's something for alc_build_pcms to look | 4536 | * This is just place-holder, so there's something for alc_build_pcms to look |
4468 | * at when it calculates the maximum number of channels. ALC260 has no mixer | 4537 | * at when it calculates the maximum number of channels. ALC260 has no mixer |
@@ -4505,12 +4574,6 @@ static struct snd_kcontrol_new alc260_input_mixer[] = { | |||
4505 | { } /* end */ | 4574 | { } /* end */ |
4506 | }; | 4575 | }; |
4507 | 4576 | ||
4508 | static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { | ||
4509 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), | ||
4510 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), | ||
4511 | { } /* end */ | ||
4512 | }; | ||
4513 | |||
4514 | /* update HP, line and mono out pins according to the master switch */ | 4577 | /* update HP, line and mono out pins according to the master switch */ |
4515 | static void alc260_hp_master_update(struct hda_codec *codec, | 4578 | static void alc260_hp_master_update(struct hda_codec *codec, |
4516 | hda_nid_t hp, hda_nid_t line, | 4579 | hda_nid_t hp, hda_nid_t line, |
@@ -4702,8 +4765,6 @@ static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { | |||
4702 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), | 4765 | HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), |
4703 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), | 4766 | HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), |
4704 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), | 4767 | ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), |
4705 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | ||
4706 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | ||
4707 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), | 4768 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), |
4708 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), | 4769 | HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), |
4709 | { } /* end */ | 4770 | { } /* end */ |
@@ -4748,8 +4809,18 @@ static struct snd_kcontrol_new alc260_acer_mixer[] = { | |||
4748 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), | 4809 | HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), |
4749 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), | 4810 | HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), |
4750 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | 4811 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
4751 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | 4812 | { } /* end */ |
4752 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | 4813 | }; |
4814 | |||
4815 | /* Maxdata Favorit 100XS: one output and one input (0x12) jack | ||
4816 | */ | ||
4817 | static struct snd_kcontrol_new alc260_favorit100_mixer[] = { | ||
4818 | HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), | ||
4819 | HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), | ||
4820 | ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), | ||
4821 | HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), | ||
4822 | HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), | ||
4823 | ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), | ||
4753 | { } /* end */ | 4824 | { } /* end */ |
4754 | }; | 4825 | }; |
4755 | 4826 | ||
@@ -4767,8 +4838,6 @@ static struct snd_kcontrol_new alc260_will_mixer[] = { | |||
4767 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), | 4838 | ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), |
4768 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | 4839 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
4769 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | 4840 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
4770 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | ||
4771 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | ||
4772 | { } /* end */ | 4841 | { } /* end */ |
4773 | }; | 4842 | }; |
4774 | 4843 | ||
@@ -5126,6 +5195,89 @@ static struct hda_verb alc260_acer_init_verbs[] = { | |||
5126 | { } | 5195 | { } |
5127 | }; | 5196 | }; |
5128 | 5197 | ||
5198 | /* Initialisation sequence for Maxdata Favorit 100XS | ||
5199 | * (adapted from Acer init verbs). | ||
5200 | */ | ||
5201 | static struct hda_verb alc260_favorit100_init_verbs[] = { | ||
5202 | /* GPIO 0 enables the output jack. | ||
5203 | * Turn this on and rely on the standard mute | ||
5204 | * methods whenever the user wants to turn these outputs off. | ||
5205 | */ | ||
5206 | {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, | ||
5207 | {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, | ||
5208 | {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, | ||
5209 | /* Line/Mic input jack is connected to Mic1 pin */ | ||
5210 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, | ||
5211 | /* Ensure all other unused pins are disabled and muted. */ | ||
5212 | {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
5213 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5214 | {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
5215 | {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5216 | {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
5217 | {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5218 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
5219 | {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5220 | {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, | ||
5221 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5222 | /* Disable digital (SPDIF) pins */ | ||
5223 | {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
5224 | {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, | ||
5225 | |||
5226 | /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum | ||
5227 | * bus when acting as outputs. | ||
5228 | */ | ||
5229 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, | ||
5230 | {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, | ||
5231 | |||
5232 | /* Start with output sum widgets muted and their output gains at min */ | ||
5233 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5234 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
5235 | {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
5236 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5237 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
5238 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
5239 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5240 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, | ||
5241 | {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
5242 | |||
5243 | /* Unmute Line-out pin widget amp left and right | ||
5244 | * (no equiv mixer ctrl) | ||
5245 | */ | ||
5246 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, | ||
5247 | /* Unmute Mic1 and Line1 pin widget input buffers since they start as | ||
5248 | * inputs. If the pin mode is changed by the user the pin mode control | ||
5249 | * will take care of enabling the pin's input/output buffers as needed. | ||
5250 | * Therefore there's no need to enable the input buffer at this | ||
5251 | * stage. | ||
5252 | */ | ||
5253 | {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
5254 | |||
5255 | /* Mute capture amp left and right */ | ||
5256 | {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5257 | /* Set ADC connection select to match default mixer setting - mic | ||
5258 | * (on mic1 pin) | ||
5259 | */ | ||
5260 | {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
5261 | |||
5262 | /* Do similar with the second ADC: mute capture input amp and | ||
5263 | * set ADC connection to mic to match ALSA's default state. | ||
5264 | */ | ||
5265 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, | ||
5266 | {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
5267 | |||
5268 | /* Mute all inputs to mixer widget (even unconnected ones) */ | ||
5269 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ | ||
5270 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ | ||
5271 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ | ||
5272 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ | ||
5273 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ | ||
5274 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ | ||
5275 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ | ||
5276 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ | ||
5277 | |||
5278 | { } | ||
5279 | }; | ||
5280 | |||
5129 | static struct hda_verb alc260_will_verbs[] = { | 5281 | static struct hda_verb alc260_will_verbs[] = { |
5130 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | 5282 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, |
5131 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, | 5283 | {0x0b, AC_VERB_SET_CONNECT_SEL, 0x00}, |
@@ -5272,8 +5424,6 @@ static struct snd_kcontrol_new alc260_test_mixer[] = { | |||
5272 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), | 5424 | HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), |
5273 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), | 5425 | HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), |
5274 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), | 5426 | HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), |
5275 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), | ||
5276 | HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), | ||
5277 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), | 5427 | HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), |
5278 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), | 5428 | HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), |
5279 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), | 5429 | HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), |
@@ -5471,7 +5621,7 @@ static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
5471 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, | 5621 | static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, |
5472 | const struct auto_pin_cfg *cfg) | 5622 | const struct auto_pin_cfg *cfg) |
5473 | { | 5623 | { |
5474 | struct hda_input_mux *imux = &spec->private_imux; | 5624 | struct hda_input_mux *imux = &spec->private_imux[0]; |
5475 | int i, err, idx; | 5625 | int i, err, idx; |
5476 | 5626 | ||
5477 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 5627 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
@@ -5546,11 +5696,9 @@ static void alc260_auto_init_analog_input(struct hda_codec *codec) | |||
5546 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 5696 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
5547 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 5697 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
5548 | if (nid >= 0x12) { | 5698 | if (nid >= 0x12) { |
5549 | snd_hda_codec_write(codec, nid, 0, | 5699 | alc_set_input_pin(codec, nid, i); |
5550 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 5700 | if (nid != ALC260_PIN_CD_NID && |
5551 | i <= AUTO_PIN_FRONT_MIC ? | 5701 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
5552 | PIN_VREF80 : PIN_IN); | ||
5553 | if (nid != ALC260_PIN_CD_NID) | ||
5554 | snd_hda_codec_write(codec, nid, 0, | 5702 | snd_hda_codec_write(codec, nid, 0, |
5555 | AC_VERB_SET_AMP_GAIN_MUTE, | 5703 | AC_VERB_SET_AMP_GAIN_MUTE, |
5556 | AMP_OUT_MUTE); | 5704 | AMP_OUT_MUTE); |
@@ -5623,7 +5771,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
5623 | 5771 | ||
5624 | spec->multiout.max_channels = 2; | 5772 | spec->multiout.max_channels = 2; |
5625 | 5773 | ||
5626 | if (spec->autocfg.dig_out_pin) | 5774 | if (spec->autocfg.dig_outs) |
5627 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; | 5775 | spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; |
5628 | if (spec->kctls.list) | 5776 | if (spec->kctls.list) |
5629 | add_mixer(spec, spec->kctls.list); | 5777 | add_mixer(spec, spec->kctls.list); |
@@ -5631,9 +5779,8 @@ static int alc260_parse_auto_config(struct hda_codec *codec) | |||
5631 | add_verb(spec, alc260_volume_init_verbs); | 5779 | add_verb(spec, alc260_volume_init_verbs); |
5632 | 5780 | ||
5633 | spec->num_mux_defs = 1; | 5781 | spec->num_mux_defs = 1; |
5634 | spec->input_mux = &spec->private_imux; | 5782 | spec->input_mux = &spec->private_imux[0]; |
5635 | 5783 | ||
5636 | store_pin_configs(codec); | ||
5637 | return 1; | 5784 | return 1; |
5638 | } | 5785 | } |
5639 | 5786 | ||
@@ -5670,6 +5817,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = { | |||
5670 | [ALC260_ACER] = "acer", | 5817 | [ALC260_ACER] = "acer", |
5671 | [ALC260_WILL] = "will", | 5818 | [ALC260_WILL] = "will", |
5672 | [ALC260_REPLACER_672V] = "replacer", | 5819 | [ALC260_REPLACER_672V] = "replacer", |
5820 | [ALC260_FAVORIT100] = "favorit100", | ||
5673 | #ifdef CONFIG_SND_DEBUG | 5821 | #ifdef CONFIG_SND_DEBUG |
5674 | [ALC260_TEST] = "test", | 5822 | [ALC260_TEST] = "test", |
5675 | #endif | 5823 | #endif |
@@ -5679,6 +5827,7 @@ static const char *alc260_models[ALC260_MODEL_LAST] = { | |||
5679 | static struct snd_pci_quirk alc260_cfg_tbl[] = { | 5827 | static struct snd_pci_quirk alc260_cfg_tbl[] = { |
5680 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), | 5828 | SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), |
5681 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), | 5829 | SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), |
5830 | SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), | ||
5682 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), | 5831 | SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), |
5683 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), | 5832 | SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), |
5684 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), | 5833 | SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), |
@@ -5701,8 +5850,7 @@ static struct snd_pci_quirk alc260_cfg_tbl[] = { | |||
5701 | static struct alc_config_preset alc260_presets[] = { | 5850 | static struct alc_config_preset alc260_presets[] = { |
5702 | [ALC260_BASIC] = { | 5851 | [ALC260_BASIC] = { |
5703 | .mixers = { alc260_base_output_mixer, | 5852 | .mixers = { alc260_base_output_mixer, |
5704 | alc260_input_mixer, | 5853 | alc260_input_mixer }, |
5705 | alc260_pc_beep_mixer }, | ||
5706 | .init_verbs = { alc260_init_verbs }, | 5854 | .init_verbs = { alc260_init_verbs }, |
5707 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | 5855 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), |
5708 | .dac_nids = alc260_dac_nids, | 5856 | .dac_nids = alc260_dac_nids, |
@@ -5781,6 +5929,18 @@ static struct alc_config_preset alc260_presets[] = { | |||
5781 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), | 5929 | .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), |
5782 | .input_mux = alc260_acer_capture_sources, | 5930 | .input_mux = alc260_acer_capture_sources, |
5783 | }, | 5931 | }, |
5932 | [ALC260_FAVORIT100] = { | ||
5933 | .mixers = { alc260_favorit100_mixer }, | ||
5934 | .init_verbs = { alc260_favorit100_init_verbs }, | ||
5935 | .num_dacs = ARRAY_SIZE(alc260_dac_nids), | ||
5936 | .dac_nids = alc260_dac_nids, | ||
5937 | .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), | ||
5938 | .adc_nids = alc260_dual_adc_nids, | ||
5939 | .num_channel_mode = ARRAY_SIZE(alc260_modes), | ||
5940 | .channel_mode = alc260_modes, | ||
5941 | .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), | ||
5942 | .input_mux = alc260_favorit100_capture_sources, | ||
5943 | }, | ||
5784 | [ALC260_WILL] = { | 5944 | [ALC260_WILL] = { |
5785 | .mixers = { alc260_will_mixer }, | 5945 | .mixers = { alc260_will_mixer }, |
5786 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, | 5946 | .init_verbs = { alc260_init_verbs, alc260_will_verbs }, |
@@ -5857,6 +6017,12 @@ static int patch_alc260(struct hda_codec *codec) | |||
5857 | } | 6017 | } |
5858 | } | 6018 | } |
5859 | 6019 | ||
6020 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
6021 | if (err < 0) { | ||
6022 | alc_free(codec); | ||
6023 | return err; | ||
6024 | } | ||
6025 | |||
5860 | if (board_config != ALC260_AUTO) | 6026 | if (board_config != ALC260_AUTO) |
5861 | setup_preset(spec, &alc260_presets[board_config]); | 6027 | setup_preset(spec, &alc260_presets[board_config]); |
5862 | 6028 | ||
@@ -5882,6 +6048,7 @@ static int patch_alc260(struct hda_codec *codec) | |||
5882 | } | 6048 | } |
5883 | } | 6049 | } |
5884 | set_capture_mixer(spec); | 6050 | set_capture_mixer(spec); |
6051 | set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); | ||
5885 | 6052 | ||
5886 | spec->vmaster_nid = 0x08; | 6053 | spec->vmaster_nid = 0x08; |
5887 | 6054 | ||
@@ -6053,8 +6220,6 @@ static struct snd_kcontrol_new alc882_base_mixer[] = { | |||
6053 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 6220 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
6054 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | 6221 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
6055 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 6222 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
6056 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
6057 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
6058 | { } /* end */ | 6223 | { } /* end */ |
6059 | }; | 6224 | }; |
6060 | 6225 | ||
@@ -6081,8 +6246,6 @@ static struct snd_kcontrol_new alc882_w2jc_mixer[] = { | |||
6081 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 6246 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
6082 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | 6247 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
6083 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 6248 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
6084 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
6085 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
6086 | { } /* end */ | 6249 | { } /* end */ |
6087 | }; | 6250 | }; |
6088 | 6251 | ||
@@ -6134,8 +6297,6 @@ static struct snd_kcontrol_new alc882_asus_a7m_mixer[] = { | |||
6134 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 6297 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
6135 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | 6298 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
6136 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 6299 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
6137 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
6138 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
6139 | { } /* end */ | 6300 | { } /* end */ |
6140 | }; | 6301 | }; |
6141 | 6302 | ||
@@ -6244,8 +6405,10 @@ static struct snd_kcontrol_new alc882_macpro_mixer[] = { | |||
6244 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), | 6405 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), |
6245 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), | 6406 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), |
6246 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | 6407 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
6408 | /* FIXME: this looks suspicious... | ||
6247 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), | 6409 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), |
6248 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), | 6410 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), |
6411 | */ | ||
6249 | { } /* end */ | 6412 | { } /* end */ |
6250 | }; | 6413 | }; |
6251 | 6414 | ||
@@ -6877,19 +7040,9 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) | |||
6877 | 7040 | ||
6878 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 7041 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
6879 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 7042 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
6880 | unsigned int vref; | ||
6881 | if (!nid) | 7043 | if (!nid) |
6882 | continue; | 7044 | continue; |
6883 | vref = PIN_IN; | 7045 | alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); |
6884 | if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { | ||
6885 | unsigned int pincap; | ||
6886 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
6887 | if ((pincap >> AC_PINCAP_VREF_SHIFT) & | ||
6888 | AC_PINCAP_VREF_80) | ||
6889 | vref = PIN_VREF80; | ||
6890 | } | ||
6891 | snd_hda_codec_write(codec, nid, 0, | ||
6892 | AC_VERB_SET_PIN_WIDGET_CONTROL, vref); | ||
6893 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) | 7046 | if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) |
6894 | snd_hda_codec_write(codec, nid, 0, | 7047 | snd_hda_codec_write(codec, nid, 0, |
6895 | AC_VERB_SET_AMP_GAIN_MUTE, | 7048 | AC_VERB_SET_AMP_GAIN_MUTE, |
@@ -6900,18 +7053,21 @@ static void alc882_auto_init_analog_input(struct hda_codec *codec) | |||
6900 | static void alc882_auto_init_input_src(struct hda_codec *codec) | 7053 | static void alc882_auto_init_input_src(struct hda_codec *codec) |
6901 | { | 7054 | { |
6902 | struct alc_spec *spec = codec->spec; | 7055 | struct alc_spec *spec = codec->spec; |
6903 | const struct hda_input_mux *imux = spec->input_mux; | ||
6904 | int c; | 7056 | int c; |
6905 | 7057 | ||
6906 | for (c = 0; c < spec->num_adc_nids; c++) { | 7058 | for (c = 0; c < spec->num_adc_nids; c++) { |
6907 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; | 7059 | hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; |
6908 | hda_nid_t nid = spec->capsrc_nids[c]; | 7060 | hda_nid_t nid = spec->capsrc_nids[c]; |
7061 | unsigned int mux_idx; | ||
7062 | const struct hda_input_mux *imux; | ||
6909 | int conns, mute, idx, item; | 7063 | int conns, mute, idx, item; |
6910 | 7064 | ||
6911 | conns = snd_hda_get_connections(codec, nid, conn_list, | 7065 | conns = snd_hda_get_connections(codec, nid, conn_list, |
6912 | ARRAY_SIZE(conn_list)); | 7066 | ARRAY_SIZE(conn_list)); |
6913 | if (conns < 0) | 7067 | if (conns < 0) |
6914 | continue; | 7068 | continue; |
7069 | mux_idx = c >= spec->num_mux_defs ? 0 : c; | ||
7070 | imux = &spec->input_mux[mux_idx]; | ||
6915 | for (idx = 0; idx < conns; idx++) { | 7071 | for (idx = 0; idx < conns; idx++) { |
6916 | /* if the current connection is the selected one, | 7072 | /* if the current connection is the selected one, |
6917 | * unmute it as default - otherwise mute it | 7073 | * unmute it as default - otherwise mute it |
@@ -6924,8 +7080,20 @@ static void alc882_auto_init_input_src(struct hda_codec *codec) | |||
6924 | break; | 7080 | break; |
6925 | } | 7081 | } |
6926 | } | 7082 | } |
6927 | snd_hda_codec_write(codec, nid, 0, | 7083 | /* check if we have a selector or mixer |
6928 | AC_VERB_SET_AMP_GAIN_MUTE, mute); | 7084 | * we could check for the widget type instead, but |
7085 | * just check for Amp-In presence (in case of mixer | ||
7086 | * without amp-in there is something wrong, this | ||
7087 | * function shouldn't be used or capsrc nid is wrong) | ||
7088 | */ | ||
7089 | if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) | ||
7090 | snd_hda_codec_write(codec, nid, 0, | ||
7091 | AC_VERB_SET_AMP_GAIN_MUTE, | ||
7092 | mute); | ||
7093 | else if (mute != AMP_IN_MUTE(idx)) | ||
7094 | snd_hda_codec_write(codec, nid, 0, | ||
7095 | AC_VERB_SET_CONNECT_SEL, | ||
7096 | idx); | ||
6929 | } | 7097 | } |
6930 | } | 7098 | } |
6931 | } | 7099 | } |
@@ -7054,6 +7222,12 @@ static int patch_alc882(struct hda_codec *codec) | |||
7054 | } | 7222 | } |
7055 | } | 7223 | } |
7056 | 7224 | ||
7225 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
7226 | if (err < 0) { | ||
7227 | alc_free(codec); | ||
7228 | return err; | ||
7229 | } | ||
7230 | |||
7057 | if (board_config != ALC882_AUTO) | 7231 | if (board_config != ALC882_AUTO) |
7058 | setup_preset(spec, &alc882_presets[board_config]); | 7232 | setup_preset(spec, &alc882_presets[board_config]); |
7059 | 7233 | ||
@@ -7074,7 +7248,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
7074 | spec->stream_digital_playback = &alc882_pcm_digital_playback; | 7248 | spec->stream_digital_playback = &alc882_pcm_digital_playback; |
7075 | spec->stream_digital_capture = &alc882_pcm_digital_capture; | 7249 | spec->stream_digital_capture = &alc882_pcm_digital_capture; |
7076 | 7250 | ||
7077 | spec->is_mix_capture = 1; /* matrix-style capture */ | 7251 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ |
7078 | if (!spec->adc_nids && spec->input_mux) { | 7252 | if (!spec->adc_nids && spec->input_mux) { |
7079 | /* check whether NID 0x07 is valid */ | 7253 | /* check whether NID 0x07 is valid */ |
7080 | unsigned int wcap = get_wcaps(codec, 0x07); | 7254 | unsigned int wcap = get_wcaps(codec, 0x07); |
@@ -7091,6 +7265,7 @@ static int patch_alc882(struct hda_codec *codec) | |||
7091 | } | 7265 | } |
7092 | } | 7266 | } |
7093 | set_capture_mixer(spec); | 7267 | set_capture_mixer(spec); |
7268 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
7094 | 7269 | ||
7095 | spec->vmaster_nid = 0x0c; | 7270 | spec->vmaster_nid = 0x0c; |
7096 | 7271 | ||
@@ -7142,10 +7317,14 @@ static hda_nid_t alc883_adc_nids_rev[2] = { | |||
7142 | 0x09, 0x08 | 7317 | 0x09, 0x08 |
7143 | }; | 7318 | }; |
7144 | 7319 | ||
7320 | #define alc889_adc_nids alc880_adc_nids | ||
7321 | |||
7145 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; | 7322 | static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; |
7146 | 7323 | ||
7147 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; | 7324 | static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; |
7148 | 7325 | ||
7326 | #define alc889_capsrc_nids alc882_capsrc_nids | ||
7327 | |||
7149 | /* input MUX */ | 7328 | /* input MUX */ |
7150 | /* FIXME: should be a matrix-type input source selection */ | 7329 | /* FIXME: should be a matrix-type input source selection */ |
7151 | 7330 | ||
@@ -7363,8 +7542,6 @@ static struct snd_kcontrol_new alc883_base_mixer[] = { | |||
7363 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 7542 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7364 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | 7543 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
7365 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 7544 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7366 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
7367 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
7368 | { } /* end */ | 7545 | { } /* end */ |
7369 | }; | 7546 | }; |
7370 | 7547 | ||
@@ -7427,8 +7604,6 @@ static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { | |||
7427 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 7604 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7428 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | 7605 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
7429 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 7606 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7430 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
7431 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
7432 | { } /* end */ | 7607 | { } /* end */ |
7433 | }; | 7608 | }; |
7434 | 7609 | ||
@@ -7452,8 +7627,6 @@ static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { | |||
7452 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 7627 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7453 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | 7628 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
7454 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 7629 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7455 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
7456 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
7457 | { } /* end */ | 7630 | { } /* end */ |
7458 | }; | 7631 | }; |
7459 | 7632 | ||
@@ -7478,8 +7651,6 @@ static struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = { | |||
7478 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 7651 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
7479 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), | 7652 | HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), |
7480 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 7653 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7481 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
7482 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
7483 | { } /* end */ | 7654 | { } /* end */ |
7484 | }; | 7655 | }; |
7485 | 7656 | ||
@@ -7503,8 +7674,6 @@ static struct snd_kcontrol_new alc883_fivestack_mixer[] = { | |||
7503 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 7674 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
7504 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | 7675 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
7505 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 7676 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
7506 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
7507 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
7508 | { } /* end */ | 7677 | { } /* end */ |
7509 | }; | 7678 | }; |
7510 | 7679 | ||
@@ -7912,36 +8081,83 @@ static struct hda_verb alc888_lenovo_sky_verbs[] = { | |||
7912 | { } /* end */ | 8081 | { } /* end */ |
7913 | }; | 8082 | }; |
7914 | 8083 | ||
8084 | static struct hda_verb alc888_6st_dell_verbs[] = { | ||
8085 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | ||
8086 | { } | ||
8087 | }; | ||
8088 | |||
8089 | static void alc888_3st_hp_front_automute(struct hda_codec *codec) | ||
8090 | { | ||
8091 | unsigned int present, bits; | ||
8092 | |||
8093 | present = snd_hda_codec_read(codec, 0x1b, 0, | ||
8094 | AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; | ||
8095 | bits = present ? HDA_AMP_MUTE : 0; | ||
8096 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
8097 | HDA_AMP_MUTE, bits); | ||
8098 | snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, | ||
8099 | HDA_AMP_MUTE, bits); | ||
8100 | snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, | ||
8101 | HDA_AMP_MUTE, bits); | ||
8102 | } | ||
8103 | |||
8104 | static void alc888_3st_hp_unsol_event(struct hda_codec *codec, | ||
8105 | unsigned int res) | ||
8106 | { | ||
8107 | switch (res >> 26) { | ||
8108 | case ALC880_HP_EVENT: | ||
8109 | alc888_3st_hp_front_automute(codec); | ||
8110 | break; | ||
8111 | } | ||
8112 | } | ||
8113 | |||
7915 | static struct hda_verb alc888_3st_hp_verbs[] = { | 8114 | static struct hda_verb alc888_3st_hp_verbs[] = { |
7916 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ | 8115 | {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ |
7917 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ | 8116 | {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ |
7918 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ | 8117 | {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ |
7919 | { } | ||
7920 | }; | ||
7921 | |||
7922 | static struct hda_verb alc888_6st_dell_verbs[] = { | ||
7923 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, | 8118 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, |
7924 | { } | 8119 | { } /* end */ |
7925 | }; | 8120 | }; |
7926 | 8121 | ||
8122 | /* | ||
8123 | * 2ch mode | ||
8124 | */ | ||
7927 | static struct hda_verb alc888_3st_hp_2ch_init[] = { | 8125 | static struct hda_verb alc888_3st_hp_2ch_init[] = { |
7928 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | 8126 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, |
7929 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | 8127 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
7930 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, | 8128 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, |
7931 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | 8129 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, |
7932 | { } | 8130 | { } /* end */ |
8131 | }; | ||
8132 | |||
8133 | /* | ||
8134 | * 4ch mode | ||
8135 | */ | ||
8136 | static struct hda_verb alc888_3st_hp_4ch_init[] = { | ||
8137 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, | ||
8138 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, | ||
8139 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | ||
8140 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | ||
8141 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, | ||
8142 | { } /* end */ | ||
7933 | }; | 8143 | }; |
7934 | 8144 | ||
8145 | /* | ||
8146 | * 6ch mode | ||
8147 | */ | ||
7935 | static struct hda_verb alc888_3st_hp_6ch_init[] = { | 8148 | static struct hda_verb alc888_3st_hp_6ch_init[] = { |
7936 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | 8149 | { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7937 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | 8150 | { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
8151 | { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, | ||
7938 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, | 8152 | { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, |
7939 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, | 8153 | { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, |
7940 | { } | 8154 | { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, |
8155 | { } /* end */ | ||
7941 | }; | 8156 | }; |
7942 | 8157 | ||
7943 | static struct hda_channel_mode alc888_3st_hp_modes[2] = { | 8158 | static struct hda_channel_mode alc888_3st_hp_modes[3] = { |
7944 | { 2, alc888_3st_hp_2ch_init }, | 8159 | { 2, alc888_3st_hp_2ch_init }, |
8160 | { 4, alc888_3st_hp_4ch_init }, | ||
7945 | { 6, alc888_3st_hp_6ch_init }, | 8161 | { 6, alc888_3st_hp_6ch_init }, |
7946 | }; | 8162 | }; |
7947 | 8163 | ||
@@ -8202,7 +8418,7 @@ static void alc888_6st_dell_unsol_event(struct hda_codec *codec, | |||
8202 | { | 8418 | { |
8203 | switch (res >> 26) { | 8419 | switch (res >> 26) { |
8204 | case ALC880_HP_EVENT: | 8420 | case ALC880_HP_EVENT: |
8205 | printk("hp_event\n"); | 8421 | /* printk(KERN_DEBUG "hp_event\n"); */ |
8206 | alc888_6st_dell_front_automute(codec); | 8422 | alc888_6st_dell_front_automute(codec); |
8207 | break; | 8423 | break; |
8208 | } | 8424 | } |
@@ -8461,6 +8677,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8461 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), | 8677 | SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), |
8462 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), | 8678 | SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), |
8463 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), | 8679 | SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), |
8680 | SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), | ||
8464 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), | 8681 | SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), |
8465 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), | 8682 | SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), |
8466 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), | 8683 | SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), |
@@ -8468,17 +8685,21 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8468 | ALC888_ACER_ASPIRE_4930G), | 8685 | ALC888_ACER_ASPIRE_4930G), |
8469 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", | 8686 | SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", |
8470 | ALC888_ACER_ASPIRE_4930G), | 8687 | ALC888_ACER_ASPIRE_4930G), |
8688 | SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), | ||
8689 | SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), | ||
8471 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", | 8690 | SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", |
8472 | ALC888_ACER_ASPIRE_4930G), | 8691 | ALC888_ACER_ASPIRE_4930G), |
8473 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", | 8692 | SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", |
8474 | ALC888_ACER_ASPIRE_4930G), | 8693 | ALC888_ACER_ASPIRE_4930G), |
8475 | SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ | 8694 | /* default Acer */ |
8695 | SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), | ||
8476 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), | 8696 | SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), |
8477 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), | 8697 | SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), |
8478 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), | 8698 | SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP), |
8479 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), | 8699 | SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), |
8480 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), | 8700 | SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), |
8481 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), | 8701 | SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), |
8702 | SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), | ||
8482 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), | 8703 | SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), |
8483 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), | 8704 | SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), |
8484 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), | 8705 | SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), |
@@ -8518,7 +8739,7 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8518 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), | 8739 | SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG), |
8519 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), | 8740 | SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), |
8520 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), | 8741 | SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), |
8521 | SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), | 8742 | SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), |
8522 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), | 8743 | SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), |
8523 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), | 8744 | SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), |
8524 | SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", | 8745 | SND_PCI_QUIRK(0x1734, 0x1107, "FSC AMILO Xi2550", |
@@ -8543,6 +8764,10 @@ static struct snd_pci_quirk alc883_cfg_tbl[] = { | |||
8543 | {} | 8764 | {} |
8544 | }; | 8765 | }; |
8545 | 8766 | ||
8767 | static hda_nid_t alc1200_slave_dig_outs[] = { | ||
8768 | ALC883_DIGOUT_NID, 0, | ||
8769 | }; | ||
8770 | |||
8546 | static struct alc_config_preset alc883_presets[] = { | 8771 | static struct alc_config_preset alc883_presets[] = { |
8547 | [ALC883_3ST_2ch_DIG] = { | 8772 | [ALC883_3ST_2ch_DIG] = { |
8548 | .mixers = { alc883_3ST_2ch_mixer }, | 8773 | .mixers = { alc883_3ST_2ch_mixer }, |
@@ -8778,6 +9003,8 @@ static struct alc_config_preset alc883_presets[] = { | |||
8778 | .channel_mode = alc888_3st_hp_modes, | 9003 | .channel_mode = alc888_3st_hp_modes, |
8779 | .need_dac_fix = 1, | 9004 | .need_dac_fix = 1, |
8780 | .input_mux = &alc883_capture_source, | 9005 | .input_mux = &alc883_capture_source, |
9006 | .unsol_event = alc888_3st_hp_unsol_event, | ||
9007 | .init_hook = alc888_3st_hp_front_automute, | ||
8781 | }, | 9008 | }, |
8782 | [ALC888_6ST_DELL] = { | 9009 | [ALC888_6ST_DELL] = { |
8783 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, | 9010 | .mixers = { alc883_base_mixer, alc883_chmode_mixer }, |
@@ -8883,6 +9110,7 @@ static struct alc_config_preset alc883_presets[] = { | |||
8883 | .dac_nids = alc883_dac_nids, | 9110 | .dac_nids = alc883_dac_nids, |
8884 | .dig_out_nid = ALC1200_DIGOUT_NID, | 9111 | .dig_out_nid = ALC1200_DIGOUT_NID, |
8885 | .dig_in_nid = ALC883_DIGIN_NID, | 9112 | .dig_in_nid = ALC883_DIGIN_NID, |
9113 | .slave_dig_outs = alc1200_slave_dig_outs, | ||
8886 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), | 9114 | .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), |
8887 | .channel_mode = alc883_sixstack_modes, | 9115 | .channel_mode = alc883_sixstack_modes, |
8888 | .input_mux = &alc883_capture_source, | 9116 | .input_mux = &alc883_capture_source, |
@@ -8950,11 +9178,9 @@ static void alc883_auto_init_analog_input(struct hda_codec *codec) | |||
8950 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 9178 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
8951 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 9179 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
8952 | if (alc883_is_input_pin(nid)) { | 9180 | if (alc883_is_input_pin(nid)) { |
8953 | snd_hda_codec_write(codec, nid, 0, | 9181 | alc_set_input_pin(codec, nid, i); |
8954 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 9182 | if (nid != ALC883_PIN_CD_NID && |
8955 | (i <= AUTO_PIN_FRONT_MIC ? | 9183 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
8956 | PIN_VREF80 : PIN_IN)); | ||
8957 | if (nid != ALC883_PIN_CD_NID) | ||
8958 | snd_hda_codec_write(codec, nid, 0, | 9184 | snd_hda_codec_write(codec, nid, 0, |
8959 | AC_VERB_SET_AMP_GAIN_MUTE, | 9185 | AC_VERB_SET_AMP_GAIN_MUTE, |
8960 | AMP_OUT_MUTE); | 9186 | AMP_OUT_MUTE); |
@@ -8969,6 +9195,8 @@ static int alc883_parse_auto_config(struct hda_codec *codec) | |||
8969 | { | 9195 | { |
8970 | struct alc_spec *spec = codec->spec; | 9196 | struct alc_spec *spec = codec->spec; |
8971 | int err = alc880_parse_auto_config(codec); | 9197 | int err = alc880_parse_auto_config(codec); |
9198 | struct auto_pin_cfg *cfg = &spec->autocfg; | ||
9199 | int i; | ||
8972 | 9200 | ||
8973 | if (err < 0) | 9201 | if (err < 0) |
8974 | return err; | 9202 | return err; |
@@ -8982,6 +9210,26 @@ static int alc883_parse_auto_config(struct hda_codec *codec) | |||
8982 | /* hack - override the init verbs */ | 9210 | /* hack - override the init verbs */ |
8983 | spec->init_verbs[0] = alc883_auto_init_verbs; | 9211 | spec->init_verbs[0] = alc883_auto_init_verbs; |
8984 | 9212 | ||
9213 | /* setup input_mux for ALC889 */ | ||
9214 | if (codec->vendor_id == 0x10ec0889) { | ||
9215 | /* digital-mic input pin is excluded in alc880_auto_create..() | ||
9216 | * because it's under 0x18 | ||
9217 | */ | ||
9218 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || | ||
9219 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { | ||
9220 | struct hda_input_mux *imux = &spec->private_imux[0]; | ||
9221 | for (i = 1; i < 3; i++) | ||
9222 | memcpy(&spec->private_imux[i], | ||
9223 | &spec->private_imux[0], | ||
9224 | sizeof(spec->private_imux[0])); | ||
9225 | imux->items[imux->num_items].label = "Int DMic"; | ||
9226 | imux->items[imux->num_items].index = 0x0b; | ||
9227 | imux->num_items++; | ||
9228 | spec->num_mux_defs = 3; | ||
9229 | spec->input_mux = spec->private_imux; | ||
9230 | } | ||
9231 | } | ||
9232 | |||
8985 | return 1; /* config found */ | 9233 | return 1; /* config found */ |
8986 | } | 9234 | } |
8987 | 9235 | ||
@@ -9033,6 +9281,12 @@ static int patch_alc883(struct hda_codec *codec) | |||
9033 | } | 9281 | } |
9034 | } | 9282 | } |
9035 | 9283 | ||
9284 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
9285 | if (err < 0) { | ||
9286 | alc_free(codec); | ||
9287 | return err; | ||
9288 | } | ||
9289 | |||
9036 | if (board_config != ALC883_AUTO) | 9290 | if (board_config != ALC883_AUTO) |
9037 | setup_preset(spec, &alc883_presets[board_config]); | 9291 | setup_preset(spec, &alc883_presets[board_config]); |
9038 | 9292 | ||
@@ -9045,14 +9299,36 @@ static int patch_alc883(struct hda_codec *codec) | |||
9045 | spec->stream_name_analog = "ALC888 Analog"; | 9299 | spec->stream_name_analog = "ALC888 Analog"; |
9046 | spec->stream_name_digital = "ALC888 Digital"; | 9300 | spec->stream_name_digital = "ALC888 Digital"; |
9047 | } | 9301 | } |
9302 | if (!spec->num_adc_nids) { | ||
9303 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | ||
9304 | spec->adc_nids = alc883_adc_nids; | ||
9305 | } | ||
9306 | if (!spec->capsrc_nids) | ||
9307 | spec->capsrc_nids = alc883_capsrc_nids; | ||
9308 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ | ||
9048 | break; | 9309 | break; |
9049 | case 0x10ec0889: | 9310 | case 0x10ec0889: |
9050 | spec->stream_name_analog = "ALC889 Analog"; | 9311 | spec->stream_name_analog = "ALC889 Analog"; |
9051 | spec->stream_name_digital = "ALC889 Digital"; | 9312 | spec->stream_name_digital = "ALC889 Digital"; |
9313 | if (!spec->num_adc_nids) { | ||
9314 | spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); | ||
9315 | spec->adc_nids = alc889_adc_nids; | ||
9316 | } | ||
9317 | if (!spec->capsrc_nids) | ||
9318 | spec->capsrc_nids = alc889_capsrc_nids; | ||
9319 | spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style | ||
9320 | capture */ | ||
9052 | break; | 9321 | break; |
9053 | default: | 9322 | default: |
9054 | spec->stream_name_analog = "ALC883 Analog"; | 9323 | spec->stream_name_analog = "ALC883 Analog"; |
9055 | spec->stream_name_digital = "ALC883 Digital"; | 9324 | spec->stream_name_digital = "ALC883 Digital"; |
9325 | if (!spec->num_adc_nids) { | ||
9326 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | ||
9327 | spec->adc_nids = alc883_adc_nids; | ||
9328 | } | ||
9329 | if (!spec->capsrc_nids) | ||
9330 | spec->capsrc_nids = alc883_capsrc_nids; | ||
9331 | spec->capture_style = CAPT_MIX; /* matrix-style capture */ | ||
9056 | break; | 9332 | break; |
9057 | } | 9333 | } |
9058 | 9334 | ||
@@ -9063,15 +9339,9 @@ static int patch_alc883(struct hda_codec *codec) | |||
9063 | spec->stream_digital_playback = &alc883_pcm_digital_playback; | 9339 | spec->stream_digital_playback = &alc883_pcm_digital_playback; |
9064 | spec->stream_digital_capture = &alc883_pcm_digital_capture; | 9340 | spec->stream_digital_capture = &alc883_pcm_digital_capture; |
9065 | 9341 | ||
9066 | if (!spec->num_adc_nids) { | ||
9067 | spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); | ||
9068 | spec->adc_nids = alc883_adc_nids; | ||
9069 | } | ||
9070 | if (!spec->capsrc_nids) | ||
9071 | spec->capsrc_nids = alc883_capsrc_nids; | ||
9072 | spec->is_mix_capture = 1; /* matrix-style capture */ | ||
9073 | if (!spec->cap_mixer) | 9342 | if (!spec->cap_mixer) |
9074 | set_capture_mixer(spec); | 9343 | set_capture_mixer(spec); |
9344 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
9075 | 9345 | ||
9076 | spec->vmaster_nid = 0x0c; | 9346 | spec->vmaster_nid = 0x0c; |
9077 | 9347 | ||
@@ -9124,8 +9394,6 @@ static struct snd_kcontrol_new alc262_base_mixer[] = { | |||
9124 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 9394 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
9125 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 9395 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
9126 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | 9396 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9127 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
9128 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ | ||
9129 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), | 9397 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), |
9130 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), | 9398 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), |
9131 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), | 9399 | HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), |
@@ -9146,8 +9414,6 @@ static struct snd_kcontrol_new alc262_hippo1_mixer[] = { | |||
9146 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 9414 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
9147 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 9415 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
9148 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | 9416 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), |
9149 | /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
9150 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */ | ||
9151 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ | 9417 | /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ |
9152 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), | 9418 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), |
9153 | { } /* end */ | 9419 | { } /* end */ |
@@ -9256,8 +9522,6 @@ static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { | |||
9256 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 9522 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
9257 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 9523 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
9258 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 9524 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
9259 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
9260 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
9261 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), | 9525 | HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), |
9262 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), | 9526 | HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), |
9263 | { } /* end */ | 9527 | { } /* end */ |
@@ -9286,8 +9550,6 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { | |||
9286 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), | 9550 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), |
9287 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 9551 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
9288 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 9552 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
9289 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
9290 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
9291 | { } /* end */ | 9553 | { } /* end */ |
9292 | }; | 9554 | }; |
9293 | 9555 | ||
@@ -9435,6 +9697,67 @@ static struct snd_kcontrol_new alc262_benq_t31_mixer[] = { | |||
9435 | { } /* end */ | 9697 | { } /* end */ |
9436 | }; | 9698 | }; |
9437 | 9699 | ||
9700 | static struct snd_kcontrol_new alc262_tyan_mixer[] = { | ||
9701 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | ||
9702 | HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), | ||
9703 | HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), | ||
9704 | HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), | ||
9705 | HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), | ||
9706 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | ||
9707 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | ||
9708 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | ||
9709 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | ||
9710 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | ||
9711 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | ||
9712 | HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), | ||
9713 | { } /* end */ | ||
9714 | }; | ||
9715 | |||
9716 | static struct hda_verb alc262_tyan_verbs[] = { | ||
9717 | /* Headphone automute */ | ||
9718 | {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, | ||
9719 | {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, | ||
9720 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, | ||
9721 | |||
9722 | /* P11 AUX_IN, white 4-pin connector */ | ||
9723 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | ||
9724 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, | ||
9725 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, | ||
9726 | {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, | ||
9727 | |||
9728 | {} | ||
9729 | }; | ||
9730 | |||
9731 | /* unsolicited event for HP jack sensing */ | ||
9732 | static void alc262_tyan_automute(struct hda_codec *codec) | ||
9733 | { | ||
9734 | unsigned int mute; | ||
9735 | unsigned int present; | ||
9736 | |||
9737 | snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
9738 | present = snd_hda_codec_read(codec, 0x1b, 0, | ||
9739 | AC_VERB_GET_PIN_SENSE, 0); | ||
9740 | present = (present & 0x80000000) != 0; | ||
9741 | if (present) { | ||
9742 | /* mute line output on ATX panel */ | ||
9743 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
9744 | HDA_AMP_MUTE, HDA_AMP_MUTE); | ||
9745 | } else { | ||
9746 | /* unmute line output if necessary */ | ||
9747 | mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); | ||
9748 | snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, | ||
9749 | HDA_AMP_MUTE, mute); | ||
9750 | } | ||
9751 | } | ||
9752 | |||
9753 | static void alc262_tyan_unsol_event(struct hda_codec *codec, | ||
9754 | unsigned int res) | ||
9755 | { | ||
9756 | if ((res >> 26) != ALC880_HP_EVENT) | ||
9757 | return; | ||
9758 | alc262_tyan_automute(codec); | ||
9759 | } | ||
9760 | |||
9438 | #define alc262_capture_mixer alc882_capture_mixer | 9761 | #define alc262_capture_mixer alc882_capture_mixer |
9439 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer | 9762 | #define alc262_capture_alt_mixer alc882_capture_alt_mixer |
9440 | 9763 | ||
@@ -9901,8 +10224,6 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { | |||
9901 | }, | 10224 | }, |
9902 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 10225 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
9903 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 10226 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
9904 | HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT), | ||
9905 | HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT), | ||
9906 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | 10227 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
9907 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 10228 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
9908 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 10229 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
@@ -10474,8 +10795,14 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
10474 | alc262_ignore); | 10795 | alc262_ignore); |
10475 | if (err < 0) | 10796 | if (err < 0) |
10476 | return err; | 10797 | return err; |
10477 | if (!spec->autocfg.line_outs) | 10798 | if (!spec->autocfg.line_outs) { |
10799 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | ||
10800 | spec->multiout.max_channels = 2; | ||
10801 | spec->no_analog = 1; | ||
10802 | goto dig_only; | ||
10803 | } | ||
10478 | return 0; /* can't find valid BIOS pin config */ | 10804 | return 0; /* can't find valid BIOS pin config */ |
10805 | } | ||
10479 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); | 10806 | err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); |
10480 | if (err < 0) | 10807 | if (err < 0) |
10481 | return err; | 10808 | return err; |
@@ -10485,8 +10812,11 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
10485 | 10812 | ||
10486 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 10813 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
10487 | 10814 | ||
10488 | if (spec->autocfg.dig_out_pin) | 10815 | dig_only: |
10816 | if (spec->autocfg.dig_outs) { | ||
10489 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; | 10817 | spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; |
10818 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | ||
10819 | } | ||
10490 | if (spec->autocfg.dig_in_pin) | 10820 | if (spec->autocfg.dig_in_pin) |
10491 | spec->dig_in_nid = ALC262_DIGIN_NID; | 10821 | spec->dig_in_nid = ALC262_DIGIN_NID; |
10492 | 10822 | ||
@@ -10495,13 +10825,12 @@ static int alc262_parse_auto_config(struct hda_codec *codec) | |||
10495 | 10825 | ||
10496 | add_verb(spec, alc262_volume_init_verbs); | 10826 | add_verb(spec, alc262_volume_init_verbs); |
10497 | spec->num_mux_defs = 1; | 10827 | spec->num_mux_defs = 1; |
10498 | spec->input_mux = &spec->private_imux; | 10828 | spec->input_mux = &spec->private_imux[0]; |
10499 | 10829 | ||
10500 | err = alc_auto_add_mic_boost(codec); | 10830 | err = alc_auto_add_mic_boost(codec); |
10501 | if (err < 0) | 10831 | if (err < 0) |
10502 | return err; | 10832 | return err; |
10503 | 10833 | ||
10504 | store_pin_configs(codec); | ||
10505 | return 1; | 10834 | return 1; |
10506 | } | 10835 | } |
10507 | 10836 | ||
@@ -10543,21 +10872,19 @@ static const char *alc262_models[ALC262_MODEL_LAST] = { | |||
10543 | [ALC262_ULTRA] = "ultra", | 10872 | [ALC262_ULTRA] = "ultra", |
10544 | [ALC262_LENOVO_3000] = "lenovo-3000", | 10873 | [ALC262_LENOVO_3000] = "lenovo-3000", |
10545 | [ALC262_NEC] = "nec", | 10874 | [ALC262_NEC] = "nec", |
10875 | [ALC262_TYAN] = "tyan", | ||
10546 | [ALC262_AUTO] = "auto", | 10876 | [ALC262_AUTO] = "auto", |
10547 | }; | 10877 | }; |
10548 | 10878 | ||
10549 | static struct snd_pci_quirk alc262_cfg_tbl[] = { | 10879 | static struct snd_pci_quirk alc262_cfg_tbl[] = { |
10550 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), | 10880 | SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), |
10551 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), | 10881 | SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), |
10552 | SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), | 10882 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", |
10553 | SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), | 10883 | ALC262_HP_BPC), |
10554 | SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), | 10884 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", |
10555 | SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), | 10885 | ALC262_HP_BPC), |
10556 | SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), | 10886 | SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", |
10557 | SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), | 10887 | ALC262_HP_BPC), |
10558 | SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), | ||
10559 | SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), | ||
10560 | SND_PCI_QUIRK(0x103c, 0x170b, "HP xw*", ALC262_HP_BPC), | ||
10561 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), | 10888 | SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), |
10562 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), | 10889 | SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), |
10563 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), | 10890 | SND_PCI_QUIRK(0x103c, 0x2802, "HP D7000", ALC262_HP_BPC_D7000_WL), |
@@ -10575,17 +10902,17 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { | |||
10575 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), | 10902 | SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
10576 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), | 10903 | SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), |
10577 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), | 10904 | SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), |
10578 | SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), | 10905 | SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ |
10579 | SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), | 10906 | SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", |
10580 | SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN", | 10907 | ALC262_SONY_ASSAMD), |
10581 | ALC262_SONY_ASSAMD), | ||
10582 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", | 10908 | SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", |
10583 | ALC262_TOSHIBA_RX1), | 10909 | ALC262_TOSHIBA_RX1), |
10584 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), | 10910 | SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06), |
10585 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), | 10911 | SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), |
10586 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), | 10912 | SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), |
10587 | SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), | 10913 | SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), |
10588 | SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), | 10914 | SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", |
10915 | ALC262_ULTRA), | ||
10589 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), | 10916 | SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), |
10590 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), | 10917 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), |
10591 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), | 10918 | SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), |
@@ -10802,6 +11129,19 @@ static struct alc_config_preset alc262_presets[] = { | |||
10802 | .unsol_event = alc262_hippo_unsol_event, | 11129 | .unsol_event = alc262_hippo_unsol_event, |
10803 | .init_hook = alc262_hippo_automute, | 11130 | .init_hook = alc262_hippo_automute, |
10804 | }, | 11131 | }, |
11132 | [ALC262_TYAN] = { | ||
11133 | .mixers = { alc262_tyan_mixer }, | ||
11134 | .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, | ||
11135 | .num_dacs = ARRAY_SIZE(alc262_dac_nids), | ||
11136 | .dac_nids = alc262_dac_nids, | ||
11137 | .hp_nid = 0x02, | ||
11138 | .dig_out_nid = ALC262_DIGOUT_NID, | ||
11139 | .num_channel_mode = ARRAY_SIZE(alc262_modes), | ||
11140 | .channel_mode = alc262_modes, | ||
11141 | .input_mux = &alc262_capture_source, | ||
11142 | .unsol_event = alc262_tyan_unsol_event, | ||
11143 | .init_hook = alc262_tyan_automute, | ||
11144 | }, | ||
10805 | }; | 11145 | }; |
10806 | 11146 | ||
10807 | static int patch_alc262(struct hda_codec *codec) | 11147 | static int patch_alc262(struct hda_codec *codec) |
@@ -10854,6 +11194,14 @@ static int patch_alc262(struct hda_codec *codec) | |||
10854 | } | 11194 | } |
10855 | } | 11195 | } |
10856 | 11196 | ||
11197 | if (!spec->no_analog) { | ||
11198 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
11199 | if (err < 0) { | ||
11200 | alc_free(codec); | ||
11201 | return err; | ||
11202 | } | ||
11203 | } | ||
11204 | |||
10857 | if (board_config != ALC262_AUTO) | 11205 | if (board_config != ALC262_AUTO) |
10858 | setup_preset(spec, &alc262_presets[board_config]); | 11206 | setup_preset(spec, &alc262_presets[board_config]); |
10859 | 11207 | ||
@@ -10865,7 +11213,7 @@ static int patch_alc262(struct hda_codec *codec) | |||
10865 | spec->stream_digital_playback = &alc262_pcm_digital_playback; | 11213 | spec->stream_digital_playback = &alc262_pcm_digital_playback; |
10866 | spec->stream_digital_capture = &alc262_pcm_digital_capture; | 11214 | spec->stream_digital_capture = &alc262_pcm_digital_capture; |
10867 | 11215 | ||
10868 | spec->is_mix_capture = 1; | 11216 | spec->capture_style = CAPT_MIX; |
10869 | if (!spec->adc_nids && spec->input_mux) { | 11217 | if (!spec->adc_nids && spec->input_mux) { |
10870 | /* check whether NID 0x07 is valid */ | 11218 | /* check whether NID 0x07 is valid */ |
10871 | unsigned int wcap = get_wcaps(codec, 0x07); | 11219 | unsigned int wcap = get_wcaps(codec, 0x07); |
@@ -10882,8 +11230,10 @@ static int patch_alc262(struct hda_codec *codec) | |||
10882 | spec->capsrc_nids = alc262_capsrc_nids; | 11230 | spec->capsrc_nids = alc262_capsrc_nids; |
10883 | } | 11231 | } |
10884 | } | 11232 | } |
10885 | if (!spec->cap_mixer) | 11233 | if (!spec->cap_mixer && !spec->no_analog) |
10886 | set_capture_mixer(spec); | 11234 | set_capture_mixer(spec); |
11235 | if (!spec->no_analog) | ||
11236 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
10887 | 11237 | ||
10888 | spec->vmaster_nid = 0x0c; | 11238 | spec->vmaster_nid = 0x0c; |
10889 | 11239 | ||
@@ -11263,19 +11613,13 @@ static void alc267_quanta_il1_unsol_event(struct hda_codec *codec, | |||
11263 | static struct hda_verb alc268_base_init_verbs[] = { | 11613 | static struct hda_verb alc268_base_init_verbs[] = { |
11264 | /* Unmute DAC0-1 and set vol = 0 */ | 11614 | /* Unmute DAC0-1 and set vol = 0 */ |
11265 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 11615 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
11266 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
11267 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
11268 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | 11616 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
11269 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
11270 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
11271 | 11617 | ||
11272 | /* | 11618 | /* |
11273 | * Set up output mixers (0x0c - 0x0e) | 11619 | * Set up output mixers (0x0c - 0x0e) |
11274 | */ | 11620 | */ |
11275 | /* set vol=0 to output mixers */ | 11621 | /* set vol=0 to output mixers */ |
11276 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11622 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11277 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
11278 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
11279 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, | 11623 | {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, |
11280 | 11624 | ||
11281 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11625 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
@@ -11294,9 +11638,7 @@ static struct hda_verb alc268_base_init_verbs[] = { | |||
11294 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11638 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
11295 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11639 | {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
11296 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11640 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
11297 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
11298 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11641 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
11299 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
11300 | 11642 | ||
11301 | /* set PCBEEP vol = 0, mute connections */ | 11643 | /* set PCBEEP vol = 0, mute connections */ |
11302 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11644 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
@@ -11318,10 +11660,8 @@ static struct hda_verb alc268_base_init_verbs[] = { | |||
11318 | */ | 11660 | */ |
11319 | static struct hda_verb alc268_volume_init_verbs[] = { | 11661 | static struct hda_verb alc268_volume_init_verbs[] = { |
11320 | /* set output DAC */ | 11662 | /* set output DAC */ |
11321 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11663 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
11322 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | 11664 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, |
11323 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
11324 | {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
11325 | 11665 | ||
11326 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | 11666 | {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
11327 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, | 11667 | {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, |
@@ -11329,16 +11669,12 @@ static struct hda_verb alc268_volume_init_verbs[] = { | |||
11329 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | 11669 | {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
11330 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, | 11670 | {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, |
11331 | 11671 | ||
11332 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, | ||
11333 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11672 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11334 | {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, | ||
11335 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11673 | {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11336 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11674 | {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
11337 | 11675 | ||
11338 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11676 | {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
11339 | {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
11340 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | 11677 | {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, |
11341 | {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, | ||
11342 | 11678 | ||
11343 | /* set PCBEEP vol = 0, mute connections */ | 11679 | /* set PCBEEP vol = 0, mute connections */ |
11344 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 11680 | {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
@@ -11537,7 +11873,7 @@ static int alc268_auto_create_multi_out_ctls(struct alc_spec *spec, | |||
11537 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, | 11873 | static int alc268_auto_create_analog_input_ctls(struct alc_spec *spec, |
11538 | const struct auto_pin_cfg *cfg) | 11874 | const struct auto_pin_cfg *cfg) |
11539 | { | 11875 | { |
11540 | struct hda_input_mux *imux = &spec->private_imux; | 11876 | struct hda_input_mux *imux = &spec->private_imux[0]; |
11541 | int i, idx1; | 11877 | int i, idx1; |
11542 | 11878 | ||
11543 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 11879 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
@@ -11631,9 +11967,14 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
11631 | alc268_ignore); | 11967 | alc268_ignore); |
11632 | if (err < 0) | 11968 | if (err < 0) |
11633 | return err; | 11969 | return err; |
11634 | if (!spec->autocfg.line_outs) | 11970 | if (!spec->autocfg.line_outs) { |
11971 | if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { | ||
11972 | spec->multiout.max_channels = 2; | ||
11973 | spec->no_analog = 1; | ||
11974 | goto dig_only; | ||
11975 | } | ||
11635 | return 0; /* can't find valid BIOS pin config */ | 11976 | return 0; /* can't find valid BIOS pin config */ |
11636 | 11977 | } | |
11637 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); | 11978 | err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); |
11638 | if (err < 0) | 11979 | if (err < 0) |
11639 | return err; | 11980 | return err; |
@@ -11643,25 +11984,26 @@ static int alc268_parse_auto_config(struct hda_codec *codec) | |||
11643 | 11984 | ||
11644 | spec->multiout.max_channels = 2; | 11985 | spec->multiout.max_channels = 2; |
11645 | 11986 | ||
11987 | dig_only: | ||
11646 | /* digital only support output */ | 11988 | /* digital only support output */ |
11647 | if (spec->autocfg.dig_out_pin) | 11989 | if (spec->autocfg.dig_outs) { |
11648 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; | 11990 | spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; |
11649 | 11991 | spec->dig_out_type = spec->autocfg.dig_out_type[0]; | |
11992 | } | ||
11650 | if (spec->kctls.list) | 11993 | if (spec->kctls.list) |
11651 | add_mixer(spec, spec->kctls.list); | 11994 | add_mixer(spec, spec->kctls.list); |
11652 | 11995 | ||
11653 | if (spec->autocfg.speaker_pins[0] != 0x1d) | 11996 | if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) |
11654 | add_mixer(spec, alc268_beep_mixer); | 11997 | add_mixer(spec, alc268_beep_mixer); |
11655 | 11998 | ||
11656 | add_verb(spec, alc268_volume_init_verbs); | 11999 | add_verb(spec, alc268_volume_init_verbs); |
11657 | spec->num_mux_defs = 1; | 12000 | spec->num_mux_defs = 1; |
11658 | spec->input_mux = &spec->private_imux; | 12001 | spec->input_mux = &spec->private_imux[0]; |
11659 | 12002 | ||
11660 | err = alc_auto_add_mic_boost(codec); | 12003 | err = alc_auto_add_mic_boost(codec); |
11661 | if (err < 0) | 12004 | if (err < 0) |
11662 | return err; | 12005 | return err; |
11663 | 12006 | ||
11664 | store_pin_configs(codec); | ||
11665 | return 1; | 12007 | return 1; |
11666 | } | 12008 | } |
11667 | 12009 | ||
@@ -11723,7 +12065,7 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = { | |||
11723 | 12065 | ||
11724 | static struct alc_config_preset alc268_presets[] = { | 12066 | static struct alc_config_preset alc268_presets[] = { |
11725 | [ALC267_QUANTA_IL1] = { | 12067 | [ALC267_QUANTA_IL1] = { |
11726 | .mixers = { alc267_quanta_il1_mixer }, | 12068 | .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, |
11727 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12069 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11728 | alc267_quanta_il1_verbs }, | 12070 | alc267_quanta_il1_verbs }, |
11729 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12071 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
@@ -11805,7 +12147,8 @@ static struct alc_config_preset alc268_presets[] = { | |||
11805 | }, | 12147 | }, |
11806 | [ALC268_ACER_ASPIRE_ONE] = { | 12148 | [ALC268_ACER_ASPIRE_ONE] = { |
11807 | .mixers = { alc268_acer_aspire_one_mixer, | 12149 | .mixers = { alc268_acer_aspire_one_mixer, |
11808 | alc268_capture_alt_mixer }, | 12150 | alc268_beep_mixer, |
12151 | alc268_capture_alt_mixer }, | ||
11809 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, | 12152 | .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, |
11810 | alc268_acer_aspire_one_verbs }, | 12153 | alc268_acer_aspire_one_verbs }, |
11811 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), | 12154 | .num_dacs = ARRAY_SIZE(alc268_dac_nids), |
@@ -11874,7 +12217,7 @@ static int patch_alc268(struct hda_codec *codec) | |||
11874 | { | 12217 | { |
11875 | struct alc_spec *spec; | 12218 | struct alc_spec *spec; |
11876 | int board_config; | 12219 | int board_config; |
11877 | int err; | 12220 | int i, has_beep, err; |
11878 | 12221 | ||
11879 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); | 12222 | spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); |
11880 | if (spec == NULL) | 12223 | if (spec == NULL) |
@@ -11923,15 +12266,30 @@ static int patch_alc268(struct hda_codec *codec) | |||
11923 | 12266 | ||
11924 | spec->stream_digital_playback = &alc268_pcm_digital_playback; | 12267 | spec->stream_digital_playback = &alc268_pcm_digital_playback; |
11925 | 12268 | ||
11926 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | 12269 | has_beep = 0; |
11927 | /* override the amp caps for beep generator */ | 12270 | for (i = 0; i < spec->num_mixers; i++) { |
11928 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | 12271 | if (spec->mixers[i] == alc268_beep_mixer) { |
12272 | has_beep = 1; | ||
12273 | break; | ||
12274 | } | ||
12275 | } | ||
12276 | |||
12277 | if (has_beep) { | ||
12278 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
12279 | if (err < 0) { | ||
12280 | alc_free(codec); | ||
12281 | return err; | ||
12282 | } | ||
12283 | if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) | ||
12284 | /* override the amp caps for beep generator */ | ||
12285 | snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, | ||
11929 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | | 12286 | (0x0c << AC_AMPCAP_OFFSET_SHIFT) | |
11930 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | | 12287 | (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | |
11931 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | | 12288 | (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | |
11932 | (0 << AC_AMPCAP_MUTE_SHIFT)); | 12289 | (0 << AC_AMPCAP_MUTE_SHIFT)); |
12290 | } | ||
11933 | 12291 | ||
11934 | if (!spec->adc_nids && spec->input_mux) { | 12292 | if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { |
11935 | /* check whether NID 0x07 is valid */ | 12293 | /* check whether NID 0x07 is valid */ |
11936 | unsigned int wcap = get_wcaps(codec, 0x07); | 12294 | unsigned int wcap = get_wcaps(codec, 0x07); |
11937 | int i; | 12295 | int i; |
@@ -12012,8 +12370,6 @@ static struct snd_kcontrol_new alc269_base_mixer[] = { | |||
12012 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), | 12370 | HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), |
12013 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 12371 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
12014 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 12372 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
12015 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), | ||
12016 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), | ||
12017 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), | 12373 | HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), |
12018 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 12374 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
12019 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 12375 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
@@ -12040,8 +12396,6 @@ static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = { | |||
12040 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 12396 | HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |
12041 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), | 12397 | HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), |
12042 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), | 12398 | HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), |
12043 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
12044 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
12045 | { } | 12399 | { } |
12046 | }; | 12400 | }; |
12047 | 12401 | ||
@@ -12065,8 +12419,6 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = { | |||
12065 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), | 12419 | HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x0b, 0x03, HDA_INPUT), |
12066 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), | 12420 | HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), |
12067 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), | 12421 | HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), |
12068 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT), | ||
12069 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT), | ||
12070 | { } | 12422 | { } |
12071 | }; | 12423 | }; |
12072 | 12424 | ||
@@ -12103,13 +12455,6 @@ static struct snd_kcontrol_new alc269_fujitsu_mixer[] = { | |||
12103 | { } /* end */ | 12455 | { } /* end */ |
12104 | }; | 12456 | }; |
12105 | 12457 | ||
12106 | /* beep control */ | ||
12107 | static struct snd_kcontrol_new alc269_beep_mixer[] = { | ||
12108 | HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT), | ||
12109 | HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT), | ||
12110 | { } /* end */ | ||
12111 | }; | ||
12112 | |||
12113 | static struct hda_verb alc269_quanta_fl1_verbs[] = { | 12458 | static struct hda_verb alc269_quanta_fl1_verbs[] = { |
12114 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, | 12459 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, |
12115 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, | 12460 | {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, |
@@ -12509,7 +12854,7 @@ static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, | |||
12509 | */ | 12854 | */ |
12510 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || | 12855 | if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || |
12511 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { | 12856 | cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { |
12512 | struct hda_input_mux *imux = &spec->private_imux; | 12857 | struct hda_input_mux *imux = &spec->private_imux[0]; |
12513 | imux->items[imux->num_items].label = "Int Mic"; | 12858 | imux->items[imux->num_items].label = "Int Mic"; |
12514 | imux->items[imux->num_items].index = 0x05; | 12859 | imux->items[imux->num_items].index = 0x05; |
12515 | imux->num_items++; | 12860 | imux->num_items++; |
@@ -12527,13 +12872,34 @@ static int alc269_auto_create_analog_input_ctls(struct alc_spec *spec, | |||
12527 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback | 12872 | #define alc269_pcm_digital_playback alc880_pcm_digital_playback |
12528 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture | 12873 | #define alc269_pcm_digital_capture alc880_pcm_digital_capture |
12529 | 12874 | ||
12875 | static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { | ||
12876 | .substreams = 1, | ||
12877 | .channels_min = 2, | ||
12878 | .channels_max = 8, | ||
12879 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | ||
12880 | /* NID is set in alc_build_pcms */ | ||
12881 | .ops = { | ||
12882 | .open = alc880_playback_pcm_open, | ||
12883 | .prepare = alc880_playback_pcm_prepare, | ||
12884 | .cleanup = alc880_playback_pcm_cleanup | ||
12885 | }, | ||
12886 | }; | ||
12887 | |||
12888 | static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { | ||
12889 | .substreams = 1, | ||
12890 | .channels_min = 2, | ||
12891 | .channels_max = 2, | ||
12892 | .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ | ||
12893 | /* NID is set in alc_build_pcms */ | ||
12894 | }; | ||
12895 | |||
12530 | /* | 12896 | /* |
12531 | * BIOS auto configuration | 12897 | * BIOS auto configuration |
12532 | */ | 12898 | */ |
12533 | static int alc269_parse_auto_config(struct hda_codec *codec) | 12899 | static int alc269_parse_auto_config(struct hda_codec *codec) |
12534 | { | 12900 | { |
12535 | struct alc_spec *spec = codec->spec; | 12901 | struct alc_spec *spec = codec->spec; |
12536 | int i, err; | 12902 | int err; |
12537 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; | 12903 | static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; |
12538 | 12904 | ||
12539 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, | 12905 | err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, |
@@ -12550,22 +12916,15 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
12550 | 12916 | ||
12551 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 12917 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
12552 | 12918 | ||
12553 | if (spec->autocfg.dig_out_pin) | 12919 | if (spec->autocfg.dig_outs) |
12554 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; | 12920 | spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; |
12555 | 12921 | ||
12556 | if (spec->kctls.list) | 12922 | if (spec->kctls.list) |
12557 | add_mixer(spec, spec->kctls.list); | 12923 | add_mixer(spec, spec->kctls.list); |
12558 | 12924 | ||
12559 | /* create a beep mixer control if the pin 0x1d isn't assigned */ | ||
12560 | for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++) | ||
12561 | if (spec->autocfg.input_pins[i] == 0x1d) | ||
12562 | break; | ||
12563 | if (i >= ARRAY_SIZE(spec->autocfg.input_pins)) | ||
12564 | add_mixer(spec, alc269_beep_mixer); | ||
12565 | |||
12566 | add_verb(spec, alc269_init_verbs); | 12925 | add_verb(spec, alc269_init_verbs); |
12567 | spec->num_mux_defs = 1; | 12926 | spec->num_mux_defs = 1; |
12568 | spec->input_mux = &spec->private_imux; | 12927 | spec->input_mux = &spec->private_imux[0]; |
12569 | /* set default input source */ | 12928 | /* set default input source */ |
12570 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], | 12929 | snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], |
12571 | 0, AC_VERB_SET_CONNECT_SEL, | 12930 | 0, AC_VERB_SET_CONNECT_SEL, |
@@ -12575,10 +12934,9 @@ static int alc269_parse_auto_config(struct hda_codec *codec) | |||
12575 | if (err < 0) | 12934 | if (err < 0) |
12576 | return err; | 12935 | return err; |
12577 | 12936 | ||
12578 | if (!spec->cap_mixer) | 12937 | if (!spec->cap_mixer && !spec->no_analog) |
12579 | set_capture_mixer(spec); | 12938 | set_capture_mixer(spec); |
12580 | 12939 | ||
12581 | store_pin_configs(codec); | ||
12582 | return 1; | 12940 | return 1; |
12583 | } | 12941 | } |
12584 | 12942 | ||
@@ -12675,7 +13033,7 @@ static struct alc_config_preset alc269_presets[] = { | |||
12675 | .init_hook = alc269_eeepc_dmic_inithook, | 13033 | .init_hook = alc269_eeepc_dmic_inithook, |
12676 | }, | 13034 | }, |
12677 | [ALC269_FUJITSU] = { | 13035 | [ALC269_FUJITSU] = { |
12678 | .mixers = { alc269_fujitsu_mixer, alc269_beep_mixer }, | 13036 | .mixers = { alc269_fujitsu_mixer }, |
12679 | .cap_mixer = alc269_epc_capture_mixer, | 13037 | .cap_mixer = alc269_epc_capture_mixer, |
12680 | .init_verbs = { alc269_init_verbs, | 13038 | .init_verbs = { alc269_init_verbs, |
12681 | alc269_eeepc_dmic_init_verbs }, | 13039 | alc269_eeepc_dmic_init_verbs }, |
@@ -12740,13 +13098,26 @@ static int patch_alc269(struct hda_codec *codec) | |||
12740 | } | 13098 | } |
12741 | } | 13099 | } |
12742 | 13100 | ||
13101 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
13102 | if (err < 0) { | ||
13103 | alc_free(codec); | ||
13104 | return err; | ||
13105 | } | ||
13106 | |||
12743 | if (board_config != ALC269_AUTO) | 13107 | if (board_config != ALC269_AUTO) |
12744 | setup_preset(spec, &alc269_presets[board_config]); | 13108 | setup_preset(spec, &alc269_presets[board_config]); |
12745 | 13109 | ||
12746 | spec->stream_name_analog = "ALC269 Analog"; | 13110 | spec->stream_name_analog = "ALC269 Analog"; |
12747 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | 13111 | if (codec->subsystem_id == 0x17aa3bf8) { |
12748 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | 13112 | /* Due to a hardware problem on Lenovo Ideadpad, we need to |
12749 | 13113 | * fix the sample rate of analog I/O to 44.1kHz | |
13114 | */ | ||
13115 | spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; | ||
13116 | spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; | ||
13117 | } else { | ||
13118 | spec->stream_analog_playback = &alc269_pcm_analog_playback; | ||
13119 | spec->stream_analog_capture = &alc269_pcm_analog_capture; | ||
13120 | } | ||
12750 | spec->stream_name_digital = "ALC269 Digital"; | 13121 | spec->stream_name_digital = "ALC269 Digital"; |
12751 | spec->stream_digital_playback = &alc269_pcm_digital_playback; | 13122 | spec->stream_digital_playback = &alc269_pcm_digital_playback; |
12752 | spec->stream_digital_capture = &alc269_pcm_digital_capture; | 13123 | spec->stream_digital_capture = &alc269_pcm_digital_capture; |
@@ -12756,6 +13127,7 @@ static int patch_alc269(struct hda_codec *codec) | |||
12756 | spec->capsrc_nids = alc269_capsrc_nids; | 13127 | spec->capsrc_nids = alc269_capsrc_nids; |
12757 | if (!spec->cap_mixer) | 13128 | if (!spec->cap_mixer) |
12758 | set_capture_mixer(spec); | 13129 | set_capture_mixer(spec); |
13130 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | ||
12759 | 13131 | ||
12760 | codec->patch_ops = alc_patch_ops; | 13132 | codec->patch_ops = alc_patch_ops; |
12761 | if (board_config == ALC269_AUTO) | 13133 | if (board_config == ALC269_AUTO) |
@@ -13006,8 +13378,6 @@ static struct snd_kcontrol_new alc861_asus_mixer[] = { | |||
13006 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { | 13378 | static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { |
13007 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), | 13379 | HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), |
13008 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), | 13380 | HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), |
13009 | HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), | ||
13010 | HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), | ||
13011 | { } | 13381 | { } |
13012 | }; | 13382 | }; |
13013 | 13383 | ||
@@ -13481,7 +13851,7 @@ static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) | |||
13481 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, | 13851 | static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, |
13482 | const struct auto_pin_cfg *cfg) | 13852 | const struct auto_pin_cfg *cfg) |
13483 | { | 13853 | { |
13484 | struct hda_input_mux *imux = &spec->private_imux; | 13854 | struct hda_input_mux *imux = &spec->private_imux[0]; |
13485 | int i, err, idx, idx1; | 13855 | int i, err, idx, idx1; |
13486 | 13856 | ||
13487 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 13857 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
@@ -13568,12 +13938,8 @@ static void alc861_auto_init_analog_input(struct hda_codec *codec) | |||
13568 | 13938 | ||
13569 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 13939 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
13570 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 13940 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
13571 | if (nid >= 0x0c && nid <= 0x11) { | 13941 | if (nid >= 0x0c && nid <= 0x11) |
13572 | snd_hda_codec_write(codec, nid, 0, | 13942 | alc_set_input_pin(codec, nid, i); |
13573 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
13574 | i <= AUTO_PIN_FRONT_MIC ? | ||
13575 | PIN_VREF80 : PIN_IN); | ||
13576 | } | ||
13577 | } | 13943 | } |
13578 | } | 13944 | } |
13579 | 13945 | ||
@@ -13609,7 +13975,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
13609 | 13975 | ||
13610 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 13976 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
13611 | 13977 | ||
13612 | if (spec->autocfg.dig_out_pin) | 13978 | if (spec->autocfg.dig_outs) |
13613 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; | 13979 | spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; |
13614 | 13980 | ||
13615 | if (spec->kctls.list) | 13981 | if (spec->kctls.list) |
@@ -13618,13 +13984,12 @@ static int alc861_parse_auto_config(struct hda_codec *codec) | |||
13618 | add_verb(spec, alc861_auto_init_verbs); | 13984 | add_verb(spec, alc861_auto_init_verbs); |
13619 | 13985 | ||
13620 | spec->num_mux_defs = 1; | 13986 | spec->num_mux_defs = 1; |
13621 | spec->input_mux = &spec->private_imux; | 13987 | spec->input_mux = &spec->private_imux[0]; |
13622 | 13988 | ||
13623 | spec->adc_nids = alc861_adc_nids; | 13989 | spec->adc_nids = alc861_adc_nids; |
13624 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); | 13990 | spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); |
13625 | set_capture_mixer(spec); | 13991 | set_capture_mixer(spec); |
13626 | 13992 | ||
13627 | store_pin_configs(codec); | ||
13628 | return 1; | 13993 | return 1; |
13629 | } | 13994 | } |
13630 | 13995 | ||
@@ -13833,6 +14198,12 @@ static int patch_alc861(struct hda_codec *codec) | |||
13833 | } | 14198 | } |
13834 | } | 14199 | } |
13835 | 14200 | ||
14201 | err = snd_hda_attach_beep_device(codec, 0x23); | ||
14202 | if (err < 0) { | ||
14203 | alc_free(codec); | ||
14204 | return err; | ||
14205 | } | ||
14206 | |||
13836 | if (board_config != ALC861_AUTO) | 14207 | if (board_config != ALC861_AUTO) |
13837 | setup_preset(spec, &alc861_presets[board_config]); | 14208 | setup_preset(spec, &alc861_presets[board_config]); |
13838 | 14209 | ||
@@ -13844,6 +14215,8 @@ static int patch_alc861(struct hda_codec *codec) | |||
13844 | spec->stream_digital_playback = &alc861_pcm_digital_playback; | 14215 | spec->stream_digital_playback = &alc861_pcm_digital_playback; |
13845 | spec->stream_digital_capture = &alc861_pcm_digital_capture; | 14216 | spec->stream_digital_capture = &alc861_pcm_digital_capture; |
13846 | 14217 | ||
14218 | set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); | ||
14219 | |||
13847 | spec->vmaster_nid = 0x03; | 14220 | spec->vmaster_nid = 0x03; |
13848 | 14221 | ||
13849 | codec->patch_ops = alc_patch_ops; | 14222 | codec->patch_ops = alc_patch_ops; |
@@ -14000,9 +14373,6 @@ static struct snd_kcontrol_new alc861vd_6st_mixer[] = { | |||
14000 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 14373 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
14001 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 14374 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
14002 | 14375 | ||
14003 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
14004 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
14005 | |||
14006 | { } /* end */ | 14376 | { } /* end */ |
14007 | }; | 14377 | }; |
14008 | 14378 | ||
@@ -14026,9 +14396,6 @@ static struct snd_kcontrol_new alc861vd_3st_mixer[] = { | |||
14026 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), | 14396 | HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), |
14027 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), | 14397 | HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), |
14028 | 14398 | ||
14029 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
14030 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
14031 | |||
14032 | { } /* end */ | 14399 | { } /* end */ |
14033 | }; | 14400 | }; |
14034 | 14401 | ||
@@ -14067,8 +14434,6 @@ static struct snd_kcontrol_new alc861vd_dallas_mixer[] = { | |||
14067 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), | 14434 | HDA_CODEC_VOLUME("Int Mic Boost", 0x19, 0, HDA_INPUT), |
14068 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 14435 | HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
14069 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 14436 | HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
14070 | HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT), | ||
14071 | HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT), | ||
14072 | { } /* end */ | 14437 | { } /* end */ |
14073 | }; | 14438 | }; |
14074 | 14439 | ||
@@ -14379,9 +14744,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = { | |||
14379 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), | 14744 | SND_PCI_QUIRK(0x1179, 0xff03, "Toshiba P205", ALC861VD_LENOVO), |
14380 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), | 14745 | SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), |
14381 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), | 14746 | SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), |
14382 | SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), | 14747 | SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), |
14383 | SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), | ||
14384 | SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), | ||
14385 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), | 14748 | SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), |
14386 | {} | 14749 | {} |
14387 | }; | 14750 | }; |
@@ -14543,11 +14906,9 @@ static void alc861vd_auto_init_analog_input(struct hda_codec *codec) | |||
14543 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 14906 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
14544 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 14907 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
14545 | if (alc861vd_is_input_pin(nid)) { | 14908 | if (alc861vd_is_input_pin(nid)) { |
14546 | snd_hda_codec_write(codec, nid, 0, | 14909 | alc_set_input_pin(codec, nid, i); |
14547 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 14910 | if (nid != ALC861VD_PIN_CD_NID && |
14548 | i <= AUTO_PIN_FRONT_MIC ? | 14911 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
14549 | PIN_VREF80 : PIN_IN); | ||
14550 | if (nid != ALC861VD_PIN_CD_NID) | ||
14551 | snd_hda_codec_write(codec, nid, 0, | 14912 | snd_hda_codec_write(codec, nid, 0, |
14552 | AC_VERB_SET_AMP_GAIN_MUTE, | 14913 | AC_VERB_SET_AMP_GAIN_MUTE, |
14553 | AMP_OUT_MUTE); | 14914 | AMP_OUT_MUTE); |
@@ -14713,7 +15074,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) | |||
14713 | 15074 | ||
14714 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 15075 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
14715 | 15076 | ||
14716 | if (spec->autocfg.dig_out_pin) | 15077 | if (spec->autocfg.dig_outs) |
14717 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; | 15078 | spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; |
14718 | 15079 | ||
14719 | if (spec->kctls.list) | 15080 | if (spec->kctls.list) |
@@ -14722,13 +15083,12 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec) | |||
14722 | add_verb(spec, alc861vd_volume_init_verbs); | 15083 | add_verb(spec, alc861vd_volume_init_verbs); |
14723 | 15084 | ||
14724 | spec->num_mux_defs = 1; | 15085 | spec->num_mux_defs = 1; |
14725 | spec->input_mux = &spec->private_imux; | 15086 | spec->input_mux = &spec->private_imux[0]; |
14726 | 15087 | ||
14727 | err = alc_auto_add_mic_boost(codec); | 15088 | err = alc_auto_add_mic_boost(codec); |
14728 | if (err < 0) | 15089 | if (err < 0) |
14729 | return err; | 15090 | return err; |
14730 | 15091 | ||
14731 | store_pin_configs(codec); | ||
14732 | return 1; | 15092 | return 1; |
14733 | } | 15093 | } |
14734 | 15094 | ||
@@ -14779,6 +15139,12 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
14779 | } | 15139 | } |
14780 | } | 15140 | } |
14781 | 15141 | ||
15142 | err = snd_hda_attach_beep_device(codec, 0x23); | ||
15143 | if (err < 0) { | ||
15144 | alc_free(codec); | ||
15145 | return err; | ||
15146 | } | ||
15147 | |||
14782 | if (board_config != ALC861VD_AUTO) | 15148 | if (board_config != ALC861VD_AUTO) |
14783 | setup_preset(spec, &alc861vd_presets[board_config]); | 15149 | setup_preset(spec, &alc861vd_presets[board_config]); |
14784 | 15150 | ||
@@ -14801,9 +15167,10 @@ static int patch_alc861vd(struct hda_codec *codec) | |||
14801 | spec->adc_nids = alc861vd_adc_nids; | 15167 | spec->adc_nids = alc861vd_adc_nids; |
14802 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); | 15168 | spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); |
14803 | spec->capsrc_nids = alc861vd_capsrc_nids; | 15169 | spec->capsrc_nids = alc861vd_capsrc_nids; |
14804 | spec->is_mix_capture = 1; | 15170 | spec->capture_style = CAPT_MIX; |
14805 | 15171 | ||
14806 | set_capture_mixer(spec); | 15172 | set_capture_mixer(spec); |
15173 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
14807 | 15174 | ||
14808 | spec->vmaster_nid = 0x02; | 15175 | spec->vmaster_nid = 0x02; |
14809 | 15176 | ||
@@ -14992,8 +15359,6 @@ static struct snd_kcontrol_new alc662_3ST_2ch_mixer[] = { | |||
14992 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 15359 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
14993 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 15360 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
14994 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 15361 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
14995 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
14996 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
14997 | { } /* end */ | 15362 | { } /* end */ |
14998 | }; | 15363 | }; |
14999 | 15364 | ||
@@ -15015,8 +15380,6 @@ static struct snd_kcontrol_new alc662_3ST_6ch_mixer[] = { | |||
15015 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 15380 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
15016 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), | 15381 | HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), |
15017 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), | 15382 | HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), |
15018 | HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), | ||
15019 | HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), | ||
15020 | { } /* end */ | 15383 | { } /* end */ |
15021 | }; | 15384 | }; |
15022 | 15385 | ||
@@ -15992,56 +16355,55 @@ static const char *alc662_models[ALC662_MODEL_LAST] = { | |||
15992 | }; | 16355 | }; |
15993 | 16356 | ||
15994 | static struct snd_pci_quirk alc662_cfg_tbl[] = { | 16357 | static struct snd_pci_quirk alc662_cfg_tbl[] = { |
15995 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), | 16358 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), |
15996 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | ||
15997 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), | ||
15998 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), | ||
15999 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), | ||
16000 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), | ||
16001 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), | ||
16002 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), | 16359 | SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), |
16003 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | 16360 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), |
16004 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | 16361 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), |
16005 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), | ||
16006 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), | 16362 | SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), |
16363 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | ||
16007 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), | 16364 | SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), |
16008 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | ||
16009 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), | ||
16010 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | ||
16011 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), | 16365 | SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), |
16012 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | 16366 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), |
16013 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | 16367 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), |
16368 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | ||
16369 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | ||
16370 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | ||
16014 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), | 16371 | SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), |
16015 | SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), | 16372 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), |
16016 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), | 16373 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), |
16374 | SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), | ||
16017 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), | 16375 | SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), |
16018 | SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), | 16376 | SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), |
16019 | SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), | 16377 | SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), |
16020 | SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), | 16378 | /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ |
16021 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | ||
16022 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), | 16379 | SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), |
16023 | SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), | ||
16024 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | ||
16025 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), | 16380 | SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), |
16026 | SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), | 16381 | SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), |
16382 | SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), | ||
16383 | SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), | ||
16384 | SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), | ||
16385 | SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), | ||
16386 | SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), | ||
16387 | SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), | ||
16388 | /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ | ||
16389 | SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), | ||
16390 | SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), | ||
16391 | SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), | ||
16027 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), | 16392 | SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), |
16028 | SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), | 16393 | SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), |
16029 | SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), | 16394 | SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), |
16030 | SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), | 16395 | SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), |
16031 | SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), | 16396 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), |
16032 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", | 16397 | SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", |
16033 | ALC662_3ST_6ch_DIG), | 16398 | ALC662_3ST_6ch_DIG), |
16034 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | ||
16035 | SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), | ||
16036 | SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), | ||
16037 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", | 16399 | SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", |
16038 | ALC662_3ST_6ch_DIG), | 16400 | ALC662_3ST_6ch_DIG), |
16039 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), | 16401 | SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), |
16402 | SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), | ||
16040 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", | 16403 | SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", |
16041 | ALC662_3ST_6ch_DIG), | 16404 | ALC662_3ST_6ch_DIG), |
16042 | SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), | 16405 | SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", |
16043 | SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), | 16406 | ALC663_ASUS_H13), |
16044 | SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), | ||
16045 | {} | 16407 | {} |
16046 | }; | 16408 | }; |
16047 | 16409 | ||
@@ -16361,7 +16723,7 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |||
16361 | 16723 | ||
16362 | if (alc880_is_fixed_pin(pin)) { | 16724 | if (alc880_is_fixed_pin(pin)) { |
16363 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); | 16725 | nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); |
16364 | /* printk("DAC nid=%x\n",nid); */ | 16726 | /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ |
16365 | /* specify the DAC as the extra output */ | 16727 | /* specify the DAC as the extra output */ |
16366 | if (!spec->multiout.hp_nid) | 16728 | if (!spec->multiout.hp_nid) |
16367 | spec->multiout.hp_nid = nid; | 16729 | spec->multiout.hp_nid = nid; |
@@ -16391,26 +16753,58 @@ static int alc662_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, | |||
16391 | return 0; | 16753 | return 0; |
16392 | } | 16754 | } |
16393 | 16755 | ||
16756 | /* return the index of the src widget from the connection list of the nid. | ||
16757 | * return -1 if not found | ||
16758 | */ | ||
16759 | static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, | ||
16760 | hda_nid_t src) | ||
16761 | { | ||
16762 | hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; | ||
16763 | int i, conns; | ||
16764 | |||
16765 | conns = snd_hda_get_connections(codec, nid, conn_list, | ||
16766 | ARRAY_SIZE(conn_list)); | ||
16767 | if (conns < 0) | ||
16768 | return -1; | ||
16769 | for (i = 0; i < conns; i++) | ||
16770 | if (conn_list[i] == src) | ||
16771 | return i; | ||
16772 | return -1; | ||
16773 | } | ||
16774 | |||
16775 | static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) | ||
16776 | { | ||
16777 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); | ||
16778 | return (pincap & AC_PINCAP_IN) != 0; | ||
16779 | } | ||
16780 | |||
16394 | /* create playback/capture controls for input pins */ | 16781 | /* create playback/capture controls for input pins */ |
16395 | static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec, | 16782 | static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, |
16396 | const struct auto_pin_cfg *cfg) | 16783 | const struct auto_pin_cfg *cfg) |
16397 | { | 16784 | { |
16398 | struct hda_input_mux *imux = &spec->private_imux; | 16785 | struct alc_spec *spec = codec->spec; |
16786 | struct hda_input_mux *imux = &spec->private_imux[0]; | ||
16399 | int i, err, idx; | 16787 | int i, err, idx; |
16400 | 16788 | ||
16401 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 16789 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
16402 | if (alc880_is_input_pin(cfg->input_pins[i])) { | 16790 | if (alc662_is_input_pin(codec, cfg->input_pins[i])) { |
16403 | idx = alc880_input_pin_idx(cfg->input_pins[i]); | 16791 | idx = alc662_input_pin_idx(codec, 0x0b, |
16404 | err = new_analog_input(spec, cfg->input_pins[i], | 16792 | cfg->input_pins[i]); |
16405 | auto_pin_cfg_labels[i], | 16793 | if (idx >= 0) { |
16406 | idx, 0x0b); | 16794 | err = new_analog_input(spec, cfg->input_pins[i], |
16407 | if (err < 0) | 16795 | auto_pin_cfg_labels[i], |
16408 | return err; | 16796 | idx, 0x0b); |
16409 | imux->items[imux->num_items].label = | 16797 | if (err < 0) |
16410 | auto_pin_cfg_labels[i]; | 16798 | return err; |
16411 | imux->items[imux->num_items].index = | 16799 | } |
16412 | alc880_input_pin_idx(cfg->input_pins[i]); | 16800 | idx = alc662_input_pin_idx(codec, 0x22, |
16413 | imux->num_items++; | 16801 | cfg->input_pins[i]); |
16802 | if (idx >= 0) { | ||
16803 | imux->items[imux->num_items].label = | ||
16804 | auto_pin_cfg_labels[i]; | ||
16805 | imux->items[imux->num_items].index = idx; | ||
16806 | imux->num_items++; | ||
16807 | } | ||
16414 | } | 16808 | } |
16415 | } | 16809 | } |
16416 | return 0; | 16810 | return 0; |
@@ -16460,7 +16854,6 @@ static void alc662_auto_init_hp_out(struct hda_codec *codec) | |||
16460 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); | 16854 | alc662_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); |
16461 | } | 16855 | } |
16462 | 16856 | ||
16463 | #define alc662_is_input_pin(nid) alc880_is_input_pin(nid) | ||
16464 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID | 16857 | #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID |
16465 | 16858 | ||
16466 | static void alc662_auto_init_analog_input(struct hda_codec *codec) | 16859 | static void alc662_auto_init_analog_input(struct hda_codec *codec) |
@@ -16470,12 +16863,10 @@ static void alc662_auto_init_analog_input(struct hda_codec *codec) | |||
16470 | 16863 | ||
16471 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 16864 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
16472 | hda_nid_t nid = spec->autocfg.input_pins[i]; | 16865 | hda_nid_t nid = spec->autocfg.input_pins[i]; |
16473 | if (alc662_is_input_pin(nid)) { | 16866 | if (alc662_is_input_pin(codec, nid)) { |
16474 | snd_hda_codec_write(codec, nid, 0, | 16867 | alc_set_input_pin(codec, nid, i); |
16475 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 16868 | if (nid != ALC662_PIN_CD_NID && |
16476 | (i <= AUTO_PIN_FRONT_MIC ? | 16869 | (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) |
16477 | PIN_VREF80 : PIN_IN)); | ||
16478 | if (nid != ALC662_PIN_CD_NID) | ||
16479 | snd_hda_codec_write(codec, nid, 0, | 16870 | snd_hda_codec_write(codec, nid, 0, |
16480 | AC_VERB_SET_AMP_GAIN_MUTE, | 16871 | AC_VERB_SET_AMP_GAIN_MUTE, |
16481 | AMP_OUT_MUTE); | 16872 | AMP_OUT_MUTE); |
@@ -16513,20 +16904,20 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
16513 | "Headphone"); | 16904 | "Headphone"); |
16514 | if (err < 0) | 16905 | if (err < 0) |
16515 | return err; | 16906 | return err; |
16516 | err = alc662_auto_create_analog_input_ctls(spec, &spec->autocfg); | 16907 | err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); |
16517 | if (err < 0) | 16908 | if (err < 0) |
16518 | return err; | 16909 | return err; |
16519 | 16910 | ||
16520 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 16911 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
16521 | 16912 | ||
16522 | if (spec->autocfg.dig_out_pin) | 16913 | if (spec->autocfg.dig_outs) |
16523 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; | 16914 | spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; |
16524 | 16915 | ||
16525 | if (spec->kctls.list) | 16916 | if (spec->kctls.list) |
16526 | add_mixer(spec, spec->kctls.list); | 16917 | add_mixer(spec, spec->kctls.list); |
16527 | 16918 | ||
16528 | spec->num_mux_defs = 1; | 16919 | spec->num_mux_defs = 1; |
16529 | spec->input_mux = &spec->private_imux; | 16920 | spec->input_mux = &spec->private_imux[0]; |
16530 | 16921 | ||
16531 | add_verb(spec, alc662_auto_init_verbs); | 16922 | add_verb(spec, alc662_auto_init_verbs); |
16532 | if (codec->vendor_id == 0x10ec0663) | 16923 | if (codec->vendor_id == 0x10ec0663) |
@@ -16536,7 +16927,6 @@ static int alc662_parse_auto_config(struct hda_codec *codec) | |||
16536 | if (err < 0) | 16927 | if (err < 0) |
16537 | return err; | 16928 | return err; |
16538 | 16929 | ||
16539 | store_pin_configs(codec); | ||
16540 | return 1; | 16930 | return 1; |
16541 | } | 16931 | } |
16542 | 16932 | ||
@@ -16588,6 +16978,12 @@ static int patch_alc662(struct hda_codec *codec) | |||
16588 | } | 16978 | } |
16589 | } | 16979 | } |
16590 | 16980 | ||
16981 | err = snd_hda_attach_beep_device(codec, 0x1); | ||
16982 | if (err < 0) { | ||
16983 | alc_free(codec); | ||
16984 | return err; | ||
16985 | } | ||
16986 | |||
16591 | if (board_config != ALC662_AUTO) | 16987 | if (board_config != ALC662_AUTO) |
16592 | setup_preset(spec, &alc662_presets[board_config]); | 16988 | setup_preset(spec, &alc662_presets[board_config]); |
16593 | 16989 | ||
@@ -16611,10 +17007,14 @@ static int patch_alc662(struct hda_codec *codec) | |||
16611 | spec->adc_nids = alc662_adc_nids; | 17007 | spec->adc_nids = alc662_adc_nids; |
16612 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); | 17008 | spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); |
16613 | spec->capsrc_nids = alc662_capsrc_nids; | 17009 | spec->capsrc_nids = alc662_capsrc_nids; |
16614 | spec->is_mix_capture = 1; | 17010 | spec->capture_style = CAPT_MIX; |
16615 | 17011 | ||
16616 | if (!spec->cap_mixer) | 17012 | if (!spec->cap_mixer) |
16617 | set_capture_mixer(spec); | 17013 | set_capture_mixer(spec); |
17014 | if (codec->vendor_id == 0x10ec0662) | ||
17015 | set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); | ||
17016 | else | ||
17017 | set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); | ||
16618 | 17018 | ||
16619 | spec->vmaster_nid = 0x02; | 17019 | spec->vmaster_nid = 0x02; |
16620 | 17020 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 6094344fb223..b5e108aa8f63 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -43,6 +43,7 @@ enum { | |||
43 | }; | 43 | }; |
44 | 44 | ||
45 | enum { | 45 | enum { |
46 | STAC_AUTO, | ||
46 | STAC_REF, | 47 | STAC_REF, |
47 | STAC_9200_OQO, | 48 | STAC_9200_OQO, |
48 | STAC_9200_DELL_D21, | 49 | STAC_9200_DELL_D21, |
@@ -62,14 +63,17 @@ enum { | |||
62 | }; | 63 | }; |
63 | 64 | ||
64 | enum { | 65 | enum { |
66 | STAC_9205_AUTO, | ||
65 | STAC_9205_REF, | 67 | STAC_9205_REF, |
66 | STAC_9205_DELL_M42, | 68 | STAC_9205_DELL_M42, |
67 | STAC_9205_DELL_M43, | 69 | STAC_9205_DELL_M43, |
68 | STAC_9205_DELL_M44, | 70 | STAC_9205_DELL_M44, |
71 | STAC_9205_EAPD, | ||
69 | STAC_9205_MODELS | 72 | STAC_9205_MODELS |
70 | }; | 73 | }; |
71 | 74 | ||
72 | enum { | 75 | enum { |
76 | STAC_92HD73XX_AUTO, | ||
73 | STAC_92HD73XX_NO_JD, /* no jack-detection */ | 77 | STAC_92HD73XX_NO_JD, /* no jack-detection */ |
74 | STAC_92HD73XX_REF, | 78 | STAC_92HD73XX_REF, |
75 | STAC_DELL_M6_AMIC, | 79 | STAC_DELL_M6_AMIC, |
@@ -80,22 +84,27 @@ enum { | |||
80 | }; | 84 | }; |
81 | 85 | ||
82 | enum { | 86 | enum { |
87 | STAC_92HD83XXX_AUTO, | ||
83 | STAC_92HD83XXX_REF, | 88 | STAC_92HD83XXX_REF, |
84 | STAC_92HD83XXX_PWR_REF, | 89 | STAC_92HD83XXX_PWR_REF, |
90 | STAC_DELL_S14, | ||
85 | STAC_92HD83XXX_MODELS | 91 | STAC_92HD83XXX_MODELS |
86 | }; | 92 | }; |
87 | 93 | ||
88 | enum { | 94 | enum { |
95 | STAC_92HD71BXX_AUTO, | ||
89 | STAC_92HD71BXX_REF, | 96 | STAC_92HD71BXX_REF, |
90 | STAC_DELL_M4_1, | 97 | STAC_DELL_M4_1, |
91 | STAC_DELL_M4_2, | 98 | STAC_DELL_M4_2, |
92 | STAC_DELL_M4_3, | 99 | STAC_DELL_M4_3, |
93 | STAC_HP_M4, | 100 | STAC_HP_M4, |
94 | STAC_HP_DV5, | 101 | STAC_HP_DV5, |
102 | STAC_HP_HDX, | ||
95 | STAC_92HD71BXX_MODELS | 103 | STAC_92HD71BXX_MODELS |
96 | }; | 104 | }; |
97 | 105 | ||
98 | enum { | 106 | enum { |
107 | STAC_925x_AUTO, | ||
99 | STAC_925x_REF, | 108 | STAC_925x_REF, |
100 | STAC_M1, | 109 | STAC_M1, |
101 | STAC_M1_2, | 110 | STAC_M1_2, |
@@ -108,6 +117,7 @@ enum { | |||
108 | }; | 117 | }; |
109 | 118 | ||
110 | enum { | 119 | enum { |
120 | STAC_922X_AUTO, | ||
111 | STAC_D945_REF, | 121 | STAC_D945_REF, |
112 | STAC_D945GTP3, | 122 | STAC_D945GTP3, |
113 | STAC_D945GTP5, | 123 | STAC_D945GTP5, |
@@ -135,6 +145,7 @@ enum { | |||
135 | }; | 145 | }; |
136 | 146 | ||
137 | enum { | 147 | enum { |
148 | STAC_927X_AUTO, | ||
138 | STAC_D965_REF_NO_JD, /* no jack-detection */ | 149 | STAC_D965_REF_NO_JD, /* no jack-detection */ |
139 | STAC_D965_REF, | 150 | STAC_D965_REF, |
140 | STAC_D965_3ST, | 151 | STAC_D965_3ST, |
@@ -144,6 +155,12 @@ enum { | |||
144 | STAC_927X_MODELS | 155 | STAC_927X_MODELS |
145 | }; | 156 | }; |
146 | 157 | ||
158 | enum { | ||
159 | STAC_9872_AUTO, | ||
160 | STAC_9872_VAIO, | ||
161 | STAC_9872_MODELS | ||
162 | }; | ||
163 | |||
147 | struct sigmatel_event { | 164 | struct sigmatel_event { |
148 | hda_nid_t nid; | 165 | hda_nid_t nid; |
149 | unsigned char type; | 166 | unsigned char type; |
@@ -167,6 +184,7 @@ struct sigmatel_spec { | |||
167 | unsigned int alt_switch: 1; | 184 | unsigned int alt_switch: 1; |
168 | unsigned int hp_detect: 1; | 185 | unsigned int hp_detect: 1; |
169 | unsigned int spdif_mute: 1; | 186 | unsigned int spdif_mute: 1; |
187 | unsigned int check_volume_offset:1; | ||
170 | 188 | ||
171 | /* gpio lines */ | 189 | /* gpio lines */ |
172 | unsigned int eapd_mask; | 190 | unsigned int eapd_mask; |
@@ -179,6 +197,7 @@ struct sigmatel_spec { | |||
179 | unsigned int stream_delay; | 197 | unsigned int stream_delay; |
180 | 198 | ||
181 | /* analog loopback */ | 199 | /* analog loopback */ |
200 | struct snd_kcontrol_new *aloopback_ctl; | ||
182 | unsigned char aloopback_mask; | 201 | unsigned char aloopback_mask; |
183 | unsigned char aloopback_shift; | 202 | unsigned char aloopback_shift; |
184 | 203 | ||
@@ -203,6 +222,8 @@ struct sigmatel_spec { | |||
203 | hda_nid_t hp_dacs[5]; | 222 | hda_nid_t hp_dacs[5]; |
204 | hda_nid_t speaker_dacs[5]; | 223 | hda_nid_t speaker_dacs[5]; |
205 | 224 | ||
225 | int volume_offset; | ||
226 | |||
206 | /* capture */ | 227 | /* capture */ |
207 | hda_nid_t *adc_nids; | 228 | hda_nid_t *adc_nids; |
208 | unsigned int num_adcs; | 229 | unsigned int num_adcs; |
@@ -224,7 +245,6 @@ struct sigmatel_spec { | |||
224 | /* pin widgets */ | 245 | /* pin widgets */ |
225 | hda_nid_t *pin_nids; | 246 | hda_nid_t *pin_nids; |
226 | unsigned int num_pins; | 247 | unsigned int num_pins; |
227 | unsigned int *pin_configs; | ||
228 | 248 | ||
229 | /* codec specific stuff */ | 249 | /* codec specific stuff */ |
230 | struct hda_verb *init; | 250 | struct hda_verb *init; |
@@ -400,6 +420,10 @@ static hda_nid_t stac922x_mux_nids[2] = { | |||
400 | 0x12, 0x13, | 420 | 0x12, 0x13, |
401 | }; | 421 | }; |
402 | 422 | ||
423 | static hda_nid_t stac927x_slave_dig_outs[2] = { | ||
424 | 0x1f, 0, | ||
425 | }; | ||
426 | |||
403 | static hda_nid_t stac927x_adc_nids[3] = { | 427 | static hda_nid_t stac927x_adc_nids[3] = { |
404 | 0x07, 0x08, 0x09 | 428 | 0x07, 0x08, 0x09 |
405 | }; | 429 | }; |
@@ -472,15 +496,21 @@ static hda_nid_t stac92hd73xx_pin_nids[13] = { | |||
472 | 0x14, 0x22, 0x23 | 496 | 0x14, 0x22, 0x23 |
473 | }; | 497 | }; |
474 | 498 | ||
475 | static hda_nid_t stac92hd83xxx_pin_nids[14] = { | 499 | static hda_nid_t stac92hd83xxx_pin_nids[10] = { |
476 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, | 500 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
477 | 0x0f, 0x10, 0x11, 0x12, 0x13, | 501 | 0x0f, 0x10, 0x11, 0x1f, 0x20, |
478 | 0x1d, 0x1e, 0x1f, 0x20 | 502 | }; |
503 | |||
504 | #define STAC92HD71BXX_NUM_PINS 13 | ||
505 | static hda_nid_t stac92hd71bxx_pin_nids_4port[STAC92HD71BXX_NUM_PINS] = { | ||
506 | 0x0a, 0x0b, 0x0c, 0x0d, 0x00, | ||
507 | 0x00, 0x14, 0x18, 0x19, 0x1e, | ||
508 | 0x1f, 0x20, 0x27 | ||
479 | }; | 509 | }; |
480 | static hda_nid_t stac92hd71bxx_pin_nids[11] = { | 510 | static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = { |
481 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, | 511 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, |
482 | 0x0f, 0x14, 0x18, 0x19, 0x1e, | 512 | 0x0f, 0x14, 0x18, 0x19, 0x1e, |
483 | 0x1f, | 513 | 0x1f, 0x20, 0x27 |
484 | }; | 514 | }; |
485 | 515 | ||
486 | static hda_nid_t stac927x_pin_nids[14] = { | 516 | static hda_nid_t stac927x_pin_nids[14] = { |
@@ -842,9 +872,9 @@ static struct hda_verb stac92hd73xx_10ch_core_init[] = { | |||
842 | }; | 872 | }; |
843 | 873 | ||
844 | static struct hda_verb stac92hd83xxx_core_init[] = { | 874 | static struct hda_verb stac92hd83xxx_core_init[] = { |
845 | { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0}, | 875 | { 0xa, AC_VERB_SET_CONNECT_SEL, 0x1}, |
846 | { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0}, | 876 | { 0xb, AC_VERB_SET_CONNECT_SEL, 0x1}, |
847 | { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1}, | 877 | { 0xd, AC_VERB_SET_CONNECT_SEL, 0x0}, |
848 | 878 | ||
849 | /* power state controls amps */ | 879 | /* power state controls amps */ |
850 | { 0x01, AC_VERB_SET_EAPD, 1 << 2}, | 880 | { 0x01, AC_VERB_SET_EAPD, 1 << 2}, |
@@ -854,26 +884,25 @@ static struct hda_verb stac92hd83xxx_core_init[] = { | |||
854 | static struct hda_verb stac92hd71bxx_core_init[] = { | 884 | static struct hda_verb stac92hd71bxx_core_init[] = { |
855 | /* set master volume and direct control */ | 885 | /* set master volume and direct control */ |
856 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 886 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
857 | /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ | ||
858 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
859 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
860 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
861 | {} | 887 | {} |
862 | }; | 888 | }; |
863 | 889 | ||
864 | #define HD_DISABLE_PORTF 2 | 890 | #define HD_DISABLE_PORTF 1 |
865 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { | 891 | static struct hda_verb stac92hd71bxx_analog_core_init[] = { |
866 | /* start of config #1 */ | 892 | /* start of config #1 */ |
867 | 893 | ||
868 | /* connect port 0f to audio mixer */ | 894 | /* connect port 0f to audio mixer */ |
869 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, | 895 | { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, |
870 | /* unmute right and left channels for node 0x0f */ | ||
871 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
872 | /* start of config #2 */ | 896 | /* start of config #2 */ |
873 | 897 | ||
874 | /* set master volume and direct control */ | 898 | /* set master volume and direct control */ |
875 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, | 899 | { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, |
876 | /* unmute right and left channels for nodes 0x0a, 0xd */ | 900 | {} |
901 | }; | ||
902 | |||
903 | static struct hda_verb stac92hd71bxx_unmute_core_init[] = { | ||
904 | /* unmute right and left channels for nodes 0x0f, 0xa, 0x0d */ | ||
905 | { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | ||
877 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 906 | { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
878 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, | 907 | { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, |
879 | {} | 908 | {} |
@@ -954,16 +983,6 @@ static struct hda_verb stac9205_core_init[] = { | |||
954 | .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ | 983 | .private_value = HDA_COMPOSE_AMP_VAL(nid, chs, idx, dir) \ |
955 | } | 984 | } |
956 | 985 | ||
957 | #define STAC_INPUT_SOURCE(cnt) \ | ||
958 | { \ | ||
959 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | ||
960 | .name = "Input Source", \ | ||
961 | .count = cnt, \ | ||
962 | .info = stac92xx_mux_enum_info, \ | ||
963 | .get = stac92xx_mux_enum_get, \ | ||
964 | .put = stac92xx_mux_enum_put, \ | ||
965 | } | ||
966 | |||
967 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ | 986 | #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ |
968 | { \ | 987 | { \ |
969 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ | 988 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ |
@@ -978,7 +997,6 @@ static struct hda_verb stac9205_core_init[] = { | |||
978 | static struct snd_kcontrol_new stac9200_mixer[] = { | 997 | static struct snd_kcontrol_new stac9200_mixer[] = { |
979 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), | 998 | HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), |
980 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), | 999 | HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), |
981 | STAC_INPUT_SOURCE(1), | ||
982 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), | 1000 | HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), |
983 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), | 1001 | HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), |
984 | { } /* end */ | 1002 | { } /* end */ |
@@ -1003,8 +1021,6 @@ static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { | |||
1003 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), | 1021 | HDA_CODEC_VOLUME("DAC Mixer Capture Volume", 0x1d, 0x3, HDA_INPUT), |
1004 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), | 1022 | HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), |
1005 | 1023 | ||
1006 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), | ||
1007 | |||
1008 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), | 1024 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
1009 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), | 1025 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
1010 | 1026 | ||
@@ -1014,9 +1030,22 @@ static struct snd_kcontrol_new stac92hd73xx_6ch_mixer[] = { | |||
1014 | { } /* end */ | 1030 | { } /* end */ |
1015 | }; | 1031 | }; |
1016 | 1032 | ||
1017 | static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { | 1033 | static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { |
1034 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), | ||
1035 | {} | ||
1036 | }; | ||
1037 | |||
1038 | static struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = { | ||
1018 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), | 1039 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), |
1040 | {} | ||
1041 | }; | ||
1019 | 1042 | ||
1043 | static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = { | ||
1044 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), | ||
1045 | {} | ||
1046 | }; | ||
1047 | |||
1048 | static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { | ||
1020 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), | 1049 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
1021 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), | 1050 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
1022 | 1051 | ||
@@ -1041,8 +1070,6 @@ static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { | |||
1041 | }; | 1070 | }; |
1042 | 1071 | ||
1043 | static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { | 1072 | static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { |
1044 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), | ||
1045 | |||
1046 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), | 1073 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), |
1047 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), | 1074 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), |
1048 | 1075 | ||
@@ -1094,9 +1121,6 @@ static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { | |||
1094 | }; | 1121 | }; |
1095 | 1122 | ||
1096 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { | 1123 | static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { |
1097 | STAC_INPUT_SOURCE(2), | ||
1098 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), | ||
1099 | |||
1100 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1124 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
1101 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1125 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
1102 | 1126 | ||
@@ -1122,10 +1146,11 @@ static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { | |||
1122 | { } /* end */ | 1146 | { } /* end */ |
1123 | }; | 1147 | }; |
1124 | 1148 | ||
1125 | static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { | 1149 | static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { |
1126 | STAC_INPUT_SOURCE(2), | 1150 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) |
1127 | STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2), | 1151 | }; |
1128 | 1152 | ||
1153 | static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { | ||
1129 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1154 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
1130 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), | 1155 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), |
1131 | 1156 | ||
@@ -1137,16 +1162,12 @@ static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { | |||
1137 | static struct snd_kcontrol_new stac925x_mixer[] = { | 1162 | static struct snd_kcontrol_new stac925x_mixer[] = { |
1138 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), | 1163 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), |
1139 | HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), | 1164 | HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), |
1140 | STAC_INPUT_SOURCE(1), | ||
1141 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), | 1165 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), |
1142 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), | 1166 | HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), |
1143 | { } /* end */ | 1167 | { } /* end */ |
1144 | }; | 1168 | }; |
1145 | 1169 | ||
1146 | static struct snd_kcontrol_new stac9205_mixer[] = { | 1170 | static struct snd_kcontrol_new stac9205_mixer[] = { |
1147 | STAC_INPUT_SOURCE(2), | ||
1148 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), | ||
1149 | |||
1150 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), | 1171 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), |
1151 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), | 1172 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), |
1152 | 1173 | ||
@@ -1155,9 +1176,13 @@ static struct snd_kcontrol_new stac9205_mixer[] = { | |||
1155 | { } /* end */ | 1176 | { } /* end */ |
1156 | }; | 1177 | }; |
1157 | 1178 | ||
1179 | static struct snd_kcontrol_new stac9205_loopback[] = { | ||
1180 | STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), | ||
1181 | {} | ||
1182 | }; | ||
1183 | |||
1158 | /* This needs to be generated dynamically based on sequence */ | 1184 | /* This needs to be generated dynamically based on sequence */ |
1159 | static struct snd_kcontrol_new stac922x_mixer[] = { | 1185 | static struct snd_kcontrol_new stac922x_mixer[] = { |
1160 | STAC_INPUT_SOURCE(2), | ||
1161 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), | 1186 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), |
1162 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), | 1187 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), |
1163 | 1188 | ||
@@ -1168,9 +1193,6 @@ static struct snd_kcontrol_new stac922x_mixer[] = { | |||
1168 | 1193 | ||
1169 | 1194 | ||
1170 | static struct snd_kcontrol_new stac927x_mixer[] = { | 1195 | static struct snd_kcontrol_new stac927x_mixer[] = { |
1171 | STAC_INPUT_SOURCE(3), | ||
1172 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), | ||
1173 | |||
1174 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), | 1196 | HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), |
1175 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), | 1197 | HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), |
1176 | 1198 | ||
@@ -1182,6 +1204,11 @@ static struct snd_kcontrol_new stac927x_mixer[] = { | |||
1182 | { } /* end */ | 1204 | { } /* end */ |
1183 | }; | 1205 | }; |
1184 | 1206 | ||
1207 | static struct snd_kcontrol_new stac927x_loopback[] = { | ||
1208 | STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), | ||
1209 | {} | ||
1210 | }; | ||
1211 | |||
1185 | static struct snd_kcontrol_new stac_dmux_mixer = { | 1212 | static struct snd_kcontrol_new stac_dmux_mixer = { |
1186 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1213 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1187 | .name = "Digital Input Source", | 1214 | .name = "Digital Input Source", |
@@ -1207,10 +1234,7 @@ static const char *slave_vols[] = { | |||
1207 | "LFE Playback Volume", | 1234 | "LFE Playback Volume", |
1208 | "Side Playback Volume", | 1235 | "Side Playback Volume", |
1209 | "Headphone Playback Volume", | 1236 | "Headphone Playback Volume", |
1210 | "Headphone2 Playback Volume", | ||
1211 | "Speaker Playback Volume", | 1237 | "Speaker Playback Volume", |
1212 | "External Speaker Playback Volume", | ||
1213 | "Speaker2 Playback Volume", | ||
1214 | NULL | 1238 | NULL |
1215 | }; | 1239 | }; |
1216 | 1240 | ||
@@ -1221,10 +1245,7 @@ static const char *slave_sws[] = { | |||
1221 | "LFE Playback Switch", | 1245 | "LFE Playback Switch", |
1222 | "Side Playback Switch", | 1246 | "Side Playback Switch", |
1223 | "Headphone Playback Switch", | 1247 | "Headphone Playback Switch", |
1224 | "Headphone2 Playback Switch", | ||
1225 | "Speaker Playback Switch", | 1248 | "Speaker Playback Switch", |
1226 | "External Speaker Playback Switch", | ||
1227 | "Speaker2 Playback Switch", | ||
1228 | "IEC958 Playback Switch", | 1249 | "IEC958 Playback Switch", |
1229 | NULL | 1250 | NULL |
1230 | }; | 1251 | }; |
@@ -1294,6 +1315,8 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
1294 | unsigned int vmaster_tlv[4]; | 1315 | unsigned int vmaster_tlv[4]; |
1295 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], | 1316 | snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], |
1296 | HDA_OUTPUT, vmaster_tlv); | 1317 | HDA_OUTPUT, vmaster_tlv); |
1318 | /* correct volume offset */ | ||
1319 | vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset; | ||
1297 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", | 1320 | err = snd_hda_add_vmaster(codec, "Master Playback Volume", |
1298 | vmaster_tlv, slave_vols); | 1321 | vmaster_tlv, slave_vols); |
1299 | if (err < 0) | 1322 | if (err < 0) |
@@ -1306,6 +1329,13 @@ static int stac92xx_build_controls(struct hda_codec *codec) | |||
1306 | return err; | 1329 | return err; |
1307 | } | 1330 | } |
1308 | 1331 | ||
1332 | if (spec->aloopback_ctl && | ||
1333 | snd_hda_get_bool_hint(codec, "loopback") == 1) { | ||
1334 | err = snd_hda_add_new_ctls(codec, spec->aloopback_ctl); | ||
1335 | if (err < 0) | ||
1336 | return err; | ||
1337 | } | ||
1338 | |||
1309 | stac92xx_free_kctls(codec); /* no longer needed */ | 1339 | stac92xx_free_kctls(codec); /* no longer needed */ |
1310 | 1340 | ||
1311 | /* create jack input elements */ | 1341 | /* create jack input elements */ |
@@ -1490,6 +1520,7 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { | |||
1490 | }; | 1520 | }; |
1491 | 1521 | ||
1492 | static const char *stac9200_models[STAC_9200_MODELS] = { | 1522 | static const char *stac9200_models[STAC_9200_MODELS] = { |
1523 | [STAC_AUTO] = "auto", | ||
1493 | [STAC_REF] = "ref", | 1524 | [STAC_REF] = "ref", |
1494 | [STAC_9200_OQO] = "oqo", | 1525 | [STAC_9200_OQO] = "oqo", |
1495 | [STAC_9200_DELL_D21] = "dell-d21", | 1526 | [STAC_9200_DELL_D21] = "dell-d21", |
@@ -1511,6 +1542,8 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { | |||
1511 | /* SigmaTel reference board */ | 1542 | /* SigmaTel reference board */ |
1512 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1543 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1513 | "DFI LanParty", STAC_REF), | 1544 | "DFI LanParty", STAC_REF), |
1545 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | ||
1546 | "DFI LanParty", STAC_REF), | ||
1514 | /* Dell laptops have BIOS problem */ | 1547 | /* Dell laptops have BIOS problem */ |
1515 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, | 1548 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01a8, |
1516 | "unknown Dell", STAC_9200_DELL_D21), | 1549 | "unknown Dell", STAC_9200_DELL_D21), |
@@ -1633,6 +1666,7 @@ static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { | |||
1633 | }; | 1666 | }; |
1634 | 1667 | ||
1635 | static const char *stac925x_models[STAC_925x_MODELS] = { | 1668 | static const char *stac925x_models[STAC_925x_MODELS] = { |
1669 | [STAC_925x_AUTO] = "auto", | ||
1636 | [STAC_REF] = "ref", | 1670 | [STAC_REF] = "ref", |
1637 | [STAC_M1] = "m1", | 1671 | [STAC_M1] = "m1", |
1638 | [STAC_M1_2] = "m1-2", | 1672 | [STAC_M1_2] = "m1-2", |
@@ -1660,6 +1694,7 @@ static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { | |||
1660 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { | 1694 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
1661 | /* SigmaTel reference board */ | 1695 | /* SigmaTel reference board */ |
1662 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), | 1696 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
1697 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, "DFI LanParty", STAC_REF), | ||
1663 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), | 1698 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
1664 | 1699 | ||
1665 | /* Default table for unknown ID */ | 1700 | /* Default table for unknown ID */ |
@@ -1691,6 +1726,7 @@ static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { | |||
1691 | }; | 1726 | }; |
1692 | 1727 | ||
1693 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { | 1728 | static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { |
1729 | [STAC_92HD73XX_AUTO] = "auto", | ||
1694 | [STAC_92HD73XX_NO_JD] = "no-jd", | 1730 | [STAC_92HD73XX_NO_JD] = "no-jd", |
1695 | [STAC_92HD73XX_REF] = "ref", | 1731 | [STAC_92HD73XX_REF] = "ref", |
1696 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", | 1732 | [STAC_DELL_M6_AMIC] = "dell-m6-amic", |
@@ -1703,6 +1739,8 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1703 | /* SigmaTel reference board */ | 1739 | /* SigmaTel reference board */ |
1704 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1740 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1705 | "DFI LanParty", STAC_92HD73XX_REF), | 1741 | "DFI LanParty", STAC_92HD73XX_REF), |
1742 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | ||
1743 | "DFI LanParty", STAC_92HD73XX_REF), | ||
1706 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, | 1744 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, |
1707 | "Dell Studio 1535", STAC_DELL_M6_DMIC), | 1745 | "Dell Studio 1535", STAC_DELL_M6_DMIC), |
1708 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, | 1746 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, |
@@ -1726,52 +1764,68 @@ static struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { | |||
1726 | {} /* terminator */ | 1764 | {} /* terminator */ |
1727 | }; | 1765 | }; |
1728 | 1766 | ||
1729 | static unsigned int ref92hd83xxx_pin_configs[14] = { | 1767 | static unsigned int ref92hd83xxx_pin_configs[10] = { |
1730 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, | 1768 | 0x02214030, 0x02211010, 0x02a19020, 0x02170130, |
1731 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, | 1769 | 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, |
1732 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0, | ||
1733 | 0x01451160, 0x98560170, | 1770 | 0x01451160, 0x98560170, |
1734 | }; | 1771 | }; |
1735 | 1772 | ||
1773 | static unsigned int dell_s14_pin_configs[10] = { | ||
1774 | 0x02214030, 0x02211010, 0x02a19020, 0x01014050, | ||
1775 | 0x40f000f0, 0x01819040, 0x40f000f0, 0x90a60160, | ||
1776 | 0x40f000f0, 0x40f000f0, | ||
1777 | }; | ||
1778 | |||
1736 | static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { | 1779 | static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { |
1737 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, | 1780 | [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, |
1738 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, | 1781 | [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, |
1782 | [STAC_DELL_S14] = dell_s14_pin_configs, | ||
1739 | }; | 1783 | }; |
1740 | 1784 | ||
1741 | static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { | 1785 | static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { |
1786 | [STAC_92HD83XXX_AUTO] = "auto", | ||
1742 | [STAC_92HD83XXX_REF] = "ref", | 1787 | [STAC_92HD83XXX_REF] = "ref", |
1743 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", | 1788 | [STAC_92HD83XXX_PWR_REF] = "mic-ref", |
1789 | [STAC_DELL_S14] = "dell-s14", | ||
1744 | }; | 1790 | }; |
1745 | 1791 | ||
1746 | static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { | 1792 | static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { |
1747 | /* SigmaTel reference board */ | 1793 | /* SigmaTel reference board */ |
1748 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1794 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1749 | "DFI LanParty", STAC_92HD83XXX_REF), | 1795 | "DFI LanParty", STAC_92HD83XXX_REF), |
1796 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | ||
1797 | "DFI LanParty", STAC_92HD83XXX_REF), | ||
1798 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ba, | ||
1799 | "unknown Dell", STAC_DELL_S14), | ||
1750 | {} /* terminator */ | 1800 | {} /* terminator */ |
1751 | }; | 1801 | }; |
1752 | 1802 | ||
1753 | static unsigned int ref92hd71bxx_pin_configs[11] = { | 1803 | static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
1754 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, | 1804 | 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, |
1755 | 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, | 1805 | 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, |
1756 | 0x90a000f0, 0x01452050, 0x01452050, | 1806 | 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, |
1807 | 0x00000000 | ||
1757 | }; | 1808 | }; |
1758 | 1809 | ||
1759 | static unsigned int dell_m4_1_pin_configs[11] = { | 1810 | static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
1760 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, | 1811 | 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, |
1761 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, | 1812 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, |
1762 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, | 1813 | 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, |
1814 | 0x00000000 | ||
1763 | }; | 1815 | }; |
1764 | 1816 | ||
1765 | static unsigned int dell_m4_2_pin_configs[11] = { | 1817 | static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
1766 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, | 1818 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
1767 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, | 1819 | 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, |
1768 | 0x40f000f0, 0x044413b0, 0x044413b0, | 1820 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
1821 | 0x00000000 | ||
1769 | }; | 1822 | }; |
1770 | 1823 | ||
1771 | static unsigned int dell_m4_3_pin_configs[11] = { | 1824 | static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { |
1772 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, | 1825 | 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, |
1773 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, | 1826 | 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, |
1774 | 0x40f000f0, 0x044413b0, 0x044413b0, | 1827 | 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, |
1828 | 0x00000000 | ||
1775 | }; | 1829 | }; |
1776 | 1830 | ||
1777 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { | 1831 | static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { |
@@ -1781,35 +1835,38 @@ static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { | |||
1781 | [STAC_DELL_M4_3] = dell_m4_3_pin_configs, | 1835 | [STAC_DELL_M4_3] = dell_m4_3_pin_configs, |
1782 | [STAC_HP_M4] = NULL, | 1836 | [STAC_HP_M4] = NULL, |
1783 | [STAC_HP_DV5] = NULL, | 1837 | [STAC_HP_DV5] = NULL, |
1838 | [STAC_HP_HDX] = NULL, | ||
1784 | }; | 1839 | }; |
1785 | 1840 | ||
1786 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { | 1841 | static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { |
1842 | [STAC_92HD71BXX_AUTO] = "auto", | ||
1787 | [STAC_92HD71BXX_REF] = "ref", | 1843 | [STAC_92HD71BXX_REF] = "ref", |
1788 | [STAC_DELL_M4_1] = "dell-m4-1", | 1844 | [STAC_DELL_M4_1] = "dell-m4-1", |
1789 | [STAC_DELL_M4_2] = "dell-m4-2", | 1845 | [STAC_DELL_M4_2] = "dell-m4-2", |
1790 | [STAC_DELL_M4_3] = "dell-m4-3", | 1846 | [STAC_DELL_M4_3] = "dell-m4-3", |
1791 | [STAC_HP_M4] = "hp-m4", | 1847 | [STAC_HP_M4] = "hp-m4", |
1792 | [STAC_HP_DV5] = "hp-dv5", | 1848 | [STAC_HP_DV5] = "hp-dv5", |
1849 | [STAC_HP_HDX] = "hp-hdx", | ||
1793 | }; | 1850 | }; |
1794 | 1851 | ||
1795 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { | 1852 | static struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { |
1796 | /* SigmaTel reference board */ | 1853 | /* SigmaTel reference board */ |
1797 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 1854 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1798 | "DFI LanParty", STAC_92HD71BXX_REF), | 1855 | "DFI LanParty", STAC_92HD71BXX_REF), |
1799 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2, | 1856 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, |
1800 | "HP dv5", STAC_HP_M4), | 1857 | "DFI LanParty", STAC_92HD71BXX_REF), |
1801 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4, | 1858 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080, |
1802 | "HP dv7", STAC_HP_DV5), | 1859 | "HP", STAC_HP_DV5), |
1803 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f7, | 1860 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, |
1804 | "HP dv4", STAC_HP_DV5), | 1861 | "HP dv4-7", STAC_HP_DV5), |
1805 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc, | 1862 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600, |
1806 | "HP dv7", STAC_HP_M4), | 1863 | "HP dv4-7", STAC_HP_DV5), |
1807 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3600, | 1864 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610, |
1808 | "HP dv5", STAC_HP_DV5), | 1865 | "HP HDX", STAC_HP_HDX), /* HDX18 */ |
1809 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603, | ||
1810 | "HP dv5", STAC_HP_DV5), | ||
1811 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, | 1866 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, |
1812 | "unknown HP", STAC_HP_M4), | 1867 | "HP mini 1000", STAC_HP_M4), |
1868 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361b, | ||
1869 | "HP HDX", STAC_HP_HDX), /* HDX16 */ | ||
1813 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, | 1870 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, |
1814 | "unknown Dell", STAC_DELL_M4_1), | 1871 | "unknown Dell", STAC_DELL_M4_1), |
1815 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, | 1872 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, |
@@ -1961,6 +2018,7 @@ static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { | |||
1961 | }; | 2018 | }; |
1962 | 2019 | ||
1963 | static const char *stac922x_models[STAC_922X_MODELS] = { | 2020 | static const char *stac922x_models[STAC_922X_MODELS] = { |
2021 | [STAC_922X_AUTO] = "auto", | ||
1964 | [STAC_D945_REF] = "ref", | 2022 | [STAC_D945_REF] = "ref", |
1965 | [STAC_D945GTP5] = "5stack", | 2023 | [STAC_D945GTP5] = "5stack", |
1966 | [STAC_D945GTP3] = "3stack", | 2024 | [STAC_D945GTP3] = "3stack", |
@@ -1988,6 +2046,8 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { | |||
1988 | /* SigmaTel reference board */ | 2046 | /* SigmaTel reference board */ |
1989 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 2047 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
1990 | "DFI LanParty", STAC_D945_REF), | 2048 | "DFI LanParty", STAC_D945_REF), |
2049 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | ||
2050 | "DFI LanParty", STAC_D945_REF), | ||
1991 | /* Intel 945G based systems */ | 2051 | /* Intel 945G based systems */ |
1992 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, | 2052 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, |
1993 | "Intel D945G", STAC_D945GTP3), | 2053 | "Intel D945G", STAC_D945GTP3), |
@@ -2041,6 +2101,9 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { | |||
2041 | "Intel D945P", STAC_D945GTP3), | 2101 | "Intel D945P", STAC_D945GTP3), |
2042 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, | 2102 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, |
2043 | "Intel D945P", STAC_D945GTP5), | 2103 | "Intel D945P", STAC_D945GTP5), |
2104 | /* other intel */ | ||
2105 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204, | ||
2106 | "Intel D945", STAC_D945_REF), | ||
2044 | /* other systems */ | 2107 | /* other systems */ |
2045 | /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ | 2108 | /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ |
2046 | SND_PCI_QUIRK(0x8384, 0x7680, | 2109 | SND_PCI_QUIRK(0x8384, 0x7680, |
@@ -2065,31 +2128,7 @@ static struct snd_pci_quirk stac922x_cfg_tbl[] = { | |||
2065 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, | 2128 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01d7, |
2066 | "Dell XPS M1210", STAC_922X_DELL_M82), | 2129 | "Dell XPS M1210", STAC_922X_DELL_M82), |
2067 | /* ECS/PC Chips boards */ | 2130 | /* ECS/PC Chips boards */ |
2068 | SND_PCI_QUIRK(0x1019, 0x2144, | 2131 | SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000, |
2069 | "ECS/PC chips", STAC_ECS_202), | ||
2070 | SND_PCI_QUIRK(0x1019, 0x2608, | ||
2071 | "ECS/PC chips", STAC_ECS_202), | ||
2072 | SND_PCI_QUIRK(0x1019, 0x2633, | ||
2073 | "ECS/PC chips P17G/1333", STAC_ECS_202), | ||
2074 | SND_PCI_QUIRK(0x1019, 0x2811, | ||
2075 | "ECS/PC chips", STAC_ECS_202), | ||
2076 | SND_PCI_QUIRK(0x1019, 0x2812, | ||
2077 | "ECS/PC chips", STAC_ECS_202), | ||
2078 | SND_PCI_QUIRK(0x1019, 0x2813, | ||
2079 | "ECS/PC chips", STAC_ECS_202), | ||
2080 | SND_PCI_QUIRK(0x1019, 0x2814, | ||
2081 | "ECS/PC chips", STAC_ECS_202), | ||
2082 | SND_PCI_QUIRK(0x1019, 0x2815, | ||
2083 | "ECS/PC chips", STAC_ECS_202), | ||
2084 | SND_PCI_QUIRK(0x1019, 0x2816, | ||
2085 | "ECS/PC chips", STAC_ECS_202), | ||
2086 | SND_PCI_QUIRK(0x1019, 0x2817, | ||
2087 | "ECS/PC chips", STAC_ECS_202), | ||
2088 | SND_PCI_QUIRK(0x1019, 0x2818, | ||
2089 | "ECS/PC chips", STAC_ECS_202), | ||
2090 | SND_PCI_QUIRK(0x1019, 0x2819, | ||
2091 | "ECS/PC chips", STAC_ECS_202), | ||
2092 | SND_PCI_QUIRK(0x1019, 0x2820, | ||
2093 | "ECS/PC chips", STAC_ECS_202), | 2132 | "ECS/PC chips", STAC_ECS_202), |
2094 | {} /* terminator */ | 2133 | {} /* terminator */ |
2095 | }; | 2134 | }; |
@@ -2132,6 +2171,7 @@ static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { | |||
2132 | }; | 2171 | }; |
2133 | 2172 | ||
2134 | static const char *stac927x_models[STAC_927X_MODELS] = { | 2173 | static const char *stac927x_models[STAC_927X_MODELS] = { |
2174 | [STAC_927X_AUTO] = "auto", | ||
2135 | [STAC_D965_REF_NO_JD] = "ref-no-jd", | 2175 | [STAC_D965_REF_NO_JD] = "ref-no-jd", |
2136 | [STAC_D965_REF] = "ref", | 2176 | [STAC_D965_REF] = "ref", |
2137 | [STAC_D965_3ST] = "3stack", | 2177 | [STAC_D965_3ST] = "3stack", |
@@ -2144,26 +2184,16 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { | |||
2144 | /* SigmaTel reference board */ | 2184 | /* SigmaTel reference board */ |
2145 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 2185 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
2146 | "DFI LanParty", STAC_D965_REF), | 2186 | "DFI LanParty", STAC_D965_REF), |
2187 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | ||
2188 | "DFI LanParty", STAC_D965_REF), | ||
2147 | /* Intel 946 based systems */ | 2189 | /* Intel 946 based systems */ |
2148 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), | 2190 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), |
2149 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST), | 2191 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST), |
2150 | /* 965 based 3 stack systems */ | 2192 | /* 965 based 3 stack systems */ |
2151 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST), | 2193 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100, |
2152 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST), | 2194 | "Intel D965", STAC_D965_3ST), |
2153 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST), | 2195 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000, |
2154 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST), | 2196 | "Intel D965", STAC_D965_3ST), |
2155 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST), | ||
2156 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST), | ||
2157 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST), | ||
2158 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST), | ||
2159 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST), | ||
2160 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST), | ||
2161 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST), | ||
2162 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST), | ||
2163 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST), | ||
2164 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST), | ||
2165 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST), | ||
2166 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST), | ||
2167 | /* Dell 3 stack systems */ | 2197 | /* Dell 3 stack systems */ |
2168 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST), | 2198 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST), |
2169 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST), | 2199 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01dd, "Dell Dimension E520", STAC_DELL_3ST), |
@@ -2179,15 +2209,10 @@ static struct snd_pci_quirk stac927x_cfg_tbl[] = { | |||
2179 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), | 2209 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02ff, "Dell ", STAC_DELL_BIOS), |
2180 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS), | 2210 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS), |
2181 | /* 965 based 5 stack systems */ | 2211 | /* 965 based 5 stack systems */ |
2182 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST), | 2212 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300, |
2183 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST), | 2213 | "Intel D965", STAC_D965_5ST), |
2184 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST), | 2214 | SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, |
2185 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST), | 2215 | "Intel D965", STAC_D965_5ST), |
2186 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST), | ||
2187 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST), | ||
2188 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST), | ||
2189 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST), | ||
2190 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST), | ||
2191 | {} /* terminator */ | 2216 | {} /* terminator */ |
2192 | }; | 2217 | }; |
2193 | 2218 | ||
@@ -2240,19 +2265,25 @@ static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { | |||
2240 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, | 2265 | [STAC_9205_DELL_M42] = dell_9205_m42_pin_configs, |
2241 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, | 2266 | [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, |
2242 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, | 2267 | [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, |
2268 | [STAC_9205_EAPD] = NULL, | ||
2243 | }; | 2269 | }; |
2244 | 2270 | ||
2245 | static const char *stac9205_models[STAC_9205_MODELS] = { | 2271 | static const char *stac9205_models[STAC_9205_MODELS] = { |
2272 | [STAC_9205_AUTO] = "auto", | ||
2246 | [STAC_9205_REF] = "ref", | 2273 | [STAC_9205_REF] = "ref", |
2247 | [STAC_9205_DELL_M42] = "dell-m42", | 2274 | [STAC_9205_DELL_M42] = "dell-m42", |
2248 | [STAC_9205_DELL_M43] = "dell-m43", | 2275 | [STAC_9205_DELL_M43] = "dell-m43", |
2249 | [STAC_9205_DELL_M44] = "dell-m44", | 2276 | [STAC_9205_DELL_M44] = "dell-m44", |
2277 | [STAC_9205_EAPD] = "eapd", | ||
2250 | }; | 2278 | }; |
2251 | 2279 | ||
2252 | static struct snd_pci_quirk stac9205_cfg_tbl[] = { | 2280 | static struct snd_pci_quirk stac9205_cfg_tbl[] = { |
2253 | /* SigmaTel reference board */ | 2281 | /* SigmaTel reference board */ |
2254 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, | 2282 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, |
2255 | "DFI LanParty", STAC_9205_REF), | 2283 | "DFI LanParty", STAC_9205_REF), |
2284 | SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, | ||
2285 | "DFI LanParty", STAC_9205_REF), | ||
2286 | /* Dell */ | ||
2256 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, | 2287 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, |
2257 | "unknown Dell", STAC_9205_DELL_M42), | 2288 | "unknown Dell", STAC_9205_DELL_M42), |
2258 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, | 2289 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f2, |
@@ -2283,101 +2314,24 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = { | |||
2283 | "Dell Inspiron", STAC_9205_DELL_M44), | 2314 | "Dell Inspiron", STAC_9205_DELL_M44), |
2284 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, | 2315 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, |
2285 | "Dell Vostro 1500", STAC_9205_DELL_M42), | 2316 | "Dell Vostro 1500", STAC_9205_DELL_M42), |
2317 | /* Gateway */ | ||
2318 | SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), | ||
2286 | {} /* terminator */ | 2319 | {} /* terminator */ |
2287 | }; | 2320 | }; |
2288 | 2321 | ||
2289 | static int stac92xx_save_bios_config_regs(struct hda_codec *codec) | 2322 | static void stac92xx_set_config_regs(struct hda_codec *codec, |
2323 | unsigned int *pincfgs) | ||
2290 | { | 2324 | { |
2291 | int i; | 2325 | int i; |
2292 | struct sigmatel_spec *spec = codec->spec; | 2326 | struct sigmatel_spec *spec = codec->spec; |
2293 | |||
2294 | kfree(spec->pin_configs); | ||
2295 | spec->pin_configs = kcalloc(spec->num_pins, sizeof(*spec->pin_configs), | ||
2296 | GFP_KERNEL); | ||
2297 | if (!spec->pin_configs) | ||
2298 | return -ENOMEM; | ||
2299 | |||
2300 | for (i = 0; i < spec->num_pins; i++) { | ||
2301 | hda_nid_t nid = spec->pin_nids[i]; | ||
2302 | unsigned int pin_cfg; | ||
2303 | |||
2304 | pin_cfg = snd_hda_codec_read(codec, nid, 0, | ||
2305 | AC_VERB_GET_CONFIG_DEFAULT, 0x00); | ||
2306 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", | ||
2307 | nid, pin_cfg); | ||
2308 | spec->pin_configs[i] = pin_cfg; | ||
2309 | } | ||
2310 | |||
2311 | return 0; | ||
2312 | } | ||
2313 | 2327 | ||
2314 | static void stac92xx_set_config_reg(struct hda_codec *codec, | 2328 | if (!pincfgs) |
2315 | hda_nid_t pin_nid, unsigned int pin_config) | 2329 | return; |
2316 | { | ||
2317 | int i; | ||
2318 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2319 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, | ||
2320 | pin_config & 0x000000ff); | ||
2321 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2322 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, | ||
2323 | (pin_config & 0x0000ff00) >> 8); | ||
2324 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2325 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, | ||
2326 | (pin_config & 0x00ff0000) >> 16); | ||
2327 | snd_hda_codec_write(codec, pin_nid, 0, | ||
2328 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, | ||
2329 | pin_config >> 24); | ||
2330 | i = snd_hda_codec_read(codec, pin_nid, 0, | ||
2331 | AC_VERB_GET_CONFIG_DEFAULT, | ||
2332 | 0x00); | ||
2333 | snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", | ||
2334 | pin_nid, i); | ||
2335 | } | ||
2336 | |||
2337 | static void stac92xx_set_config_regs(struct hda_codec *codec) | ||
2338 | { | ||
2339 | int i; | ||
2340 | struct sigmatel_spec *spec = codec->spec; | ||
2341 | |||
2342 | if (!spec->pin_configs) | ||
2343 | return; | ||
2344 | 2330 | ||
2345 | for (i = 0; i < spec->num_pins; i++) | 2331 | for (i = 0; i < spec->num_pins; i++) |
2346 | stac92xx_set_config_reg(codec, spec->pin_nids[i], | 2332 | if (spec->pin_nids[i] && pincfgs[i]) |
2347 | spec->pin_configs[i]); | 2333 | snd_hda_codec_set_pincfg(codec, spec->pin_nids[i], |
2348 | } | 2334 | pincfgs[i]); |
2349 | |||
2350 | static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins) | ||
2351 | { | ||
2352 | struct sigmatel_spec *spec = codec->spec; | ||
2353 | |||
2354 | if (!pins) | ||
2355 | return stac92xx_save_bios_config_regs(codec); | ||
2356 | |||
2357 | kfree(spec->pin_configs); | ||
2358 | spec->pin_configs = kmemdup(pins, | ||
2359 | spec->num_pins * sizeof(*pins), | ||
2360 | GFP_KERNEL); | ||
2361 | if (!spec->pin_configs) | ||
2362 | return -ENOMEM; | ||
2363 | |||
2364 | stac92xx_set_config_regs(codec); | ||
2365 | return 0; | ||
2366 | } | ||
2367 | |||
2368 | static void stac_change_pin_config(struct hda_codec *codec, hda_nid_t nid, | ||
2369 | unsigned int cfg) | ||
2370 | { | ||
2371 | struct sigmatel_spec *spec = codec->spec; | ||
2372 | int i; | ||
2373 | |||
2374 | for (i = 0; i < spec->num_pins; i++) { | ||
2375 | if (spec->pin_nids[i] == nid) { | ||
2376 | spec->pin_configs[i] = cfg; | ||
2377 | stac92xx_set_config_reg(codec, nid, cfg); | ||
2378 | break; | ||
2379 | } | ||
2380 | } | ||
2381 | } | 2335 | } |
2382 | 2336 | ||
2383 | /* | 2337 | /* |
@@ -2567,7 +2521,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec) | |||
2567 | codec->num_pcms++; | 2521 | codec->num_pcms++; |
2568 | info++; | 2522 | info++; |
2569 | info->name = "STAC92xx Digital"; | 2523 | info->name = "STAC92xx Digital"; |
2570 | info->pcm_type = HDA_PCM_TYPE_SPDIF; | 2524 | info->pcm_type = spec->autocfg.dig_out_type[0]; |
2571 | if (spec->multiout.dig_out_nid) { | 2525 | if (spec->multiout.dig_out_nid) { |
2572 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; | 2526 | info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; |
2573 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; | 2527 | info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; |
@@ -2583,8 +2537,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec) | |||
2583 | 2537 | ||
2584 | static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) | 2538 | static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) |
2585 | { | 2539 | { |
2586 | unsigned int pincap = snd_hda_param_read(codec, nid, | 2540 | unsigned int pincap = snd_hda_query_pin_caps(codec, nid); |
2587 | AC_PAR_PIN_CAP); | ||
2588 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; | 2541 | pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; |
2589 | if (pincap & AC_PINCAP_VREF_100) | 2542 | if (pincap & AC_PINCAP_VREF_100) |
2590 | return AC_PINCTL_VREF_100; | 2543 | return AC_PINCTL_VREF_100; |
@@ -2759,22 +2712,37 @@ static struct snd_kcontrol_new stac92xx_control_templates[] = { | |||
2759 | }; | 2712 | }; |
2760 | 2713 | ||
2761 | /* add dynamic controls */ | 2714 | /* add dynamic controls */ |
2762 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, | 2715 | static struct snd_kcontrol_new * |
2763 | struct snd_kcontrol_new *ktemp, | 2716 | stac_control_new(struct sigmatel_spec *spec, |
2764 | int idx, const char *name, | 2717 | struct snd_kcontrol_new *ktemp, |
2765 | unsigned long val) | 2718 | const char *name) |
2766 | { | 2719 | { |
2767 | struct snd_kcontrol_new *knew; | 2720 | struct snd_kcontrol_new *knew; |
2768 | 2721 | ||
2769 | snd_array_init(&spec->kctls, sizeof(*knew), 32); | 2722 | snd_array_init(&spec->kctls, sizeof(*knew), 32); |
2770 | knew = snd_array_new(&spec->kctls); | 2723 | knew = snd_array_new(&spec->kctls); |
2771 | if (!knew) | 2724 | if (!knew) |
2772 | return -ENOMEM; | 2725 | return NULL; |
2773 | *knew = *ktemp; | 2726 | *knew = *ktemp; |
2774 | knew->index = idx; | ||
2775 | knew->name = kstrdup(name, GFP_KERNEL); | 2727 | knew->name = kstrdup(name, GFP_KERNEL); |
2776 | if (!knew->name) | 2728 | if (!knew->name) { |
2729 | /* roolback */ | ||
2730 | memset(knew, 0, sizeof(*knew)); | ||
2731 | spec->kctls.alloced--; | ||
2732 | return NULL; | ||
2733 | } | ||
2734 | return knew; | ||
2735 | } | ||
2736 | |||
2737 | static int stac92xx_add_control_temp(struct sigmatel_spec *spec, | ||
2738 | struct snd_kcontrol_new *ktemp, | ||
2739 | int idx, const char *name, | ||
2740 | unsigned long val) | ||
2741 | { | ||
2742 | struct snd_kcontrol_new *knew = stac_control_new(spec, ktemp, name); | ||
2743 | if (!knew) | ||
2777 | return -ENOMEM; | 2744 | return -ENOMEM; |
2745 | knew->index = idx; | ||
2778 | knew->private_value = val; | 2746 | knew->private_value = val; |
2779 | return 0; | 2747 | return 0; |
2780 | } | 2748 | } |
@@ -2796,6 +2764,29 @@ static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, | |||
2796 | return stac92xx_add_control_idx(spec, type, 0, name, val); | 2764 | return stac92xx_add_control_idx(spec, type, 0, name, val); |
2797 | } | 2765 | } |
2798 | 2766 | ||
2767 | static struct snd_kcontrol_new stac_input_src_temp = { | ||
2768 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
2769 | .name = "Input Source", | ||
2770 | .info = stac92xx_mux_enum_info, | ||
2771 | .get = stac92xx_mux_enum_get, | ||
2772 | .put = stac92xx_mux_enum_put, | ||
2773 | }; | ||
2774 | |||
2775 | static int stac92xx_add_input_source(struct sigmatel_spec *spec) | ||
2776 | { | ||
2777 | struct snd_kcontrol_new *knew; | ||
2778 | struct hda_input_mux *imux = &spec->private_imux; | ||
2779 | |||
2780 | if (!spec->num_adcs || imux->num_items <= 1) | ||
2781 | return 0; /* no need for input source control */ | ||
2782 | knew = stac_control_new(spec, &stac_input_src_temp, | ||
2783 | stac_input_src_temp.name); | ||
2784 | if (!knew) | ||
2785 | return -ENOMEM; | ||
2786 | knew->count = spec->num_adcs; | ||
2787 | return 0; | ||
2788 | } | ||
2789 | |||
2799 | /* check whether the line-input can be used as line-out */ | 2790 | /* check whether the line-input can be used as line-out */ |
2800 | static hda_nid_t check_line_out_switch(struct hda_codec *codec) | 2791 | static hda_nid_t check_line_out_switch(struct hda_codec *codec) |
2801 | { | 2792 | { |
@@ -2807,7 +2798,7 @@ static hda_nid_t check_line_out_switch(struct hda_codec *codec) | |||
2807 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) | 2798 | if (cfg->line_out_type != AUTO_PIN_LINE_OUT) |
2808 | return 0; | 2799 | return 0; |
2809 | nid = cfg->input_pins[AUTO_PIN_LINE]; | 2800 | nid = cfg->input_pins[AUTO_PIN_LINE]; |
2810 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | 2801 | pincap = snd_hda_query_pin_caps(codec, nid); |
2811 | if (pincap & AC_PINCAP_OUT) | 2802 | if (pincap & AC_PINCAP_OUT) |
2812 | return nid; | 2803 | return nid; |
2813 | return 0; | 2804 | return 0; |
@@ -2826,12 +2817,11 @@ static hda_nid_t check_mic_out_switch(struct hda_codec *codec) | |||
2826 | mic_pin = AUTO_PIN_MIC; | 2817 | mic_pin = AUTO_PIN_MIC; |
2827 | for (;;) { | 2818 | for (;;) { |
2828 | hda_nid_t nid = cfg->input_pins[mic_pin]; | 2819 | hda_nid_t nid = cfg->input_pins[mic_pin]; |
2829 | def_conf = snd_hda_codec_read(codec, nid, 0, | 2820 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
2830 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
2831 | /* some laptops have an internal analog microphone | 2821 | /* some laptops have an internal analog microphone |
2832 | * which can't be used as a output */ | 2822 | * which can't be used as a output */ |
2833 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { | 2823 | if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { |
2834 | pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | 2824 | pincap = snd_hda_query_pin_caps(codec, nid); |
2835 | if (pincap & AC_PINCAP_OUT) | 2825 | if (pincap & AC_PINCAP_OUT) |
2836 | return nid; | 2826 | return nid; |
2837 | } | 2827 | } |
@@ -2879,8 +2869,7 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) | |||
2879 | conn_len = snd_hda_get_connections(codec, nid, conn, | 2869 | conn_len = snd_hda_get_connections(codec, nid, conn, |
2880 | HDA_MAX_CONNECTIONS); | 2870 | HDA_MAX_CONNECTIONS); |
2881 | for (j = 0; j < conn_len; j++) { | 2871 | for (j = 0; j < conn_len; j++) { |
2882 | wcaps = snd_hda_param_read(codec, conn[j], | 2872 | wcaps = get_wcaps(codec, conn[j]); |
2883 | AC_PAR_AUDIO_WIDGET_CAP); | ||
2884 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; | 2873 | wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; |
2885 | /* we check only analog outputs */ | 2874 | /* we check only analog outputs */ |
2886 | if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) | 2875 | if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) |
@@ -2895,6 +2884,16 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) | |||
2895 | return conn[j]; | 2884 | return conn[j]; |
2896 | } | 2885 | } |
2897 | } | 2886 | } |
2887 | /* if all DACs are already assigned, connect to the primary DAC */ | ||
2888 | if (conn_len > 1) { | ||
2889 | for (j = 0; j < conn_len; j++) { | ||
2890 | if (conn[j] == spec->multiout.dac_nids[0]) { | ||
2891 | snd_hda_codec_write_cache(codec, nid, 0, | ||
2892 | AC_VERB_SET_CONNECT_SEL, j); | ||
2893 | break; | ||
2894 | } | ||
2895 | } | ||
2896 | } | ||
2898 | return 0; | 2897 | return 0; |
2899 | } | 2898 | } |
2900 | 2899 | ||
@@ -2935,6 +2934,26 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) | |||
2935 | add_spec_dacs(spec, dac); | 2934 | add_spec_dacs(spec, dac); |
2936 | } | 2935 | } |
2937 | 2936 | ||
2937 | for (i = 0; i < cfg->hp_outs; i++) { | ||
2938 | nid = cfg->hp_pins[i]; | ||
2939 | dac = get_unassigned_dac(codec, nid); | ||
2940 | if (dac) { | ||
2941 | if (!spec->multiout.hp_nid) | ||
2942 | spec->multiout.hp_nid = dac; | ||
2943 | else | ||
2944 | add_spec_extra_dacs(spec, dac); | ||
2945 | } | ||
2946 | spec->hp_dacs[i] = dac; | ||
2947 | } | ||
2948 | |||
2949 | for (i = 0; i < cfg->speaker_outs; i++) { | ||
2950 | nid = cfg->speaker_pins[i]; | ||
2951 | dac = get_unassigned_dac(codec, nid); | ||
2952 | if (dac) | ||
2953 | add_spec_extra_dacs(spec, dac); | ||
2954 | spec->speaker_dacs[i] = dac; | ||
2955 | } | ||
2956 | |||
2938 | /* add line-in as output */ | 2957 | /* add line-in as output */ |
2939 | nid = check_line_out_switch(codec); | 2958 | nid = check_line_out_switch(codec); |
2940 | if (nid) { | 2959 | if (nid) { |
@@ -2962,26 +2981,6 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) | |||
2962 | } | 2981 | } |
2963 | } | 2982 | } |
2964 | 2983 | ||
2965 | for (i = 0; i < cfg->hp_outs; i++) { | ||
2966 | nid = cfg->hp_pins[i]; | ||
2967 | dac = get_unassigned_dac(codec, nid); | ||
2968 | if (dac) { | ||
2969 | if (!spec->multiout.hp_nid) | ||
2970 | spec->multiout.hp_nid = dac; | ||
2971 | else | ||
2972 | add_spec_extra_dacs(spec, dac); | ||
2973 | } | ||
2974 | spec->hp_dacs[i] = dac; | ||
2975 | } | ||
2976 | |||
2977 | for (i = 0; i < cfg->speaker_outs; i++) { | ||
2978 | nid = cfg->speaker_pins[i]; | ||
2979 | dac = get_unassigned_dac(codec, nid); | ||
2980 | if (dac) | ||
2981 | add_spec_extra_dacs(spec, dac); | ||
2982 | spec->speaker_dacs[i] = dac; | ||
2983 | } | ||
2984 | |||
2985 | snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", | 2984 | snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", |
2986 | spec->multiout.num_dacs, | 2985 | spec->multiout.num_dacs, |
2987 | spec->multiout.dac_nids[0], | 2986 | spec->multiout.dac_nids[0], |
@@ -2994,24 +2993,47 @@ static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) | |||
2994 | } | 2993 | } |
2995 | 2994 | ||
2996 | /* create volume control/switch for the given prefx type */ | 2995 | /* create volume control/switch for the given prefx type */ |
2997 | static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs) | 2996 | static int create_controls_idx(struct hda_codec *codec, const char *pfx, |
2997 | int idx, hda_nid_t nid, int chs) | ||
2998 | { | 2998 | { |
2999 | struct sigmatel_spec *spec = codec->spec; | ||
2999 | char name[32]; | 3000 | char name[32]; |
3000 | int err; | 3001 | int err; |
3001 | 3002 | ||
3003 | if (!spec->check_volume_offset) { | ||
3004 | unsigned int caps, step, nums, db_scale; | ||
3005 | caps = query_amp_caps(codec, nid, HDA_OUTPUT); | ||
3006 | step = (caps & AC_AMPCAP_STEP_SIZE) >> | ||
3007 | AC_AMPCAP_STEP_SIZE_SHIFT; | ||
3008 | step = (step + 1) * 25; /* in .01dB unit */ | ||
3009 | nums = (caps & AC_AMPCAP_NUM_STEPS) >> | ||
3010 | AC_AMPCAP_NUM_STEPS_SHIFT; | ||
3011 | db_scale = nums * step; | ||
3012 | /* if dB scale is over -64dB, and finer enough, | ||
3013 | * let's reduce it to half | ||
3014 | */ | ||
3015 | if (db_scale > 6400 && nums >= 0x1f) | ||
3016 | spec->volume_offset = nums / 2; | ||
3017 | spec->check_volume_offset = 1; | ||
3018 | } | ||
3019 | |||
3002 | sprintf(name, "%s Playback Volume", pfx); | 3020 | sprintf(name, "%s Playback Volume", pfx); |
3003 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, | 3021 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name, |
3004 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | 3022 | HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, |
3023 | spec->volume_offset)); | ||
3005 | if (err < 0) | 3024 | if (err < 0) |
3006 | return err; | 3025 | return err; |
3007 | sprintf(name, "%s Playback Switch", pfx); | 3026 | sprintf(name, "%s Playback Switch", pfx); |
3008 | err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, | 3027 | err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name, |
3009 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); | 3028 | HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); |
3010 | if (err < 0) | 3029 | if (err < 0) |
3011 | return err; | 3030 | return err; |
3012 | return 0; | 3031 | return 0; |
3013 | } | 3032 | } |
3014 | 3033 | ||
3034 | #define create_controls(codec, pfx, nid, chs) \ | ||
3035 | create_controls_idx(codec, pfx, 0, nid, chs) | ||
3036 | |||
3015 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) | 3037 | static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) |
3016 | { | 3038 | { |
3017 | if (spec->multiout.num_dacs > 4) { | 3039 | if (spec->multiout.num_dacs > 4) { |
@@ -3037,40 +3059,32 @@ static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid) | |||
3037 | return 1; | 3059 | return 1; |
3038 | } | 3060 | } |
3039 | 3061 | ||
3040 | static int is_unique_dac(struct sigmatel_spec *spec, hda_nid_t nid) | 3062 | /* Create output controls |
3041 | { | 3063 | * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT) |
3042 | int i; | 3064 | */ |
3043 | 3065 | static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, | |
3044 | if (spec->autocfg.line_outs != 1) | 3066 | const hda_nid_t *pins, |
3045 | return 0; | 3067 | const hda_nid_t *dac_nids, |
3046 | if (spec->multiout.hp_nid == nid) | 3068 | int type) |
3047 | return 0; | ||
3048 | for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) | ||
3049 | if (spec->multiout.extra_out_nid[i] == nid) | ||
3050 | return 0; | ||
3051 | return 1; | ||
3052 | } | ||
3053 | |||
3054 | /* add playback controls from the parsed DAC table */ | ||
3055 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | ||
3056 | const struct auto_pin_cfg *cfg) | ||
3057 | { | 3069 | { |
3058 | struct sigmatel_spec *spec = codec->spec; | 3070 | struct sigmatel_spec *spec = codec->spec; |
3059 | static const char *chname[4] = { | 3071 | static const char *chname[4] = { |
3060 | "Front", "Surround", NULL /*CLFE*/, "Side" | 3072 | "Front", "Surround", NULL /*CLFE*/, "Side" |
3061 | }; | 3073 | }; |
3062 | hda_nid_t nid = 0; | 3074 | hda_nid_t nid; |
3063 | int i, err; | 3075 | int i, err; |
3064 | unsigned int wid_caps; | 3076 | unsigned int wid_caps; |
3065 | 3077 | ||
3066 | for (i = 0; i < cfg->line_outs && spec->multiout.dac_nids[i]; i++) { | 3078 | for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) { |
3067 | nid = spec->multiout.dac_nids[i]; | 3079 | nid = dac_nids[i]; |
3068 | if (i == 2) { | 3080 | if (!nid) |
3081 | continue; | ||
3082 | if (type != AUTO_PIN_HP_OUT && i == 2) { | ||
3069 | /* Center/LFE */ | 3083 | /* Center/LFE */ |
3070 | err = create_controls(spec, "Center", nid, 1); | 3084 | err = create_controls(codec, "Center", nid, 1); |
3071 | if (err < 0) | 3085 | if (err < 0) |
3072 | return err; | 3086 | return err; |
3073 | err = create_controls(spec, "LFE", nid, 2); | 3087 | err = create_controls(codec, "LFE", nid, 2); |
3074 | if (err < 0) | 3088 | if (err < 0) |
3075 | return err; | 3089 | return err; |
3076 | 3090 | ||
@@ -3086,23 +3100,47 @@ static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | |||
3086 | } | 3100 | } |
3087 | 3101 | ||
3088 | } else { | 3102 | } else { |
3089 | const char *name = chname[i]; | 3103 | const char *name; |
3090 | /* if it's a single DAC, assign a better name */ | 3104 | int idx; |
3091 | if (!i && is_unique_dac(spec, nid)) { | 3105 | switch (type) { |
3092 | switch (cfg->line_out_type) { | 3106 | case AUTO_PIN_HP_OUT: |
3093 | case AUTO_PIN_HP_OUT: | 3107 | name = "Headphone"; |
3094 | name = "Headphone"; | 3108 | idx = i; |
3095 | break; | 3109 | break; |
3096 | case AUTO_PIN_SPEAKER_OUT: | 3110 | case AUTO_PIN_SPEAKER_OUT: |
3097 | name = "Speaker"; | 3111 | name = "Speaker"; |
3098 | break; | 3112 | idx = i; |
3099 | } | 3113 | break; |
3114 | default: | ||
3115 | name = chname[i]; | ||
3116 | idx = 0; | ||
3117 | break; | ||
3100 | } | 3118 | } |
3101 | err = create_controls(spec, name, nid, 3); | 3119 | err = create_controls_idx(codec, name, idx, nid, 3); |
3102 | if (err < 0) | 3120 | if (err < 0) |
3103 | return err; | 3121 | return err; |
3122 | if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { | ||
3123 | wid_caps = get_wcaps(codec, pins[i]); | ||
3124 | if (wid_caps & AC_WCAP_UNSOL_CAP) | ||
3125 | spec->hp_detect = 1; | ||
3126 | } | ||
3104 | } | 3127 | } |
3105 | } | 3128 | } |
3129 | return 0; | ||
3130 | } | ||
3131 | |||
3132 | /* add playback controls from the parsed DAC table */ | ||
3133 | static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, | ||
3134 | const struct auto_pin_cfg *cfg) | ||
3135 | { | ||
3136 | struct sigmatel_spec *spec = codec->spec; | ||
3137 | int err; | ||
3138 | |||
3139 | err = create_multi_out_ctls(codec, cfg->line_outs, cfg->line_out_pins, | ||
3140 | spec->multiout.dac_nids, | ||
3141 | cfg->line_out_type); | ||
3142 | if (err < 0) | ||
3143 | return err; | ||
3106 | 3144 | ||
3107 | if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { | 3145 | if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { |
3108 | err = stac92xx_add_control(spec, | 3146 | err = stac92xx_add_control(spec, |
@@ -3137,40 +3175,18 @@ static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, | |||
3137 | struct auto_pin_cfg *cfg) | 3175 | struct auto_pin_cfg *cfg) |
3138 | { | 3176 | { |
3139 | struct sigmatel_spec *spec = codec->spec; | 3177 | struct sigmatel_spec *spec = codec->spec; |
3140 | hda_nid_t nid; | 3178 | int err; |
3141 | int i, err, nums; | 3179 | |
3180 | err = create_multi_out_ctls(codec, cfg->hp_outs, cfg->hp_pins, | ||
3181 | spec->hp_dacs, AUTO_PIN_HP_OUT); | ||
3182 | if (err < 0) | ||
3183 | return err; | ||
3184 | |||
3185 | err = create_multi_out_ctls(codec, cfg->speaker_outs, cfg->speaker_pins, | ||
3186 | spec->speaker_dacs, AUTO_PIN_SPEAKER_OUT); | ||
3187 | if (err < 0) | ||
3188 | return err; | ||
3142 | 3189 | ||
3143 | nums = 0; | ||
3144 | for (i = 0; i < cfg->hp_outs; i++) { | ||
3145 | static const char *pfxs[] = { | ||
3146 | "Headphone", "Headphone2", "Headphone3", | ||
3147 | }; | ||
3148 | unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); | ||
3149 | if (wid_caps & AC_WCAP_UNSOL_CAP) | ||
3150 | spec->hp_detect = 1; | ||
3151 | if (nums >= ARRAY_SIZE(pfxs)) | ||
3152 | continue; | ||
3153 | nid = spec->hp_dacs[i]; | ||
3154 | if (!nid) | ||
3155 | continue; | ||
3156 | err = create_controls(spec, pfxs[nums++], nid, 3); | ||
3157 | if (err < 0) | ||
3158 | return err; | ||
3159 | } | ||
3160 | nums = 0; | ||
3161 | for (i = 0; i < cfg->speaker_outs; i++) { | ||
3162 | static const char *pfxs[] = { | ||
3163 | "Speaker", "External Speaker", "Speaker2", | ||
3164 | }; | ||
3165 | if (nums >= ARRAY_SIZE(pfxs)) | ||
3166 | continue; | ||
3167 | nid = spec->speaker_dacs[i]; | ||
3168 | if (!nid) | ||
3169 | continue; | ||
3170 | err = create_controls(spec, pfxs[nums++], nid, 3); | ||
3171 | if (err < 0) | ||
3172 | return err; | ||
3173 | } | ||
3174 | return 0; | 3190 | return 0; |
3175 | } | 3191 | } |
3176 | 3192 | ||
@@ -3379,11 +3395,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, | |||
3379 | unsigned int wcaps; | 3395 | unsigned int wcaps; |
3380 | unsigned int def_conf; | 3396 | unsigned int def_conf; |
3381 | 3397 | ||
3382 | def_conf = snd_hda_codec_read(codec, | 3398 | def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); |
3383 | spec->dmic_nids[i], | ||
3384 | 0, | ||
3385 | AC_VERB_GET_CONFIG_DEFAULT, | ||
3386 | 0); | ||
3387 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) | 3399 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) |
3388 | continue; | 3400 | continue; |
3389 | 3401 | ||
@@ -3507,6 +3519,7 @@ static void stac92xx_auto_init_hp_out(struct hda_codec *codec) | |||
3507 | static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) | 3519 | static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) |
3508 | { | 3520 | { |
3509 | struct sigmatel_spec *spec = codec->spec; | 3521 | struct sigmatel_spec *spec = codec->spec; |
3522 | int hp_swap = 0; | ||
3510 | int err; | 3523 | int err; |
3511 | 3524 | ||
3512 | if ((err = snd_hda_parse_pin_def_config(codec, | 3525 | if ((err = snd_hda_parse_pin_def_config(codec, |
@@ -3516,7 +3529,6 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3516 | if (! spec->autocfg.line_outs) | 3529 | if (! spec->autocfg.line_outs) |
3517 | return 0; /* can't find valid pin config */ | 3530 | return 0; /* can't find valid pin config */ |
3518 | 3531 | ||
3519 | #if 0 /* FIXME: temporarily disabled */ | ||
3520 | /* If we have no real line-out pin and multiple hp-outs, HPs should | 3532 | /* If we have no real line-out pin and multiple hp-outs, HPs should |
3521 | * be set up as multi-channel outputs. | 3533 | * be set up as multi-channel outputs. |
3522 | */ | 3534 | */ |
@@ -3535,8 +3547,8 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3535 | spec->autocfg.line_outs = spec->autocfg.hp_outs; | 3547 | spec->autocfg.line_outs = spec->autocfg.hp_outs; |
3536 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; | 3548 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; |
3537 | spec->autocfg.hp_outs = 0; | 3549 | spec->autocfg.hp_outs = 0; |
3550 | hp_swap = 1; | ||
3538 | } | 3551 | } |
3539 | #endif /* FIXME: temporarily disabled */ | ||
3540 | if (spec->autocfg.mono_out_pin) { | 3552 | if (spec->autocfg.mono_out_pin) { |
3541 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & | 3553 | int dir = get_wcaps(codec, spec->autocfg.mono_out_pin) & |
3542 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); | 3554 | (AC_WCAP_OUT_AMP | AC_WCAP_IN_AMP); |
@@ -3629,12 +3641,19 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3629 | #endif | 3641 | #endif |
3630 | 3642 | ||
3631 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); | 3643 | err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); |
3632 | |||
3633 | if (err < 0) | 3644 | if (err < 0) |
3634 | return err; | 3645 | return err; |
3635 | 3646 | ||
3636 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); | 3647 | /* All output parsing done, now restore the swapped hp pins */ |
3648 | if (hp_swap) { | ||
3649 | memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, | ||
3650 | sizeof(spec->autocfg.hp_pins)); | ||
3651 | spec->autocfg.hp_outs = spec->autocfg.line_outs; | ||
3652 | spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; | ||
3653 | spec->autocfg.line_outs = 0; | ||
3654 | } | ||
3637 | 3655 | ||
3656 | err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); | ||
3638 | if (err < 0) | 3657 | if (err < 0) |
3639 | return err; | 3658 | return err; |
3640 | 3659 | ||
@@ -3663,11 +3682,15 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out | |||
3663 | return err; | 3682 | return err; |
3664 | } | 3683 | } |
3665 | 3684 | ||
3685 | err = stac92xx_add_input_source(spec); | ||
3686 | if (err < 0) | ||
3687 | return err; | ||
3688 | |||
3666 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 3689 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
3667 | if (spec->multiout.max_channels > 2) | 3690 | if (spec->multiout.max_channels > 2) |
3668 | spec->surr_switch = 1; | 3691 | spec->surr_switch = 1; |
3669 | 3692 | ||
3670 | if (spec->autocfg.dig_out_pin) | 3693 | if (spec->autocfg.dig_outs) |
3671 | spec->multiout.dig_out_nid = dig_out; | 3694 | spec->multiout.dig_out_nid = dig_out; |
3672 | if (dig_in && spec->autocfg.dig_in_pin) | 3695 | if (dig_in && spec->autocfg.dig_in_pin) |
3673 | spec->dig_in_nid = dig_in; | 3696 | spec->dig_in_nid = dig_in; |
@@ -3730,9 +3753,7 @@ static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, | |||
3730 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { | 3753 | for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { |
3731 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; | 3754 | hda_nid_t pin = spec->autocfg.line_out_pins[i]; |
3732 | unsigned int defcfg; | 3755 | unsigned int defcfg; |
3733 | defcfg = snd_hda_codec_read(codec, pin, 0, | 3756 | defcfg = snd_hda_codec_get_pincfg(codec, pin); |
3734 | AC_VERB_GET_CONFIG_DEFAULT, | ||
3735 | 0x00); | ||
3736 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { | 3757 | if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { |
3737 | unsigned int wcaps = get_wcaps(codec, pin); | 3758 | unsigned int wcaps = get_wcaps(codec, pin); |
3738 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); | 3759 | wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); |
@@ -3745,7 +3766,7 @@ static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, | |||
3745 | } | 3766 | } |
3746 | 3767 | ||
3747 | if (lfe_pin) { | 3768 | if (lfe_pin) { |
3748 | err = create_controls(spec, "LFE", lfe_pin, 1); | 3769 | err = create_controls(codec, "LFE", lfe_pin, 1); |
3749 | if (err < 0) | 3770 | if (err < 0) |
3750 | return err; | 3771 | return err; |
3751 | } | 3772 | } |
@@ -3776,7 +3797,11 @@ static int stac9200_parse_auto_config(struct hda_codec *codec) | |||
3776 | return err; | 3797 | return err; |
3777 | } | 3798 | } |
3778 | 3799 | ||
3779 | if (spec->autocfg.dig_out_pin) | 3800 | err = stac92xx_add_input_source(spec); |
3801 | if (err < 0) | ||
3802 | return err; | ||
3803 | |||
3804 | if (spec->autocfg.dig_outs) | ||
3780 | spec->multiout.dig_out_nid = 0x05; | 3805 | spec->multiout.dig_out_nid = 0x05; |
3781 | if (spec->autocfg.dig_in_pin) | 3806 | if (spec->autocfg.dig_in_pin) |
3782 | spec->dig_in_nid = 0x04; | 3807 | spec->dig_in_nid = 0x04; |
@@ -3832,8 +3857,7 @@ static int stac92xx_add_jack(struct hda_codec *codec, | |||
3832 | #ifdef CONFIG_SND_JACK | 3857 | #ifdef CONFIG_SND_JACK |
3833 | struct sigmatel_spec *spec = codec->spec; | 3858 | struct sigmatel_spec *spec = codec->spec; |
3834 | struct sigmatel_jack *jack; | 3859 | struct sigmatel_jack *jack; |
3835 | int def_conf = snd_hda_codec_read(codec, nid, | 3860 | int def_conf = snd_hda_codec_get_pincfg(codec, nid); |
3836 | 0, AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
3837 | int connectivity = get_defcfg_connect(def_conf); | 3861 | int connectivity = get_defcfg_connect(def_conf); |
3838 | char name[32]; | 3862 | char name[32]; |
3839 | 3863 | ||
@@ -3948,6 +3972,36 @@ static void stac92xx_power_down(struct hda_codec *codec) | |||
3948 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, | 3972 | static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, |
3949 | int enable); | 3973 | int enable); |
3950 | 3974 | ||
3975 | /* override some hints from the hwdep entry */ | ||
3976 | static void stac_store_hints(struct hda_codec *codec) | ||
3977 | { | ||
3978 | struct sigmatel_spec *spec = codec->spec; | ||
3979 | const char *p; | ||
3980 | int val; | ||
3981 | |||
3982 | val = snd_hda_get_bool_hint(codec, "hp_detect"); | ||
3983 | if (val >= 0) | ||
3984 | spec->hp_detect = val; | ||
3985 | p = snd_hda_get_hint(codec, "gpio_mask"); | ||
3986 | if (p) { | ||
3987 | spec->gpio_mask = simple_strtoul(p, NULL, 0); | ||
3988 | spec->eapd_mask = spec->gpio_dir = spec->gpio_data = | ||
3989 | spec->gpio_mask; | ||
3990 | } | ||
3991 | p = snd_hda_get_hint(codec, "gpio_dir"); | ||
3992 | if (p) | ||
3993 | spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask; | ||
3994 | p = snd_hda_get_hint(codec, "gpio_data"); | ||
3995 | if (p) | ||
3996 | spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask; | ||
3997 | p = snd_hda_get_hint(codec, "eapd_mask"); | ||
3998 | if (p) | ||
3999 | spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask; | ||
4000 | val = snd_hda_get_bool_hint(codec, "eapd_switch"); | ||
4001 | if (val >= 0) | ||
4002 | spec->eapd_switch = val; | ||
4003 | } | ||
4004 | |||
3951 | static int stac92xx_init(struct hda_codec *codec) | 4005 | static int stac92xx_init(struct hda_codec *codec) |
3952 | { | 4006 | { |
3953 | struct sigmatel_spec *spec = codec->spec; | 4007 | struct sigmatel_spec *spec = codec->spec; |
@@ -3964,6 +4018,9 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3964 | spec->adc_nids[i], 0, | 4018 | spec->adc_nids[i], 0, |
3965 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); | 4019 | AC_VERB_SET_POWER_STATE, AC_PWRST_D3); |
3966 | 4020 | ||
4021 | /* override some hints */ | ||
4022 | stac_store_hints(codec); | ||
4023 | |||
3967 | /* set up GPIO */ | 4024 | /* set up GPIO */ |
3968 | gpio = spec->gpio_data; | 4025 | gpio = spec->gpio_data; |
3969 | /* turn on EAPD statically when spec->eapd_switch isn't set. | 4026 | /* turn on EAPD statically when spec->eapd_switch isn't set. |
@@ -4013,8 +4070,7 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4013 | pinctl); | 4070 | pinctl); |
4014 | } | 4071 | } |
4015 | } | 4072 | } |
4016 | conf = snd_hda_codec_read(codec, nid, 0, | 4073 | conf = snd_hda_codec_get_pincfg(codec, nid); |
4017 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
4018 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { | 4074 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { |
4019 | enable_pin_detect(codec, nid, | 4075 | enable_pin_detect(codec, nid, |
4020 | STAC_INSERT_EVENT); | 4076 | STAC_INSERT_EVENT); |
@@ -4026,8 +4082,8 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4026 | for (i = 0; i < spec->num_dmics; i++) | 4082 | for (i = 0; i < spec->num_dmics; i++) |
4027 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], | 4083 | stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], |
4028 | AC_PINCTL_IN_EN); | 4084 | AC_PINCTL_IN_EN); |
4029 | if (cfg->dig_out_pin) | 4085 | if (cfg->dig_out_pins[0]) |
4030 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, | 4086 | stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0], |
4031 | AC_PINCTL_OUT_EN); | 4087 | AC_PINCTL_OUT_EN); |
4032 | if (cfg->dig_in_pin) | 4088 | if (cfg->dig_in_pin) |
4033 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, | 4089 | stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, |
@@ -4055,8 +4111,7 @@ static int stac92xx_init(struct hda_codec *codec) | |||
4055 | stac_toggle_power_map(codec, nid, 1); | 4111 | stac_toggle_power_map(codec, nid, 1); |
4056 | continue; | 4112 | continue; |
4057 | } | 4113 | } |
4058 | def_conf = snd_hda_codec_read(codec, nid, 0, | 4114 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
4059 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
4060 | def_conf = get_defcfg_connect(def_conf); | 4115 | def_conf = get_defcfg_connect(def_conf); |
4061 | /* skip any ports that don't have jacks since presence | 4116 | /* skip any ports that don't have jacks since presence |
4062 | * detection is useless */ | 4117 | * detection is useless */ |
@@ -4110,7 +4165,6 @@ static void stac92xx_free(struct hda_codec *codec) | |||
4110 | if (! spec) | 4165 | if (! spec) |
4111 | return; | 4166 | return; |
4112 | 4167 | ||
4113 | kfree(spec->pin_configs); | ||
4114 | stac92xx_free_jacks(codec); | 4168 | stac92xx_free_jacks(codec); |
4115 | snd_array_free(&spec->events); | 4169 | snd_array_free(&spec->events); |
4116 | 4170 | ||
@@ -4121,7 +4175,9 @@ static void stac92xx_free(struct hda_codec *codec) | |||
4121 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, | 4175 | static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, |
4122 | unsigned int flag) | 4176 | unsigned int flag) |
4123 | { | 4177 | { |
4124 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, | 4178 | unsigned int old_ctl, pin_ctl; |
4179 | |||
4180 | pin_ctl = snd_hda_codec_read(codec, nid, | ||
4125 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); | 4181 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
4126 | 4182 | ||
4127 | if (pin_ctl & AC_PINCTL_IN_EN) { | 4183 | if (pin_ctl & AC_PINCTL_IN_EN) { |
@@ -4135,14 +4191,17 @@ static void stac92xx_set_pinctl(struct hda_codec *codec, hda_nid_t nid, | |||
4135 | return; | 4191 | return; |
4136 | } | 4192 | } |
4137 | 4193 | ||
4194 | old_ctl = pin_ctl; | ||
4138 | /* if setting pin direction bits, clear the current | 4195 | /* if setting pin direction bits, clear the current |
4139 | direction bits first */ | 4196 | direction bits first */ |
4140 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) | 4197 | if (flag & (AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN)) |
4141 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); | 4198 | pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); |
4142 | 4199 | ||
4143 | snd_hda_codec_write_cache(codec, nid, 0, | 4200 | pin_ctl |= flag; |
4144 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 4201 | if (old_ctl != pin_ctl) |
4145 | pin_ctl | flag); | 4202 | snd_hda_codec_write_cache(codec, nid, 0, |
4203 | AC_VERB_SET_PIN_WIDGET_CONTROL, | ||
4204 | pin_ctl); | ||
4146 | } | 4205 | } |
4147 | 4206 | ||
4148 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, | 4207 | static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, |
@@ -4150,9 +4209,10 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, | |||
4150 | { | 4209 | { |
4151 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, | 4210 | unsigned int pin_ctl = snd_hda_codec_read(codec, nid, |
4152 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); | 4211 | 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); |
4153 | snd_hda_codec_write_cache(codec, nid, 0, | 4212 | if (pin_ctl & flag) |
4154 | AC_VERB_SET_PIN_WIDGET_CONTROL, | 4213 | snd_hda_codec_write_cache(codec, nid, 0, |
4155 | pin_ctl & ~flag); | 4214 | AC_VERB_SET_PIN_WIDGET_CONTROL, |
4215 | pin_ctl & ~flag); | ||
4156 | } | 4216 | } |
4157 | 4217 | ||
4158 | static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) | 4218 | static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
@@ -4415,7 +4475,6 @@ static int stac92xx_resume(struct hda_codec *codec) | |||
4415 | { | 4475 | { |
4416 | struct sigmatel_spec *spec = codec->spec; | 4476 | struct sigmatel_spec *spec = codec->spec; |
4417 | 4477 | ||
4418 | stac92xx_set_config_regs(codec); | ||
4419 | stac92xx_init(codec); | 4478 | stac92xx_init(codec); |
4420 | snd_hda_codec_resume_amp(codec); | 4479 | snd_hda_codec_resume_amp(codec); |
4421 | snd_hda_codec_resume_cache(codec); | 4480 | snd_hda_codec_resume_cache(codec); |
@@ -4426,6 +4485,37 @@ static int stac92xx_resume(struct hda_codec *codec) | |||
4426 | return 0; | 4485 | return 0; |
4427 | } | 4486 | } |
4428 | 4487 | ||
4488 | |||
4489 | /* | ||
4490 | * using power check for controlling mute led of HP HDX notebooks | ||
4491 | * check for mute state only on Speakers (nid = 0x10) | ||
4492 | * | ||
4493 | * For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise | ||
4494 | * the LED is NOT working properly ! | ||
4495 | */ | ||
4496 | |||
4497 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
4498 | static int stac92xx_hp_hdx_check_power_status(struct hda_codec *codec, | ||
4499 | hda_nid_t nid) | ||
4500 | { | ||
4501 | struct sigmatel_spec *spec = codec->spec; | ||
4502 | |||
4503 | if (nid == 0x10) { | ||
4504 | if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & | ||
4505 | HDA_AMP_MUTE) | ||
4506 | spec->gpio_data &= ~0x08; /* orange */ | ||
4507 | else | ||
4508 | spec->gpio_data |= 0x08; /* white */ | ||
4509 | |||
4510 | stac_gpio_set(codec, spec->gpio_mask, | ||
4511 | spec->gpio_dir, | ||
4512 | spec->gpio_data); | ||
4513 | } | ||
4514 | |||
4515 | return 0; | ||
4516 | } | ||
4517 | #endif | ||
4518 | |||
4429 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) | 4519 | static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) |
4430 | { | 4520 | { |
4431 | struct sigmatel_spec *spec = codec->spec; | 4521 | struct sigmatel_spec *spec = codec->spec; |
@@ -4464,16 +4554,11 @@ static int patch_stac9200(struct hda_codec *codec) | |||
4464 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, | 4554 | spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, |
4465 | stac9200_models, | 4555 | stac9200_models, |
4466 | stac9200_cfg_tbl); | 4556 | stac9200_cfg_tbl); |
4467 | if (spec->board_config < 0) { | 4557 | if (spec->board_config < 0) |
4468 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); | 4558 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); |
4469 | err = stac92xx_save_bios_config_regs(codec); | 4559 | else |
4470 | } else | 4560 | stac92xx_set_config_regs(codec, |
4471 | err = stac_save_pin_cfgs(codec, | ||
4472 | stac9200_brd_tbl[spec->board_config]); | 4561 | stac9200_brd_tbl[spec->board_config]); |
4473 | if (err < 0) { | ||
4474 | stac92xx_free(codec); | ||
4475 | return err; | ||
4476 | } | ||
4477 | 4562 | ||
4478 | spec->multiout.max_channels = 2; | 4563 | spec->multiout.max_channels = 2; |
4479 | spec->multiout.num_dacs = 1; | 4564 | spec->multiout.num_dacs = 1; |
@@ -4541,17 +4626,12 @@ static int patch_stac925x(struct hda_codec *codec) | |||
4541 | stac925x_models, | 4626 | stac925x_models, |
4542 | stac925x_cfg_tbl); | 4627 | stac925x_cfg_tbl); |
4543 | again: | 4628 | again: |
4544 | if (spec->board_config < 0) { | 4629 | if (spec->board_config < 0) |
4545 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," | 4630 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," |
4546 | "using BIOS defaults\n"); | 4631 | "using BIOS defaults\n"); |
4547 | err = stac92xx_save_bios_config_regs(codec); | 4632 | else |
4548 | } else | 4633 | stac92xx_set_config_regs(codec, |
4549 | err = stac_save_pin_cfgs(codec, | ||
4550 | stac925x_brd_tbl[spec->board_config]); | 4634 | stac925x_brd_tbl[spec->board_config]); |
4551 | if (err < 0) { | ||
4552 | stac92xx_free(codec); | ||
4553 | return err; | ||
4554 | } | ||
4555 | 4635 | ||
4556 | spec->multiout.max_channels = 2; | 4636 | spec->multiout.max_channels = 2; |
4557 | spec->multiout.num_dacs = 1; | 4637 | spec->multiout.num_dacs = 1; |
@@ -4629,17 +4709,12 @@ static int patch_stac92hd73xx(struct hda_codec *codec) | |||
4629 | stac92hd73xx_models, | 4709 | stac92hd73xx_models, |
4630 | stac92hd73xx_cfg_tbl); | 4710 | stac92hd73xx_cfg_tbl); |
4631 | again: | 4711 | again: |
4632 | if (spec->board_config < 0) { | 4712 | if (spec->board_config < 0) |
4633 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | 4713 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
4634 | " STAC92HD73XX, using BIOS defaults\n"); | 4714 | " STAC92HD73XX, using BIOS defaults\n"); |
4635 | err = stac92xx_save_bios_config_regs(codec); | 4715 | else |
4636 | } else | 4716 | stac92xx_set_config_regs(codec, |
4637 | err = stac_save_pin_cfgs(codec, | ||
4638 | stac92hd73xx_brd_tbl[spec->board_config]); | 4717 | stac92hd73xx_brd_tbl[spec->board_config]); |
4639 | if (err < 0) { | ||
4640 | stac92xx_free(codec); | ||
4641 | return err; | ||
4642 | } | ||
4643 | 4718 | ||
4644 | num_dacs = snd_hda_get_connections(codec, 0x0a, | 4719 | num_dacs = snd_hda_get_connections(codec, 0x0a, |
4645 | conn, STAC92HD73_DAC_COUNT + 2) - 1; | 4720 | conn, STAC92HD73_DAC_COUNT + 2) - 1; |
@@ -4653,14 +4728,18 @@ again: | |||
4653 | case 0x3: /* 6 Channel */ | 4728 | case 0x3: /* 6 Channel */ |
4654 | spec->mixer = stac92hd73xx_6ch_mixer; | 4729 | spec->mixer = stac92hd73xx_6ch_mixer; |
4655 | spec->init = stac92hd73xx_6ch_core_init; | 4730 | spec->init = stac92hd73xx_6ch_core_init; |
4731 | spec->aloopback_ctl = stac92hd73xx_6ch_loopback; | ||
4656 | break; | 4732 | break; |
4657 | case 0x4: /* 8 Channel */ | 4733 | case 0x4: /* 8 Channel */ |
4658 | spec->mixer = stac92hd73xx_8ch_mixer; | 4734 | spec->mixer = stac92hd73xx_8ch_mixer; |
4659 | spec->init = stac92hd73xx_8ch_core_init; | 4735 | spec->init = stac92hd73xx_8ch_core_init; |
4736 | spec->aloopback_ctl = stac92hd73xx_8ch_loopback; | ||
4660 | break; | 4737 | break; |
4661 | case 0x5: /* 10 Channel */ | 4738 | case 0x5: /* 10 Channel */ |
4662 | spec->mixer = stac92hd73xx_10ch_mixer; | 4739 | spec->mixer = stac92hd73xx_10ch_mixer; |
4663 | spec->init = stac92hd73xx_10ch_core_init; | 4740 | spec->init = stac92hd73xx_10ch_core_init; |
4741 | spec->aloopback_ctl = stac92hd73xx_10ch_loopback; | ||
4742 | break; | ||
4664 | } | 4743 | } |
4665 | spec->multiout.dac_nids = spec->dac_nids; | 4744 | spec->multiout.dac_nids = spec->dac_nids; |
4666 | 4745 | ||
@@ -4699,18 +4778,18 @@ again: | |||
4699 | spec->init = dell_m6_core_init; | 4778 | spec->init = dell_m6_core_init; |
4700 | switch (spec->board_config) { | 4779 | switch (spec->board_config) { |
4701 | case STAC_DELL_M6_AMIC: /* Analog Mics */ | 4780 | case STAC_DELL_M6_AMIC: /* Analog Mics */ |
4702 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4781 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
4703 | spec->num_dmics = 0; | 4782 | spec->num_dmics = 0; |
4704 | spec->private_dimux.num_items = 1; | 4783 | spec->private_dimux.num_items = 1; |
4705 | break; | 4784 | break; |
4706 | case STAC_DELL_M6_DMIC: /* Digital Mics */ | 4785 | case STAC_DELL_M6_DMIC: /* Digital Mics */ |
4707 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4786 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
4708 | spec->num_dmics = 1; | 4787 | spec->num_dmics = 1; |
4709 | spec->private_dimux.num_items = 2; | 4788 | spec->private_dimux.num_items = 2; |
4710 | break; | 4789 | break; |
4711 | case STAC_DELL_M6_BOTH: /* Both */ | 4790 | case STAC_DELL_M6_BOTH: /* Both */ |
4712 | stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); | 4791 | snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); |
4713 | stac92xx_set_config_reg(codec, 0x13, 0x90A60160); | 4792 | snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); |
4714 | spec->num_dmics = 1; | 4793 | spec->num_dmics = 1; |
4715 | spec->private_dimux.num_items = 2; | 4794 | spec->private_dimux.num_items = 2; |
4716 | break; | 4795 | break; |
@@ -4773,6 +4852,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
4773 | hda_nid_t conn[STAC92HD83_DAC_COUNT + 1]; | 4852 | hda_nid_t conn[STAC92HD83_DAC_COUNT + 1]; |
4774 | int err; | 4853 | int err; |
4775 | int num_dacs; | 4854 | int num_dacs; |
4855 | hda_nid_t nid; | ||
4776 | 4856 | ||
4777 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 4857 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
4778 | if (spec == NULL) | 4858 | if (spec == NULL) |
@@ -4791,15 +4871,6 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
4791 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); | 4871 | spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); |
4792 | spec->multiout.dac_nids = spec->dac_nids; | 4872 | spec->multiout.dac_nids = spec->dac_nids; |
4793 | 4873 | ||
4794 | |||
4795 | /* set port 0xe to select the last DAC | ||
4796 | */ | ||
4797 | num_dacs = snd_hda_get_connections(codec, 0x0e, | ||
4798 | conn, STAC92HD83_DAC_COUNT + 1) - 1; | ||
4799 | |||
4800 | snd_hda_codec_write_cache(codec, 0xe, 0, | ||
4801 | AC_VERB_SET_CONNECT_SEL, num_dacs); | ||
4802 | |||
4803 | spec->init = stac92hd83xxx_core_init; | 4874 | spec->init = stac92hd83xxx_core_init; |
4804 | spec->mixer = stac92hd83xxx_mixer; | 4875 | spec->mixer = stac92hd83xxx_mixer; |
4805 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); | 4876 | spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); |
@@ -4814,17 +4885,12 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) | |||
4814 | stac92hd83xxx_models, | 4885 | stac92hd83xxx_models, |
4815 | stac92hd83xxx_cfg_tbl); | 4886 | stac92hd83xxx_cfg_tbl); |
4816 | again: | 4887 | again: |
4817 | if (spec->board_config < 0) { | 4888 | if (spec->board_config < 0) |
4818 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | 4889 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
4819 | " STAC92HD83XXX, using BIOS defaults\n"); | 4890 | " STAC92HD83XXX, using BIOS defaults\n"); |
4820 | err = stac92xx_save_bios_config_regs(codec); | 4891 | else |
4821 | } else | 4892 | stac92xx_set_config_regs(codec, |
4822 | err = stac_save_pin_cfgs(codec, | ||
4823 | stac92hd83xxx_brd_tbl[spec->board_config]); | 4893 | stac92hd83xxx_brd_tbl[spec->board_config]); |
4824 | if (err < 0) { | ||
4825 | stac92xx_free(codec); | ||
4826 | return err; | ||
4827 | } | ||
4828 | 4894 | ||
4829 | switch (codec->vendor_id) { | 4895 | switch (codec->vendor_id) { |
4830 | case 0x111d7604: | 4896 | case 0x111d7604: |
@@ -4851,6 +4917,23 @@ again: | |||
4851 | return err; | 4917 | return err; |
4852 | } | 4918 | } |
4853 | 4919 | ||
4920 | switch (spec->board_config) { | ||
4921 | case STAC_DELL_S14: | ||
4922 | nid = 0xf; | ||
4923 | break; | ||
4924 | default: | ||
4925 | nid = 0xe; | ||
4926 | break; | ||
4927 | } | ||
4928 | |||
4929 | num_dacs = snd_hda_get_connections(codec, nid, | ||
4930 | conn, STAC92HD83_DAC_COUNT + 1) - 1; | ||
4931 | |||
4932 | /* set port X to select the last DAC | ||
4933 | */ | ||
4934 | snd_hda_codec_write_cache(codec, nid, 0, | ||
4935 | AC_VERB_SET_CONNECT_SEL, num_dacs); | ||
4936 | |||
4854 | codec->patch_ops = stac92xx_patch_ops; | 4937 | codec->patch_ops = stac92xx_patch_ops; |
4855 | 4938 | ||
4856 | codec->proc_widget_hook = stac92hd_proc_hook; | 4939 | codec->proc_widget_hook = stac92hd_proc_hook; |
@@ -4858,7 +4941,16 @@ again: | |||
4858 | return 0; | 4941 | return 0; |
4859 | } | 4942 | } |
4860 | 4943 | ||
4861 | static struct hda_input_mux stac92hd71bxx_dmux = { | 4944 | static struct hda_input_mux stac92hd71bxx_dmux_nomixer = { |
4945 | .num_items = 3, | ||
4946 | .items = { | ||
4947 | { "Analog Inputs", 0x00 }, | ||
4948 | { "Digital Mic 1", 0x02 }, | ||
4949 | { "Digital Mic 2", 0x03 }, | ||
4950 | } | ||
4951 | }; | ||
4952 | |||
4953 | static struct hda_input_mux stac92hd71bxx_dmux_amixer = { | ||
4862 | .num_items = 4, | 4954 | .num_items = 4, |
4863 | .items = { | 4955 | .items = { |
4864 | { "Analog Inputs", 0x00 }, | 4956 | { "Analog Inputs", 0x00 }, |
@@ -4868,10 +4960,67 @@ static struct hda_input_mux stac92hd71bxx_dmux = { | |||
4868 | } | 4960 | } |
4869 | }; | 4961 | }; |
4870 | 4962 | ||
4963 | /* get the pin connection (fixed, none, etc) */ | ||
4964 | static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) | ||
4965 | { | ||
4966 | struct sigmatel_spec *spec = codec->spec; | ||
4967 | unsigned int cfg; | ||
4968 | |||
4969 | cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]); | ||
4970 | return get_defcfg_connect(cfg); | ||
4971 | } | ||
4972 | |||
4973 | static int stac92hd71bxx_connected_ports(struct hda_codec *codec, | ||
4974 | hda_nid_t *nids, int num_nids) | ||
4975 | { | ||
4976 | struct sigmatel_spec *spec = codec->spec; | ||
4977 | int idx, num; | ||
4978 | unsigned int def_conf; | ||
4979 | |||
4980 | for (num = 0; num < num_nids; num++) { | ||
4981 | for (idx = 0; idx < spec->num_pins; idx++) | ||
4982 | if (spec->pin_nids[idx] == nids[num]) | ||
4983 | break; | ||
4984 | if (idx >= spec->num_pins) | ||
4985 | break; | ||
4986 | def_conf = stac_get_defcfg_connect(codec, idx); | ||
4987 | if (def_conf == AC_JACK_PORT_NONE) | ||
4988 | break; | ||
4989 | } | ||
4990 | return num; | ||
4991 | } | ||
4992 | |||
4993 | static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, | ||
4994 | hda_nid_t dig0pin) | ||
4995 | { | ||
4996 | struct sigmatel_spec *spec = codec->spec; | ||
4997 | int idx; | ||
4998 | |||
4999 | for (idx = 0; idx < spec->num_pins; idx++) | ||
5000 | if (spec->pin_nids[idx] == dig0pin) | ||
5001 | break; | ||
5002 | if ((idx + 2) >= spec->num_pins) | ||
5003 | return 0; | ||
5004 | |||
5005 | /* dig1pin case */ | ||
5006 | if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE) | ||
5007 | return 2; | ||
5008 | |||
5009 | /* dig0pin + dig2pin case */ | ||
5010 | if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE) | ||
5011 | return 2; | ||
5012 | if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE) | ||
5013 | return 1; | ||
5014 | else | ||
5015 | return 0; | ||
5016 | } | ||
5017 | |||
4871 | static int patch_stac92hd71bxx(struct hda_codec *codec) | 5018 | static int patch_stac92hd71bxx(struct hda_codec *codec) |
4872 | { | 5019 | { |
4873 | struct sigmatel_spec *spec; | 5020 | struct sigmatel_spec *spec; |
5021 | struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; | ||
4874 | int err = 0; | 5022 | int err = 0; |
5023 | unsigned int ndmic_nids = 0; | ||
4875 | 5024 | ||
4876 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5025 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
4877 | if (spec == NULL) | 5026 | if (spec == NULL) |
@@ -4879,27 +5028,32 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) | |||
4879 | 5028 | ||
4880 | codec->spec = spec; | 5029 | codec->spec = spec; |
4881 | codec->patch_ops = stac92xx_patch_ops; | 5030 | codec->patch_ops = stac92xx_patch_ops; |
4882 | spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); | 5031 | spec->num_pins = STAC92HD71BXX_NUM_PINS; |
5032 | switch (codec->vendor_id) { | ||
5033 | case 0x111d76b6: | ||
5034 | case 0x111d76b7: | ||
5035 | spec->pin_nids = stac92hd71bxx_pin_nids_4port; | ||
5036 | break; | ||
5037 | case 0x111d7603: | ||
5038 | case 0x111d7608: | ||
5039 | /* On 92HD75Bx 0x27 isn't a pin nid */ | ||
5040 | spec->num_pins--; | ||
5041 | /* fallthrough */ | ||
5042 | default: | ||
5043 | spec->pin_nids = stac92hd71bxx_pin_nids_6port; | ||
5044 | } | ||
4883 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); | 5045 | spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); |
4884 | spec->pin_nids = stac92hd71bxx_pin_nids; | ||
4885 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux, | ||
4886 | sizeof(stac92hd71bxx_dmux)); | ||
4887 | spec->board_config = snd_hda_check_board_config(codec, | 5046 | spec->board_config = snd_hda_check_board_config(codec, |
4888 | STAC_92HD71BXX_MODELS, | 5047 | STAC_92HD71BXX_MODELS, |
4889 | stac92hd71bxx_models, | 5048 | stac92hd71bxx_models, |
4890 | stac92hd71bxx_cfg_tbl); | 5049 | stac92hd71bxx_cfg_tbl); |
4891 | again: | 5050 | again: |
4892 | if (spec->board_config < 0) { | 5051 | if (spec->board_config < 0) |
4893 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | 5052 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
4894 | " STAC92HD71BXX, using BIOS defaults\n"); | 5053 | " STAC92HD71BXX, using BIOS defaults\n"); |
4895 | err = stac92xx_save_bios_config_regs(codec); | 5054 | else |
4896 | } else | 5055 | stac92xx_set_config_regs(codec, |
4897 | err = stac_save_pin_cfgs(codec, | ||
4898 | stac92hd71bxx_brd_tbl[spec->board_config]); | 5056 | stac92hd71bxx_brd_tbl[spec->board_config]); |
4899 | if (err < 0) { | ||
4900 | stac92xx_free(codec); | ||
4901 | return err; | ||
4902 | } | ||
4903 | 5057 | ||
4904 | if (spec->board_config > STAC_92HD71BXX_REF) { | 5058 | if (spec->board_config > STAC_92HD71BXX_REF) { |
4905 | /* GPIO0 = EAPD */ | 5059 | /* GPIO0 = EAPD */ |
@@ -4908,16 +5062,34 @@ again: | |||
4908 | spec->gpio_data = 0x01; | 5062 | spec->gpio_data = 0x01; |
4909 | } | 5063 | } |
4910 | 5064 | ||
5065 | spec->dmic_nids = stac92hd71bxx_dmic_nids; | ||
5066 | spec->dmux_nids = stac92hd71bxx_dmux_nids; | ||
5067 | |||
4911 | switch (codec->vendor_id) { | 5068 | switch (codec->vendor_id) { |
4912 | case 0x111d76b6: /* 4 Port without Analog Mixer */ | 5069 | case 0x111d76b6: /* 4 Port without Analog Mixer */ |
4913 | case 0x111d76b7: | 5070 | case 0x111d76b7: |
5071 | unmute_init++; | ||
5072 | /* fallthru */ | ||
4914 | case 0x111d76b4: /* 6 Port without Analog Mixer */ | 5073 | case 0x111d76b4: /* 6 Port without Analog Mixer */ |
4915 | case 0x111d76b5: | 5074 | case 0x111d76b5: |
5075 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer, | ||
5076 | sizeof(stac92hd71bxx_dmux_nomixer)); | ||
4916 | spec->mixer = stac92hd71bxx_mixer; | 5077 | spec->mixer = stac92hd71bxx_mixer; |
4917 | spec->init = stac92hd71bxx_core_init; | 5078 | spec->init = stac92hd71bxx_core_init; |
4918 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 5079 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
5080 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, | ||
5081 | stac92hd71bxx_dmic_nids, | ||
5082 | STAC92HD71BXX_NUM_DMICS); | ||
5083 | if (spec->num_dmics) { | ||
5084 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5085 | spec->dinput_mux = &spec->private_dimux; | ||
5086 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; | ||
5087 | } | ||
4919 | break; | 5088 | break; |
4920 | case 0x111d7608: /* 5 Port with Analog Mixer */ | 5089 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
5090 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, | ||
5091 | sizeof(stac92hd71bxx_dmux_amixer)); | ||
5092 | spec->private_dimux.num_items--; | ||
4921 | switch (spec->board_config) { | 5093 | switch (spec->board_config) { |
4922 | case STAC_HP_M4: | 5094 | case STAC_HP_M4: |
4923 | /* Enable VREF power saving on GPIO1 detect */ | 5095 | /* Enable VREF power saving on GPIO1 detect */ |
@@ -4944,7 +5116,15 @@ again: | |||
4944 | 5116 | ||
4945 | /* disable VSW */ | 5117 | /* disable VSW */ |
4946 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; | 5118 | spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; |
4947 | stac_change_pin_config(codec, 0xf, 0x40f000f0); | 5119 | unmute_init++; |
5120 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); | ||
5121 | snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); | ||
5122 | stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0; | ||
5123 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, | ||
5124 | stac92hd71bxx_dmic_nids, | ||
5125 | STAC92HD71BXX_NUM_DMICS - 1); | ||
5126 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5127 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 2; | ||
4948 | break; | 5128 | break; |
4949 | case 0x111d7603: /* 6 Port with Analog Mixer */ | 5129 | case 0x111d7603: /* 6 Port with Analog Mixer */ |
4950 | if ((codec->revision_id & 0xf) == 1) | 5130 | if ((codec->revision_id & 0xf) == 1) |
@@ -4954,12 +5134,23 @@ again: | |||
4954 | spec->num_pwrs = 0; | 5134 | spec->num_pwrs = 0; |
4955 | /* fallthru */ | 5135 | /* fallthru */ |
4956 | default: | 5136 | default: |
5137 | memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, | ||
5138 | sizeof(stac92hd71bxx_dmux_amixer)); | ||
4957 | spec->dinput_mux = &spec->private_dimux; | 5139 | spec->dinput_mux = &spec->private_dimux; |
4958 | spec->mixer = stac92hd71bxx_analog_mixer; | 5140 | spec->mixer = stac92hd71bxx_analog_mixer; |
4959 | spec->init = stac92hd71bxx_analog_core_init; | 5141 | spec->init = stac92hd71bxx_analog_core_init; |
4960 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 5142 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
5143 | spec->num_dmics = stac92hd71bxx_connected_ports(codec, | ||
5144 | stac92hd71bxx_dmic_nids, | ||
5145 | STAC92HD71BXX_NUM_DMICS); | ||
5146 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | ||
5147 | ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; | ||
4961 | } | 5148 | } |
4962 | 5149 | ||
5150 | if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) | ||
5151 | snd_hda_sequence_write_cache(codec, unmute_init); | ||
5152 | |||
5153 | spec->aloopback_ctl = stac92hd71bxx_loopback; | ||
4963 | spec->aloopback_mask = 0x50; | 5154 | spec->aloopback_mask = 0x50; |
4964 | spec->aloopback_shift = 0; | 5155 | spec->aloopback_shift = 0; |
4965 | 5156 | ||
@@ -4967,18 +5158,17 @@ again: | |||
4967 | spec->digbeep_nid = 0x26; | 5158 | spec->digbeep_nid = 0x26; |
4968 | spec->mux_nids = stac92hd71bxx_mux_nids; | 5159 | spec->mux_nids = stac92hd71bxx_mux_nids; |
4969 | spec->adc_nids = stac92hd71bxx_adc_nids; | 5160 | spec->adc_nids = stac92hd71bxx_adc_nids; |
4970 | spec->dmic_nids = stac92hd71bxx_dmic_nids; | ||
4971 | spec->dmux_nids = stac92hd71bxx_dmux_nids; | ||
4972 | spec->smux_nids = stac92hd71bxx_smux_nids; | 5161 | spec->smux_nids = stac92hd71bxx_smux_nids; |
4973 | spec->pwr_nids = stac92hd71bxx_pwr_nids; | 5162 | spec->pwr_nids = stac92hd71bxx_pwr_nids; |
4974 | 5163 | ||
4975 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); | 5164 | spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); |
4976 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); | 5165 | spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); |
5166 | spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); | ||
4977 | 5167 | ||
4978 | switch (spec->board_config) { | 5168 | switch (spec->board_config) { |
4979 | case STAC_HP_M4: | 5169 | case STAC_HP_M4: |
4980 | /* enable internal microphone */ | 5170 | /* enable internal microphone */ |
4981 | stac_change_pin_config(codec, 0x0e, 0x01813040); | 5171 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040); |
4982 | stac92xx_auto_set_pinctl(codec, 0x0e, | 5172 | stac92xx_auto_set_pinctl(codec, 0x0e, |
4983 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); | 5173 | AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); |
4984 | /* fallthru */ | 5174 | /* fallthru */ |
@@ -4993,19 +5183,36 @@ again: | |||
4993 | spec->num_smuxes = 0; | 5183 | spec->num_smuxes = 0; |
4994 | spec->num_dmuxes = 1; | 5184 | spec->num_dmuxes = 1; |
4995 | break; | 5185 | break; |
4996 | default: | 5186 | case STAC_HP_DV5: |
4997 | spec->num_dmics = STAC92HD71BXX_NUM_DMICS; | 5187 | snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010); |
4998 | spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids); | 5188 | stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); |
4999 | spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); | 5189 | break; |
5190 | case STAC_HP_HDX: | ||
5191 | spec->num_dmics = 1; | ||
5192 | spec->num_dmuxes = 1; | ||
5193 | spec->num_smuxes = 1; | ||
5194 | /* | ||
5195 | * For controlling MUTE LED on HP HDX16/HDX18 notebooks, | ||
5196 | * the CONFIG_SND_HDA_POWER_SAVE is needed to be set. | ||
5197 | */ | ||
5198 | #ifdef CONFIG_SND_HDA_POWER_SAVE | ||
5199 | /* orange/white mute led on GPIO3, orange=0, white=1 */ | ||
5200 | spec->gpio_mask |= 0x08; | ||
5201 | spec->gpio_dir |= 0x08; | ||
5202 | spec->gpio_data |= 0x08; /* set to white */ | ||
5203 | |||
5204 | /* register check_power_status callback. */ | ||
5205 | codec->patch_ops.check_power_status = | ||
5206 | stac92xx_hp_hdx_check_power_status; | ||
5207 | #endif | ||
5208 | break; | ||
5000 | }; | 5209 | }; |
5001 | 5210 | ||
5002 | spec->multiout.dac_nids = spec->dac_nids; | 5211 | spec->multiout.dac_nids = spec->dac_nids; |
5003 | if (spec->dinput_mux) | 5212 | if (spec->dinput_mux) |
5004 | spec->private_dimux.num_items += | 5213 | spec->private_dimux.num_items += spec->num_dmics - ndmic_nids; |
5005 | spec->num_dmics - | ||
5006 | (ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1); | ||
5007 | 5214 | ||
5008 | err = stac92xx_parse_auto_config(codec, 0x21, 0x23); | 5215 | err = stac92xx_parse_auto_config(codec, 0x21, 0); |
5009 | if (!err) { | 5216 | if (!err) { |
5010 | if (spec->board_config < 0) { | 5217 | if (spec->board_config < 0) { |
5011 | printk(KERN_WARNING "hda_codec: No auto-config is " | 5218 | printk(KERN_WARNING "hda_codec: No auto-config is " |
@@ -5080,17 +5287,12 @@ static int patch_stac922x(struct hda_codec *codec) | |||
5080 | } | 5287 | } |
5081 | 5288 | ||
5082 | again: | 5289 | again: |
5083 | if (spec->board_config < 0) { | 5290 | if (spec->board_config < 0) |
5084 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " | 5291 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " |
5085 | "using BIOS defaults\n"); | 5292 | "using BIOS defaults\n"); |
5086 | err = stac92xx_save_bios_config_regs(codec); | 5293 | else |
5087 | } else | 5294 | stac92xx_set_config_regs(codec, |
5088 | err = stac_save_pin_cfgs(codec, | ||
5089 | stac922x_brd_tbl[spec->board_config]); | 5295 | stac922x_brd_tbl[spec->board_config]); |
5090 | if (err < 0) { | ||
5091 | stac92xx_free(codec); | ||
5092 | return err; | ||
5093 | } | ||
5094 | 5296 | ||
5095 | spec->adc_nids = stac922x_adc_nids; | 5297 | spec->adc_nids = stac922x_adc_nids; |
5096 | spec->mux_nids = stac922x_mux_nids; | 5298 | spec->mux_nids = stac922x_mux_nids; |
@@ -5141,24 +5343,19 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5141 | return -ENOMEM; | 5343 | return -ENOMEM; |
5142 | 5344 | ||
5143 | codec->spec = spec; | 5345 | codec->spec = spec; |
5346 | codec->slave_dig_outs = stac927x_slave_dig_outs; | ||
5144 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); | 5347 | spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); |
5145 | spec->pin_nids = stac927x_pin_nids; | 5348 | spec->pin_nids = stac927x_pin_nids; |
5146 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, | 5349 | spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, |
5147 | stac927x_models, | 5350 | stac927x_models, |
5148 | stac927x_cfg_tbl); | 5351 | stac927x_cfg_tbl); |
5149 | again: | 5352 | again: |
5150 | if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) { | 5353 | if (spec->board_config < 0) |
5151 | if (spec->board_config < 0) | 5354 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" |
5152 | snd_printdd(KERN_INFO "hda_codec: Unknown model for" | 5355 | "STAC927x, using BIOS defaults\n"); |
5153 | "STAC927x, using BIOS defaults\n"); | 5356 | else |
5154 | err = stac92xx_save_bios_config_regs(codec); | 5357 | stac92xx_set_config_regs(codec, |
5155 | } else | ||
5156 | err = stac_save_pin_cfgs(codec, | ||
5157 | stac927x_brd_tbl[spec->board_config]); | 5358 | stac927x_brd_tbl[spec->board_config]); |
5158 | if (err < 0) { | ||
5159 | stac92xx_free(codec); | ||
5160 | return err; | ||
5161 | } | ||
5162 | 5359 | ||
5163 | spec->digbeep_nid = 0x23; | 5360 | spec->digbeep_nid = 0x23; |
5164 | spec->adc_nids = stac927x_adc_nids; | 5361 | spec->adc_nids = stac927x_adc_nids; |
@@ -5187,15 +5384,15 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5187 | case 0x10280209: | 5384 | case 0x10280209: |
5188 | case 0x1028022e: | 5385 | case 0x1028022e: |
5189 | /* correct the device field to SPDIF out */ | 5386 | /* correct the device field to SPDIF out */ |
5190 | stac_change_pin_config(codec, 0x21, 0x01442070); | 5387 | snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070); |
5191 | break; | 5388 | break; |
5192 | }; | 5389 | }; |
5193 | /* configure the analog microphone on some laptops */ | 5390 | /* configure the analog microphone on some laptops */ |
5194 | stac_change_pin_config(codec, 0x0c, 0x90a79130); | 5391 | snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130); |
5195 | /* correct the front output jack as a hp out */ | 5392 | /* correct the front output jack as a hp out */ |
5196 | stac_change_pin_config(codec, 0x0f, 0x0227011f); | 5393 | snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f); |
5197 | /* correct the front input jack as a mic */ | 5394 | /* correct the front input jack as a mic */ |
5198 | stac_change_pin_config(codec, 0x0e, 0x02a79130); | 5395 | snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130); |
5199 | /* fallthru */ | 5396 | /* fallthru */ |
5200 | case STAC_DELL_3ST: | 5397 | case STAC_DELL_3ST: |
5201 | /* GPIO2 High = Enable EAPD */ | 5398 | /* GPIO2 High = Enable EAPD */ |
@@ -5222,6 +5419,7 @@ static int patch_stac927x(struct hda_codec *codec) | |||
5222 | } | 5419 | } |
5223 | 5420 | ||
5224 | spec->num_pwrs = 0; | 5421 | spec->num_pwrs = 0; |
5422 | spec->aloopback_ctl = stac927x_loopback; | ||
5225 | spec->aloopback_mask = 0x40; | 5423 | spec->aloopback_mask = 0x40; |
5226 | spec->aloopback_shift = 0; | 5424 | spec->aloopback_shift = 0; |
5227 | spec->eapd_switch = 1; | 5425 | spec->eapd_switch = 1; |
@@ -5280,16 +5478,11 @@ static int patch_stac9205(struct hda_codec *codec) | |||
5280 | stac9205_models, | 5478 | stac9205_models, |
5281 | stac9205_cfg_tbl); | 5479 | stac9205_cfg_tbl); |
5282 | again: | 5480 | again: |
5283 | if (spec->board_config < 0) { | 5481 | if (spec->board_config < 0) |
5284 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); | 5482 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); |
5285 | err = stac92xx_save_bios_config_regs(codec); | 5483 | else |
5286 | } else | 5484 | stac92xx_set_config_regs(codec, |
5287 | err = stac_save_pin_cfgs(codec, | ||
5288 | stac9205_brd_tbl[spec->board_config]); | 5485 | stac9205_brd_tbl[spec->board_config]); |
5289 | if (err < 0) { | ||
5290 | stac92xx_free(codec); | ||
5291 | return err; | ||
5292 | } | ||
5293 | 5486 | ||
5294 | spec->digbeep_nid = 0x23; | 5487 | spec->digbeep_nid = 0x23; |
5295 | spec->adc_nids = stac9205_adc_nids; | 5488 | spec->adc_nids = stac9205_adc_nids; |
@@ -5306,17 +5499,20 @@ static int patch_stac9205(struct hda_codec *codec) | |||
5306 | 5499 | ||
5307 | spec->init = stac9205_core_init; | 5500 | spec->init = stac9205_core_init; |
5308 | spec->mixer = stac9205_mixer; | 5501 | spec->mixer = stac9205_mixer; |
5502 | spec->aloopback_ctl = stac9205_loopback; | ||
5309 | 5503 | ||
5310 | spec->aloopback_mask = 0x40; | 5504 | spec->aloopback_mask = 0x40; |
5311 | spec->aloopback_shift = 0; | 5505 | spec->aloopback_shift = 0; |
5312 | spec->eapd_switch = 1; | 5506 | /* Turn on/off EAPD per HP plugging */ |
5507 | if (spec->board_config != STAC_9205_EAPD) | ||
5508 | spec->eapd_switch = 1; | ||
5313 | spec->multiout.dac_nids = spec->dac_nids; | 5509 | spec->multiout.dac_nids = spec->dac_nids; |
5314 | 5510 | ||
5315 | switch (spec->board_config){ | 5511 | switch (spec->board_config){ |
5316 | case STAC_9205_DELL_M43: | 5512 | case STAC_9205_DELL_M43: |
5317 | /* Enable SPDIF in/out */ | 5513 | /* Enable SPDIF in/out */ |
5318 | stac_change_pin_config(codec, 0x1f, 0x01441030); | 5514 | snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030); |
5319 | stac_change_pin_config(codec, 0x20, 0x1c410030); | 5515 | snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); |
5320 | 5516 | ||
5321 | /* Enable unsol response for GPIO4/Dock HP connection */ | 5517 | /* Enable unsol response for GPIO4/Dock HP connection */ |
5322 | err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); | 5518 | err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); |
@@ -5373,223 +5569,87 @@ static int patch_stac9205(struct hda_codec *codec) | |||
5373 | * STAC9872 hack | 5569 | * STAC9872 hack |
5374 | */ | 5570 | */ |
5375 | 5571 | ||
5376 | /* static config for Sony VAIO FE550G and Sony VAIO AR */ | 5572 | static struct hda_verb stac9872_core_init[] = { |
5377 | static hda_nid_t vaio_dacs[] = { 0x2 }; | ||
5378 | #define VAIO_HP_DAC 0x5 | ||
5379 | static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ }; | ||
5380 | static hda_nid_t vaio_mux_nids[] = { 0x15 }; | ||
5381 | |||
5382 | static struct hda_input_mux vaio_mux = { | ||
5383 | .num_items = 3, | ||
5384 | .items = { | ||
5385 | /* { "HP", 0x0 }, */ | ||
5386 | { "Mic Jack", 0x1 }, | ||
5387 | { "Internal Mic", 0x2 }, | ||
5388 | { "PCM", 0x3 }, | ||
5389 | } | ||
5390 | }; | ||
5391 | |||
5392 | static struct hda_verb vaio_init[] = { | ||
5393 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ | ||
5394 | {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT}, | ||
5395 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ | ||
5396 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ | ||
5397 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ | ||
5398 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ | ||
5399 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ | 5573 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ |
5400 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ | ||
5401 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ | ||
5402 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ | ||
5403 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ | ||
5404 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ | 5574 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ |
5405 | {} | 5575 | {} |
5406 | }; | 5576 | }; |
5407 | 5577 | ||
5408 | static struct hda_verb vaio_ar_init[] = { | 5578 | static struct snd_kcontrol_new stac9872_mixer[] = { |
5409 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ | ||
5410 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ | ||
5411 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ | ||
5412 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ | ||
5413 | /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */ | ||
5414 | {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ | ||
5415 | {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ | ||
5416 | {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ | ||
5417 | {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ | ||
5418 | /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */ | ||
5419 | {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ | ||
5420 | {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ | ||
5421 | {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ | ||
5422 | {} | ||
5423 | }; | ||
5424 | |||
5425 | static struct snd_kcontrol_new vaio_mixer[] = { | ||
5426 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT), | ||
5427 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT), | ||
5428 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT), | ||
5429 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT), | ||
5430 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ | ||
5431 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), | 5579 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), |
5432 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), | 5580 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), |
5433 | { | 5581 | { } /* end */ |
5434 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
5435 | .name = "Capture Source", | ||
5436 | .count = 1, | ||
5437 | .info = stac92xx_mux_enum_info, | ||
5438 | .get = stac92xx_mux_enum_get, | ||
5439 | .put = stac92xx_mux_enum_put, | ||
5440 | }, | ||
5441 | {} | ||
5442 | }; | 5582 | }; |
5443 | 5583 | ||
5444 | static struct snd_kcontrol_new vaio_ar_mixer[] = { | 5584 | static hda_nid_t stac9872_pin_nids[] = { |
5445 | HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT), | 5585 | 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, |
5446 | HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT), | 5586 | 0x11, 0x13, 0x14, |
5447 | HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT), | ||
5448 | HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT), | ||
5449 | /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ | ||
5450 | HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), | ||
5451 | HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), | ||
5452 | /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT), | ||
5453 | HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/ | ||
5454 | { | ||
5455 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
5456 | .name = "Capture Source", | ||
5457 | .count = 1, | ||
5458 | .info = stac92xx_mux_enum_info, | ||
5459 | .get = stac92xx_mux_enum_get, | ||
5460 | .put = stac92xx_mux_enum_put, | ||
5461 | }, | ||
5462 | {} | ||
5463 | }; | 5587 | }; |
5464 | 5588 | ||
5465 | static struct hda_codec_ops stac9872_patch_ops = { | 5589 | static hda_nid_t stac9872_adc_nids[] = { |
5466 | .build_controls = stac92xx_build_controls, | 5590 | 0x8 /*,0x6*/ |
5467 | .build_pcms = stac92xx_build_pcms, | ||
5468 | .init = stac92xx_init, | ||
5469 | .free = stac92xx_free, | ||
5470 | #ifdef SND_HDA_NEEDS_RESUME | ||
5471 | .resume = stac92xx_resume, | ||
5472 | #endif | ||
5473 | }; | 5591 | }; |
5474 | 5592 | ||
5475 | static int stac9872_vaio_init(struct hda_codec *codec) | 5593 | static hda_nid_t stac9872_mux_nids[] = { |
5476 | { | 5594 | 0x15 |
5477 | int err; | ||
5478 | |||
5479 | err = stac92xx_init(codec); | ||
5480 | if (err < 0) | ||
5481 | return err; | ||
5482 | if (codec->patch_ops.unsol_event) | ||
5483 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); | ||
5484 | return 0; | ||
5485 | } | ||
5486 | |||
5487 | static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res) | ||
5488 | { | ||
5489 | if (get_pin_presence(codec, 0x0a)) { | ||
5490 | stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); | ||
5491 | stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); | ||
5492 | } else { | ||
5493 | stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); | ||
5494 | stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); | ||
5495 | } | ||
5496 | } | ||
5497 | |||
5498 | static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res) | ||
5499 | { | ||
5500 | switch (res >> 26) { | ||
5501 | case STAC_HP_EVENT: | ||
5502 | stac9872_vaio_hp_detect(codec, res); | ||
5503 | break; | ||
5504 | } | ||
5505 | } | ||
5506 | |||
5507 | static struct hda_codec_ops stac9872_vaio_patch_ops = { | ||
5508 | .build_controls = stac92xx_build_controls, | ||
5509 | .build_pcms = stac92xx_build_pcms, | ||
5510 | .init = stac9872_vaio_init, | ||
5511 | .free = stac92xx_free, | ||
5512 | .unsol_event = stac9872_vaio_unsol_event, | ||
5513 | #ifdef CONFIG_PM | ||
5514 | .resume = stac92xx_resume, | ||
5515 | #endif | ||
5516 | }; | 5595 | }; |
5517 | 5596 | ||
5518 | enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ | 5597 | static unsigned int stac9872_vaio_pin_configs[9] = { |
5519 | CXD9872RD_VAIO, | 5598 | 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, |
5520 | /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ | 5599 | 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, |
5521 | STAC9872AK_VAIO, | 5600 | 0x90a7013e |
5522 | /* Unknown. id=0x83847661 and subsys=0x104D1200. */ | ||
5523 | STAC9872K_VAIO, | ||
5524 | /* AR Series. id=0x83847664 and subsys=104D1300 */ | ||
5525 | CXD9872AKD_VAIO, | ||
5526 | STAC_9872_MODELS, | ||
5527 | }; | 5601 | }; |
5528 | 5602 | ||
5529 | static const char *stac9872_models[STAC_9872_MODELS] = { | 5603 | static const char *stac9872_models[STAC_9872_MODELS] = { |
5530 | [CXD9872RD_VAIO] = "vaio", | 5604 | [STAC_9872_AUTO] = "auto", |
5531 | [CXD9872AKD_VAIO] = "vaio-ar", | 5605 | [STAC_9872_VAIO] = "vaio", |
5606 | }; | ||
5607 | |||
5608 | static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = { | ||
5609 | [STAC_9872_VAIO] = stac9872_vaio_pin_configs, | ||
5532 | }; | 5610 | }; |
5533 | 5611 | ||
5534 | static struct snd_pci_quirk stac9872_cfg_tbl[] = { | 5612 | static struct snd_pci_quirk stac9872_cfg_tbl[] = { |
5535 | SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO), | 5613 | {} /* terminator */ |
5536 | SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO), | ||
5537 | SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO), | ||
5538 | SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO), | ||
5539 | {} | ||
5540 | }; | 5614 | }; |
5541 | 5615 | ||
5542 | static int patch_stac9872(struct hda_codec *codec) | 5616 | static int patch_stac9872(struct hda_codec *codec) |
5543 | { | 5617 | { |
5544 | struct sigmatel_spec *spec; | 5618 | struct sigmatel_spec *spec; |
5545 | int board_config; | 5619 | int err; |
5546 | 5620 | ||
5547 | board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, | ||
5548 | stac9872_models, | ||
5549 | stac9872_cfg_tbl); | ||
5550 | if (board_config < 0) | ||
5551 | /* unknown config, let generic-parser do its job... */ | ||
5552 | return snd_hda_parse_generic_codec(codec); | ||
5553 | |||
5554 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); | 5621 | spec = kzalloc(sizeof(*spec), GFP_KERNEL); |
5555 | if (spec == NULL) | 5622 | if (spec == NULL) |
5556 | return -ENOMEM; | 5623 | return -ENOMEM; |
5557 | |||
5558 | codec->spec = spec; | 5624 | codec->spec = spec; |
5559 | switch (board_config) { | ||
5560 | case CXD9872RD_VAIO: | ||
5561 | case STAC9872AK_VAIO: | ||
5562 | case STAC9872K_VAIO: | ||
5563 | spec->mixer = vaio_mixer; | ||
5564 | spec->init = vaio_init; | ||
5565 | spec->multiout.max_channels = 2; | ||
5566 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); | ||
5567 | spec->multiout.dac_nids = vaio_dacs; | ||
5568 | spec->multiout.hp_nid = VAIO_HP_DAC; | ||
5569 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); | ||
5570 | spec->adc_nids = vaio_adcs; | ||
5571 | spec->num_pwrs = 0; | ||
5572 | spec->input_mux = &vaio_mux; | ||
5573 | spec->mux_nids = vaio_mux_nids; | ||
5574 | codec->patch_ops = stac9872_vaio_patch_ops; | ||
5575 | break; | ||
5576 | |||
5577 | case CXD9872AKD_VAIO: | ||
5578 | spec->mixer = vaio_ar_mixer; | ||
5579 | spec->init = vaio_ar_init; | ||
5580 | spec->multiout.max_channels = 2; | ||
5581 | spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); | ||
5582 | spec->multiout.dac_nids = vaio_dacs; | ||
5583 | spec->multiout.hp_nid = VAIO_HP_DAC; | ||
5584 | spec->num_adcs = ARRAY_SIZE(vaio_adcs); | ||
5585 | spec->num_pwrs = 0; | ||
5586 | spec->adc_nids = vaio_adcs; | ||
5587 | spec->input_mux = &vaio_mux; | ||
5588 | spec->mux_nids = vaio_mux_nids; | ||
5589 | codec->patch_ops = stac9872_patch_ops; | ||
5590 | break; | ||
5591 | } | ||
5592 | 5625 | ||
5626 | spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, | ||
5627 | stac9872_models, | ||
5628 | stac9872_cfg_tbl); | ||
5629 | if (spec->board_config < 0) | ||
5630 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9872, " | ||
5631 | "using BIOS defaults\n"); | ||
5632 | else | ||
5633 | stac92xx_set_config_regs(codec, | ||
5634 | stac9872_brd_tbl[spec->board_config]); | ||
5635 | |||
5636 | spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); | ||
5637 | spec->pin_nids = stac9872_pin_nids; | ||
5638 | spec->multiout.dac_nids = spec->dac_nids; | ||
5639 | spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); | ||
5640 | spec->adc_nids = stac9872_adc_nids; | ||
5641 | spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); | ||
5642 | spec->mux_nids = stac9872_mux_nids; | ||
5643 | spec->mixer = stac9872_mixer; | ||
5644 | spec->init = stac9872_core_init; | ||
5645 | |||
5646 | err = stac92xx_parse_auto_config(codec, 0x10, 0x12); | ||
5647 | if (err < 0) { | ||
5648 | stac92xx_free(codec); | ||
5649 | return -EINVAL; | ||
5650 | } | ||
5651 | spec->input_mux = &spec->private_imux; | ||
5652 | codec->patch_ops = stac92xx_patch_ops; | ||
5593 | return 0; | 5653 | return 0; |
5594 | } | 5654 | } |
5595 | 5655 | ||
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index c761394cbe84..b25a5cc637d6 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -1308,16 +1308,13 @@ static void vt1708_set_pinconfig_connect(struct hda_codec *codec, hda_nid_t nid) | |||
1308 | unsigned int def_conf; | 1308 | unsigned int def_conf; |
1309 | unsigned char seqassoc; | 1309 | unsigned char seqassoc; |
1310 | 1310 | ||
1311 | def_conf = snd_hda_codec_read(codec, nid, 0, | 1311 | def_conf = snd_hda_codec_get_pincfg(codec, nid); |
1312 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
1313 | seqassoc = (unsigned char) get_defcfg_association(def_conf); | 1312 | seqassoc = (unsigned char) get_defcfg_association(def_conf); |
1314 | seqassoc = (seqassoc << 4) | get_defcfg_sequence(def_conf); | 1313 | seqassoc = (seqassoc << 4) | get_defcfg_sequence(def_conf); |
1315 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) { | 1314 | if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) { |
1316 | if (seqassoc == 0xff) { | 1315 | if (seqassoc == 0xff) { |
1317 | def_conf = def_conf & (~(AC_JACK_PORT_BOTH << 30)); | 1316 | def_conf = def_conf & (~(AC_JACK_PORT_BOTH << 30)); |
1318 | snd_hda_codec_write(codec, nid, 0, | 1317 | snd_hda_codec_set_pincfg(codec, nid, def_conf); |
1319 | AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, | ||
1320 | def_conf >> 24); | ||
1321 | } | 1318 | } |
1322 | } | 1319 | } |
1323 | 1320 | ||
@@ -1354,7 +1351,7 @@ static int vt1708_parse_auto_config(struct hda_codec *codec) | |||
1354 | 1351 | ||
1355 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 1352 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
1356 | 1353 | ||
1357 | if (spec->autocfg.dig_out_pin) | 1354 | if (spec->autocfg.dig_outs) |
1358 | spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; | 1355 | spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; |
1359 | if (spec->autocfg.dig_in_pin) | 1356 | if (spec->autocfg.dig_in_pin) |
1360 | spec->dig_in_nid = VT1708_DIGIN_NID; | 1357 | spec->dig_in_nid = VT1708_DIGIN_NID; |
@@ -1827,7 +1824,7 @@ static int vt1709_parse_auto_config(struct hda_codec *codec) | |||
1827 | 1824 | ||
1828 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 1825 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
1829 | 1826 | ||
1830 | if (spec->autocfg.dig_out_pin) | 1827 | if (spec->autocfg.dig_outs) |
1831 | spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; | 1828 | spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; |
1832 | if (spec->autocfg.dig_in_pin) | 1829 | if (spec->autocfg.dig_in_pin) |
1833 | spec->dig_in_nid = VT1709_DIGIN_NID; | 1830 | spec->dig_in_nid = VT1709_DIGIN_NID; |
@@ -2371,7 +2368,7 @@ static int vt1708B_parse_auto_config(struct hda_codec *codec) | |||
2371 | 2368 | ||
2372 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 2369 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
2373 | 2370 | ||
2374 | if (spec->autocfg.dig_out_pin) | 2371 | if (spec->autocfg.dig_outs) |
2375 | spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; | 2372 | spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; |
2376 | if (spec->autocfg.dig_in_pin) | 2373 | if (spec->autocfg.dig_in_pin) |
2377 | spec->dig_in_nid = VT1708B_DIGIN_NID; | 2374 | spec->dig_in_nid = VT1708B_DIGIN_NID; |
@@ -2836,7 +2833,7 @@ static int vt1708S_parse_auto_config(struct hda_codec *codec) | |||
2836 | 2833 | ||
2837 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 2834 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
2838 | 2835 | ||
2839 | if (spec->autocfg.dig_out_pin) | 2836 | if (spec->autocfg.dig_outs) |
2840 | spec->multiout.dig_out_nid = VT1708S_DIGOUT_NID; | 2837 | spec->multiout.dig_out_nid = VT1708S_DIGOUT_NID; |
2841 | 2838 | ||
2842 | spec->extra_dig_out_nid = 0x15; | 2839 | spec->extra_dig_out_nid = 0x15; |
@@ -3155,7 +3152,7 @@ static int vt1702_parse_auto_config(struct hda_codec *codec) | |||
3155 | 3152 | ||
3156 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; | 3153 | spec->multiout.max_channels = spec->multiout.num_dacs * 2; |
3157 | 3154 | ||
3158 | if (spec->autocfg.dig_out_pin) | 3155 | if (spec->autocfg.dig_outs) |
3159 | spec->multiout.dig_out_nid = VT1702_DIGOUT_NID; | 3156 | spec->multiout.dig_out_nid = VT1702_DIGOUT_NID; |
3160 | 3157 | ||
3161 | spec->extra_dig_out_nid = 0x1B; | 3158 | spec->extra_dig_out_nid = 0x1B; |
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 58d7cda03de5..3dd63f1cda53 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c | |||
@@ -458,7 +458,7 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id) | |||
458 | u16 pbkstatus; | 458 | u16 pbkstatus; |
459 | struct snd_pcm_substream *substream; | 459 | struct snd_pcm_substream *substream; |
460 | pbkstatus = inw(ICEDS(ice, INTSTAT)); | 460 | pbkstatus = inw(ICEDS(ice, INTSTAT)); |
461 | /* printk("pbkstatus = 0x%x\n", pbkstatus); */ | 461 | /* printk(KERN_DEBUG "pbkstatus = 0x%x\n", pbkstatus); */ |
462 | for (idx = 0; idx < 6; idx++) { | 462 | for (idx = 0; idx < 6; idx++) { |
463 | if ((pbkstatus & (3 << (idx * 2))) == 0) | 463 | if ((pbkstatus & (3 << (idx * 2))) == 0) |
464 | continue; | 464 | continue; |
@@ -2648,9 +2648,9 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci, | |||
2648 | return -ENOENT; | 2648 | return -ENOENT; |
2649 | } | 2649 | } |
2650 | 2650 | ||
2651 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2651 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2652 | if (card == NULL) | 2652 | if (err < 0) |
2653 | return -ENOMEM; | 2653 | return err; |
2654 | 2654 | ||
2655 | strcpy(card->driver, "ICE1712"); | 2655 | strcpy(card->driver, "ICE1712"); |
2656 | strcpy(card->shortname, "ICEnsemble ICE1712"); | 2656 | strcpy(card->shortname, "ICEnsemble ICE1712"); |
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index bb8d8c766b9d..128510e77a78 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c | |||
@@ -241,6 +241,8 @@ get_rawmidi_substream(struct snd_ice1712 *ice, unsigned int stream) | |||
241 | struct snd_rawmidi_substream, list); | 241 | struct snd_rawmidi_substream, list); |
242 | } | 242 | } |
243 | 243 | ||
244 | static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable); | ||
245 | |||
244 | static void vt1724_midi_write(struct snd_ice1712 *ice) | 246 | static void vt1724_midi_write(struct snd_ice1712 *ice) |
245 | { | 247 | { |
246 | struct snd_rawmidi_substream *s; | 248 | struct snd_rawmidi_substream *s; |
@@ -254,6 +256,11 @@ static void vt1724_midi_write(struct snd_ice1712 *ice) | |||
254 | for (i = 0; i < count; ++i) | 256 | for (i = 0; i < count; ++i) |
255 | outb(buffer[i], ICEREG1724(ice, MPU_DATA)); | 257 | outb(buffer[i], ICEREG1724(ice, MPU_DATA)); |
256 | } | 258 | } |
259 | /* mask irq when all bytes have been transmitted. | ||
260 | * enabled again in output_trigger when the new data comes in. | ||
261 | */ | ||
262 | enable_midi_irq(ice, VT1724_IRQ_MPU_TX, | ||
263 | !snd_rawmidi_transmit_empty(s)); | ||
257 | } | 264 | } |
258 | 265 | ||
259 | static void vt1724_midi_read(struct snd_ice1712 *ice) | 266 | static void vt1724_midi_read(struct snd_ice1712 *ice) |
@@ -272,31 +279,34 @@ static void vt1724_midi_read(struct snd_ice1712 *ice) | |||
272 | } | 279 | } |
273 | } | 280 | } |
274 | 281 | ||
275 | static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, | 282 | /* call with ice->reg_lock */ |
276 | u8 flag, int enable) | 283 | static void enable_midi_irq(struct snd_ice1712 *ice, u8 flag, int enable) |
277 | { | 284 | { |
278 | struct snd_ice1712 *ice = substream->rmidi->private_data; | 285 | u8 mask = inb(ICEREG1724(ice, IRQMASK)); |
279 | u8 mask; | ||
280 | |||
281 | spin_lock_irq(&ice->reg_lock); | ||
282 | mask = inb(ICEREG1724(ice, IRQMASK)); | ||
283 | if (enable) | 286 | if (enable) |
284 | mask &= ~flag; | 287 | mask &= ~flag; |
285 | else | 288 | else |
286 | mask |= flag; | 289 | mask |= flag; |
287 | outb(mask, ICEREG1724(ice, IRQMASK)); | 290 | outb(mask, ICEREG1724(ice, IRQMASK)); |
291 | } | ||
292 | |||
293 | static void vt1724_enable_midi_irq(struct snd_rawmidi_substream *substream, | ||
294 | u8 flag, int enable) | ||
295 | { | ||
296 | struct snd_ice1712 *ice = substream->rmidi->private_data; | ||
297 | |||
298 | spin_lock_irq(&ice->reg_lock); | ||
299 | enable_midi_irq(ice, flag, enable); | ||
288 | spin_unlock_irq(&ice->reg_lock); | 300 | spin_unlock_irq(&ice->reg_lock); |
289 | } | 301 | } |
290 | 302 | ||
291 | static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) | 303 | static int vt1724_midi_output_open(struct snd_rawmidi_substream *s) |
292 | { | 304 | { |
293 | vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 1); | ||
294 | return 0; | 305 | return 0; |
295 | } | 306 | } |
296 | 307 | ||
297 | static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) | 308 | static int vt1724_midi_output_close(struct snd_rawmidi_substream *s) |
298 | { | 309 | { |
299 | vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); | ||
300 | return 0; | 310 | return 0; |
301 | } | 311 | } |
302 | 312 | ||
@@ -311,6 +321,7 @@ static void vt1724_midi_output_trigger(struct snd_rawmidi_substream *s, int up) | |||
311 | vt1724_midi_write(ice); | 321 | vt1724_midi_write(ice); |
312 | } else { | 322 | } else { |
313 | ice->midi_output = 0; | 323 | ice->midi_output = 0; |
324 | enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); | ||
314 | } | 325 | } |
315 | spin_unlock_irqrestore(&ice->reg_lock, flags); | 326 | spin_unlock_irqrestore(&ice->reg_lock, flags); |
316 | } | 327 | } |
@@ -320,6 +331,7 @@ static void vt1724_midi_output_drain(struct snd_rawmidi_substream *s) | |||
320 | struct snd_ice1712 *ice = s->rmidi->private_data; | 331 | struct snd_ice1712 *ice = s->rmidi->private_data; |
321 | unsigned long timeout; | 332 | unsigned long timeout; |
322 | 333 | ||
334 | vt1724_enable_midi_irq(s, VT1724_IRQ_MPU_TX, 0); | ||
323 | /* 32 bytes should be transmitted in less than about 12 ms */ | 335 | /* 32 bytes should be transmitted in less than about 12 ms */ |
324 | timeout = jiffies + msecs_to_jiffies(15); | 336 | timeout = jiffies + msecs_to_jiffies(15); |
325 | do { | 337 | do { |
@@ -389,24 +401,24 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) | |||
389 | status &= status_mask; | 401 | status &= status_mask; |
390 | if (status == 0) | 402 | if (status == 0) |
391 | break; | 403 | break; |
404 | spin_lock(&ice->reg_lock); | ||
392 | if (++timeout > 10) { | 405 | if (++timeout > 10) { |
393 | status = inb(ICEREG1724(ice, IRQSTAT)); | 406 | status = inb(ICEREG1724(ice, IRQSTAT)); |
394 | printk(KERN_ERR "ice1724: Too long irq loop, " | 407 | printk(KERN_ERR "ice1724: Too long irq loop, " |
395 | "status = 0x%x\n", status); | 408 | "status = 0x%x\n", status); |
396 | if (status & VT1724_IRQ_MPU_TX) { | 409 | if (status & VT1724_IRQ_MPU_TX) { |
397 | printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); | 410 | printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); |
398 | outb(inb(ICEREG1724(ice, IRQMASK)) | | 411 | enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); |
399 | VT1724_IRQ_MPU_TX, | ||
400 | ICEREG1724(ice, IRQMASK)); | ||
401 | } | 412 | } |
413 | spin_unlock(&ice->reg_lock); | ||
402 | break; | 414 | break; |
403 | } | 415 | } |
404 | handled = 1; | 416 | handled = 1; |
405 | if (status & VT1724_IRQ_MPU_TX) { | 417 | if (status & VT1724_IRQ_MPU_TX) { |
406 | spin_lock(&ice->reg_lock); | ||
407 | if (ice->midi_output) | 418 | if (ice->midi_output) |
408 | vt1724_midi_write(ice); | 419 | vt1724_midi_write(ice); |
409 | spin_unlock(&ice->reg_lock); | 420 | else |
421 | enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); | ||
410 | /* Due to mysterical reasons, MPU_TX is always | 422 | /* Due to mysterical reasons, MPU_TX is always |
411 | * generated (and can't be cleared) when a PCM | 423 | * generated (and can't be cleared) when a PCM |
412 | * playback is going. So let's ignore at the | 424 | * playback is going. So let's ignore at the |
@@ -415,15 +427,14 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) | |||
415 | status_mask &= ~VT1724_IRQ_MPU_TX; | 427 | status_mask &= ~VT1724_IRQ_MPU_TX; |
416 | } | 428 | } |
417 | if (status & VT1724_IRQ_MPU_RX) { | 429 | if (status & VT1724_IRQ_MPU_RX) { |
418 | spin_lock(&ice->reg_lock); | ||
419 | if (ice->midi_input) | 430 | if (ice->midi_input) |
420 | vt1724_midi_read(ice); | 431 | vt1724_midi_read(ice); |
421 | else | 432 | else |
422 | vt1724_midi_clear_rx(ice); | 433 | vt1724_midi_clear_rx(ice); |
423 | spin_unlock(&ice->reg_lock); | ||
424 | } | 434 | } |
425 | /* ack MPU irq */ | 435 | /* ack MPU irq */ |
426 | outb(status, ICEREG1724(ice, IRQSTAT)); | 436 | outb(status, ICEREG1724(ice, IRQSTAT)); |
437 | spin_unlock(&ice->reg_lock); | ||
427 | if (status & VT1724_IRQ_MTPCM) { | 438 | if (status & VT1724_IRQ_MTPCM) { |
428 | /* | 439 | /* |
429 | * Multi-track PCM | 440 | * Multi-track PCM |
@@ -745,7 +756,14 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream) | |||
745 | 756 | ||
746 | spin_unlock_irq(&ice->reg_lock); | 757 | spin_unlock_irq(&ice->reg_lock); |
747 | 758 | ||
748 | /* printk("pro prepare: ch = %d, addr = 0x%x, buffer = 0x%x, period = 0x%x\n", substream->runtime->channels, (unsigned int)substream->runtime->dma_addr, snd_pcm_lib_buffer_bytes(substream), snd_pcm_lib_period_bytes(substream)); */ | 759 | /* |
760 | printk(KERN_DEBUG "pro prepare: ch = %d, addr = 0x%x, " | ||
761 | "buffer = 0x%x, period = 0x%x\n", | ||
762 | substream->runtime->channels, | ||
763 | (unsigned int)substream->runtime->dma_addr, | ||
764 | snd_pcm_lib_buffer_bytes(substream), | ||
765 | snd_pcm_lib_period_bytes(substream)); | ||
766 | */ | ||
749 | return 0; | 767 | return 0; |
750 | } | 768 | } |
751 | 769 | ||
@@ -2122,7 +2140,9 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice, | |||
2122 | wait_i2c_busy(ice); | 2140 | wait_i2c_busy(ice); |
2123 | val = inb(ICEREG1724(ice, I2C_DATA)); | 2141 | val = inb(ICEREG1724(ice, I2C_DATA)); |
2124 | mutex_unlock(&ice->i2c_mutex); | 2142 | mutex_unlock(&ice->i2c_mutex); |
2125 | /* printk("i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); */ | 2143 | /* |
2144 | printk(KERN_DEBUG "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); | ||
2145 | */ | ||
2126 | return val; | 2146 | return val; |
2127 | } | 2147 | } |
2128 | 2148 | ||
@@ -2131,7 +2151,9 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice, | |||
2131 | { | 2151 | { |
2132 | mutex_lock(&ice->i2c_mutex); | 2152 | mutex_lock(&ice->i2c_mutex); |
2133 | wait_i2c_busy(ice); | 2153 | wait_i2c_busy(ice); |
2134 | /* printk("i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); */ | 2154 | /* |
2155 | printk(KERN_DEBUG "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); | ||
2156 | */ | ||
2135 | outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); | 2157 | outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); |
2136 | outb(data, ICEREG1724(ice, I2C_DATA)); | 2158 | outb(data, ICEREG1724(ice, I2C_DATA)); |
2137 | outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); | 2159 | outb(dev | VT1724_I2C_WRITE, ICEREG1724(ice, I2C_DEV_ADDR)); |
@@ -2456,9 +2478,9 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci, | |||
2456 | return -ENOENT; | 2478 | return -ENOENT; |
2457 | } | 2479 | } |
2458 | 2480 | ||
2459 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2481 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2460 | if (card == NULL) | 2482 | if (err < 0) |
2461 | return -ENOMEM; | 2483 | return err; |
2462 | 2484 | ||
2463 | strcpy(card->driver, "ICE1724"); | 2485 | strcpy(card->driver, "ICE1724"); |
2464 | strcpy(card->shortname, "ICEnsemble ICE1724"); | 2486 | strcpy(card->shortname, "ICEnsemble ICE1724"); |
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index c51659b9caf6..fd948bfd9aef 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c | |||
@@ -345,8 +345,9 @@ static int juli_mute_put(struct snd_kcontrol *kcontrol, | |||
345 | new_gpio = old_gpio & | 345 | new_gpio = old_gpio & |
346 | ~((unsigned int) kcontrol->private_value); | 346 | ~((unsigned int) kcontrol->private_value); |
347 | } | 347 | } |
348 | /* printk("JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, \ | 348 | /* printk(KERN_DEBUG |
349 | new_gpio 0x%x\n", | 349 | "JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, " |
350 | "new_gpio 0x%x\n", | ||
350 | (unsigned int)ucontrol->value.integer.value[0], old_gpio, | 351 | (unsigned int)ucontrol->value.integer.value[0], old_gpio, |
351 | new_gpio); */ | 352 | new_gpio); */ |
352 | if (old_gpio != new_gpio) { | 353 | if (old_gpio != new_gpio) { |
diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 48d3679292a7..2a8e5cd8f2d8 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c | |||
@@ -133,8 +133,10 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
133 | idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME; | 133 | idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id) + STAC946X_LF_VOLUME; |
134 | /* due to possible conflicts with stac9460_set_rate_val, mutexing */ | 134 | /* due to possible conflicts with stac9460_set_rate_val, mutexing */ |
135 | mutex_lock(&spec->mute_mutex); | 135 | mutex_lock(&spec->mute_mutex); |
136 | /*printk("Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, | 136 | /* |
137 | ucontrol->value.integer.value[0]);*/ | 137 | printk(KERN_DEBUG "Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, |
138 | ucontrol->value.integer.value[0]); | ||
139 | */ | ||
138 | change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); | 140 | change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); |
139 | mutex_unlock(&spec->mute_mutex); | 141 | mutex_unlock(&spec->mute_mutex); |
140 | return change; | 142 | return change; |
@@ -185,7 +187,10 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el | |||
185 | change = (ovol != nvol); | 187 | change = (ovol != nvol); |
186 | if (change) { | 188 | if (change) { |
187 | ovol = (0x7f - nvol) | (tmp & 0x80); | 189 | ovol = (0x7f - nvol) | (tmp & 0x80); |
188 | /*printk("DAC Volume: reg 0x%02x: 0x%02x\n", idx, ovol);*/ | 190 | /* |
191 | printk(KERN_DEBUG "DAC Volume: reg 0x%02x: 0x%02x\n", | ||
192 | idx, ovol); | ||
193 | */ | ||
189 | stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); | 194 | stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); |
190 | } | 195 | } |
191 | return change; | 196 | return change; |
@@ -344,7 +349,7 @@ static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate) | |||
344 | for (idx = 0; idx < 7 ; ++idx) | 349 | for (idx = 0; idx < 7 ; ++idx) |
345 | changed[idx] = stac9460_dac_mute(ice, | 350 | changed[idx] = stac9460_dac_mute(ice, |
346 | STAC946X_MASTER_VOLUME + idx, 0); | 351 | STAC946X_MASTER_VOLUME + idx, 0); |
347 | /*printk("Rate change: %d, new MC: 0x%02x\n", rate, new);*/ | 352 | /*printk(KERN_DEBUG "Rate change: %d, new MC: 0x%02x\n", rate, new);*/ |
348 | stac9460_put(ice, STAC946X_MASTER_CLOCKING, new); | 353 | stac9460_put(ice, STAC946X_MASTER_CLOCKING, new); |
349 | udelay(10); | 354 | udelay(10); |
350 | /* unmuting - only originally unmuted dacs - | 355 | /* unmuting - only originally unmuted dacs - |
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index e900cdc84849..57648810eaf1 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c | |||
@@ -689,7 +689,7 @@ static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ich | |||
689 | bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */ | 689 | bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */ |
690 | ichdev->fragsize >> ichdev->pos_shift); | 690 | ichdev->fragsize >> ichdev->pos_shift); |
691 | #if 0 | 691 | #if 0 |
692 | printk("bdbar[%i] = 0x%x [0x%x]\n", | 692 | printk(KERN_DEBUG "bdbar[%i] = 0x%x [0x%x]\n", |
693 | idx + 0, bdbar[idx + 0], bdbar[idx + 1]); | 693 | idx + 0, bdbar[idx + 0], bdbar[idx + 1]); |
694 | #endif | 694 | #endif |
695 | } | 695 | } |
@@ -701,8 +701,10 @@ static void snd_intel8x0_setup_periods(struct intel8x0 *chip, struct ichdev *ich | |||
701 | ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; | 701 | ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; |
702 | ichdev->position = 0; | 702 | ichdev->position = 0; |
703 | #if 0 | 703 | #if 0 |
704 | printk("lvi_frag = %i, frags = %i, period_size = 0x%x, period_size1 = 0x%x\n", | 704 | printk(KERN_DEBUG "lvi_frag = %i, frags = %i, period_size = 0x%x, " |
705 | ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, ichdev->fragsize1); | 705 | "period_size1 = 0x%x\n", |
706 | ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, | ||
707 | ichdev->fragsize1); | ||
706 | #endif | 708 | #endif |
707 | /* clear interrupts */ | 709 | /* clear interrupts */ |
708 | iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); | 710 | iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); |
@@ -768,7 +770,8 @@ static inline void snd_intel8x0_update(struct intel8x0 *chip, struct ichdev *ich | |||
768 | ichdev->lvi_frag %= ichdev->frags; | 770 | ichdev->lvi_frag %= ichdev->frags; |
769 | ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize1); | 771 | ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize1); |
770 | #if 0 | 772 | #if 0 |
771 | printk("new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n", | 773 | printk(KERN_DEBUG "new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, " |
774 | "all = 0x%x, 0x%x\n", | ||
772 | ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], | 775 | ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], |
773 | ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), | 776 | ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), |
774 | inl(port + 4), inb(port + ICH_REG_OFF_CR)); | 777 | inl(port + 4), inb(port + ICH_REG_OFF_CR)); |
@@ -2287,23 +2290,23 @@ static void do_ali_reset(struct intel8x0 *chip) | |||
2287 | iputdword(chip, ICHREG(ALI_INTERRUPTSR), 0x00000000); | 2290 | iputdword(chip, ICHREG(ALI_INTERRUPTSR), 0x00000000); |
2288 | } | 2291 | } |
2289 | 2292 | ||
2290 | static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing) | 2293 | #ifdef CONFIG_SND_AC97_POWER_SAVE |
2291 | { | 2294 | static struct snd_pci_quirk ich_chip_reset_mode[] = { |
2292 | unsigned long end_time; | 2295 | SND_PCI_QUIRK(0x1014, 0x051f, "Thinkpad R32", 1), |
2293 | unsigned int cnt, status, nstatus; | 2296 | { } /* end */ |
2294 | 2297 | }; | |
2295 | /* put logic to right state */ | ||
2296 | /* first clear status bits */ | ||
2297 | status = ICH_RCS | ICH_MCINT | ICH_POINT | ICH_PIINT; | ||
2298 | if (chip->device_type == DEVICE_NFORCE) | ||
2299 | status |= ICH_NVSPINT; | ||
2300 | cnt = igetdword(chip, ICHREG(GLOB_STA)); | ||
2301 | iputdword(chip, ICHREG(GLOB_STA), cnt & status); | ||
2302 | 2298 | ||
2299 | static int snd_intel8x0_ich_chip_cold_reset(struct intel8x0 *chip) | ||
2300 | { | ||
2301 | unsigned int cnt; | ||
2303 | /* ACLink on, 2 channels */ | 2302 | /* ACLink on, 2 channels */ |
2303 | |||
2304 | if (snd_pci_quirk_lookup(chip->pci, ich_chip_reset_mode)) | ||
2305 | return -EIO; | ||
2306 | |||
2304 | cnt = igetdword(chip, ICHREG(GLOB_CNT)); | 2307 | cnt = igetdword(chip, ICHREG(GLOB_CNT)); |
2305 | cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK); | 2308 | cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK); |
2306 | #ifdef CONFIG_SND_AC97_POWER_SAVE | 2309 | |
2307 | /* do cold reset - the full ac97 powerdown may leave the controller | 2310 | /* do cold reset - the full ac97 powerdown may leave the controller |
2308 | * in a warm state but actually it cannot communicate with the codec. | 2311 | * in a warm state but actually it cannot communicate with the codec. |
2309 | */ | 2312 | */ |
@@ -2312,22 +2315,58 @@ static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing) | |||
2312 | udelay(10); | 2315 | udelay(10); |
2313 | iputdword(chip, ICHREG(GLOB_CNT), cnt | ICH_AC97COLD); | 2316 | iputdword(chip, ICHREG(GLOB_CNT), cnt | ICH_AC97COLD); |
2314 | msleep(1); | 2317 | msleep(1); |
2318 | return 0; | ||
2319 | } | ||
2320 | #define snd_intel8x0_ich_chip_can_cold_reset(chip) \ | ||
2321 | (!snd_pci_quirk_lookup(chip->pci, ich_chip_reset_mode)) | ||
2315 | #else | 2322 | #else |
2323 | #define snd_intel8x0_ich_chip_cold_reset(chip) 0 | ||
2324 | #define snd_intel8x0_ich_chip_can_cold_reset(chip) (0) | ||
2325 | #endif | ||
2326 | |||
2327 | static int snd_intel8x0_ich_chip_reset(struct intel8x0 *chip) | ||
2328 | { | ||
2329 | unsigned long end_time; | ||
2330 | unsigned int cnt; | ||
2331 | /* ACLink on, 2 channels */ | ||
2332 | cnt = igetdword(chip, ICHREG(GLOB_CNT)); | ||
2333 | cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK); | ||
2316 | /* finish cold or do warm reset */ | 2334 | /* finish cold or do warm reset */ |
2317 | cnt |= (cnt & ICH_AC97COLD) == 0 ? ICH_AC97COLD : ICH_AC97WARM; | 2335 | cnt |= (cnt & ICH_AC97COLD) == 0 ? ICH_AC97COLD : ICH_AC97WARM; |
2318 | iputdword(chip, ICHREG(GLOB_CNT), cnt); | 2336 | iputdword(chip, ICHREG(GLOB_CNT), cnt); |
2319 | end_time = (jiffies + (HZ / 4)) + 1; | 2337 | end_time = (jiffies + (HZ / 4)) + 1; |
2320 | do { | 2338 | do { |
2321 | if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0) | 2339 | if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0) |
2322 | goto __ok; | 2340 | return 0; |
2323 | schedule_timeout_uninterruptible(1); | 2341 | schedule_timeout_uninterruptible(1); |
2324 | } while (time_after_eq(end_time, jiffies)); | 2342 | } while (time_after_eq(end_time, jiffies)); |
2325 | snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", | 2343 | snd_printk(KERN_ERR "AC'97 warm reset still in progress? [0x%x]\n", |
2326 | igetdword(chip, ICHREG(GLOB_CNT))); | 2344 | igetdword(chip, ICHREG(GLOB_CNT))); |
2327 | return -EIO; | 2345 | return -EIO; |
2346 | } | ||
2347 | |||
2348 | static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing) | ||
2349 | { | ||
2350 | unsigned long end_time; | ||
2351 | unsigned int status, nstatus; | ||
2352 | unsigned int cnt; | ||
2353 | int err; | ||
2354 | |||
2355 | /* put logic to right state */ | ||
2356 | /* first clear status bits */ | ||
2357 | status = ICH_RCS | ICH_MCINT | ICH_POINT | ICH_PIINT; | ||
2358 | if (chip->device_type == DEVICE_NFORCE) | ||
2359 | status |= ICH_NVSPINT; | ||
2360 | cnt = igetdword(chip, ICHREG(GLOB_STA)); | ||
2361 | iputdword(chip, ICHREG(GLOB_STA), cnt & status); | ||
2362 | |||
2363 | if (snd_intel8x0_ich_chip_can_cold_reset(chip)) | ||
2364 | err = snd_intel8x0_ich_chip_cold_reset(chip); | ||
2365 | else | ||
2366 | err = snd_intel8x0_ich_chip_reset(chip); | ||
2367 | if (err < 0) | ||
2368 | return err; | ||
2328 | 2369 | ||
2329 | __ok: | ||
2330 | #endif | ||
2331 | if (probing) { | 2370 | if (probing) { |
2332 | /* wait for any codec ready status. | 2371 | /* wait for any codec ready status. |
2333 | * Once it becomes ready it should remain ready | 2372 | * Once it becomes ready it should remain ready |
@@ -3058,9 +3097,9 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci, | |||
3058 | int err; | 3097 | int err; |
3059 | struct shortname_table *name; | 3098 | struct shortname_table *name; |
3060 | 3099 | ||
3061 | card = snd_card_new(index, id, THIS_MODULE, 0); | 3100 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
3062 | if (card == NULL) | 3101 | if (err < 0) |
3063 | return -ENOMEM; | 3102 | return err; |
3064 | 3103 | ||
3065 | if (spdif_aclink < 0) | 3104 | if (spdif_aclink < 0) |
3066 | spdif_aclink = check_default_spdif_aclink(pci); | 3105 | spdif_aclink = check_default_spdif_aclink(pci); |
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 93449e464566..6ec0fc50d6be 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c | |||
@@ -411,7 +411,10 @@ static void snd_intel8x0_setup_periods(struct intel8x0m *chip, struct ichdev *ic | |||
411 | bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf + (((idx >> 1) * ichdev->fragsize) % ichdev->size)); | 411 | bdbar[idx + 0] = cpu_to_le32(ichdev->physbuf + (((idx >> 1) * ichdev->fragsize) % ichdev->size)); |
412 | bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */ | 412 | bdbar[idx + 1] = cpu_to_le32(0x80000000 | /* interrupt on completion */ |
413 | ichdev->fragsize >> chip->pcm_pos_shift); | 413 | ichdev->fragsize >> chip->pcm_pos_shift); |
414 | // printk("bdbar[%i] = 0x%x [0x%x]\n", idx + 0, bdbar[idx + 0], bdbar[idx + 1]); | 414 | /* |
415 | printk(KERN_DEBUG "bdbar[%i] = 0x%x [0x%x]\n", | ||
416 | idx + 0, bdbar[idx + 0], bdbar[idx + 1]); | ||
417 | */ | ||
415 | } | 418 | } |
416 | ichdev->frags = ichdev->size / ichdev->fragsize; | 419 | ichdev->frags = ichdev->size / ichdev->fragsize; |
417 | } | 420 | } |
@@ -421,8 +424,10 @@ static void snd_intel8x0_setup_periods(struct intel8x0m *chip, struct ichdev *ic | |||
421 | ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; | 424 | ichdev->lvi_frag = ICH_REG_LVI_MASK % ichdev->frags; |
422 | ichdev->position = 0; | 425 | ichdev->position = 0; |
423 | #if 0 | 426 | #if 0 |
424 | printk("lvi_frag = %i, frags = %i, period_size = 0x%x, period_size1 = 0x%x\n", | 427 | printk(KERN_DEBUG "lvi_frag = %i, frags = %i, period_size = 0x%x, " |
425 | ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, ichdev->fragsize1); | 428 | "period_size1 = 0x%x\n", |
429 | ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, | ||
430 | ichdev->fragsize1); | ||
426 | #endif | 431 | #endif |
427 | /* clear interrupts */ | 432 | /* clear interrupts */ |
428 | iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); | 433 | iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI); |
@@ -465,7 +470,8 @@ static inline void snd_intel8x0_update(struct intel8x0m *chip, struct ichdev *ic | |||
465 | ichdev->lvi_frag * | 470 | ichdev->lvi_frag * |
466 | ichdev->fragsize1); | 471 | ichdev->fragsize1); |
467 | #if 0 | 472 | #if 0 |
468 | printk("new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n", | 473 | printk(KERN_DEBUG "new: bdbar[%i] = 0x%x [0x%x], " |
474 | "prefetch = %i, all = 0x%x, 0x%x\n", | ||
469 | ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], | 475 | ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], |
470 | ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), | 476 | ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), |
471 | inl(port + 4), inb(port + ICH_REG_OFF_CR)); | 477 | inl(port + 4), inb(port + ICH_REG_OFF_CR)); |
@@ -1269,9 +1275,9 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, | |||
1269 | int err; | 1275 | int err; |
1270 | struct shortname_table *name; | 1276 | struct shortname_table *name; |
1271 | 1277 | ||
1272 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1278 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1273 | if (card == NULL) | 1279 | if (err < 0) |
1274 | return -ENOMEM; | 1280 | return err; |
1275 | 1281 | ||
1276 | strcpy(card->driver, "ICH-MODEM"); | 1282 | strcpy(card->driver, "ICH-MODEM"); |
1277 | strcpy(card->shortname, "Intel ICH"); | 1283 | strcpy(card->shortname, "Intel ICH"); |
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 5f8006b42750..8b79969034be 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c | |||
@@ -2443,9 +2443,9 @@ snd_korg1212_probe(struct pci_dev *pci, | |||
2443 | dev++; | 2443 | dev++; |
2444 | return -ENOENT; | 2444 | return -ENOENT; |
2445 | } | 2445 | } |
2446 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2446 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2447 | if (card == NULL) | 2447 | if (err < 0) |
2448 | return -ENOMEM; | 2448 | return err; |
2449 | 2449 | ||
2450 | if ((err = snd_korg1212_create(card, pci, &korg1212)) < 0) { | 2450 | if ((err = snd_korg1212_create(card, pci, &korg1212)) < 0) { |
2451 | snd_card_free(card); | 2451 | snd_card_free(card); |
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c index 59bbaf8f3e5b..70141548f251 100644 --- a/sound/pci/maestro3.c +++ b/sound/pci/maestro3.c | |||
@@ -2691,9 +2691,9 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2691 | return -ENOENT; | 2691 | return -ENOENT; |
2692 | } | 2692 | } |
2693 | 2693 | ||
2694 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2694 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2695 | if (card == NULL) | 2695 | if (err < 0) |
2696 | return -ENOMEM; | 2696 | return err; |
2697 | 2697 | ||
2698 | switch (pci->device) { | 2698 | switch (pci->device) { |
2699 | case PCI_DEVICE_ID_ESS_ALLEGRO: | 2699 | case PCI_DEVICE_ID_ESS_ALLEGRO: |
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index bb162507fe6c..c1eb84a14c42 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c | |||
@@ -1366,12 +1366,12 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci, | |||
1366 | else | 1366 | else |
1367 | idx = index[dev] + i; | 1367 | idx = index[dev] + i; |
1368 | snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i); | 1368 | snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i); |
1369 | card = snd_card_new(idx, tmpid, THIS_MODULE, 0); | 1369 | err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card); |
1370 | 1370 | ||
1371 | if (! card) { | 1371 | if (err < 0) { |
1372 | snd_printk(KERN_ERR "cannot allocate the card %d\n", i); | 1372 | snd_printk(KERN_ERR "cannot allocate the card %d\n", i); |
1373 | snd_mixart_free(mgr); | 1373 | snd_mixart_free(mgr); |
1374 | return -ENOMEM; | 1374 | return err; |
1375 | } | 1375 | } |
1376 | 1376 | ||
1377 | strcpy(card->driver, CARD_NAME); | 1377 | strcpy(card->driver, CARD_NAME); |
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c index 3782b52bc0e8..4cf4cd8c939c 100644 --- a/sound/pci/mixart/mixart_hwdep.c +++ b/sound/pci/mixart/mixart_hwdep.c | |||
@@ -345,8 +345,8 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
345 | status_daught = readl_be( MIXART_MEM( mgr,MIXART_PSEUDOREG_DXLX_STATUS_OFFSET )); | 345 | status_daught = readl_be( MIXART_MEM( mgr,MIXART_PSEUDOREG_DXLX_STATUS_OFFSET )); |
346 | 346 | ||
347 | /* motherboard xilinx status 5 will say that the board is performing a reset */ | 347 | /* motherboard xilinx status 5 will say that the board is performing a reset */ |
348 | if( status_xilinx == 5 ) { | 348 | if (status_xilinx == 5) { |
349 | snd_printk( KERN_ERR "miXart is resetting !\n"); | 349 | snd_printk(KERN_ERR "miXart is resetting !\n"); |
350 | return -EAGAIN; /* try again later */ | 350 | return -EAGAIN; /* try again later */ |
351 | } | 351 | } |
352 | 352 | ||
@@ -354,13 +354,14 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
354 | case MIXART_MOTHERBOARD_XLX_INDEX: | 354 | case MIXART_MOTHERBOARD_XLX_INDEX: |
355 | 355 | ||
356 | /* xilinx already loaded ? */ | 356 | /* xilinx already loaded ? */ |
357 | if( status_xilinx == 4 ) { | 357 | if (status_xilinx == 4) { |
358 | snd_printk( KERN_DEBUG "xilinx is already loaded !\n"); | 358 | snd_printk(KERN_DEBUG "xilinx is already loaded !\n"); |
359 | return 0; | 359 | return 0; |
360 | } | 360 | } |
361 | /* the status should be 0 == "idle" */ | 361 | /* the status should be 0 == "idle" */ |
362 | if( status_xilinx != 0 ) { | 362 | if (status_xilinx != 0) { |
363 | snd_printk( KERN_ERR "xilinx load error ! status = %d\n", status_xilinx); | 363 | snd_printk(KERN_ERR "xilinx load error ! status = %d\n", |
364 | status_xilinx); | ||
364 | return -EIO; /* modprob -r may help ? */ | 365 | return -EIO; /* modprob -r may help ? */ |
365 | } | 366 | } |
366 | 367 | ||
@@ -389,21 +390,23 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
389 | 390 | ||
390 | case MIXART_MOTHERBOARD_ELF_INDEX: | 391 | case MIXART_MOTHERBOARD_ELF_INDEX: |
391 | 392 | ||
392 | if( status_elf == 4 ) { | 393 | if (status_elf == 4) { |
393 | snd_printk( KERN_DEBUG "elf file already loaded !\n"); | 394 | snd_printk(KERN_DEBUG "elf file already loaded !\n"); |
394 | return 0; | 395 | return 0; |
395 | } | 396 | } |
396 | 397 | ||
397 | /* the status should be 0 == "idle" */ | 398 | /* the status should be 0 == "idle" */ |
398 | if( status_elf != 0 ) { | 399 | if (status_elf != 0) { |
399 | snd_printk( KERN_ERR "elf load error ! status = %d\n", status_elf); | 400 | snd_printk(KERN_ERR "elf load error ! status = %d\n", |
401 | status_elf); | ||
400 | return -EIO; /* modprob -r may help ? */ | 402 | return -EIO; /* modprob -r may help ? */ |
401 | } | 403 | } |
402 | 404 | ||
403 | /* wait for xilinx status == 4 */ | 405 | /* wait for xilinx status == 4 */ |
404 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_MXLX_STATUS_OFFSET, 1, 4, 500); /* 5sec */ | 406 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_MXLX_STATUS_OFFSET, 1, 4, 500); /* 5sec */ |
405 | if (err < 0) { | 407 | if (err < 0) { |
406 | snd_printk( KERN_ERR "xilinx was not loaded or could not be started\n"); | 408 | snd_printk(KERN_ERR "xilinx was not loaded or " |
409 | "could not be started\n"); | ||
407 | return err; | 410 | return err; |
408 | } | 411 | } |
409 | 412 | ||
@@ -424,7 +427,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
424 | /* wait for elf status == 4 */ | 427 | /* wait for elf status == 4 */ |
425 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_ELF_STATUS_OFFSET, 1, 4, 300); /* 3sec */ | 428 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_ELF_STATUS_OFFSET, 1, 4, 300); /* 3sec */ |
426 | if (err < 0) { | 429 | if (err < 0) { |
427 | snd_printk( KERN_ERR "elf could not be started\n"); | 430 | snd_printk(KERN_ERR "elf could not be started\n"); |
428 | return err; | 431 | return err; |
429 | } | 432 | } |
430 | 433 | ||
@@ -437,15 +440,16 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
437 | default: | 440 | default: |
438 | 441 | ||
439 | /* elf and xilinx should be loaded */ | 442 | /* elf and xilinx should be loaded */ |
440 | if( (status_elf != 4) || (status_xilinx != 4) ) { | 443 | if (status_elf != 4 || status_xilinx != 4) { |
441 | printk( KERN_ERR "xilinx or elf not successfully loaded\n"); | 444 | printk(KERN_ERR "xilinx or elf not " |
445 | "successfully loaded\n"); | ||
442 | return -EIO; /* modprob -r may help ? */ | 446 | return -EIO; /* modprob -r may help ? */ |
443 | } | 447 | } |
444 | 448 | ||
445 | /* wait for daughter detection != 0 */ | 449 | /* wait for daughter detection != 0 */ |
446 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DBRD_PRESENCE_OFFSET, 0, 0, 30); /* 300msec */ | 450 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DBRD_PRESENCE_OFFSET, 0, 0, 30); /* 300msec */ |
447 | if (err < 0) { | 451 | if (err < 0) { |
448 | snd_printk( KERN_ERR "error starting elf file\n"); | 452 | snd_printk(KERN_ERR "error starting elf file\n"); |
449 | return err; | 453 | return err; |
450 | } | 454 | } |
451 | 455 | ||
@@ -460,8 +464,9 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
460 | return -EINVAL; | 464 | return -EINVAL; |
461 | 465 | ||
462 | /* daughter should be idle */ | 466 | /* daughter should be idle */ |
463 | if( status_daught != 0 ) { | 467 | if (status_daught != 0) { |
464 | printk( KERN_ERR "daughter load error ! status = %d\n", status_daught); | 468 | printk(KERN_ERR "daughter load error ! status = %d\n", |
469 | status_daught); | ||
465 | return -EIO; /* modprob -r may help ? */ | 470 | return -EIO; /* modprob -r may help ? */ |
466 | } | 471 | } |
467 | 472 | ||
@@ -480,7 +485,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
480 | /* wait for status == 2 */ | 485 | /* wait for status == 2 */ |
481 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 2, 30); /* 300msec */ | 486 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 2, 30); /* 300msec */ |
482 | if (err < 0) { | 487 | if (err < 0) { |
483 | snd_printk( KERN_ERR "daughter board load error\n"); | 488 | snd_printk(KERN_ERR "daughter board load error\n"); |
484 | return err; | 489 | return err; |
485 | } | 490 | } |
486 | 491 | ||
@@ -502,7 +507,8 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
502 | /* wait for daughter status == 3 */ | 507 | /* wait for daughter status == 3 */ |
503 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 3, 300); /* 3sec */ | 508 | err = mixart_wait_nice_for_register_value( mgr, MIXART_PSEUDOREG_DXLX_STATUS_OFFSET, 1, 3, 300); /* 3sec */ |
504 | if (err < 0) { | 509 | if (err < 0) { |
505 | snd_printk( KERN_ERR "daughter board could not be initialised\n"); | 510 | snd_printk(KERN_ERR |
511 | "daughter board could not be initialised\n"); | ||
506 | return err; | 512 | return err; |
507 | } | 513 | } |
508 | 514 | ||
@@ -512,7 +518,7 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw | |||
512 | /* first communication with embedded */ | 518 | /* first communication with embedded */ |
513 | err = mixart_first_init(mgr); | 519 | err = mixart_first_init(mgr); |
514 | if (err < 0) { | 520 | if (err < 0) { |
515 | snd_printk( KERN_ERR "miXart could not be set up\n"); | 521 | snd_printk(KERN_ERR "miXart could not be set up\n"); |
516 | return err; | 522 | return err; |
517 | } | 523 | } |
518 | 524 | ||
@@ -581,16 +587,6 @@ MODULE_FIRMWARE("mixart/miXart8AES.xlx"); | |||
581 | /* miXart hwdep interface id string */ | 587 | /* miXart hwdep interface id string */ |
582 | #define SND_MIXART_HWDEP_ID "miXart Loader" | 588 | #define SND_MIXART_HWDEP_ID "miXart Loader" |
583 | 589 | ||
584 | static int mixart_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
585 | { | ||
586 | return 0; | ||
587 | } | ||
588 | |||
589 | static int mixart_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
590 | { | ||
591 | return 0; | ||
592 | } | ||
593 | |||
594 | static int mixart_hwdep_dsp_status(struct snd_hwdep *hw, | 590 | static int mixart_hwdep_dsp_status(struct snd_hwdep *hw, |
595 | struct snd_hwdep_dsp_status *info) | 591 | struct snd_hwdep_dsp_status *info) |
596 | { | 592 | { |
@@ -643,8 +639,6 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr) | |||
643 | 639 | ||
644 | hw->iface = SNDRV_HWDEP_IFACE_MIXART; | 640 | hw->iface = SNDRV_HWDEP_IFACE_MIXART; |
645 | hw->private_data = mgr; | 641 | hw->private_data = mgr; |
646 | hw->ops.open = mixart_hwdep_open; | ||
647 | hw->ops.release = mixart_hwdep_release; | ||
648 | hw->ops.dsp_status = mixart_hwdep_dsp_status; | 642 | hw->ops.dsp_status = mixart_hwdep_dsp_status; |
649 | hw->ops.dsp_load = mixart_hwdep_dsp_load; | 643 | hw->ops.dsp_load = mixart_hwdep_dsp_load; |
650 | hw->exclusive = 1; | 644 | hw->exclusive = 1; |
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c index 50c9f8a05082..522a040855d4 100644 --- a/sound/pci/nm256/nm256.c +++ b/sound/pci/nm256/nm256.c | |||
@@ -1668,9 +1668,9 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci, | |||
1668 | } | 1668 | } |
1669 | } | 1669 | } |
1670 | 1670 | ||
1671 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1671 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1672 | if (card == NULL) | 1672 | if (err < 0) |
1673 | return -ENOMEM; | 1673 | return err; |
1674 | 1674 | ||
1675 | switch (pci->device) { | 1675 | switch (pci->device) { |
1676 | case PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO: | 1676 | case PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO: |
diff --git a/sound/pci/oxygen/hifier.c b/sound/pci/oxygen/hifier.c index 1ab833f843eb..84ef13183419 100644 --- a/sound/pci/oxygen/hifier.c +++ b/sound/pci/oxygen/hifier.c | |||
@@ -45,6 +45,7 @@ MODULE_PARM_DESC(enable, "enable card"); | |||
45 | static struct pci_device_id hifier_ids[] __devinitdata = { | 45 | static struct pci_device_id hifier_ids[] __devinitdata = { |
46 | { OXYGEN_PCI_SUBID(0x14c3, 0x1710) }, | 46 | { OXYGEN_PCI_SUBID(0x14c3, 0x1710) }, |
47 | { OXYGEN_PCI_SUBID(0x14c3, 0x1711) }, | 47 | { OXYGEN_PCI_SUBID(0x14c3, 0x1711) }, |
48 | { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, | ||
48 | { } | 49 | { } |
49 | }; | 50 | }; |
50 | MODULE_DEVICE_TABLE(pci, hifier_ids); | 51 | MODULE_DEVICE_TABLE(pci, hifier_ids); |
@@ -151,7 +152,6 @@ static const struct oxygen_model model_hifier = { | |||
151 | .shortname = "C-Media CMI8787", | 152 | .shortname = "C-Media CMI8787", |
152 | .longname = "C-Media Oxygen HD Audio", | 153 | .longname = "C-Media Oxygen HD Audio", |
153 | .chip = "CMI8788", | 154 | .chip = "CMI8788", |
154 | .owner = THIS_MODULE, | ||
155 | .init = hifier_init, | 155 | .init = hifier_init, |
156 | .control_filter = hifier_control_filter, | 156 | .control_filter = hifier_control_filter, |
157 | .cleanup = hifier_cleanup, | 157 | .cleanup = hifier_cleanup, |
@@ -173,6 +173,13 @@ static const struct oxygen_model model_hifier = { | |||
173 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | 173 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, |
174 | }; | 174 | }; |
175 | 175 | ||
176 | static int __devinit get_hifier_model(struct oxygen *chip, | ||
177 | const struct pci_device_id *id) | ||
178 | { | ||
179 | chip->model = model_hifier; | ||
180 | return 0; | ||
181 | } | ||
182 | |||
176 | static int __devinit hifier_probe(struct pci_dev *pci, | 183 | static int __devinit hifier_probe(struct pci_dev *pci, |
177 | const struct pci_device_id *pci_id) | 184 | const struct pci_device_id *pci_id) |
178 | { | 185 | { |
@@ -185,7 +192,8 @@ static int __devinit hifier_probe(struct pci_dev *pci, | |||
185 | ++dev; | 192 | ++dev; |
186 | return -ENOENT; | 193 | return -ENOENT; |
187 | } | 194 | } |
188 | err = oxygen_pci_probe(pci, index[dev], id[dev], &model_hifier, 0); | 195 | err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, |
196 | hifier_ids, get_hifier_model); | ||
189 | if (err >= 0) | 197 | if (err >= 0) |
190 | ++dev; | 198 | ++dev; |
191 | return err; | 199 | return err; |
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c index de999c6d6dd3..72db4c39007f 100644 --- a/sound/pci/oxygen/oxygen.c +++ b/sound/pci/oxygen/oxygen.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * C-Media CMI8788 driver for C-Media's reference design and for the X-Meridian | 2 | * C-Media CMI8788 driver for C-Media's reference design and similar models |
3 | * | 3 | * |
4 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> | 4 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> |
5 | * | 5 | * |
@@ -26,6 +26,7 @@ | |||
26 | * | 26 | * |
27 | * GPIO 0 -> DFS0 of AK5385 | 27 | * GPIO 0 -> DFS0 of AK5385 |
28 | * GPIO 1 -> DFS1 of AK5385 | 28 | * GPIO 1 -> DFS1 of AK5385 |
29 | * GPIO 8 -> enable headphone amplifier on HT-Omega models | ||
29 | */ | 30 | */ |
30 | 31 | ||
31 | #include <linux/delay.h> | 32 | #include <linux/delay.h> |
@@ -61,7 +62,8 @@ MODULE_PARM_DESC(enable, "enable card"); | |||
61 | enum { | 62 | enum { |
62 | MODEL_CMEDIA_REF, /* C-Media's reference design */ | 63 | MODEL_CMEDIA_REF, /* C-Media's reference design */ |
63 | MODEL_MERIDIAN, /* AuzenTech X-Meridian */ | 64 | MODEL_MERIDIAN, /* AuzenTech X-Meridian */ |
64 | MODEL_HALO, /* HT-Omega Claro halo */ | 65 | MODEL_CLARO, /* HT-Omega Claro */ |
66 | MODEL_CLARO_HALO, /* HT-Omega Claro halo */ | ||
65 | }; | 67 | }; |
66 | 68 | ||
67 | static struct pci_device_id oxygen_ids[] __devinitdata = { | 69 | static struct pci_device_id oxygen_ids[] __devinitdata = { |
@@ -74,8 +76,8 @@ static struct pci_device_id oxygen_ids[] __devinitdata = { | |||
74 | { OXYGEN_PCI_SUBID(0x147a, 0xa017), .driver_data = MODEL_CMEDIA_REF }, | 76 | { OXYGEN_PCI_SUBID(0x147a, 0xa017), .driver_data = MODEL_CMEDIA_REF }, |
75 | { OXYGEN_PCI_SUBID(0x1a58, 0x0910), .driver_data = MODEL_CMEDIA_REF }, | 77 | { OXYGEN_PCI_SUBID(0x1a58, 0x0910), .driver_data = MODEL_CMEDIA_REF }, |
76 | { OXYGEN_PCI_SUBID(0x415a, 0x5431), .driver_data = MODEL_MERIDIAN }, | 78 | { OXYGEN_PCI_SUBID(0x415a, 0x5431), .driver_data = MODEL_MERIDIAN }, |
77 | { OXYGEN_PCI_SUBID(0x7284, 0x9761), .driver_data = MODEL_CMEDIA_REF }, | 79 | { OXYGEN_PCI_SUBID(0x7284, 0x9761), .driver_data = MODEL_CLARO }, |
78 | { OXYGEN_PCI_SUBID(0x7284, 0x9781), .driver_data = MODEL_HALO }, | 80 | { OXYGEN_PCI_SUBID(0x7284, 0x9781), .driver_data = MODEL_CLARO_HALO }, |
79 | { } | 81 | { } |
80 | }; | 82 | }; |
81 | MODULE_DEVICE_TABLE(pci, oxygen_ids); | 83 | MODULE_DEVICE_TABLE(pci, oxygen_ids); |
@@ -86,6 +88,8 @@ MODULE_DEVICE_TABLE(pci, oxygen_ids); | |||
86 | #define GPIO_AK5385_DFS_DOUBLE 0x0001 | 88 | #define GPIO_AK5385_DFS_DOUBLE 0x0001 |
87 | #define GPIO_AK5385_DFS_QUAD 0x0002 | 89 | #define GPIO_AK5385_DFS_QUAD 0x0002 |
88 | 90 | ||
91 | #define GPIO_CLARO_HP 0x0100 | ||
92 | |||
89 | struct generic_data { | 93 | struct generic_data { |
90 | u8 ak4396_ctl2; | 94 | u8 ak4396_ctl2; |
91 | u16 saved_wm8785_registers[2]; | 95 | u16 saved_wm8785_registers[2]; |
@@ -196,10 +200,46 @@ static void meridian_init(struct oxygen *chip) | |||
196 | ak5385_init(chip); | 200 | ak5385_init(chip); |
197 | } | 201 | } |
198 | 202 | ||
203 | static void claro_enable_hp(struct oxygen *chip) | ||
204 | { | ||
205 | msleep(300); | ||
206 | oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_CLARO_HP); | ||
207 | oxygen_set_bits16(chip, OXYGEN_GPIO_DATA, GPIO_CLARO_HP); | ||
208 | } | ||
209 | |||
210 | static void claro_init(struct oxygen *chip) | ||
211 | { | ||
212 | ak4396_init(chip); | ||
213 | wm8785_init(chip); | ||
214 | claro_enable_hp(chip); | ||
215 | } | ||
216 | |||
217 | static void claro_halo_init(struct oxygen *chip) | ||
218 | { | ||
219 | ak4396_init(chip); | ||
220 | ak5385_init(chip); | ||
221 | claro_enable_hp(chip); | ||
222 | } | ||
223 | |||
199 | static void generic_cleanup(struct oxygen *chip) | 224 | static void generic_cleanup(struct oxygen *chip) |
200 | { | 225 | { |
201 | } | 226 | } |
202 | 227 | ||
228 | static void claro_disable_hp(struct oxygen *chip) | ||
229 | { | ||
230 | oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, GPIO_CLARO_HP); | ||
231 | } | ||
232 | |||
233 | static void claro_cleanup(struct oxygen *chip) | ||
234 | { | ||
235 | claro_disable_hp(chip); | ||
236 | } | ||
237 | |||
238 | static void claro_suspend(struct oxygen *chip) | ||
239 | { | ||
240 | claro_disable_hp(chip); | ||
241 | } | ||
242 | |||
203 | static void generic_resume(struct oxygen *chip) | 243 | static void generic_resume(struct oxygen *chip) |
204 | { | 244 | { |
205 | ak4396_registers_init(chip); | 245 | ak4396_registers_init(chip); |
@@ -211,6 +251,12 @@ static void meridian_resume(struct oxygen *chip) | |||
211 | ak4396_registers_init(chip); | 251 | ak4396_registers_init(chip); |
212 | } | 252 | } |
213 | 253 | ||
254 | static void claro_resume(struct oxygen *chip) | ||
255 | { | ||
256 | ak4396_registers_init(chip); | ||
257 | claro_enable_hp(chip); | ||
258 | } | ||
259 | |||
214 | static void set_ak4396_params(struct oxygen *chip, | 260 | static void set_ak4396_params(struct oxygen *chip, |
215 | struct snd_pcm_hw_params *params) | 261 | struct snd_pcm_hw_params *params) |
216 | { | 262 | { |
@@ -293,30 +339,10 @@ static void set_ak5385_params(struct oxygen *chip, | |||
293 | 339 | ||
294 | static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); | 340 | static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); |
295 | 341 | ||
296 | static int generic_probe(struct oxygen *chip, unsigned long driver_data) | ||
297 | { | ||
298 | if (driver_data == MODEL_MERIDIAN) { | ||
299 | chip->model.init = meridian_init; | ||
300 | chip->model.resume = meridian_resume; | ||
301 | chip->model.set_adc_params = set_ak5385_params; | ||
302 | chip->model.device_config = PLAYBACK_0_TO_I2S | | ||
303 | PLAYBACK_1_TO_SPDIF | | ||
304 | CAPTURE_0_FROM_I2S_2 | | ||
305 | CAPTURE_1_FROM_SPDIF; | ||
306 | } | ||
307 | if (driver_data == MODEL_MERIDIAN || driver_data == MODEL_HALO) { | ||
308 | chip->model.misc_flags = OXYGEN_MISC_MIDI; | ||
309 | chip->model.device_config |= MIDI_OUTPUT | MIDI_INPUT; | ||
310 | } | ||
311 | return 0; | ||
312 | } | ||
313 | |||
314 | static const struct oxygen_model model_generic = { | 342 | static const struct oxygen_model model_generic = { |
315 | .shortname = "C-Media CMI8788", | 343 | .shortname = "C-Media CMI8788", |
316 | .longname = "C-Media Oxygen HD Audio", | 344 | .longname = "C-Media Oxygen HD Audio", |
317 | .chip = "CMI8788", | 345 | .chip = "CMI8788", |
318 | .owner = THIS_MODULE, | ||
319 | .probe = generic_probe, | ||
320 | .init = generic_init, | 346 | .init = generic_init, |
321 | .cleanup = generic_cleanup, | 347 | .cleanup = generic_cleanup, |
322 | .resume = generic_resume, | 348 | .resume = generic_resume, |
@@ -341,6 +367,42 @@ static const struct oxygen_model model_generic = { | |||
341 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | 367 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, |
342 | }; | 368 | }; |
343 | 369 | ||
370 | static int __devinit get_oxygen_model(struct oxygen *chip, | ||
371 | const struct pci_device_id *id) | ||
372 | { | ||
373 | chip->model = model_generic; | ||
374 | switch (id->driver_data) { | ||
375 | case MODEL_MERIDIAN: | ||
376 | chip->model.init = meridian_init; | ||
377 | chip->model.resume = meridian_resume; | ||
378 | chip->model.set_adc_params = set_ak5385_params; | ||
379 | chip->model.device_config = PLAYBACK_0_TO_I2S | | ||
380 | PLAYBACK_1_TO_SPDIF | | ||
381 | CAPTURE_0_FROM_I2S_2 | | ||
382 | CAPTURE_1_FROM_SPDIF; | ||
383 | break; | ||
384 | case MODEL_CLARO: | ||
385 | chip->model.init = claro_init; | ||
386 | chip->model.cleanup = claro_cleanup; | ||
387 | chip->model.suspend = claro_suspend; | ||
388 | chip->model.resume = claro_resume; | ||
389 | break; | ||
390 | case MODEL_CLARO_HALO: | ||
391 | chip->model.init = claro_halo_init; | ||
392 | chip->model.cleanup = claro_cleanup; | ||
393 | chip->model.suspend = claro_suspend; | ||
394 | chip->model.resume = claro_resume; | ||
395 | chip->model.set_adc_params = set_ak5385_params; | ||
396 | break; | ||
397 | } | ||
398 | if (id->driver_data == MODEL_MERIDIAN || | ||
399 | id->driver_data == MODEL_CLARO_HALO) { | ||
400 | chip->model.misc_flags = OXYGEN_MISC_MIDI; | ||
401 | chip->model.device_config |= MIDI_OUTPUT | MIDI_INPUT; | ||
402 | } | ||
403 | return 0; | ||
404 | } | ||
405 | |||
344 | static int __devinit generic_oxygen_probe(struct pci_dev *pci, | 406 | static int __devinit generic_oxygen_probe(struct pci_dev *pci, |
345 | const struct pci_device_id *pci_id) | 407 | const struct pci_device_id *pci_id) |
346 | { | 408 | { |
@@ -353,8 +415,8 @@ static int __devinit generic_oxygen_probe(struct pci_dev *pci, | |||
353 | ++dev; | 415 | ++dev; |
354 | return -ENOENT; | 416 | return -ENOENT; |
355 | } | 417 | } |
356 | err = oxygen_pci_probe(pci, index[dev], id[dev], | 418 | err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, |
357 | &model_generic, pci_id->driver_data); | 419 | oxygen_ids, get_oxygen_model); |
358 | if (err >= 0) | 420 | if (err >= 0) |
359 | ++dev; | 421 | ++dev; |
360 | return err; | 422 | return err; |
diff --git a/sound/pci/oxygen/oxygen.h b/sound/pci/oxygen/oxygen.h index 19107c6307e5..bd615dbffadb 100644 --- a/sound/pci/oxygen/oxygen.h +++ b/sound/pci/oxygen/oxygen.h | |||
@@ -18,6 +18,8 @@ | |||
18 | 18 | ||
19 | #define OXYGEN_IO_SIZE 0x100 | 19 | #define OXYGEN_IO_SIZE 0x100 |
20 | 20 | ||
21 | #define OXYGEN_EEPROM_ID 0x434d /* "CM" */ | ||
22 | |||
21 | /* model-specific configuration of outputs/inputs */ | 23 | /* model-specific configuration of outputs/inputs */ |
22 | #define PLAYBACK_0_TO_I2S 0x0001 | 24 | #define PLAYBACK_0_TO_I2S 0x0001 |
23 | /* PLAYBACK_0_TO_AC97_0 not implemented */ | 25 | /* PLAYBACK_0_TO_AC97_0 not implemented */ |
@@ -49,7 +51,13 @@ enum { | |||
49 | .subvendor = sv, \ | 51 | .subvendor = sv, \ |
50 | .subdevice = sd | 52 | .subdevice = sd |
51 | 53 | ||
54 | #define BROKEN_EEPROM_DRIVER_DATA ((unsigned long)-1) | ||
55 | #define OXYGEN_PCI_SUBID_BROKEN_EEPROM \ | ||
56 | OXYGEN_PCI_SUBID(PCI_VENDOR_ID_CMEDIA, 0x8788), \ | ||
57 | .driver_data = BROKEN_EEPROM_DRIVER_DATA | ||
58 | |||
52 | struct pci_dev; | 59 | struct pci_dev; |
60 | struct pci_device_id; | ||
53 | struct snd_card; | 61 | struct snd_card; |
54 | struct snd_pcm_substream; | 62 | struct snd_pcm_substream; |
55 | struct snd_pcm_hardware; | 63 | struct snd_pcm_hardware; |
@@ -62,8 +70,6 @@ struct oxygen_model { | |||
62 | const char *shortname; | 70 | const char *shortname; |
63 | const char *longname; | 71 | const char *longname; |
64 | const char *chip; | 72 | const char *chip; |
65 | struct module *owner; | ||
66 | int (*probe)(struct oxygen *chip, unsigned long driver_data); | ||
67 | void (*init)(struct oxygen *chip); | 73 | void (*init)(struct oxygen *chip); |
68 | int (*control_filter)(struct snd_kcontrol_new *template); | 74 | int (*control_filter)(struct snd_kcontrol_new *template); |
69 | int (*mixer_init)(struct oxygen *chip); | 75 | int (*mixer_init)(struct oxygen *chip); |
@@ -83,6 +89,7 @@ struct oxygen_model { | |||
83 | void (*ac97_switch)(struct oxygen *chip, | 89 | void (*ac97_switch)(struct oxygen *chip, |
84 | unsigned int reg, unsigned int mute); | 90 | unsigned int reg, unsigned int mute); |
85 | const unsigned int *dac_tlv; | 91 | const unsigned int *dac_tlv; |
92 | unsigned long private_data; | ||
86 | size_t model_data_size; | 93 | size_t model_data_size; |
87 | unsigned int device_config; | 94 | unsigned int device_config; |
88 | u8 dac_channels; | 95 | u8 dac_channels; |
@@ -134,8 +141,12 @@ struct oxygen { | |||
134 | /* oxygen_lib.c */ | 141 | /* oxygen_lib.c */ |
135 | 142 | ||
136 | int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | 143 | int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, |
137 | const struct oxygen_model *model, | 144 | struct module *owner, |
138 | unsigned long driver_data); | 145 | const struct pci_device_id *ids, |
146 | int (*get_model)(struct oxygen *chip, | ||
147 | const struct pci_device_id *id | ||
148 | ) | ||
149 | ); | ||
139 | void oxygen_pci_remove(struct pci_dev *pci); | 150 | void oxygen_pci_remove(struct pci_dev *pci); |
140 | #ifdef CONFIG_PM | 151 | #ifdef CONFIG_PM |
141 | int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state); | 152 | int oxygen_pci_suspend(struct pci_dev *pci, pm_message_t state); |
@@ -180,6 +191,9 @@ void oxygen_write_i2c(struct oxygen *chip, u8 device, u8 map, u8 data); | |||
180 | void oxygen_reset_uart(struct oxygen *chip); | 191 | void oxygen_reset_uart(struct oxygen *chip); |
181 | void oxygen_write_uart(struct oxygen *chip, u8 data); | 192 | void oxygen_write_uart(struct oxygen *chip, u8 data); |
182 | 193 | ||
194 | u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index); | ||
195 | void oxygen_write_eeprom(struct oxygen *chip, unsigned int index, u16 value); | ||
196 | |||
183 | static inline void oxygen_set_bits8(struct oxygen *chip, | 197 | static inline void oxygen_set_bits8(struct oxygen *chip, |
184 | unsigned int reg, u8 value) | 198 | unsigned int reg, u8 value) |
185 | { | 199 | { |
diff --git a/sound/pci/oxygen/oxygen_io.c b/sound/pci/oxygen/oxygen_io.c index 3126c4b403dd..c1eb923f2ac9 100644 --- a/sound/pci/oxygen/oxygen_io.c +++ b/sound/pci/oxygen/oxygen_io.c | |||
@@ -254,3 +254,34 @@ void oxygen_write_uart(struct oxygen *chip, u8 data) | |||
254 | _write_uart(chip, 0, data); | 254 | _write_uart(chip, 0, data); |
255 | } | 255 | } |
256 | EXPORT_SYMBOL(oxygen_write_uart); | 256 | EXPORT_SYMBOL(oxygen_write_uart); |
257 | |||
258 | u16 oxygen_read_eeprom(struct oxygen *chip, unsigned int index) | ||
259 | { | ||
260 | unsigned int timeout; | ||
261 | |||
262 | oxygen_write8(chip, OXYGEN_EEPROM_CONTROL, | ||
263 | index | OXYGEN_EEPROM_DIR_READ); | ||
264 | for (timeout = 0; timeout < 100; ++timeout) { | ||
265 | udelay(1); | ||
266 | if (!(oxygen_read8(chip, OXYGEN_EEPROM_STATUS) | ||
267 | & OXYGEN_EEPROM_BUSY)) | ||
268 | break; | ||
269 | } | ||
270 | return oxygen_read16(chip, OXYGEN_EEPROM_DATA); | ||
271 | } | ||
272 | |||
273 | void oxygen_write_eeprom(struct oxygen *chip, unsigned int index, u16 value) | ||
274 | { | ||
275 | unsigned int timeout; | ||
276 | |||
277 | oxygen_write16(chip, OXYGEN_EEPROM_DATA, value); | ||
278 | oxygen_write8(chip, OXYGEN_EEPROM_CONTROL, | ||
279 | index | OXYGEN_EEPROM_DIR_WRITE); | ||
280 | for (timeout = 0; timeout < 10; ++timeout) { | ||
281 | msleep(1); | ||
282 | if (!(oxygen_read8(chip, OXYGEN_EEPROM_STATUS) | ||
283 | & OXYGEN_EEPROM_BUSY)) | ||
284 | return; | ||
285 | } | ||
286 | snd_printk(KERN_ERR "EEPROM write timeout\n"); | ||
287 | } | ||
diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index 84f481d41efa..312251d39696 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c | |||
@@ -34,6 +34,7 @@ MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); | |||
34 | MODULE_DESCRIPTION("C-Media CMI8788 helper library"); | 34 | MODULE_DESCRIPTION("C-Media CMI8788 helper library"); |
35 | MODULE_LICENSE("GPL v2"); | 35 | MODULE_LICENSE("GPL v2"); |
36 | 36 | ||
37 | #define DRIVER "oxygen" | ||
37 | 38 | ||
38 | static inline int oxygen_uart_input_ready(struct oxygen *chip) | 39 | static inline int oxygen_uart_input_ready(struct oxygen *chip) |
39 | { | 40 | { |
@@ -243,6 +244,62 @@ static void oxygen_proc_init(struct oxygen *chip) | |||
243 | #define oxygen_proc_init(chip) | 244 | #define oxygen_proc_init(chip) |
244 | #endif | 245 | #endif |
245 | 246 | ||
247 | static const struct pci_device_id * | ||
248 | oxygen_search_pci_id(struct oxygen *chip, const struct pci_device_id ids[]) | ||
249 | { | ||
250 | u16 subdevice; | ||
251 | |||
252 | /* | ||
253 | * Make sure the EEPROM pins are available, i.e., not used for SPI. | ||
254 | * (This function is called before we initialize or use SPI.) | ||
255 | */ | ||
256 | oxygen_clear_bits8(chip, OXYGEN_FUNCTION, | ||
257 | OXYGEN_FUNCTION_ENABLE_SPI_4_5); | ||
258 | /* | ||
259 | * Read the subsystem device ID directly from the EEPROM, because the | ||
260 | * chip didn't if the first EEPROM word was overwritten. | ||
261 | */ | ||
262 | subdevice = oxygen_read_eeprom(chip, 2); | ||
263 | /* | ||
264 | * We use only the subsystem device ID for searching because it is | ||
265 | * unique even without the subsystem vendor ID, which may have been | ||
266 | * overwritten in the EEPROM. | ||
267 | */ | ||
268 | for (; ids->vendor; ++ids) | ||
269 | if (ids->subdevice == subdevice && | ||
270 | ids->driver_data != BROKEN_EEPROM_DRIVER_DATA) | ||
271 | return ids; | ||
272 | return NULL; | ||
273 | } | ||
274 | |||
275 | static void oxygen_restore_eeprom(struct oxygen *chip, | ||
276 | const struct pci_device_id *id) | ||
277 | { | ||
278 | if (oxygen_read_eeprom(chip, 0) != OXYGEN_EEPROM_ID) { | ||
279 | /* | ||
280 | * This function gets called only when a known card model has | ||
281 | * been detected, i.e., we know there is a valid subsystem | ||
282 | * product ID at index 2 in the EEPROM. Therefore, we have | ||
283 | * been able to deduce the correct subsystem vendor ID, and | ||
284 | * this is enough information to restore the original EEPROM | ||
285 | * contents. | ||
286 | */ | ||
287 | oxygen_write_eeprom(chip, 1, id->subvendor); | ||
288 | oxygen_write_eeprom(chip, 0, OXYGEN_EEPROM_ID); | ||
289 | |||
290 | oxygen_set_bits8(chip, OXYGEN_MISC, | ||
291 | OXYGEN_MISC_WRITE_PCI_SUBID); | ||
292 | pci_write_config_word(chip->pci, PCI_SUBSYSTEM_VENDOR_ID, | ||
293 | id->subvendor); | ||
294 | pci_write_config_word(chip->pci, PCI_SUBSYSTEM_ID, | ||
295 | id->subdevice); | ||
296 | oxygen_clear_bits8(chip, OXYGEN_MISC, | ||
297 | OXYGEN_MISC_WRITE_PCI_SUBID); | ||
298 | |||
299 | snd_printk(KERN_INFO "EEPROM ID restored\n"); | ||
300 | } | ||
301 | } | ||
302 | |||
246 | static void oxygen_init(struct oxygen *chip) | 303 | static void oxygen_init(struct oxygen *chip) |
247 | { | 304 | { |
248 | unsigned int i; | 305 | unsigned int i; |
@@ -446,30 +503,33 @@ static void oxygen_card_free(struct snd_card *card) | |||
446 | free_irq(chip->irq, chip); | 503 | free_irq(chip->irq, chip); |
447 | flush_scheduled_work(); | 504 | flush_scheduled_work(); |
448 | chip->model.cleanup(chip); | 505 | chip->model.cleanup(chip); |
506 | kfree(chip->model_data); | ||
449 | mutex_destroy(&chip->mutex); | 507 | mutex_destroy(&chip->mutex); |
450 | pci_release_regions(chip->pci); | 508 | pci_release_regions(chip->pci); |
451 | pci_disable_device(chip->pci); | 509 | pci_disable_device(chip->pci); |
452 | } | 510 | } |
453 | 511 | ||
454 | int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | 512 | int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, |
455 | const struct oxygen_model *model, | 513 | struct module *owner, |
456 | unsigned long driver_data) | 514 | const struct pci_device_id *ids, |
515 | int (*get_model)(struct oxygen *chip, | ||
516 | const struct pci_device_id *id | ||
517 | ) | ||
518 | ) | ||
457 | { | 519 | { |
458 | struct snd_card *card; | 520 | struct snd_card *card; |
459 | struct oxygen *chip; | 521 | struct oxygen *chip; |
522 | const struct pci_device_id *pci_id; | ||
460 | int err; | 523 | int err; |
461 | 524 | ||
462 | card = snd_card_new(index, id, model->owner, | 525 | err = snd_card_create(index, id, owner, sizeof(*chip), &card); |
463 | sizeof *chip + model->model_data_size); | 526 | if (err < 0) |
464 | if (!card) | 527 | return err; |
465 | return -ENOMEM; | ||
466 | 528 | ||
467 | chip = card->private_data; | 529 | chip = card->private_data; |
468 | chip->card = card; | 530 | chip->card = card; |
469 | chip->pci = pci; | 531 | chip->pci = pci; |
470 | chip->irq = -1; | 532 | chip->irq = -1; |
471 | chip->model = *model; | ||
472 | chip->model_data = chip + 1; | ||
473 | spin_lock_init(&chip->reg_lock); | 533 | spin_lock_init(&chip->reg_lock); |
474 | mutex_init(&chip->mutex); | 534 | mutex_init(&chip->mutex); |
475 | INIT_WORK(&chip->spdif_input_bits_work, | 535 | INIT_WORK(&chip->spdif_input_bits_work, |
@@ -481,7 +541,7 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | |||
481 | if (err < 0) | 541 | if (err < 0) |
482 | goto err_card; | 542 | goto err_card; |
483 | 543 | ||
484 | err = pci_request_regions(pci, model->chip); | 544 | err = pci_request_regions(pci, DRIVER); |
485 | if (err < 0) { | 545 | if (err < 0) { |
486 | snd_printk(KERN_ERR "cannot reserve PCI resources\n"); | 546 | snd_printk(KERN_ERR "cannot reserve PCI resources\n"); |
487 | goto err_pci_enable; | 547 | goto err_pci_enable; |
@@ -495,20 +555,34 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id, | |||
495 | } | 555 | } |
496 | chip->addr = pci_resource_start(pci, 0); | 556 | chip->addr = pci_resource_start(pci, 0); |
497 | 557 | ||
558 | pci_id = oxygen_search_pci_id(chip, ids); | ||
559 | if (!pci_id) { | ||
560 | err = -ENODEV; | ||
561 | goto err_pci_regions; | ||
562 | } | ||
563 | oxygen_restore_eeprom(chip, pci_id); | ||
564 | err = get_model(chip, pci_id); | ||
565 | if (err < 0) | ||
566 | goto err_pci_regions; | ||
567 | |||
568 | if (chip->model.model_data_size) { | ||
569 | chip->model_data = kzalloc(chip->model.model_data_size, | ||
570 | GFP_KERNEL); | ||
571 | if (!chip->model_data) { | ||
572 | err = -ENOMEM; | ||
573 | goto err_pci_regions; | ||
574 | } | ||
575 | } | ||
576 | |||
498 | pci_set_master(pci); | 577 | pci_set_master(pci); |
499 | snd_card_set_dev(card, &pci->dev); | 578 | snd_card_set_dev(card, &pci->dev); |
500 | card->private_free = oxygen_card_free; | 579 | card->private_free = oxygen_card_free; |
501 | 580 | ||
502 | if (chip->model.probe) { | ||
503 | err = chip->model.probe(chip, driver_data); | ||
504 | if (err < 0) | ||
505 | goto err_card; | ||
506 | } | ||
507 | oxygen_init(chip); | 581 | oxygen_init(chip); |
508 | chip->model.init(chip); | 582 | chip->model.init(chip); |
509 | 583 | ||
510 | err = request_irq(pci->irq, oxygen_interrupt, IRQF_SHARED, | 584 | err = request_irq(pci->irq, oxygen_interrupt, IRQF_SHARED, |
511 | chip->model.chip, chip); | 585 | DRIVER, chip); |
512 | if (err < 0) { | 586 | if (err < 0) { |
513 | snd_printk(KERN_ERR "cannot grab interrupt %d\n", pci->irq); | 587 | snd_printk(KERN_ERR "cannot grab interrupt %d\n", pci->irq); |
514 | goto err_card; | 588 | goto err_card; |
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c index 6c870c12a177..bc5ce11c8b14 100644 --- a/sound/pci/oxygen/virtuoso.c +++ b/sound/pci/oxygen/virtuoso.c | |||
@@ -112,6 +112,34 @@ | |||
112 | * CS4362A: AD0 <- 0 | 112 | * CS4362A: AD0 <- 0 |
113 | */ | 113 | */ |
114 | 114 | ||
115 | /* | ||
116 | * Xonar Essence STX | ||
117 | * ----------------- | ||
118 | * | ||
119 | * CMI8788: | ||
120 | * | ||
121 | * I²C <-> PCM1792A | ||
122 | * | ||
123 | * GPI 0 <- external power present | ||
124 | * | ||
125 | * GPIO 0 -> enable output to speakers | ||
126 | * GPIO 1 -> route HP to front panel (0) or rear jack (1) | ||
127 | * GPIO 2 -> M0 of CS5381 | ||
128 | * GPIO 3 -> M1 of CS5381 | ||
129 | * GPIO 7 -> route output to speaker jacks (0) or HP (1) | ||
130 | * GPIO 8 -> route input jack to line-in (0) or mic-in (1) | ||
131 | * | ||
132 | * PCM1792A: | ||
133 | * | ||
134 | * AD0 <- 0 | ||
135 | * | ||
136 | * H6 daughterboard | ||
137 | * ---------------- | ||
138 | * | ||
139 | * GPIO 4 <- 0 | ||
140 | * GPIO 5 <- 0 | ||
141 | */ | ||
142 | |||
115 | #include <linux/pci.h> | 143 | #include <linux/pci.h> |
116 | #include <linux/delay.h> | 144 | #include <linux/delay.h> |
117 | #include <linux/mutex.h> | 145 | #include <linux/mutex.h> |
@@ -152,6 +180,7 @@ enum { | |||
152 | MODEL_DX, | 180 | MODEL_DX, |
153 | MODEL_HDAV, /* without daughterboard */ | 181 | MODEL_HDAV, /* without daughterboard */ |
154 | MODEL_HDAV_H6, /* with H6 daughterboard */ | 182 | MODEL_HDAV_H6, /* with H6 daughterboard */ |
183 | MODEL_STX, | ||
155 | }; | 184 | }; |
156 | 185 | ||
157 | static struct pci_device_id xonar_ids[] __devinitdata = { | 186 | static struct pci_device_id xonar_ids[] __devinitdata = { |
@@ -160,6 +189,8 @@ static struct pci_device_id xonar_ids[] __devinitdata = { | |||
160 | { OXYGEN_PCI_SUBID(0x1043, 0x82b7), .driver_data = MODEL_D2X }, | 189 | { OXYGEN_PCI_SUBID(0x1043, 0x82b7), .driver_data = MODEL_D2X }, |
161 | { OXYGEN_PCI_SUBID(0x1043, 0x8314), .driver_data = MODEL_HDAV }, | 190 | { OXYGEN_PCI_SUBID(0x1043, 0x8314), .driver_data = MODEL_HDAV }, |
162 | { OXYGEN_PCI_SUBID(0x1043, 0x834f), .driver_data = MODEL_D1 }, | 191 | { OXYGEN_PCI_SUBID(0x1043, 0x834f), .driver_data = MODEL_D1 }, |
192 | { OXYGEN_PCI_SUBID(0x1043, 0x835c), .driver_data = MODEL_STX }, | ||
193 | { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, | ||
163 | { } | 194 | { } |
164 | }; | 195 | }; |
165 | MODULE_DEVICE_TABLE(pci, xonar_ids); | 196 | MODULE_DEVICE_TABLE(pci, xonar_ids); |
@@ -183,12 +214,14 @@ MODULE_DEVICE_TABLE(pci, xonar_ids); | |||
183 | #define GPIO_HDAV_DB_H6 0x0000 | 214 | #define GPIO_HDAV_DB_H6 0x0000 |
184 | #define GPIO_HDAV_DB_XX 0x0020 | 215 | #define GPIO_HDAV_DB_XX 0x0020 |
185 | 216 | ||
217 | #define GPIO_ST_HP_REAR 0x0002 | ||
218 | #define GPIO_ST_HP 0x0080 | ||
219 | |||
186 | #define I2C_DEVICE_PCM1796(i) (0x98 + ((i) << 1)) /* 10011, ADx=i, /W=0 */ | 220 | #define I2C_DEVICE_PCM1796(i) (0x98 + ((i) << 1)) /* 10011, ADx=i, /W=0 */ |
187 | #define I2C_DEVICE_CS4398 0x9e /* 10011, AD1=1, AD0=1, /W=0 */ | 221 | #define I2C_DEVICE_CS4398 0x9e /* 10011, AD1=1, AD0=1, /W=0 */ |
188 | #define I2C_DEVICE_CS4362A 0x30 /* 001100, AD0=0, /W=0 */ | 222 | #define I2C_DEVICE_CS4362A 0x30 /* 001100, AD0=0, /W=0 */ |
189 | 223 | ||
190 | struct xonar_data { | 224 | struct xonar_data { |
191 | unsigned int model; | ||
192 | unsigned int anti_pop_delay; | 225 | unsigned int anti_pop_delay; |
193 | unsigned int dacs; | 226 | unsigned int dacs; |
194 | u16 output_enable_bit; | 227 | u16 output_enable_bit; |
@@ -334,15 +367,9 @@ static void xonar_d2_init(struct oxygen *chip) | |||
334 | struct xonar_data *data = chip->model_data; | 367 | struct xonar_data *data = chip->model_data; |
335 | 368 | ||
336 | data->anti_pop_delay = 300; | 369 | data->anti_pop_delay = 300; |
370 | data->dacs = 4; | ||
337 | data->output_enable_bit = GPIO_D2_OUTPUT_ENABLE; | 371 | data->output_enable_bit = GPIO_D2_OUTPUT_ENABLE; |
338 | data->pcm1796_oversampling = PCM1796_OS_64; | 372 | data->pcm1796_oversampling = PCM1796_OS_64; |
339 | if (data->model == MODEL_D2X) { | ||
340 | data->ext_power_reg = OXYGEN_GPIO_DATA; | ||
341 | data->ext_power_int_reg = OXYGEN_GPIO_INTERRUPT_MASK; | ||
342 | data->ext_power_bit = GPIO_D2X_EXT_POWER; | ||
343 | oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, | ||
344 | GPIO_D2X_EXT_POWER); | ||
345 | } | ||
346 | 373 | ||
347 | pcm1796_init(chip); | 374 | pcm1796_init(chip); |
348 | 375 | ||
@@ -355,6 +382,18 @@ static void xonar_d2_init(struct oxygen *chip) | |||
355 | snd_component_add(chip->card, "CS5381"); | 382 | snd_component_add(chip->card, "CS5381"); |
356 | } | 383 | } |
357 | 384 | ||
385 | static void xonar_d2x_init(struct oxygen *chip) | ||
386 | { | ||
387 | struct xonar_data *data = chip->model_data; | ||
388 | |||
389 | data->ext_power_reg = OXYGEN_GPIO_DATA; | ||
390 | data->ext_power_int_reg = OXYGEN_GPIO_INTERRUPT_MASK; | ||
391 | data->ext_power_bit = GPIO_D2X_EXT_POWER; | ||
392 | oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, GPIO_D2X_EXT_POWER); | ||
393 | |||
394 | xonar_d2_init(chip); | ||
395 | } | ||
396 | |||
358 | static void update_cs4362a_volumes(struct oxygen *chip) | 397 | static void update_cs4362a_volumes(struct oxygen *chip) |
359 | { | 398 | { |
360 | u8 mute; | 399 | u8 mute; |
@@ -422,11 +461,6 @@ static void xonar_d1_init(struct oxygen *chip) | |||
422 | data->cs4398_fm = CS4398_FM_SINGLE | CS4398_DEM_NONE | CS4398_DIF_LJUST; | 461 | data->cs4398_fm = CS4398_FM_SINGLE | CS4398_DEM_NONE | CS4398_DIF_LJUST; |
423 | data->cs4362a_fm = CS4362A_FM_SINGLE | | 462 | data->cs4362a_fm = CS4362A_FM_SINGLE | |
424 | CS4362A_ATAPI_B_R | CS4362A_ATAPI_A_L; | 463 | CS4362A_ATAPI_B_R | CS4362A_ATAPI_A_L; |
425 | if (data->model == MODEL_DX) { | ||
426 | data->ext_power_reg = OXYGEN_GPI_DATA; | ||
427 | data->ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; | ||
428 | data->ext_power_bit = GPI_DX_EXT_POWER; | ||
429 | } | ||
430 | 464 | ||
431 | oxygen_write16(chip, OXYGEN_2WIRE_BUS_STATUS, | 465 | oxygen_write16(chip, OXYGEN_2WIRE_BUS_STATUS, |
432 | OXYGEN_2WIRE_LENGTH_8 | | 466 | OXYGEN_2WIRE_LENGTH_8 | |
@@ -447,6 +481,17 @@ static void xonar_d1_init(struct oxygen *chip) | |||
447 | snd_component_add(chip->card, "CS5361"); | 481 | snd_component_add(chip->card, "CS5361"); |
448 | } | 482 | } |
449 | 483 | ||
484 | static void xonar_dx_init(struct oxygen *chip) | ||
485 | { | ||
486 | struct xonar_data *data = chip->model_data; | ||
487 | |||
488 | data->ext_power_reg = OXYGEN_GPI_DATA; | ||
489 | data->ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; | ||
490 | data->ext_power_bit = GPI_DX_EXT_POWER; | ||
491 | |||
492 | xonar_d1_init(chip); | ||
493 | } | ||
494 | |||
450 | static void xonar_hdav_init(struct oxygen *chip) | 495 | static void xonar_hdav_init(struct oxygen *chip) |
451 | { | 496 | { |
452 | struct xonar_data *data = chip->model_data; | 497 | struct xonar_data *data = chip->model_data; |
@@ -458,6 +503,7 @@ static void xonar_hdav_init(struct oxygen *chip) | |||
458 | OXYGEN_2WIRE_SPEED_FAST); | 503 | OXYGEN_2WIRE_SPEED_FAST); |
459 | 504 | ||
460 | data->anti_pop_delay = 100; | 505 | data->anti_pop_delay = 100; |
506 | data->dacs = chip->model.private_data == MODEL_HDAV_H6 ? 4 : 1; | ||
461 | data->output_enable_bit = GPIO_DX_OUTPUT_ENABLE; | 507 | data->output_enable_bit = GPIO_DX_OUTPUT_ENABLE; |
462 | data->ext_power_reg = OXYGEN_GPI_DATA; | 508 | data->ext_power_reg = OXYGEN_GPI_DATA; |
463 | data->ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; | 509 | data->ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; |
@@ -484,6 +530,36 @@ static void xonar_hdav_init(struct oxygen *chip) | |||
484 | snd_component_add(chip->card, "CS5381"); | 530 | snd_component_add(chip->card, "CS5381"); |
485 | } | 531 | } |
486 | 532 | ||
533 | static void xonar_stx_init(struct oxygen *chip) | ||
534 | { | ||
535 | struct xonar_data *data = chip->model_data; | ||
536 | |||
537 | oxygen_write16(chip, OXYGEN_2WIRE_BUS_STATUS, | ||
538 | OXYGEN_2WIRE_LENGTH_8 | | ||
539 | OXYGEN_2WIRE_INTERRUPT_MASK | | ||
540 | OXYGEN_2WIRE_SPEED_FAST); | ||
541 | |||
542 | data->anti_pop_delay = 100; | ||
543 | data->dacs = 1; | ||
544 | data->output_enable_bit = GPIO_DX_OUTPUT_ENABLE; | ||
545 | data->ext_power_reg = OXYGEN_GPI_DATA; | ||
546 | data->ext_power_int_reg = OXYGEN_GPI_INTERRUPT_MASK; | ||
547 | data->ext_power_bit = GPI_DX_EXT_POWER; | ||
548 | data->pcm1796_oversampling = PCM1796_OS_64; | ||
549 | |||
550 | pcm1796_init(chip); | ||
551 | |||
552 | oxygen_set_bits16(chip, OXYGEN_GPIO_CONTROL, | ||
553 | GPIO_DX_INPUT_ROUTE | GPIO_ST_HP_REAR | GPIO_ST_HP); | ||
554 | oxygen_clear_bits16(chip, OXYGEN_GPIO_DATA, | ||
555 | GPIO_DX_INPUT_ROUTE | GPIO_ST_HP_REAR | GPIO_ST_HP); | ||
556 | |||
557 | xonar_common_init(chip); | ||
558 | |||
559 | snd_component_add(chip->card, "PCM1792A"); | ||
560 | snd_component_add(chip->card, "CS5381"); | ||
561 | } | ||
562 | |||
487 | static void xonar_disable_output(struct oxygen *chip) | 563 | static void xonar_disable_output(struct oxygen *chip) |
488 | { | 564 | { |
489 | struct xonar_data *data = chip->model_data; | 565 | struct xonar_data *data = chip->model_data; |
@@ -511,6 +587,11 @@ static void xonar_hdav_cleanup(struct oxygen *chip) | |||
511 | xonar_disable_output(chip); | 587 | xonar_disable_output(chip); |
512 | } | 588 | } |
513 | 589 | ||
590 | static void xonar_st_cleanup(struct oxygen *chip) | ||
591 | { | ||
592 | xonar_disable_output(chip); | ||
593 | } | ||
594 | |||
514 | static void xonar_d2_suspend(struct oxygen *chip) | 595 | static void xonar_d2_suspend(struct oxygen *chip) |
515 | { | 596 | { |
516 | xonar_d2_cleanup(chip); | 597 | xonar_d2_cleanup(chip); |
@@ -527,6 +608,11 @@ static void xonar_hdav_suspend(struct oxygen *chip) | |||
527 | msleep(2); | 608 | msleep(2); |
528 | } | 609 | } |
529 | 610 | ||
611 | static void xonar_st_suspend(struct oxygen *chip) | ||
612 | { | ||
613 | xonar_st_cleanup(chip); | ||
614 | } | ||
615 | |||
530 | static void xonar_d2_resume(struct oxygen *chip) | 616 | static void xonar_d2_resume(struct oxygen *chip) |
531 | { | 617 | { |
532 | pcm1796_init(chip); | 618 | pcm1796_init(chip); |
@@ -554,6 +640,12 @@ static void xonar_hdav_resume(struct oxygen *chip) | |||
554 | xonar_enable_output(chip); | 640 | xonar_enable_output(chip); |
555 | } | 641 | } |
556 | 642 | ||
643 | static void xonar_st_resume(struct oxygen *chip) | ||
644 | { | ||
645 | pcm1796_init(chip); | ||
646 | xonar_enable_output(chip); | ||
647 | } | ||
648 | |||
557 | static void xonar_hdav_pcm_hardware_filter(unsigned int channel, | 649 | static void xonar_hdav_pcm_hardware_filter(unsigned int channel, |
558 | struct snd_pcm_hardware *hardware) | 650 | struct snd_pcm_hardware *hardware) |
559 | { | 651 | { |
@@ -733,6 +825,72 @@ static const struct snd_kcontrol_new front_panel_switch = { | |||
733 | .private_value = GPIO_DX_FRONT_PANEL, | 825 | .private_value = GPIO_DX_FRONT_PANEL, |
734 | }; | 826 | }; |
735 | 827 | ||
828 | static int st_output_switch_info(struct snd_kcontrol *ctl, | ||
829 | struct snd_ctl_elem_info *info) | ||
830 | { | ||
831 | static const char *const names[3] = { | ||
832 | "Speakers", "Headphones", "FP Headphones" | ||
833 | }; | ||
834 | |||
835 | info->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
836 | info->count = 1; | ||
837 | info->value.enumerated.items = 3; | ||
838 | if (info->value.enumerated.item >= 3) | ||
839 | info->value.enumerated.item = 2; | ||
840 | strcpy(info->value.enumerated.name, names[info->value.enumerated.item]); | ||
841 | return 0; | ||
842 | } | ||
843 | |||
844 | static int st_output_switch_get(struct snd_kcontrol *ctl, | ||
845 | struct snd_ctl_elem_value *value) | ||
846 | { | ||
847 | struct oxygen *chip = ctl->private_data; | ||
848 | u16 gpio; | ||
849 | |||
850 | gpio = oxygen_read16(chip, OXYGEN_GPIO_DATA); | ||
851 | if (!(gpio & GPIO_ST_HP)) | ||
852 | value->value.enumerated.item[0] = 0; | ||
853 | else if (gpio & GPIO_ST_HP_REAR) | ||
854 | value->value.enumerated.item[0] = 1; | ||
855 | else | ||
856 | value->value.enumerated.item[0] = 2; | ||
857 | return 0; | ||
858 | } | ||
859 | |||
860 | |||
861 | static int st_output_switch_put(struct snd_kcontrol *ctl, | ||
862 | struct snd_ctl_elem_value *value) | ||
863 | { | ||
864 | struct oxygen *chip = ctl->private_data; | ||
865 | u16 gpio_old, gpio; | ||
866 | |||
867 | mutex_lock(&chip->mutex); | ||
868 | gpio_old = oxygen_read16(chip, OXYGEN_GPIO_DATA); | ||
869 | gpio = gpio_old; | ||
870 | switch (value->value.enumerated.item[0]) { | ||
871 | case 0: | ||
872 | gpio &= ~(GPIO_ST_HP | GPIO_ST_HP_REAR); | ||
873 | break; | ||
874 | case 1: | ||
875 | gpio |= GPIO_ST_HP | GPIO_ST_HP_REAR; | ||
876 | break; | ||
877 | case 2: | ||
878 | gpio = (gpio | GPIO_ST_HP) & ~GPIO_ST_HP_REAR; | ||
879 | break; | ||
880 | } | ||
881 | oxygen_write16(chip, OXYGEN_GPIO_DATA, gpio); | ||
882 | mutex_unlock(&chip->mutex); | ||
883 | return gpio != gpio_old; | ||
884 | } | ||
885 | |||
886 | static const struct snd_kcontrol_new st_output_switch = { | ||
887 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
888 | .name = "Analog Output", | ||
889 | .info = st_output_switch_info, | ||
890 | .get = st_output_switch_get, | ||
891 | .put = st_output_switch_put, | ||
892 | }; | ||
893 | |||
736 | static void xonar_line_mic_ac97_switch(struct oxygen *chip, | 894 | static void xonar_line_mic_ac97_switch(struct oxygen *chip, |
737 | unsigned int reg, unsigned int mute) | 895 | unsigned int reg, unsigned int mute) |
738 | { | 896 | { |
@@ -745,8 +903,8 @@ static void xonar_line_mic_ac97_switch(struct oxygen *chip, | |||
745 | } | 903 | } |
746 | } | 904 | } |
747 | 905 | ||
748 | static const DECLARE_TLV_DB_SCALE(pcm1796_db_scale, -12000, 50, 0); | 906 | static const DECLARE_TLV_DB_SCALE(pcm1796_db_scale, -6000, 50, 0); |
749 | static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -12700, 100, 0); | 907 | static const DECLARE_TLV_DB_SCALE(cs4362a_db_scale, -6000, 100, 0); |
750 | 908 | ||
751 | static int xonar_d2_control_filter(struct snd_kcontrol_new *template) | 909 | static int xonar_d2_control_filter(struct snd_kcontrol_new *template) |
752 | { | 910 | { |
@@ -763,6 +921,15 @@ static int xonar_d1_control_filter(struct snd_kcontrol_new *template) | |||
763 | return 0; | 921 | return 0; |
764 | } | 922 | } |
765 | 923 | ||
924 | static int xonar_st_control_filter(struct snd_kcontrol_new *template) | ||
925 | { | ||
926 | if (!strncmp(template->name, "CD Capture ", 11)) | ||
927 | return 1; /* no CD input */ | ||
928 | if (!strcmp(template->name, "Stereo Upmixing")) | ||
929 | return 1; /* stereo only - we don't need upmixing */ | ||
930 | return 0; | ||
931 | } | ||
932 | |||
766 | static int xonar_d2_mixer_init(struct oxygen *chip) | 933 | static int xonar_d2_mixer_init(struct oxygen *chip) |
767 | { | 934 | { |
768 | return snd_ctl_add(chip->card, snd_ctl_new1(&alt_switch, chip)); | 935 | return snd_ctl_add(chip->card, snd_ctl_new1(&alt_switch, chip)); |
@@ -773,51 +940,14 @@ static int xonar_d1_mixer_init(struct oxygen *chip) | |||
773 | return snd_ctl_add(chip->card, snd_ctl_new1(&front_panel_switch, chip)); | 940 | return snd_ctl_add(chip->card, snd_ctl_new1(&front_panel_switch, chip)); |
774 | } | 941 | } |
775 | 942 | ||
776 | static int xonar_model_probe(struct oxygen *chip, unsigned long driver_data) | 943 | static int xonar_st_mixer_init(struct oxygen *chip) |
777 | { | 944 | { |
778 | static const char *const names[] = { | 945 | return snd_ctl_add(chip->card, snd_ctl_new1(&st_output_switch, chip)); |
779 | [MODEL_D1] = "Xonar D1", | ||
780 | [MODEL_DX] = "Xonar DX", | ||
781 | [MODEL_D2] = "Xonar D2", | ||
782 | [MODEL_D2X] = "Xonar D2X", | ||
783 | [MODEL_HDAV] = "Xonar HDAV1.3", | ||
784 | [MODEL_HDAV_H6] = "Xonar HDAV1.3+H6", | ||
785 | }; | ||
786 | static const u8 dacs[] = { | ||
787 | [MODEL_D1] = 2, | ||
788 | [MODEL_DX] = 2, | ||
789 | [MODEL_D2] = 4, | ||
790 | [MODEL_D2X] = 4, | ||
791 | [MODEL_HDAV] = 1, | ||
792 | [MODEL_HDAV_H6] = 4, | ||
793 | }; | ||
794 | struct xonar_data *data = chip->model_data; | ||
795 | |||
796 | data->model = driver_data; | ||
797 | if (data->model == MODEL_HDAV) { | ||
798 | oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, | ||
799 | GPIO_HDAV_DB_MASK); | ||
800 | switch (oxygen_read16(chip, OXYGEN_GPIO_DATA) & | ||
801 | GPIO_HDAV_DB_MASK) { | ||
802 | case GPIO_HDAV_DB_H6: | ||
803 | data->model = MODEL_HDAV_H6; | ||
804 | break; | ||
805 | case GPIO_HDAV_DB_XX: | ||
806 | snd_printk(KERN_ERR "unknown daughterboard\n"); | ||
807 | return -ENODEV; | ||
808 | } | ||
809 | } | ||
810 | |||
811 | data->dacs = dacs[data->model]; | ||
812 | chip->model.shortname = names[data->model]; | ||
813 | return 0; | ||
814 | } | 946 | } |
815 | 947 | ||
816 | static const struct oxygen_model model_xonar_d2 = { | 948 | static const struct oxygen_model model_xonar_d2 = { |
817 | .longname = "Asus Virtuoso 200", | 949 | .longname = "Asus Virtuoso 200", |
818 | .chip = "AV200", | 950 | .chip = "AV200", |
819 | .owner = THIS_MODULE, | ||
820 | .probe = xonar_model_probe, | ||
821 | .init = xonar_d2_init, | 951 | .init = xonar_d2_init, |
822 | .control_filter = xonar_d2_control_filter, | 952 | .control_filter = xonar_d2_control_filter, |
823 | .mixer_init = xonar_d2_mixer_init, | 953 | .mixer_init = xonar_d2_mixer_init, |
@@ -837,8 +967,8 @@ static const struct oxygen_model model_xonar_d2 = { | |||
837 | MIDI_OUTPUT | | 967 | MIDI_OUTPUT | |
838 | MIDI_INPUT, | 968 | MIDI_INPUT, |
839 | .dac_channels = 8, | 969 | .dac_channels = 8, |
840 | .dac_volume_min = 0x0f, | 970 | .dac_volume_min = 255 - 2*60, |
841 | .dac_volume_max = 0xff, | 971 | .dac_volume_max = 255, |
842 | .misc_flags = OXYGEN_MISC_MIDI, | 972 | .misc_flags = OXYGEN_MISC_MIDI, |
843 | .function_flags = OXYGEN_FUNCTION_SPI | | 973 | .function_flags = OXYGEN_FUNCTION_SPI | |
844 | OXYGEN_FUNCTION_ENABLE_SPI_4_5, | 974 | OXYGEN_FUNCTION_ENABLE_SPI_4_5, |
@@ -849,8 +979,6 @@ static const struct oxygen_model model_xonar_d2 = { | |||
849 | static const struct oxygen_model model_xonar_d1 = { | 979 | static const struct oxygen_model model_xonar_d1 = { |
850 | .longname = "Asus Virtuoso 100", | 980 | .longname = "Asus Virtuoso 100", |
851 | .chip = "AV200", | 981 | .chip = "AV200", |
852 | .owner = THIS_MODULE, | ||
853 | .probe = xonar_model_probe, | ||
854 | .init = xonar_d1_init, | 982 | .init = xonar_d1_init, |
855 | .control_filter = xonar_d1_control_filter, | 983 | .control_filter = xonar_d1_control_filter, |
856 | .mixer_init = xonar_d1_mixer_init, | 984 | .mixer_init = xonar_d1_mixer_init, |
@@ -868,7 +996,7 @@ static const struct oxygen_model model_xonar_d1 = { | |||
868 | PLAYBACK_1_TO_SPDIF | | 996 | PLAYBACK_1_TO_SPDIF | |
869 | CAPTURE_0_FROM_I2S_2, | 997 | CAPTURE_0_FROM_I2S_2, |
870 | .dac_channels = 8, | 998 | .dac_channels = 8, |
871 | .dac_volume_min = 0, | 999 | .dac_volume_min = 127 - 60, |
872 | .dac_volume_max = 127, | 1000 | .dac_volume_max = 127, |
873 | .function_flags = OXYGEN_FUNCTION_2WIRE, | 1001 | .function_flags = OXYGEN_FUNCTION_2WIRE, |
874 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | 1002 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, |
@@ -878,8 +1006,6 @@ static const struct oxygen_model model_xonar_d1 = { | |||
878 | static const struct oxygen_model model_xonar_hdav = { | 1006 | static const struct oxygen_model model_xonar_hdav = { |
879 | .longname = "Asus Virtuoso 200", | 1007 | .longname = "Asus Virtuoso 200", |
880 | .chip = "AV200", | 1008 | .chip = "AV200", |
881 | .owner = THIS_MODULE, | ||
882 | .probe = xonar_model_probe, | ||
883 | .init = xonar_hdav_init, | 1009 | .init = xonar_hdav_init, |
884 | .cleanup = xonar_hdav_cleanup, | 1010 | .cleanup = xonar_hdav_cleanup, |
885 | .suspend = xonar_hdav_suspend, | 1011 | .suspend = xonar_hdav_suspend, |
@@ -897,16 +1023,43 @@ static const struct oxygen_model model_xonar_hdav = { | |||
897 | PLAYBACK_1_TO_SPDIF | | 1023 | PLAYBACK_1_TO_SPDIF | |
898 | CAPTURE_0_FROM_I2S_2, | 1024 | CAPTURE_0_FROM_I2S_2, |
899 | .dac_channels = 8, | 1025 | .dac_channels = 8, |
900 | .dac_volume_min = 0x0f, | 1026 | .dac_volume_min = 255 - 2*60, |
901 | .dac_volume_max = 0xff, | 1027 | .dac_volume_max = 255, |
902 | .misc_flags = OXYGEN_MISC_MIDI, | 1028 | .misc_flags = OXYGEN_MISC_MIDI, |
903 | .function_flags = OXYGEN_FUNCTION_2WIRE, | 1029 | .function_flags = OXYGEN_FUNCTION_2WIRE, |
904 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | 1030 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, |
905 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | 1031 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, |
906 | }; | 1032 | }; |
907 | 1033 | ||
908 | static int __devinit xonar_probe(struct pci_dev *pci, | 1034 | static const struct oxygen_model model_xonar_st = { |
909 | const struct pci_device_id *pci_id) | 1035 | .longname = "Asus Virtuoso 100", |
1036 | .chip = "AV200", | ||
1037 | .init = xonar_stx_init, | ||
1038 | .control_filter = xonar_st_control_filter, | ||
1039 | .mixer_init = xonar_st_mixer_init, | ||
1040 | .cleanup = xonar_st_cleanup, | ||
1041 | .suspend = xonar_st_suspend, | ||
1042 | .resume = xonar_st_resume, | ||
1043 | .set_dac_params = set_pcm1796_params, | ||
1044 | .set_adc_params = set_cs53x1_params, | ||
1045 | .update_dac_volume = update_pcm1796_volume, | ||
1046 | .update_dac_mute = update_pcm1796_mute, | ||
1047 | .ac97_switch = xonar_line_mic_ac97_switch, | ||
1048 | .dac_tlv = pcm1796_db_scale, | ||
1049 | .model_data_size = sizeof(struct xonar_data), | ||
1050 | .device_config = PLAYBACK_0_TO_I2S | | ||
1051 | PLAYBACK_1_TO_SPDIF | | ||
1052 | CAPTURE_0_FROM_I2S_2, | ||
1053 | .dac_channels = 2, | ||
1054 | .dac_volume_min = 255 - 2*60, | ||
1055 | .dac_volume_max = 255, | ||
1056 | .function_flags = OXYGEN_FUNCTION_2WIRE, | ||
1057 | .dac_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | ||
1058 | .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, | ||
1059 | }; | ||
1060 | |||
1061 | static int __devinit get_xonar_model(struct oxygen *chip, | ||
1062 | const struct pci_device_id *id) | ||
910 | { | 1063 | { |
911 | static const struct oxygen_model *const models[] = { | 1064 | static const struct oxygen_model *const models[] = { |
912 | [MODEL_D1] = &model_xonar_d1, | 1065 | [MODEL_D1] = &model_xonar_d1, |
@@ -914,7 +1067,57 @@ static int __devinit xonar_probe(struct pci_dev *pci, | |||
914 | [MODEL_D2] = &model_xonar_d2, | 1067 | [MODEL_D2] = &model_xonar_d2, |
915 | [MODEL_D2X] = &model_xonar_d2, | 1068 | [MODEL_D2X] = &model_xonar_d2, |
916 | [MODEL_HDAV] = &model_xonar_hdav, | 1069 | [MODEL_HDAV] = &model_xonar_hdav, |
1070 | [MODEL_STX] = &model_xonar_st, | ||
917 | }; | 1071 | }; |
1072 | static const char *const names[] = { | ||
1073 | [MODEL_D1] = "Xonar D1", | ||
1074 | [MODEL_DX] = "Xonar DX", | ||
1075 | [MODEL_D2] = "Xonar D2", | ||
1076 | [MODEL_D2X] = "Xonar D2X", | ||
1077 | [MODEL_HDAV] = "Xonar HDAV1.3", | ||
1078 | [MODEL_HDAV_H6] = "Xonar HDAV1.3+H6", | ||
1079 | [MODEL_STX] = "Xonar Essence STX", | ||
1080 | }; | ||
1081 | unsigned int model = id->driver_data; | ||
1082 | |||
1083 | if (model >= ARRAY_SIZE(models) || !models[model]) | ||
1084 | return -EINVAL; | ||
1085 | chip->model = *models[model]; | ||
1086 | |||
1087 | switch (model) { | ||
1088 | case MODEL_D2X: | ||
1089 | chip->model.init = xonar_d2x_init; | ||
1090 | break; | ||
1091 | case MODEL_DX: | ||
1092 | chip->model.init = xonar_dx_init; | ||
1093 | break; | ||
1094 | case MODEL_HDAV: | ||
1095 | oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, | ||
1096 | GPIO_HDAV_DB_MASK); | ||
1097 | switch (oxygen_read16(chip, OXYGEN_GPIO_DATA) & | ||
1098 | GPIO_HDAV_DB_MASK) { | ||
1099 | case GPIO_HDAV_DB_H6: | ||
1100 | model = MODEL_HDAV_H6; | ||
1101 | break; | ||
1102 | case GPIO_HDAV_DB_XX: | ||
1103 | snd_printk(KERN_ERR "unknown daughterboard\n"); | ||
1104 | return -ENODEV; | ||
1105 | } | ||
1106 | break; | ||
1107 | case MODEL_STX: | ||
1108 | oxygen_clear_bits16(chip, OXYGEN_GPIO_CONTROL, | ||
1109 | GPIO_HDAV_DB_MASK); | ||
1110 | break; | ||
1111 | } | ||
1112 | |||
1113 | chip->model.shortname = names[model]; | ||
1114 | chip->model.private_data = model; | ||
1115 | return 0; | ||
1116 | } | ||
1117 | |||
1118 | static int __devinit xonar_probe(struct pci_dev *pci, | ||
1119 | const struct pci_device_id *pci_id) | ||
1120 | { | ||
918 | static int dev; | 1121 | static int dev; |
919 | int err; | 1122 | int err; |
920 | 1123 | ||
@@ -924,10 +1127,8 @@ static int __devinit xonar_probe(struct pci_dev *pci, | |||
924 | ++dev; | 1127 | ++dev; |
925 | return -ENOENT; | 1128 | return -ENOENT; |
926 | } | 1129 | } |
927 | BUG_ON(pci_id->driver_data >= ARRAY_SIZE(models)); | 1130 | err = oxygen_pci_probe(pci, index[dev], id[dev], THIS_MODULE, |
928 | err = oxygen_pci_probe(pci, index[dev], id[dev], | 1131 | xonar_ids, get_xonar_model); |
929 | models[pci_id->driver_data], | ||
930 | pci_id->driver_data); | ||
931 | if (err >= 0) | 1132 | if (err >= 0) |
932 | ++dev; | 1133 | ++dev; |
933 | return err; | 1134 | return err; |
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index 27cf2c28d113..80e064a3efff 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c | |||
@@ -1334,6 +1334,40 @@ static void pcxhr_proc_sync(struct snd_info_entry *entry, | |||
1334 | snd_iprintf(buffer, "\n"); | 1334 | snd_iprintf(buffer, "\n"); |
1335 | } | 1335 | } |
1336 | 1336 | ||
1337 | static void pcxhr_proc_gpio_read(struct snd_info_entry *entry, | ||
1338 | struct snd_info_buffer *buffer) | ||
1339 | { | ||
1340 | struct snd_pcxhr *chip = entry->private_data; | ||
1341 | struct pcxhr_mgr *mgr = chip->mgr; | ||
1342 | /* commands available when embedded DSP is running */ | ||
1343 | if (mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX)) { | ||
1344 | /* gpio ports on stereo boards only available */ | ||
1345 | int value = 0; | ||
1346 | hr222_read_gpio(mgr, 1, &value); /* GPI */ | ||
1347 | snd_iprintf(buffer, "GPI: 0x%x\n", value); | ||
1348 | hr222_read_gpio(mgr, 0, &value); /* GP0 */ | ||
1349 | snd_iprintf(buffer, "GPO: 0x%x\n", value); | ||
1350 | } else | ||
1351 | snd_iprintf(buffer, "no firmware loaded\n"); | ||
1352 | snd_iprintf(buffer, "\n"); | ||
1353 | } | ||
1354 | static void pcxhr_proc_gpo_write(struct snd_info_entry *entry, | ||
1355 | struct snd_info_buffer *buffer) | ||
1356 | { | ||
1357 | struct snd_pcxhr *chip = entry->private_data; | ||
1358 | struct pcxhr_mgr *mgr = chip->mgr; | ||
1359 | char line[64]; | ||
1360 | int value; | ||
1361 | /* commands available when embedded DSP is running */ | ||
1362 | if (!(mgr->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX))) | ||
1363 | return; | ||
1364 | while (!snd_info_get_line(buffer, line, sizeof(line))) { | ||
1365 | if (sscanf(line, "GPO: 0x%x", &value) != 1) | ||
1366 | continue; | ||
1367 | hr222_write_gpo(mgr, value); /* GP0 */ | ||
1368 | } | ||
1369 | } | ||
1370 | |||
1337 | static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip) | 1371 | static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip) |
1338 | { | 1372 | { |
1339 | struct snd_info_entry *entry; | 1373 | struct snd_info_entry *entry; |
@@ -1342,6 +1376,13 @@ static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip) | |||
1342 | snd_info_set_text_ops(entry, chip, pcxhr_proc_info); | 1376 | snd_info_set_text_ops(entry, chip, pcxhr_proc_info); |
1343 | if (! snd_card_proc_new(chip->card, "sync", &entry)) | 1377 | if (! snd_card_proc_new(chip->card, "sync", &entry)) |
1344 | snd_info_set_text_ops(entry, chip, pcxhr_proc_sync); | 1378 | snd_info_set_text_ops(entry, chip, pcxhr_proc_sync); |
1379 | /* gpio available on stereo sound cards only */ | ||
1380 | if (chip->mgr->is_hr_stereo && | ||
1381 | !snd_card_proc_new(chip->card, "gpio", &entry)) { | ||
1382 | snd_info_set_text_ops(entry, chip, pcxhr_proc_gpio_read); | ||
1383 | entry->c.text.write = pcxhr_proc_gpo_write; | ||
1384 | entry->mode |= S_IWUSR; | ||
1385 | } | ||
1345 | } | 1386 | } |
1346 | /* end of proc interface */ | 1387 | /* end of proc interface */ |
1347 | 1388 | ||
@@ -1510,12 +1551,12 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, | |||
1510 | 1551 | ||
1511 | snprintf(tmpid, sizeof(tmpid), "%s-%d", | 1552 | snprintf(tmpid, sizeof(tmpid), "%s-%d", |
1512 | id[dev] ? id[dev] : card_name, i); | 1553 | id[dev] ? id[dev] : card_name, i); |
1513 | card = snd_card_new(idx, tmpid, THIS_MODULE, 0); | 1554 | err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card); |
1514 | 1555 | ||
1515 | if (! card) { | 1556 | if (err < 0) { |
1516 | snd_printk(KERN_ERR "cannot allocate the card %d\n", i); | 1557 | snd_printk(KERN_ERR "cannot allocate the card %d\n", i); |
1517 | pcxhr_free(mgr); | 1558 | pcxhr_free(mgr); |
1518 | return -ENOMEM; | 1559 | return err; |
1519 | } | 1560 | } |
1520 | 1561 | ||
1521 | strcpy(card->driver, DRIVER_NAME); | 1562 | strcpy(card->driver, DRIVER_NAME); |
diff --git a/sound/pci/pcxhr/pcxhr.h b/sound/pci/pcxhr/pcxhr.h index 69d87dee6995..bda776c49884 100644 --- a/sound/pci/pcxhr/pcxhr.h +++ b/sound/pci/pcxhr/pcxhr.h | |||
@@ -27,8 +27,8 @@ | |||
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <sound/pcm.h> | 28 | #include <sound/pcm.h> |
29 | 29 | ||
30 | #define PCXHR_DRIVER_VERSION 0x000905 /* 0.9.5 */ | 30 | #define PCXHR_DRIVER_VERSION 0x000906 /* 0.9.6 */ |
31 | #define PCXHR_DRIVER_VERSION_STRING "0.9.5" /* 0.9.5 */ | 31 | #define PCXHR_DRIVER_VERSION_STRING "0.9.6" /* 0.9.6 */ |
32 | 32 | ||
33 | 33 | ||
34 | #define PCXHR_MAX_CARDS 6 | 34 | #define PCXHR_MAX_CARDS 6 |
@@ -124,6 +124,7 @@ struct pcxhr_mgr { | |||
124 | 124 | ||
125 | unsigned char xlx_cfg; /* copy of PCXHR_XLX_CFG register */ | 125 | unsigned char xlx_cfg; /* copy of PCXHR_XLX_CFG register */ |
126 | unsigned char xlx_selmic; /* copy of PCXHR_XLX_SELMIC register */ | 126 | unsigned char xlx_selmic; /* copy of PCXHR_XLX_SELMIC register */ |
127 | unsigned char dsp_reset; /* copy of PCXHR_DSP_RESET register */ | ||
127 | }; | 128 | }; |
128 | 129 | ||
129 | 130 | ||
diff --git a/sound/pci/pcxhr/pcxhr_core.h b/sound/pci/pcxhr/pcxhr_core.h index bbbd66d13a64..be0173796cdb 100644 --- a/sound/pci/pcxhr/pcxhr_core.h +++ b/sound/pci/pcxhr/pcxhr_core.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * Driver for Digigram pcxhr compatible soundcards | 2 | * Driver for Digigram pcxhr compatible soundcards |
3 | * | 3 | * |
4 | * low level interface with interrupt ans message handling | 4 | * low level interface with interrupt and message handling |
5 | * | 5 | * |
6 | * Copyright (c) 2004 by Digigram <alsa@digigram.com> | 6 | * Copyright (c) 2004 by Digigram <alsa@digigram.com> |
7 | * | 7 | * |
diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c index 592743a298b0..17cb1233a903 100644 --- a/sound/pci/pcxhr/pcxhr_hwdep.c +++ b/sound/pci/pcxhr/pcxhr_hwdep.c | |||
@@ -471,16 +471,6 @@ static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw, | |||
471 | return 0; | 471 | return 0; |
472 | } | 472 | } |
473 | 473 | ||
474 | static int pcxhr_hwdep_open(struct snd_hwdep *hw, struct file *file) | ||
475 | { | ||
476 | return 0; | ||
477 | } | ||
478 | |||
479 | static int pcxhr_hwdep_release(struct snd_hwdep *hw, struct file *file) | ||
480 | { | ||
481 | return 0; | ||
482 | } | ||
483 | |||
484 | int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) | 474 | int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) |
485 | { | 475 | { |
486 | int err; | 476 | int err; |
@@ -495,8 +485,6 @@ int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) | |||
495 | 485 | ||
496 | hw->iface = SNDRV_HWDEP_IFACE_PCXHR; | 486 | hw->iface = SNDRV_HWDEP_IFACE_PCXHR; |
497 | hw->private_data = mgr; | 487 | hw->private_data = mgr; |
498 | hw->ops.open = pcxhr_hwdep_open; | ||
499 | hw->ops.release = pcxhr_hwdep_release; | ||
500 | hw->ops.dsp_status = pcxhr_hwdep_dsp_status; | 488 | hw->ops.dsp_status = pcxhr_hwdep_dsp_status; |
501 | hw->ops.dsp_load = pcxhr_hwdep_dsp_load; | 489 | hw->ops.dsp_load = pcxhr_hwdep_dsp_load; |
502 | hw->exclusive = 1; | 490 | hw->exclusive = 1; |
diff --git a/sound/pci/pcxhr/pcxhr_mix22.c b/sound/pci/pcxhr/pcxhr_mix22.c index ff019126b672..1cb82c0a9cb3 100644 --- a/sound/pci/pcxhr/pcxhr_mix22.c +++ b/sound/pci/pcxhr/pcxhr_mix22.c | |||
@@ -53,6 +53,8 @@ | |||
53 | #define PCXHR_DSP_RESET_DSP 0x01 | 53 | #define PCXHR_DSP_RESET_DSP 0x01 |
54 | #define PCXHR_DSP_RESET_MUTE 0x02 | 54 | #define PCXHR_DSP_RESET_MUTE 0x02 |
55 | #define PCXHR_DSP_RESET_CODEC 0x08 | 55 | #define PCXHR_DSP_RESET_CODEC 0x08 |
56 | #define PCXHR_DSP_RESET_GPO_OFFSET 5 | ||
57 | #define PCXHR_DSP_RESET_GPO_MASK 0x60 | ||
56 | 58 | ||
57 | /* values for PCHR_XLX_CFG register */ | 59 | /* values for PCHR_XLX_CFG register */ |
58 | #define PCXHR_CFG_SYNCDSP_MASK 0x80 | 60 | #define PCXHR_CFG_SYNCDSP_MASK 0x80 |
@@ -81,6 +83,8 @@ | |||
81 | /* values for PCHR_XLX_STATUS register - READ */ | 83 | /* values for PCHR_XLX_STATUS register - READ */ |
82 | #define PCXHR_STAT_SRC_LOCK 0x01 | 84 | #define PCXHR_STAT_SRC_LOCK 0x01 |
83 | #define PCXHR_STAT_LEVEL_IN 0x02 | 85 | #define PCXHR_STAT_LEVEL_IN 0x02 |
86 | #define PCXHR_STAT_GPI_OFFSET 2 | ||
87 | #define PCXHR_STAT_GPI_MASK 0x0C | ||
84 | #define PCXHR_STAT_MIC_CAPS 0x10 | 88 | #define PCXHR_STAT_MIC_CAPS 0x10 |
85 | /* values for PCHR_XLX_STATUS register - WRITE */ | 89 | /* values for PCHR_XLX_STATUS register - WRITE */ |
86 | #define PCXHR_STAT_FREQ_SYNC_MASK 0x01 | 90 | #define PCXHR_STAT_FREQ_SYNC_MASK 0x01 |
@@ -291,10 +295,11 @@ int hr222_sub_init(struct pcxhr_mgr *mgr) | |||
291 | PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, | 295 | PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, |
292 | PCXHR_DSP_RESET_DSP); | 296 | PCXHR_DSP_RESET_DSP); |
293 | msleep(5); | 297 | msleep(5); |
294 | PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, | 298 | mgr->dsp_reset = PCXHR_DSP_RESET_DSP | |
295 | PCXHR_DSP_RESET_DSP | | 299 | PCXHR_DSP_RESET_MUTE | |
296 | PCXHR_DSP_RESET_MUTE | | 300 | PCXHR_DSP_RESET_CODEC; |
297 | PCXHR_DSP_RESET_CODEC); | 301 | PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, mgr->dsp_reset); |
302 | /* hr222_write_gpo(mgr, 0); does the same */ | ||
298 | msleep(5); | 303 | msleep(5); |
299 | 304 | ||
300 | /* config AKM */ | 305 | /* config AKM */ |
@@ -496,6 +501,33 @@ int hr222_get_external_clock(struct pcxhr_mgr *mgr, | |||
496 | } | 501 | } |
497 | 502 | ||
498 | 503 | ||
504 | int hr222_read_gpio(struct pcxhr_mgr *mgr, int is_gpi, int *value) | ||
505 | { | ||
506 | if (is_gpi) { | ||
507 | unsigned char reg = PCXHR_INPB(mgr, PCXHR_XLX_STATUS); | ||
508 | *value = (int)(reg & PCXHR_STAT_GPI_MASK) >> | ||
509 | PCXHR_STAT_GPI_OFFSET; | ||
510 | } else { | ||
511 | *value = (int)(mgr->dsp_reset & PCXHR_DSP_RESET_GPO_MASK) >> | ||
512 | PCXHR_DSP_RESET_GPO_OFFSET; | ||
513 | } | ||
514 | return 0; | ||
515 | } | ||
516 | |||
517 | |||
518 | int hr222_write_gpo(struct pcxhr_mgr *mgr, int value) | ||
519 | { | ||
520 | unsigned char reg = mgr->dsp_reset & ~PCXHR_DSP_RESET_GPO_MASK; | ||
521 | |||
522 | reg |= (unsigned char)(value << PCXHR_DSP_RESET_GPO_OFFSET) & | ||
523 | PCXHR_DSP_RESET_GPO_MASK; | ||
524 | |||
525 | PCXHR_OUTPB(mgr, PCXHR_DSP_RESET, reg); | ||
526 | mgr->dsp_reset = reg; | ||
527 | return 0; | ||
528 | } | ||
529 | |||
530 | |||
499 | int hr222_update_analog_audio_level(struct snd_pcxhr *chip, | 531 | int hr222_update_analog_audio_level(struct snd_pcxhr *chip, |
500 | int is_capture, int channel) | 532 | int is_capture, int channel) |
501 | { | 533 | { |
diff --git a/sound/pci/pcxhr/pcxhr_mix22.h b/sound/pci/pcxhr/pcxhr_mix22.h index 6b318b2f0100..5a37a0007e8f 100644 --- a/sound/pci/pcxhr/pcxhr_mix22.h +++ b/sound/pci/pcxhr/pcxhr_mix22.h | |||
@@ -32,6 +32,9 @@ int hr222_get_external_clock(struct pcxhr_mgr *mgr, | |||
32 | enum pcxhr_clock_type clock_type, | 32 | enum pcxhr_clock_type clock_type, |
33 | int *sample_rate); | 33 | int *sample_rate); |
34 | 34 | ||
35 | int hr222_read_gpio(struct pcxhr_mgr *mgr, int is_gpi, int *value); | ||
36 | int hr222_write_gpo(struct pcxhr_mgr *mgr, int value); | ||
37 | |||
35 | #define HR222_LINE_PLAYBACK_LEVEL_MIN 0 /* -25.5 dB */ | 38 | #define HR222_LINE_PLAYBACK_LEVEL_MIN 0 /* -25.5 dB */ |
36 | #define HR222_LINE_PLAYBACK_ZERO_LEVEL 51 /* 0.0 dB */ | 39 | #define HR222_LINE_PLAYBACK_ZERO_LEVEL 51 /* 0.0 dB */ |
37 | #define HR222_LINE_PLAYBACK_LEVEL_MAX 99 /* +24.0 dB */ | 40 | #define HR222_LINE_PLAYBACK_LEVEL_MAX 99 /* +24.0 dB */ |
diff --git a/sound/pci/pcxhr/pcxhr_mixer.c b/sound/pci/pcxhr/pcxhr_mixer.c index 2436e374586f..fec049344621 100644 --- a/sound/pci/pcxhr/pcxhr_mixer.c +++ b/sound/pci/pcxhr/pcxhr_mixer.c | |||
@@ -789,11 +789,15 @@ static int pcxhr_clock_type_put(struct snd_kcontrol *kcontrol, | |||
789 | if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) { | 789 | if (mgr->use_clock_type != ucontrol->value.enumerated.item[0]) { |
790 | mutex_lock(&mgr->setup_mutex); | 790 | mutex_lock(&mgr->setup_mutex); |
791 | mgr->use_clock_type = ucontrol->value.enumerated.item[0]; | 791 | mgr->use_clock_type = ucontrol->value.enumerated.item[0]; |
792 | if (mgr->use_clock_type) | 792 | rate = 0; |
793 | if (mgr->use_clock_type != PCXHR_CLOCK_TYPE_INTERNAL) { | ||
793 | pcxhr_get_external_clock(mgr, mgr->use_clock_type, | 794 | pcxhr_get_external_clock(mgr, mgr->use_clock_type, |
794 | &rate); | 795 | &rate); |
795 | else | 796 | } else { |
796 | rate = mgr->sample_rate; | 797 | rate = mgr->sample_rate; |
798 | if (!rate) | ||
799 | rate = 48000; | ||
800 | } | ||
797 | if (rate) { | 801 | if (rate) { |
798 | pcxhr_set_clock(mgr, rate); | 802 | pcxhr_set_clock(mgr, rate); |
799 | if (mgr->sample_rate) | 803 | if (mgr->sample_rate) |
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 3caacfb9d8e0..6f1034417a02 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c | |||
@@ -2102,9 +2102,9 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2102 | return -ENOENT; | 2102 | return -ENOENT; |
2103 | } | 2103 | } |
2104 | 2104 | ||
2105 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 2105 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
2106 | if (card == NULL) | 2106 | if (err < 0) |
2107 | return -ENOMEM; | 2107 | return err; |
2108 | if ((err = snd_riptide_create(card, pci, &chip)) < 0) { | 2108 | if ((err = snd_riptide_create(card, pci, &chip)) < 0) { |
2109 | snd_card_free(card); | 2109 | snd_card_free(card); |
2110 | return err; | 2110 | return err; |
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index e7ef3a1a25a8..d7b966e7c4cf 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c | |||
@@ -1941,9 +1941,10 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
1941 | return -ENOENT; | 1941 | return -ENOENT; |
1942 | } | 1942 | } |
1943 | 1943 | ||
1944 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 1944 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
1945 | sizeof(struct rme32))) == NULL) | 1945 | sizeof(struct rme32), &card); |
1946 | return -ENOMEM; | 1946 | if (err < 0) |
1947 | return err; | ||
1947 | card->private_free = snd_rme32_card_free; | 1948 | card->private_free = snd_rme32_card_free; |
1948 | rme32 = (struct rme32 *) card->private_data; | 1949 | rme32 = (struct rme32 *) card->private_data; |
1949 | rme32->card = card; | 1950 | rme32->card = card; |
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index 3fdd488d0975..55fb1c131f58 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c | |||
@@ -2348,9 +2348,10 @@ snd_rme96_probe(struct pci_dev *pci, | |||
2348 | dev++; | 2348 | dev++; |
2349 | return -ENOENT; | 2349 | return -ENOENT; |
2350 | } | 2350 | } |
2351 | if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 2351 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
2352 | sizeof(struct rme96))) == NULL) | 2352 | sizeof(struct rme96), &card); |
2353 | return -ENOMEM; | 2353 | if (err < 0) |
2354 | return err; | ||
2354 | card->private_free = snd_rme96_card_free; | 2355 | card->private_free = snd_rme96_card_free; |
2355 | rme96 = (struct rme96 *)card->private_data; | 2356 | rme96 = (struct rme96 *)card->private_data; |
2356 | rme96->card = card; | 2357 | rme96->card = card; |
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index 44d0c15e2b71..314e73531bd1 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c | |||
@@ -113,7 +113,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); | |||
113 | 113 | ||
114 | /* the meters are regular i/o-mapped registers, but offset | 114 | /* the meters are regular i/o-mapped registers, but offset |
115 | considerably from the rest. the peak registers are reset | 115 | considerably from the rest. the peak registers are reset |
116 | when read; the least-significant 4 bits are full-scale counters; | 116 | when read; the least-significant 4 bits are full-scale counters; |
117 | the actual peak value is in the most-significant 24 bits. | 117 | the actual peak value is in the most-significant 24 bits. |
118 | */ | 118 | */ |
119 | 119 | ||
@@ -131,7 +131,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); | |||
131 | 26*3 values are read in ss mode | 131 | 26*3 values are read in ss mode |
132 | 14*3 in ds mode, with no gap between values | 132 | 14*3 in ds mode, with no gap between values |
133 | */ | 133 | */ |
134 | #define HDSP_9652_peakBase 7164 | 134 | #define HDSP_9652_peakBase 7164 |
135 | #define HDSP_9652_rmsBase 4096 | 135 | #define HDSP_9652_rmsBase 4096 |
136 | 136 | ||
137 | /* c.f. the hdsp_9632_meters_t struct */ | 137 | /* c.f. the hdsp_9632_meters_t struct */ |
@@ -173,12 +173,12 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); | |||
173 | #define HDSP_SPDIFEmphasis (1<<10) /* 0=none, 1=on */ | 173 | #define HDSP_SPDIFEmphasis (1<<10) /* 0=none, 1=on */ |
174 | #define HDSP_SPDIFNonAudio (1<<11) /* 0=off, 1=on */ | 174 | #define HDSP_SPDIFNonAudio (1<<11) /* 0=off, 1=on */ |
175 | #define HDSP_SPDIFOpticalOut (1<<12) /* 1=use 1st ADAT connector for SPDIF, 0=do not */ | 175 | #define HDSP_SPDIFOpticalOut (1<<12) /* 1=use 1st ADAT connector for SPDIF, 0=do not */ |
176 | #define HDSP_SyncRef2 (1<<13) | 176 | #define HDSP_SyncRef2 (1<<13) |
177 | #define HDSP_SPDIFInputSelect0 (1<<14) | 177 | #define HDSP_SPDIFInputSelect0 (1<<14) |
178 | #define HDSP_SPDIFInputSelect1 (1<<15) | 178 | #define HDSP_SPDIFInputSelect1 (1<<15) |
179 | #define HDSP_SyncRef0 (1<<16) | 179 | #define HDSP_SyncRef0 (1<<16) |
180 | #define HDSP_SyncRef1 (1<<17) | 180 | #define HDSP_SyncRef1 (1<<17) |
181 | #define HDSP_AnalogExtensionBoard (1<<18) /* For H9632 cards */ | 181 | #define HDSP_AnalogExtensionBoard (1<<18) /* For H9632 cards */ |
182 | #define HDSP_XLRBreakoutCable (1<<20) /* For H9632 cards */ | 182 | #define HDSP_XLRBreakoutCable (1<<20) /* For H9632 cards */ |
183 | #define HDSP_Midi0InterruptEnable (1<<22) | 183 | #define HDSP_Midi0InterruptEnable (1<<22) |
184 | #define HDSP_Midi1InterruptEnable (1<<23) | 184 | #define HDSP_Midi1InterruptEnable (1<<23) |
@@ -314,7 +314,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); | |||
314 | #define HDSP_TimecodeSync (1<<27) | 314 | #define HDSP_TimecodeSync (1<<27) |
315 | #define HDSP_AEBO (1<<28) /* H9632 specific Analog Extension Boards */ | 315 | #define HDSP_AEBO (1<<28) /* H9632 specific Analog Extension Boards */ |
316 | #define HDSP_AEBI (1<<29) /* 0 = present, 1 = absent */ | 316 | #define HDSP_AEBI (1<<29) /* 0 = present, 1 = absent */ |
317 | #define HDSP_midi0IRQPending (1<<30) | 317 | #define HDSP_midi0IRQPending (1<<30) |
318 | #define HDSP_midi1IRQPending (1<<31) | 318 | #define HDSP_midi1IRQPending (1<<31) |
319 | 319 | ||
320 | #define HDSP_spdifFrequencyMask (HDSP_spdifFrequency0|HDSP_spdifFrequency1|HDSP_spdifFrequency2) | 320 | #define HDSP_spdifFrequencyMask (HDSP_spdifFrequency0|HDSP_spdifFrequency1|HDSP_spdifFrequency2) |
@@ -391,7 +391,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin"); | |||
391 | #define HDSP_CHANNEL_BUFFER_BYTES (4*HDSP_CHANNEL_BUFFER_SAMPLES) | 391 | #define HDSP_CHANNEL_BUFFER_BYTES (4*HDSP_CHANNEL_BUFFER_SAMPLES) |
392 | 392 | ||
393 | /* the size of the area we need to allocate for DMA transfers. the | 393 | /* the size of the area we need to allocate for DMA transfers. the |
394 | size is the same regardless of the number of channels - the | 394 | size is the same regardless of the number of channels - the |
395 | Multiface still uses the same memory area. | 395 | Multiface still uses the same memory area. |
396 | 396 | ||
397 | Note that we allocate 1 more channel than is apparently needed | 397 | Note that we allocate 1 more channel than is apparently needed |
@@ -460,7 +460,7 @@ struct hdsp { | |||
460 | unsigned char qs_in_channels; /* quad speed mode for H9632 */ | 460 | unsigned char qs_in_channels; /* quad speed mode for H9632 */ |
461 | unsigned char ds_in_channels; | 461 | unsigned char ds_in_channels; |
462 | unsigned char ss_in_channels; /* different for multiface/digiface */ | 462 | unsigned char ss_in_channels; /* different for multiface/digiface */ |
463 | unsigned char qs_out_channels; | 463 | unsigned char qs_out_channels; |
464 | unsigned char ds_out_channels; | 464 | unsigned char ds_out_channels; |
465 | unsigned char ss_out_channels; | 465 | unsigned char ss_out_channels; |
466 | 466 | ||
@@ -502,9 +502,9 @@ static char channel_map_df_ss[HDSP_MAX_CHANNELS] = { | |||
502 | 502 | ||
503 | static char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */ | 503 | static char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */ |
504 | /* Analog */ | 504 | /* Analog */ |
505 | 0, 1, 2, 3, 4, 5, 6, 7, | 505 | 0, 1, 2, 3, 4, 5, 6, 7, |
506 | /* ADAT 2 */ | 506 | /* ADAT 2 */ |
507 | 16, 17, 18, 19, 20, 21, 22, 23, | 507 | 16, 17, 18, 19, 20, 21, 22, 23, |
508 | /* SPDIF */ | 508 | /* SPDIF */ |
509 | 24, 25, | 509 | 24, 25, |
510 | -1, -1, -1, -1, -1, -1, -1, -1 | 510 | -1, -1, -1, -1, -1, -1, -1, -1 |
@@ -525,11 +525,11 @@ static char channel_map_H9632_ss[HDSP_MAX_CHANNELS] = { | |||
525 | /* SPDIF */ | 525 | /* SPDIF */ |
526 | 8, 9, | 526 | 8, 9, |
527 | /* Analog */ | 527 | /* Analog */ |
528 | 10, 11, | 528 | 10, 11, |
529 | /* AO4S-192 and AI4S-192 extension boards */ | 529 | /* AO4S-192 and AI4S-192 extension boards */ |
530 | 12, 13, 14, 15, | 530 | 12, 13, 14, 15, |
531 | /* others don't exist */ | 531 | /* others don't exist */ |
532 | -1, -1, -1, -1, -1, -1, -1, -1, | 532 | -1, -1, -1, -1, -1, -1, -1, -1, |
533 | -1, -1 | 533 | -1, -1 |
534 | }; | 534 | }; |
535 | 535 | ||
@@ -539,7 +539,7 @@ static char channel_map_H9632_ds[HDSP_MAX_CHANNELS] = { | |||
539 | /* SPDIF */ | 539 | /* SPDIF */ |
540 | 8, 9, | 540 | 8, 9, |
541 | /* Analog */ | 541 | /* Analog */ |
542 | 10, 11, | 542 | 10, 11, |
543 | /* AO4S-192 and AI4S-192 extension boards */ | 543 | /* AO4S-192 and AI4S-192 extension boards */ |
544 | 12, 13, 14, 15, | 544 | 12, 13, 14, 15, |
545 | /* others don't exist */ | 545 | /* others don't exist */ |
@@ -587,7 +587,7 @@ static void snd_hammerfall_free_buffer(struct snd_dma_buffer *dmab, struct pci_d | |||
587 | static struct pci_device_id snd_hdsp_ids[] = { | 587 | static struct pci_device_id snd_hdsp_ids[] = { |
588 | { | 588 | { |
589 | .vendor = PCI_VENDOR_ID_XILINX, | 589 | .vendor = PCI_VENDOR_ID_XILINX, |
590 | .device = PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP, | 590 | .device = PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP, |
591 | .subvendor = PCI_ANY_ID, | 591 | .subvendor = PCI_ANY_ID, |
592 | .subdevice = PCI_ANY_ID, | 592 | .subdevice = PCI_ANY_ID, |
593 | }, /* RME Hammerfall-DSP */ | 593 | }, /* RME Hammerfall-DSP */ |
@@ -653,7 +653,6 @@ static unsigned int hdsp_read(struct hdsp *hdsp, int reg) | |||
653 | 653 | ||
654 | static int hdsp_check_for_iobox (struct hdsp *hdsp) | 654 | static int hdsp_check_for_iobox (struct hdsp *hdsp) |
655 | { | 655 | { |
656 | |||
657 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; | 656 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; |
658 | if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) { | 657 | if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) { |
659 | snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n"); | 658 | snd_printk ("Hammerfall-DSP: no Digiface or Multiface connected!\n"); |
@@ -661,7 +660,29 @@ static int hdsp_check_for_iobox (struct hdsp *hdsp) | |||
661 | return -EIO; | 660 | return -EIO; |
662 | } | 661 | } |
663 | return 0; | 662 | return 0; |
663 | } | ||
664 | 664 | ||
665 | static int hdsp_wait_for_iobox(struct hdsp *hdsp, unsigned int loops, | ||
666 | unsigned int delay) | ||
667 | { | ||
668 | unsigned int i; | ||
669 | |||
670 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) | ||
671 | return 0; | ||
672 | |||
673 | for (i = 0; i != loops; ++i) { | ||
674 | if (hdsp_read(hdsp, HDSP_statusRegister) & HDSP_ConfigError) | ||
675 | msleep(delay); | ||
676 | else { | ||
677 | snd_printd("Hammerfall-DSP: iobox found after %ums!\n", | ||
678 | i * delay); | ||
679 | return 0; | ||
680 | } | ||
681 | } | ||
682 | |||
683 | snd_printk("Hammerfall-DSP: no Digiface or Multiface connected!\n"); | ||
684 | hdsp->state &= ~HDSP_FirmwareLoaded; | ||
685 | return -EIO; | ||
665 | } | 686 | } |
666 | 687 | ||
667 | static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { | 688 | static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { |
@@ -670,19 +691,19 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { | |||
670 | unsigned long flags; | 691 | unsigned long flags; |
671 | 692 | ||
672 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { | 693 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { |
673 | 694 | ||
674 | snd_printk ("Hammerfall-DSP: loading firmware\n"); | 695 | snd_printk ("Hammerfall-DSP: loading firmware\n"); |
675 | 696 | ||
676 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); | 697 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); |
677 | hdsp_write (hdsp, HDSP_fifoData, 0); | 698 | hdsp_write (hdsp, HDSP_fifoData, 0); |
678 | 699 | ||
679 | if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { | 700 | if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { |
680 | snd_printk ("Hammerfall-DSP: timeout waiting for download preparation\n"); | 701 | snd_printk ("Hammerfall-DSP: timeout waiting for download preparation\n"); |
681 | return -EIO; | 702 | return -EIO; |
682 | } | 703 | } |
683 | 704 | ||
684 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); | 705 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); |
685 | 706 | ||
686 | for (i = 0; i < 24413; ++i) { | 707 | for (i = 0; i < 24413; ++i) { |
687 | hdsp_write(hdsp, HDSP_fifoData, hdsp->firmware_cache[i]); | 708 | hdsp_write(hdsp, HDSP_fifoData, hdsp->firmware_cache[i]); |
688 | if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { | 709 | if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { |
@@ -692,7 +713,7 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { | |||
692 | } | 713 | } |
693 | 714 | ||
694 | ssleep(3); | 715 | ssleep(3); |
695 | 716 | ||
696 | if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { | 717 | if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { |
697 | snd_printk ("Hammerfall-DSP: timeout at end of firmware loading\n"); | 718 | snd_printk ("Hammerfall-DSP: timeout at end of firmware loading\n"); |
698 | return -EIO; | 719 | return -EIO; |
@@ -705,15 +726,15 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { | |||
705 | #endif | 726 | #endif |
706 | hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); | 727 | hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); |
707 | snd_printk ("Hammerfall-DSP: finished firmware loading\n"); | 728 | snd_printk ("Hammerfall-DSP: finished firmware loading\n"); |
708 | 729 | ||
709 | } | 730 | } |
710 | if (hdsp->state & HDSP_InitializationComplete) { | 731 | if (hdsp->state & HDSP_InitializationComplete) { |
711 | snd_printk(KERN_INFO "Hammerfall-DSP: firmware loaded from cache, restoring defaults\n"); | 732 | snd_printk(KERN_INFO "Hammerfall-DSP: firmware loaded from cache, restoring defaults\n"); |
712 | spin_lock_irqsave(&hdsp->lock, flags); | 733 | spin_lock_irqsave(&hdsp->lock, flags); |
713 | snd_hdsp_set_defaults(hdsp); | 734 | snd_hdsp_set_defaults(hdsp); |
714 | spin_unlock_irqrestore(&hdsp->lock, flags); | 735 | spin_unlock_irqrestore(&hdsp->lock, flags); |
715 | } | 736 | } |
716 | 737 | ||
717 | hdsp->state |= HDSP_FirmwareLoaded; | 738 | hdsp->state |= HDSP_FirmwareLoaded; |
718 | 739 | ||
719 | return 0; | 740 | return 0; |
@@ -722,7 +743,7 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) { | |||
722 | static int hdsp_get_iobox_version (struct hdsp *hdsp) | 743 | static int hdsp_get_iobox_version (struct hdsp *hdsp) |
723 | { | 744 | { |
724 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { | 745 | if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { |
725 | 746 | ||
726 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM); | 747 | hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM); |
727 | hdsp_write (hdsp, HDSP_fifoData, 0); | 748 | hdsp_write (hdsp, HDSP_fifoData, 0); |
728 | if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) | 749 | if (hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT) < 0) |
@@ -738,7 +759,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp) | |||
738 | hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT); | 759 | hdsp_fifo_wait (hdsp, 0, HDSP_SHORT_WAIT); |
739 | } else { | 760 | } else { |
740 | hdsp->io_type = Digiface; | 761 | hdsp->io_type = Digiface; |
741 | } | 762 | } |
742 | } else { | 763 | } else { |
743 | /* firmware was already loaded, get iobox type */ | 764 | /* firmware was already loaded, get iobox type */ |
744 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) | 765 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) |
@@ -786,13 +807,13 @@ static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand) | |||
786 | 807 | ||
787 | 808 | ||
788 | static int hdsp_fifo_wait(struct hdsp *hdsp, int count, int timeout) | 809 | static int hdsp_fifo_wait(struct hdsp *hdsp, int count, int timeout) |
789 | { | 810 | { |
790 | int i; | 811 | int i; |
791 | 812 | ||
792 | /* the fifoStatus registers reports on how many words | 813 | /* the fifoStatus registers reports on how many words |
793 | are available in the command FIFO. | 814 | are available in the command FIFO. |
794 | */ | 815 | */ |
795 | 816 | ||
796 | for (i = 0; i < timeout; i++) { | 817 | for (i = 0; i < timeout; i++) { |
797 | 818 | ||
798 | if ((int)(hdsp_read (hdsp, HDSP_fifoStatus) & 0xff) <= count) | 819 | if ((int)(hdsp_read (hdsp, HDSP_fifoStatus) & 0xff) <= count) |
@@ -824,11 +845,11 @@ static int hdsp_write_gain(struct hdsp *hdsp, unsigned int addr, unsigned short | |||
824 | 845 | ||
825 | if (addr >= HDSP_MATRIX_MIXER_SIZE) | 846 | if (addr >= HDSP_MATRIX_MIXER_SIZE) |
826 | return -1; | 847 | return -1; |
827 | 848 | ||
828 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) { | 849 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) { |
829 | 850 | ||
830 | /* from martin bjornsen: | 851 | /* from martin bjornsen: |
831 | 852 | ||
832 | "You can only write dwords to the | 853 | "You can only write dwords to the |
833 | mixer memory which contain two | 854 | mixer memory which contain two |
834 | mixer values in the low and high | 855 | mixer values in the low and high |
@@ -847,7 +868,7 @@ static int hdsp_write_gain(struct hdsp *hdsp, unsigned int addr, unsigned short | |||
847 | 868 | ||
848 | hdsp->mixer_matrix[addr] = data; | 869 | hdsp->mixer_matrix[addr] = data; |
849 | 870 | ||
850 | 871 | ||
851 | /* `addr' addresses a 16-bit wide address, but | 872 | /* `addr' addresses a 16-bit wide address, but |
852 | the address space accessed via hdsp_write | 873 | the address space accessed via hdsp_write |
853 | uses byte offsets. put another way, addr | 874 | uses byte offsets. put another way, addr |
@@ -856,17 +877,17 @@ static int hdsp_write_gain(struct hdsp *hdsp, unsigned int addr, unsigned short | |||
856 | to access 0 to 2703 ... | 877 | to access 0 to 2703 ... |
857 | */ | 878 | */ |
858 | ad = addr/2; | 879 | ad = addr/2; |
859 | 880 | ||
860 | hdsp_write (hdsp, 4096 + (ad*4), | 881 | hdsp_write (hdsp, 4096 + (ad*4), |
861 | (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + | 882 | (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + |
862 | hdsp->mixer_matrix[addr&0x7fe]); | 883 | hdsp->mixer_matrix[addr&0x7fe]); |
863 | 884 | ||
864 | return 0; | 885 | return 0; |
865 | 886 | ||
866 | } else { | 887 | } else { |
867 | 888 | ||
868 | ad = (addr << 16) + data; | 889 | ad = (addr << 16) + data; |
869 | 890 | ||
870 | if (hdsp_fifo_wait(hdsp, 127, HDSP_LONG_WAIT)) | 891 | if (hdsp_fifo_wait(hdsp, 127, HDSP_LONG_WAIT)) |
871 | return -1; | 892 | return -1; |
872 | 893 | ||
@@ -902,7 +923,7 @@ static int hdsp_spdif_sample_rate(struct hdsp *hdsp) | |||
902 | 923 | ||
903 | if (status & HDSP_SPDIFErrorFlag) | 924 | if (status & HDSP_SPDIFErrorFlag) |
904 | return 0; | 925 | return 0; |
905 | 926 | ||
906 | switch (rate_bits) { | 927 | switch (rate_bits) { |
907 | case HDSP_spdifFrequency32KHz: return 32000; | 928 | case HDSP_spdifFrequency32KHz: return 32000; |
908 | case HDSP_spdifFrequency44_1KHz: return 44100; | 929 | case HDSP_spdifFrequency44_1KHz: return 44100; |
@@ -910,13 +931,13 @@ static int hdsp_spdif_sample_rate(struct hdsp *hdsp) | |||
910 | case HDSP_spdifFrequency64KHz: return 64000; | 931 | case HDSP_spdifFrequency64KHz: return 64000; |
911 | case HDSP_spdifFrequency88_2KHz: return 88200; | 932 | case HDSP_spdifFrequency88_2KHz: return 88200; |
912 | case HDSP_spdifFrequency96KHz: return 96000; | 933 | case HDSP_spdifFrequency96KHz: return 96000; |
913 | case HDSP_spdifFrequency128KHz: | 934 | case HDSP_spdifFrequency128KHz: |
914 | if (hdsp->io_type == H9632) return 128000; | 935 | if (hdsp->io_type == H9632) return 128000; |
915 | break; | 936 | break; |
916 | case HDSP_spdifFrequency176_4KHz: | 937 | case HDSP_spdifFrequency176_4KHz: |
917 | if (hdsp->io_type == H9632) return 176400; | 938 | if (hdsp->io_type == H9632) return 176400; |
918 | break; | 939 | break; |
919 | case HDSP_spdifFrequency192KHz: | 940 | case HDSP_spdifFrequency192KHz: |
920 | if (hdsp->io_type == H9632) return 192000; | 941 | if (hdsp->io_type == H9632) return 192000; |
921 | break; | 942 | break; |
922 | default: | 943 | default: |
@@ -1027,7 +1048,7 @@ static void hdsp_set_dds_value(struct hdsp *hdsp, int rate) | |||
1027 | { | 1048 | { |
1028 | u64 n; | 1049 | u64 n; |
1029 | u32 r; | 1050 | u32 r; |
1030 | 1051 | ||
1031 | if (rate >= 112000) | 1052 | if (rate >= 112000) |
1032 | rate /= 4; | 1053 | rate /= 4; |
1033 | else if (rate >= 56000) | 1054 | else if (rate >= 56000) |
@@ -1053,35 +1074,35 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally) | |||
1053 | there is no need for it (e.g. during module | 1074 | there is no need for it (e.g. during module |
1054 | initialization). | 1075 | initialization). |
1055 | */ | 1076 | */ |
1056 | 1077 | ||
1057 | if (!(hdsp->control_register & HDSP_ClockModeMaster)) { | 1078 | if (!(hdsp->control_register & HDSP_ClockModeMaster)) { |
1058 | if (called_internally) { | 1079 | if (called_internally) { |
1059 | /* request from ctl or card initialization */ | 1080 | /* request from ctl or card initialization */ |
1060 | snd_printk(KERN_ERR "Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n"); | 1081 | snd_printk(KERN_ERR "Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n"); |
1061 | return -1; | 1082 | return -1; |
1062 | } else { | 1083 | } else { |
1063 | /* hw_param request while in AutoSync mode */ | 1084 | /* hw_param request while in AutoSync mode */ |
1064 | int external_freq = hdsp_external_sample_rate(hdsp); | 1085 | int external_freq = hdsp_external_sample_rate(hdsp); |
1065 | int spdif_freq = hdsp_spdif_sample_rate(hdsp); | 1086 | int spdif_freq = hdsp_spdif_sample_rate(hdsp); |
1066 | 1087 | ||
1067 | if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) | 1088 | if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) |
1068 | snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in double speed mode\n"); | 1089 | snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in double speed mode\n"); |
1069 | else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) | 1090 | else if (hdsp->io_type == H9632 && (spdif_freq == external_freq*4) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) |
1070 | snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in quad speed mode\n"); | 1091 | snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in quad speed mode\n"); |
1071 | else if (rate != external_freq) { | 1092 | else if (rate != external_freq) { |
1072 | snd_printk(KERN_INFO "Hammerfall-DSP: No AutoSync source for requested rate\n"); | 1093 | snd_printk(KERN_INFO "Hammerfall-DSP: No AutoSync source for requested rate\n"); |
1073 | return -1; | 1094 | return -1; |
1074 | } | 1095 | } |
1075 | } | 1096 | } |
1076 | } | 1097 | } |
1077 | 1098 | ||
1078 | current_rate = hdsp->system_sample_rate; | 1099 | current_rate = hdsp->system_sample_rate; |
1079 | 1100 | ||
1080 | /* Changing from a "single speed" to a "double speed" rate is | 1101 | /* Changing from a "single speed" to a "double speed" rate is |
1081 | not allowed if any substreams are open. This is because | 1102 | not allowed if any substreams are open. This is because |
1082 | such a change causes a shift in the location of | 1103 | such a change causes a shift in the location of |
1083 | the DMA buffers and a reduction in the number of available | 1104 | the DMA buffers and a reduction in the number of available |
1084 | buffers. | 1105 | buffers. |
1085 | 1106 | ||
1086 | Note that a similar but essentially insoluble problem | 1107 | Note that a similar but essentially insoluble problem |
1087 | exists for externally-driven rate changes. All we can do | 1108 | exists for externally-driven rate changes. All we can do |
@@ -1089,7 +1110,7 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally) | |||
1089 | 1110 | ||
1090 | if (rate > 96000 && hdsp->io_type != H9632) | 1111 | if (rate > 96000 && hdsp->io_type != H9632) |
1091 | return -EINVAL; | 1112 | return -EINVAL; |
1092 | 1113 | ||
1093 | switch (rate) { | 1114 | switch (rate) { |
1094 | case 32000: | 1115 | case 32000: |
1095 | if (current_rate > 48000) | 1116 | if (current_rate > 48000) |
@@ -1179,7 +1200,7 @@ static int hdsp_set_rate(struct hdsp *hdsp, int rate, int called_internally) | |||
1179 | break; | 1200 | break; |
1180 | } | 1201 | } |
1181 | } | 1202 | } |
1182 | 1203 | ||
1183 | hdsp->system_sample_rate = rate; | 1204 | hdsp->system_sample_rate = rate; |
1184 | 1205 | ||
1185 | return 0; | 1206 | return 0; |
@@ -1245,16 +1266,16 @@ static int snd_hdsp_midi_output_write (struct hdsp_midi *hmidi) | |||
1245 | unsigned char buf[128]; | 1266 | unsigned char buf[128]; |
1246 | 1267 | ||
1247 | /* Output is not interrupt driven */ | 1268 | /* Output is not interrupt driven */ |
1248 | 1269 | ||
1249 | spin_lock_irqsave (&hmidi->lock, flags); | 1270 | spin_lock_irqsave (&hmidi->lock, flags); |
1250 | if (hmidi->output) { | 1271 | if (hmidi->output) { |
1251 | if (!snd_rawmidi_transmit_empty (hmidi->output)) { | 1272 | if (!snd_rawmidi_transmit_empty (hmidi->output)) { |
1252 | if ((n_pending = snd_hdsp_midi_output_possible (hmidi->hdsp, hmidi->id)) > 0) { | 1273 | if ((n_pending = snd_hdsp_midi_output_possible (hmidi->hdsp, hmidi->id)) > 0) { |
1253 | if (n_pending > (int)sizeof (buf)) | 1274 | if (n_pending > (int)sizeof (buf)) |
1254 | n_pending = sizeof (buf); | 1275 | n_pending = sizeof (buf); |
1255 | 1276 | ||
1256 | if ((to_write = snd_rawmidi_transmit (hmidi->output, buf, n_pending)) > 0) { | 1277 | if ((to_write = snd_rawmidi_transmit (hmidi->output, buf, n_pending)) > 0) { |
1257 | for (i = 0; i < to_write; ++i) | 1278 | for (i = 0; i < to_write; ++i) |
1258 | snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]); | 1279 | snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]); |
1259 | } | 1280 | } |
1260 | } | 1281 | } |
@@ -1325,14 +1346,14 @@ static void snd_hdsp_midi_output_timer(unsigned long data) | |||
1325 | { | 1346 | { |
1326 | struct hdsp_midi *hmidi = (struct hdsp_midi *) data; | 1347 | struct hdsp_midi *hmidi = (struct hdsp_midi *) data; |
1327 | unsigned long flags; | 1348 | unsigned long flags; |
1328 | 1349 | ||
1329 | snd_hdsp_midi_output_write(hmidi); | 1350 | snd_hdsp_midi_output_write(hmidi); |
1330 | spin_lock_irqsave (&hmidi->lock, flags); | 1351 | spin_lock_irqsave (&hmidi->lock, flags); |
1331 | 1352 | ||
1332 | /* this does not bump hmidi->istimer, because the | 1353 | /* this does not bump hmidi->istimer, because the |
1333 | kernel automatically removed the timer when it | 1354 | kernel automatically removed the timer when it |
1334 | expired, and we are now adding it back, thus | 1355 | expired, and we are now adding it back, thus |
1335 | leaving istimer wherever it was set before. | 1356 | leaving istimer wherever it was set before. |
1336 | */ | 1357 | */ |
1337 | 1358 | ||
1338 | if (hmidi->istimer) { | 1359 | if (hmidi->istimer) { |
@@ -1501,7 +1522,7 @@ static int snd_hdsp_control_spdif_info(struct snd_kcontrol *kcontrol, struct snd | |||
1501 | static int snd_hdsp_control_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1522 | static int snd_hdsp_control_spdif_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1502 | { | 1523 | { |
1503 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1524 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1504 | 1525 | ||
1505 | snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif); | 1526 | snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif); |
1506 | return 0; | 1527 | return 0; |
1507 | } | 1528 | } |
@@ -1511,7 +1532,7 @@ static int snd_hdsp_control_spdif_put(struct snd_kcontrol *kcontrol, struct snd_ | |||
1511 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1532 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1512 | int change; | 1533 | int change; |
1513 | u32 val; | 1534 | u32 val; |
1514 | 1535 | ||
1515 | val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); | 1536 | val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); |
1516 | spin_lock_irq(&hdsp->lock); | 1537 | spin_lock_irq(&hdsp->lock); |
1517 | change = val != hdsp->creg_spdif; | 1538 | change = val != hdsp->creg_spdif; |
@@ -1530,7 +1551,7 @@ static int snd_hdsp_control_spdif_stream_info(struct snd_kcontrol *kcontrol, str | |||
1530 | static int snd_hdsp_control_spdif_stream_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1551 | static int snd_hdsp_control_spdif_stream_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1531 | { | 1552 | { |
1532 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1553 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1533 | 1554 | ||
1534 | snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif_stream); | 1555 | snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif_stream); |
1535 | return 0; | 1556 | return 0; |
1536 | } | 1557 | } |
@@ -1540,7 +1561,7 @@ static int snd_hdsp_control_spdif_stream_put(struct snd_kcontrol *kcontrol, stru | |||
1540 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1561 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1541 | int change; | 1562 | int change; |
1542 | u32 val; | 1563 | u32 val; |
1543 | 1564 | ||
1544 | val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); | 1565 | val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); |
1545 | spin_lock_irq(&hdsp->lock); | 1566 | spin_lock_irq(&hdsp->lock); |
1546 | change = val != hdsp->creg_spdif_stream; | 1567 | change = val != hdsp->creg_spdif_stream; |
@@ -1602,7 +1623,7 @@ static int snd_hdsp_info_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
1602 | static int snd_hdsp_get_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1623 | static int snd_hdsp_get_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1603 | { | 1624 | { |
1604 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1625 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1605 | 1626 | ||
1606 | ucontrol->value.enumerated.item[0] = hdsp_spdif_in(hdsp); | 1627 | ucontrol->value.enumerated.item[0] = hdsp_spdif_in(hdsp); |
1607 | return 0; | 1628 | return 0; |
1608 | } | 1629 | } |
@@ -1612,7 +1633,7 @@ static int snd_hdsp_put_spdif_in(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
1612 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1633 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1613 | int change; | 1634 | int change; |
1614 | unsigned int val; | 1635 | unsigned int val; |
1615 | 1636 | ||
1616 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 1637 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
1617 | return -EBUSY; | 1638 | return -EBUSY; |
1618 | val = ucontrol->value.enumerated.item[0] % ((hdsp->io_type == H9632) ? 4 : 3); | 1639 | val = ucontrol->value.enumerated.item[0] % ((hdsp->io_type == H9632) ? 4 : 3); |
@@ -1649,7 +1670,7 @@ static int hdsp_set_spdif_output(struct hdsp *hdsp, int out) | |||
1649 | static int snd_hdsp_get_spdif_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1670 | static int snd_hdsp_get_spdif_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1650 | { | 1671 | { |
1651 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1672 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1652 | 1673 | ||
1653 | ucontrol->value.integer.value[0] = hdsp_spdif_out(hdsp); | 1674 | ucontrol->value.integer.value[0] = hdsp_spdif_out(hdsp); |
1654 | return 0; | 1675 | return 0; |
1655 | } | 1676 | } |
@@ -1659,7 +1680,7 @@ static int snd_hdsp_put_spdif_out(struct snd_kcontrol *kcontrol, struct snd_ctl_ | |||
1659 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1680 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1660 | int change; | 1681 | int change; |
1661 | unsigned int val; | 1682 | unsigned int val; |
1662 | 1683 | ||
1663 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 1684 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
1664 | return -EBUSY; | 1685 | return -EBUSY; |
1665 | val = ucontrol->value.integer.value[0] & 1; | 1686 | val = ucontrol->value.integer.value[0] & 1; |
@@ -1693,7 +1714,7 @@ static int hdsp_set_spdif_professional(struct hdsp *hdsp, int val) | |||
1693 | static int snd_hdsp_get_spdif_professional(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1714 | static int snd_hdsp_get_spdif_professional(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1694 | { | 1715 | { |
1695 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1716 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1696 | 1717 | ||
1697 | ucontrol->value.integer.value[0] = hdsp_spdif_professional(hdsp); | 1718 | ucontrol->value.integer.value[0] = hdsp_spdif_professional(hdsp); |
1698 | return 0; | 1719 | return 0; |
1699 | } | 1720 | } |
@@ -1703,7 +1724,7 @@ static int snd_hdsp_put_spdif_professional(struct snd_kcontrol *kcontrol, struct | |||
1703 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1724 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1704 | int change; | 1725 | int change; |
1705 | unsigned int val; | 1726 | unsigned int val; |
1706 | 1727 | ||
1707 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 1728 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
1708 | return -EBUSY; | 1729 | return -EBUSY; |
1709 | val = ucontrol->value.integer.value[0] & 1; | 1730 | val = ucontrol->value.integer.value[0] & 1; |
@@ -1737,7 +1758,7 @@ static int hdsp_set_spdif_emphasis(struct hdsp *hdsp, int val) | |||
1737 | static int snd_hdsp_get_spdif_emphasis(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1758 | static int snd_hdsp_get_spdif_emphasis(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1738 | { | 1759 | { |
1739 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1760 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1740 | 1761 | ||
1741 | ucontrol->value.integer.value[0] = hdsp_spdif_emphasis(hdsp); | 1762 | ucontrol->value.integer.value[0] = hdsp_spdif_emphasis(hdsp); |
1742 | return 0; | 1763 | return 0; |
1743 | } | 1764 | } |
@@ -1747,7 +1768,7 @@ static int snd_hdsp_put_spdif_emphasis(struct snd_kcontrol *kcontrol, struct snd | |||
1747 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1768 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1748 | int change; | 1769 | int change; |
1749 | unsigned int val; | 1770 | unsigned int val; |
1750 | 1771 | ||
1751 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 1772 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
1752 | return -EBUSY; | 1773 | return -EBUSY; |
1753 | val = ucontrol->value.integer.value[0] & 1; | 1774 | val = ucontrol->value.integer.value[0] & 1; |
@@ -1781,7 +1802,7 @@ static int hdsp_set_spdif_nonaudio(struct hdsp *hdsp, int val) | |||
1781 | static int snd_hdsp_get_spdif_nonaudio(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1802 | static int snd_hdsp_get_spdif_nonaudio(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1782 | { | 1803 | { |
1783 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1804 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1784 | 1805 | ||
1785 | ucontrol->value.integer.value[0] = hdsp_spdif_nonaudio(hdsp); | 1806 | ucontrol->value.integer.value[0] = hdsp_spdif_nonaudio(hdsp); |
1786 | return 0; | 1807 | return 0; |
1787 | } | 1808 | } |
@@ -1791,7 +1812,7 @@ static int snd_hdsp_put_spdif_nonaudio(struct snd_kcontrol *kcontrol, struct snd | |||
1791 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1812 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1792 | int change; | 1813 | int change; |
1793 | unsigned int val; | 1814 | unsigned int val; |
1794 | 1815 | ||
1795 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 1816 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
1796 | return -EBUSY; | 1817 | return -EBUSY; |
1797 | val = ucontrol->value.integer.value[0] & 1; | 1818 | val = ucontrol->value.integer.value[0] & 1; |
@@ -1828,7 +1849,7 @@ static int snd_hdsp_info_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct | |||
1828 | static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1849 | static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1829 | { | 1850 | { |
1830 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1851 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1831 | 1852 | ||
1832 | switch (hdsp_spdif_sample_rate(hdsp)) { | 1853 | switch (hdsp_spdif_sample_rate(hdsp)) { |
1833 | case 32000: | 1854 | case 32000: |
1834 | ucontrol->value.enumerated.item[0] = 0; | 1855 | ucontrol->value.enumerated.item[0] = 0; |
@@ -1858,7 +1879,7 @@ static int snd_hdsp_get_spdif_sample_rate(struct snd_kcontrol *kcontrol, struct | |||
1858 | ucontrol->value.enumerated.item[0] = 9; | 1879 | ucontrol->value.enumerated.item[0] = 9; |
1859 | break; | 1880 | break; |
1860 | default: | 1881 | default: |
1861 | ucontrol->value.enumerated.item[0] = 6; | 1882 | ucontrol->value.enumerated.item[0] = 6; |
1862 | } | 1883 | } |
1863 | return 0; | 1884 | return 0; |
1864 | } | 1885 | } |
@@ -1882,7 +1903,7 @@ static int snd_hdsp_info_system_sample_rate(struct snd_kcontrol *kcontrol, struc | |||
1882 | static int snd_hdsp_get_system_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1903 | static int snd_hdsp_get_system_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1883 | { | 1904 | { |
1884 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1905 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1885 | 1906 | ||
1886 | ucontrol->value.enumerated.item[0] = hdsp->system_sample_rate; | 1907 | ucontrol->value.enumerated.item[0] = hdsp->system_sample_rate; |
1887 | return 0; | 1908 | return 0; |
1888 | } | 1909 | } |
@@ -1899,7 +1920,7 @@ static int snd_hdsp_get_system_sample_rate(struct snd_kcontrol *kcontrol, struct | |||
1899 | static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1920 | static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1900 | { | 1921 | { |
1901 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1922 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1902 | static char *texts[] = {"32000", "44100", "48000", "64000", "88200", "96000", "None", "128000", "176400", "192000"}; | 1923 | static char *texts[] = {"32000", "44100", "48000", "64000", "88200", "96000", "None", "128000", "176400", "192000"}; |
1903 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1924 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
1904 | uinfo->count = 1; | 1925 | uinfo->count = 1; |
1905 | uinfo->value.enumerated.items = (hdsp->io_type == H9632) ? 10 : 7 ; | 1926 | uinfo->value.enumerated.items = (hdsp->io_type == H9632) ? 10 : 7 ; |
@@ -1912,7 +1933,7 @@ static int snd_hdsp_info_autosync_sample_rate(struct snd_kcontrol *kcontrol, str | |||
1912 | static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 1933 | static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1913 | { | 1934 | { |
1914 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 1935 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1915 | 1936 | ||
1916 | switch (hdsp_external_sample_rate(hdsp)) { | 1937 | switch (hdsp_external_sample_rate(hdsp)) { |
1917 | case 32000: | 1938 | case 32000: |
1918 | ucontrol->value.enumerated.item[0] = 0; | 1939 | ucontrol->value.enumerated.item[0] = 0; |
@@ -1940,9 +1961,9 @@ static int snd_hdsp_get_autosync_sample_rate(struct snd_kcontrol *kcontrol, stru | |||
1940 | break; | 1961 | break; |
1941 | case 192000: | 1962 | case 192000: |
1942 | ucontrol->value.enumerated.item[0] = 9; | 1963 | ucontrol->value.enumerated.item[0] = 9; |
1943 | break; | 1964 | break; |
1944 | default: | 1965 | default: |
1945 | ucontrol->value.enumerated.item[0] = 6; | 1966 | ucontrol->value.enumerated.item[0] = 6; |
1946 | } | 1967 | } |
1947 | return 0; | 1968 | return 0; |
1948 | } | 1969 | } |
@@ -1968,7 +1989,7 @@ static int hdsp_system_clock_mode(struct hdsp *hdsp) | |||
1968 | static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 1989 | static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
1969 | { | 1990 | { |
1970 | static char *texts[] = {"Master", "Slave" }; | 1991 | static char *texts[] = {"Master", "Slave" }; |
1971 | 1992 | ||
1972 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 1993 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
1973 | uinfo->count = 1; | 1994 | uinfo->count = 1; |
1974 | uinfo->value.enumerated.items = 2; | 1995 | uinfo->value.enumerated.items = 2; |
@@ -1981,7 +2002,7 @@ static int snd_hdsp_info_system_clock_mode(struct snd_kcontrol *kcontrol, struct | |||
1981 | static int snd_hdsp_get_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2002 | static int snd_hdsp_get_system_clock_mode(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
1982 | { | 2003 | { |
1983 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2004 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
1984 | 2005 | ||
1985 | ucontrol->value.enumerated.item[0] = hdsp_system_clock_mode(hdsp); | 2006 | ucontrol->value.enumerated.item[0] = hdsp_system_clock_mode(hdsp); |
1986 | return 0; | 2007 | return 0; |
1987 | } | 2008 | } |
@@ -2018,7 +2039,7 @@ static int hdsp_clock_source(struct hdsp *hdsp) | |||
2018 | case 192000: | 2039 | case 192000: |
2019 | return 9; | 2040 | return 9; |
2020 | default: | 2041 | default: |
2021 | return 3; | 2042 | return 3; |
2022 | } | 2043 | } |
2023 | } else { | 2044 | } else { |
2024 | return 0; | 2045 | return 0; |
@@ -2032,7 +2053,7 @@ static int hdsp_set_clock_source(struct hdsp *hdsp, int mode) | |||
2032 | case HDSP_CLOCK_SOURCE_AUTOSYNC: | 2053 | case HDSP_CLOCK_SOURCE_AUTOSYNC: |
2033 | if (hdsp_external_sample_rate(hdsp) != 0) { | 2054 | if (hdsp_external_sample_rate(hdsp) != 0) { |
2034 | if (!hdsp_set_rate(hdsp, hdsp_external_sample_rate(hdsp), 1)) { | 2055 | if (!hdsp_set_rate(hdsp, hdsp_external_sample_rate(hdsp), 1)) { |
2035 | hdsp->control_register &= ~HDSP_ClockModeMaster; | 2056 | hdsp->control_register &= ~HDSP_ClockModeMaster; |
2036 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); | 2057 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); |
2037 | return 0; | 2058 | return 0; |
2038 | } | 2059 | } |
@@ -2043,7 +2064,7 @@ static int hdsp_set_clock_source(struct hdsp *hdsp, int mode) | |||
2043 | break; | 2064 | break; |
2044 | case HDSP_CLOCK_SOURCE_INTERNAL_44_1KHZ: | 2065 | case HDSP_CLOCK_SOURCE_INTERNAL_44_1KHZ: |
2045 | rate = 44100; | 2066 | rate = 44100; |
2046 | break; | 2067 | break; |
2047 | case HDSP_CLOCK_SOURCE_INTERNAL_48KHZ: | 2068 | case HDSP_CLOCK_SOURCE_INTERNAL_48KHZ: |
2048 | rate = 48000; | 2069 | rate = 48000; |
2049 | break; | 2070 | break; |
@@ -2078,13 +2099,13 @@ static int snd_hdsp_info_clock_source(struct snd_kcontrol *kcontrol, struct snd_ | |||
2078 | { | 2099 | { |
2079 | static char *texts[] = {"AutoSync", "Internal 32.0 kHz", "Internal 44.1 kHz", "Internal 48.0 kHz", "Internal 64.0 kHz", "Internal 88.2 kHz", "Internal 96.0 kHz", "Internal 128 kHz", "Internal 176.4 kHz", "Internal 192.0 KHz" }; | 2100 | static char *texts[] = {"AutoSync", "Internal 32.0 kHz", "Internal 44.1 kHz", "Internal 48.0 kHz", "Internal 64.0 kHz", "Internal 88.2 kHz", "Internal 96.0 kHz", "Internal 128 kHz", "Internal 176.4 kHz", "Internal 192.0 KHz" }; |
2080 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2101 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2081 | 2102 | ||
2082 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2103 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2083 | uinfo->count = 1; | 2104 | uinfo->count = 1; |
2084 | if (hdsp->io_type == H9632) | 2105 | if (hdsp->io_type == H9632) |
2085 | uinfo->value.enumerated.items = 10; | 2106 | uinfo->value.enumerated.items = 10; |
2086 | else | 2107 | else |
2087 | uinfo->value.enumerated.items = 7; | 2108 | uinfo->value.enumerated.items = 7; |
2088 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | 2109 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) |
2089 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | 2110 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; |
2090 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | 2111 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
@@ -2094,7 +2115,7 @@ static int snd_hdsp_info_clock_source(struct snd_kcontrol *kcontrol, struct snd_ | |||
2094 | static int snd_hdsp_get_clock_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2115 | static int snd_hdsp_get_clock_source(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2095 | { | 2116 | { |
2096 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2117 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2097 | 2118 | ||
2098 | ucontrol->value.enumerated.item[0] = hdsp_clock_source(hdsp); | 2119 | ucontrol->value.enumerated.item[0] = hdsp_clock_source(hdsp); |
2099 | return 0; | 2120 | return 0; |
2100 | } | 2121 | } |
@@ -2104,7 +2125,7 @@ static int snd_hdsp_put_clock_source(struct snd_kcontrol *kcontrol, struct snd_c | |||
2104 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2125 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2105 | int change; | 2126 | int change; |
2106 | int val; | 2127 | int val; |
2107 | 2128 | ||
2108 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2129 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2109 | return -EBUSY; | 2130 | return -EBUSY; |
2110 | val = ucontrol->value.enumerated.item[0]; | 2131 | val = ucontrol->value.enumerated.item[0]; |
@@ -2130,7 +2151,7 @@ static int snd_hdsp_put_clock_source(struct snd_kcontrol *kcontrol, struct snd_c | |||
2130 | static int snd_hdsp_get_clock_source_lock(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2151 | static int snd_hdsp_get_clock_source_lock(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2131 | { | 2152 | { |
2132 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2153 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2133 | 2154 | ||
2134 | ucontrol->value.integer.value[0] = hdsp->clock_source_locked; | 2155 | ucontrol->value.integer.value[0] = hdsp->clock_source_locked; |
2135 | return 0; | 2156 | return 0; |
2136 | } | 2157 | } |
@@ -2165,7 +2186,7 @@ static int hdsp_da_gain(struct hdsp *hdsp) | |||
2165 | case HDSP_DAGainMinus10dBV: | 2186 | case HDSP_DAGainMinus10dBV: |
2166 | return 2; | 2187 | return 2; |
2167 | default: | 2188 | default: |
2168 | return 1; | 2189 | return 1; |
2169 | } | 2190 | } |
2170 | } | 2191 | } |
2171 | 2192 | ||
@@ -2180,8 +2201,8 @@ static int hdsp_set_da_gain(struct hdsp *hdsp, int mode) | |||
2180 | hdsp->control_register |= HDSP_DAGainPlus4dBu; | 2201 | hdsp->control_register |= HDSP_DAGainPlus4dBu; |
2181 | break; | 2202 | break; |
2182 | case 2: | 2203 | case 2: |
2183 | hdsp->control_register |= HDSP_DAGainMinus10dBV; | 2204 | hdsp->control_register |= HDSP_DAGainMinus10dBV; |
2184 | break; | 2205 | break; |
2185 | default: | 2206 | default: |
2186 | return -1; | 2207 | return -1; |
2187 | 2208 | ||
@@ -2193,7 +2214,7 @@ static int hdsp_set_da_gain(struct hdsp *hdsp, int mode) | |||
2193 | static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2214 | static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2194 | { | 2215 | { |
2195 | static char *texts[] = {"Hi Gain", "+4 dBu", "-10 dbV"}; | 2216 | static char *texts[] = {"Hi Gain", "+4 dBu", "-10 dbV"}; |
2196 | 2217 | ||
2197 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2218 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2198 | uinfo->count = 1; | 2219 | uinfo->count = 1; |
2199 | uinfo->value.enumerated.items = 3; | 2220 | uinfo->value.enumerated.items = 3; |
@@ -2206,7 +2227,7 @@ static int snd_hdsp_info_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
2206 | static int snd_hdsp_get_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2227 | static int snd_hdsp_get_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2207 | { | 2228 | { |
2208 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2229 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2209 | 2230 | ||
2210 | ucontrol->value.enumerated.item[0] = hdsp_da_gain(hdsp); | 2231 | ucontrol->value.enumerated.item[0] = hdsp_da_gain(hdsp); |
2211 | return 0; | 2232 | return 0; |
2212 | } | 2233 | } |
@@ -2216,7 +2237,7 @@ static int snd_hdsp_put_da_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_el | |||
2216 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2237 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2217 | int change; | 2238 | int change; |
2218 | int val; | 2239 | int val; |
2219 | 2240 | ||
2220 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2241 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2221 | return -EBUSY; | 2242 | return -EBUSY; |
2222 | val = ucontrol->value.enumerated.item[0]; | 2243 | val = ucontrol->value.enumerated.item[0]; |
@@ -2250,7 +2271,7 @@ static int hdsp_ad_gain(struct hdsp *hdsp) | |||
2250 | case HDSP_ADGainLowGain: | 2271 | case HDSP_ADGainLowGain: |
2251 | return 2; | 2272 | return 2; |
2252 | default: | 2273 | default: |
2253 | return 1; | 2274 | return 1; |
2254 | } | 2275 | } |
2255 | } | 2276 | } |
2256 | 2277 | ||
@@ -2262,11 +2283,11 @@ static int hdsp_set_ad_gain(struct hdsp *hdsp, int mode) | |||
2262 | hdsp->control_register |= HDSP_ADGainMinus10dBV; | 2283 | hdsp->control_register |= HDSP_ADGainMinus10dBV; |
2263 | break; | 2284 | break; |
2264 | case 1: | 2285 | case 1: |
2265 | hdsp->control_register |= HDSP_ADGainPlus4dBu; | 2286 | hdsp->control_register |= HDSP_ADGainPlus4dBu; |
2266 | break; | 2287 | break; |
2267 | case 2: | 2288 | case 2: |
2268 | hdsp->control_register |= HDSP_ADGainLowGain; | 2289 | hdsp->control_register |= HDSP_ADGainLowGain; |
2269 | break; | 2290 | break; |
2270 | default: | 2291 | default: |
2271 | return -1; | 2292 | return -1; |
2272 | 2293 | ||
@@ -2278,7 +2299,7 @@ static int hdsp_set_ad_gain(struct hdsp *hdsp, int mode) | |||
2278 | static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2299 | static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2279 | { | 2300 | { |
2280 | static char *texts[] = {"-10 dBV", "+4 dBu", "Lo Gain"}; | 2301 | static char *texts[] = {"-10 dBV", "+4 dBu", "Lo Gain"}; |
2281 | 2302 | ||
2282 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2303 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2283 | uinfo->count = 1; | 2304 | uinfo->count = 1; |
2284 | uinfo->value.enumerated.items = 3; | 2305 | uinfo->value.enumerated.items = 3; |
@@ -2291,7 +2312,7 @@ static int snd_hdsp_info_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
2291 | static int snd_hdsp_get_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2312 | static int snd_hdsp_get_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2292 | { | 2313 | { |
2293 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2314 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2294 | 2315 | ||
2295 | ucontrol->value.enumerated.item[0] = hdsp_ad_gain(hdsp); | 2316 | ucontrol->value.enumerated.item[0] = hdsp_ad_gain(hdsp); |
2296 | return 0; | 2317 | return 0; |
2297 | } | 2318 | } |
@@ -2301,7 +2322,7 @@ static int snd_hdsp_put_ad_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_el | |||
2301 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2322 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2302 | int change; | 2323 | int change; |
2303 | int val; | 2324 | int val; |
2304 | 2325 | ||
2305 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2326 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2306 | return -EBUSY; | 2327 | return -EBUSY; |
2307 | val = ucontrol->value.enumerated.item[0]; | 2328 | val = ucontrol->value.enumerated.item[0]; |
@@ -2335,7 +2356,7 @@ static int hdsp_phone_gain(struct hdsp *hdsp) | |||
2335 | case HDSP_PhoneGainMinus12dB: | 2356 | case HDSP_PhoneGainMinus12dB: |
2336 | return 2; | 2357 | return 2; |
2337 | default: | 2358 | default: |
2338 | return 0; | 2359 | return 0; |
2339 | } | 2360 | } |
2340 | } | 2361 | } |
2341 | 2362 | ||
@@ -2347,11 +2368,11 @@ static int hdsp_set_phone_gain(struct hdsp *hdsp, int mode) | |||
2347 | hdsp->control_register |= HDSP_PhoneGain0dB; | 2368 | hdsp->control_register |= HDSP_PhoneGain0dB; |
2348 | break; | 2369 | break; |
2349 | case 1: | 2370 | case 1: |
2350 | hdsp->control_register |= HDSP_PhoneGainMinus6dB; | 2371 | hdsp->control_register |= HDSP_PhoneGainMinus6dB; |
2351 | break; | 2372 | break; |
2352 | case 2: | 2373 | case 2: |
2353 | hdsp->control_register |= HDSP_PhoneGainMinus12dB; | 2374 | hdsp->control_register |= HDSP_PhoneGainMinus12dB; |
2354 | break; | 2375 | break; |
2355 | default: | 2376 | default: |
2356 | return -1; | 2377 | return -1; |
2357 | 2378 | ||
@@ -2363,7 +2384,7 @@ static int hdsp_set_phone_gain(struct hdsp *hdsp, int mode) | |||
2363 | static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2384 | static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2364 | { | 2385 | { |
2365 | static char *texts[] = {"0 dB", "-6 dB", "-12 dB"}; | 2386 | static char *texts[] = {"0 dB", "-6 dB", "-12 dB"}; |
2366 | 2387 | ||
2367 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2388 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2368 | uinfo->count = 1; | 2389 | uinfo->count = 1; |
2369 | uinfo->value.enumerated.items = 3; | 2390 | uinfo->value.enumerated.items = 3; |
@@ -2376,7 +2397,7 @@ static int snd_hdsp_info_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ct | |||
2376 | static int snd_hdsp_get_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2397 | static int snd_hdsp_get_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2377 | { | 2398 | { |
2378 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2399 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2379 | 2400 | ||
2380 | ucontrol->value.enumerated.item[0] = hdsp_phone_gain(hdsp); | 2401 | ucontrol->value.enumerated.item[0] = hdsp_phone_gain(hdsp); |
2381 | return 0; | 2402 | return 0; |
2382 | } | 2403 | } |
@@ -2386,7 +2407,7 @@ static int snd_hdsp_put_phone_gain(struct snd_kcontrol *kcontrol, struct snd_ctl | |||
2386 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2407 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2387 | int change; | 2408 | int change; |
2388 | int val; | 2409 | int val; |
2389 | 2410 | ||
2390 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2411 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2391 | return -EBUSY; | 2412 | return -EBUSY; |
2392 | val = ucontrol->value.enumerated.item[0]; | 2413 | val = ucontrol->value.enumerated.item[0]; |
@@ -2432,7 +2453,7 @@ static int hdsp_set_xlr_breakout_cable(struct hdsp *hdsp, int mode) | |||
2432 | static int snd_hdsp_get_xlr_breakout_cable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2453 | static int snd_hdsp_get_xlr_breakout_cable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2433 | { | 2454 | { |
2434 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2455 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2435 | 2456 | ||
2436 | ucontrol->value.enumerated.item[0] = hdsp_xlr_breakout_cable(hdsp); | 2457 | ucontrol->value.enumerated.item[0] = hdsp_xlr_breakout_cable(hdsp); |
2437 | return 0; | 2458 | return 0; |
2438 | } | 2459 | } |
@@ -2442,7 +2463,7 @@ static int snd_hdsp_put_xlr_breakout_cable(struct snd_kcontrol *kcontrol, struct | |||
2442 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2463 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2443 | int change; | 2464 | int change; |
2444 | int val; | 2465 | int val; |
2445 | 2466 | ||
2446 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2467 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2447 | return -EBUSY; | 2468 | return -EBUSY; |
2448 | val = ucontrol->value.integer.value[0] & 1; | 2469 | val = ucontrol->value.integer.value[0] & 1; |
@@ -2488,7 +2509,7 @@ static int hdsp_set_aeb(struct hdsp *hdsp, int mode) | |||
2488 | static int snd_hdsp_get_aeb(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2509 | static int snd_hdsp_get_aeb(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2489 | { | 2510 | { |
2490 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2511 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2491 | 2512 | ||
2492 | ucontrol->value.enumerated.item[0] = hdsp_aeb(hdsp); | 2513 | ucontrol->value.enumerated.item[0] = hdsp_aeb(hdsp); |
2493 | return 0; | 2514 | return 0; |
2494 | } | 2515 | } |
@@ -2498,7 +2519,7 @@ static int snd_hdsp_put_aeb(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_v | |||
2498 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2519 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2499 | int change; | 2520 | int change; |
2500 | int val; | 2521 | int val; |
2501 | 2522 | ||
2502 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2523 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2503 | return -EBUSY; | 2524 | return -EBUSY; |
2504 | val = ucontrol->value.integer.value[0] & 1; | 2525 | val = ucontrol->value.integer.value[0] & 1; |
@@ -2576,7 +2597,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd | |||
2576 | { | 2597 | { |
2577 | static char *texts[] = {"Word", "IEC958", "ADAT1", "ADAT Sync", "ADAT2", "ADAT3" }; | 2598 | static char *texts[] = {"Word", "IEC958", "ADAT1", "ADAT Sync", "ADAT2", "ADAT3" }; |
2578 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2599 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2579 | 2600 | ||
2580 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2601 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2581 | uinfo->count = 1; | 2602 | uinfo->count = 1; |
2582 | 2603 | ||
@@ -2595,7 +2616,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd | |||
2595 | uinfo->value.enumerated.items = 0; | 2616 | uinfo->value.enumerated.items = 0; |
2596 | break; | 2617 | break; |
2597 | } | 2618 | } |
2598 | 2619 | ||
2599 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | 2620 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) |
2600 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; | 2621 | uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; |
2601 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); | 2622 | strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); |
@@ -2605,7 +2626,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd | |||
2605 | static int snd_hdsp_get_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2626 | static int snd_hdsp_get_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2606 | { | 2627 | { |
2607 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2628 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2608 | 2629 | ||
2609 | ucontrol->value.enumerated.item[0] = hdsp_pref_sync_ref(hdsp); | 2630 | ucontrol->value.enumerated.item[0] = hdsp_pref_sync_ref(hdsp); |
2610 | return 0; | 2631 | return 0; |
2611 | } | 2632 | } |
@@ -2615,7 +2636,7 @@ static int snd_hdsp_put_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd_ | |||
2615 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2636 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2616 | int change, max; | 2637 | int change, max; |
2617 | unsigned int val; | 2638 | unsigned int val; |
2618 | 2639 | ||
2619 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2640 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2620 | return -EBUSY; | 2641 | return -EBUSY; |
2621 | 2642 | ||
@@ -2664,7 +2685,7 @@ static int hdsp_autosync_ref(struct hdsp *hdsp) | |||
2664 | case HDSP_SelSyncRef_SPDIF: | 2685 | case HDSP_SelSyncRef_SPDIF: |
2665 | return HDSP_AUTOSYNC_FROM_SPDIF; | 2686 | return HDSP_AUTOSYNC_FROM_SPDIF; |
2666 | case HDSP_SelSyncRefMask: | 2687 | case HDSP_SelSyncRefMask: |
2667 | return HDSP_AUTOSYNC_FROM_NONE; | 2688 | return HDSP_AUTOSYNC_FROM_NONE; |
2668 | case HDSP_SelSyncRef_ADAT1: | 2689 | case HDSP_SelSyncRef_ADAT1: |
2669 | return HDSP_AUTOSYNC_FROM_ADAT1; | 2690 | return HDSP_AUTOSYNC_FROM_ADAT1; |
2670 | case HDSP_SelSyncRef_ADAT2: | 2691 | case HDSP_SelSyncRef_ADAT2: |
@@ -2680,7 +2701,7 @@ static int hdsp_autosync_ref(struct hdsp *hdsp) | |||
2680 | static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2701 | static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2681 | { | 2702 | { |
2682 | static char *texts[] = {"Word", "ADAT Sync", "IEC958", "None", "ADAT1", "ADAT2", "ADAT3" }; | 2703 | static char *texts[] = {"Word", "ADAT Sync", "IEC958", "None", "ADAT1", "ADAT2", "ADAT3" }; |
2683 | 2704 | ||
2684 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2705 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2685 | uinfo->count = 1; | 2706 | uinfo->count = 1; |
2686 | uinfo->value.enumerated.items = 7; | 2707 | uinfo->value.enumerated.items = 7; |
@@ -2693,7 +2714,7 @@ static int snd_hdsp_info_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ | |||
2693 | static int snd_hdsp_get_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2714 | static int snd_hdsp_get_autosync_ref(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2694 | { | 2715 | { |
2695 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2716 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2696 | 2717 | ||
2697 | ucontrol->value.enumerated.item[0] = hdsp_autosync_ref(hdsp); | 2718 | ucontrol->value.enumerated.item[0] = hdsp_autosync_ref(hdsp); |
2698 | return 0; | 2719 | return 0; |
2699 | } | 2720 | } |
@@ -2727,7 +2748,7 @@ static int hdsp_set_line_output(struct hdsp *hdsp, int out) | |||
2727 | static int snd_hdsp_get_line_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2748 | static int snd_hdsp_get_line_out(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2728 | { | 2749 | { |
2729 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2750 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2730 | 2751 | ||
2731 | spin_lock_irq(&hdsp->lock); | 2752 | spin_lock_irq(&hdsp->lock); |
2732 | ucontrol->value.integer.value[0] = hdsp_line_out(hdsp); | 2753 | ucontrol->value.integer.value[0] = hdsp_line_out(hdsp); |
2733 | spin_unlock_irq(&hdsp->lock); | 2754 | spin_unlock_irq(&hdsp->lock); |
@@ -2739,7 +2760,7 @@ static int snd_hdsp_put_line_out(struct snd_kcontrol *kcontrol, struct snd_ctl_e | |||
2739 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2760 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2740 | int change; | 2761 | int change; |
2741 | unsigned int val; | 2762 | unsigned int val; |
2742 | 2763 | ||
2743 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2764 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2744 | return -EBUSY; | 2765 | return -EBUSY; |
2745 | val = ucontrol->value.integer.value[0] & 1; | 2766 | val = ucontrol->value.integer.value[0] & 1; |
@@ -2773,7 +2794,7 @@ static int hdsp_set_precise_pointer(struct hdsp *hdsp, int precise) | |||
2773 | static int snd_hdsp_get_precise_pointer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2794 | static int snd_hdsp_get_precise_pointer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2774 | { | 2795 | { |
2775 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2796 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2776 | 2797 | ||
2777 | spin_lock_irq(&hdsp->lock); | 2798 | spin_lock_irq(&hdsp->lock); |
2778 | ucontrol->value.integer.value[0] = hdsp->precise_ptr; | 2799 | ucontrol->value.integer.value[0] = hdsp->precise_ptr; |
2779 | spin_unlock_irq(&hdsp->lock); | 2800 | spin_unlock_irq(&hdsp->lock); |
@@ -2785,7 +2806,7 @@ static int snd_hdsp_put_precise_pointer(struct snd_kcontrol *kcontrol, struct sn | |||
2785 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2806 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2786 | int change; | 2807 | int change; |
2787 | unsigned int val; | 2808 | unsigned int val; |
2788 | 2809 | ||
2789 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2810 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2790 | return -EBUSY; | 2811 | return -EBUSY; |
2791 | val = ucontrol->value.integer.value[0] & 1; | 2812 | val = ucontrol->value.integer.value[0] & 1; |
@@ -2819,7 +2840,7 @@ static int hdsp_set_use_midi_tasklet(struct hdsp *hdsp, int use_tasklet) | |||
2819 | static int snd_hdsp_get_use_midi_tasklet(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 2840 | static int snd_hdsp_get_use_midi_tasklet(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
2820 | { | 2841 | { |
2821 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2842 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2822 | 2843 | ||
2823 | spin_lock_irq(&hdsp->lock); | 2844 | spin_lock_irq(&hdsp->lock); |
2824 | ucontrol->value.integer.value[0] = hdsp->use_midi_tasklet; | 2845 | ucontrol->value.integer.value[0] = hdsp->use_midi_tasklet; |
2825 | spin_unlock_irq(&hdsp->lock); | 2846 | spin_unlock_irq(&hdsp->lock); |
@@ -2831,7 +2852,7 @@ static int snd_hdsp_put_use_midi_tasklet(struct snd_kcontrol *kcontrol, struct s | |||
2831 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 2852 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
2832 | int change; | 2853 | int change; |
2833 | unsigned int val; | 2854 | unsigned int val; |
2834 | 2855 | ||
2835 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 2856 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
2836 | return -EBUSY; | 2857 | return -EBUSY; |
2837 | val = ucontrol->value.integer.value[0] & 1; | 2858 | val = ucontrol->value.integer.value[0] & 1; |
@@ -2873,12 +2894,12 @@ static int snd_hdsp_get_mixer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
2873 | 2894 | ||
2874 | source = ucontrol->value.integer.value[0]; | 2895 | source = ucontrol->value.integer.value[0]; |
2875 | destination = ucontrol->value.integer.value[1]; | 2896 | destination = ucontrol->value.integer.value[1]; |
2876 | 2897 | ||
2877 | if (source >= hdsp->max_channels) | 2898 | if (source >= hdsp->max_channels) |
2878 | addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels,destination); | 2899 | addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels,destination); |
2879 | else | 2900 | else |
2880 | addr = hdsp_input_to_output_key(hdsp,source, destination); | 2901 | addr = hdsp_input_to_output_key(hdsp,source, destination); |
2881 | 2902 | ||
2882 | spin_lock_irq(&hdsp->lock); | 2903 | spin_lock_irq(&hdsp->lock); |
2883 | ucontrol->value.integer.value[2] = hdsp_read_gain (hdsp, addr); | 2904 | ucontrol->value.integer.value[2] = hdsp_read_gain (hdsp, addr); |
2884 | spin_unlock_irq(&hdsp->lock); | 2905 | spin_unlock_irq(&hdsp->lock); |
@@ -2926,7 +2947,7 @@ static int snd_hdsp_put_mixer(struct snd_kcontrol *kcontrol, struct snd_ctl_elem | |||
2926 | 2947 | ||
2927 | static int snd_hdsp_info_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) | 2948 | static int snd_hdsp_info_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) |
2928 | { | 2949 | { |
2929 | static char *texts[] = {"No Lock", "Lock", "Sync" }; | 2950 | static char *texts[] = {"No Lock", "Lock", "Sync" }; |
2930 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2951 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2931 | uinfo->count = 1; | 2952 | uinfo->count = 1; |
2932 | uinfo->value.enumerated.items = 3; | 2953 | uinfo->value.enumerated.items = 3; |
@@ -2971,7 +2992,7 @@ static int hdsp_spdif_sync_check(struct hdsp *hdsp) | |||
2971 | int status = hdsp_read(hdsp, HDSP_statusRegister); | 2992 | int status = hdsp_read(hdsp, HDSP_statusRegister); |
2972 | if (status & HDSP_SPDIFErrorFlag) | 2993 | if (status & HDSP_SPDIFErrorFlag) |
2973 | return 0; | 2994 | return 0; |
2974 | else { | 2995 | else { |
2975 | if (status & HDSP_SPDIFSync) | 2996 | if (status & HDSP_SPDIFSync) |
2976 | return 2; | 2997 | return 2; |
2977 | else | 2998 | else |
@@ -3007,7 +3028,7 @@ static int hdsp_adatsync_sync_check(struct hdsp *hdsp) | |||
3007 | return 1; | 3028 | return 1; |
3008 | } else | 3029 | } else |
3009 | return 0; | 3030 | return 0; |
3010 | } | 3031 | } |
3011 | 3032 | ||
3012 | static int snd_hdsp_get_adatsync_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 3033 | static int snd_hdsp_get_adatsync_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
3013 | { | 3034 | { |
@@ -3025,17 +3046,17 @@ static int snd_hdsp_get_adatsync_sync_check(struct snd_kcontrol *kcontrol, struc | |||
3025 | } | 3046 | } |
3026 | 3047 | ||
3027 | static int hdsp_adat_sync_check(struct hdsp *hdsp, int idx) | 3048 | static int hdsp_adat_sync_check(struct hdsp *hdsp, int idx) |
3028 | { | 3049 | { |
3029 | int status = hdsp_read(hdsp, HDSP_statusRegister); | 3050 | int status = hdsp_read(hdsp, HDSP_statusRegister); |
3030 | 3051 | ||
3031 | if (status & (HDSP_Lock0>>idx)) { | 3052 | if (status & (HDSP_Lock0>>idx)) { |
3032 | if (status & (HDSP_Sync0>>idx)) | 3053 | if (status & (HDSP_Sync0>>idx)) |
3033 | return 2; | 3054 | return 2; |
3034 | else | 3055 | else |
3035 | return 1; | 3056 | return 1; |
3036 | } else | 3057 | } else |
3037 | return 0; | 3058 | return 0; |
3038 | } | 3059 | } |
3039 | 3060 | ||
3040 | static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 3061 | static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
3041 | { | 3062 | { |
@@ -3053,7 +3074,7 @@ static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct sn | |||
3053 | break; | 3074 | break; |
3054 | case Multiface: | 3075 | case Multiface: |
3055 | case H9632: | 3076 | case H9632: |
3056 | if (offset >= 1) | 3077 | if (offset >= 1) |
3057 | return -EINVAL; | 3078 | return -EINVAL; |
3058 | break; | 3079 | break; |
3059 | default: | 3080 | default: |
@@ -3115,7 +3136,7 @@ static int snd_hdsp_info_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ct | |||
3115 | static int snd_hdsp_get_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) | 3136 | static int snd_hdsp_get_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) |
3116 | { | 3137 | { |
3117 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 3138 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
3118 | 3139 | ||
3119 | ucontrol->value.enumerated.item[0] = hdsp_dds_offset(hdsp); | 3140 | ucontrol->value.enumerated.item[0] = hdsp_dds_offset(hdsp); |
3120 | return 0; | 3141 | return 0; |
3121 | } | 3142 | } |
@@ -3125,7 +3146,7 @@ static int snd_hdsp_put_dds_offset(struct snd_kcontrol *kcontrol, struct snd_ctl | |||
3125 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); | 3146 | struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); |
3126 | int change; | 3147 | int change; |
3127 | int val; | 3148 | int val; |
3128 | 3149 | ||
3129 | if (!snd_hdsp_use_is_exclusive(hdsp)) | 3150 | if (!snd_hdsp_use_is_exclusive(hdsp)) |
3130 | return -EBUSY; | 3151 | return -EBUSY; |
3131 | val = ucontrol->value.enumerated.item[0]; | 3152 | val = ucontrol->value.enumerated.item[0]; |
@@ -3170,7 +3191,7 @@ static struct snd_kcontrol_new snd_hdsp_controls[] = { | |||
3170 | .get = snd_hdsp_control_spdif_mask_get, | 3191 | .get = snd_hdsp_control_spdif_mask_get, |
3171 | .private_value = IEC958_AES0_NONAUDIO | | 3192 | .private_value = IEC958_AES0_NONAUDIO | |
3172 | IEC958_AES0_PROFESSIONAL | | 3193 | IEC958_AES0_PROFESSIONAL | |
3173 | IEC958_AES0_CON_EMPHASIS, | 3194 | IEC958_AES0_CON_EMPHASIS, |
3174 | }, | 3195 | }, |
3175 | { | 3196 | { |
3176 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 3197 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
@@ -3188,7 +3209,7 @@ HDSP_SPDIF_OUT("IEC958 Output also on ADAT1", 0), | |||
3188 | HDSP_SPDIF_PROFESSIONAL("IEC958 Professional Bit", 0), | 3209 | HDSP_SPDIF_PROFESSIONAL("IEC958 Professional Bit", 0), |
3189 | HDSP_SPDIF_EMPHASIS("IEC958 Emphasis Bit", 0), | 3210 | HDSP_SPDIF_EMPHASIS("IEC958 Emphasis Bit", 0), |
3190 | HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0), | 3211 | HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0), |
3191 | /* 'Sample Clock Source' complies with the alsa control naming scheme */ | 3212 | /* 'Sample Clock Source' complies with the alsa control naming scheme */ |
3192 | HDSP_CLOCK_SOURCE("Sample Clock Source", 0), | 3213 | HDSP_CLOCK_SOURCE("Sample Clock Source", 0), |
3193 | { | 3214 | { |
3194 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 3215 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
@@ -3240,7 +3261,7 @@ static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp) | |||
3240 | return err; | 3261 | return err; |
3241 | } | 3262 | } |
3242 | } | 3263 | } |
3243 | 3264 | ||
3244 | /* DA, AD and Phone gain and XLR breakout cable controls for H9632 cards */ | 3265 | /* DA, AD and Phone gain and XLR breakout cable controls for H9632 cards */ |
3245 | if (hdsp->io_type == H9632) { | 3266 | if (hdsp->io_type == H9632) { |
3246 | for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) { | 3267 | for (idx = 0; idx < ARRAY_SIZE(snd_hdsp_9632_controls); idx++) { |
@@ -3259,7 +3280,7 @@ static int snd_hdsp_create_controls(struct snd_card *card, struct hdsp *hdsp) | |||
3259 | } | 3280 | } |
3260 | 3281 | ||
3261 | /*------------------------------------------------------------ | 3282 | /*------------------------------------------------------------ |
3262 | /proc interface | 3283 | /proc interface |
3263 | ------------------------------------------------------------*/ | 3284 | ------------------------------------------------------------*/ |
3264 | 3285 | ||
3265 | static void | 3286 | static void |
@@ -3298,7 +3319,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3298 | } | 3319 | } |
3299 | } | 3320 | } |
3300 | } | 3321 | } |
3301 | 3322 | ||
3302 | status = hdsp_read(hdsp, HDSP_statusRegister); | 3323 | status = hdsp_read(hdsp, HDSP_statusRegister); |
3303 | status2 = hdsp_read(hdsp, HDSP_status2Register); | 3324 | status2 = hdsp_read(hdsp, HDSP_status2Register); |
3304 | 3325 | ||
@@ -3362,17 +3383,17 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3362 | break; | 3383 | break; |
3363 | case HDSP_CLOCK_SOURCE_INTERNAL_192KHZ: | 3384 | case HDSP_CLOCK_SOURCE_INTERNAL_192KHZ: |
3364 | clock_source = "Internal 192 kHz"; | 3385 | clock_source = "Internal 192 kHz"; |
3365 | break; | 3386 | break; |
3366 | default: | 3387 | default: |
3367 | clock_source = "Error"; | 3388 | clock_source = "Error"; |
3368 | } | 3389 | } |
3369 | snd_iprintf (buffer, "Sample Clock Source: %s\n", clock_source); | 3390 | snd_iprintf (buffer, "Sample Clock Source: %s\n", clock_source); |
3370 | 3391 | ||
3371 | if (hdsp_system_clock_mode(hdsp)) | 3392 | if (hdsp_system_clock_mode(hdsp)) |
3372 | system_clock_mode = "Slave"; | 3393 | system_clock_mode = "Slave"; |
3373 | else | 3394 | else |
3374 | system_clock_mode = "Master"; | 3395 | system_clock_mode = "Master"; |
3375 | 3396 | ||
3376 | switch (hdsp_pref_sync_ref (hdsp)) { | 3397 | switch (hdsp_pref_sync_ref (hdsp)) { |
3377 | case HDSP_SYNC_FROM_WORD: | 3398 | case HDSP_SYNC_FROM_WORD: |
3378 | pref_sync_ref = "Word Clock"; | 3399 | pref_sync_ref = "Word Clock"; |
@@ -3397,7 +3418,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3397 | break; | 3418 | break; |
3398 | } | 3419 | } |
3399 | snd_iprintf (buffer, "Preferred Sync Reference: %s\n", pref_sync_ref); | 3420 | snd_iprintf (buffer, "Preferred Sync Reference: %s\n", pref_sync_ref); |
3400 | 3421 | ||
3401 | switch (hdsp_autosync_ref (hdsp)) { | 3422 | switch (hdsp_autosync_ref (hdsp)) { |
3402 | case HDSP_AUTOSYNC_FROM_WORD: | 3423 | case HDSP_AUTOSYNC_FROM_WORD: |
3403 | autosync_ref = "Word Clock"; | 3424 | autosync_ref = "Word Clock"; |
@@ -3410,7 +3431,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3410 | break; | 3431 | break; |
3411 | case HDSP_AUTOSYNC_FROM_NONE: | 3432 | case HDSP_AUTOSYNC_FROM_NONE: |
3412 | autosync_ref = "None"; | 3433 | autosync_ref = "None"; |
3413 | break; | 3434 | break; |
3414 | case HDSP_AUTOSYNC_FROM_ADAT1: | 3435 | case HDSP_AUTOSYNC_FROM_ADAT1: |
3415 | autosync_ref = "ADAT1"; | 3436 | autosync_ref = "ADAT1"; |
3416 | break; | 3437 | break; |
@@ -3425,14 +3446,14 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3425 | break; | 3446 | break; |
3426 | } | 3447 | } |
3427 | snd_iprintf (buffer, "AutoSync Reference: %s\n", autosync_ref); | 3448 | snd_iprintf (buffer, "AutoSync Reference: %s\n", autosync_ref); |
3428 | 3449 | ||
3429 | snd_iprintf (buffer, "AutoSync Frequency: %d\n", hdsp_external_sample_rate(hdsp)); | 3450 | snd_iprintf (buffer, "AutoSync Frequency: %d\n", hdsp_external_sample_rate(hdsp)); |
3430 | 3451 | ||
3431 | snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode); | 3452 | snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode); |
3432 | 3453 | ||
3433 | snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate); | 3454 | snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate); |
3434 | snd_iprintf (buffer, "System Clock Locked: %s\n", hdsp->clock_source_locked ? "Yes" : "No"); | 3455 | snd_iprintf (buffer, "System Clock Locked: %s\n", hdsp->clock_source_locked ? "Yes" : "No"); |
3435 | 3456 | ||
3436 | snd_iprintf(buffer, "\n"); | 3457 | snd_iprintf(buffer, "\n"); |
3437 | 3458 | ||
3438 | switch (hdsp_spdif_in(hdsp)) { | 3459 | switch (hdsp_spdif_in(hdsp)) { |
@@ -3452,7 +3473,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3452 | snd_iprintf(buffer, "IEC958 input: ???\n"); | 3473 | snd_iprintf(buffer, "IEC958 input: ???\n"); |
3453 | break; | 3474 | break; |
3454 | } | 3475 | } |
3455 | 3476 | ||
3456 | if (hdsp->control_register & HDSP_SPDIFOpticalOut) | 3477 | if (hdsp->control_register & HDSP_SPDIFOpticalOut) |
3457 | snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n"); | 3478 | snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n"); |
3458 | else | 3479 | else |
@@ -3510,13 +3531,13 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3510 | snd_iprintf (buffer, "SPDIF: No Lock\n"); | 3531 | snd_iprintf (buffer, "SPDIF: No Lock\n"); |
3511 | else | 3532 | else |
3512 | snd_iprintf (buffer, "SPDIF: %s\n", x ? "Sync" : "Lock"); | 3533 | snd_iprintf (buffer, "SPDIF: %s\n", x ? "Sync" : "Lock"); |
3513 | 3534 | ||
3514 | x = status2 & HDSP_wc_sync; | 3535 | x = status2 & HDSP_wc_sync; |
3515 | if (status2 & HDSP_wc_lock) | 3536 | if (status2 & HDSP_wc_lock) |
3516 | snd_iprintf (buffer, "Word Clock: %s\n", x ? "Sync" : "Lock"); | 3537 | snd_iprintf (buffer, "Word Clock: %s\n", x ? "Sync" : "Lock"); |
3517 | else | 3538 | else |
3518 | snd_iprintf (buffer, "Word Clock: No Lock\n"); | 3539 | snd_iprintf (buffer, "Word Clock: No Lock\n"); |
3519 | 3540 | ||
3520 | x = status & HDSP_TimecodeSync; | 3541 | x = status & HDSP_TimecodeSync; |
3521 | if (status & HDSP_TimecodeLock) | 3542 | if (status & HDSP_TimecodeLock) |
3522 | snd_iprintf(buffer, "ADAT Sync: %s\n", x ? "Sync" : "Lock"); | 3543 | snd_iprintf(buffer, "ADAT Sync: %s\n", x ? "Sync" : "Lock"); |
@@ -3524,11 +3545,11 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3524 | snd_iprintf(buffer, "ADAT Sync: No Lock\n"); | 3545 | snd_iprintf(buffer, "ADAT Sync: No Lock\n"); |
3525 | 3546 | ||
3526 | snd_iprintf(buffer, "\n"); | 3547 | snd_iprintf(buffer, "\n"); |
3527 | 3548 | ||
3528 | /* Informations about H9632 specific controls */ | 3549 | /* Informations about H9632 specific controls */ |
3529 | if (hdsp->io_type == H9632) { | 3550 | if (hdsp->io_type == H9632) { |
3530 | char *tmp; | 3551 | char *tmp; |
3531 | 3552 | ||
3532 | switch (hdsp_ad_gain(hdsp)) { | 3553 | switch (hdsp_ad_gain(hdsp)) { |
3533 | case 0: | 3554 | case 0: |
3534 | tmp = "-10 dBV"; | 3555 | tmp = "-10 dBV"; |
@@ -3554,7 +3575,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3554 | break; | 3575 | break; |
3555 | } | 3576 | } |
3556 | snd_iprintf(buffer, "DA Gain : %s\n", tmp); | 3577 | snd_iprintf(buffer, "DA Gain : %s\n", tmp); |
3557 | 3578 | ||
3558 | switch (hdsp_phone_gain(hdsp)) { | 3579 | switch (hdsp_phone_gain(hdsp)) { |
3559 | case 0: | 3580 | case 0: |
3560 | tmp = "0 dB"; | 3581 | tmp = "0 dB"; |
@@ -3568,8 +3589,8 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) | |||
3568 | } | 3589 | } |
3569 | snd_iprintf(buffer, "Phones Gain : %s\n", tmp); | 3590 | snd_iprintf(buffer, "Phones Gain : %s\n", tmp); |
3570 | 3591 | ||
3571 | snd_iprintf(buffer, "XLR Breakout Cable : %s\n", hdsp_xlr_breakout_cable(hdsp) ? "yes" : "no"); | 3592 | snd_iprintf(buffer, "XLR Breakout Cable : %s\n", hdsp_xlr_breakout_cable(hdsp) ? "yes" : "no"); |
3572 | 3593 | ||
3573 | if (hdsp->control_register & HDSP_AnalogExtensionBoard) | 3594 | if (hdsp->control_register & HDSP_AnalogExtensionBoard) |
3574 | snd_iprintf(buffer, "AEB : on (ADAT1 internal)\n"); | 3595 | snd_iprintf(buffer, "AEB : on (ADAT1 internal)\n"); |
3575 | else | 3596 | else |
@@ -3632,18 +3653,18 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) | |||
3632 | 3653 | ||
3633 | /* set defaults: | 3654 | /* set defaults: |
3634 | 3655 | ||
3635 | SPDIF Input via Coax | 3656 | SPDIF Input via Coax |
3636 | Master clock mode | 3657 | Master clock mode |
3637 | maximum latency (7 => 2^7 = 8192 samples, 64Kbyte buffer, | 3658 | maximum latency (7 => 2^7 = 8192 samples, 64Kbyte buffer, |
3638 | which implies 2 4096 sample, 32Kbyte periods). | 3659 | which implies 2 4096 sample, 32Kbyte periods). |
3639 | Enable line out. | 3660 | Enable line out. |
3640 | */ | 3661 | */ |
3641 | 3662 | ||
3642 | hdsp->control_register = HDSP_ClockModeMaster | | 3663 | hdsp->control_register = HDSP_ClockModeMaster | |
3643 | HDSP_SPDIFInputCoaxial | | 3664 | HDSP_SPDIFInputCoaxial | |
3644 | hdsp_encode_latency(7) | | 3665 | hdsp_encode_latency(7) | |
3645 | HDSP_LineOut; | 3666 | HDSP_LineOut; |
3646 | 3667 | ||
3647 | 3668 | ||
3648 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); | 3669 | hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); |
3649 | 3670 | ||
@@ -3661,7 +3682,7 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) | |||
3661 | hdsp_compute_period_size(hdsp); | 3682 | hdsp_compute_period_size(hdsp); |
3662 | 3683 | ||
3663 | /* silence everything */ | 3684 | /* silence everything */ |
3664 | 3685 | ||
3665 | for (i = 0; i < HDSP_MATRIX_MIXER_SIZE; ++i) | 3686 | for (i = 0; i < HDSP_MATRIX_MIXER_SIZE; ++i) |
3666 | hdsp->mixer_matrix[i] = MINUS_INFINITY_GAIN; | 3687 | hdsp->mixer_matrix[i] = MINUS_INFINITY_GAIN; |
3667 | 3688 | ||
@@ -3669,7 +3690,7 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) | |||
3669 | if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) | 3690 | if (hdsp_write_gain (hdsp, i, MINUS_INFINITY_GAIN)) |
3670 | return -EIO; | 3691 | return -EIO; |
3671 | } | 3692 | } |
3672 | 3693 | ||
3673 | /* H9632 specific defaults */ | 3694 | /* H9632 specific defaults */ |
3674 | if (hdsp->io_type == H9632) { | 3695 | if (hdsp->io_type == H9632) { |
3675 | hdsp->control_register |= (HDSP_DAGainPlus4dBu | HDSP_ADGainPlus4dBu | HDSP_PhoneGain0dB); | 3696 | hdsp->control_register |= (HDSP_DAGainPlus4dBu | HDSP_ADGainPlus4dBu | HDSP_PhoneGain0dB); |
@@ -3687,12 +3708,12 @@ static int snd_hdsp_set_defaults(struct hdsp *hdsp) | |||
3687 | static void hdsp_midi_tasklet(unsigned long arg) | 3708 | static void hdsp_midi_tasklet(unsigned long arg) |
3688 | { | 3709 | { |
3689 | struct hdsp *hdsp = (struct hdsp *)arg; | 3710 | struct hdsp *hdsp = (struct hdsp *)arg; |
3690 | 3711 | ||
3691 | if (hdsp->midi[0].pending) | 3712 | if (hdsp->midi[0].pending) |
3692 | snd_hdsp_midi_input_read (&hdsp->midi[0]); | 3713 | snd_hdsp_midi_input_read (&hdsp->midi[0]); |
3693 | if (hdsp->midi[1].pending) | 3714 | if (hdsp->midi[1].pending) |
3694 | snd_hdsp_midi_input_read (&hdsp->midi[1]); | 3715 | snd_hdsp_midi_input_read (&hdsp->midi[1]); |
3695 | } | 3716 | } |
3696 | 3717 | ||
3697 | static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) | 3718 | static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) |
3698 | { | 3719 | { |
@@ -3704,7 +3725,7 @@ static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) | |||
3704 | unsigned int midi0status; | 3725 | unsigned int midi0status; |
3705 | unsigned int midi1status; | 3726 | unsigned int midi1status; |
3706 | int schedule = 0; | 3727 | int schedule = 0; |
3707 | 3728 | ||
3708 | status = hdsp_read(hdsp, HDSP_statusRegister); | 3729 | status = hdsp_read(hdsp, HDSP_statusRegister); |
3709 | 3730 | ||
3710 | audio = status & HDSP_audioIRQPending; | 3731 | audio = status & HDSP_audioIRQPending; |
@@ -3718,15 +3739,18 @@ static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) | |||
3718 | 3739 | ||
3719 | midi0status = hdsp_read (hdsp, HDSP_midiStatusIn0) & 0xff; | 3740 | midi0status = hdsp_read (hdsp, HDSP_midiStatusIn0) & 0xff; |
3720 | midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff; | 3741 | midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff; |
3721 | 3742 | ||
3743 | if (!(hdsp->state & HDSP_InitializationComplete)) | ||
3744 | return IRQ_HANDLED; | ||
3745 | |||
3722 | if (audio) { | 3746 | if (audio) { |
3723 | if (hdsp->capture_substream) | 3747 | if (hdsp->capture_substream) |
3724 | snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); | 3748 | snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); |
3725 | 3749 | ||
3726 | if (hdsp->playback_substream) | 3750 | if (hdsp->playback_substream) |
3727 | snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); | 3751 | snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); |
3728 | } | 3752 | } |
3729 | 3753 | ||
3730 | if (midi0 && midi0status) { | 3754 | if (midi0 && midi0status) { |
3731 | if (hdsp->use_midi_tasklet) { | 3755 | if (hdsp->use_midi_tasklet) { |
3732 | /* we disable interrupts for this input until processing is done */ | 3756 | /* we disable interrupts for this input until processing is done */ |
@@ -3769,10 +3793,10 @@ static char *hdsp_channel_buffer_location(struct hdsp *hdsp, | |||
3769 | 3793 | ||
3770 | if (snd_BUG_ON(channel < 0 || channel >= hdsp->max_channels)) | 3794 | if (snd_BUG_ON(channel < 0 || channel >= hdsp->max_channels)) |
3771 | return NULL; | 3795 | return NULL; |
3772 | 3796 | ||
3773 | if ((mapped_channel = hdsp->channel_map[channel]) < 0) | 3797 | if ((mapped_channel = hdsp->channel_map[channel]) < 0) |
3774 | return NULL; | 3798 | return NULL; |
3775 | 3799 | ||
3776 | if (stream == SNDRV_PCM_STREAM_CAPTURE) | 3800 | if (stream == SNDRV_PCM_STREAM_CAPTURE) |
3777 | return hdsp->capture_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES); | 3801 | return hdsp->capture_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES); |
3778 | else | 3802 | else |
@@ -3965,7 +3989,7 @@ static int snd_hdsp_trigger(struct snd_pcm_substream *substream, int cmd) | |||
3965 | struct hdsp *hdsp = snd_pcm_substream_chip(substream); | 3989 | struct hdsp *hdsp = snd_pcm_substream_chip(substream); |
3966 | struct snd_pcm_substream *other; | 3990 | struct snd_pcm_substream *other; |
3967 | int running; | 3991 | int running; |
3968 | 3992 | ||
3969 | if (hdsp_check_for_iobox (hdsp)) | 3993 | if (hdsp_check_for_iobox (hdsp)) |
3970 | return -EIO; | 3994 | return -EIO; |
3971 | 3995 | ||
@@ -4059,10 +4083,10 @@ static struct snd_pcm_hardware snd_hdsp_playback_subinfo = | |||
4059 | .formats = SNDRV_PCM_FMTBIT_S32_LE, | 4083 | .formats = SNDRV_PCM_FMTBIT_S32_LE, |
4060 | #endif | 4084 | #endif |
4061 | .rates = (SNDRV_PCM_RATE_32000 | | 4085 | .rates = (SNDRV_PCM_RATE_32000 | |
4062 | SNDRV_PCM_RATE_44100 | | 4086 | SNDRV_PCM_RATE_44100 | |
4063 | SNDRV_PCM_RATE_48000 | | 4087 | SNDRV_PCM_RATE_48000 | |
4064 | SNDRV_PCM_RATE_64000 | | 4088 | SNDRV_PCM_RATE_64000 | |
4065 | SNDRV_PCM_RATE_88200 | | 4089 | SNDRV_PCM_RATE_88200 | |
4066 | SNDRV_PCM_RATE_96000), | 4090 | SNDRV_PCM_RATE_96000), |
4067 | .rate_min = 32000, | 4091 | .rate_min = 32000, |
4068 | .rate_max = 96000, | 4092 | .rate_max = 96000, |
@@ -4088,10 +4112,10 @@ static struct snd_pcm_hardware snd_hdsp_capture_subinfo = | |||
4088 | .formats = SNDRV_PCM_FMTBIT_S32_LE, | 4112 | .formats = SNDRV_PCM_FMTBIT_S32_LE, |
4089 | #endif | 4113 | #endif |
4090 | .rates = (SNDRV_PCM_RATE_32000 | | 4114 | .rates = (SNDRV_PCM_RATE_32000 | |
4091 | SNDRV_PCM_RATE_44100 | | 4115 | SNDRV_PCM_RATE_44100 | |
4092 | SNDRV_PCM_RATE_48000 | | 4116 | SNDRV_PCM_RATE_48000 | |
4093 | SNDRV_PCM_RATE_64000 | | 4117 | SNDRV_PCM_RATE_64000 | |
4094 | SNDRV_PCM_RATE_88200 | | 4118 | SNDRV_PCM_RATE_88200 | |
4095 | SNDRV_PCM_RATE_96000), | 4119 | SNDRV_PCM_RATE_96000), |
4096 | .rate_min = 32000, | 4120 | .rate_min = 32000, |
4097 | .rate_max = 96000, | 4121 | .rate_max = 96000, |
@@ -4170,7 +4194,7 @@ static int snd_hdsp_hw_rule_in_channels_rate(struct snd_pcm_hw_params *params, | |||
4170 | .max = hdsp->qs_in_channels, | 4194 | .max = hdsp->qs_in_channels, |
4171 | .integer = 1, | 4195 | .integer = 1, |
4172 | }; | 4196 | }; |
4173 | return snd_interval_refine(c, &t); | 4197 | return snd_interval_refine(c, &t); |
4174 | } else if (r->min > 48000 && r->max <= 96000) { | 4198 | } else if (r->min > 48000 && r->max <= 96000) { |
4175 | struct snd_interval t = { | 4199 | struct snd_interval t = { |
4176 | .min = hdsp->ds_in_channels, | 4200 | .min = hdsp->ds_in_channels, |
@@ -4201,7 +4225,7 @@ static int snd_hdsp_hw_rule_out_channels_rate(struct snd_pcm_hw_params *params, | |||
4201 | .max = hdsp->qs_out_channels, | 4225 | .max = hdsp->qs_out_channels, |
4202 | .integer = 1, | 4226 | .integer = 1, |
4203 | }; | 4227 | }; |
4204 | return snd_interval_refine(c, &t); | 4228 | return snd_interval_refine(c, &t); |
4205 | } else if (r->min > 48000 && r->max <= 96000) { | 4229 | } else if (r->min > 48000 && r->max <= 96000) { |
4206 | struct snd_interval t = { | 4230 | struct snd_interval t = { |
4207 | .min = hdsp->ds_out_channels, | 4231 | .min = hdsp->ds_out_channels, |
@@ -4318,8 +4342,8 @@ static int snd_hdsp_playback_open(struct snd_pcm_substream *substream) | |||
4318 | if (hdsp->io_type == H9632) { | 4342 | if (hdsp->io_type == H9632) { |
4319 | runtime->hw.channels_min = hdsp->qs_out_channels; | 4343 | runtime->hw.channels_min = hdsp->qs_out_channels; |
4320 | runtime->hw.channels_max = hdsp->ss_out_channels; | 4344 | runtime->hw.channels_max = hdsp->ss_out_channels; |
4321 | } | 4345 | } |
4322 | 4346 | ||
4323 | snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, | 4347 | snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, |
4324 | snd_hdsp_hw_rule_out_channels, hdsp, | 4348 | snd_hdsp_hw_rule_out_channels, hdsp, |
4325 | SNDRV_PCM_HW_PARAM_CHANNELS, -1); | 4349 | SNDRV_PCM_HW_PARAM_CHANNELS, -1); |
@@ -4413,13 +4437,6 @@ static int snd_hdsp_capture_release(struct snd_pcm_substream *substream) | |||
4413 | return 0; | 4437 | return 0; |
4414 | } | 4438 | } |
4415 | 4439 | ||
4416 | static int snd_hdsp_hwdep_dummy_op(struct snd_hwdep *hw, struct file *file) | ||
4417 | { | ||
4418 | /* we have nothing to initialize but the call is required */ | ||
4419 | return 0; | ||
4420 | } | ||
4421 | |||
4422 | |||
4423 | /* helper functions for copying meter values */ | 4440 | /* helper functions for copying meter values */ |
4424 | static inline int copy_u32_le(void __user *dest, void __iomem *src) | 4441 | static inline int copy_u32_le(void __user *dest, void __iomem *src) |
4425 | { | 4442 | { |
@@ -4536,7 +4553,7 @@ static int hdsp_get_peak(struct hdsp *hdsp, struct hdsp_peak_rms __user *peak_rm | |||
4536 | hdsp->iobase + HDSP_playbackRmsLevel + i * 8 + 4, | 4553 | hdsp->iobase + HDSP_playbackRmsLevel + i * 8 + 4, |
4537 | hdsp->iobase + HDSP_playbackRmsLevel + i * 8)) | 4554 | hdsp->iobase + HDSP_playbackRmsLevel + i * 8)) |
4538 | return -EFAULT; | 4555 | return -EFAULT; |
4539 | if (copy_u64_le(&peak_rms->input_rms[i], | 4556 | if (copy_u64_le(&peak_rms->input_rms[i], |
4540 | hdsp->iobase + HDSP_inputRmsLevel + i * 8 + 4, | 4557 | hdsp->iobase + HDSP_inputRmsLevel + i * 8 + 4, |
4541 | hdsp->iobase + HDSP_inputRmsLevel + i * 8)) | 4558 | hdsp->iobase + HDSP_inputRmsLevel + i * 8)) |
4542 | return -EFAULT; | 4559 | return -EFAULT; |
@@ -4546,7 +4563,7 @@ static int hdsp_get_peak(struct hdsp *hdsp, struct hdsp_peak_rms __user *peak_rm | |||
4546 | 4563 | ||
4547 | static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg) | 4564 | static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigned int cmd, unsigned long arg) |
4548 | { | 4565 | { |
4549 | struct hdsp *hdsp = (struct hdsp *)hw->private_data; | 4566 | struct hdsp *hdsp = (struct hdsp *)hw->private_data; |
4550 | void __user *argp = (void __user *)arg; | 4567 | void __user *argp = (void __user *)arg; |
4551 | int err; | 4568 | int err; |
4552 | 4569 | ||
@@ -4580,7 +4597,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4580 | struct hdsp_config_info info; | 4597 | struct hdsp_config_info info; |
4581 | unsigned long flags; | 4598 | unsigned long flags; |
4582 | int i; | 4599 | int i; |
4583 | 4600 | ||
4584 | err = hdsp_check_for_iobox(hdsp); | 4601 | err = hdsp_check_for_iobox(hdsp); |
4585 | if (err < 0) | 4602 | if (err < 0) |
4586 | return err; | 4603 | return err; |
@@ -4614,7 +4631,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4614 | info.ad_gain = (unsigned char)hdsp_ad_gain(hdsp); | 4631 | info.ad_gain = (unsigned char)hdsp_ad_gain(hdsp); |
4615 | info.phone_gain = (unsigned char)hdsp_phone_gain(hdsp); | 4632 | info.phone_gain = (unsigned char)hdsp_phone_gain(hdsp); |
4616 | info.xlr_breakout_cable = (unsigned char)hdsp_xlr_breakout_cable(hdsp); | 4633 | info.xlr_breakout_cable = (unsigned char)hdsp_xlr_breakout_cable(hdsp); |
4617 | 4634 | ||
4618 | } | 4635 | } |
4619 | if (hdsp->io_type == H9632 || hdsp->io_type == H9652) | 4636 | if (hdsp->io_type == H9632 || hdsp->io_type == H9652) |
4620 | info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp); | 4637 | info.analog_extension_board = (unsigned char)hdsp_aeb(hdsp); |
@@ -4625,7 +4642,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4625 | } | 4642 | } |
4626 | case SNDRV_HDSP_IOCTL_GET_9632_AEB: { | 4643 | case SNDRV_HDSP_IOCTL_GET_9632_AEB: { |
4627 | struct hdsp_9632_aeb h9632_aeb; | 4644 | struct hdsp_9632_aeb h9632_aeb; |
4628 | 4645 | ||
4629 | if (hdsp->io_type != H9632) return -EINVAL; | 4646 | if (hdsp->io_type != H9632) return -EINVAL; |
4630 | h9632_aeb.aebi = hdsp->ss_in_channels - H9632_SS_CHANNELS; | 4647 | h9632_aeb.aebi = hdsp->ss_in_channels - H9632_SS_CHANNELS; |
4631 | h9632_aeb.aebo = hdsp->ss_out_channels - H9632_SS_CHANNELS; | 4648 | h9632_aeb.aebo = hdsp->ss_out_channels - H9632_SS_CHANNELS; |
@@ -4636,7 +4653,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4636 | case SNDRV_HDSP_IOCTL_GET_VERSION: { | 4653 | case SNDRV_HDSP_IOCTL_GET_VERSION: { |
4637 | struct hdsp_version hdsp_version; | 4654 | struct hdsp_version hdsp_version; |
4638 | int err; | 4655 | int err; |
4639 | 4656 | ||
4640 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; | 4657 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; |
4641 | if (hdsp->io_type == Undefined) { | 4658 | if (hdsp->io_type == Undefined) { |
4642 | if ((err = hdsp_get_iobox_version(hdsp)) < 0) | 4659 | if ((err = hdsp_get_iobox_version(hdsp)) < 0) |
@@ -4652,7 +4669,7 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4652 | struct hdsp_firmware __user *firmware; | 4669 | struct hdsp_firmware __user *firmware; |
4653 | u32 __user *firmware_data; | 4670 | u32 __user *firmware_data; |
4654 | int err; | 4671 | int err; |
4655 | 4672 | ||
4656 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; | 4673 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; |
4657 | /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */ | 4674 | /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */ |
4658 | if (hdsp->io_type == Undefined) return -EINVAL; | 4675 | if (hdsp->io_type == Undefined) return -EINVAL; |
@@ -4665,25 +4682,25 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne | |||
4665 | 4682 | ||
4666 | if (get_user(firmware_data, &firmware->firmware_data)) | 4683 | if (get_user(firmware_data, &firmware->firmware_data)) |
4667 | return -EFAULT; | 4684 | return -EFAULT; |
4668 | 4685 | ||
4669 | if (hdsp_check_for_iobox (hdsp)) | 4686 | if (hdsp_check_for_iobox (hdsp)) |
4670 | return -EIO; | 4687 | return -EIO; |
4671 | 4688 | ||
4672 | if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(hdsp->firmware_cache)) != 0) | 4689 | if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(hdsp->firmware_cache)) != 0) |
4673 | return -EFAULT; | 4690 | return -EFAULT; |
4674 | 4691 | ||
4675 | hdsp->state |= HDSP_FirmwareCached; | 4692 | hdsp->state |= HDSP_FirmwareCached; |
4676 | 4693 | ||
4677 | if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) | 4694 | if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) |
4678 | return err; | 4695 | return err; |
4679 | 4696 | ||
4680 | if (!(hdsp->state & HDSP_InitializationComplete)) { | 4697 | if (!(hdsp->state & HDSP_InitializationComplete)) { |
4681 | if ((err = snd_hdsp_enable_io(hdsp)) < 0) | 4698 | if ((err = snd_hdsp_enable_io(hdsp)) < 0) |
4682 | return err; | 4699 | return err; |
4683 | 4700 | ||
4684 | snd_hdsp_initialize_channels(hdsp); | 4701 | snd_hdsp_initialize_channels(hdsp); |
4685 | snd_hdsp_initialize_midi_flush(hdsp); | 4702 | snd_hdsp_initialize_midi_flush(hdsp); |
4686 | 4703 | ||
4687 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { | 4704 | if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { |
4688 | snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); | 4705 | snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); |
4689 | return err; | 4706 | return err; |
@@ -4730,18 +4747,16 @@ static int snd_hdsp_create_hwdep(struct snd_card *card, struct hdsp *hdsp) | |||
4730 | { | 4747 | { |
4731 | struct snd_hwdep *hw; | 4748 | struct snd_hwdep *hw; |
4732 | int err; | 4749 | int err; |
4733 | 4750 | ||
4734 | if ((err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw)) < 0) | 4751 | if ((err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw)) < 0) |
4735 | return err; | 4752 | return err; |
4736 | 4753 | ||
4737 | hdsp->hwdep = hw; | 4754 | hdsp->hwdep = hw; |
4738 | hw->private_data = hdsp; | 4755 | hw->private_data = hdsp; |
4739 | strcpy(hw->name, "HDSP hwdep interface"); | 4756 | strcpy(hw->name, "HDSP hwdep interface"); |
4740 | 4757 | ||
4741 | hw->ops.open = snd_hdsp_hwdep_dummy_op; | ||
4742 | hw->ops.ioctl = snd_hdsp_hwdep_ioctl; | 4758 | hw->ops.ioctl = snd_hdsp_hwdep_ioctl; |
4743 | hw->ops.release = snd_hdsp_hwdep_dummy_op; | 4759 | |
4744 | |||
4745 | return 0; | 4760 | return 0; |
4746 | } | 4761 | } |
4747 | 4762 | ||
@@ -4774,24 +4789,24 @@ static void snd_hdsp_9652_enable_mixer (struct hdsp *hdsp) | |||
4774 | static int snd_hdsp_enable_io (struct hdsp *hdsp) | 4789 | static int snd_hdsp_enable_io (struct hdsp *hdsp) |
4775 | { | 4790 | { |
4776 | int i; | 4791 | int i; |
4777 | 4792 | ||
4778 | if (hdsp_fifo_wait (hdsp, 0, 100)) { | 4793 | if (hdsp_fifo_wait (hdsp, 0, 100)) { |
4779 | snd_printk(KERN_ERR "Hammerfall-DSP: enable_io fifo_wait failed\n"); | 4794 | snd_printk(KERN_ERR "Hammerfall-DSP: enable_io fifo_wait failed\n"); |
4780 | return -EIO; | 4795 | return -EIO; |
4781 | } | 4796 | } |
4782 | 4797 | ||
4783 | for (i = 0; i < hdsp->max_channels; ++i) { | 4798 | for (i = 0; i < hdsp->max_channels; ++i) { |
4784 | hdsp_write (hdsp, HDSP_inputEnable + (4 * i), 1); | 4799 | hdsp_write (hdsp, HDSP_inputEnable + (4 * i), 1); |
4785 | hdsp_write (hdsp, HDSP_outputEnable + (4 * i), 1); | 4800 | hdsp_write (hdsp, HDSP_outputEnable + (4 * i), 1); |
4786 | } | 4801 | } |
4787 | 4802 | ||
4788 | return 0; | 4803 | return 0; |
4789 | } | 4804 | } |
4790 | 4805 | ||
4791 | static void snd_hdsp_initialize_channels(struct hdsp *hdsp) | 4806 | static void snd_hdsp_initialize_channels(struct hdsp *hdsp) |
4792 | { | 4807 | { |
4793 | int status, aebi_channels, aebo_channels; | 4808 | int status, aebi_channels, aebo_channels; |
4794 | 4809 | ||
4795 | switch (hdsp->io_type) { | 4810 | switch (hdsp->io_type) { |
4796 | case Digiface: | 4811 | case Digiface: |
4797 | hdsp->card_name = "RME Hammerfall DSP + Digiface"; | 4812 | hdsp->card_name = "RME Hammerfall DSP + Digiface"; |
@@ -4804,7 +4819,7 @@ static void snd_hdsp_initialize_channels(struct hdsp *hdsp) | |||
4804 | hdsp->ss_in_channels = hdsp->ss_out_channels = H9652_SS_CHANNELS; | 4819 | hdsp->ss_in_channels = hdsp->ss_out_channels = H9652_SS_CHANNELS; |
4805 | hdsp->ds_in_channels = hdsp->ds_out_channels = H9652_DS_CHANNELS; | 4820 | hdsp->ds_in_channels = hdsp->ds_out_channels = H9652_DS_CHANNELS; |
4806 | break; | 4821 | break; |
4807 | 4822 | ||
4808 | case H9632: | 4823 | case H9632: |
4809 | status = hdsp_read(hdsp, HDSP_statusRegister); | 4824 | status = hdsp_read(hdsp, HDSP_statusRegister); |
4810 | /* HDSP_AEBx bits are low when AEB are connected */ | 4825 | /* HDSP_AEBx bits are low when AEB are connected */ |
@@ -4824,7 +4839,7 @@ static void snd_hdsp_initialize_channels(struct hdsp *hdsp) | |||
4824 | hdsp->ss_in_channels = hdsp->ss_out_channels = MULTIFACE_SS_CHANNELS; | 4839 | hdsp->ss_in_channels = hdsp->ss_out_channels = MULTIFACE_SS_CHANNELS; |
4825 | hdsp->ds_in_channels = hdsp->ds_out_channels = MULTIFACE_DS_CHANNELS; | 4840 | hdsp->ds_in_channels = hdsp->ds_out_channels = MULTIFACE_DS_CHANNELS; |
4826 | break; | 4841 | break; |
4827 | 4842 | ||
4828 | default: | 4843 | default: |
4829 | /* should never get here */ | 4844 | /* should never get here */ |
4830 | break; | 4845 | break; |
@@ -4840,12 +4855,12 @@ static void snd_hdsp_initialize_midi_flush (struct hdsp *hdsp) | |||
4840 | static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp) | 4855 | static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp) |
4841 | { | 4856 | { |
4842 | int err; | 4857 | int err; |
4843 | 4858 | ||
4844 | if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { | 4859 | if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { |
4845 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating pcm interface\n"); | 4860 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating pcm interface\n"); |
4846 | return err; | 4861 | return err; |
4847 | } | 4862 | } |
4848 | 4863 | ||
4849 | 4864 | ||
4850 | if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { | 4865 | if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { |
4851 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating first midi interface\n"); | 4866 | snd_printk(KERN_ERR "Hammerfall-DSP: Error creating first midi interface\n"); |
@@ -4876,19 +4891,19 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp | |||
4876 | snd_printk(KERN_ERR "Hammerfall-DSP: Error setting default values\n"); | 4891 | snd_printk(KERN_ERR "Hammerfall-DSP: Error setting default values\n"); |
4877 | return err; | 4892 | return err; |
4878 | } | 4893 | } |
4879 | 4894 | ||
4880 | if (!(hdsp->state & HDSP_InitializationComplete)) { | 4895 | if (!(hdsp->state & HDSP_InitializationComplete)) { |
4881 | strcpy(card->shortname, "Hammerfall DSP"); | 4896 | strcpy(card->shortname, "Hammerfall DSP"); |
4882 | sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, | 4897 | sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, |
4883 | hdsp->port, hdsp->irq); | 4898 | hdsp->port, hdsp->irq); |
4884 | 4899 | ||
4885 | if ((err = snd_card_register(card)) < 0) { | 4900 | if ((err = snd_card_register(card)) < 0) { |
4886 | snd_printk(KERN_ERR "Hammerfall-DSP: error registering card\n"); | 4901 | snd_printk(KERN_ERR "Hammerfall-DSP: error registering card\n"); |
4887 | return err; | 4902 | return err; |
4888 | } | 4903 | } |
4889 | hdsp->state |= HDSP_InitializationComplete; | 4904 | hdsp->state |= HDSP_InitializationComplete; |
4890 | } | 4905 | } |
4891 | 4906 | ||
4892 | return 0; | 4907 | return 0; |
4893 | } | 4908 | } |
4894 | 4909 | ||
@@ -4899,7 +4914,7 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp) | |||
4899 | const char *fwfile; | 4914 | const char *fwfile; |
4900 | const struct firmware *fw; | 4915 | const struct firmware *fw; |
4901 | int err; | 4916 | int err; |
4902 | 4917 | ||
4903 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) | 4918 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) |
4904 | return 0; | 4919 | return 0; |
4905 | if (hdsp->io_type == Undefined) { | 4920 | if (hdsp->io_type == Undefined) { |
@@ -4908,7 +4923,7 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp) | |||
4908 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) | 4923 | if (hdsp->io_type == H9652 || hdsp->io_type == H9632) |
4909 | return 0; | 4924 | return 0; |
4910 | } | 4925 | } |
4911 | 4926 | ||
4912 | /* caution: max length of firmware filename is 30! */ | 4927 | /* caution: max length of firmware filename is 30! */ |
4913 | switch (hdsp->io_type) { | 4928 | switch (hdsp->io_type) { |
4914 | case Multiface: | 4929 | case Multiface: |
@@ -4942,12 +4957,12 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp) | |||
4942 | memcpy(hdsp->firmware_cache, fw->data, sizeof(hdsp->firmware_cache)); | 4957 | memcpy(hdsp->firmware_cache, fw->data, sizeof(hdsp->firmware_cache)); |
4943 | 4958 | ||
4944 | release_firmware(fw); | 4959 | release_firmware(fw); |
4945 | 4960 | ||
4946 | hdsp->state |= HDSP_FirmwareCached; | 4961 | hdsp->state |= HDSP_FirmwareCached; |
4947 | 4962 | ||
4948 | if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) | 4963 | if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) |
4949 | return err; | 4964 | return err; |
4950 | 4965 | ||
4951 | if (!(hdsp->state & HDSP_InitializationComplete)) { | 4966 | if (!(hdsp->state & HDSP_InitializationComplete)) { |
4952 | if ((err = snd_hdsp_enable_io(hdsp)) < 0) | 4967 | if ((err = snd_hdsp_enable_io(hdsp)) < 0) |
4953 | return err; | 4968 | return err; |
@@ -4994,14 +5009,14 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
4994 | hdsp->max_channels = 26; | 5009 | hdsp->max_channels = 26; |
4995 | 5010 | ||
4996 | hdsp->card = card; | 5011 | hdsp->card = card; |
4997 | 5012 | ||
4998 | spin_lock_init(&hdsp->lock); | 5013 | spin_lock_init(&hdsp->lock); |
4999 | 5014 | ||
5000 | tasklet_init(&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long)hdsp); | 5015 | tasklet_init(&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long)hdsp); |
5001 | 5016 | ||
5002 | pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev); | 5017 | pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev); |
5003 | hdsp->firmware_rev &= 0xff; | 5018 | hdsp->firmware_rev &= 0xff; |
5004 | 5019 | ||
5005 | /* From Martin Bjoernsen : | 5020 | /* From Martin Bjoernsen : |
5006 | "It is important that the card's latency timer register in | 5021 | "It is important that the card's latency timer register in |
5007 | the PCI configuration space is set to a value much larger | 5022 | the PCI configuration space is set to a value much larger |
@@ -5010,7 +5025,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5010 | to its maximum 255 to avoid problems with some computers." | 5025 | to its maximum 255 to avoid problems with some computers." |
5011 | */ | 5026 | */ |
5012 | pci_write_config_byte(hdsp->pci, PCI_LATENCY_TIMER, 0xFF); | 5027 | pci_write_config_byte(hdsp->pci, PCI_LATENCY_TIMER, 0xFF); |
5013 | 5028 | ||
5014 | strcpy(card->driver, "H-DSP"); | 5029 | strcpy(card->driver, "H-DSP"); |
5015 | strcpy(card->mixername, "Xilinx FPGA"); | 5030 | strcpy(card->mixername, "Xilinx FPGA"); |
5016 | 5031 | ||
@@ -5024,7 +5039,7 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5024 | } else { | 5039 | } else { |
5025 | hdsp->card_name = "RME HDSP 9632"; | 5040 | hdsp->card_name = "RME HDSP 9632"; |
5026 | hdsp->max_channels = 16; | 5041 | hdsp->max_channels = 16; |
5027 | is_9632 = 1; | 5042 | is_9632 = 1; |
5028 | } | 5043 | } |
5029 | 5044 | ||
5030 | if ((err = pci_enable_device(pci)) < 0) | 5045 | if ((err = pci_enable_device(pci)) < 0) |
@@ -5053,12 +5068,12 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5053 | 5068 | ||
5054 | if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) | 5069 | if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) |
5055 | return err; | 5070 | return err; |
5056 | 5071 | ||
5057 | if (!is_9652 && !is_9632) { | 5072 | if (!is_9652 && !is_9632) { |
5058 | /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */ | 5073 | /* we wait a maximum of 10 seconds to let freshly |
5059 | ssleep(2); | 5074 | * inserted cardbus cards do their hardware init */ |
5075 | err = hdsp_wait_for_iobox(hdsp, 1000, 10); | ||
5060 | 5076 | ||
5061 | err = hdsp_check_for_iobox(hdsp); | ||
5062 | if (err < 0) | 5077 | if (err < 0) |
5063 | return err; | 5078 | return err; |
5064 | 5079 | ||
@@ -5080,35 +5095,35 @@ static int __devinit snd_hdsp_create(struct snd_card *card, | |||
5080 | return err; | 5095 | return err; |
5081 | return 0; | 5096 | return 0; |
5082 | } else { | 5097 | } else { |
5083 | snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n"); | 5098 | snd_printk(KERN_INFO "Hammerfall-DSP: Firmware already present, initializing card.\n"); |
5084 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) | 5099 | if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) |
5085 | hdsp->io_type = Multiface; | 5100 | hdsp->io_type = Multiface; |
5086 | else | 5101 | else |
5087 | hdsp->io_type = Digiface; | 5102 | hdsp->io_type = Digiface; |
5088 | } | 5103 | } |
5089 | } | 5104 | } |
5090 | 5105 | ||
5091 | if ((err = snd_hdsp_enable_io(hdsp)) != 0) | 5106 | if ((err = snd_hdsp_enable_io(hdsp)) != 0) |
5092 | return err; | 5107 | return err; |
5093 | 5108 | ||
5094 | if (is_9652) | 5109 | if (is_9652) |
5095 | hdsp->io_type = H9652; | 5110 | hdsp->io_type = H9652; |
5096 | 5111 | ||
5097 | if (is_9632) | 5112 | if (is_9632) |
5098 | hdsp->io_type = H9632; | 5113 | hdsp->io_type = H9632; |
5099 | 5114 | ||
5100 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) | 5115 | if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) |
5101 | return err; | 5116 | return err; |
5102 | 5117 | ||
5103 | snd_hdsp_initialize_channels(hdsp); | 5118 | snd_hdsp_initialize_channels(hdsp); |
5104 | snd_hdsp_initialize_midi_flush(hdsp); | 5119 | snd_hdsp_initialize_midi_flush(hdsp); |
5105 | 5120 | ||
5106 | hdsp->state |= HDSP_FirmwareLoaded; | 5121 | hdsp->state |= HDSP_FirmwareLoaded; |
5107 | 5122 | ||
5108 | if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) | 5123 | if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) |
5109 | return err; | 5124 | return err; |
5110 | 5125 | ||
5111 | return 0; | 5126 | return 0; |
5112 | } | 5127 | } |
5113 | 5128 | ||
5114 | static int snd_hdsp_free(struct hdsp *hdsp) | 5129 | static int snd_hdsp_free(struct hdsp *hdsp) |
@@ -5124,13 +5139,13 @@ static int snd_hdsp_free(struct hdsp *hdsp) | |||
5124 | free_irq(hdsp->irq, (void *)hdsp); | 5139 | free_irq(hdsp->irq, (void *)hdsp); |
5125 | 5140 | ||
5126 | snd_hdsp_free_buffers(hdsp); | 5141 | snd_hdsp_free_buffers(hdsp); |
5127 | 5142 | ||
5128 | if (hdsp->iobase) | 5143 | if (hdsp->iobase) |
5129 | iounmap(hdsp->iobase); | 5144 | iounmap(hdsp->iobase); |
5130 | 5145 | ||
5131 | if (hdsp->port) | 5146 | if (hdsp->port) |
5132 | pci_release_regions(hdsp->pci); | 5147 | pci_release_regions(hdsp->pci); |
5133 | 5148 | ||
5134 | pci_disable_device(hdsp->pci); | 5149 | pci_disable_device(hdsp->pci); |
5135 | return 0; | 5150 | return 0; |
5136 | } | 5151 | } |
@@ -5158,8 +5173,10 @@ static int __devinit snd_hdsp_probe(struct pci_dev *pci, | |||
5158 | return -ENOENT; | 5173 | return -ENOENT; |
5159 | } | 5174 | } |
5160 | 5175 | ||
5161 | if (!(card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct hdsp)))) | 5176 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
5162 | return -ENOMEM; | 5177 | sizeof(struct hdsp), &card); |
5178 | if (err < 0) | ||
5179 | return err; | ||
5163 | 5180 | ||
5164 | hdsp = (struct hdsp *) card->private_data; | 5181 | hdsp = (struct hdsp *) card->private_data; |
5165 | card->private_free = snd_hdsp_card_free; | 5182 | card->private_free = snd_hdsp_card_free; |
@@ -5173,7 +5190,7 @@ static int __devinit snd_hdsp_probe(struct pci_dev *pci, | |||
5173 | } | 5190 | } |
5174 | 5191 | ||
5175 | strcpy(card->shortname, "Hammerfall DSP"); | 5192 | strcpy(card->shortname, "Hammerfall DSP"); |
5176 | sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, | 5193 | sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, |
5177 | hdsp->port, hdsp->irq); | 5194 | hdsp->port, hdsp->irq); |
5178 | 5195 | ||
5179 | if ((err = snd_card_register(card)) < 0) { | 5196 | if ((err = snd_card_register(card)) < 0) { |
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 71231cf1b2b0..bac2dc0c5d85 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -4100,13 +4100,6 @@ static int snd_hdspm_capture_release(struct snd_pcm_substream *substream) | |||
4100 | return 0; | 4100 | return 0; |
4101 | } | 4101 | } |
4102 | 4102 | ||
4103 | static int snd_hdspm_hwdep_dummy_op(struct snd_hwdep * hw, struct file *file) | ||
4104 | { | ||
4105 | /* we have nothing to initialize but the call is required */ | ||
4106 | return 0; | ||
4107 | } | ||
4108 | |||
4109 | |||
4110 | static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file, | 4103 | static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file, |
4111 | unsigned int cmd, unsigned long arg) | 4104 | unsigned int cmd, unsigned long arg) |
4112 | { | 4105 | { |
@@ -4213,9 +4206,7 @@ static int __devinit snd_hdspm_create_hwdep(struct snd_card *card, | |||
4213 | hw->private_data = hdspm; | 4206 | hw->private_data = hdspm; |
4214 | strcpy(hw->name, "HDSPM hwdep interface"); | 4207 | strcpy(hw->name, "HDSPM hwdep interface"); |
4215 | 4208 | ||
4216 | hw->ops.open = snd_hdspm_hwdep_dummy_op; | ||
4217 | hw->ops.ioctl = snd_hdspm_hwdep_ioctl; | 4209 | hw->ops.ioctl = snd_hdspm_hwdep_ioctl; |
4218 | hw->ops.release = snd_hdspm_hwdep_dummy_op; | ||
4219 | 4210 | ||
4220 | return 0; | 4211 | return 0; |
4221 | } | 4212 | } |
@@ -4503,10 +4494,10 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci, | |||
4503 | return -ENOENT; | 4494 | return -ENOENT; |
4504 | } | 4495 | } |
4505 | 4496 | ||
4506 | card = snd_card_new(index[dev], id[dev], | 4497 | err = snd_card_create(index[dev], id[dev], |
4507 | THIS_MODULE, sizeof(struct hdspm)); | 4498 | THIS_MODULE, sizeof(struct hdspm), &card); |
4508 | if (!card) | 4499 | if (err < 0) |
4509 | return -ENOMEM; | 4500 | return err; |
4510 | 4501 | ||
4511 | hdspm = card->private_data; | 4502 | hdspm = card->private_data; |
4512 | card->private_free = snd_hdspm_card_free; | 4503 | card->private_free = snd_hdspm_card_free; |
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index 2570907134d7..bc539abb2105 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c | |||
@@ -2594,11 +2594,11 @@ static int __devinit snd_rme9652_probe(struct pci_dev *pci, | |||
2594 | return -ENOENT; | 2594 | return -ENOENT; |
2595 | } | 2595 | } |
2596 | 2596 | ||
2597 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, | 2597 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, |
2598 | sizeof(struct snd_rme9652)); | 2598 | sizeof(struct snd_rme9652), &card); |
2599 | 2599 | ||
2600 | if (!card) | 2600 | if (err < 0) |
2601 | return -ENOMEM; | 2601 | return err; |
2602 | 2602 | ||
2603 | rme9652 = (struct snd_rme9652 *) card->private_data; | 2603 | rme9652 = (struct snd_rme9652 *) card->private_data; |
2604 | card->private_free = snd_rme9652_card_free; | 2604 | card->private_free = snd_rme9652_card_free; |
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c index df2007e3be7c..baf6d8e3dabc 100644 --- a/sound/pci/sis7019.c +++ b/sound/pci/sis7019.c | |||
@@ -1387,9 +1387,8 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci, | |||
1387 | if (!enable) | 1387 | if (!enable) |
1388 | goto error_out; | 1388 | goto error_out; |
1389 | 1389 | ||
1390 | rc = -ENOMEM; | 1390 | rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card); |
1391 | card = snd_card_new(index, id, THIS_MODULE, sizeof(*sis)); | 1391 | if (rc < 0) |
1392 | if (!card) | ||
1393 | goto error_out; | 1392 | goto error_out; |
1394 | 1393 | ||
1395 | strcpy(card->driver, "SiS7019"); | 1394 | strcpy(card->driver, "SiS7019"); |
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index cd408b86c839..d989215f3556 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c | |||
@@ -273,7 +273,8 @@ static inline void snd_sonicvibes_setdmaa(struct sonicvibes * sonic, | |||
273 | outl(count, sonic->dmaa_port + SV_DMA_COUNT0); | 273 | outl(count, sonic->dmaa_port + SV_DMA_COUNT0); |
274 | outb(0x18, sonic->dmaa_port + SV_DMA_MODE); | 274 | outb(0x18, sonic->dmaa_port + SV_DMA_MODE); |
275 | #if 0 | 275 | #if 0 |
276 | printk("program dmaa: addr = 0x%x, paddr = 0x%x\n", addr, inl(sonic->dmaa_port + SV_DMA_ADDR0)); | 276 | printk(KERN_DEBUG "program dmaa: addr = 0x%x, paddr = 0x%x\n", |
277 | addr, inl(sonic->dmaa_port + SV_DMA_ADDR0)); | ||
277 | #endif | 278 | #endif |
278 | } | 279 | } |
279 | 280 | ||
@@ -288,7 +289,8 @@ static inline void snd_sonicvibes_setdmac(struct sonicvibes * sonic, | |||
288 | outl(count, sonic->dmac_port + SV_DMA_COUNT0); | 289 | outl(count, sonic->dmac_port + SV_DMA_COUNT0); |
289 | outb(0x14, sonic->dmac_port + SV_DMA_MODE); | 290 | outb(0x14, sonic->dmac_port + SV_DMA_MODE); |
290 | #if 0 | 291 | #if 0 |
291 | printk("program dmac: addr = 0x%x, paddr = 0x%x\n", addr, inl(sonic->dmac_port + SV_DMA_ADDR0)); | 292 | printk(KERN_DEBUG "program dmac: addr = 0x%x, paddr = 0x%x\n", |
293 | addr, inl(sonic->dmac_port + SV_DMA_ADDR0)); | ||
292 | #endif | 294 | #endif |
293 | } | 295 | } |
294 | 296 | ||
@@ -355,71 +357,104 @@ static unsigned char snd_sonicvibes_in(struct sonicvibes * sonic, unsigned char | |||
355 | #if 0 | 357 | #if 0 |
356 | static void snd_sonicvibes_debug(struct sonicvibes * sonic) | 358 | static void snd_sonicvibes_debug(struct sonicvibes * sonic) |
357 | { | 359 | { |
358 | printk("SV REGS: INDEX = 0x%02x ", inb(SV_REG(sonic, INDEX))); | 360 | printk(KERN_DEBUG |
361 | "SV REGS: INDEX = 0x%02x ", inb(SV_REG(sonic, INDEX))); | ||
359 | printk(" STATUS = 0x%02x\n", inb(SV_REG(sonic, STATUS))); | 362 | printk(" STATUS = 0x%02x\n", inb(SV_REG(sonic, STATUS))); |
360 | printk(" 0x00: left input = 0x%02x ", snd_sonicvibes_in(sonic, 0x00)); | 363 | printk(KERN_DEBUG |
364 | " 0x00: left input = 0x%02x ", snd_sonicvibes_in(sonic, 0x00)); | ||
361 | printk(" 0x20: synth rate low = 0x%02x\n", snd_sonicvibes_in(sonic, 0x20)); | 365 | printk(" 0x20: synth rate low = 0x%02x\n", snd_sonicvibes_in(sonic, 0x20)); |
362 | printk(" 0x01: right input = 0x%02x ", snd_sonicvibes_in(sonic, 0x01)); | 366 | printk(KERN_DEBUG |
367 | " 0x01: right input = 0x%02x ", snd_sonicvibes_in(sonic, 0x01)); | ||
363 | printk(" 0x21: synth rate high = 0x%02x\n", snd_sonicvibes_in(sonic, 0x21)); | 368 | printk(" 0x21: synth rate high = 0x%02x\n", snd_sonicvibes_in(sonic, 0x21)); |
364 | printk(" 0x02: left AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x02)); | 369 | printk(KERN_DEBUG |
370 | " 0x02: left AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x02)); | ||
365 | printk(" 0x22: ADC clock = 0x%02x\n", snd_sonicvibes_in(sonic, 0x22)); | 371 | printk(" 0x22: ADC clock = 0x%02x\n", snd_sonicvibes_in(sonic, 0x22)); |
366 | printk(" 0x03: right AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x03)); | 372 | printk(KERN_DEBUG |
373 | " 0x03: right AUX1 = 0x%02x ", snd_sonicvibes_in(sonic, 0x03)); | ||
367 | printk(" 0x23: ADC alt rate = 0x%02x\n", snd_sonicvibes_in(sonic, 0x23)); | 374 | printk(" 0x23: ADC alt rate = 0x%02x\n", snd_sonicvibes_in(sonic, 0x23)); |
368 | printk(" 0x04: left CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x04)); | 375 | printk(KERN_DEBUG |
376 | " 0x04: left CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x04)); | ||
369 | printk(" 0x24: ADC pll M = 0x%02x\n", snd_sonicvibes_in(sonic, 0x24)); | 377 | printk(" 0x24: ADC pll M = 0x%02x\n", snd_sonicvibes_in(sonic, 0x24)); |
370 | printk(" 0x05: right CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x05)); | 378 | printk(KERN_DEBUG |
379 | " 0x05: right CD = 0x%02x ", snd_sonicvibes_in(sonic, 0x05)); | ||
371 | printk(" 0x25: ADC pll N = 0x%02x\n", snd_sonicvibes_in(sonic, 0x25)); | 380 | printk(" 0x25: ADC pll N = 0x%02x\n", snd_sonicvibes_in(sonic, 0x25)); |
372 | printk(" 0x06: left line = 0x%02x ", snd_sonicvibes_in(sonic, 0x06)); | 381 | printk(KERN_DEBUG |
382 | " 0x06: left line = 0x%02x ", snd_sonicvibes_in(sonic, 0x06)); | ||
373 | printk(" 0x26: Synth pll M = 0x%02x\n", snd_sonicvibes_in(sonic, 0x26)); | 383 | printk(" 0x26: Synth pll M = 0x%02x\n", snd_sonicvibes_in(sonic, 0x26)); |
374 | printk(" 0x07: right line = 0x%02x ", snd_sonicvibes_in(sonic, 0x07)); | 384 | printk(KERN_DEBUG |
385 | " 0x07: right line = 0x%02x ", snd_sonicvibes_in(sonic, 0x07)); | ||
375 | printk(" 0x27: Synth pll N = 0x%02x\n", snd_sonicvibes_in(sonic, 0x27)); | 386 | printk(" 0x27: Synth pll N = 0x%02x\n", snd_sonicvibes_in(sonic, 0x27)); |
376 | printk(" 0x08: MIC = 0x%02x ", snd_sonicvibes_in(sonic, 0x08)); | 387 | printk(KERN_DEBUG |
388 | " 0x08: MIC = 0x%02x ", snd_sonicvibes_in(sonic, 0x08)); | ||
377 | printk(" 0x28: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x28)); | 389 | printk(" 0x28: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x28)); |
378 | printk(" 0x09: Game port = 0x%02x ", snd_sonicvibes_in(sonic, 0x09)); | 390 | printk(KERN_DEBUG |
391 | " 0x09: Game port = 0x%02x ", snd_sonicvibes_in(sonic, 0x09)); | ||
379 | printk(" 0x29: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x29)); | 392 | printk(" 0x29: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x29)); |
380 | printk(" 0x0a: left synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0a)); | 393 | printk(KERN_DEBUG |
394 | " 0x0a: left synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0a)); | ||
381 | printk(" 0x2a: MPU401 = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2a)); | 395 | printk(" 0x2a: MPU401 = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2a)); |
382 | printk(" 0x0b: right synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0b)); | 396 | printk(KERN_DEBUG |
397 | " 0x0b: right synth = 0x%02x ", snd_sonicvibes_in(sonic, 0x0b)); | ||
383 | printk(" 0x2b: drive ctrl = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2b)); | 398 | printk(" 0x2b: drive ctrl = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2b)); |
384 | printk(" 0x0c: left AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0c)); | 399 | printk(KERN_DEBUG |
400 | " 0x0c: left AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0c)); | ||
385 | printk(" 0x2c: SRS space = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2c)); | 401 | printk(" 0x2c: SRS space = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2c)); |
386 | printk(" 0x0d: right AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0d)); | 402 | printk(KERN_DEBUG |
403 | " 0x0d: right AUX2 = 0x%02x ", snd_sonicvibes_in(sonic, 0x0d)); | ||
387 | printk(" 0x2d: SRS center = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2d)); | 404 | printk(" 0x2d: SRS center = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2d)); |
388 | printk(" 0x0e: left analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0e)); | 405 | printk(KERN_DEBUG |
406 | " 0x0e: left analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0e)); | ||
389 | printk(" 0x2e: wave source = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2e)); | 407 | printk(" 0x2e: wave source = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2e)); |
390 | printk(" 0x0f: right analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0f)); | 408 | printk(KERN_DEBUG |
409 | " 0x0f: right analog = 0x%02x ", snd_sonicvibes_in(sonic, 0x0f)); | ||
391 | printk(" 0x2f: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2f)); | 410 | printk(" 0x2f: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x2f)); |
392 | printk(" 0x10: left PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x10)); | 411 | printk(KERN_DEBUG |
412 | " 0x10: left PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x10)); | ||
393 | printk(" 0x30: analog power = 0x%02x\n", snd_sonicvibes_in(sonic, 0x30)); | 413 | printk(" 0x30: analog power = 0x%02x\n", snd_sonicvibes_in(sonic, 0x30)); |
394 | printk(" 0x11: right PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x11)); | 414 | printk(KERN_DEBUG |
415 | " 0x11: right PCM = 0x%02x ", snd_sonicvibes_in(sonic, 0x11)); | ||
395 | printk(" 0x31: analog power = 0x%02x\n", snd_sonicvibes_in(sonic, 0x31)); | 416 | printk(" 0x31: analog power = 0x%02x\n", snd_sonicvibes_in(sonic, 0x31)); |
396 | printk(" 0x12: DMA data format = 0x%02x ", snd_sonicvibes_in(sonic, 0x12)); | 417 | printk(KERN_DEBUG |
418 | " 0x12: DMA data format = 0x%02x ", snd_sonicvibes_in(sonic, 0x12)); | ||
397 | printk(" 0x32: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x32)); | 419 | printk(" 0x32: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x32)); |
398 | printk(" 0x13: P/C enable = 0x%02x ", snd_sonicvibes_in(sonic, 0x13)); | 420 | printk(KERN_DEBUG |
421 | " 0x13: P/C enable = 0x%02x ", snd_sonicvibes_in(sonic, 0x13)); | ||
399 | printk(" 0x33: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x33)); | 422 | printk(" 0x33: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x33)); |
400 | printk(" 0x14: U/D button = 0x%02x ", snd_sonicvibes_in(sonic, 0x14)); | 423 | printk(KERN_DEBUG |
424 | " 0x14: U/D button = 0x%02x ", snd_sonicvibes_in(sonic, 0x14)); | ||
401 | printk(" 0x34: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x34)); | 425 | printk(" 0x34: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x34)); |
402 | printk(" 0x15: revision = 0x%02x ", snd_sonicvibes_in(sonic, 0x15)); | 426 | printk(KERN_DEBUG |
427 | " 0x15: revision = 0x%02x ", snd_sonicvibes_in(sonic, 0x15)); | ||
403 | printk(" 0x35: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x35)); | 428 | printk(" 0x35: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x35)); |
404 | printk(" 0x16: ADC output ctrl = 0x%02x ", snd_sonicvibes_in(sonic, 0x16)); | 429 | printk(KERN_DEBUG |
430 | " 0x16: ADC output ctrl = 0x%02x ", snd_sonicvibes_in(sonic, 0x16)); | ||
405 | printk(" 0x36: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x36)); | 431 | printk(" 0x36: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x36)); |
406 | printk(" 0x17: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x17)); | 432 | printk(KERN_DEBUG |
433 | " 0x17: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x17)); | ||
407 | printk(" 0x37: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x37)); | 434 | printk(" 0x37: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x37)); |
408 | printk(" 0x18: DMA A upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x18)); | 435 | printk(KERN_DEBUG |
436 | " 0x18: DMA A upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x18)); | ||
409 | printk(" 0x38: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x38)); | 437 | printk(" 0x38: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x38)); |
410 | printk(" 0x19: DMA A lower cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x19)); | 438 | printk(KERN_DEBUG |
439 | " 0x19: DMA A lower cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x19)); | ||
411 | printk(" 0x39: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x39)); | 440 | printk(" 0x39: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x39)); |
412 | printk(" 0x1a: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1a)); | 441 | printk(KERN_DEBUG |
442 | " 0x1a: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1a)); | ||
413 | printk(" 0x3a: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3a)); | 443 | printk(" 0x3a: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3a)); |
414 | printk(" 0x1b: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1b)); | 444 | printk(KERN_DEBUG |
445 | " 0x1b: --- = 0x%02x ", snd_sonicvibes_in(sonic, 0x1b)); | ||
415 | printk(" 0x3b: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3b)); | 446 | printk(" 0x3b: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3b)); |
416 | printk(" 0x1c: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1c)); | 447 | printk(KERN_DEBUG |
448 | " 0x1c: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1c)); | ||
417 | printk(" 0x3c: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3c)); | 449 | printk(" 0x3c: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3c)); |
418 | printk(" 0x1d: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1d)); | 450 | printk(KERN_DEBUG |
451 | " 0x1d: DMA C upper cnt = 0x%02x ", snd_sonicvibes_in(sonic, 0x1d)); | ||
419 | printk(" 0x3d: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3d)); | 452 | printk(" 0x3d: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3d)); |
420 | printk(" 0x1e: PCM rate low = 0x%02x ", snd_sonicvibes_in(sonic, 0x1e)); | 453 | printk(KERN_DEBUG |
454 | " 0x1e: PCM rate low = 0x%02x ", snd_sonicvibes_in(sonic, 0x1e)); | ||
421 | printk(" 0x3e: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3e)); | 455 | printk(" 0x3e: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3e)); |
422 | printk(" 0x1f: PCM rate high = 0x%02x ", snd_sonicvibes_in(sonic, 0x1f)); | 456 | printk(KERN_DEBUG |
457 | " 0x1f: PCM rate high = 0x%02x ", snd_sonicvibes_in(sonic, 0x1f)); | ||
423 | printk(" 0x3f: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3f)); | 458 | printk(" 0x3f: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3f)); |
424 | } | 459 | } |
425 | 460 | ||
@@ -476,8 +511,8 @@ static void snd_sonicvibes_pll(unsigned int rate, | |||
476 | *res_m = m; | 511 | *res_m = m; |
477 | *res_n = n; | 512 | *res_n = n; |
478 | #if 0 | 513 | #if 0 |
479 | printk("metric = %i, xm = %i, xn = %i\n", metric, xm, xn); | 514 | printk(KERN_DEBUG "metric = %i, xm = %i, xn = %i\n", metric, xm, xn); |
480 | printk("pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n); | 515 | printk(KERN_DEBUG "pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n); |
481 | #endif | 516 | #endif |
482 | } | 517 | } |
483 | 518 | ||
@@ -1423,9 +1458,9 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci, | |||
1423 | return -ENOENT; | 1458 | return -ENOENT; |
1424 | } | 1459 | } |
1425 | 1460 | ||
1426 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 1461 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
1427 | if (card == NULL) | 1462 | if (err < 0) |
1428 | return -ENOMEM; | 1463 | return err; |
1429 | for (idx = 0; idx < 5; idx++) { | 1464 | for (idx = 0; idx < 5; idx++) { |
1430 | if (pci_resource_start(pci, idx) == 0 || | 1465 | if (pci_resource_start(pci, idx) == 0 || |
1431 | !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { | 1466 | !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { |
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c index d94b16ffb385..21cef97d478d 100644 --- a/sound/pci/trident/trident.c +++ b/sound/pci/trident/trident.c | |||
@@ -89,9 +89,9 @@ static int __devinit snd_trident_probe(struct pci_dev *pci, | |||
89 | return -ENOENT; | 89 | return -ENOENT; |
90 | } | 90 | } |
91 | 91 | ||
92 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 92 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
93 | if (card == NULL) | 93 | if (err < 0) |
94 | return -ENOMEM; | 94 | return err; |
95 | 95 | ||
96 | if ((err = snd_trident_create(card, pci, | 96 | if ((err = snd_trident_create(card, pci, |
97 | pcm_channels[dev], | 97 | pcm_channels[dev], |
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index c612b435ca2b..a9da9c184660 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c | |||
@@ -68,40 +68,40 @@ static void snd_trident_print_voice_regs(struct snd_trident *trident, int voice) | |||
68 | { | 68 | { |
69 | unsigned int val, tmp; | 69 | unsigned int val, tmp; |
70 | 70 | ||
71 | printk("Trident voice %i:\n", voice); | 71 | printk(KERN_DEBUG "Trident voice %i:\n", voice); |
72 | outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR)); | 72 | outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR)); |
73 | val = inl(TRID_REG(trident, CH_LBA)); | 73 | val = inl(TRID_REG(trident, CH_LBA)); |
74 | printk("LBA: 0x%x\n", val); | 74 | printk(KERN_DEBUG "LBA: 0x%x\n", val); |
75 | val = inl(TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); | 75 | val = inl(TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); |
76 | printk("GVSel: %i\n", val >> 31); | 76 | printk(KERN_DEBUG "GVSel: %i\n", val >> 31); |
77 | printk("Pan: 0x%x\n", (val >> 24) & 0x7f); | 77 | printk(KERN_DEBUG "Pan: 0x%x\n", (val >> 24) & 0x7f); |
78 | printk("Vol: 0x%x\n", (val >> 16) & 0xff); | 78 | printk(KERN_DEBUG "Vol: 0x%x\n", (val >> 16) & 0xff); |
79 | printk("CTRL: 0x%x\n", (val >> 12) & 0x0f); | 79 | printk(KERN_DEBUG "CTRL: 0x%x\n", (val >> 12) & 0x0f); |
80 | printk("EC: 0x%x\n", val & 0x0fff); | 80 | printk(KERN_DEBUG "EC: 0x%x\n", val & 0x0fff); |
81 | if (trident->device != TRIDENT_DEVICE_ID_NX) { | 81 | if (trident->device != TRIDENT_DEVICE_ID_NX) { |
82 | val = inl(TRID_REG(trident, CH_DX_CSO_ALPHA_FMS)); | 82 | val = inl(TRID_REG(trident, CH_DX_CSO_ALPHA_FMS)); |
83 | printk("CSO: 0x%x\n", val >> 16); | 83 | printk(KERN_DEBUG "CSO: 0x%x\n", val >> 16); |
84 | printk("Alpha: 0x%x\n", (val >> 4) & 0x0fff); | 84 | printk("Alpha: 0x%x\n", (val >> 4) & 0x0fff); |
85 | printk("FMS: 0x%x\n", val & 0x0f); | 85 | printk(KERN_DEBUG "FMS: 0x%x\n", val & 0x0f); |
86 | val = inl(TRID_REG(trident, CH_DX_ESO_DELTA)); | 86 | val = inl(TRID_REG(trident, CH_DX_ESO_DELTA)); |
87 | printk("ESO: 0x%x\n", val >> 16); | 87 | printk(KERN_DEBUG "ESO: 0x%x\n", val >> 16); |
88 | printk("Delta: 0x%x\n", val & 0xffff); | 88 | printk(KERN_DEBUG "Delta: 0x%x\n", val & 0xffff); |
89 | val = inl(TRID_REG(trident, CH_DX_FMC_RVOL_CVOL)); | 89 | val = inl(TRID_REG(trident, CH_DX_FMC_RVOL_CVOL)); |
90 | } else { // TRIDENT_DEVICE_ID_NX | 90 | } else { // TRIDENT_DEVICE_ID_NX |
91 | val = inl(TRID_REG(trident, CH_NX_DELTA_CSO)); | 91 | val = inl(TRID_REG(trident, CH_NX_DELTA_CSO)); |
92 | tmp = (val >> 24) & 0xff; | 92 | tmp = (val >> 24) & 0xff; |
93 | printk("CSO: 0x%x\n", val & 0x00ffffff); | 93 | printk(KERN_DEBUG "CSO: 0x%x\n", val & 0x00ffffff); |
94 | val = inl(TRID_REG(trident, CH_NX_DELTA_ESO)); | 94 | val = inl(TRID_REG(trident, CH_NX_DELTA_ESO)); |
95 | tmp |= (val >> 16) & 0xff00; | 95 | tmp |= (val >> 16) & 0xff00; |
96 | printk("Delta: 0x%x\n", tmp); | 96 | printk(KERN_DEBUG "Delta: 0x%x\n", tmp); |
97 | printk("ESO: 0x%x\n", val & 0x00ffffff); | 97 | printk(KERN_DEBUG "ESO: 0x%x\n", val & 0x00ffffff); |
98 | val = inl(TRID_REG(trident, CH_NX_ALPHA_FMS_FMC_RVOL_CVOL)); | 98 | val = inl(TRID_REG(trident, CH_NX_ALPHA_FMS_FMC_RVOL_CVOL)); |
99 | printk("Alpha: 0x%x\n", val >> 20); | 99 | printk(KERN_DEBUG "Alpha: 0x%x\n", val >> 20); |
100 | printk("FMS: 0x%x\n", (val >> 16) & 0x0f); | 100 | printk(KERN_DEBUG "FMS: 0x%x\n", (val >> 16) & 0x0f); |
101 | } | 101 | } |
102 | printk("FMC: 0x%x\n", (val >> 14) & 3); | 102 | printk(KERN_DEBUG "FMC: 0x%x\n", (val >> 14) & 3); |
103 | printk("RVol: 0x%x\n", (val >> 7) & 0x7f); | 103 | printk(KERN_DEBUG "RVol: 0x%x\n", (val >> 7) & 0x7f); |
104 | printk("CVol: 0x%x\n", val & 0x7f); | 104 | printk(KERN_DEBUG "CVol: 0x%x\n", val & 0x7f); |
105 | } | 105 | } |
106 | #endif | 106 | #endif |
107 | 107 | ||
@@ -496,12 +496,17 @@ void snd_trident_write_voice_regs(struct snd_trident * trident, | |||
496 | outl(regs[4], TRID_REG(trident, CH_START + 16)); | 496 | outl(regs[4], TRID_REG(trident, CH_START + 16)); |
497 | 497 | ||
498 | #if 0 | 498 | #if 0 |
499 | printk("written %i channel:\n", voice->number); | 499 | printk(KERN_DEBUG "written %i channel:\n", voice->number); |
500 | printk(" regs[0] = 0x%x/0x%x\n", regs[0], inl(TRID_REG(trident, CH_START + 0))); | 500 | printk(KERN_DEBUG " regs[0] = 0x%x/0x%x\n", |
501 | printk(" regs[1] = 0x%x/0x%x\n", regs[1], inl(TRID_REG(trident, CH_START + 4))); | 501 | regs[0], inl(TRID_REG(trident, CH_START + 0))); |
502 | printk(" regs[2] = 0x%x/0x%x\n", regs[2], inl(TRID_REG(trident, CH_START + 8))); | 502 | printk(KERN_DEBUG " regs[1] = 0x%x/0x%x\n", |
503 | printk(" regs[3] = 0x%x/0x%x\n", regs[3], inl(TRID_REG(trident, CH_START + 12))); | 503 | regs[1], inl(TRID_REG(trident, CH_START + 4))); |
504 | printk(" regs[4] = 0x%x/0x%x\n", regs[4], inl(TRID_REG(trident, CH_START + 16))); | 504 | printk(KERN_DEBUG " regs[2] = 0x%x/0x%x\n", |
505 | regs[2], inl(TRID_REG(trident, CH_START + 8))); | ||
506 | printk(KERN_DEBUG " regs[3] = 0x%x/0x%x\n", | ||
507 | regs[3], inl(TRID_REG(trident, CH_START + 12))); | ||
508 | printk(KERN_DEBUG " regs[4] = 0x%x/0x%x\n", | ||
509 | regs[4], inl(TRID_REG(trident, CH_START + 16))); | ||
505 | #endif | 510 | #endif |
506 | } | 511 | } |
507 | 512 | ||
@@ -583,7 +588,7 @@ static void snd_trident_write_vol_reg(struct snd_trident * trident, | |||
583 | outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2)); | 588 | outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2)); |
584 | break; | 589 | break; |
585 | case TRIDENT_DEVICE_ID_SI7018: | 590 | case TRIDENT_DEVICE_ID_SI7018: |
586 | // printk("voice->Vol = 0x%x\n", voice->Vol); | 591 | /* printk(KERN_DEBUG "voice->Vol = 0x%x\n", voice->Vol); */ |
587 | outw((voice->CTRL << 12) | voice->Vol, | 592 | outw((voice->CTRL << 12) | voice->Vol, |
588 | TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); | 593 | TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); |
589 | break; | 594 | break; |
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 1aafe956ee2b..809b233dd4a3 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -466,7 +466,10 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre | |||
466 | flag = VIA_TBL_BIT_FLAG; /* period boundary */ | 466 | flag = VIA_TBL_BIT_FLAG; /* period boundary */ |
467 | } else | 467 | } else |
468 | flag = 0; /* period continues to the next */ | 468 | flag = 0; /* period continues to the next */ |
469 | // printk("via: tbl %d: at %d size %d (rest %d)\n", idx, ofs, r, rest); | 469 | /* |
470 | printk(KERN_DEBUG "via: tbl %d: at %d size %d " | ||
471 | "(rest %d)\n", idx, ofs, r, rest); | ||
472 | */ | ||
470 | ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); | 473 | ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); |
471 | dev->idx_table[idx].offset = ofs; | 474 | dev->idx_table[idx].offset = ofs; |
472 | dev->idx_table[idx].size = r; | 475 | dev->idx_table[idx].size = r; |
@@ -2360,14 +2363,14 @@ static struct snd_pci_quirk dxs_whitelist[] __devinitdata = { | |||
2360 | SND_PCI_QUIRK(0x1019, 0x0996, "ESC Mobo", VIA_DXS_48K), | 2363 | SND_PCI_QUIRK(0x1019, 0x0996, "ESC Mobo", VIA_DXS_48K), |
2361 | SND_PCI_QUIRK(0x1019, 0x0a81, "ECS K7VTA3 v8.0", VIA_DXS_NO_VRA), | 2364 | SND_PCI_QUIRK(0x1019, 0x0a81, "ECS K7VTA3 v8.0", VIA_DXS_NO_VRA), |
2362 | SND_PCI_QUIRK(0x1019, 0x0a85, "ECS L7VMM2", VIA_DXS_NO_VRA), | 2365 | SND_PCI_QUIRK(0x1019, 0x0a85, "ECS L7VMM2", VIA_DXS_NO_VRA), |
2363 | SND_PCI_QUIRK(0x1019, 0, "ESC K8", VIA_DXS_SRC), | 2366 | SND_PCI_QUIRK_VENDOR(0x1019, "ESC K8", VIA_DXS_SRC), |
2364 | SND_PCI_QUIRK(0x1019, 0xaa01, "ESC K8T890-A", VIA_DXS_SRC), | 2367 | SND_PCI_QUIRK(0x1019, 0xaa01, "ESC K8T890-A", VIA_DXS_SRC), |
2365 | SND_PCI_QUIRK(0x1025, 0x0033, "Acer Inspire 1353LM", VIA_DXS_NO_VRA), | 2368 | SND_PCI_QUIRK(0x1025, 0x0033, "Acer Inspire 1353LM", VIA_DXS_NO_VRA), |
2366 | SND_PCI_QUIRK(0x1025, 0x0046, "Acer Aspire 1524 WLMi", VIA_DXS_SRC), | 2369 | SND_PCI_QUIRK(0x1025, 0x0046, "Acer Aspire 1524 WLMi", VIA_DXS_SRC), |
2367 | SND_PCI_QUIRK(0x1043, 0, "ASUS A7/A8", VIA_DXS_NO_VRA), | 2370 | SND_PCI_QUIRK_VENDOR(0x1043, "ASUS A7/A8", VIA_DXS_NO_VRA), |
2368 | SND_PCI_QUIRK(0x1071, 0, "Diverse Notebook", VIA_DXS_NO_VRA), | 2371 | SND_PCI_QUIRK_VENDOR(0x1071, "Diverse Notebook", VIA_DXS_NO_VRA), |
2369 | SND_PCI_QUIRK(0x10cf, 0x118e, "FSC Laptop", VIA_DXS_ENABLE), | 2372 | SND_PCI_QUIRK(0x10cf, 0x118e, "FSC Laptop", VIA_DXS_ENABLE), |
2370 | SND_PCI_QUIRK(0x1106, 0, "ASRock", VIA_DXS_SRC), | 2373 | SND_PCI_QUIRK_VENDOR(0x1106, "ASRock", VIA_DXS_SRC), |
2371 | SND_PCI_QUIRK(0x1297, 0xa231, "Shuttle AK31v2", VIA_DXS_SRC), | 2374 | SND_PCI_QUIRK(0x1297, 0xa231, "Shuttle AK31v2", VIA_DXS_SRC), |
2372 | SND_PCI_QUIRK(0x1297, 0xa232, "Shuttle", VIA_DXS_SRC), | 2375 | SND_PCI_QUIRK(0x1297, 0xa232, "Shuttle", VIA_DXS_SRC), |
2373 | SND_PCI_QUIRK(0x1297, 0xc160, "Shuttle Sk41G", VIA_DXS_SRC), | 2376 | SND_PCI_QUIRK(0x1297, 0xc160, "Shuttle Sk41G", VIA_DXS_SRC), |
@@ -2375,7 +2378,7 @@ static struct snd_pci_quirk dxs_whitelist[] __devinitdata = { | |||
2375 | SND_PCI_QUIRK(0x1462, 0x3800, "MSI KT266", VIA_DXS_ENABLE), | 2378 | SND_PCI_QUIRK(0x1462, 0x3800, "MSI KT266", VIA_DXS_ENABLE), |
2376 | SND_PCI_QUIRK(0x1462, 0x7120, "MSI KT4V", VIA_DXS_ENABLE), | 2379 | SND_PCI_QUIRK(0x1462, 0x7120, "MSI KT4V", VIA_DXS_ENABLE), |
2377 | SND_PCI_QUIRK(0x1462, 0x7142, "MSI K8MM-V", VIA_DXS_ENABLE), | 2380 | SND_PCI_QUIRK(0x1462, 0x7142, "MSI K8MM-V", VIA_DXS_ENABLE), |
2378 | SND_PCI_QUIRK(0x1462, 0, "MSI Mobo", VIA_DXS_SRC), | 2381 | SND_PCI_QUIRK_VENDOR(0x1462, "MSI Mobo", VIA_DXS_SRC), |
2379 | SND_PCI_QUIRK(0x147b, 0x1401, "ABIT KD7(-RAID)", VIA_DXS_ENABLE), | 2382 | SND_PCI_QUIRK(0x147b, 0x1401, "ABIT KD7(-RAID)", VIA_DXS_ENABLE), |
2380 | SND_PCI_QUIRK(0x147b, 0x1411, "ABIT VA-20", VIA_DXS_ENABLE), | 2383 | SND_PCI_QUIRK(0x147b, 0x1411, "ABIT VA-20", VIA_DXS_ENABLE), |
2381 | SND_PCI_QUIRK(0x147b, 0x1413, "ABIT KV8 Pro", VIA_DXS_ENABLE), | 2384 | SND_PCI_QUIRK(0x147b, 0x1413, "ABIT KV8 Pro", VIA_DXS_ENABLE), |
@@ -2389,11 +2392,11 @@ static struct snd_pci_quirk dxs_whitelist[] __devinitdata = { | |||
2389 | SND_PCI_QUIRK(0x161f, 0x2032, "m680x machines", VIA_DXS_48K), | 2392 | SND_PCI_QUIRK(0x161f, 0x2032, "m680x machines", VIA_DXS_48K), |
2390 | SND_PCI_QUIRK(0x1631, 0xe004, "PB EasyNote 3174", VIA_DXS_ENABLE), | 2393 | SND_PCI_QUIRK(0x1631, 0xe004, "PB EasyNote 3174", VIA_DXS_ENABLE), |
2391 | SND_PCI_QUIRK(0x1695, 0x3005, "EPoX EP-8K9A", VIA_DXS_ENABLE), | 2394 | SND_PCI_QUIRK(0x1695, 0x3005, "EPoX EP-8K9A", VIA_DXS_ENABLE), |
2392 | SND_PCI_QUIRK(0x1695, 0, "EPoX mobo", VIA_DXS_SRC), | 2395 | SND_PCI_QUIRK_VENDOR(0x1695, "EPoX mobo", VIA_DXS_SRC), |
2393 | SND_PCI_QUIRK(0x16f3, 0, "Jetway K8", VIA_DXS_SRC), | 2396 | SND_PCI_QUIRK_VENDOR(0x16f3, "Jetway K8", VIA_DXS_SRC), |
2394 | SND_PCI_QUIRK(0x1734, 0, "FSC Laptop", VIA_DXS_SRC), | 2397 | SND_PCI_QUIRK_VENDOR(0x1734, "FSC Laptop", VIA_DXS_SRC), |
2395 | SND_PCI_QUIRK(0x1849, 0x3059, "ASRock K7VM2", VIA_DXS_NO_VRA), | 2398 | SND_PCI_QUIRK(0x1849, 0x3059, "ASRock K7VM2", VIA_DXS_NO_VRA), |
2396 | SND_PCI_QUIRK(0x1849, 0, "ASRock mobo", VIA_DXS_SRC), | 2399 | SND_PCI_QUIRK_VENDOR(0x1849, "ASRock mobo", VIA_DXS_SRC), |
2397 | SND_PCI_QUIRK(0x1919, 0x200a, "Soltek SL-K8", VIA_DXS_NO_VRA), | 2400 | SND_PCI_QUIRK(0x1919, 0x200a, "Soltek SL-K8", VIA_DXS_NO_VRA), |
2398 | SND_PCI_QUIRK(0x4005, 0x4710, "MSI K7T266", VIA_DXS_SRC), | 2401 | SND_PCI_QUIRK(0x4005, 0x4710, "MSI K7T266", VIA_DXS_SRC), |
2399 | { } /* terminator */ | 2402 | { } /* terminator */ |
@@ -2433,9 +2436,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
2433 | unsigned int i; | 2436 | unsigned int i; |
2434 | int err; | 2437 | int err; |
2435 | 2438 | ||
2436 | card = snd_card_new(index, id, THIS_MODULE, 0); | 2439 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
2437 | if (card == NULL) | 2440 | if (err < 0) |
2438 | return -ENOMEM; | 2441 | return err; |
2439 | 2442 | ||
2440 | card_type = pci_id->driver_data; | 2443 | card_type = pci_id->driver_data; |
2441 | switch (card_type) { | 2444 | switch (card_type) { |
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 5bd79d2a5a15..0d54e3503c1e 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c | |||
@@ -328,7 +328,10 @@ static int build_via_table(struct viadev *dev, struct snd_pcm_substream *substre | |||
328 | flag = VIA_TBL_BIT_FLAG; /* period boundary */ | 328 | flag = VIA_TBL_BIT_FLAG; /* period boundary */ |
329 | } else | 329 | } else |
330 | flag = 0; /* period continues to the next */ | 330 | flag = 0; /* period continues to the next */ |
331 | // printk("via: tbl %d: at %d size %d (rest %d)\n", idx, ofs, r, rest); | 331 | /* |
332 | printk(KERN_DEBUG "via: tbl %d: at %d size %d " | ||
333 | "(rest %d)\n", idx, ofs, r, rest); | ||
334 | */ | ||
332 | ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); | 335 | ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); |
333 | dev->idx_table[idx].offset = ofs; | 336 | dev->idx_table[idx].offset = ofs; |
334 | dev->idx_table[idx].size = r; | 337 | dev->idx_table[idx].size = r; |
@@ -1167,9 +1170,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci, | |||
1167 | unsigned int i; | 1170 | unsigned int i; |
1168 | int err; | 1171 | int err; |
1169 | 1172 | ||
1170 | card = snd_card_new(index, id, THIS_MODULE, 0); | 1173 | err = snd_card_create(index, id, THIS_MODULE, 0, &card); |
1171 | if (card == NULL) | 1174 | if (err < 0) |
1172 | return -ENOMEM; | 1175 | return err; |
1173 | 1176 | ||
1174 | card_type = pci_id->driver_data; | 1177 | card_type = pci_id->driver_data; |
1175 | switch (card_type) { | 1178 | switch (card_type) { |
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c index acc352f4a441..fc9136c3e0d7 100644 --- a/sound/pci/vx222/vx222.c +++ b/sound/pci/vx222/vx222.c | |||
@@ -204,9 +204,9 @@ static int __devinit snd_vx222_probe(struct pci_dev *pci, | |||
204 | return -ENOENT; | 204 | return -ENOENT; |
205 | } | 205 | } |
206 | 206 | ||
207 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 207 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
208 | if (card == NULL) | 208 | if (err < 0) |
209 | return -ENOMEM; | 209 | return err; |
210 | 210 | ||
211 | switch ((int)pci_id->driver_data) { | 211 | switch ((int)pci_id->driver_data) { |
212 | case VX_PCI_VX222_OLD: | 212 | case VX_PCI_VX222_OLD: |
diff --git a/sound/pci/vx222/vx222_ops.c b/sound/pci/vx222/vx222_ops.c index 7e87f398ff0b..c0efe4491116 100644 --- a/sound/pci/vx222/vx222_ops.c +++ b/sound/pci/vx222/vx222_ops.c | |||
@@ -107,7 +107,9 @@ static unsigned char vx2_inb(struct vx_core *chip, int offset) | |||
107 | static void vx2_outb(struct vx_core *chip, int offset, unsigned char val) | 107 | static void vx2_outb(struct vx_core *chip, int offset, unsigned char val) |
108 | { | 108 | { |
109 | outb(val, vx2_reg_addr(chip, offset)); | 109 | outb(val, vx2_reg_addr(chip, offset)); |
110 | //printk("outb: %x -> %x\n", val, vx2_reg_addr(chip, offset)); | 110 | /* |
111 | printk(KERN_DEBUG "outb: %x -> %x\n", val, vx2_reg_addr(chip, offset)); | ||
112 | */ | ||
111 | } | 113 | } |
112 | 114 | ||
113 | /** | 115 | /** |
@@ -126,7 +128,9 @@ static unsigned int vx2_inl(struct vx_core *chip, int offset) | |||
126 | */ | 128 | */ |
127 | static void vx2_outl(struct vx_core *chip, int offset, unsigned int val) | 129 | static void vx2_outl(struct vx_core *chip, int offset, unsigned int val) |
128 | { | 130 | { |
129 | // printk("outl: %x -> %x\n", val, vx2_reg_addr(chip, offset)); | 131 | /* |
132 | printk(KERN_DEBUG "outl: %x -> %x\n", val, vx2_reg_addr(chip, offset)); | ||
133 | */ | ||
130 | outl(val, vx2_reg_addr(chip, offset)); | 134 | outl(val, vx2_reg_addr(chip, offset)); |
131 | } | 135 | } |
132 | 136 | ||
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c index 2631a554845e..4af66661f9b0 100644 --- a/sound/pci/ymfpci/ymfpci.c +++ b/sound/pci/ymfpci/ymfpci.c | |||
@@ -187,9 +187,9 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci, | |||
187 | return -ENOENT; | 187 | return -ENOENT; |
188 | } | 188 | } |
189 | 189 | ||
190 | card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); | 190 | err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); |
191 | if (card == NULL) | 191 | if (err < 0) |
192 | return -ENOMEM; | 192 | return err; |
193 | 193 | ||
194 | switch (pci_id->device) { | 194 | switch (pci_id->device) { |
195 | case 0x0004: str = "YMF724"; model = "DS-1"; break; | 195 | case 0x0004: str = "YMF724"; model = "DS-1"; break; |
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index 90d0d62bd0b4..2f0925236a1b 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c | |||
@@ -318,7 +318,12 @@ static void snd_ymfpci_pcm_interrupt(struct snd_ymfpci *chip, struct snd_ymfpci_ | |||
318 | ypcm->period_pos += delta; | 318 | ypcm->period_pos += delta; |
319 | ypcm->last_pos = pos; | 319 | ypcm->last_pos = pos; |
320 | if (ypcm->period_pos >= ypcm->period_size) { | 320 | if (ypcm->period_pos >= ypcm->period_size) { |
321 | // printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start); | 321 | /* |
322 | printk(KERN_DEBUG | ||
323 | "done - active_bank = 0x%x, start = 0x%x\n", | ||
324 | chip->active_bank, | ||
325 | voice->bank[chip->active_bank].start); | ||
326 | */ | ||
322 | ypcm->period_pos %= ypcm->period_size; | 327 | ypcm->period_pos %= ypcm->period_size; |
323 | spin_unlock(&chip->reg_lock); | 328 | spin_unlock(&chip->reg_lock); |
324 | snd_pcm_period_elapsed(ypcm->substream); | 329 | snd_pcm_period_elapsed(ypcm->substream); |
@@ -366,7 +371,12 @@ static void snd_ymfpci_pcm_capture_interrupt(struct snd_pcm_substream *substream | |||
366 | ypcm->last_pos = pos; | 371 | ypcm->last_pos = pos; |
367 | if (ypcm->period_pos >= ypcm->period_size) { | 372 | if (ypcm->period_pos >= ypcm->period_size) { |
368 | ypcm->period_pos %= ypcm->period_size; | 373 | ypcm->period_pos %= ypcm->period_size; |
369 | // printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start); | 374 | /* |
375 | printk(KERN_DEBUG | ||
376 | "done - active_bank = 0x%x, start = 0x%x\n", | ||
377 | chip->active_bank, | ||
378 | voice->bank[chip->active_bank].start); | ||
379 | */ | ||
370 | spin_unlock(&chip->reg_lock); | 380 | spin_unlock(&chip->reg_lock); |
371 | snd_pcm_period_elapsed(substream); | 381 | snd_pcm_period_elapsed(substream); |
372 | spin_lock(&chip->reg_lock); | 382 | spin_lock(&chip->reg_lock); |