Changeset 426 for GPL/trunk/alsa-kernel/pci
- Timestamp:
- May 9, 2009, 11:45:26 AM (17 years ago)
- Location:
- GPL/trunk/alsa-kernel/pci
- Files:
-
- 50 edited
-
ac97/ac97_codec.c (modified) (4 diffs)
-
ac97/ac97_proc.c (modified) (1 diff)
-
ak4531_codec.c (modified) (1 diff)
-
ali5451/ali5451.c (modified) (3 diffs)
-
als4000.c (modified) (1 diff)
-
atiixp.c (modified) (1 diff)
-
au88x0/au88x0.c (modified) (1 diff)
-
au88x0/au88x0_a3d.c (modified) (1 diff)
-
au88x0/au88x0_core.c (modified) (5 diffs)
-
au88x0/au88x0_synth.c (modified) (3 diffs)
-
ca0106/ca0106_main.c (modified) (15 diffs)
-
cmipci.c (modified) (1 diff)
-
cs4281.c (modified) (1 diff)
-
cs46xx/cs46xx_lib.c (modified) (2 diffs)
-
cs46xx/cs46xx_lib.h (modified) (1 diff)
-
emu10k1/emu10k1_callback.c (modified) (2 diffs)
-
emu10k1/emu10k1_main.c (modified) (5 diffs)
-
emu10k1/emu10k1x.c (modified) (1 diff)
-
emu10k1/emufx.c (modified) (5 diffs)
-
emu10k1/emupcm.c (modified) (7 diffs)
-
emu10k1/io.c (modified) (2 diffs)
-
emu10k1/p16v.c (modified) (16 diffs)
-
emu10k1/voice.c (modified) (3 diffs)
-
ens1370.c (modified) (1 diff)
-
es1938.c (modified) (4 diffs)
-
es1968.c (modified) (1 diff)
-
hda/hda_beep.h (modified) (2 diffs)
-
hda/hda_codec.c (modified) (117 diffs)
-
hda/hda_codec.h (modified) (15 diffs)
-
hda/hda_generic.c (modified) (7 diffs)
-
hda/hda_hwdep.c (modified) (12 diffs)
-
hda/hda_intel.c (modified) (41 diffs)
-
hda/hda_local.h (modified) (11 diffs)
-
hda/hda_proc.c (modified) (8 diffs)
-
hda/patch_analog.c (modified) (63 diffs)
-
hda/patch_atihdmi.c (modified) (2 diffs)
-
hda/patch_cmedia.c (modified) (4 diffs)
-
hda/patch_conexant.c (modified) (42 diffs)
-
hda/patch_realtek.c (modified) (210 diffs)
-
hda/patch_si3054.c (modified) (3 diffs)
-
hda/patch_sigmatel.c (modified) (160 diffs)
-
hda/patch_via.c (modified) (10 diffs)
-
intel8x0.c (modified) (20 diffs)
-
maestro3.c (modified) (1 diff)
-
rme9652/hdsp.c (modified) (163 diffs)
-
rme9652/hdspm.c (modified) (2 diffs)
-
sonicvibes.c (modified) (5 diffs)
-
trident/trident_main.c (modified) (4 diffs)
-
via82xx.c (modified) (5 diffs)
-
ymfpci/ymfpci_main.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk/alsa-kernel/pci/ac97/ac97_codec.c
r410 r426 144 144 { 0x43585421, 0xffffffff, "HSD11246", NULL, NULL }, // SmartMC II 145 145 { 0x43585428, 0xfffffff8, "Cx20468", patch_conexant, NULL }, // SmartAMC fixme: the mask might be different 146 { 0x43585430, 0xffffffff, "Cx20468-31", patch_conexant, NULL }, 146 147 { 0x43585431, 0xffffffff, "Cx20551", patch_cx20551, NULL }, 147 148 { 0x44543031, 0xfffffff0, "DT0398", NULL, NULL }, … … 384 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 388 int snd_ac97_update_bits_nolock(struct snd_ac97 *ac97, unsigned short reg, 388 389 unsigned short mask, unsigned short value) … … 1682 1683 int err, idx; 1683 1684 1684 //printk("AC97_GPIO_CFG = %x\n",snd_ac97_read(ac97,AC97_GPIO_CFG)); 1685 /* 1686 printk(KERN_DEBUG "AC97_GPIO_CFG = %x\n", 1687 snd_ac97_read(ac97,AC97_GPIO_CFG)); 1688 */ 1685 1689 snd_ac97_write(ac97, AC97_GPIO_CFG, 0xffff & ~(AC97_GPIO_LINE1_OH)); 1686 1690 snd_ac97_write(ac97, AC97_GPIO_POLARITY, 0xffff & ~(AC97_GPIO_LINE1_OH)); … … 2162 2166 /* nothing should be in powerdown mode */ 2163 2167 snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0); 2164 end_time = jiffies + msecs_to_jiffies(1 00);2168 end_time = jiffies + msecs_to_jiffies(120); 2165 2169 do { 2166 2170 if ((snd_ac97_read(ac97, AC97_POWERDOWN) & 0x0f) == 0x0f) -
GPL/trunk/alsa-kernel/pci/ac97/ac97_proc.c
r305 r426 125 125 snd_iprintf(buffer, "PCI Subsys Device: 0x%04x\n\n", 126 126 ac97->subsystem_device); 127 128 snd_iprintf(buffer, "Flags: %x\n", ac97->flags); 127 129 128 130 if ((ac97->ext_id & AC97_EI_REV_MASK) >= AC97_EI_REV_23) { -
GPL/trunk/alsa-kernel/pci/ak4531_codec.c
r399 r426 52 52 53 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 -
GPL/trunk/alsa-kernel/pci/ali5451/ali5451.c
r410 r426 2153 2153 int err; 2154 2154 2155 snd_ali_printk("resou ces allocation ...\n");2155 snd_ali_printk("resources allocation ...\n"); 2156 2156 err = pci_request_regions(codec->pci, "ALI 5451"); 2157 2157 if (err < 0) … … 2165 2165 } 2166 2166 codec->irq = codec->pci->irq; 2167 snd_ali_printk("resou ces allocated.\n");2167 snd_ali_printk("resources allocated.\n"); 2168 2168 return 0; 2169 2169 } … … 2197 2197 return err; 2198 2198 /* check, if we can restrict PCI DMA transfers to 31 bits */ 2199 if (pci_set_dma_mask(pci, DMA_ 31BIT_MASK) < 0 ||2200 pci_set_consistent_dma_mask(pci, DMA_ 31BIT_MASK) < 0) {2199 if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 || 2200 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) { 2201 2201 snd_printk(KERN_ERR "architecture does not support " 2202 2202 "31bit PCI busmaster DMA\n"); -
GPL/trunk/alsa-kernel/pci/als4000.c
r410 r426 873 873 } 874 874 /* check, if we can restrict PCI DMA transfers to 24 bits */ 875 if (pci_set_dma_mask(pci, DMA_ 24BIT_MASK) < 0 ||876 pci_set_consistent_dma_mask(pci, DMA_ 24BIT_MASK) < 0) {875 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 876 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 877 877 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 878 878 pci_disable_device(pci); -
GPL/trunk/alsa-kernel/pci/atiixp.c
r410 r426 1396 1396 .type = AC97_TUNE_MUTE_LED 1397 1397 }, 1398 { 1399 .subvendor = 0x103c, 1400 .subdevice = 0x3091, 1401 .name = "unknown HP", 1402 .type = AC97_TUNE_MUTE_LED 1403 }, 1398 1404 {0} /* terminator */ 1399 1405 }; -
GPL/trunk/alsa-kernel/pci/au88x0/au88x0.c
r410 r426 152 152 if ((err = pci_enable_device(pci)) < 0) 153 153 return err; 154 if (pci_set_dma_mask(pci, DMA_ 32BIT_MASK) < 0 ||155 pci_set_consistent_dma_mask(pci, DMA_ 32BIT_MASK) < 0) {154 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || 155 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 156 156 printk(KERN_ERR "error to set DMA mask\n"); 157 157 pci_disable_device(pci); -
GPL/trunk/alsa-kernel/pci/au88x0/au88x0_a3d.c
r305 r426 463 463 static void a3dsrc_ZeroState(a3dsrc_t * a) 464 464 { 465 466 //printk("vortex: ZeroState slice: %d, source %d\n", a->slice, a->source); 467 465 /* 466 printk(KERN_DEBUG "vortex: ZeroState slice: %d, source %d\n", 467 a->slice, a->source); 468 */ 468 469 a3dsrc_SetAtmosState(a, 0, 0, 0, 0); 469 470 a3dsrc_SetHrtfState(a, A3dHrirZeros, A3dHrirZeros); -
GPL/trunk/alsa-kernel/pci/au88x0/au88x0_core.c
r399 r426 1136 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 1142 hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFCFG0 + (adbdma << 3), dma->cfg0); 1140 1143 hwwrite(vortex->mmio, VORTEX_ADBDMA_BUFCFG1 + (adbdma << 3), dma->cfg1); … … 1960 1963 vortex_connection_mix_adb(vortex, en, 0x11, mixers[3], 1961 1964 ADB_CODECOUT(1 + 4)); 1962 / /printk("SDAC detected ");1965 /* printk(KERN_DEBUG "SDAC detected "); */ 1963 1966 } 1964 1967 #else … … 2014 2017 else 2015 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 2024 return i; 2018 2025 } … … 2025 2032 if (resmap[restype] & (1 << i)) { 2026 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 2039 return i; 2029 2040 } … … 2790 2801 int a, this_194; 2791 2802 2792 if ((bits != 8) ||(bits != 16))2803 if ((bits != 8) && (bits != 16)) 2793 2804 return -1; 2794 2805 -
GPL/trunk/alsa-kernel/pci/au88x0/au88x0_synth.c
r305 r426 214 214 /* Voice specific parameters */ 215 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 220 hwwrite(vortex->mmio, WT_RUN(wt), val); 218 221 return 0xc; 219 222 break; 220 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 228 hwwrite(vortex->mmio, WT_PARM(wt, 0), val); 223 229 return 0xc; 224 230 break; 225 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 236 hwwrite(vortex->mmio, WT_PARM(wt, 1), val); 228 237 return 0xc; 229 238 break; 230 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 244 hwwrite(vortex->mmio, WT_PARM(wt, 2), val); 233 245 return 0xc; 234 246 break; 235 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 252 hwwrite(vortex->mmio, WT_PARM(wt, 3), val); 238 253 return 0xc; 239 254 break; 240 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 260 hwwrite(vortex->mmio, WT_MUTE(wt), val); 243 261 return 0xc; … … 245 263 case 0xb: 246 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 269 hwwrite(vortex->mmio, WT_DELAY(wt, 3), val); 249 270 hwwrite(vortex->mmio, WT_DELAY(wt, 2), val); … … 273 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 299 hwwrite(vortex->mmio, ecx, val); 277 300 return 1; -
GPL/trunk/alsa-kernel/pci/ca0106/ca0106_main.c
r410 r426 256 256 .i2c_adc = 1, 257 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 266 /* Shuttle XPC SD31P which has an onboard Creative Labs 259 267 * Sound Blaster Live! 24-bit EAX … … 405 413 406 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 418 /* Not sure what this I2C channel controls. */ 409 419 /* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */ … … 423 433 while (1) { 424 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 436 timeout++; 427 437 if ((status & I2C_A_ADC_START) == 0) … … 522 532 523 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 538 //channel->interrupt = snd_ca0106_pcm_channel_interrupt; 526 539 channel->epcm = epcm; … … 615 628 616 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 634 //channel->interrupt = snd_ca0106_pcm_channel_interrupt; 619 635 channel->epcm = epcm; … … 706 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)); 709 //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); 710 //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); 724 #if 0 /* debug */ 725 snd_printk(KERN_DEBUG 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 738 /* Rate can be set per channel. */ 712 739 /* reg40 control host to fifo */ … … 800 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)); 803 //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); 804 //snd_printk("dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",emu->buffer.addr, emu->buffer.area, emu->buffer.bytes); 829 #if 0 /* debug */ 830 snd_printk(KERN_DEBUG 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 843 /* reg71 controls ADC rate. */ 806 844 switch (runtime->rate) { … … 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 895 snd_ca0106_ptr_write(emu, 0x13, channel, 0); 851 896 snd_ca0106_ptr_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr); … … 889 934 epcm = runtime->private_data; 890 935 channel = epcm->channel_id; 891 /* snd_printk( "channel=%d\n",channel); */936 /* snd_printk(KERN_DEBUG "channel=%d\n", channel); */ 892 937 epcm->running = running; 893 938 basic |= (0x1 << channel); … … 895 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 944 switch (cmd) { … … 973 1018 if (ptr >= runtime->buffer_size) 974 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); 976 1020 /* 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 1027 return ptr; 978 1028 } … … 996 1046 if (ptr >= runtime->buffer_size) 997 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); 999 1048 /* 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 1055 return ptr; 1001 1056 } … … 1182 1237 1183 1238 stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0); 1184 //snd_printk("interrupt status = 0x%08x, stat76=0x%08x\n", status, stat76); 1185 //snd_printk("ptr=0x%08x\n",snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0)); 1239 /* 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 1245 mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */ 1187 1246 for(i = 0; i < 4; i++) { … … 1471 1530 1472 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 1533 for (n = 0; n < size; n++) 1475 1534 snd_ca0106_i2c_write(chip, i2c_adc_init[n][0], … … 1531 1590 if (err < 0) 1532 1591 return err; 1533 if (pci_set_dma_mask(pci, DMA_ 32BIT_MASK) < 0 ||1534 pci_set_consistent_dma_mask(pci, DMA_ 32BIT_MASK) < 0) {1592 if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 || 1593 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) { 1535 1594 printk(KERN_ERR "error to set 32bit mask DMA\n"); 1536 1595 pci_disable_device(pci); -
GPL/trunk/alsa-kernel/pci/cmipci.c
r410 r426 3031 3031 }; 3032 3032 unsigned int val; 3033 long iomidi ;3033 long iomidi = 0; 3034 3034 int integrated_midi = 0; 3035 3035 char modelstr[16]; -
GPL/trunk/alsa-kernel/pci/cs4281.c
r410 r426 835 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 842 return runtime->buffer_size - 839 843 snd_cs4281_peekBA0(chip, dma->regDCC) - 1; -
GPL/trunk/alsa-kernel/pci/cs46xx/cs46xx_lib.c
r410 r426 195 195 */ 196 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 198 snd_cs46xx_peekBA0(chip, BA0_ACSDA), 199 199 snd_cs46xx_peekBA0(chip, BA0_ACCAD)); … … 429 429 430 430 if(status & SERBST_WBSY) { 431 snd_printk( KERN_ERR "cs46xx: failure waiting for FIFO command to complete\n");432 431 snd_printk(KERN_ERR "cs46xx: failure waiting for " 432 "FIFO command to complete\n"); 433 433 return -EINVAL; 434 434 } -
GPL/trunk/alsa-kernel/pci/cs46xx/cs46xx_lib.h
r305 r426 63 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 70 writel(val, chip->region.idx[bank+1].remap_addr + offset); 67 71 } -
GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1_callback.c
r399 r426 104 104 vp = &emu->voices[best[i].voice]; 105 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 110 continue; 108 111 } … … 336 339 emem->map_locked++; 337 340 if (snd_emu10k1_memblk_map(hw, emem) < 0) { 338 / / printk("emu: cannot map!\n");341 /* printk(KERN_ERR "emu: cannot map!\n"); */ 339 342 return -ENOMEM; 340 343 } -
GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1_main.c
r402 r426 715 715 { 716 716 struct snd_emu10k1 *emu = data; 717 int tmp, tmp2; 718 int reg; 717 u32 tmp, tmp2, reg; 719 718 int err; 720 719 … … 762 761 snd_emu1010_fpga_read(emu, EMU_DOCK_MAJOR_REV, &tmp); 763 762 snd_emu1010_fpga_read(emu, EMU_DOCK_MINOR_REV, &tmp2); 764 snd_printk("Audio Dock ver:%d.%d\n", tmp, tmp2); 763 snd_printk(KERN_INFO "Audio Dock ver: %u.%u\n", 764 tmp, tmp2); 765 765 /* Sync clocking between 1010 and Dock */ 766 766 /* Allow DLL to settle */ … … 808 808 { 809 809 unsigned int i; 810 int tmp, tmp2; 811 int reg; 810 u32 tmp, tmp2, reg; 812 811 int err; 813 812 const char *filename = NULL; … … 891 890 snd_emu1010_fpga_read(emu, EMU_HANA_MAJOR_REV, &tmp); 892 891 snd_emu1010_fpga_read(emu, EMU_HANA_MINOR_REV, &tmp2); 893 snd_printk( "emu1010: Hana version: %d.%d\n", tmp, tmp2);892 snd_printk(KERN_INFO "emu1010: Hana version: %u.%u\n", tmp, tmp2); 894 893 /* Enable 48Volt power to Audio Dock */ 895 894 snd_emu1010_fpga_write(emu, EMU_HANA_DOCK_PWR, EMU_HANA_DOCK_PWR_ON); … … 1532 1531 .spk71 = 1, 1533 1532 .spdif_bug = 1, 1533 .invert_shared_spdif = 1, /* digital/analog switch swapped */ 1534 1534 .ac97_chip = 1} , 1535 1535 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x10021102, -
GPL/trunk/alsa-kernel/pci/emu10k1/emu10k1x.c
r410 r426 898 898 if ((err = pci_enable_device(pci)) < 0) 899 899 return err; 900 if (pci_set_dma_mask(pci, DMA_ 28BIT_MASK) < 0 ||901 pci_set_consistent_dma_mask(pci, DMA_ 28BIT_MASK) < 0) {900 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 901 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 902 902 snd_printk(KERN_ERR "error to set 28bit mask DMA\n"); 903 903 pci_disable_device(pci); -
GPL/trunk/alsa-kernel/pci/emu10k1/emufx.c
r399 r426 1520 1520 if (emu->card_capabilities->emu_model) { 1521 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 1523 for (z = 0; z < 8; z++) { 1524 1524 if (emu->card_capabilities->ca0108_chip) { … … 1568 1568 if (emu->card_capabilities->emu_model) { 1569 1569 if (emu->card_capabilities->ca0108_chip) { 1570 snd_printk( "EMU2 inputs on\n");1570 snd_printk(KERN_INFO "EMU2 inputs on\n"); 1571 1571 for (z = 0; z < 0x10; z++) { 1572 1572 snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, … … 1576 1576 } 1577 1577 } else { 1578 snd_printk( "EMU inputs on\n");1578 snd_printk(KERN_INFO "EMU inputs on\n"); 1579 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 1585 /* For the EMU1010: How to get 32bit values from the DSP. High 16bits into L, low 16bits into R. */ 1583 1586 /* A_P16VIN(0) is delayed by one sample, … … 2491 2494 if (!capable(CAP_SYS_ADMIN)) 2492 2495 return -EPERM; 2493 icode = kmalloc(sizeof(*icode), GFP_KERNEL); 2494 if (icode == NULL) 2495 return -ENOMEM; 2496 if (copy_from_user(icode, argp, sizeof(*icode))) { 2497 kfree(icode); 2498 return -EFAULT; 2499 } 2496 2497 icode = memdup_user(argp, sizeof(*icode)); 2498 if (IS_ERR(icode)) 2499 return PTR_ERR(icode); 2500 2500 res = snd_emu10k1_icode_poke(emu, icode); 2501 2501 kfree(icode); 2502 2502 return res; 2503 2503 case SNDRV_EMU10K1_IOCTL_CODE_PEEK: 2504 icode = kmalloc(sizeof(*icode), GFP_KERNEL); 2505 if (icode == NULL) 2506 return -ENOMEM; 2507 if (copy_from_user(icode, argp, sizeof(*icode))) { 2508 kfree(icode); 2509 return -EFAULT; 2510 } 2504 icode = memdup_user(argp, sizeof(*icode)); 2505 if (IS_ERR(icode)) 2506 return PTR_ERR(icode); 2511 2507 res = snd_emu10k1_icode_peek(emu, icode); 2512 2508 if (res == 0 && copy_to_user(argp, icode, sizeof(*icode))) { … … 2517 2513 return res; 2518 2514 case SNDRV_EMU10K1_IOCTL_PCM_POKE: 2519 ipcm = kmalloc(sizeof(*ipcm), GFP_KERNEL); 2520 if (ipcm == NULL) 2521 return -ENOMEM; 2522 if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { 2523 kfree(ipcm); 2524 return -EFAULT; 2525 } 2515 ipcm = memdup_user(argp, sizeof(*ipcm)); 2516 if (IS_ERR(ipcm)) 2517 return PTR_ERR(ipcm); 2526 2518 res = snd_emu10k1_ipcm_poke(emu, ipcm); 2527 2519 kfree(ipcm); 2528 2520 return res; 2529 2521 case SNDRV_EMU10K1_IOCTL_PCM_PEEK: 2530 ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL); 2531 if (ipcm == NULL) 2532 return -ENOMEM; 2533 if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { 2534 kfree(ipcm); 2535 return -EFAULT; 2536 } 2522 ipcm = memdup_user(argp, sizeof(*ipcm)); 2523 if (IS_ERR(ipcm)) 2524 return PTR_ERR(ipcm); 2537 2525 res = snd_emu10k1_ipcm_peek(emu, ipcm); 2538 2526 if (res == 0 && copy_to_user(argp, ipcm, sizeof(*ipcm))) { -
GPL/trunk/alsa-kernel/pci/emu10k1/emupcm.c
r305 r426 45 45 return; 46 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 48 epcm->substream->runtime->hw->pointer(emu, epcm->substream), 49 49 snd_pcm_lib_period_bytes(epcm->substream), … … 147 147 &epcm->extra); 148 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 154 for (i = 0; i < voices; i++) { 151 155 snd_emu10k1_voice_free(epcm->emu, epcm->voices[i]); … … 738 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 748 spin_lock(&emu->reg_lock); 742 749 switch (cmd) { … … 787 794 outl(epcm->capture_ipr, emu->port + IPR); 788 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 800 switch (epcm->type) { 791 801 case CAPTURE_AC97ADC: … … 858 868 } 859 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 875 return ptr; 862 876 } … … 1547 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 1568 if ((tram_shift & 1) == 0) { 1551 1569 while (count--) { … … 1624 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 1650 memset(&pcm->pcm_rec, 0, sizeof(pcm->pcm_rec)); 1628 1651 pcm->pcm_rec.hw_buffer_size = pcm->buffer_size * 2; /* byte size */ -
GPL/trunk/alsa-kernel/pci/emu10k1/io.c
r305 r426 227 227 228 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 232 break; 231 233 } … … 489 491 break; 490 492 } 491 if (count > =16384)493 if (count > 16384) 492 494 break; 493 495 curtime = newtime; -
GPL/trunk/alsa-kernel/pci/emu10k1/p16v.c
r305 r426 169 169 170 170 if (epcm) { 171 / /snd_printk("epcm free: %p\n", epcm);171 /* snd_printk(KERN_DEBUG "epcm free: %p\n", epcm); */ 172 172 kfree(epcm); 173 173 } … … 184 184 185 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 188 if (epcm == NULL) … … 190 190 epcm->emu = emu; 191 191 epcm->substream = substream; 192 //snd_printk("epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); 193 192 /* 193 snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", 194 substream->pcm->device, channel_id); 195 */ 194 196 runtime->private_data = epcm; 195 197 runtime->private_free = snd_p16v_pcm_free_substream; … … 201 203 202 204 channel->use=1; 203 //snd_printk("p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); 204 //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); 205 //channel->interrupt = snd_p16v_pcm_channel_interrupt; 206 channel->epcm=epcm; 205 #if 0 /* debug */ 206 snd_printk(KERN_DEBUG 207 "p16v: open channel_id=%d, channel=%p, use=0x%x\n", 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 214 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 208 215 return err; … … 225 232 226 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 236 if (epcm == NULL) … … 231 238 epcm->emu = emu; 232 239 epcm->substream = substream; 233 //snd_printk("epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id); 234 240 /* 241 snd_printk(KERN_DEBUG "epcm device=%d, channel_id=%d\n", 242 substream->pcm->device, channel_id); 243 */ 235 244 runtime->private_data = epcm; 236 245 runtime->private_free = snd_p16v_pcm_free_substream; … … 242 251 243 252 channel->use=1; 244 //snd_printk("p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use); 245 //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel); 246 //channel->interrupt = snd_p16v_pcm_channel_interrupt; 247 channel->epcm=epcm; 253 #if 0 /* debug */ 254 snd_printk(KERN_DEBUG 255 "p16v: open channel_id=%d, channel=%p, use=0x%x\n", 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 262 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 249 263 return err; … … 335 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)); 338 //snd_printk("dma_addr=%x, dma_area=%p, table_base=%p\n",runtime->dma_addr, runtime->dma_area, table_base); 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); 351 #if 0 /* debug */ 352 snd_printk(KERN_DEBUG "prepare:channel_number=%d, rate=%d, " 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 364 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); 341 365 switch (runtime->rate) { … … 380 404 int channel = substream->pcm->device - emu->p16v_device_offset; 381 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 415 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel); 384 416 switch (runtime->rate) { … … 460 492 epcm = runtime->private_data; 461 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 495 epcm->running = running; 464 496 basic |= (0x1<<channel); … … 466 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 502 switch (cmd) { … … 559 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); 562 593 /* 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 600 return ptr; 564 601 } … … 593 630 if (chip->p16v_buffer.area) { 594 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 637 return 0; … … 605 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 648 emu->p16v_device_offset = device; 609 649 if (rpcm) … … 632 672 ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) 633 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 … … 643 686 65536 - 64, 65536 - 64)) < 0) 644 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 -
GPL/trunk/alsa-kernel/pci/emu10k1/voice.c
r399 r426 54 54 first_voice = last_voice = 0; 55 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 60 i %= NUM_G; 58 61 … … 72 75 } 73 76 if (!skip) { 74 / / printk("allocated voice %d\n", i);77 /* printk(KERN_DEBUG "allocated voice %d\n", i); */ 75 78 first_voice = i; 76 79 last_voice = (i + number) % NUM_G; … … 85 88 for (i = 0; i < number; i++) { 86 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 94 voice->use = 1; 89 95 switch (type) { -
GPL/trunk/alsa-kernel/pci/ens1370.c
r410 r426 585 585 586 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 589 reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); 589 590 #endif -
GPL/trunk/alsa-kernel/pci/es1938.c
r410 r426 1609 1609 return err; 1610 1610 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1611 if (pci_set_dma_mask(pci, DMA_ 24BIT_MASK) < 0 ||1612 pci_set_consistent_dma_mask(pci, DMA_ 24BIT_MASK) < 0) {1611 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 1612 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 1613 1613 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1614 1614 pci_disable_device(pci); … … 1674 1674 status = inb(SLIO_REG(chip, IRQCONTROL)); 1675 1675 #if 0 1676 printk( "Es1938debug - interrupt status: =0x%x\n", status);1676 printk(KERN_DEBUG "Es1938debug - interrupt status: =0x%x\n", status); 1677 1677 #endif 1678 1678 … … 1680 1680 if (status & 0x10) { 1681 1681 #if 0 1682 printk("Es1938debug - AUDIO channel 1 interrupt\n"); 1683 printk("Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", 1682 printk(KERN_DEBUG 1683 "Es1938debug - AUDIO channel 1 interrupt\n"); 1684 printk(KERN_DEBUG 1685 "Es1938debug - AUDIO channel 1 DMAC DMA count: %u\n", 1684 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 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 1692 inl(SLDM_REG(chip, DMASTATUS))); 1689 1693 #endif … … 1700 1704 if (status & 0x20) { 1701 1705 #if 0 1702 printk("Es1938debug - AUDIO channel 2 interrupt\n"); 1703 printk("Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", 1706 printk(KERN_DEBUG 1707 "Es1938debug - AUDIO channel 2 interrupt\n"); 1708 printk(KERN_DEBUG 1709 "Es1938debug - AUDIO channel 2 DMAC DMA count: %u\n", 1704 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 1713 inl(SLIO_REG(chip, AUDIO2DMAADDR))); 1707 1714 -
GPL/trunk/alsa-kernel/pci/es1968.c
r410 r426 2549 2549 return err; 2550 2550 /* check, if we can restrict PCI DMA transfers to 28 bits */ 2551 if (pci_set_dma_mask(pci, DMA_ 28BIT_MASK) < 0 ||2552 pci_set_consistent_dma_mask(pci, DMA_ 28BIT_MASK) < 0) {2551 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 2552 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 2553 2553 snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); 2554 2554 pci_disable_device(pci); -
GPL/trunk/alsa-kernel/pci/hda/hda_beep.h
r417 r426 32 32 int tone; 33 33 int nid; 34 int enabled; 34 35 struct work_struct beep_work; /* scheduled task for beep event */ 35 36 }; … … 39 40 void snd_hda_detach_beep_device(struct hda_codec *codec); 40 41 #else 41 #define snd_hda_attach_beep_device(...) 42 #define snd_hda_attach_beep_device(...) 0 42 43 #define snd_hda_detach_beep_device(...) 43 44 #endif -
GPL/trunk/alsa-kernel/pci/hda/hda_codec.c
r417 r426 32 32 #include "hda_local.h" 33 33 #include <sound/hda_hwdep.h> 34 #include "hda_patch.h" /* codec presets */35 36 #ifdef CONFIG_SND_HDA_POWER_SAVE37 /* define this option here to hide as static */38 static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT;39 module_param(power_save, int, 0644);40 MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "41 "(in second, 0 = disable).");42 #endif43 34 44 35 /* … … 56 47 { 0x1057, "Motorola" }, 57 48 { 0x1095, "Silicon Image" }, 49 { 0x10de, "Nvidia" }, 58 50 { 0x10ec, "Realtek" }, 59 51 { 0x1106, "VIA" }, … … 67 59 { 0x1aec, "Wolfson Microelectronics" }, 68 60 { 0x434d, "C-Media" }, 61 { 0x8086, "Intel" }, 69 62 { 0x8384, "SigmaTel" }, 70 63 {0} /* terminator */ 71 64 }; 72 65 73 static const struct hda_codec_preset *hda_preset_tables[] = { 74 #ifdef CONFIG_SND_HDA_CODEC_REALTEK 75 snd_hda_preset_realtek, 76 #endif 77 #ifdef CONFIG_SND_HDA_CODEC_CMEDIA 78 snd_hda_preset_cmedia, 79 #endif 80 #ifdef CONFIG_SND_HDA_CODEC_ANALOG 81 snd_hda_preset_analog, 82 #endif 83 #ifdef CONFIG_SND_HDA_CODEC_SIGMATEL 84 snd_hda_preset_sigmatel, 85 #endif 86 #ifdef CONFIG_SND_HDA_CODEC_SI3054 87 snd_hda_preset_si3054, 88 #endif 89 #ifdef CONFIG_SND_HDA_CODEC_ATIHDMI 90 snd_hda_preset_atihdmi, 91 #endif 92 #ifdef CONFIG_SND_HDA_CODEC_CONEXANT 93 snd_hda_preset_conexant, 94 #endif 95 #ifdef CONFIG_SND_HDA_CODEC_VIA 96 snd_hda_preset_via, 97 #endif 98 #ifdef CONFIG_SND_HDA_CODEC_NVHDMI 99 snd_hda_preset_nvhdmi, 100 #endif 101 #ifdef CONFIG_SND_HDA_CODEC_INTELHDMI 102 snd_hda_preset_intelhdmi, 103 #endif 104 NULL 105 }; 66 static DEFINE_MUTEX(preset_mutex); 67 static LIST_HEAD(hda_preset_tables); 68 69 int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset) 70 { 71 mutex_lock(&preset_mutex); 72 list_add_tail(&preset->list, &hda_preset_tables); 73 mutex_unlock(&preset_mutex); 74 return 0; 75 } 76 EXPORT_SYMBOL_HDA(snd_hda_add_codec_preset); 77 78 int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) 79 { 80 mutex_lock(&preset_mutex); 81 list_del(&preset->list); 82 mutex_unlock(&preset_mutex); 83 return 0; 84 } 85 EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset); 106 86 107 87 #ifdef CONFIG_SND_HDA_POWER_SAVE … … 137 117 return "UNKNOWN"; 138 118 } 119 EXPORT_SYMBOL_HDA(snd_hda_get_jack_location); 139 120 140 121 const char *snd_hda_get_jack_connectivity(u32 cfg) … … 144 125 return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3]; 145 126 } 127 EXPORT_SYMBOL_HDA(snd_hda_get_jack_connectivity); 146 128 147 129 const char *snd_hda_get_jack_type(u32 cfg) … … 157 139 >> AC_DEFCFG_DEVICE_SHIFT]; 158 140 } 141 EXPORT_SYMBOL_HDA(snd_hda_get_jack_type); 159 142 160 143 /* … … 205 188 return res; 206 189 } 190 EXPORT_SYMBOL_HDA(snd_hda_codec_read); 207 191 208 192 /** … … 233 217 return err; 234 218 } 219 EXPORT_SYMBOL_HDA(snd_hda_codec_write); 235 220 236 221 /** … … 247 232 snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); 248 233 } 234 EXPORT_SYMBOL_HDA(snd_hda_sequence_write); 249 235 250 236 /** … … 268 254 return (int)(parm & 0x7fff); 269 255 } 256 EXPORT_SYMBOL_HDA(snd_hda_get_sub_nodes); 270 257 271 258 /** … … 356 343 return conns; 357 344 } 345 EXPORT_SYMBOL_HDA(snd_hda_get_connections); 358 346 359 347 … … 386 374 unsol->queue[wp + 1] = res_ex; 387 375 388 /* 2.4 kernels seem to have a problem with workq wrapper... */ 389 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 390 schedule_work(&unsol->work); 391 #endif 392 return 0; 393 } 376 queue_work(bus->workq, &unsol->work); 377 378 return 0; 379 } 380 EXPORT_SYMBOL_HDA(snd_hda_queue_unsol_event); 394 381 395 382 /* … … 453 440 if (!bus) 454 441 return 0; 455 if (bus->unsol) { 456 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 457 flush_scheduled_work(); 458 #endif 442 if (bus->workq) 443 flush_workqueue(bus->workq); 444 if (bus->unsol) 459 445 kfree(bus->unsol); 460 }461 446 list_for_each_entry_safe(codec, n, &bus->codec_list, list, struct hda_codec) { 462 447 snd_hda_codec_free(codec); … … 464 449 if (bus->ops.private_free) 465 450 bus->ops.private_free(bus); 451 if (bus->workq) 452 destroy_workqueue(bus->workq); 466 453 kfree(bus); 467 454 return 0; … … 471 458 { 472 459 struct hda_bus *bus = device->device_data; 460 bus->shutdown = 1; 473 461 return snd_hda_bus_free(bus); 474 462 } … … 496 484 * Returns 0 if successful, or a negative error code. 497 485 */ 498 int __devinitsnd_hda_bus_new(struct snd_card *card,486 int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, 499 487 const struct hda_bus_template *temp, 500 488 struct hda_bus **busp) … … 525 513 bus->pci = temp->pci; 526 514 bus->modelname = temp->modelname; 515 bus->power_save = temp->power_save; 527 516 bus->ops = temp->ops; 528 517 529 518 mutex_init(&bus->cmd_mutex); 530 519 INIT_LIST_HEAD(&bus->codec_list); 520 521 snprintf(bus->workq_name, sizeof(bus->workq_name), 522 "hd-audio%d", card->number); 523 bus->workq = create_singlethread_workqueue(bus->workq_name); 524 if (!bus->workq) { 525 snd_printk(KERN_ERR "cannot create workqueue %s\n", 526 bus->workq_name); 527 kfree(bus); 528 return -ENOMEM; 529 } 531 530 532 531 err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops); … … 539 538 return 0; 540 539 } 540 EXPORT_SYMBOL_HDA(snd_hda_bus_new); 541 541 542 542 #ifdef CONFIG_SND_HDA_GENERIC … … 547 547 #endif 548 548 549 #if defined(MODULE) && !defined(TARGET_OS2) 550 #define HDA_MODREQ_MAX_COUNT 2 /* two request_modules()'s */ 551 #else 552 #define HDA_MODREQ_MAX_COUNT 0 /* all presets are statically linked */ 553 #endif 554 549 555 /* 550 556 * find a matching codec preset … … 553 559 find_codec_preset(struct hda_codec *codec) 554 560 { 555 const struct hda_codec_preset **tbl, *preset; 561 struct hda_codec_preset_list *tbl; 562 const struct hda_codec_preset *preset; 563 int mod_requested = 0; 556 564 557 565 if (is_generic_config(codec)) 558 566 return NULL; /* use the generic parser */ 559 567 560 for (tbl = hda_preset_tables; *tbl; tbl++) { 561 for (preset = *tbl; preset->id; preset++) { 568 again: 569 mutex_lock(&preset_mutex); 570 list_for_each_entry(tbl, &hda_preset_tables, list, struct hda_codec_preset_list) { 571 if (!try_module_get(tbl->owner)) { 572 snd_printk(KERN_ERR "hda_codec: cannot module_get\n"); 573 continue; 574 } 575 for (preset = tbl->preset; preset->id; preset++) { 562 576 u32 mask = preset->mask; 563 577 if (preset->afg && preset->afg != codec->afg) … … 569 583 if (preset->id == (codec->vendor_id & mask) && 570 584 (!preset->rev || 571 preset->rev == codec->revision_id)) 585 preset->rev == codec->revision_id)) { 586 mutex_unlock(&preset_mutex); 587 codec->owner = tbl->owner; 572 588 return preset; 573 } 574 } 589 } 590 } 591 module_put(tbl->owner); 592 } 593 mutex_unlock(&preset_mutex); 594 595 #ifndef TARGET_OS2 596 if (mod_requested < HDA_MODREQ_MAX_COUNT) { 597 char name[32]; 598 if (!mod_requested) 599 snprintf(name, sizeof(name), "snd-hda-codec-id:%08x", 600 codec->vendor_id); 601 else 602 snprintf(name, sizeof(name), "snd-hda-codec-id:%04x*", 603 (codec->vendor_id >> 16) & 0xffff); 604 request_module(name); 605 mod_requested++; 606 goto again; 607 } 608 #endif 575 609 return NULL; 576 610 } … … 611 645 * look for an AFG and MFG nodes 612 646 */ 613 static void __devinitsetup_fg_nodes(struct hda_codec *codec)614 { 615 int i, total_nodes ;647 static void /*__devinit*/ setup_fg_nodes(struct hda_codec *codec) 648 { 649 int i, total_nodes, function_id; 616 650 hda_nid_t nid; 617 651 618 652 total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); 619 653 for (i = 0; i < total_nodes; i++, nid++) { 620 unsigned int func;621 func = snd_hda_param_read(codec, nid, AC_PAR_FUNCTION_TYPE);622 switch (func & 0xff) {654 function_id = snd_hda_param_read(codec, nid, 655 AC_PAR_FUNCTION_TYPE) & 0xff; 656 switch (function_id) { 623 657 case AC_GRP_AUDIO_FUNCTION: 624 658 codec->afg = nid; 659 codec->function_id = function_id; 625 660 break; 626 661 case AC_GRP_MODEM_FUNCTION: 627 662 codec->mfg = nid; 663 codec->function_id = function_id; 628 664 break; 629 665 default: … … 653 689 } 654 690 691 /* read all pin default configurations and save codec->init_pins */ 692 static int read_pin_defaults(struct hda_codec *codec) 693 { 694 int i; 695 hda_nid_t nid = codec->start_nid; 696 697 for (i = 0; i < codec->num_nodes; i++, nid++) { 698 struct hda_pincfg *pin; 699 unsigned int wcaps = get_wcaps(codec, nid); 700 unsigned int wid_type = (wcaps & AC_WCAP_TYPE) >> 701 AC_WCAP_TYPE_SHIFT; 702 if (wid_type != AC_WID_PIN) 703 continue; 704 pin = snd_array_new(&codec->init_pins); 705 if (!pin) 706 return -ENOMEM; 707 pin->nid = nid; 708 pin->cfg = snd_hda_codec_read(codec, nid, 0, 709 AC_VERB_GET_CONFIG_DEFAULT, 0); 710 } 711 return 0; 712 } 713 714 /* look up the given pin config list and return the item matching with NID */ 715 static struct hda_pincfg *look_up_pincfg(struct hda_codec *codec, 716 struct snd_array *array, 717 hda_nid_t nid) 718 { 719 int i; 720 for (i = 0; i < array->used; i++) { 721 struct hda_pincfg *pin = snd_array_elem(array, i); 722 if (pin->nid == nid) 723 return pin; 724 } 725 return NULL; 726 } 727 728 /* write a config value for the given NID */ 729 static void set_pincfg(struct hda_codec *codec, hda_nid_t nid, 730 unsigned int cfg) 731 { 732 int i; 733 for (i = 0; i < 4; i++) { 734 snd_hda_codec_write(codec, nid, 0, 735 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, 736 cfg & 0xff); 737 cfg >>= 8; 738 } 739 } 740 741 /* set the current pin config value for the given NID. 742 * the value is cached, and read via snd_hda_codec_get_pincfg() 743 */ 744 int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, 745 hda_nid_t nid, unsigned int cfg) 746 { 747 struct hda_pincfg *pin; 748 unsigned int oldcfg; 749 750 oldcfg = snd_hda_codec_get_pincfg(codec, nid); 751 pin = look_up_pincfg(codec, list, nid); 752 if (!pin) { 753 pin = snd_array_new(list); 754 if (!pin) 755 return -ENOMEM; 756 pin->nid = nid; 757 } 758 pin->cfg = cfg; 759 760 /* change only when needed; e.g. if the pincfg is already present 761 * in user_pins[], don't write it 762 */ 763 cfg = snd_hda_codec_get_pincfg(codec, nid); 764 if (oldcfg != cfg) 765 set_pincfg(codec, nid, cfg); 766 return 0; 767 } 768 769 int snd_hda_codec_set_pincfg(struct hda_codec *codec, 770 hda_nid_t nid, unsigned int cfg) 771 { 772 return snd_hda_add_pincfg(codec, &codec->driver_pins, nid, cfg); 773 } 774 EXPORT_SYMBOL_HDA(snd_hda_codec_set_pincfg); 775 776 /* get the current pin config value of the given pin NID */ 777 unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) 778 { 779 struct hda_pincfg *pin; 780 781 #ifdef CONFIG_SND_HDA_HWDEP 782 pin = look_up_pincfg(codec, &codec->user_pins, nid); 783 if (pin) 784 return pin->cfg; 785 #endif 786 pin = look_up_pincfg(codec, &codec->driver_pins, nid); 787 if (pin) 788 return pin->cfg; 789 pin = look_up_pincfg(codec, &codec->init_pins, nid); 790 if (pin) 791 return pin->cfg; 792 return 0; 793 } 794 EXPORT_SYMBOL_HDA(snd_hda_codec_get_pincfg); 795 796 /* restore all current pin configs */ 797 static void restore_pincfgs(struct hda_codec *codec) 798 { 799 int i; 800 for (i = 0; i < codec->init_pins.used; i++) { 801 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i); 802 set_pincfg(codec, pin->nid, 803 snd_hda_codec_get_pincfg(codec, pin->nid)); 804 } 805 } 655 806 656 807 static void init_hda_cache(struct hda_cache_rec *cache, … … 658 809 static void free_hda_cache(struct hda_cache_rec *cache); 659 810 811 /* restore the initial pin cfgs and release all pincfg lists */ 812 static void restore_init_pincfgs(struct hda_codec *codec) 813 { 814 /* first free driver_pins and user_pins, then call restore_pincfg 815 * so that only the values in init_pins are restored 816 */ 817 snd_array_free(&codec->driver_pins); 818 #ifdef CONFIG_SND_HDA_HWDEP 819 snd_array_free(&codec->user_pins); 820 #endif 821 restore_pincfgs(codec); 822 snd_array_free(&codec->init_pins); 823 } 824 660 825 /* 661 826 * codec destructor … … 665 830 if (!codec) 666 831 return; 832 restore_init_pincfgs(codec); 667 833 #ifdef CONFIG_SND_HDA_POWER_SAVE 668 834 cancel_delayed_work(&codec->power_work); 669 flush_ scheduled_work();835 flush_workqueue(codec->bus->workq); 670 836 #endif 671 837 list_del(&codec->list); … … 674 840 if (codec->patch_ops.free) 675 841 codec->patch_ops.free(codec); 842 module_put(codec->owner); 676 843 free_hda_cache(&codec->amp_cache); 677 844 free_hda_cache(&codec->cmd_cache); … … 682 849 } 683 850 851 static void hda_set_power_state(struct hda_codec *codec, hda_nid_t fg, 852 unsigned int power_state); 853 684 854 /** 685 855 * snd_hda_codec_new - create a HDA codec … … 690 860 * Returns 0 if successful, or a negative error code. 691 861 */ 692 int __devinitsnd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,693 struct hda_codec **codecp)862 int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, 863 int do_init, struct hda_codec **codecp) 694 864 { 695 865 struct hda_codec *codec; … … 717 887 codec->addr = codec_addr; 718 888 mutex_init(&codec->spdif_mutex); 889 mutex_init(&codec->control_mutex); 719 890 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); 720 891 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); 721 892 snd_array_init(&codec->mixers, sizeof(struct snd_kcontrol *), 32); 893 snd_array_init(&codec->init_pins, sizeof(struct hda_pincfg), 16); 894 snd_array_init(&codec->driver_pins, sizeof(struct hda_pincfg), 16); 722 895 if (codec->bus->modelname) { 723 896 codec->modelname = kstrdup(codec->bus->modelname, GFP_KERNEL); … … 756 929 if (!codec->afg && !codec->mfg) { 757 930 snd_printdd("hda_codec: no AFG or MFG node found\n"); 758 snd_hda_codec_free(codec); 759 return -ENODEV; 760 } 761 762 if (read_widget_caps(codec, codec->afg ? codec->afg : codec->mfg) < 0) { 931 err = -ENODEV; 932 goto error; 933 } 934 935 err = read_widget_caps(codec, codec->afg ? codec->afg : codec->mfg); 936 if (err < 0) { 763 937 snd_printk(KERN_ERR "hda_codec: cannot malloc\n"); 764 snd_hda_codec_free(codec); 765 return -ENOMEM; 766 } 938 goto error; 939 } 940 err = read_pin_defaults(codec); 941 if (err < 0) 942 goto error; 767 943 768 944 if (!codec->subsystem_id) { … … 775 951 codec->modelname = kstrdup(bus->modelname, GFP_KERNEL); 776 952 777 err = snd_hda_codec_configure(codec); 778 if (err < 0) { 779 snd_hda_codec_free(codec); 780 return err; 953 /* power-up all before initialization */ 954 hda_set_power_state(codec, 955 codec->afg ? codec->afg : codec->mfg, 956 AC_PWRST_D0); 957 958 if (do_init) { 959 err = snd_hda_codec_configure(codec); 960 if (err < 0) 961 goto error; 781 962 } 782 963 snd_hda_codec_proc_new(codec); … … 791 972 *codecp = codec; 792 973 return 0; 793 } 974 975 error: 976 snd_hda_codec_free(codec); 977 return err; 978 } 979 EXPORT_SYMBOL_HDA(snd_hda_codec_new); 794 980 795 981 int snd_hda_codec_configure(struct hda_codec *codec) … … 851 1037 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); 852 1038 } 1039 EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream); 853 1040 854 1041 void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) … … 864 1051 #endif 865 1052 } 1053 EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); 866 1054 867 1055 /* … … 871 1059 /* FIXME: more better hash key? */ 872 1060 #define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) 1061 #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) 873 1062 #define INFO_AMP_CAPS (1<<0) 874 1063 #define INFO_AMP_VOL(ch) (1 << (1 + (ch))) 875 1064 876 1065 /* initialize the hash table */ 877 static void __devinitinit_hda_cache(struct hda_cache_rec *cache,1066 static void /*__devinit*/ init_hda_cache(struct hda_cache_rec *cache, 878 1067 unsigned int record_size) 879 1068 { … … 945 1134 return info->amp_caps; 946 1135 } 1136 EXPORT_SYMBOL_HDA(query_amp_caps); 947 1137 948 1138 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, … … 958 1148 return 0; 959 1149 } 1150 EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps); 1151 1152 u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid) 1153 { 1154 struct hda_amp_info *info; 1155 1156 info = get_alloc_amp_hash(codec, HDA_HASH_PINCAP_KEY(nid)); 1157 if (!info) 1158 return 0; 1159 if (!info->head.val) { 1160 info->amp_caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 1161 info->head.val |= INFO_AMP_CAPS; 1162 } 1163 return info->amp_caps; 1164 } 1165 EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps); 960 1166 961 1167 /* … … 1011 1217 return get_vol_mute(codec, info, nid, ch, direction, index); 1012 1218 } 1219 EXPORT_SYMBOL_HDA(snd_hda_codec_amp_read); 1013 1220 1014 1221 /* … … 1030 1237 return 1; 1031 1238 } 1239 EXPORT_SYMBOL_HDA(snd_hda_codec_amp_update); 1032 1240 1033 1241 /* … … 1043 1251 return ret; 1044 1252 } 1253 EXPORT_SYMBOL_HDA(snd_hda_codec_amp_stereo); 1045 1254 1046 1255 #ifdef SND_HDA_NEEDS_RESUME … … 1068 1277 } 1069 1278 } 1279 EXPORT_SYMBOL_HDA(snd_hda_codec_resume_amp); 1070 1280 #endif /* SND_HDA_NEEDS_RESUME */ 1071 1281 … … 1078 1288 u8 chs = get_amp_channels(kcontrol); 1079 1289 int dir = get_amp_direction(kcontrol); 1290 unsigned int ofs = get_amp_offset(kcontrol); 1080 1291 u32 caps; 1081 1292 … … 1089 1300 return -EINVAL; 1090 1301 } 1302 if (ofs < caps) 1303 caps -= ofs; 1091 1304 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1092 1305 uinfo->count = chs == 3 ? 2 : 1; … … 1094 1307 uinfo->value.integer.max = caps; 1095 1308 return 0; 1309 } 1310 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_info); 1311 1312 1313 static inline unsigned int 1314 read_amp_value(struct hda_codec *codec, hda_nid_t nid, 1315 int ch, int dir, int idx, unsigned int ofs) 1316 { 1317 unsigned int val; 1318 val = snd_hda_codec_amp_read(codec, nid, ch, dir, idx); 1319 val &= HDA_AMP_VOLMASK; 1320 if (val >= ofs) 1321 val -= ofs; 1322 else 1323 val = 0; 1324 return val; 1325 } 1326 1327 static inline int 1328 update_amp_value(struct hda_codec *codec, hda_nid_t nid, 1329 int ch, int dir, int idx, unsigned int ofs, 1330 unsigned int val) 1331 { 1332 if (val > 0) 1333 val += ofs; 1334 return snd_hda_codec_amp_update(codec, nid, ch, dir, idx, 1335 HDA_AMP_VOLMASK, val); 1096 1336 } 1097 1337 … … 1104 1344 int dir = get_amp_direction(kcontrol); 1105 1345 int idx = get_amp_index(kcontrol); 1346 unsigned int ofs = get_amp_offset(kcontrol); 1106 1347 long *valp = ucontrol->value.integer.value; 1107 1348 1108 1349 if (chs & 1) 1109 *valp++ = snd_hda_codec_amp_read(codec, nid, 0, dir, idx) 1110 & HDA_AMP_VOLMASK; 1350 *valp++ = read_amp_value(codec, nid, 0, dir, idx, ofs); 1111 1351 if (chs & 2) 1112 *valp = snd_hda_codec_amp_read(codec, nid, 1, dir, idx)1113 & HDA_AMP_VOLMASK;1114 return 0; 1115 } 1352 *valp = read_amp_value(codec, nid, 1, dir, idx, ofs); 1353 return 0; 1354 } 1355 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_get); 1116 1356 1117 1357 int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, … … 1123 1363 int dir = get_amp_direction(kcontrol); 1124 1364 int idx = get_amp_index(kcontrol); 1365 unsigned int ofs = get_amp_offset(kcontrol); 1125 1366 long *valp = ucontrol->value.integer.value; 1126 1367 int change = 0; … … 1128 1369 snd_hda_power_up(codec); 1129 1370 if (chs & 1) { 1130 change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, 1131 0x7f, *valp); 1371 change = update_amp_value(codec, nid, 0, dir, idx, ofs, *valp); 1132 1372 valp++; 1133 1373 } 1134 1374 if (chs & 2) 1135 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, 1136 0x7f, *valp); 1375 change |= update_amp_value(codec, nid, 1, dir, idx, ofs, *valp); 1137 1376 snd_hda_power_down(codec); 1138 1377 return change; 1139 1378 } 1379 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_put); 1140 1380 1141 1381 int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, … … 1145 1385 hda_nid_t nid = get_amp_nid(kcontrol); 1146 1386 int dir = get_amp_direction(kcontrol); 1387 unsigned int ofs = get_amp_offset(kcontrol); 1147 1388 u32 caps, val1, val2; 1148 1389 … … 1153 1394 val2 = (val2 + 1) * 25; 1154 1395 val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT); 1396 val1 += ofs; 1155 1397 val1 = ((int)val1) * ((int)val2); 1156 1398 if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv)) … … 1164 1406 return 0; 1165 1407 } 1408 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_tlv); 1166 1409 1167 1410 /* … … 1183 1426 tlv[3] = step; 1184 1427 } 1428 EXPORT_SYMBOL_HDA(snd_hda_set_vmaster_tlv); 1185 1429 1186 1430 /* find a mixer control element with the given name */ … … 1202 1446 return _snd_hda_find_mixer_ctl(codec, name, 0); 1203 1447 } 1448 EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); 1204 1449 1205 1450 /* Add a control element and assign to the codec */ … … 1218 1463 return 0; 1219 1464 } 1465 EXPORT_SYMBOL_HDA(snd_hda_ctl_add); 1220 1466 1221 1467 /* Clear all controls assigned to the given codec */ … … 1229 1475 } 1230 1476 1231 void snd_hda_codec_reset(struct hda_codec *codec) 1232 { 1233 int i; 1477 /* pseudo device locking 1478 * toggle card->shutdown to allow/disallow the device access (as a hack) 1479 */ 1480 static int hda_lock_devices(struct snd_card *card) 1481 { 1482 spin_lock(&card->files_lock); 1483 if (card->shutdown) { 1484 spin_unlock(&card->files_lock); 1485 return -EINVAL; 1486 } 1487 card->shutdown = 1; 1488 spin_unlock(&card->files_lock); 1489 return 0; 1490 } 1491 1492 static void hda_unlock_devices(struct snd_card *card) 1493 { 1494 spin_lock(&card->files_lock); 1495 card->shutdown = 0; 1496 spin_unlock(&card->files_lock); 1497 } 1498 1499 int snd_hda_codec_reset(struct hda_codec *codec) 1500 { 1501 struct snd_card *card = codec->bus->card; 1502 int i, pcm; 1503 1504 if (hda_lock_devices(card) < 0) 1505 return -EBUSY; 1506 /* check whether the codec isn't used by any mixer or PCM streams */ 1507 if (!list_empty(&card->ctl_files)) { 1508 hda_unlock_devices(card); 1509 return -EBUSY; 1510 } 1511 for (pcm = 0; pcm < codec->num_pcms; pcm++) { 1512 struct hda_pcm *cpcm = &codec->pcm_info[pcm]; 1513 if (!cpcm->pcm) 1514 continue; 1515 if (cpcm->pcm->streams[0].substream_opened || 1516 cpcm->pcm->streams[1].substream_opened) { 1517 hda_unlock_devices(card); 1518 return -EBUSY; 1519 } 1520 } 1521 1522 /* OK, let it free */ 1234 1523 1235 1524 #ifdef CONFIG_SND_HDA_POWER_SAVE 1236 1525 cancel_delayed_work(&codec->power_work); 1237 flush_ scheduled_work();1526 flush_workqueue(codec->bus->workq); 1238 1527 #endif 1239 1528 snd_hda_ctls_clear(codec); 1240 1529 /* relase PCMs */ 1241 1530 for (i = 0; i < codec->num_pcms; i++) { 1242 if (codec->pcm_info[i].pcm) 1243 snd_device_free(codec->bus->card, 1244 codec->pcm_info[i].pcm); 1531 if (codec->pcm_info[i].pcm) { 1532 snd_device_free(card, codec->pcm_info[i].pcm); 1533 clear_bit(codec->pcm_info[i].device, 1534 codec->bus->pcm_dev_bits); 1535 } 1245 1536 } 1246 1537 if (codec->patch_ops.free) 1247 1538 codec->patch_ops.free(codec); 1539 codec->proc_widget_hook = NULL; 1248 1540 codec->spec = NULL; 1249 1541 free_hda_cache(&codec->amp_cache); 1250 1542 free_hda_cache(&codec->cmd_cache); 1543 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); 1544 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); 1545 /* free only driver_pins so that init_pins + user_pins are restored */ 1546 snd_array_free(&codec->driver_pins); 1547 restore_pincfgs(codec); 1251 1548 codec->num_pcms = 0; 1252 1549 codec->pcm_info = NULL; 1253 1550 codec->preset = NULL; 1551 memset(&codec->patch_ops, 0, sizeof(codec->patch_ops)); 1552 codec->slave_dig_outs = NULL; 1553 codec->spdif_status_reset = 0; 1554 module_put(codec->owner); 1555 codec->owner = NULL; 1556 1557 /* allow device access again */ 1558 hda_unlock_devices(card); 1559 return 0; 1254 1560 } 1255 1561 … … 1277 1583 for (s = slaves; *s; s++) { 1278 1584 struct snd_kcontrol *sctl; 1279 1280 sctl = snd_hda_find_mixer_ctl(codec, *s); 1281 if (!sctl) { 1282 snd_printdd("Cannot find slave %s, skipped\n", *s); 1283 continue; 1284 } 1285 err = snd_ctl_add_slave(kctl, sctl); 1286 if (err < 0) 1287 return err; 1288 } 1289 return 0; 1290 } 1585 int i = 0; 1586 for (;;) { 1587 sctl = _snd_hda_find_mixer_ctl(codec, *s, i); 1588 if (!sctl) { 1589 if (!i) 1590 snd_printdd("Cannot find slave %s, " 1591 "skipped\n", *s); 1592 break; 1593 } 1594 err = snd_ctl_add_slave(kctl, sctl); 1595 if (err < 0) 1596 return err; 1597 i++; 1598 } 1599 } 1600 return 0; 1601 } 1602 EXPORT_SYMBOL_HDA(snd_hda_add_vmaster); 1291 1603 1292 1604 /* switch */ … … 1302 1614 return 0; 1303 1615 } 1616 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_info); 1304 1617 1305 1618 int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, … … 1321 1634 return 0; 1322 1635 } 1636 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_get); 1323 1637 1324 1638 int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, … … 1351 1665 return change; 1352 1666 } 1667 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put); 1353 1668 1354 1669 /* … … 1368 1683 int err; 1369 1684 1370 mutex_lock(&codec-> spdif_mutex); /* reuse spdif_mutex */1685 mutex_lock(&codec->control_mutex); 1371 1686 pval = kcontrol->private_value; 1372 1687 kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ 1373 1688 err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); 1374 1689 kcontrol->private_value = pval; 1375 mutex_unlock(&codec-> spdif_mutex);1690 mutex_unlock(&codec->control_mutex); 1376 1691 return err; 1377 1692 } 1693 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_get); 1378 1694 1379 1695 int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, … … 1384 1700 int i, indices, err = 0, change = 0; 1385 1701 1386 mutex_lock(&codec-> spdif_mutex); /* reuse spdif_mutex */1702 mutex_lock(&codec->control_mutex); 1387 1703 pval = kcontrol->private_value; 1388 1704 indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; … … 1396 1712 } 1397 1713 kcontrol->private_value = pval; 1398 mutex_unlock(&codec-> spdif_mutex);1714 mutex_unlock(&codec->control_mutex); 1399 1715 return err < 0 ? err : change; 1400 1716 } 1717 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_put); 1401 1718 1402 1719 /* … … 1410 1727 int err; 1411 1728 1412 mutex_lock(&codec-> spdif_mutex); /* reuse spdif_mutex */1729 mutex_lock(&codec->control_mutex); 1413 1730 c = (struct hda_bind_ctls *)kcontrol->private_value; 1414 1731 kcontrol->private_value = *c->values; 1415 1732 err = c->ops->info(kcontrol, uinfo); 1416 1733 kcontrol->private_value = (long)c; 1417 mutex_unlock(&codec-> spdif_mutex);1734 mutex_unlock(&codec->control_mutex); 1418 1735 return err; 1419 1736 } 1737 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_info); 1420 1738 1421 1739 int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol, … … 1426 1744 int err; 1427 1745 1428 mutex_lock(&codec-> spdif_mutex); /* reuse spdif_mutex */1746 mutex_lock(&codec->control_mutex); 1429 1747 c = (struct hda_bind_ctls *)kcontrol->private_value; 1430 1748 kcontrol->private_value = *c->values; 1431 1749 err = c->ops->get(kcontrol, ucontrol); 1432 1750 kcontrol->private_value = (long)c; 1433 mutex_unlock(&codec-> spdif_mutex);1751 mutex_unlock(&codec->control_mutex); 1434 1752 return err; 1435 1753 } 1754 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_get); 1436 1755 1437 1756 int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol, … … 1443 1762 int err = 0, change = 0; 1444 1763 1445 mutex_lock(&codec-> spdif_mutex); /* reuse spdif_mutex */1764 mutex_lock(&codec->control_mutex); 1446 1765 c = (struct hda_bind_ctls *)kcontrol->private_value; 1447 1766 for (vals = c->values; *vals; vals++) { … … 1453 1772 } 1454 1773 kcontrol->private_value = (long)c; 1455 mutex_unlock(&codec-> spdif_mutex);1774 mutex_unlock(&codec->control_mutex); 1456 1775 return err < 0 ? err : change; 1457 1776 } 1777 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_put); 1458 1778 1459 1779 int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag, … … 1464 1784 int err; 1465 1785 1466 mutex_lock(&codec-> spdif_mutex); /* reuse spdif_mutex */1786 mutex_lock(&codec->control_mutex); 1467 1787 c = (struct hda_bind_ctls *)kcontrol->private_value; 1468 1788 kcontrol->private_value = *c->values; 1469 1789 err = c->ops->tlv(kcontrol, op_flag, size, tlv); 1470 1790 kcontrol->private_value = (long)c; 1471 mutex_unlock(&codec-> spdif_mutex);1791 mutex_unlock(&codec->control_mutex); 1472 1792 return err; 1473 1793 } 1794 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_tlv); 1474 1795 1475 1796 struct hda_ctl_ops snd_hda_bind_vol = { … … 1479 1800 .tlv = snd_hda_mixer_amp_tlv 1480 1801 }; 1802 EXPORT_SYMBOL_HDA(snd_hda_bind_vol); 1481 1803 1482 1804 struct hda_ctl_ops snd_hda_bind_sw = { … … 1486 1808 .tlv = snd_hda_mixer_amp_tlv 1487 1809 }; 1810 EXPORT_SYMBOL_HDA(snd_hda_bind_sw); 1488 1811 1489 1812 /* … … 1592 1915 hda_nid_t *d; 1593 1916 1594 snd_hda_codec_write (codec, nid, 0, verb, val);1917 snd_hda_codec_write_cache(codec, nid, 0, verb, val); 1595 1918 d = codec->slave_dig_outs; 1596 1919 if (!d) 1597 1920 return; 1598 1921 for (; *d; d++) 1599 snd_hda_codec_write (codec, *d, 0, verb, val);1922 snd_hda_codec_write_cache(codec, *d, 0, verb, val); 1600 1923 } 1601 1924 … … 1747 2070 return 0; 1748 2071 } 2072 EXPORT_SYMBOL_HDA(snd_hda_create_spdif_out_ctls); 1749 2073 1750 2074 /* … … 1784 2108 snd_ctl_new1(&spdif_share_sw, mout)); 1785 2109 } 2110 EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw); 1786 2111 1787 2112 /* … … 1882 2207 for (dig_mix = dig_in_ctls; dig_mix->name; dig_mix++) { 1883 2208 kctl = snd_ctl_new1(dig_mix, codec); 2209 if (!kctl) 2210 return -ENOMEM; 1884 2211 kctl->private_value = nid; 1885 2212 err = snd_hda_ctl_add(codec, kctl); … … 1893 2220 return 0; 1894 2221 } 2222 EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls); 1895 2223 1896 2224 #ifdef SND_HDA_NEEDS_RESUME … … 1929 2257 if (!err) { 1930 2258 struct hda_cache_head *c; 1931 u32 key = build_cmd_cache_key(nid, verb); 2259 u32 key; 2260 /* parm may contain the verb stuff for get/set amp */ 2261 verb = verb | (parm >> 8); 2262 parm &= 0xff; 2263 key = build_cmd_cache_key(nid, verb); 1932 2264 c = get_alloc_hash(&codec->cmd_cache, key); 1933 2265 if (c) … … 1938 2270 return err; 1939 2271 } 2272 EXPORT_SYMBOL_HDA(snd_hda_codec_write_cache); 1940 2273 1941 2274 /* resume the all commands from the cache */ … … 1953 2286 } 1954 2287 } 2288 EXPORT_SYMBOL_HDA(snd_hda_codec_resume_cache); 1955 2289 1956 2290 /** … … 1970 2304 seq->param); 1971 2305 } 2306 EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache); 1972 2307 #endif /* SND_HDA_NEEDS_RESUME */ 1973 2308 … … 1997 2332 * eapd and EAPD_BTLENABLE is set. 1998 2333 */ 1999 pincap = snd_hda_param_read(codec, nid, 2000 AC_PAR_PIN_CAP); 2334 pincap = snd_hda_query_pin_caps(codec, nid); 2001 2335 if (pincap & AC_PINCAP_EAPD) { 2002 2336 int eapd = snd_hda_codec_read(codec, … … 2067 2401 codec->afg ? codec->afg : codec->mfg, 2068 2402 AC_PWRST_D0); 2403 restore_pincfgs(codec); /* restore all current pin configs */ 2069 2404 hda_exec_init_verbs(codec); 2070 2405 if (codec->patch_ops.resume) … … 2088 2423 * Returns 0 if successful, otherwise a negative error code. 2089 2424 */ 2090 int __devinitsnd_hda_build_controls(struct hda_bus *bus)2425 int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) 2091 2426 { 2092 2427 struct hda_codec *codec; … … 2094 2429 list_for_each_entry(codec, &bus->codec_list, list, struct hda_codec) { 2095 2430 int err = snd_hda_codec_build_controls(codec); 2096 if (err < 0) 2097 return err; 2098 } 2099 2100 return 0; 2101 } 2431 if (err < 0) { 2432 printk(KERN_ERR "hda_codec: cannot build controls" 2433 "for #%d (error %d)\n", codec->addr, err); 2434 err = snd_hda_codec_reset(codec); 2435 if (err < 0) { 2436 printk(KERN_ERR 2437 "hda_codec: cannot revert codec\n"); 2438 return err; 2439 } 2440 } 2441 } 2442 return 0; 2443 } 2444 EXPORT_SYMBOL_HDA(snd_hda_build_controls); 2102 2445 2103 2446 int snd_hda_codec_build_controls(struct hda_codec *codec) 2104 2447 { 2105 2448 int err = 0; 2106 /* fake as if already powered-on */2107 hda_keep_power_on(codec);2108 /* then fire up */2109 hda_set_power_state(codec,2110 codec->afg ? codec->afg : codec->mfg,2111 AC_PWRST_D0);2112 2449 hda_exec_init_verbs(codec); 2113 2450 /* continue to initialize... */ … … 2116 2453 if (!err && codec->patch_ops.build_controls) 2117 2454 err = codec->patch_ops.build_controls(codec); 2118 snd_hda_power_down(codec);2119 2455 if (err < 0) 2120 2456 return err; … … 2211 2547 return val; 2212 2548 } 2549 EXPORT_SYMBOL_HDA(snd_hda_calc_stream_format); 2213 2550 2214 2551 /** … … 2225 2562 * Returns 0 if successful, otherwise a negative error code. 2226 2563 */ 2227 int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid,2564 static int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, 2228 2565 u32 *ratesp, u64 *formatsp, unsigned int *bpsp) 2229 2566 { 2230 int i; 2231 unsigned int val, streams; 2567 unsigned int i, val, wcaps; 2232 2568 2233 2569 val = 0; 2234 if (nid != codec->afg &&2235 (get_wcaps(codec, nid)& AC_WCAP_FORMAT_OVRD)) {2570 wcaps = get_wcaps(codec, nid); 2571 if (nid != codec->afg && (wcaps & AC_WCAP_FORMAT_OVRD)) { 2236 2572 val = snd_hda_param_read(codec, nid, AC_PAR_PCM); 2237 2573 if (val == -1) … … 2247 2583 rates |= rate_bits[i].alsa_bits; 2248 2584 } 2585 if (rates == 0) { 2586 snd_printk(KERN_ERR "hda_codec: rates == 0 " 2587 "(nid=0x%x, val=0x%x, ovrd=%i)\n", 2588 nid, val, 2589 (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0); 2590 return -EIO; 2591 } 2249 2592 *ratesp = rates; 2250 2593 } … … 2252 2595 if (formatsp || bpsp) { 2253 2596 u64 formats = 0; 2254 unsigned int bps; 2255 unsigned int wcaps; 2256 2257 wcaps = get_wcaps(codec, nid); 2597 unsigned int streams, bps; 2598 2258 2599 streams = snd_hda_param_read(codec, nid, AC_PAR_STREAM); 2259 2600 if (streams == -1) … … 2308 2649 bps = 8; 2309 2650 } 2651 if (formats == 0) { 2652 snd_printk(KERN_ERR "hda_codec: formats == 0 " 2653 "(nid=0x%x, val=0x%x, ovrd=%i, " 2654 "streams=0x%x)\n", 2655 nid, val, 2656 (wcaps & AC_WCAP_FORMAT_OVRD) ? 1 : 0, 2657 streams); 2658 return -EIO; 2659 } 2310 2660 if (formatsp) 2311 2661 *formatsp = formats; … … 2390 2740 return 1; 2391 2741 } 2742 EXPORT_SYMBOL_HDA(snd_hda_is_supported_format); 2392 2743 2393 2744 /* … … 2422 2773 struct hda_pcm_stream *info) 2423 2774 { 2775 int err; 2776 2424 2777 /* query support PCM information from the given NID */ 2425 2778 if (info->nid && (!info->rates || !info->formats)) { 2426 snd_hda_query_supported_pcm(codec, info->nid,2779 err = snd_hda_query_supported_pcm(codec, info->nid, 2427 2780 info->rates ? NULL : &info->rates, 2428 2781 info->formats ? NULL : &info->formats, 2429 2782 info->maxbps ? NULL : &info->maxbps); 2783 if (err < 0) 2784 return err; 2430 2785 } 2431 2786 if (info->ops.open == NULL) … … 2447 2802 2448 2803 /* 2449 * attach a new PCM stream 2450 */ 2451 static int __devinit 2452 snd_hda_attach_pcm(struct hda_codec *codec, struct hda_pcm *pcm) 2453 { 2454 struct hda_bus *bus = codec->bus; 2455 struct hda_pcm_stream *info; 2456 int stream, err; 2457 2458 if (snd_BUG_ON(!pcm->name)) 2459 return -EINVAL; 2460 for (stream = 0; stream < 2; stream++) { 2461 info = &pcm->stream[stream]; 2462 if (info->substreams) { 2463 err = set_pcm_default_values(codec, info); 2464 if (err < 0) 2465 return err; 2466 } 2467 } 2468 return bus->ops.attach_pcm(bus, codec, pcm); 2469 } 2470 2471 /** 2472 * snd_hda_build_pcms - build PCM information 2473 * @bus: the BUS 2474 * 2475 * Create PCM information for each codec included in the bus. 2476 * 2477 * The build_pcms codec patch is requested to set up codec->num_pcms and 2478 * codec->pcm_info properly. The array is referred by the top-level driver 2479 * to create its PCM instances. 2480 * The allocated codec->pcm_info should be released in codec->patch_ops.free 2481 * callback. 2482 * 2483 * At least, substreams, channels_min and channels_max must be filled for 2484 * each stream. substreams = 0 indicates that the stream doesn't exist. 2485 * When rates and/or formats are zero, the supported values are queried 2486 * from the given nid. The nid is used also by the default ops.prepare 2487 * and ops.cleanup callbacks. 2488 * 2489 * The driver needs to call ops.open in its open callback. Similarly, 2490 * ops.close is supposed to be called in the close callback. 2491 * ops.prepare should be called in the prepare or hw_params callback 2492 * with the proper parameters for set up. 2493 * ops.cleanup should be called in hw_free for clean up of streams. 2494 * 2495 * This function returns 0 if successfull, or a negative error code. 2496 */ 2497 int snd_hda_build_pcms(struct hda_bus *bus) 2804 * get the empty PCM device number to assign 2805 */ 2806 static int get_empty_pcm_device(struct hda_bus *bus, int type) 2498 2807 { 2499 2808 static const char *dev_name[HDA_PCM_NTYPES] = { … … 2509 2818 /* normal audio device indices; not linear to keep compatibility */ 2510 2819 static int audio_idx[4] = { 0, 2, 4, 5 }; 2511 struct hda_codec *codec; 2512 int num_devs[HDA_PCM_NTYPES]; 2513 2514 memset(num_devs, 0, sizeof(num_devs)); 2515 list_for_each_entry(codec, &bus->codec_list, list, struct hda_codec) { 2516 unsigned int pcm; 2517 int err; 2518 if (!codec->num_pcms) { 2519 if (!codec->patch_ops.build_pcms) 2520 continue; 2521 err = codec->patch_ops.build_pcms(codec); 2820 int i, dev; 2821 2822 switch (type) { 2823 case HDA_PCM_TYPE_AUDIO: 2824 for (i = 0; i < ARRAY_SIZE(audio_idx); i++) { 2825 dev = audio_idx[i]; 2826 if (!test_bit(dev, bus->pcm_dev_bits)) 2827 goto ok; 2828 } 2829 snd_printk(KERN_WARNING "Too many audio devices\n"); 2830 return -EAGAIN; 2831 case HDA_PCM_TYPE_SPDIF: 2832 case HDA_PCM_TYPE_HDMI: 2833 case HDA_PCM_TYPE_MODEM: 2834 dev = dev_idx[type]; 2835 if (test_bit(dev, bus->pcm_dev_bits)) { 2836 snd_printk(KERN_WARNING "%s already defined\n", 2837 dev_name[type]); 2838 return -EAGAIN; 2839 } 2840 break; 2841 default: 2842 snd_printk(KERN_WARNING "Invalid PCM type %d\n", type); 2843 return -EINVAL; 2844 } 2845 ok: 2846 set_bit(dev, bus->pcm_dev_bits); 2847 return dev; 2848 } 2849 2850 /* 2851 * attach a new PCM stream 2852 */ 2853 static int snd_hda_attach_pcm(struct hda_codec *codec, struct hda_pcm *pcm) 2854 { 2855 struct hda_bus *bus = codec->bus; 2856 struct hda_pcm_stream *info; 2857 int stream, err; 2858 2859 if (snd_BUG_ON(!pcm->name)) 2860 return -EINVAL; 2861 for (stream = 0; stream < 2; stream++) { 2862 info = &pcm->stream[stream]; 2863 if (info->substreams) { 2864 err = set_pcm_default_values(codec, info); 2522 2865 if (err < 0) 2523 2866 return err; 2524 2867 } 2525 for (pcm = 0; pcm < codec->num_pcms; pcm++) { 2526 struct hda_pcm *cpcm = &codec->pcm_info[pcm]; 2527 int type = cpcm->pcm_type; 2528 int dev; 2529 2530 if (!cpcm->stream[0].substreams && 2531 !cpcm->stream[1].substreams) 2532 continue; /* no substreams assigned */ 2533 2534 switch (type) { 2535 case HDA_PCM_TYPE_AUDIO: 2536 if (num_devs[type] >= ARRAY_SIZE(audio_idx)) { 2537 snd_printk(KERN_WARNING 2538 "Too many audio devices\n"); 2539 continue; 2540 } 2541 dev = audio_idx[num_devs[type]]; 2542 break; 2543 case HDA_PCM_TYPE_SPDIF: 2544 case HDA_PCM_TYPE_HDMI: 2545 case HDA_PCM_TYPE_MODEM: 2546 if (num_devs[type]) { 2547 snd_printk(KERN_WARNING 2548 "%s already defined\n", 2549 dev_name[type]); 2550 continue; 2551 } 2552 dev = dev_idx[type]; 2553 break; 2554 default: 2555 snd_printk(KERN_WARNING 2556 "Invalid PCM type %d\n", type); 2557 continue; 2868 } 2869 return bus->ops.attach_pcm(bus, codec, pcm); 2870 } 2871 2872 /* assign all PCMs of the given codec */ 2873 int snd_hda_codec_build_pcms(struct hda_codec *codec) 2874 { 2875 unsigned int pcm; 2876 int err; 2877 2878 if (!codec->num_pcms) { 2879 if (!codec->patch_ops.build_pcms) 2880 return 0; 2881 err = codec->patch_ops.build_pcms(codec); 2882 if (err < 0) { 2883 printk(KERN_ERR "hda_codec: cannot build PCMs" 2884 "for #%d (error %d)\n", codec->addr, err); 2885 err = snd_hda_codec_reset(codec); 2886 if (err < 0) { 2887 printk(KERN_ERR 2888 "hda_codec: cannot revert codec\n"); 2889 return err; 2558 2890 } 2559 num_devs[type]++; 2560 if (!cpcm->pcm) { 2561 cpcm->device = dev; 2562 err = snd_hda_attach_pcm(codec, cpcm); 2563 if (err < 0) 2564 return err; 2891 } 2892 } 2893 for (pcm = 0; pcm < codec->num_pcms; pcm++) { 2894 struct hda_pcm *cpcm = &codec->pcm_info[pcm]; 2895 int dev; 2896 2897 if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams) 2898 continue; /* no substreams assigned */ 2899 2900 if (!cpcm->pcm) { 2901 dev = get_empty_pcm_device(codec->bus, cpcm->pcm_type); 2902 if (dev < 0) 2903 continue; /* no fatal error */ 2904 cpcm->device = dev; 2905 err = snd_hda_attach_pcm(codec, cpcm); 2906 if (err < 0) { 2907 printk(KERN_ERR "hda_codec: cannot attach " 2908 "PCM stream %d for codec #%d\n", 2909 dev, codec->addr); 2910 continue; /* no fatal error */ 2565 2911 } 2566 2912 } … … 2568 2914 return 0; 2569 2915 } 2916 2917 /** 2918 * snd_hda_build_pcms - build PCM information 2919 * @bus: the BUS 2920 * 2921 * Create PCM information for each codec included in the bus. 2922 * 2923 * The build_pcms codec patch is requested to set up codec->num_pcms and 2924 * codec->pcm_info properly. The array is referred by the top-level driver 2925 * to create its PCM instances. 2926 * The allocated codec->pcm_info should be released in codec->patch_ops.free 2927 * callback. 2928 * 2929 * At least, substreams, channels_min and channels_max must be filled for 2930 * each stream. substreams = 0 indicates that the stream doesn't exist. 2931 * When rates and/or formats are zero, the supported values are queried 2932 * from the given nid. The nid is used also by the default ops.prepare 2933 * and ops.cleanup callbacks. 2934 * 2935 * The driver needs to call ops.open in its open callback. Similarly, 2936 * ops.close is supposed to be called in the close callback. 2937 * ops.prepare should be called in the prepare or hw_params callback 2938 * with the proper parameters for set up. 2939 * ops.cleanup should be called in hw_free for clean up of streams. 2940 * 2941 * This function returns 0 if successfull, or a negative error code. 2942 */ 2943 int __devinit snd_hda_build_pcms(struct hda_bus *bus) 2944 { 2945 struct hda_codec *codec; 2946 2947 list_for_each_entry(codec, &bus->codec_list, list, struct hda_codec) { 2948 int err = snd_hda_codec_build_pcms(codec); 2949 if (err < 0) 2950 return err; 2951 } 2952 return 0; 2953 } 2954 EXPORT_SYMBOL_HDA(snd_hda_build_pcms); 2570 2955 2571 2956 /** … … 2623 3008 return -1; 2624 3009 } 3010 EXPORT_SYMBOL_HDA(snd_hda_check_board_config); 3011 3012 /** 3013 * snd_hda_check_board_codec_sid_config - compare the current codec 3014 subsystem ID with the 3015 config table 3016 3017 This is important for Gateway notebooks with SB450 HDA Audio 3018 where the vendor ID of the PCI device is: 3019 ATI Technologies Inc SB450 HDA Audio [1002:437b] 3020 and the vendor/subvendor are found only at the codec. 3021 3022 * @codec: the HDA codec 3023 * @num_configs: number of config enums 3024 * @models: array of model name strings 3025 * @tbl: configuration table, terminated by null entries 3026 * 3027 * Compares the modelname or PCI subsystem id of the current codec with the 3028 * given configuration table. If a matching entry is found, returns its 3029 * config value (supposed to be 0 or positive). 3030 * 3031 * If no entries are matching, the function returns a negative value. 3032 */ 3033 int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, 3034 int num_configs, const char **models, 3035 const struct snd_pci_quirk *tbl) 3036 { 3037 const struct snd_pci_quirk *q; 3038 3039 /* Search for codec ID */ 3040 for (q = tbl; q->subvendor; q++) { 3041 unsigned long vendorid = (q->subdevice) | (q->subvendor << 16); 3042 3043 if (vendorid == codec->subsystem_id) 3044 break; 3045 } 3046 3047 if (!q->subvendor) 3048 return -1; 3049 3050 tbl = q; 3051 3052 if (tbl->value >= 0 && tbl->value < num_configs) { 3053 #ifdef CONFIG_SND_DEBUG_DETECT 3054 char tmp[10]; 3055 const char *model = NULL; 3056 if (models) 3057 model = models[tbl->value]; 3058 if (!model) { 3059 sprintf(tmp, "#%d", tbl->value); 3060 model = tmp; 3061 } 3062 snd_printdd(KERN_INFO "hda_codec: model '%s' is selected " 3063 "for config %x:%x (%s)\n", 3064 model, tbl->subvendor, tbl->subdevice, 3065 (tbl->name ? tbl->name : "Unknown device")); 3066 #endif 3067 return tbl->value; 3068 } 3069 return -1; 3070 } 3071 EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config); 2625 3072 2626 3073 /** … … 2658 3105 return 0; 2659 3106 } 3107 EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); 2660 3108 2661 3109 #ifdef CONFIG_SND_HDA_POWER_SAVE … … 2700 3148 codec->power_transition = 0; 2701 3149 } 3150 EXPORT_SYMBOL_HDA(snd_hda_power_up); 3151 3152 #define power_save(codec) \ 3153 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) 3154 3155 #define power_save(codec) \ 3156 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0) 2702 3157 2703 3158 void snd_hda_power_down(struct hda_codec *codec) … … 2706 3161 if (!codec->power_on || codec->power_count || codec->power_transition) 2707 3162 return; 2708 if (power_save ) {3163 if (power_save(codec)) { 2709 3164 codec->power_transition = 1; /* avoid reentrance */ 2710 schedule_delayed_work(&codec->power_work, 2711 msecs_to_jiffies(power_save * 1000)); 2712 } 2713 } 3165 queue_delayed_work(codec->bus->workq, &codec->power_work, 3166 msecs_to_jiffies(power_save(codec) * 1000)); 3167 } 3168 } 3169 EXPORT_SYMBOL_HDA(snd_hda_power_down); 2714 3170 2715 3171 int snd_hda_check_amp_list_power(struct hda_codec *codec, … … 2748 3204 return 0; 2749 3205 } 3206 EXPORT_SYMBOL_HDA(snd_hda_check_amp_list_power); 2750 3207 #endif 2751 3208 … … 2767 3224 return 0; 2768 3225 } 3226 EXPORT_SYMBOL_HDA(snd_hda_ch_mode_info); 2769 3227 2770 3228 int snd_hda_ch_mode_get(struct hda_codec *codec, … … 2784 3242 return 0; 2785 3243 } 3244 EXPORT_SYMBOL_HDA(snd_hda_ch_mode_get); 2786 3245 2787 3246 int snd_hda_ch_mode_put(struct hda_codec *codec, … … 2804 3263 return 1; 2805 3264 } 3265 EXPORT_SYMBOL_HDA(snd_hda_ch_mode_put); 2806 3266 2807 3267 /* … … 2824 3284 return 0; 2825 3285 } 3286 EXPORT_SYMBOL_HDA(snd_hda_input_mux_info); 2826 3287 2827 3288 int snd_hda_input_mux_put(struct hda_codec *codec, … … 2845 3306 return 1; 2846 3307 } 3308 EXPORT_SYMBOL_HDA(snd_hda_input_mux_put); 2847 3309 2848 3310 … … 2897 3359 return 0; 2898 3360 } 3361 EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_open); 2899 3362 2900 3363 int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, … … 2909 3372 return 0; 2910 3373 } 3374 EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare); 3375 3376 int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec, 3377 struct hda_multi_out *mout) 3378 { 3379 mutex_lock(&codec->spdif_mutex); 3380 cleanup_dig_out_stream(codec, mout->dig_out_nid); 3381 mutex_unlock(&codec->spdif_mutex); 3382 return 0; 3383 } 3384 EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_cleanup); 2911 3385 2912 3386 /* … … 2921 3395 return 0; 2922 3396 } 3397 EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_close); 2923 3398 2924 3399 /* … … 2960 3435 SNDRV_PCM_HW_PARAM_CHANNELS, 2); 2961 3436 } 3437 EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_open); 2962 3438 2963 3439 /* … … 3018 3494 return 0; 3019 3495 } 3496 EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_prepare); 3020 3497 3021 3498 /* … … 3044 3521 return 0; 3045 3522 } 3523 EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup); 3046 3524 3047 3525 /* … … 3132 3610 continue; 3133 3611 3134 def_conf = snd_hda_codec_read(codec, nid, 0, 3135 AC_VERB_GET_CONFIG_DEFAULT, 0); 3612 def_conf = snd_hda_codec_get_pincfg(codec, nid); 3136 3613 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) 3137 3614 continue; … … 3209 3686 break; 3210 3687 case AC_JACK_SPDIF_OUT: 3211 cfg->dig_out_pin = nid; 3688 case AC_JACK_DIG_OTHER_OUT: 3689 if (cfg->dig_outs >= ARRAY_SIZE(cfg->dig_out_pins)) 3690 continue; 3691 cfg->dig_out_pins[cfg->dig_outs] = nid; 3692 cfg->dig_out_type[cfg->dig_outs] = 3693 (loc == AC_JACK_LOC_HDMI) ? 3694 HDA_PCM_TYPE_HDMI : HDA_PCM_TYPE_SPDIF; 3695 cfg->dig_outs++; 3212 3696 break; 3213 3697 case AC_JACK_SPDIF_IN: 3698 case AC_JACK_DIG_OTHER_IN: 3214 3699 cfg->dig_in_pin = nid; 3700 if (loc == AC_JACK_LOC_HDMI) 3701 cfg->dig_in_type = HDA_PCM_TYPE_HDMI; 3702 else 3703 cfg->dig_in_type = HDA_PCM_TYPE_SPDIF; 3215 3704 break; 3216 3705 } … … 3318 3807 cfg->hp_pins[3], cfg->hp_pins[4]); 3319 3808 snd_printd(" mono: mono_out=0x%x\n", cfg->mono_out_pin); 3809 if (cfg->dig_outs) 3810 snd_printd(" dig-out=0x%x/0x%x\n", 3811 cfg->dig_out_pins[0], cfg->dig_out_pins[1]); 3320 3812 snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x," 3321 3813 " cd=0x%x, aux=0x%x\n", … … 3326 3818 cfg->input_pins[AUTO_PIN_CD], 3327 3819 cfg->input_pins[AUTO_PIN_AUX]); 3328 3329 return 0; 3330 } 3820 if (cfg->dig_in_pin) 3821 snd_printd(" dig-in=0x%x\n", cfg->dig_in_pin); 3822 3823 return 0; 3824 } 3825 EXPORT_SYMBOL_HDA(snd_hda_parse_pin_def_config); 3331 3826 3332 3827 /* labels for input pins */ … … 3334 3829 "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux" 3335 3830 }; 3831 EXPORT_SYMBOL_HDA(auto_pin_cfg_labels); 3336 3832 3337 3833 … … 3361 3857 return 0; 3362 3858 } 3859 EXPORT_SYMBOL_HDA(snd_hda_suspend); 3363 3860 3364 3861 /** 3365 3862 * snd_hda_resume - resume the codecs 3366 3863 * @bus: the HDA bus 3367 * @state: resume state3368 3864 * 3369 3865 * Returns 0 if successful. … … 3382 3878 return 0; 3383 3879 } 3384 #ifdef CONFIG_SND_HDA_POWER_SAVE 3385 int snd_hda_codecs_inuse(struct hda_bus *bus) 3386 { 3387 struct hda_codec *codec; 3388 3389 list_for_each_entry(codec, &bus->codec_list, list, struct hda_codec) { 3390 if (snd_hda_codec_needs_resume(codec)) 3391 return 1; 3392 } 3393 return 0; 3394 } 3395 #endif 3396 #endif 3880 EXPORT_SYMBOL_HDA(snd_hda_resume); 3881 #endif /* CONFIG_PM */ 3397 3882 3398 3883 /* … … 3423 3908 return snd_array_elem(array, array->used++); 3424 3909 } 3910 EXPORT_SYMBOL_HDA(snd_array_new); 3425 3911 3426 3912 /* free the given array elements */ … … 3432 3918 array->list = NULL; 3433 3919 } 3920 EXPORT_SYMBOL_HDA(snd_array_free); 3921 3922 /* 3923 * used by hda_proc.c and hda_eld.c 3924 */ 3925 void snd_print_pcm_rates(int pcm, char *buf, int buflen) 3926 { 3927 static unsigned int rates[] = { 3928 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 3929 96000, 176400, 192000, 384000 3930 }; 3931 int i, j; 3932 3933 for (i = 0, j = 0; i < ARRAY_SIZE(rates); i++) 3934 if (pcm & (1 << i)) 3935 j += snprintf(buf + j, buflen - j, " %d", rates[i]); 3936 3937 buf[j] = '\0'; /* necessary when j == 0 */ 3938 } 3939 EXPORT_SYMBOL_HDA(snd_print_pcm_rates); 3940 3941 void snd_print_pcm_bits(int pcm, char *buf, int buflen) 3942 { 3943 static unsigned int bits[] = { 8, 16, 20, 24, 32 }; 3944 int i, j; 3945 3946 for (i = 0, j = 0; i < ARRAY_SIZE(bits); i++) 3947 if (pcm & (AC_SUPPCM_BITS_8 << i)) 3948 j += snprintf(buf + j, buflen - j, " %d", bits[i]); 3949 3950 buf[j] = '\0'; /* necessary when j == 0 */ 3951 } 3952 EXPORT_SYMBOL_HDA(snd_print_pcm_bits); 3953 3954 MODULE_DESCRIPTION("HDA codec core"); 3955 MODULE_LICENSE("GPL"); -
GPL/trunk/alsa-kernel/pci/hda/hda_codec.h
r417 r426 586 586 struct pci_dev *pci; 587 587 const char *modelname; 588 int *power_save; 588 589 struct hda_bus_ops ops; 589 590 }; … … 602 603 struct pci_dev *pci; 603 604 const char *modelname; 605 int *power_save; 604 606 struct hda_bus_ops ops; 605 607 … … 617 619 /* unsolicited event queue */ 618 620 struct hda_bus_unsolicited *unsol; 619 620 struct snd_info_entry *proc; 621 char workq_name[16]; 622 struct workqueue_struct *workq; /* common workqueue for codecs */ 623 624 /* assigned PCMs */ 625 DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES); 621 626 622 627 /* misc op flags */ 623 628 unsigned int needs_damn_long_delay :1; 629 unsigned int shutdown :1; /* being unloaded */ 624 630 }; 625 631 … … 641 647 }; 642 648 649 struct hda_codec_preset_list { 650 const struct hda_codec_preset *preset; 651 struct module *owner; 652 struct list_head list; 653 }; 654 655 /* initial hook */ 656 int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset); 657 int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset); 658 643 659 /* ops set by the preset patch */ 644 660 struct hda_codec_ops { … … 728 744 729 745 /* ids */ 746 u32 function_id; 730 747 u32 vendor_id; 731 748 u32 subsystem_id; … … 734 751 /* detected preset */ 735 752 const struct hda_codec_preset *preset; 753 struct module *owner; 736 754 const char *name; /* codec name */ 737 755 const char *modelname; /* model name for preset */ … … 765 783 struct semaphore spdif_mutex; 766 784 #endif 785 struct mutex control_mutex; 767 786 unsigned int spdif_status; /* IEC958 status bits */ 768 787 unsigned short spdif_ctls; /* SPDIF control bits */ 769 788 unsigned int spdif_in_enable; /* SPDIF input enable? */ 770 789 hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ 790 struct snd_array init_pins; /* initial (BIOS) pin configurations */ 791 struct snd_array driver_pins; /* pin configs set by codec parser */ 771 792 772 793 #ifdef CONFIG_SND_HDA_HWDEP … … 774 795 struct snd_array init_verbs; /* additional init verbs */ 775 796 struct snd_array hints; /* additional hints */ 797 struct snd_array user_pins; /* default pin configs to override */ 776 798 #endif 777 799 … … 781 803 * (e.g. Realtek codecs) 782 804 */ 805 unsigned int pin_amp_workaround:1; /* pin out-amp takes index 806 * (e.g. Conexant codecs) 807 */ 783 808 #ifdef CONFIG_SND_HDA_POWER_SAVE 784 809 unsigned int power_on :1; /* current (global) power-state */ … … 787 812 struct delayed_work power_work; /* delayed task for powerdown */ 788 813 #endif 814 815 /* codec-specific additional proc output */ 816 void (*proc_widget_hook)(struct snd_info_buffer *buffer, 817 struct hda_codec *codec, hda_nid_t nid); 789 818 }; 790 819 … … 801 830 struct hda_bus **busp); 802 831 int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, 803 struct hda_codec **codecp);832 int do_init, struct hda_codec **codecp); 804 833 805 834 /* … … 842 871 #endif 843 872 873 /* the struct for codec->pin_configs */ 874 struct hda_pincfg { 875 hda_nid_t nid; 876 unsigned int cfg; 877 }; 878 879 unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid); 880 int snd_hda_codec_set_pincfg(struct hda_codec *codec, hda_nid_t nid, 881 unsigned int cfg); 882 int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list, 883 hda_nid_t nid, unsigned int cfg); /* for hwdep */ 884 844 885 /* 845 886 * Mixer … … 852 893 */ 853 894 int snd_hda_build_pcms(struct hda_bus *bus); 895 int snd_hda_codec_build_pcms(struct hda_codec *codec); 854 896 void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, 855 897 u32 stream_tag, … … 860 902 unsigned int format, 861 903 unsigned int maxbps); 862 int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid,863 u32 *ratesp, u64 *formatsp, unsigned int *bpsp);864 904 int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid, 865 905 unsigned int format); … … 892 932 void snd_hda_power_down(struct hda_codec *codec); 893 933 #define snd_hda_codec_needs_resume(codec) codec->power_count 894 int snd_hda_codecs_inuse(struct hda_bus *bus);895 934 #else 896 935 static inline void snd_hda_power_up(struct hda_codec *codec) {} 897 936 static inline void snd_hda_power_down(struct hda_codec *codec) {} 898 937 #define snd_hda_codec_needs_resume(codec) 1 899 #define snd_hda_codecs_inuse(bus) 1 938 #endif 939 940 /* 941 * Codec modularization 942 */ 943 944 /* Export symbols only for communication with codec drivers; 945 * When built in kernel, all HD-audio drivers are supposed to be statically 946 * linked to the kernel. Thus, the symbols don't have to (or shouldn't) be 947 * exported unless it's built as a module. 948 */ 949 #if defined(MODULE) && !defined(TARGET_OS2) 950 #define EXPORT_SYMBOL_HDA(sym) EXPORT_SYMBOL_GPL(sym) 951 #else 952 #define EXPORT_SYMBOL_HDA(sym) 900 953 #endif 901 954 -
GPL/trunk/alsa-kernel/pci/hda/hda_generic.c
r417 r426 145 145 146 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 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 … … 724 724 knew.index = index; 725 725 knew.name = name; 726 #ifdef TARGET_OS2 727 knew.count = 1; 728 #endif 726 729 knew.info = snd_hda_mixer_amp_switch_info; 727 730 knew.get = snd_hda_mixer_amp_switch_get; … … 741 744 knew.index = index; 742 745 knew.name = name; 746 #ifdef TARGET_OS2 747 knew.count = 1; 748 #endif 743 749 knew.info = snd_hda_mixer_amp_switch_info; 744 750 knew.get = snd_hda_mixer_amp_switch_get; … … 763 769 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 764 770 knew.name = name; 771 #ifdef TARGET_OS2 772 knew.count = 1; 773 #endif 765 774 knew.info = snd_hda_mixer_amp_volume_info; 766 775 knew.get = snd_hda_mixer_amp_volume_get; … … 777 786 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 778 787 knew.name = name; 788 #ifdef TARGET_OS2 789 knew.count = 1; 790 #endif 779 791 knew.info = snd_hda_mixer_amp_volume_info; 780 792 knew.get = snd_hda_mixer_amp_volume_get; … … 900 912 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 901 913 knew.name = name; 914 #ifdef TARGET_OS2 915 knew.count = 1; 916 #endif 902 917 knew.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 903 918 SNDRV_CTL_ELEM_ACCESS_TLV_READ | … … 1138 1153 return err; 1139 1154 } 1155 EXPORT_SYMBOL(snd_hda_parse_generic_codec); -
GPL/trunk/alsa-kernel/pci/hda/hda_hwdep.c
r417 r426 31 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 40 * write/read an out-of-bound verb … … 100 106 static void clear_hwdep_elements(struct hda_codec *codec) 101 107 { 102 char **head;103 108 int i; 104 109 … … 106 111 snd_array_free(&codec->init_verbs); 107 112 /* clear hints */ 108 head = codec->hints.list; 109 for (i = 0; i < codec->hints.used; i++, head++) 110 kfree(*head); 113 for (i = 0; i < codec->hints.used; i++) { 114 struct hda_hint *hint = snd_array_elem(&codec->hints, i); 115 kfree(hint->key); /* we don't need to free hint->val */ 116 } 111 117 snd_array_free(&codec->hints); 118 snd_array_free(&codec->user_pins); 112 119 } 113 120 … … 117 124 } 118 125 119 int __devinitsnd_hda_create_hwdep(struct hda_codec *codec)126 int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) 120 127 { 121 128 char hwname[16]; … … 141 148 142 149 snd_array_init(&codec->init_verbs, sizeof(struct hda_verb), 32); 143 snd_array_init(&codec->hints, sizeof(char *), 32); 144 145 return 0; 146 } 150 snd_array_init(&codec->hints, sizeof(struct hda_hint), 32); 151 snd_array_init(&codec->user_pins, sizeof(struct hda_pincfg), 16); 152 153 return 0; 154 } 155 156 #ifdef CONFIG_SND_HDA_RECONFIG 147 157 148 158 /* … … 152 162 static int clear_codec(struct hda_codec *codec) 153 163 { 154 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 } 155 171 clear_hwdep_elements(codec); 156 172 return 0; … … 161 177 int err; 162 178 179 snd_hda_power_up(codec); 163 180 snd_printk(KERN_INFO "hda-codec: reconfiguring\n"); 164 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 } 165 187 err = snd_hda_codec_configure(codec); 166 188 if (err < 0) 167 return err;189 goto error; 168 190 /* rebuild PCMs */ 169 err = snd_hda_ build_pcms(codec->bus);191 err = snd_hda_codec_build_pcms(codec); 170 192 if (err < 0) 171 return err;193 goto error; 172 194 /* rebuild mixers */ 173 195 err = snd_hda_codec_build_controls(codec); 174 196 if (err < 0) 175 return err; 176 return 0; 197 goto error; 198 err = snd_card_register(codec->bus->card); 199 error: 200 snd_hda_power_down(codec); 201 return err; 177 202 } 178 203 … … 270 295 CODEC_ACTION_STORE(clear); 271 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 272 313 static ssize_t init_verbs_store(struct device *dev, 273 314 struct device_attribute *attr, … … 276 317 struct snd_hwdep *hwdep = dev_get_drvdata(dev); 277 318 struct hda_codec *codec = hwdep->private_data; 278 char *p; 279 struct hda_verb verb, *v; 280 281 verb.nid = simple_strtoul(buf, &p, 0); 282 verb.verb = simple_strtoul(p, &p, 0); 283 verb.param = simple_strtoul(p, &p, 0); 284 if (!verb.nid || !verb.verb || !verb.param) 319 struct hda_verb *v; 320 int nid, verb, param; 321 322 if (sscanf(buf, "%i %i %i", &nid, &verb, ¶m) != 3) 323 return -EINVAL; 324 if (!nid || !verb) 285 325 return -EINVAL; 286 326 v = snd_array_new(&codec->init_verbs); 287 327 if (!v) 288 328 return -ENOMEM; 289 *v = verb; 329 v->nid = nid; 330 v->verb = verb; 331 v->param = param; 290 332 return count; 291 333 } 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 292 376 293 377 static ssize_t hints_store(struct device *dev, … … 297 381 struct snd_hwdep *hwdep = dev_get_drvdata(dev); 298 382 struct hda_codec *codec = hwdep->private_data; 299 char *p; 300 char **hint; 301 302 if (!*buf || isspace(*buf) || *buf == '#' || *buf == '\n') 383 char *key, *val; 384 struct hda_hint *hint; 385 386 while (isspace(*buf)) 387 buf++; 388 if (!*buf || *buf == '#' || *buf == '\n') 303 389 return count; 304 p = kstrndup_noeol(buf, 1024); 305 if (!p) 390 if (*buf == '=') 391 return -EINVAL; 392 key = kstrndup_noeol(buf, 1024); 393 if (!key) 306 394 return -ENOMEM; 307 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); 308 419 if (!hint) { 309 kfree( p);420 kfree(key); 310 421 return -ENOMEM; 311 422 } 312 *hint = p; 423 hint->key = key; 424 hint->val = val; 313 425 return count; 314 426 } 315 427 316 #ifndef TARGET_OS2 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; 486 return count; 487 } 488 317 489 #define CODEC_ATTR_RW(type) \ 318 490 __ATTR(type, 0644, type##_show, type##_store) … … 330 502 CODEC_ATTR_RW(name), 331 503 CODEC_ATTR_RW(modelname), 332 CODEC_ATTR_WO(init_verbs), 333 CODEC_ATTR_WO(hints), 504 CODEC_ATTR_RW(init_verbs), 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), 334 509 CODEC_ATTR_WO(reconfig), 335 510 CODEC_ATTR_WO(clear), … … 349 524 return 0; 350 525 } 351 #endif /* TARGET_OS2 */ 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 552 #endif /* CONFIG_SND_HDA_RECONFIG */ -
GPL/trunk/alsa-kernel/pci/hda/hda_intel.c
r417 r426 51 51 #include "hda_codec.h" 52 52 53 53 54 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 54 55 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; … … 60 61 static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 61 62 #else 62 static int bdl_pos_adj[SNDRV_CARDS] = {-1 };63 static int probe_mask[SNDRV_CARDS] = {-1 };63 static int bdl_pos_adj[SNDRV_CARDS] = {-1,-1,-1,-1,-1,-1,-1,-1}; 64 static int probe_mask[SNDRV_CARDS] = {-1,-1,-1,-1,-1,-1,-1,-1}; 64 65 #endif 66 static int probe_only[SNDRV_CARDS]; 65 67 static int single_cmd; 66 68 static int enable_msi; … … 81 83 module_param_array(probe_mask, int, NULL, 0444); 82 84 MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1)."); 85 module_param_array(probe_only, bool, NULL, 0444); 86 MODULE_PARM_DESC(probe_only, "Only probing and no codec initialization."); 83 87 module_param(single_cmd, bool, 0444); 84 88 MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs " … … 88 92 89 93 #ifdef CONFIG_SND_HDA_POWER_SAVE 90 /* power_save option is defined in hda_codec.c */ 94 static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; 95 module_param(power_save, int, 0644); 96 MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " 97 "(in second, 0 = disable)."); 91 98 92 99 /* reset the HD-audio controller in power save mode. … … 297 304 #define VIA_HDAC_DEVICE_ID 0x3288 298 305 306 /* HD Audio class code */ 307 #define PCI_CLASS_MULTIMEDIA_HD_AUDIO 0x0403 299 308 300 309 /* … … 308 317 u32 *posbuf; /* position buffer pointer */ 309 318 #endif 319 310 320 unsigned int bufsize; /* size of the play buffer in bytes */ 311 321 unsigned int period_bytes; /* size of the period in bytes */ 312 322 unsigned int frags; /* number for period in the play buffer */ 313 323 unsigned int fifo_size; /* FIFO size */ 324 unsigned long start_jiffies; /* start + minimum jiffies */ 325 unsigned long min_jiffies; /* minimum jiffies before position is valid */ 314 326 315 327 #ifdef TARGET_OS2 … … 334 346 unsigned int running :1; 335 347 unsigned int irq_pending :1; 336 unsigned int irq_ignore :1;348 unsigned int start_flag: 1; /* stream full start flag */ 337 349 /* 338 350 * For VIA: … … 393 405 /* HD codec */ 394 406 unsigned short codec_mask; 407 int codec_probe_mask; /* copied from probe_mask option */ 395 408 struct hda_bus *bus; 396 409 … … 435 448 AZX_DRIVER_NVIDIA, 436 449 AZX_DRIVER_TERA, 450 AZX_DRIVER_GENERIC, 437 451 AZX_NUM_DRIVERS, /* keep this as last entry */ 438 452 }; … … 448 462 [AZX_DRIVER_NVIDIA] = "HDA NVidia", 449 463 [AZX_DRIVER_TERA] = "HDA Teradici", 464 [AZX_DRIVER_GENERIC] = "HD-Audio Generic", 450 465 }; 451 466 … … 868 883 } 869 884 870 /* stop a stream */ 871 static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev) 872 { 873 /* stop DMA */ 885 /* stop DMA */ 886 static void azx_stream_clear(struct azx *chip, struct azx_dev *azx_dev) 887 { 874 888 azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & 875 889 ~(SD_CTL_DMA_START | SD_INT_MASK)); 876 890 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); /* to be sure */ 891 } 892 893 /* stop a stream */ 894 static void azx_stream_stop(struct azx *chip, struct azx_dev *azx_dev) 895 { 896 azx_stream_clear(chip, azx_dev); 877 897 /* disable SIE */ 878 898 azx_writeb(chip, INTCTL, … … 979 999 struct azx_dev *azx_dev; 980 1000 u32 status; 981 #ifdef TARGET_OS2982 u32 ignore_irq = 0;983 #endif984 int i;1001 #ifdef TARGET_OS2 1002 u32 ignore_irq = 0; 1003 #endif 1004 int i, ok; 985 1005 986 1006 spin_lock(&chip->reg_lock); … … 998 1018 if (!azx_dev->substream || !azx_dev->running) 999 1019 continue; 1000 /* ignore the first dummy IRQ (due to pos_adj) */ 1001 if (azx_dev->irq_ignore) { 1002 azx_dev->irq_ignore = 0; 1003 #ifdef TARGET_OS2 1004 ignore_irq |= azx_dev->sd_int_sta_mask; 1005 #endif 1006 continue; 1007 } 1020 #if 0 /* ??????? */ 1021 #ifdef TARGET_OS2 1022 ignore_irq |= azx_dev->sd_int_sta_mask; 1023 #endif 1024 continue; 1025 #endif 1008 1026 /* check whether this IRQ is really acceptable */ 1009 if (azx_position_ok(chip, azx_dev)) { 1027 ok = azx_position_ok(chip, azx_dev); 1028 if (ok == 1) { 1010 1029 azx_dev->irq_pending = 0; 1011 1030 spin_unlock(&chip->reg_lock); 1012 1031 snd_pcm_period_elapsed(azx_dev->substream); 1013 1032 spin_lock(&chip->reg_lock); 1014 } else {1033 } else if (ok == 0 && chip->bus && chip->bus->workq) { 1015 1034 /* bogus IRQ, process it later */ 1016 1035 azx_dev->irq_pending = 1; 1017 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 1018 schedule_work(&chip->irq_pending_work); 1019 #endif 1036 queue_work(chip->bus->workq, 1037 &chip->irq_pending_work); 1020 1038 } 1021 1039 } … … 1102 1120 azx_sd_writel(azx_dev, SD_BDLPU, 0); 1103 1121 1104 period_bytes = snd_pcm_lib_period_bytes(substream); 1105 azx_dev->period_bytes = period_bytes; 1122 period_bytes = azx_dev->period_bytes; 1106 1123 periods = azx_dev->bufsize / period_bytes; 1107 1124 … … 1110 1127 ofs = 0; 1111 1128 azx_dev->frags = 0; 1112 azx_dev->irq_ignore = 0;1113 1129 pos_adj = bdl_pos_adj[chip->dev_index]; 1114 1130 if (pos_adj > 0) { … … 1131 1147 if (ofs < 0) 1132 1148 goto error; 1133 azx_dev->irq_ignore = 1;1134 1149 } 1135 1150 } else … … 1150 1165 snd_printk(KERN_ERR "Too many BDL entries: buffer=%d, period=%d\n", 1151 1166 azx_dev->bufsize, period_bytes); 1152 /* reset */1153 azx_sd_writel(azx_dev, SD_BDLPL, 0);1154 azx_sd_writel(azx_dev, SD_BDLPU, 0);1155 1167 return -EINVAL; 1156 1168 } 1157 1169 1158 /* 1159 * set up the SD for streaming 1160 */ 1161 static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) 1170 /* reset stream */ 1171 static void azx_stream_reset(struct azx *chip, struct azx_dev *azx_dev) 1162 1172 { 1163 1173 unsigned char val; 1164 1174 int timeout; 1165 1175 1166 /* make sure the run bit is zero for SD */ 1167 azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) & 1168 ~SD_CTL_DMA_START); 1169 /* reset stream */ 1176 azx_stream_clear(chip, azx_dev); 1177 1170 1178 azx_sd_writeb(azx_dev, SD_CTL, azx_sd_readb(azx_dev, SD_CTL) | 1171 1179 SD_CTL_STREAM_RESET); … … 1185 1193 ; 1186 1194 1195 /* reset first position - may not be synced with hw at this time */ 1196 *azx_dev->posbuf = 0; 1197 } 1198 1199 /* 1200 * set up the SD for streaming 1201 */ 1202 static int azx_setup_controller(struct azx *chip, struct azx_dev *azx_dev) 1203 { 1204 /* make sure the run bit is zero for SD */ 1205 azx_stream_clear(chip, azx_dev); 1187 1206 /* program the stream_tag */ 1188 1207 azx_sd_writel(azx_dev, SD_CTL, … … 1255 1274 1256 1275 static int __devinit azx_codec_create(struct azx *chip, const char *model, 1257 unsigned int codec_probe_mask)1276 int no_init) 1258 1277 { 1259 1278 struct hda_bus_template bus_temp; … … 1269 1288 bus_temp.ops.attach_pcm = azx_attach_pcm_stream; 1270 1289 #ifdef CONFIG_SND_HDA_POWER_SAVE 1290 bus_temp.power_save = &power_save; 1271 1291 bus_temp.ops.pm_notify = azx_power_notify; 1272 1292 #endif … … 1286 1306 /* First try to probe all given codec slots */ 1287 1307 for (c = 0; c < max_slots; c++) { 1288 if ((chip->codec_mask & (1 << c)) & c odec_probe_mask) {1308 if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { 1289 1309 if (probe_codec(chip, c) < 0) { 1290 1310 /* Some BIOSen give you wrong codec addresses … … 1310 1330 /* Then create codec instances */ 1311 1331 for (c = 0; c < max_slots; c++) { 1312 if ((chip->codec_mask & (1 << c)) & c odec_probe_mask) {1332 if ((chip->codec_mask & (1 << c)) & chip->codec_probe_mask) { 1313 1333 struct hda_codec *codec; 1314 err = snd_hda_codec_new(chip->bus, c, &codec);1334 err = snd_hda_codec_new(chip->bus, c, !no_init, &codec); 1315 1335 if (err < 0) 1316 1336 continue; … … 1428 1448 snd_pcm_set_sync(substream); 1429 1449 mutex_unlock(&chip->open_mutex); 1450 1430 1451 return 0; 1431 1452 } … … 1454 1475 struct snd_pcm_hw_params *hw_params) 1455 1476 { 1477 struct azx_dev *azx_dev = get_azx_dev(substream); 1478 1479 azx_dev->bufsize = 0; 1480 azx_dev->period_bytes = 0; 1481 azx_dev->format_val = 0; 1456 1482 return snd_pcm_lib_malloc_pages(substream, 1457 1483 params_buffer_bytes(hw_params)); … … 1468 1494 azx_sd_writel(azx_dev, SD_BDLPU, 0); 1469 1495 azx_sd_writel(azx_dev, SD_CTL, 0); 1496 azx_dev->bufsize = 0; 1497 azx_dev->period_bytes = 0; 1498 azx_dev->format_val = 0; 1470 1499 1471 1500 hinfo->ops.cleanup(hinfo, apcm->codec, substream); … … 1481 1510 struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; 1482 1511 struct snd_pcm_runtime *runtime = substream->runtime; 1483 1484 azx_dev->bufsize = snd_pcm_lib_buffer_bytes(substream); 1485 azx_dev->format_val = snd_hda_calc_stream_format(runtime->rate, 1486 runtime->channels, 1487 runtime->format, 1488 hinfo->maxbps); 1489 if (!azx_dev->format_val) { 1512 unsigned int bufsize, period_bytes, format_val; 1513 int err; 1514 1515 azx_stream_reset(chip, azx_dev); 1516 format_val = snd_hda_calc_stream_format(runtime->rate, 1517 runtime->channels, 1518 runtime->format, 1519 hinfo->maxbps); 1520 if (!format_val) { 1490 1521 snd_printk(KERN_ERR SFX 1491 1522 "invalid format_val, rate=%d, ch=%d, format=%d\n", … … 1494 1525 } 1495 1526 1527 bufsize = snd_pcm_lib_buffer_bytes(substream); 1528 period_bytes = snd_pcm_lib_period_bytes(substream); 1529 1496 1530 snd_printdd("azx_pcm_prepare: bufsize=0x%x, format=0x%x\n", 1497 azx_dev->bufsize, azx_dev->format_val); 1498 if (azx_setup_periods(chip, substream, azx_dev) < 0) 1499 return -EINVAL; 1531 bufsize, format_val); 1532 1533 if (bufsize != azx_dev->bufsize || 1534 period_bytes != azx_dev->period_bytes || 1535 format_val != azx_dev->format_val) { 1536 azx_dev->bufsize = bufsize; 1537 azx_dev->period_bytes = period_bytes; 1538 azx_dev->format_val = format_val; 1539 err = azx_setup_periods(chip, substream, azx_dev); 1540 if (err < 0) 1541 return err; 1542 } 1543 1544 azx_dev->min_jiffies = (runtime->period_size * HZ) / 1545 (runtime->rate * 2); 1500 1546 azx_setup_controller(chip, azx_dev); 1501 1547 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) … … 1514 1560 struct azx_dev *azx_dev; 1515 1561 struct snd_pcm_substream *s; 1516 int start, nsync = 0, sbits = 0;1562 int rstart = 0, start, nsync = 0, sbits = 0; 1517 1563 int nwait, timeout; 1518 1564 1519 1565 switch (cmd) { 1566 case SNDRV_PCM_TRIGGER_START: 1567 rstart = 1; 1520 1568 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 1521 1569 case SNDRV_PCM_TRIGGER_RESUME: 1522 case SNDRV_PCM_TRIGGER_START:1523 1570 start = 1; 1524 1571 break; … … 1550 1597 continue; 1551 1598 azx_dev = get_azx_dev(s); 1599 if (rstart) { 1600 azx_dev->start_flag = 1; 1601 azx_dev->start_jiffies = jiffies + azx_dev->min_jiffies; 1602 } 1552 1603 if (start) 1553 1604 azx_stream_start(chip, azx_dev); … … 1699 1750 unsigned int pos; 1700 1751 1752 if (azx_dev->start_flag && 1753 time_before_eq(jiffies, azx_dev->start_jiffies)) 1754 return -1; /* bogus (too early) interrupt */ 1755 azx_dev->start_flag = 0; 1756 1701 1757 pos = azx_get_position(chip, azx_dev); 1702 1758 if (chip->position_fix == POS_FIX_AUTO) { … … 1767 1823 chip->azx_dev[i].irq_pending = 0; 1768 1824 spin_unlock_irq(&chip->reg_lock); 1769 flush_scheduled_work();1770 1825 } 1771 1826 … … 1938 1993 * power management 1939 1994 */ 1995 1996 static int snd_hda_codecs_inuse(struct hda_bus *bus) 1997 { 1998 struct hda_codec *codec; 1999 2000 list_for_each_entry(codec, &bus->codec_list, list, struct hda_codec) { 2001 if (snd_hda_codec_needs_resume(codec)) 2002 return 1; 2003 } 2004 return 0; 2005 } 2006 1940 2007 static int azx_suspend(struct pci_dev *pci, pm_message_t state) 1941 2008 { … … 2078 2145 const struct snd_pci_quirk *q; 2079 2146 2080 /* Check VIA HD Audio Controller exist */ 2081 if (chip->pci->vendor == PCI_VENDOR_ID_VIA && 2082 chip->pci->device == VIA_HDAC_DEVICE_ID) { 2147 switch (fix) { 2148 case POS_FIX_LPIB: 2149 case POS_FIX_POSBUF: 2150 return fix; 2151 } 2152 2153 /* Check VIA/ATI HD Audio Controller exist */ 2154 switch (chip->driver_type) { 2155 case AZX_DRIVER_VIA: 2156 case AZX_DRIVER_ATI: 2083 2157 chip->via_dmapos_patch = 1; 2084 2158 /* Use link position directly, avoid any transfer problem. */ … … 2087 2161 chip->via_dmapos_patch = 0; 2088 2162 2089 if (fix == POS_FIX_AUTO) { 2090 q = snd_pci_quirk_lookup(chip->pci, position_fix_list); 2091 if (q) { 2092 printk(KERN_INFO 2093 "hda_intel: position_fix set to %d " 2094 "for device %04x:%04x\n", 2095 q->value, q->subvendor, q->subdevice); 2096 return q->value; 2097 } 2098 } 2099 return fix; 2163 q = snd_pci_quirk_lookup(chip->pci, position_fix_list); 2164 if (q) { 2165 printk(KERN_INFO 2166 "hda_intel: position_fix set to %d " 2167 "for device %04x:%04x\n", 2168 q->value, q->subvendor, q->subdevice); 2169 return q->value; 2170 } 2171 return POS_FIX_AUTO; 2100 2172 } 2101 2173 … … 2110 2182 SND_PCI_QUIRK(0x17aa, 0x2010, "Thinkpad X/T/R60", 0x01), 2111 2183 SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X/T/R61", 0x01), 2112 /* broken BIOS */ 2113 SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), 2184 /* broken BIOS */ 2185 SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), 2186 /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ 2187 SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), 2188 /* forced codec slots */ 2189 SND_PCI_QUIRK(0x1046, 0x1262, "ASUS W5F", 0x103), 2114 2190 {0} 2115 2191 }; 2116 2192 2193 #define AZX_FORCE_CODEC_MASK 0x100 2194 2117 2195 static void __devinit check_probe_mask(struct azx *chip, int dev) 2118 2196 { 2119 2197 const struct snd_pci_quirk *q; 2120 2198 2121 if (probe_mask[dev] == -1) { 2199 chip->codec_probe_mask = probe_mask[dev]; 2200 if (chip->codec_probe_mask == -1) { 2122 2201 q = snd_pci_quirk_lookup(chip->pci, probe_mask_list); 2123 2202 if (q) { … … 2126 2205 "for device %04x:%04x\n", 2127 2206 q->value, q->subvendor, q->subdevice); 2128 probe_mask[dev]= q->value;2207 chip->codec_probe_mask = q->value; 2129 2208 } 2209 } 2210 2211 /* check forced option */ 2212 if (chip->codec_probe_mask != -1 && 2213 (chip->codec_probe_mask & AZX_FORCE_CODEC_MASK)) { 2214 chip->codec_mask = chip->codec_probe_mask & 0xff; 2215 printk(KERN_INFO "hda_intel: codec_mask forced to 0x%x\n", 2216 chip->codec_mask); 2130 2217 } 2131 2218 } … … 2225 2312 snd_printdd("chipset global capabilities = 0x%x\n", gcap); 2226 2313 2314 /* ATI chips seems buggy about 64bit DMA addresses */ 2315 if (chip->driver_type == AZX_DRIVER_ATI) 2316 gcap &= ~0x01; 2317 2227 2318 /* allow 64bit DMA address if supported by H/W */ 2228 if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_64BIT_MASK)) 2229 pci_set_consistent_dma_mask(pci, DMA_64BIT_MASK); 2319 if ((gcap & 0x01) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64))) 2320 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64)); 2321 else { 2322 pci_set_dma_mask(pci, DMA_BIT_MASK(32)); 2323 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)); 2324 } 2230 2325 2231 2326 /* read number of streams from GCAP register instead of using … … 2246 2341 chip->capture_streams = ATIHDMI_NUM_CAPTURE; 2247 2342 break; 2343 case AZX_DRIVER_GENERIC: 2248 2344 default: 2249 2345 chip->playback_streams = ICH6_NUM_PLAYBACK; … … 2348 2444 } 2349 2445 2350 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);2351 if ( !card) {2446 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 2447 if (err < 0) { 2352 2448 snd_printk(KERN_ERR SFX "Error creating card!\n"); 2353 return -ENOMEM;2449 return err; 2354 2450 } 2355 2451 2356 2452 err = azx_create(card, pci, dev, pci_id->driver_data, &chip); 2357 if (err < 0) { 2358 snd_card_free(card); 2359 return err; 2360 } 2453 if (err < 0) 2454 goto out_free; 2361 2455 card->private_data = chip; 2362 2456 2363 2457 /* create codec instances */ 2364 err = azx_codec_create(chip, model[dev], probe_mask[dev]); 2365 if (err < 0) { 2366 snd_card_free(card); 2367 return err; 2368 } 2458 err = azx_codec_create(chip, model[dev], probe_only[dev]); 2459 if (err < 0) 2460 goto out_free; 2369 2461 2370 2462 /* create PCM streams */ 2371 2463 err = snd_hda_build_pcms(chip->bus); 2372 if (err < 0) { 2373 snd_card_free(card); 2374 return err; 2375 } 2464 if (err < 0) 2465 goto out_free; 2376 2466 2377 2467 /* create mixer controls */ 2378 2468 err = azx_mixer_create(chip); 2379 if (err < 0) { 2380 snd_card_free(card); 2381 return err; 2382 } 2469 if (err < 0) 2470 goto out_free; 2383 2471 2384 2472 snd_card_set_dev(card, &pci->dev); 2385 2473 2386 2474 err = snd_card_register(card); 2387 if (err < 0) { 2388 snd_card_free(card); 2389 return err; 2390 } 2475 if (err < 0) 2476 goto out_free; 2391 2477 2392 2478 pci_set_drvdata(pci, card); … … 2396 2482 2397 2483 dev++; 2484 return err; 2485 out_free: 2486 snd_card_free(card); 2398 2487 return err; 2399 2488 } … … 2464 2553 { PCI_DEVICE(0x10de, 0x0ac2), .driver_data = AZX_DRIVER_NVIDIA }, 2465 2554 { PCI_DEVICE(0x10de, 0x0ac3), .driver_data = AZX_DRIVER_NVIDIA }, 2466 { PCI_DEVICE(0x10de, 0x0 bd4), .driver_data = AZX_DRIVER_NVIDIA },2467 { PCI_DEVICE(0x10de, 0x0 bd5), .driver_data = AZX_DRIVER_NVIDIA },2468 { PCI_DEVICE(0x10de, 0x0 bd6), .driver_data = AZX_DRIVER_NVIDIA },2469 { PCI_DEVICE(0x10de, 0x0 bd7), .driver_data = AZX_DRIVER_NVIDIA },2555 { PCI_DEVICE(0x10de, 0x0d94), .driver_data = AZX_DRIVER_NVIDIA }, 2556 { PCI_DEVICE(0x10de, 0x0d95), .driver_data = AZX_DRIVER_NVIDIA }, 2557 { PCI_DEVICE(0x10de, 0x0d96), .driver_data = AZX_DRIVER_NVIDIA }, 2558 { PCI_DEVICE(0x10de, 0x0d97), .driver_data = AZX_DRIVER_NVIDIA }, 2470 2559 /* Teradici */ 2471 2560 { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, 2561 /* AMD Generic, PCI class code and Vendor ID for HD Audio */ 2562 { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID), 2563 .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8, 2564 .class_mask = 0xffffff, 2565 .driver_data = AZX_DRIVER_GENERIC }, 2472 2566 { 0, } 2473 2567 }; -
GPL/trunk/alsa-kernel/pci/hda/hda_local.h
r417 r426 27 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 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 33 /* mono volume with index (index=0,1,...) (channel=1,2) */ 32 34 #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ … … 97 99 int snd_hda_add_vmaster(struct hda_codec *codec, char *name, 98 100 unsigned int *tlv, const char **slaves); 99 voidsnd_hda_codec_reset(struct hda_codec *codec);101 int snd_hda_codec_reset(struct hda_codec *codec); 100 102 int snd_hda_codec_configure(struct hda_codec *codec); 101 103 … … 135 137 struct hda_bind_ctls { 136 138 struct hda_ctl_ops *ops; 137 #ifndef TARGET_OS2138 long values[];139 #else140 139 unsigned long values[]; 141 #endif142 140 }; 143 141 … … 232 230 hda_nid_t extra_out_nid[3]; /* optional DACs, 0 when not exists */ 233 231 hda_nid_t dig_out_nid; /* digital out audio widget */ 232 hda_nid_t *slave_dig_outs; 234 233 int max_channels; /* currently supported analog channels */ 235 234 int dig_out_used; /* current usage of digital out (HDA_DIG_XXX) */ … … 256 255 unsigned int format, 257 256 struct snd_pcm_substream *substream); 257 int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec, 258 struct hda_multi_out *mout); 258 259 int snd_hda_multi_out_analog_open(struct hda_codec *codec, 259 260 struct hda_multi_out *mout, … … 289 290 #endif 290 291 292 #define SND_PRINT_RATES_ADVISED_BUFSIZE 80 293 void snd_print_pcm_rates(int pcm, char *buf, int buflen); 294 295 #define SND_PRINT_BITS_ADVISED_BUFSIZE 16 296 void snd_print_pcm_bits(int pcm, char *buf, int buflen); 297 291 298 /* 292 299 * Misc … … 295 302 const char **modelnames, 296 303 const struct snd_pci_quirk *pci_list); 304 int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, 305 int num_configs, const char **models, 306 const struct snd_pci_quirk *tbl); 297 307 int snd_hda_add_new_ctls(struct hda_codec *codec, 298 308 struct snd_kcontrol_new *knew); … … 348 358 hda_nid_t hp_pins[AUTO_CFG_MAX_OUTS]; 349 359 hda_nid_t input_pins[AUTO_PIN_LAST]; 350 hda_nid_t dig_out_pin; 360 int dig_outs; 361 hda_nid_t dig_out_pins[2]; 351 362 hda_nid_t dig_in_pin; 352 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 */ 353 366 }; 354 367 … … 399 412 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, 400 413 unsigned int caps); 414 u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); 401 415 402 416 int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl); … … 408 422 #ifdef CONFIG_SND_HDA_HWDEP 409 423 int snd_hda_create_hwdep(struct hda_codec *codec); 424 #else 425 static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } 426 #endif 427 428 #ifdef CONFIG_SND_HDA_RECONFIG 410 429 int snd_hda_hwdep_add_sysfs(struct hda_codec *codec); 411 430 #else 412 static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } 431 static inline int snd_hda_hwdep_add_sysfs(struct hda_codec *codec) 432 { 433 return 0; 434 } 435 #endif 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 } 413 452 #endif 414 453 … … 444 483 #define get_amp_direction(kc) (((kc)->private_value >> 18) & 0x1) 445 484 #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) 485 #define get_amp_offset(kc) (((kc)->private_value >> 23) & 0x3f) 486 487 /* 488 * CEA Short Audio Descriptor data 489 */ 490 struct cea_sad { 491 int channels; 492 int format; /* (format == 0) indicates invalid SAD */ 493 int rates; 494 int sample_bits; /* for LPCM */ 495 int max_bitrate; /* for AC3...ATRAC */ 496 int profile; /* for WMAPRO */ 497 }; 498 499 #define ELD_FIXED_BYTES 20 500 #define ELD_MAX_MNL 16 501 #define ELD_MAX_SAD 16 502 503 /* 504 * ELD: EDID Like Data 505 */ 506 struct hdmi_eld { 507 int eld_size; 508 int baseline_len; 509 int eld_ver; /* (eld_ver == 0) indicates invalid ELD */ 510 int cea_edid_ver; 511 char monitor_name[ELD_MAX_MNL + 1]; 512 int manufacture_id; 513 int product_id; 514 u64 port_id; 515 int support_hdcp; 516 int support_ai; 517 int conn_type; 518 int aud_synch_delay; 519 int spk_alloc; 520 int sad_count; 521 struct cea_sad sad[ELD_MAX_SAD]; 522 #ifdef CONFIG_PROC_FS 523 struct snd_info_entry *proc_entry; 524 #endif 525 }; 526 527 int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid); 528 int snd_hdmi_get_eld(struct hdmi_eld *, struct hda_codec *, hda_nid_t); 529 void snd_hdmi_show_eld(struct hdmi_eld *eld); 530 531 #ifdef CONFIG_PROC_FS 532 int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld); 533 void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld); 534 #else 535 static inline int snd_hda_eld_proc_new(struct hda_codec *codec, 536 struct hdmi_eld *eld) 537 { 538 return 0; 539 } 540 static inline void snd_hda_eld_proc_free(struct hda_codec *codec, 541 struct hdmi_eld *eld) 542 { 543 } 544 #endif 545 546 #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 547 void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen); 446 548 447 549 #endif /* __SOUND_HDA_LOCAL_H */ -
GPL/trunk/alsa-kernel/pci/hda/hda_proc.c
r417 r426 92 92 static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) 93 93 { 94 static unsigned int rates[] = { 95 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96 96000, 176400, 192000, 384000 97 }; 98 int i; 94 char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; 99 95 100 96 pcm &= AC_SUPPCM_RATES; 101 97 snd_iprintf(buffer, " rates [0x%x]:", pcm); 102 for (i = 0; i < ARRAY_SIZE(rates); i++) 103 if (pcm & (1 << i)) 104 snd_iprintf(buffer, " %d", rates[i]); 105 snd_iprintf(buffer, "\n"); 98 snd_print_pcm_rates(pcm, buf, sizeof(buf)); 99 snd_iprintf(buffer, "%s\n", buf); 106 100 } 107 101 108 102 static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm) 109 103 { 110 static unsigned int bits[] = { 8, 16, 20, 24, 32 }; 111 int i; 112 113 pcm = (pcm >> 16) & 0xff; 114 snd_iprintf(buffer, " bits [0x%x]:", pcm); 115 for (i = 0; i < ARRAY_SIZE(bits); i++) 116 if (pcm & (1 << i)) 117 snd_iprintf(buffer, " %d", bits[i]); 118 snd_iprintf(buffer, "\n"); 104 char buf[SND_PRINT_BITS_ADVISED_BUFSIZE]; 105 106 snd_iprintf(buffer, " bits [0x%x]:", (pcm >> 16) & 0xff); 107 snd_print_pcm_bits(pcm, buf, sizeof(buf)); 108 snd_iprintf(buffer, "%s\n", buf); 119 109 } 120 110 … … 410 400 int c, curr = -1; 411 401 412 if (conn_len > 1 && wid_type != AC_WID_AUD_MIX) 402 if (conn_len > 1 && 403 wid_type != AC_WID_AUD_MIX && 404 wid_type != AC_WID_VOL_KNB && 405 wid_type != AC_WID_POWER) 413 406 curr = snd_hda_codec_read(codec, nid, 0, 414 407 AC_VERB_GET_CONNECT_SEL, 0); … … 423 416 snd_iprintf(buffer, "\n"); 424 417 } 425 }426 427 static void print_realtek_coef(struct snd_info_buffer *buffer,428 struct hda_codec *codec, hda_nid_t nid)429 {430 int coeff = snd_hda_codec_read(codec, nid, 0,431 AC_VERB_GET_PROC_COEF, 0);432 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);433 coeff = snd_hda_codec_read(codec, nid, 0,434 AC_VERB_GET_COEF_INDEX, 0);435 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);436 418 } 437 419 … … 468 450 snd_iprintf(buffer, 469 451 " IO[%d]: enable=%d, dir=%d, wake=%d, " 470 "sticky=%d, data=%d \n", i,452 "sticky=%d, data=%d, unsol=%d\n", i, 471 453 (enable & (1<<i)) ? 1 : 0, 472 454 (direction & (1<<i)) ? 1 : 0, 473 455 (wake & (1<<i)) ? 1 : 0, 474 456 (sticky & (1<<i)) ? 1 : 0, 475 (data & (1<<i)) ? 1 : 0); 457 (data & (1<<i)) ? 1 : 0, 458 (unsol & (1<<i)) ? 1 : 0); 476 459 /* FIXME: add GPO and GPI pin information */ 477 460 } … … 487 470 codec->name ? codec->name : "Not Set"); 488 471 snd_iprintf(buffer, "Address: %d\n", codec->addr); 489 snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id); 490 snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id); 472 snd_iprintf(buffer, "Function Id: 0x%x\n", codec->function_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); 491 475 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); 492 476 … … 514 498 515 499 print_gpio(buffer, codec, codec->afg); 500 if (codec->proc_widget_hook) 501 codec->proc_widget_hook(buffer, codec, codec->afg); 516 502 517 503 for (i = 0; i < nodes; i++, nid++) { … … 572 558 print_amp_caps(buffer, codec, nid, HDA_OUTPUT); 573 559 snd_iprintf(buffer, " Amp-Out vals: "); 574 print_amp_vals(buffer, codec, nid, HDA_OUTPUT, 575 wid_caps & AC_WCAP_STEREO, 1); 560 if (wid_type == AC_WID_PIN && 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); 576 568 } 577 569 … … 616 608 print_proc_caps(buffer, codec, nid); 617 609 618 /* NID 0x20 == Realtek Define Registers */ 619 if (codec->vendor_id == 0x10ec && nid == 0x20) 620 print_realtek_coef(buffer, codec, nid); 610 if (codec->proc_widget_hook) 611 codec->proc_widget_hook(buffer, codec, nid); 621 612 } 622 613 snd_hda_power_down(codec); -
GPL/trunk/alsa-kernel/pci/hda/patch_analog.c
r417 r426 28 28 #include "hda_codec.h" 29 29 #include "hda_local.h" 30 #include "hda_ patch.h"30 #include "hda_beep.h" 31 31 32 32 struct ad198x_spec { 33 33 struct snd_kcontrol_new *mixers[5]; 34 34 int num_mixers; 35 35 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ 36 36 const struct hda_verb *init_verbs[5]; /* initialization verbs 37 37 * don't forget NULL termination! … … 155 155 156 156 static void ad198x_free_kctls(struct hda_codec *codec); 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 {0} /* 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 */ 157 167 158 168 static int ad198x_build_controls(struct hda_codec *codec) … … 183 193 } 184 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 185 210 /* if we have no master control, let's create it */ 186 211 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { … … 277 302 } 278 303 304 static int ad198x_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, 305 struct hda_codec *codec, 306 struct snd_pcm_substream *substream) 307 { 308 struct ad198x_spec *spec = codec->spec; 309 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); 310 } 311 279 312 /* 280 313 * Analog capture … … 335 368 .open = ad198x_dig_playback_pcm_open, 336 369 .close = ad198x_dig_playback_pcm_close, 337 .prepare = ad198x_dig_playback_pcm_prepare 370 .prepare = ad198x_dig_playback_pcm_prepare, 371 .cleanup = ad198x_dig_playback_pcm_cleanup 338 372 }, 339 373 }; … … 399 433 400 434 ad198x_free_kctls(codec); 401 kfree(codec->spec); 435 kfree(spec); 436 snd_hda_detach_beep_device(codec); 402 437 } 403 438 … … 538 573 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), 539 574 HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), 540 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT),541 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT),542 575 HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), 543 576 HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), … … 603 636 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), 604 637 HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), 605 /* HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), 606 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), 638 /* 607 639 HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), 608 640 HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), */ … … 639 671 640 672 static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { 673 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), 674 HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), 675 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), 676 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), 677 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT), 678 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT), 679 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), 680 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), 681 HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), 682 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), 683 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), 684 { 685 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 686 .name = "Capture Source", 687 .info = ad198x_mux_enum_info, 688 .get = ad198x_mux_enum_get, 689 .put = ad198x_mux_enum_put, 690 }, 691 { 692 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 693 .name = "External Amplifier", 694 .info = ad198x_eapd_info, 695 .get = ad198x_eapd_get, 696 .put = ad198x_eapd_put, 697 .private_value = 0x1b | (1 << 8), /* port-D, inversed */ 698 }, 699 {0} /* end */ 700 }; 701 702 static struct snd_kcontrol_new ad1986a_samsung_mixers[] = { 641 703 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), 642 704 HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), … … 772 834 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), 773 835 HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT), 774 HDA_CODEC_VOLUME("Beep Playback Volume", 0x18, 0x0, HDA_OUTPUT),775 HDA_CODEC_MUTE("Beep Playback Switch", 0x18, 0x0, HDA_OUTPUT),776 836 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), 777 837 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), … … 931 991 AD1986A_LAPTOP_AUTOMUTE, 932 992 AD1986A_ULTRA, 993 AD1986A_SAMSUNG, 933 994 AD1986A_MODELS 934 995 }; … … 941 1002 [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute", 942 1003 [AD1986A_ULTRA] = "ultra", 1004 [AD1986A_SAMSUNG] = "samsung", 943 1005 }; 944 1006 … … 963 1025 SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), 964 1026 SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), 965 SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD),966 SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD),967 SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD),968 1027 SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), 1028 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_SAMSUNG), 969 1029 SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), 970 1030 SND_PCI_QUIRK(0x17aa, 0x1011, "Lenovo M55", AD1986A_LAPTOP), … … 988 1048 static int is_jack_available(struct hda_codec *codec, hda_nid_t nid) 989 1049 { 990 unsigned int conf = snd_hda_codec_read(codec, nid, 0, 991 AC_VERB_GET_CONFIG_DEFAULT, 0); 1050 unsigned int conf = snd_hda_codec_get_pincfg(codec, nid); 992 1051 return get_defcfg_connect(conf) != AC_JACK_PORT_NONE; 993 1052 } … … 996 1055 { 997 1056 struct ad198x_spec *spec; 998 int board_config;1057 int err, board_config; 999 1058 1000 1059 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 1003 1062 1004 1063 codec->spec = spec; 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); 1005 1071 1006 1072 spec->multiout.max_channels = 6; … … 1047 1113 case AD1986A_LAPTOP_EAPD: 1048 1114 spec->mixers[0] = ad1986a_laptop_eapd_mixers; 1115 spec->num_init_verbs = 2; 1116 spec->init_verbs[1] = ad1986a_eapd_init_verbs; 1117 spec->multiout.max_channels = 2; 1118 spec->multiout.num_dacs = 1; 1119 spec->multiout.dac_nids = ad1986a_laptop_dac_nids; 1120 if (!is_jack_available(codec, 0x25)) 1121 spec->multiout.dig_out_nid = 0; 1122 spec->input_mux = &ad1986a_laptop_eapd_capture_source; 1123 break; 1124 case AD1986A_SAMSUNG: 1125 spec->mixers[0] = ad1986a_samsung_mixers; 1049 1126 spec->num_init_verbs = 3; 1050 1127 spec->init_verbs[1] = ad1986a_eapd_init_verbs; … … 1172 1249 HDA_CODEC_VOLUME("Line Playback Volume", 0x13, 0x0, HDA_OUTPUT), 1173 1250 HDA_CODEC_MUTE("Line Playback Switch", 0x13, 0x0, HDA_OUTPUT), 1174 HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x10, 1, 0x0, HDA_OUTPUT),1175 HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x10, 1, 0x0, HDA_OUTPUT),1176 1251 HDA_CODEC_VOLUME("Mic Boost", 0x0c, 0x0, HDA_OUTPUT), 1177 1252 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), … … 1244 1319 { 1245 1320 struct ad198x_spec *spec; 1321 int err; 1246 1322 1247 1323 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 1250 1326 1251 1327 codec->spec = spec; 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); 1252 1335 1253 1336 spec->multiout.max_channels = 2; … … 1320 1403 HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), 1321 1404 HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), 1322 HDA_CODEC_VOLUME_MONO("PC Speaker Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),1323 HDA_CODEC_MUTE_MONO("PC Speaker Playback Switch", 0x0d, 1, 0x0, HDA_OUTPUT),1324 1405 HDA_CODEC_VOLUME("Front Mic Boost", 0x08, 0x0, HDA_INPUT), 1325 1406 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0x0, HDA_INPUT), … … 1366 1447 {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 1367 1448 /* Mic boost: 0dB */ 1368 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},1369 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},1449 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 1450 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 1370 1451 /* Record selector: Front mic */ 1371 1452 {0x15, AC_VERB_SET_CONNECT_SEL, 0x0}, … … 1632 1713 SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD), 1633 1714 /* All HP models */ 1634 SND_PCI_QUIRK (0x103c, 0, "HP nx", AD1981_HP),1715 SND_PCI_QUIRK_VENDOR(0x103c, "HP nx", AD1981_HP), 1635 1716 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba U205", AD1981_TOSHIBA), 1636 1717 /* Lenovo Thinkpad T60/X60/Z6xx */ 1637 SND_PCI_QUIRK (0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD),1718 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1981_THINKPAD), 1638 1719 /* HP nx6320 (reversed SSID, H/W bug) */ 1639 1720 SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_HP), … … 1644 1725 { 1645 1726 struct ad198x_spec *spec; 1646 int board_config;1727 int err, board_config; 1647 1728 1648 1729 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 1651 1732 1652 1733 codec->spec = spec; 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); 1653 1741 1654 1742 spec->multiout.max_channels = 2; … … 1844 1932 #define AD1988_SPDIF_IN 0x07 1845 1933 1846 static hda_nid_t ad1989b_slave_dig_outs[ 2] = {1847 AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI 1934 static hda_nid_t ad1989b_slave_dig_outs[] = { 1935 AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0 1848 1936 }; 1849 1937 … … 1938 2026 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), 1939 2027 1940 HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT),1941 HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT),1942 1943 2028 HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), 1944 2029 HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), … … 1984 2069 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x4, HDA_INPUT), 1985 2070 1986 HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT),1987 HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT),1988 1989 2071 HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), 1990 2072 HDA_CODEC_MUTE("Analog Mix Playback Switch", 0x21, 0x0, HDA_OUTPUT), … … 2015 2097 HDA_CODEC_VOLUME("Line Playback Volume", 0x20, 0x1, HDA_INPUT), 2016 2098 HDA_CODEC_MUTE("Line Playback Switch", 0x20, 0x1, HDA_INPUT), 2017 2018 HDA_CODEC_VOLUME("Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT),2019 HDA_CODEC_MUTE("Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT),2020 2099 2021 2100 HDA_CODEC_VOLUME("Analog Mix Playback Volume", 0x21, 0x0, HDA_OUTPUT), … … 2247 2326 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, 2248 2327 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, 2249 /* ADCs; muted */2250 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},2251 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},2252 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},2253 2328 2254 2329 {0} … … 2358 2433 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, 2359 2434 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, 2360 /* ADCs; muted */2361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},2362 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},2363 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},2364 2435 /* Analog Mix output amp */ 2365 2436 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ … … 2433 2504 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x1}, 2434 2505 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x1}, 2435 /* ADCs; muted */2436 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},2437 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},2438 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},2439 2506 /* Analog Mix output amp */ 2440 2507 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x1f}, /* 0dB */ … … 2840 2907 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 2841 2908 2842 if (spec->autocfg.dig_out _pin)2909 if (spec->autocfg.dig_outs) 2843 2910 spec->multiout.dig_out_nid = AD1988_SPDIF_OUT; 2844 2911 if (spec->autocfg.dig_in_pin) … … 2890 2957 { 2891 2958 struct ad198x_spec *spec; 2892 int board_config;2959 int err, board_config; 2893 2960 2894 2961 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 2910 2977 if (board_config == AD1988_AUTO) { 2911 2978 /* automatic parse from the BIOS config */ 2912 interr = ad1988_parse_auto_config(codec);2979 err = ad1988_parse_auto_config(codec); 2913 2980 if (err < 0) { 2914 2981 ad198x_free(codec); … … 2919 2986 } 2920 2987 } 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); 2921 2995 2922 2996 switch (board_config) { … … 3076 3150 HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), 3077 3151 HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), 3078 /*3079 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT),3080 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT),3081 HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0x10, 0x0, HDA_OUTPUT),3082 HDA_CODEC_MUTE("Digital Beep Playback Switch", 0x10, 0x0, HDA_OUTPUT),3083 */3084 3152 HDA_CODEC_VOLUME("Mic Boost", 0x15, 0x0, HDA_INPUT), 3085 3153 HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), … … 3154 3222 /* Port-B (front mic) pin */ 3155 3223 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3156 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_ OUT_MUTE},3224 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3157 3225 /* Port-C (rear mic) pin */ 3158 3226 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3159 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_ OUT_MUTE},3227 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3160 3228 /* Analog mixer; mute as default */ 3161 3229 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, … … 3189 3257 "CD Playback Volume", 3190 3258 "Internal Mic Playback Volume", 3191 "Docking Mic Playback Volume" 3192 "Beep Playback Volume",3259 "Docking Mic Playback Volume", 3260 /* "Beep Playback Volume", */ 3193 3261 "IEC958 Playback Volume", 3194 3262 NULL … … 3198 3266 { 3199 3267 struct ad198x_spec *spec; 3268 int err; 3200 3269 3201 3270 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 3204 3273 3205 3274 codec->spec = spec; 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); 3206 3282 3207 3283 spec->multiout.max_channels = 2; … … 3271 3347 HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), 3272 3348 HDA_CODEC_VOLUME("Docking Mic Boost", 0x25, 0x0, HDA_OUTPUT), 3273 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),3274 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),3275 3349 HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT), 3276 3350 HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT), … … 3308 3382 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3309 3383 /* docking mic boost */ 3310 {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ MUTE},3384 {0x25, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3311 3385 /* Analog mixer - docking mic; mute as default */ 3312 3386 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, … … 3329 3403 HDA_CODEC_VOLUME("Line-In Playback Volume", 0x20, 0x01, HDA_INPUT), 3330 3404 HDA_CODEC_MUTE("Line-In Playback Switch", 0x20, 0x01, HDA_INPUT), 3331 /*3332 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x20, 0x03, HDA_INPUT),3333 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x20, 0x03, HDA_INPUT),3334 */3335 3405 HDA_CODEC_VOLUME("Line-In Boost", 0x15, 0x0, HDA_INPUT), 3336 3406 HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), … … 3418 3488 static struct snd_pci_quirk ad1984_cfg_tbl[] = { 3419 3489 /* Lenovo Thinkpad T61/X61 */ 3420 SND_PCI_QUIRK (0x17aa, 0, "Lenovo Thinkpad", AD1984_THINKPAD),3490 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1984_THINKPAD), 3421 3491 SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP), 3422 3492 {0} … … 3511 3581 HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x02, HDA_INPUT), 3512 3582 HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x02, HDA_INPUT), 3513 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),3514 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),3515 3583 HDA_CODEC_VOLUME("Front Mic Boost", 0x14, 0x0, HDA_INPUT), 3516 3584 HDA_CODEC_VOLUME("Line Boost", 0x15, 0x0, HDA_INPUT), … … 3572 3640 /* Port-B (front mic) pin */ 3573 3641 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3574 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_ OUT_MUTE},3642 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3575 3643 /* Port-C (rear line-in) pin */ 3576 3644 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 3577 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_ OUT_MUTE},3645 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3578 3646 /* Port-E (rear mic) pin */ 3579 3647 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, … … 3645 3713 HDA_CODEC_VOLUME("Dock Mic Playback Volume", 0x20, 0x04, HDA_INPUT), 3646 3714 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x20, 0x04, HDA_INPUT), 3647 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),3648 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),3649 3715 HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), 3650 3716 HDA_CODEC_VOLUME("Internal Mic Boost", 0x15, 0x0, HDA_INPUT), … … 3674 3740 HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT), 3675 3741 HDA_CODEC_MUTE("PCM Playback Switch", 0x20, 0x5, HDA_INPUT), 3676 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),3677 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),3678 3742 HDA_CODEC_VOLUME("Mic Capture Volume", 0x14, 0x0, HDA_INPUT), 3679 3743 HDA_CODEC_VOLUME("Internal Mic Capture Volume", 0x15, 0x0, HDA_INPUT), … … 3754 3818 }; 3755 3819 3820 static struct hda_verb ad1884a_mobile_verbs[] = { 3821 /* DACs; unmute as default */ 3822 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 3823 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */ 3824 /* Port-A (HP) mixer - route only from analog mixer */ 3825 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3826 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 3827 /* Port-A pin */ 3828 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3829 /* Port-A (HP) pin - always unmuted */ 3830 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3831 /* Port-B (mic jack) pin */ 3832 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3833 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ 3834 /* Port-C (int mic) pin */ 3835 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3836 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x7002}, /* raise mic as default */ 3837 /* Port-F (int speaker) mixer - route only from analog mixer */ 3838 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3839 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 3840 /* Port-F pin */ 3841 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3842 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3843 /* Analog mixer; mute as default */ 3844 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3845 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3846 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 3847 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 3848 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 3849 {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, 3850 /* Analog Mix output amp */ 3851 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3852 /* capture sources */ 3853 /* {0x0c, AC_VERB_SET_CONNECT_SEL, 0x0}, */ /* set via unsol */ 3854 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3855 {0x0d, AC_VERB_SET_CONNECT_SEL, 0x0}, 3856 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 3857 /* unsolicited event for pin-sense */ 3858 {0x11, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_HP_EVENT}, 3859 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1884A_MIC_EVENT}, 3860 {0} /* end */ 3861 }; 3862 3756 3863 /* 3757 3864 * Thinkpad X300 … … 3786 3893 HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x00, HDA_INPUT), 3787 3894 HDA_CODEC_MUTE("Mic Playback Switch", 0x20, 0x00, HDA_INPUT), 3788 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x03, HDA_INPUT),3789 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x03, HDA_INPUT),3790 3895 HDA_CODEC_VOLUME("Mic Boost", 0x14, 0x0, HDA_INPUT), 3791 3896 HDA_CODEC_VOLUME("Internal Mic Boost", 0x17, 0x0, HDA_INPUT), … … 3859 3964 static struct snd_pci_quirk ad1884a_cfg_tbl[] = { 3860 3965 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), 3966 SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP), 3861 3967 SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), 3862 SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), 3863 SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), 3968 SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x3070, "HP", AD1884A_MOBILE), 3969 SND_PCI_QUIRK_MASK(0x103c, 0xfff0, 0x30e0, "HP laptop", AD1884A_LAPTOP), 3970 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3600, "HP laptop", AD1884A_LAPTOP), 3864 3971 SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X300", AD1884A_THINKPAD), 3865 3972 {0} … … 3869 3976 { 3870 3977 struct ad198x_spec *spec; 3871 int board_config;3978 int err, board_config; 3872 3979 3873 3980 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 3876 3983 3877 3984 codec->spec = spec; 3985 3986 err = snd_hda_attach_beep_device(codec, 0x10); 3987 if (err < 0) { 3988 ad198x_free(codec); 3989 return err; 3990 } 3991 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); 3878 3992 3879 3993 spec->multiout.max_channels = 2; … … 3907 4021 codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; 3908 4022 codec->patch_ops.init = ad1884a_hp_init; 4023 /* set the upper-limit for mixer amp to 0dB for avoiding the 4024 * possible damage by overloading 4025 */ 4026 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, 4027 (0x17 << AC_AMPCAP_OFFSET_SHIFT) | 4028 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | 4029 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 4030 (1 << AC_AMPCAP_MUTE_SHIFT)); 3909 4031 break; 3910 4032 case AD1884A_MOBILE: 3911 4033 spec->mixers[0] = ad1884a_mobile_mixers; 3912 spec->init_verbs[ spec->num_init_verbs++] = ad1884a_laptop_verbs;4034 spec->init_verbs[0] = ad1884a_mobile_verbs; 3913 4035 spec->multiout.dig_out_nid = 0; 3914 4036 codec->patch_ops.unsol_event = ad1884a_hp_unsol_event; 3915 4037 codec->patch_ops.init = ad1884a_hp_init; 4038 /* set the upper-limit for mixer amp to 0dB for avoiding the 4039 * possible damage by overloading 4040 */ 4041 snd_hda_override_amp_caps(codec, 0x20, HDA_INPUT, 4042 (0x17 << AC_AMPCAP_OFFSET_SHIFT) | 4043 (0x17 << AC_AMPCAP_NUM_STEPS_SHIFT) | 4044 (0x05 << AC_AMPCAP_STEP_SIZE_SHIFT) | 4045 (1 << AC_AMPCAP_MUTE_SHIFT)); 3916 4046 break; 3917 4047 case AD1884A_THINKPAD: … … 4031 4161 HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), 4032 4162 HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), 4033 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT),4034 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT),4035 4163 {0} /* end */ 4036 4164 }; … … 4045 4173 HDA_CODEC_VOLUME("CD Playback Volume", 0x20, 0x06, HDA_INPUT), 4046 4174 HDA_CODEC_MUTE("CD Playback Switch", 0x20, 0x06, HDA_INPUT), 4047 HDA_CODEC_VOLUME("Beep Playback Volume", 0x20, 0x07, HDA_INPUT),4048 HDA_CODEC_MUTE("Beep Playback Switch", 0x20, 0x07, HDA_INPUT),4049 4175 HDA_CODEC_VOLUME("Digital Mic Boost", 0x1f, 0x0, HDA_INPUT), 4050 4176 {0} /* end */ … … 4205 4331 { 4206 4332 struct ad198x_spec *spec; 4207 int board_config;4333 int err, board_config; 4208 4334 4209 4335 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 4212 4338 4213 4339 codec->spec = spec; 4340 4341 err = snd_hda_attach_beep_device(codec, 0x10); 4342 if (err < 0) { 4343 ad198x_free(codec); 4344 return err; 4345 } 4346 set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); 4214 4347 4215 4348 spec->multiout.max_channels = 6; … … 4220 4353 spec->adc_nids = ad1882_adc_nids; 4221 4354 spec->capsrc_nids = ad1882_capsrc_nids; 4222 if (codec->vendor_id == 0x11d 1882)4355 if (codec->vendor_id == 0x11d41882) 4223 4356 spec->input_mux = &ad1882_capture_source; 4224 4357 else … … 4226 4359 spec->num_mixers = 2; 4227 4360 spec->mixers[0] = ad1882_base_mixers; 4228 if (codec->vendor_id == 0x11d 1882)4361 if (codec->vendor_id == 0x11d41882) 4229 4362 spec->mixers[1] = ad1882_loopback_mixers; 4230 4363 else … … 4266 4399 * patch entries 4267 4400 */ 4268 st ruct hda_codec_preset snd_hda_preset_analog[] = {4401 static struct hda_codec_preset snd_hda_preset_analog[] = { 4269 4402 { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a }, 4270 4403 { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 }, … … 4284 4417 {0} /* terminator */ 4285 4418 }; 4419 4420 MODULE_ALIAS("snd-hda-codec-id:11d4*"); 4421 4422 MODULE_LICENSE("GPL"); 4423 MODULE_DESCRIPTION("Analog Devices HD-audio codec"); 4424 4425 static struct hda_codec_preset_list analog_list = { 4426 .preset = snd_hda_preset_analog, 4427 .owner = THIS_MODULE, 4428 }; 4429 4430 static int __init patch_analog_init(void) 4431 { 4432 return snd_hda_add_codec_preset(&analog_list); 4433 } 4434 4435 static void __exit patch_analog_exit(void) 4436 { 4437 snd_hda_delete_codec_preset(&analog_list); 4438 } 4439 4440 module_init(patch_analog_init) 4441 module_exit(patch_analog_exit) -
GPL/trunk/alsa-kernel/pci/hda/patch_atihdmi.c
r417 r426 28 28 #include "hda_codec.h" 29 29 #include "hda_local.h" 30 #include "hda_patch.h"31 30 32 31 struct atihdmi_spec { … … 188 187 * patch entries 189 188 */ 190 st ruct hda_codec_preset snd_hda_preset_atihdmi[] = {191 { .id = 0x1002793c, .name = " ATIRS600 HDMI", .patch = patch_atihdmi },192 { .id = 0x10027919, .name = " ATIRS600 HDMI", .patch = patch_atihdmi },193 { .id = 0x1002791a, .name = " ATIRS690/780 HDMI", .patch = patch_atihdmi },194 { .id = 0x1002aa01, .name = " ATIR6xx HDMI", .patch = patch_atihdmi },189 static struct hda_codec_preset snd_hda_preset_atihdmi[] = { 190 { .id = 0x1002793c, .name = "RS600 HDMI", .patch = patch_atihdmi }, 191 { .id = 0x10027919, .name = "RS600 HDMI", .patch = patch_atihdmi }, 192 { .id = 0x1002791a, .name = "RS690/780 HDMI", .patch = patch_atihdmi }, 193 { .id = 0x1002aa01, .name = "R6xx HDMI", .patch = patch_atihdmi }, 195 194 { .id = 0x10951390, .name = "SiI1390 HDMI", .patch = patch_atihdmi }, 196 { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_atihdmi },197 195 { .id = 0x17e80047, .name = "Chrontel HDMI", .patch = patch_atihdmi }, 198 196 {0} /* terminator */ 199 197 }; 198 199 MODULE_ALIAS("snd-hda-codec-id:1002793c"); 200 MODULE_ALIAS("snd-hda-codec-id:10027919"); 201 MODULE_ALIAS("snd-hda-codec-id:1002791a"); 202 MODULE_ALIAS("snd-hda-codec-id:1002aa01"); 203 MODULE_ALIAS("snd-hda-codec-id:10951390"); 204 MODULE_ALIAS("snd-hda-codec-id:17e80047"); 205 206 MODULE_LICENSE("GPL"); 207 MODULE_DESCRIPTION("ATI HDMI HD-audio codec"); 208 209 static struct hda_codec_preset_list atihdmi_list = { 210 .preset = snd_hda_preset_atihdmi, 211 .owner = THIS_MODULE, 212 }; 213 214 static int __init patch_atihdmi_init(void) 215 { 216 return snd_hda_add_codec_preset(&atihdmi_list); 217 } 218 219 static void __exit patch_atihdmi_exit(void) 220 { 221 snd_hda_delete_codec_preset(&atihdmi_list); 222 } 223 224 module_init(patch_atihdmi_init) 225 module_exit(patch_atihdmi_exit) -
GPL/trunk/alsa-kernel/pci/hda/patch_cmedia.c
r417 r426 29 29 #include "hda_codec.h" 30 30 #include "hda_local.h" 31 #include "hda_patch.h"32 31 #define NUM_PINS 11 33 32 … … 682 681 683 682 /* collect pin default configuration */ 684 port_e = snd_hda_codec_ read(codec, 0x0f, 0, AC_VERB_GET_CONFIG_DEFAULT, 0);685 port_f = snd_hda_codec_ read(codec, 0x10, 0, AC_VERB_GET_CONFIG_DEFAULT,0);683 port_e = snd_hda_codec_get_pincfg(codec, 0x0f); 684 port_f = snd_hda_codec_get_pincfg(codec, 0x10); 686 685 spec->front_panel = 1; 687 686 if (get_defcfg_connect(port_e) == AC_JACK_PORT_NONE || 688 687 get_defcfg_connect(port_f) == AC_JACK_PORT_NONE) { 689 port_g = snd_hda_codec_ read(codec, 0x1f, 0, AC_VERB_GET_CONFIG_DEFAULT, 0);690 port_h = snd_hda_codec_ read(codec, 0x20, 0, AC_VERB_GET_CONFIG_DEFAULT,0);688 port_g = snd_hda_codec_get_pincfg(codec, 0x1f); 689 port_h = snd_hda_codec_get_pincfg(codec, 0x20); 691 690 spec->channel_modes = cmi9880_channel_modes; 692 691 /* no front panel */ … … 705 704 } else { 706 705 spec->input_mux = &cmi9880_basic_mux; 707 port_spdifi = snd_hda_codec_ read(codec, 0x13, 0, AC_VERB_GET_CONFIG_DEFAULT, 0);708 port_spdifo = snd_hda_codec_ read(codec, 0x12, 0, AC_VERB_GET_CONFIG_DEFAULT, 0);706 port_spdifi = snd_hda_codec_get_pincfg(codec, 0x13); 707 port_spdifo = snd_hda_codec_get_pincfg(codec, 0x12); 709 708 if (get_defcfg_connect(port_spdifo) != AC_JACK_PORT_NONE) 710 709 spec->multiout.dig_out_nid = CMI_DIG_OUT_NID; … … 737 736 * patch entries 738 737 */ 739 st ruct hda_codec_preset snd_hda_preset_cmedia[] = {738 static struct hda_codec_preset snd_hda_preset_cmedia[] = { 740 739 { .id = 0x13f69880, .name = "CMI9880", .patch = patch_cmi9880 }, 741 740 { .id = 0x434d4980, .name = "CMI9880", .patch = patch_cmi9880 }, 742 741 {0} /* terminator */ 743 742 }; 743 744 MODULE_ALIAS("snd-hda-codec-id:13f69880"); 745 MODULE_ALIAS("snd-hda-codec-id:434d4980"); 746 747 MODULE_LICENSE("GPL"); 748 MODULE_DESCRIPTION("C-Media HD-audio codec"); 749 750 static struct hda_codec_preset_list cmedia_list = { 751 .preset = snd_hda_preset_cmedia, 752 .owner = THIS_MODULE, 753 }; 754 755 static int __init patch_cmedia_init(void) 756 { 757 return snd_hda_add_codec_preset(&cmedia_list); 758 } 759 760 static void __exit patch_cmedia_exit(void) 761 { 762 snd_hda_delete_codec_preset(&cmedia_list); 763 } 764 765 module_init(patch_cmedia_init) 766 module_exit(patch_cmedia_exit) -
GPL/trunk/alsa-kernel/pci/hda/patch_conexant.c
r417 r426 26 26 #include <linux/pci.h> 27 27 #include <sound/core.h> 28 #include <sound/jack.h> 29 28 30 #include "hda_codec.h" 29 31 #include "hda_local.h" 30 #include "hda_patch.h"31 32 32 33 #define CXT_PIN_DIR_IN 0x00 … … 39 40 #define CONEXANT_MIC_EVENT 0x38 40 41 41 42 /* Conexant 5051 specific */ 43 44 #define CXT5051_SPDIF_OUT 0x1C 45 #define CXT5051_PORTB_EVENT 0x38 46 #define CXT5051_PORTC_EVENT 0x39 47 48 49 struct conexant_jack { 50 51 hda_nid_t nid; 52 int type; 53 struct snd_jack *jack; 54 55 }; 42 56 43 57 struct conexant_spec { … … 45 59 struct snd_kcontrol_new *mixers[5]; 46 60 int num_mixers; 61 hda_nid_t vmaster_nid; 47 62 48 63 const struct hda_verb *init_verbs[5]; /* initialization verbs … … 59 74 unsigned int cur_eapd; 60 75 unsigned int hp_present; 76 unsigned int no_auto_mic; 61 77 unsigned int need_dac_fix; 62 78 … … 84 100 85 101 unsigned int spdif_route; 102 103 /* jack detection */ 104 struct snd_array jacks; 86 105 87 106 /* dynamic controls, init_verbs and input_mux */ … … 331 350 } 332 351 352 #ifdef CONFIG_SND_JACK 353 static void conexant_free_jack_priv(struct snd_jack *jack) 354 { 355 struct conexant_jack *jacks = jack->private_data; 356 jacks->nid = 0; 357 jacks->jack = NULL; 358 } 359 360 static int conexant_add_jack(struct hda_codec *codec, 361 hda_nid_t nid, int type) 362 { 363 struct conexant_spec *spec; 364 struct conexant_jack *jack; 365 const char *name; 366 int err; 367 368 spec = codec->spec; 369 snd_array_init(&spec->jacks, sizeof(*jack), 32); 370 jack = snd_array_new(&spec->jacks); 371 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ; 372 373 if (!jack) 374 return -ENOMEM; 375 376 jack->nid = nid; 377 jack->type = type; 378 379 err = snd_jack_new(codec->bus->card, name, type, &jack->jack); 380 if (err < 0) 381 return err; 382 jack->jack->private_data = jack; 383 jack->jack->private_free = conexant_free_jack_priv; 384 return 0; 385 } 386 387 static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) 388 { 389 struct conexant_spec *spec = codec->spec; 390 struct conexant_jack *jacks = spec->jacks.list; 391 392 if (jacks) { 393 int i; 394 for (i = 0; i < spec->jacks.used; i++) { 395 if (jacks->nid == nid) { 396 unsigned int present; 397 present = snd_hda_codec_read(codec, nid, 0, 398 AC_VERB_GET_PIN_SENSE, 0) & 399 AC_PINSENSE_PRESENCE; 400 401 present = (present) ? jacks->type : 0 ; 402 403 snd_jack_report(jacks->jack, 404 present); 405 } 406 jacks++; 407 } 408 } 409 } 410 411 static int conexant_init_jacks(struct hda_codec *codec) 412 { 413 struct conexant_spec *spec = codec->spec; 414 int i; 415 416 for (i = 0; i < spec->num_init_verbs; i++) { 417 const struct hda_verb *hv; 418 419 hv = spec->init_verbs[i]; 420 while (hv->nid) { 421 int err = 0; 422 switch (hv->param ^ AC_USRSP_EN) { 423 case CONEXANT_HP_EVENT: 424 err = conexant_add_jack(codec, hv->nid, 425 SND_JACK_HEADPHONE); 426 conexant_report_jack(codec, hv->nid); 427 break; 428 case CXT5051_PORTC_EVENT: 429 case CONEXANT_MIC_EVENT: 430 err = conexant_add_jack(codec, hv->nid, 431 SND_JACK_MICROPHONE); 432 conexant_report_jack(codec, hv->nid); 433 break; 434 } 435 if (err < 0) 436 return err; 437 ++hv; 438 } 439 } 440 return 0; 441 442 } 443 #else 444 static inline void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) 445 { 446 } 447 448 static inline int conexant_init_jacks(struct hda_codec *codec) 449 { 450 return 0; 451 } 452 #endif 453 333 454 static int conexant_init(struct hda_codec *codec) 334 455 { … … 343 464 static void conexant_free(struct hda_codec *codec) 344 465 { 466 #ifdef CONFIG_SND_JACK 467 struct conexant_spec *spec = codec->spec; 468 if (spec->jacks.list) { 469 struct conexant_jack *jacks = spec->jacks.list; 470 int i; 471 for (i = 0; i < spec->jacks.used; i++, jacks++) { 472 if (jacks->jack) 473 snd_device_free(codec->bus->card, jacks->jack); 474 } 475 snd_array_free(&spec->jacks); 476 } 477 #endif 345 478 kfree(codec->spec); 346 479 } 480 481 static struct snd_kcontrol_new cxt_capture_mixers[] = { 482 { 483 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 484 .name = "Capture Source", 485 .info = conexant_mux_enum_info, 486 .get = conexant_mux_enum_get, 487 .put = conexant_mux_enum_put 488 }, 489 {0} 490 }; 491 492 static const char *slave_vols[] = { 493 "Headphone Playback Volume", 494 "Speaker Playback Volume", 495 NULL 496 }; 497 498 static const char *slave_sws[] = { 499 "Headphone Playback Switch", 500 "Speaker Playback Switch", 501 NULL 502 }; 347 503 348 504 static int conexant_build_controls(struct hda_codec *codec) … … 373 529 return err; 374 530 } 531 532 /* if we have no master control, let's create it */ 533 if (spec->vmaster_nid && 534 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { 535 unsigned int vmaster_tlv[4]; 536 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, 537 HDA_OUTPUT, vmaster_tlv); 538 err = snd_hda_add_vmaster(codec, "Master Playback Volume", 539 vmaster_tlv, slave_vols); 540 if (err < 0) 541 return err; 542 } 543 if (spec->vmaster_nid && 544 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { 545 err = snd_hda_add_vmaster(codec, "Master Playback Switch", 546 NULL, slave_sws); 547 if (err < 0) 548 return err; 549 } 550 551 if (spec->input_mux) { 552 err = snd_hda_add_new_ctls(codec, cxt_capture_mixers); 553 if (err < 0) 554 return err; 555 } 556 375 557 return 0; 376 558 } … … 604 786 605 787 static struct snd_kcontrol_new cxt5045_mixers[] = { 606 {607 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,608 .name = "Capture Source",609 .info = conexant_mux_enum_info,610 .get = conexant_mux_enum_get,611 .put = conexant_mux_enum_put612 },613 788 HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x01, HDA_INPUT), 614 789 HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x01, HDA_INPUT), … … 644 819 645 820 static struct snd_kcontrol_new cxt5045_mixers_hp530[] = { 646 {647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,648 .name = "Capture Source",649 .info = conexant_mux_enum_info,650 .get = conexant_mux_enum_get,651 .put = conexant_mux_enum_put652 },653 821 HDA_CODEC_VOLUME("Int Mic Capture Volume", 0x1a, 0x02, HDA_INPUT), 654 822 HDA_CODEC_MUTE("Int Mic Capture Switch", 0x1a, 0x02, HDA_INPUT), … … 887 1055 888 1056 static struct snd_pci_quirk cxt5045_cfg_tbl[] = { 889 SND_PCI_QUIRK(0x103c, 0x30a5, "HP", CXT5045_LAPTOP_HPSENSE),890 SND_PCI_QUIRK(0x103c, 0x30b2, "HP DV Series", CXT5045_LAPTOP_HPSENSE),891 SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2120", CXT5045_LAPTOP_HPSENSE),892 SND_PCI_QUIRK(0x103c, 0x30b7, "HP DV6000Z", CXT5045_LAPTOP_HPSENSE),893 SND_PCI_QUIRK(0x103c, 0x30bb, "HP DV8000", CXT5045_LAPTOP_HPSENSE),894 SND_PCI_QUIRK(0x103c, 0x30cd, "HP DV Series", CXT5045_LAPTOP_HPSENSE),895 SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV9533EG", CXT5045_LAPTOP_HPSENSE),896 1057 SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), 897 SND_PCI_QUIRK(0x103c, 0x30d9, "HP Spartan", CXT5045_LAPTOP_HPSENSE), 1058 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", 1059 CXT5045_LAPTOP_HPSENSE), 898 1060 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE), 899 1061 SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), … … 905 1067 SND_PCI_QUIRK(0x1509, 0x2f05, "FIC", CXT5045_LAPTOP_HPMICSENSE), 906 1068 SND_PCI_QUIRK(0x1509, 0x2f06, "FIC", CXT5045_LAPTOP_HPMICSENSE), 907 SND_PCI_QUIRK (0x1631, 0xc106, "Packard Bell", CXT5045_LAPTOP_HPMICSENSE),908 SND_PCI_QUIRK(0x1631, 0xc107, "Packard Bell",CXT5045_LAPTOP_HPMICSENSE),1069 SND_PCI_QUIRK_MASK(0x1631, 0xff00, 0xc100, "Packard Bell", 1070 CXT5045_LAPTOP_HPMICSENSE), 909 1071 SND_PCI_QUIRK(0x8086, 0x2111, "Conexant Reference board", CXT5045_LAPTOP_HPSENSE), 910 1072 {0} … … 920 1082 return -ENOMEM; 921 1083 codec->spec = spec; 1084 codec->pin_amp_workaround = 1; 922 1085 923 1086 spec->multiout.max_channels = 2; … … 1019 1182 #define CXT5047_SPDIF_OUT 0x11 1020 1183 1021 static hda_nid_t cxt5047_dac_nids[ 2] = { 0x10, 0x1c };1184 static hda_nid_t cxt5047_dac_nids[1] = { 0x10 }; /* 0x1c */ 1022 1185 static hda_nid_t cxt5047_adc_nids[1] = { 0x12 }; 1023 1186 static hda_nid_t cxt5047_capsrc_nids[1] = { 0x1a }; … … 1025 1188 static struct hda_channel_mode cxt5047_modes[1] = { 1026 1189 { 2, NULL }, 1027 };1028 1029 static struct hda_input_mux cxt5047_capture_source = {1030 .num_items = 1,1031 .items = {1032 { "Mic", 0x2 },1033 }1034 };1035 1036 static struct hda_input_mux cxt5047_hp_capture_source = {1037 .num_items = 1,1038 .items = {1039 { "ExtMic", 0x2 },1040 }1041 1190 }; 1042 1191 … … 1064 1213 */ 1065 1214 bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE; 1066 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, 1215 /* NOTE: Conexat codec needs the index for *OUTPUT* amp of 1216 * pin widgets unlike other codecs. In this case, we need to 1217 * set index 0x01 for the volume from the mixer amp 0x19. 1218 */ 1219 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0x01, 1067 1220 HDA_AMP_MUTE, bits); 1068 1221 bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE; … … 1072 1225 } 1073 1226 1074 /* bind volumes of both NID 0x13 (Headphones) and 0x1d (Speakers) */1075 static struct hda_bind_ctls cxt5047_bind_master_vol = {1076 .ops = &snd_hda_bind_vol,1077 .values = {1078 HDA_COMPOSE_AMP_VAL(0x13, 3, 0, HDA_OUTPUT),1079 HDA_COMPOSE_AMP_VAL(0x1d, 3, 0, HDA_OUTPUT),1080 01081 },1082 };1083 1084 1227 /* mute internal speaker if HP is plugged */ 1085 1228 static void cxt5047_hp_automute(struct hda_codec *codec) … … 1092 1235 1093 1236 bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; 1094 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, 1095 HDA_AMP_MUTE, bits); 1096 /* Mute/Unmute PCM 2 for good measure - some systems need this */ 1097 snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0, 1098 HDA_AMP_MUTE, bits); 1099 } 1100 1101 /* mute internal speaker if HP is plugged */ 1102 static void cxt5047_hp2_automute(struct hda_codec *codec) 1103 { 1104 struct conexant_spec *spec = codec->spec; 1105 unsigned int bits; 1106 1107 spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, 1108 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1109 1110 bits = spec->hp_present ? HDA_AMP_MUTE : 0; 1111 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0, 1112 HDA_AMP_MUTE, bits); 1113 /* Mute/Unmute PCM 2 for good measure - some systems need this */ 1114 snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0, 1237 /* See the note in cxt5047_hp_master_sw_put */ 1238 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0x01, 1115 1239 HDA_AMP_MUTE, bits); 1116 1240 } … … 1153 1277 } 1154 1278 1155 /* unsolicited event for HP jack sensing - non-EAPD systems */ 1156 static void cxt5047_hp2_unsol_event(struct hda_codec *codec, 1157 unsigned int res) 1158 { 1159 res >>= 26; 1160 switch (res) { 1161 case CONEXANT_HP_EVENT: 1162 cxt5047_hp2_automute(codec); 1163 break; 1164 case CONEXANT_MIC_EVENT: 1165 cxt5047_hp_automic(codec); 1166 break; 1167 } 1168 } 1169 1170 static struct snd_kcontrol_new cxt5047_mixers[] = { 1171 HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), 1172 HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT), 1173 HDA_CODEC_VOLUME("Mic Gain Volume", 0x1a, 0x0, HDA_OUTPUT), 1174 HDA_CODEC_MUTE("Mic Gain Switch", 0x1a, 0x0, HDA_OUTPUT), 1279 static struct snd_kcontrol_new cxt5047_base_mixers[] = { 1280 HDA_CODEC_VOLUME("Mic Playback Volume", 0x19, 0x02, HDA_INPUT), 1281 HDA_CODEC_MUTE("Mic Playback Switch", 0x19, 0x02, HDA_INPUT), 1282 HDA_CODEC_VOLUME("Mic Boost", 0x1a, 0x0, HDA_OUTPUT), 1175 1283 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), 1176 1284 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), 1177 1285 HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), 1178 1286 HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), 1179 HDA_CODEC_VOLUME("PCM-2 Volume", 0x1c, 0x00, HDA_OUTPUT),1180 HDA_CODEC_MUTE("PCM-2 Switch", 0x1c, 0x00, HDA_OUTPUT),1181 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x00, HDA_OUTPUT),1182 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1d, 0x00, HDA_OUTPUT),1183 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT),1184 HDA_CODEC_MUTE("Headphone Playback Switch", 0x13, 0x00, HDA_OUTPUT),1185 1186 {0}1187 };1188 1189 static struct snd_kcontrol_new cxt5047_toshiba_mixers[] = {1190 {1191 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,1192 .name = "Capture Source",1193 .info = conexant_mux_enum_info,1194 .get = conexant_mux_enum_get,1195 .put = conexant_mux_enum_put1196 },1197 HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT),1198 HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19, 0x02, HDA_INPUT),1199 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT),1200 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT),1201 HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT),1202 HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT),1203 HDA_BIND_VOL("Master Playback Volume", &cxt5047_bind_master_vol),1204 1287 { 1205 1288 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 1214 1297 }; 1215 1298 1216 static struct snd_kcontrol_new cxt5047_hp_mixers[] = { 1217 { 1218 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1219 .name = "Capture Source", 1220 .info = conexant_mux_enum_info, 1221 .get = conexant_mux_enum_get, 1222 .put = conexant_mux_enum_put 1223 }, 1224 HDA_CODEC_VOLUME("Mic Bypass Capture Volume", 0x19, 0x02, HDA_INPUT), 1225 HDA_CODEC_MUTE("Mic Bypass Capture Switch", 0x19,0x02,HDA_INPUT), 1226 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x03, HDA_INPUT), 1227 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x03, HDA_INPUT), 1228 HDA_CODEC_VOLUME("PCM Volume", 0x10, 0x00, HDA_OUTPUT), 1229 HDA_CODEC_MUTE("PCM Switch", 0x10, 0x00, HDA_OUTPUT), 1299 static struct snd_kcontrol_new cxt5047_hp_spk_mixers[] = { 1300 /* See the note in cxt5047_hp_master_sw_put */ 1301 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x1d, 0x01, HDA_OUTPUT), 1302 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x13, 0x00, HDA_OUTPUT), 1303 {0} 1304 }; 1305 1306 static struct snd_kcontrol_new cxt5047_hp_only_mixers[] = { 1230 1307 HDA_CODEC_VOLUME("Master Playback Volume", 0x13, 0x00, HDA_OUTPUT), 1231 {1232 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,1233 .name = "Master Playback Switch",1234 .info = cxt_eapd_info,1235 .get = cxt_eapd_get,1236 .put = cxt5047_hp_master_sw_put,1237 .private_value = 0x13,1238 },1239 1308 {0} /* end */ 1240 1309 }; … … 1247 1316 /* HP, Speaker */ 1248 1317 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 1249 {0x13, AC_VERB_SET_CONNECT_SEL, 0x1},1250 {0x1d, AC_VERB_SET_CONNECT_SEL, 0x0},1318 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, /* mixer(0x19) */ 1319 {0x1d, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mixer(0x19) */ 1251 1320 /* Record selector: Mic */ 1252 1321 {0x12, AC_VERB_SET_CONNECT_SEL,0x03}, … … 1268 1337 /* configuration for Toshiba Laptops */ 1269 1338 static struct hda_verb cxt5047_toshiba_init_verbs[] = { 1270 {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0 }, /* default on */ 1271 /* pin sensing on HP and Mic jacks */ 1272 {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, 1273 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_MIC_EVENT}, 1274 /* Speaker routing */ 1275 {0x1d, AC_VERB_SET_CONNECT_SEL,0x1}, 1276 {0} 1277 }; 1278 1279 /* configuration for HP Laptops */ 1280 static struct hda_verb cxt5047_hp_init_verbs[] = { 1281 /* pin sensing on HP jack */ 1282 {0x13, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | CONEXANT_HP_EVENT}, 1283 /* 0x13 is actually shared by both HP and speaker; 1284 * setting the connection to 0 (=0x19) makes the master volume control 1285 * working mysteriouslly... 1286 */ 1287 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, 1288 /* Record selector: Ext Mic */ 1289 {0x12, AC_VERB_SET_CONNECT_SEL,0x03}, 1290 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 1291 AC_AMP_SET_INPUT|AC_AMP_SET_RIGHT|AC_AMP_SET_LEFT|0x17}, 1292 /* Speaker routing */ 1293 {0x1d, AC_VERB_SET_CONNECT_SEL,0x1}, 1339 {0x13, AC_VERB_SET_EAPD_BTLENABLE, 0x0}, /* default off */ 1294 1340 {0} 1295 1341 }; … … 1456 1502 1457 1503 static struct snd_pci_quirk cxt5047_cfg_tbl[] = { 1458 SND_PCI_QUIRK(0x103c, 0x30a0, "HP DV1000", CXT5047_LAPTOP),1459 1504 SND_PCI_QUIRK(0x103c, 0x30a5, "HP DV5200T/DV8000T", CXT5047_LAPTOP_HP), 1460 SND_PCI_QUIRK (0x103c, 0x30b2, "HP DV2000T/DV3000T", CXT5047_LAPTOP),1461 SND_PCI_QUIRK(0x103c, 0x30b5, "HP DV2000Z",CXT5047_LAPTOP),1505 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series", 1506 CXT5047_LAPTOP), 1462 1507 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P100", CXT5047_LAPTOP_EAPD), 1463 1508 {0} … … 1473 1518 return -ENOMEM; 1474 1519 codec->spec = spec; 1520 codec->pin_amp_workaround = 1; 1475 1521 1476 1522 spec->multiout.max_channels = 2; … … 1481 1527 spec->adc_nids = cxt5047_adc_nids; 1482 1528 spec->capsrc_nids = cxt5047_capsrc_nids; 1483 spec->input_mux = &cxt5047_capture_source;1484 1529 spec->num_mixers = 1; 1485 spec->mixers[0] = cxt5047_ mixers;1530 spec->mixers[0] = cxt5047_base_mixers; 1486 1531 spec->num_init_verbs = 1; 1487 1532 spec->init_verbs[0] = cxt5047_init_verbs; … … 1497 1542 switch (board_config) { 1498 1543 case CXT5047_LAPTOP: 1499 codec->patch_ops.unsol_event = cxt5047_hp2_unsol_event; 1544 spec->num_mixers = 2; 1545 spec->mixers[1] = cxt5047_hp_spk_mixers; 1546 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; 1500 1547 break; 1501 1548 case CXT5047_LAPTOP_HP: 1502 spec->input_mux = &cxt5047_hp_capture_source; 1503 spec->num_init_verbs = 2; 1504 spec->init_verbs[1] = cxt5047_hp_init_verbs; 1505 spec->mixers[0] = cxt5047_hp_mixers; 1549 spec->num_mixers = 2; 1550 spec->mixers[1] = cxt5047_hp_only_mixers; 1506 1551 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; 1507 1552 codec->patch_ops.init = cxt5047_hp_init; … … 1509 1554 case CXT5047_LAPTOP_EAPD: 1510 1555 spec->input_mux = &cxt5047_toshiba_capture_source; 1556 spec->num_mixers = 2; 1557 spec->mixers[1] = cxt5047_hp_spk_mixers; 1511 1558 spec->num_init_verbs = 2; 1512 1559 spec->init_verbs[1] = cxt5047_toshiba_init_verbs; 1513 spec->mixers[0] = cxt5047_toshiba_mixers;1514 1560 codec->patch_ops.unsol_event = cxt5047_hp_unsol_event; 1515 1561 break; … … 1522 1568 #endif 1523 1569 } 1570 spec->vmaster_nid = 0x13; 1524 1571 return 0; 1525 1572 } … … 1528 1575 static hda_nid_t cxt5051_dac_nids[1] = { 0x10 }; 1529 1576 static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 }; 1530 #define CXT5051_SPDIF_OUT 0x1C1531 #define CXT5051_PORTB_EVENT 0x381532 #define CXT5051_PORTC_EVENT 0x391533 1577 1534 1578 static struct hda_channel_mode cxt5051_modes[1] = { … … 1560 1604 static void cxt5051_portb_automic(struct hda_codec *codec) 1561 1605 { 1606 struct conexant_spec *spec = codec->spec; 1562 1607 unsigned int present; 1563 1608 1609 if (spec->no_auto_mic) 1610 return; 1564 1611 present = snd_hda_codec_read(codec, 0x17, 0, 1565 1612 AC_VERB_GET_PIN_SENSE, 0) & … … 1577 1624 hda_nid_t new_adc; 1578 1625 1626 if (spec->no_auto_mic) 1627 return; 1579 1628 present = snd_hda_codec_read(codec, 0x18, 0, 1580 1629 AC_VERB_GET_PIN_SENSE, 0) & … … 1610 1659 unsigned int res) 1611 1660 { 1661 int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; 1612 1662 switch (res >> 26) { 1613 1663 case CONEXANT_HP_EVENT: … … 1621 1671 break; 1622 1672 } 1673 conexant_report_jack(codec, nid); 1623 1674 } 1624 1675 … … 1648 1699 HDA_CODEC_VOLUME("External Mic Volume", 0x15, 0x00, HDA_INPUT), 1649 1700 HDA_CODEC_MUTE("External Mic Switch", 0x15, 0x00, HDA_INPUT), 1701 HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT), 1702 { 1703 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1704 .name = "Master Playback Switch", 1705 .info = cxt_eapd_info, 1706 .get = cxt_eapd_get, 1707 .put = cxt5051_hp_master_sw_put, 1708 .private_value = 0x1a, 1709 }, 1710 1711 {0} 1712 }; 1713 1714 static struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = { 1715 HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x00, HDA_INPUT), 1716 HDA_CODEC_MUTE("Mic Switch", 0x14, 0x00, HDA_INPUT), 1650 1717 HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT), 1651 1718 { … … 1691 1758 }; 1692 1759 1760 static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = { 1761 /* Line in, Mic */ 1762 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1763 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1764 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0}, 1765 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0}, 1766 /* SPK */ 1767 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1768 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, 1769 /* HP, Amp */ 1770 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1771 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, 1772 /* DAC1 */ 1773 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1774 /* Record selector: Int mic */ 1775 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44}, 1776 {0x14, AC_VERB_SET_CONNECT_SEL, 0x1}, 1777 /* SPDIF route: PCM */ 1778 {0x1c, AC_VERB_SET_CONNECT_SEL, 0x0}, 1779 /* EAPD */ 1780 {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ 1781 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, 1782 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, 1783 {0} /* end */ 1784 }; 1785 1786 static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = { 1787 /* Line in, Mic */ 1788 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1789 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1790 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1791 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1792 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1793 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, 1794 /* SPK */ 1795 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1796 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00}, 1797 /* HP, Amp */ 1798 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1799 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, 1800 /* Docking HP */ 1801 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1802 {0x19, AC_VERB_SET_CONNECT_SEL, 0x00}, 1803 /* DAC1 */ 1804 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1805 /* Record selector: Int mic */ 1806 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44}, 1807 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44}, 1808 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x44}, 1809 /* SPDIF route: PCM */ 1810 {0x1c, AC_VERB_SET_CONNECT_SEL, 0x0}, 1811 /* EAPD */ 1812 {0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */ 1813 {0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, 1814 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT}, 1815 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTC_EVENT}, 1816 {0x19, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT}, 1817 {0} /* end */ 1818 }; 1819 1693 1820 /* initialize jack-sensing, too */ 1694 1821 static int cxt5051_init(struct hda_codec *codec) 1695 1822 { 1696 1823 conexant_init(codec); 1824 conexant_init_jacks(codec); 1697 1825 if (codec->patch_ops.unsol_event) { 1698 1826 cxt5051_hp_automute(codec); … … 1707 1835 CXT5051_LAPTOP, /* Laptops w/ EAPD support */ 1708 1836 CXT5051_HP, /* no docking */ 1837 CXT5051_HP_DV6736, /* HP without mic switch */ 1838 CXT5051_LENOVO_X200, /* Lenovo X200 laptop */ 1709 1839 CXT5051_MODELS 1710 1840 }; … … 1713 1843 [CXT5051_LAPTOP] = "laptop", 1714 1844 [CXT5051_HP] = "hp", 1845 [CXT5051_HP_DV6736] = "hp-dv6736", 1846 [CXT5051_LENOVO_X200] = "lenovo-x200", 1715 1847 }; 1716 1848 1717 1849 static struct snd_pci_quirk cxt5051_cfg_tbl[] = { 1850 SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6736", CXT5051_HP_DV6736), 1718 1851 SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", 1719 1852 CXT5051_LAPTOP), 1720 1853 SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP), 1854 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo X200", CXT5051_LENOVO_X200), 1721 1855 {0} 1722 1856 }; … … 1731 1865 return -ENOMEM; 1732 1866 codec->spec = spec; 1867 codec->pin_amp_workaround = 1; 1733 1868 1734 1869 codec->patch_ops = conexant_patch_ops; … … 1751 1886 spec->cur_adc_idx = 0; 1752 1887 1888 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; 1889 1753 1890 board_config = snd_hda_check_board_config(codec, CXT5051_MODELS, 1754 1891 cxt5051_models, … … 1756 1893 switch (board_config) { 1757 1894 case CXT5051_HP: 1758 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;1759 1895 spec->mixers[0] = cxt5051_hp_mixers; 1760 1896 break; 1761 default: 1762 case CXT5051_LAPTOP: 1763 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; 1897 case CXT5051_HP_DV6736: 1898 spec->init_verbs[0] = cxt5051_hp_dv6736_init_verbs; 1899 spec->mixers[0] = cxt5051_hp_dv6736_mixers; 1900 spec->no_auto_mic = 1; 1901 break; 1902 case CXT5051_LENOVO_X200: 1903 spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs; 1764 1904 break; 1765 1905 } … … 1772 1912 */ 1773 1913 1774 st ruct hda_codec_preset snd_hda_preset_conexant[] = {1914 static struct hda_codec_preset snd_hda_preset_conexant[] = { 1775 1915 { .id = 0x14f15045, .name = "CX20549 (Venice)", 1776 1916 .patch = patch_cxt5045 }, … … 1781 1921 {0} /* terminator */ 1782 1922 }; 1923 1924 MODULE_ALIAS("snd-hda-codec-id:14f15045"); 1925 MODULE_ALIAS("snd-hda-codec-id:14f15047"); 1926 MODULE_ALIAS("snd-hda-codec-id:14f15051"); 1927 1928 MODULE_LICENSE("GPL"); 1929 MODULE_DESCRIPTION("Conexant HD-audio codec"); 1930 1931 static struct hda_codec_preset_list conexant_list = { 1932 .preset = snd_hda_preset_conexant, 1933 .owner = THIS_MODULE, 1934 }; 1935 1936 static int __init patch_conexant_init(void) 1937 { 1938 return snd_hda_add_codec_preset(&conexant_list); 1939 } 1940 1941 static void __exit patch_conexant_exit(void) 1942 { 1943 snd_hda_delete_codec_preset(&conexant_list); 1944 } 1945 1946 module_init(patch_conexant_init) 1947 module_exit(patch_conexant_exit) -
GPL/trunk/alsa-kernel/pci/hda/patch_realtek.c
r417 r426 31 31 #include "hda_codec.h" 32 32 #include "hda_local.h" 33 #include "hda_ patch.h"33 #include "hda_beep.h" 34 34 35 35 #define ALC880_FRONT_EVENT 0x01 … … 79 79 ALC260_WILL, 80 80 ALC260_REPLACER_672V, 81 ALC260_FAVORIT100, 81 82 #ifdef CONFIG_SND_DEBUG 82 83 ALC260_TEST, … … 105 106 ALC262_TOSHIBA_S06, 106 107 ALC262_TOSHIBA_RX1, 108 ALC262_TYAN, 107 109 ALC262_AUTO, 108 110 ALC262_MODEL_LAST /* last tag */ … … 187 189 ALC663_ASUS_MODE5, 188 190 ALC663_ASUS_MODE6, 191 ALC272_DELL, 192 ALC272_DELL_ZM1, 189 193 ALC662_AUTO, 190 194 ALC662_MODEL_LAST, … … 217 221 ALC883_ACER, 218 222 ALC883_ACER_ASPIRE, 223 ALC888_ACER_ASPIRE_4930G, 219 224 ALC883_MEDION, 220 225 ALC883_MEDION_MD2, … … 230 235 ALC883_CLEVO_M720, 231 236 ALC883_FUJITSU_PI2515, 237 ALC888_FUJITSU_XA3530, 232 238 ALC883_3ST_6ch_INTEL, 233 239 ALC888_ASUS_M90V, 234 240 ALC888_ASUS_EEE1601, 241 ALC1200_ASUS_P5Q, 235 242 ALC883_AUTO, 236 243 ALC883_MODEL_LAST, 244 }; 245 246 /* styles of capture selection */ 247 enum { 248 CAPT_MUX = 0, /* only mux based */ 249 CAPT_MIX, /* only mixer based */ 250 CAPT_1MUX_MIX, /* first mux and other mixers */ 237 251 }; 238 252 … … 245 259 unsigned int num_mixers; 246 260 struct snd_kcontrol_new *cap_mixer; /* capture mixer */ 261 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ 247 262 248 263 const struct hda_verb *init_verbs[5]; /* initialization verbs … … 268 283 */ 269 284 hda_nid_t alt_dac_nid; 285 hda_nid_t slave_dig_outs[3]; /* optional - for auto-parsing */ 286 int dig_out_type; 270 287 271 288 /* capture */ … … 274 291 hda_nid_t *capsrc_nids; 275 292 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 276 unsigned char is_mix_capture; /* matrix-style capture (non-mux) */293 int capture_style; /* capture style (CAPT_*) */ 277 294 278 295 /* capture source */ … … 292 309 struct auto_pin_cfg autocfg; 293 310 struct snd_array kctls; 294 struct hda_input_mux private_imux ;311 struct hda_input_mux private_imux[3]; 295 312 hda_nid_t private_dac_nids[AUTO_CFG_MAX_OUTS]; 296 313 … … 303 320 unsigned int jack_present: 1; 304 321 unsigned int master_sw: 1; 322 323 /* other flags */ 324 unsigned int no_analog :1; /* digital I/O only */ 305 325 306 326 /* for virtual master */ … … 313 333 hda_nid_t pll_nid; 314 334 unsigned int pll_coef_idx, pll_coef_bit; 315 316 #ifdef SND_HDA_NEEDS_RESUME317 #define ALC_MAX_PINS 16318 unsigned int num_pins;319 hda_nid_t pin_nids[ALC_MAX_PINS];320 unsigned int pin_cfgs[ALC_MAX_PINS];321 #endif322 335 }; 323 336 … … 335 348 hda_nid_t dig_out_nid; /* optional */ 336 349 hda_nid_t hp_nid; /* optional */ 350 hda_nid_t *slave_dig_outs; 337 351 unsigned int num_adc_nids; 338 352 hda_nid_t *adc_nids; … … 382 396 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 383 397 struct alc_spec *spec = codec->spec; 384 const struct hda_input_mux *imux = spec->input_mux;398 const struct hda_input_mux *imux; 385 399 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 400 unsigned int mux_idx; 386 401 hda_nid_t nid = spec->capsrc_nids ? 387 402 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; 388 403 389 if (spec->is_mix_capture) { 404 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 405 imux = &spec->input_mux[mux_idx]; 406 407 if (spec->capture_style && 408 !(spec->capture_style == CAPT_1MUX_MIX && !adc_idx)) { 390 409 /* Matrix-mixer style (e.g. ALC882) */ 391 410 unsigned int *cur_val = &spec->cur_mux[adc_idx]; … … 407 426 } else { 408 427 /* MUX style (e.g. ALC880) */ 409 unsigned int mux_idx; 410 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 411 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], 412 ucontrol, nid, 428 return snd_hda_input_mux_put(codec, imux, ucontrol, nid, 413 429 &spec->cur_mux[adc_idx]); 414 430 } … … 748 764 749 765 /* 766 * set up the input pin config (depending on the given auto-pin type) 767 */ 768 static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid, 769 int auto_pin_type) 770 { 771 unsigned int val = PIN_IN; 772 773 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { 774 unsigned int pincap; 775 pincap = snd_hda_query_pin_caps(codec, nid); 776 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; 777 if (pincap & AC_PINCAP_VREF_80) 778 val = PIN_VREF80; 779 } 780 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, val); 781 } 782 783 /* 750 784 */ 751 785 static void add_mixer(struct alc_spec *spec, struct snd_kcontrol_new *mix) … … 762 796 spec->init_verbs[spec->num_init_verbs++] = verb; 763 797 } 798 799 #ifdef CONFIG_PROC_FS 800 /* 801 * hook for proc 802 */ 803 static void print_realtek_coef(struct snd_info_buffer *buffer, 804 struct hda_codec *codec, hda_nid_t nid) 805 { 806 int coeff; 807 808 if (nid != 0x20) 809 return; 810 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); 811 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); 812 coeff = snd_hda_codec_read(codec, nid, 0, 813 AC_VERB_GET_COEF_INDEX, 0); 814 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); 815 } 816 #else 817 #define print_realtek_coef NULL 818 #endif 764 819 765 820 /* … … 787 842 spec->multiout.dac_nids = preset->dac_nids; 788 843 spec->multiout.dig_out_nid = preset->dig_out_nid; 844 spec->multiout.slave_dig_outs = preset->slave_dig_outs; 789 845 spec->multiout.hp_nid = preset->hp_nid; 790 846 … … 898 954 } 899 955 #else 900 #define alc_mic_automute(codec) /* NOP */956 #define alc_mic_automute(codec) do {} while(0) /* NOP */ 901 957 #endif /* disabled */ 902 958 … … 929 985 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); 930 986 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_COEF_INDEX, 7); 931 if ((tmp & 0xf0) == 2)987 if ((tmp & 0xf0) == 0x20) 932 988 /* alc888S-VC */ 933 989 snd_hda_codec_read(codec, 0x20, 0, … … 968 1024 if (codec->vendor_id == 0x10ec0260) 969 1025 nid = 0x17; 970 ass = snd_hda_codec_read(codec, nid, 0, 971 AC_VERB_GET_CONFIG_DEFAULT, 0); 1026 ass = snd_hda_codec_get_pincfg(codec, nid); 972 1027 if (!(ass & 1) && !(ass & 0x100000)) 973 1028 return; … … 1014 1069 case 0x10ec0268: 1015 1070 case 0x10ec0269: 1071 case 0x10ec0272: 1016 1072 case 0x10ec0660: 1017 1073 case 0x10ec0662: … … 1042 1098 case 0x10ec0883: 1043 1099 case 0x10ec0885: 1100 case 0x10ec0887: 1044 1101 case 0x10ec0889: 1045 1102 snd_hda_codec_write(codec, 0x20, 0, … … 1141 1198 1142 1199 cfg = pinfix[quirk->value]; 1143 for (; cfg->nid; cfg++) { 1144 int i; 1145 u32 val = cfg->val; 1146 for (i = 0; i < 4; i++) { 1147 snd_hda_codec_write(codec, cfg->nid, 0, 1148 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i, 1149 val & 0xff); 1150 val >>= 8; 1151 } 1200 for (; cfg->nid; cfg++) 1201 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); 1202 } 1203 1204 /* 1205 * ALC888 1206 */ 1207 1208 /* 1209 * 2ch mode 1210 */ 1211 static struct hda_verb alc888_4ST_ch2_intel_init[] = { 1212 /* Mic-in jack as mic in */ 1213 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 1214 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 1215 /* Line-in jack as Line in */ 1216 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 1217 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 1218 /* Line-Out as Front */ 1219 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, 1220 {0} /* end */ 1221 }; 1222 1223 /* 1224 * 4ch mode 1225 */ 1226 static struct hda_verb alc888_4ST_ch4_intel_init[] = { 1227 /* Mic-in jack as mic in */ 1228 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 1229 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 1230 /* Line-in jack as Surround */ 1231 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 1232 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 1233 /* Line-Out as Front */ 1234 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00}, 1235 {0} /* end */ 1236 }; 1237 1238 /* 1239 * 6ch mode 1240 */ 1241 static struct hda_verb alc888_4ST_ch6_intel_init[] = { 1242 /* Mic-in jack as CLFE */ 1243 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 1244 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 1245 /* Line-in jack as Surround */ 1246 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 1247 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 1248 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */ 1249 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, 1250 {0} /* end */ 1251 }; 1252 1253 /* 1254 * 8ch mode 1255 */ 1256 static struct hda_verb alc888_4ST_ch8_intel_init[] = { 1257 /* Mic-in jack as CLFE */ 1258 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 1259 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 1260 /* Line-in jack as Surround */ 1261 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 1262 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 1263 /* Line-Out as Side */ 1264 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, 1265 {0} /* end */ 1266 }; 1267 1268 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = { 1269 { 2, alc888_4ST_ch2_intel_init }, 1270 { 4, alc888_4ST_ch4_intel_init }, 1271 { 6, alc888_4ST_ch6_intel_init }, 1272 { 8, alc888_4ST_ch8_intel_init }, 1273 }; 1274 1275 /* 1276 * ALC888 Fujitsu Siemens Amillo xa3530 1277 */ 1278 1279 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { 1280 /* Front Mic: set to PIN_IN (empty by default) */ 1281 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1282 /* Connect Internal HP to Front */ 1283 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1284 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1285 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 1286 /* Connect Bass HP to Front */ 1287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1288 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1289 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 1290 /* Connect Line-Out side jack (SPDIF) to Side */ 1291 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1292 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1293 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, 1294 /* Connect Mic jack to CLFE */ 1295 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1296 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1297 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, 1298 /* Connect Line-in jack to Surround */ 1299 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1300 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1301 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, 1302 /* Connect HP out jack to Front */ 1303 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1304 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1305 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 1306 /* Enable unsolicited event for HP jack and Line-out jack */ 1307 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 1308 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 1309 {0} 1310 }; 1311 1312 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec) 1313 { 1314 unsigned int present; 1315 unsigned int bits; 1316 /* Line out presence */ 1317 present = snd_hda_codec_read(codec, 0x17, 0, 1318 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1319 /* HP out presence */ 1320 present = present || snd_hda_codec_read(codec, 0x1b, 0, 1321 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1322 bits = present ? HDA_AMP_MUTE : 0; 1323 /* Toggle internal speakers muting */ 1324 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 1325 HDA_AMP_MUTE, bits); 1326 /* Toggle internal bass muting */ 1327 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 1328 HDA_AMP_MUTE, bits); 1329 } 1330 1331 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec, 1332 unsigned int res) 1333 { 1334 if (res >> 26 == ALC880_HP_EVENT) 1335 alc888_fujitsu_xa3530_automute(codec); 1336 } 1337 1338 1339 /* 1340 * ALC888 Acer Aspire 4930G model 1341 */ 1342 1343 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = { 1344 /* Front Mic: set to PIN_IN (empty by default) */ 1345 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1346 /* Unselect Front Mic by default in input mixer 3 */ 1347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)}, 1348 /* Enable unsolicited event for HP jack */ 1349 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 1350 /* Connect Internal HP to front */ 1351 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1352 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1353 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 1354 /* Connect HP out to front */ 1355 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1357 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 1358 {0} 1359 }; 1360 1361 static struct hda_input_mux alc888_2_capture_sources[2] = { 1362 /* Front mic only available on one ADC */ 1363 { 1364 .num_items = 4, 1365 .items = { 1366 { "Mic", 0x0 }, 1367 { "Line", 0x2 }, 1368 { "CD", 0x4 }, 1369 { "Front Mic", 0xb }, 1370 }, 1371 }, 1372 { 1373 .num_items = 3, 1374 .items = { 1375 { "Mic", 0x0 }, 1376 { "Line", 0x2 }, 1377 { "CD", 0x4 }, 1378 }, 1152 1379 } 1380 }; 1381 1382 static struct snd_kcontrol_new alc888_base_mixer[] = { 1383 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 1384 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 1385 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 1386 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 1387 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, 1388 HDA_OUTPUT), 1389 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 1390 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 1391 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 1392 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 1393 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 1394 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 1395 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 1396 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 1397 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 1398 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 1399 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 1400 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 1401 {0} /* end */ 1402 }; 1403 1404 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec) 1405 { 1406 unsigned int present; 1407 unsigned int bits; 1408 present = snd_hda_codec_read(codec, 0x15, 0, 1409 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1410 bits = present ? HDA_AMP_MUTE : 0; 1411 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 1412 HDA_AMP_MUTE, bits); 1413 } 1414 1415 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, 1416 unsigned int res) 1417 { 1418 if (res >> 26 == ALC880_HP_EVENT) 1419 alc888_acer_aspire_4930g_automute(codec); 1153 1420 } 1154 1421 … … 1238 1505 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), 1239 1506 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), 1240 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),1241 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),1242 1507 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), 1243 1508 { … … 1258 1523 int err; 1259 1524 1260 mutex_lock(&codec-> spdif_mutex); /* reuse spdif_mutex */1525 mutex_lock(&codec->control_mutex); 1261 1526 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, 1262 1527 HDA_INPUT); 1263 1528 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); 1264 mutex_unlock(&codec-> spdif_mutex); /* reuse spdif_mutex */1529 mutex_unlock(&codec->control_mutex); 1265 1530 return err; 1266 1531 } … … 1273 1538 int err; 1274 1539 1275 mutex_lock(&codec-> spdif_mutex); /* reuse spdif_mutex */1540 mutex_lock(&codec->control_mutex); 1276 1541 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, 1277 1542 HDA_INPUT); 1278 1543 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); 1279 mutex_unlock(&codec-> spdif_mutex); /* reuse spdif_mutex */1544 mutex_unlock(&codec->control_mutex); 1280 1545 return err; 1281 1546 } … … 1293 1558 int err; 1294 1559 1295 mutex_lock(&codec-> spdif_mutex); /* reuse spdif_mutex */1560 mutex_lock(&codec->control_mutex); 1296 1561 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], 1297 1562 3, 0, HDA_INPUT); 1298 1563 err = func(kcontrol, ucontrol); 1299 mutex_unlock(&codec-> spdif_mutex); /* reuse spdif_mutex */1564 mutex_unlock(&codec->control_mutex); 1300 1565 return err; 1301 1566 } … … 1332 1597 } 1333 1598 1334 #define DEFINE_CAPMIX(num) \ 1335 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ 1599 #define _DEFINE_CAPMIX(num) \ 1336 1600 { \ 1337 1601 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ … … 1354 1618 .put = alc_cap_vol_put, \ 1355 1619 .tlv = { .c = alc_cap_vol_tlv }, \ 1356 }, \ 1620 } 1621 1622 #define _DEFINE_CAPSRC(num) \ 1357 1623 { \ 1358 1624 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ … … 1363 1629 .get = alc_mux_enum_get, \ 1364 1630 .put = alc_mux_enum_put, \ 1365 }, \ 1366 {0} /* end */ \ 1631 } 1632 1633 #define DEFINE_CAPMIX(num) \ 1634 static struct snd_kcontrol_new alc_capture_mixer ## num[] = { \ 1635 _DEFINE_CAPMIX(num), \ 1636 _DEFINE_CAPSRC(num), \ 1637 {0} /* end */ \ 1638 } 1639 1640 #define DEFINE_CAPMIX_NOSRC(num) \ 1641 static struct snd_kcontrol_new alc_capture_mixer_nosrc ## num[] = { \ 1642 _DEFINE_CAPMIX(num), \ 1643 {0} /* end */ \ 1367 1644 } 1368 1645 … … 1371 1648 DEFINE_CAPMIX(2); 1372 1649 DEFINE_CAPMIX(3); 1373 1650 DEFINE_CAPMIX_NOSRC(1); 1651 DEFINE_CAPMIX_NOSRC(2); 1652 DEFINE_CAPMIX_NOSRC(3); 1374 1653 1375 1654 … … 1461 1740 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 1462 1741 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 1463 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),1464 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),1465 1742 { 1466 1743 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 1639 1916 }; 1640 1917 1641 /* additional mixers to alc880_asus_mixer */1642 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = {1643 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),1644 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),1645 {0} /* end */1646 };1647 1648 1918 /* TCL S700 */ 1649 1919 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { … … 1678 1948 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 1679 1949 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 1680 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),1681 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),1682 1950 { 1683 1951 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 1754 2022 static void alc_free_kctls(struct hda_codec *codec); 1755 2023 2024 /* additional beep mixers; the actual parameters are overwritten at build */ 2025 static struct snd_kcontrol_new alc_beep_mixer[] = { 2026 HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_INPUT), 2027 HDA_CODEC_MUTE("Beep Playback Switch", 0, 0, HDA_INPUT), 2028 {0} /* end */ 2029 }; 2030 1756 2031 static int alc_build_controls(struct hda_codec *codec) 1757 2032 { … … 1775 2050 if (err < 0) 1776 2051 return err; 1777 err = snd_hda_create_spdif_share_sw(codec, 1778 &spec->multiout); 1779 if (err < 0) 1780 return err; 1781 spec->multiout.share_spdif = 1; 2052 if (!spec->no_analog) { 2053 err = snd_hda_create_spdif_share_sw(codec, 2054 &spec->multiout); 2055 if (err < 0) 2056 return err; 2057 spec->multiout.share_spdif = 1; 2058 } 1782 2059 } 1783 2060 if (spec->dig_in_nid) { … … 1787 2064 } 1788 2065 2066 /* create beep controls if needed */ 2067 if (spec->beep_amp) { 2068 struct snd_kcontrol_new *knew; 2069 for (knew = alc_beep_mixer; knew->name; knew++) { 2070 struct snd_kcontrol *kctl; 2071 kctl = snd_ctl_new1(knew, codec); 2072 if (!kctl) 2073 return -ENOMEM; 2074 kctl->private_value = spec->beep_amp; 2075 err = snd_hda_ctl_add(codec, kctl); 2076 if (err < 0) 2077 return err; 2078 } 2079 } 2080 1789 2081 /* if we have no master control, let's create it */ 1790 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { 2082 if (!spec->no_analog && 2083 !snd_hda_find_mixer_ctl(codec, "Master Playback Volume")) { 1791 2084 unsigned int vmaster_tlv[4]; 1792 2085 snd_hda_set_vmaster_tlv(codec, spec->vmaster_nid, … … 1797 2090 return err; 1798 2091 } 1799 if (!snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { 2092 if (!spec->no_analog && 2093 !snd_hda_find_mixer_ctl(codec, "Master Playback Switch")) { 1800 2094 err = snd_hda_add_vmaster(codec, "Master Playback Switch", 1801 2095 NULL, alc_slave_sws); … … 2706 3000 } 2707 3001 3002 static int alc880_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, 3003 struct hda_codec *codec, 3004 struct snd_pcm_substream *substream) 3005 { 3006 struct alc_spec *spec = codec->spec; 3007 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); 3008 } 3009 2708 3010 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, 2709 3011 struct hda_codec *codec, … … 2789 3091 .open = alc880_dig_playback_pcm_open, 2790 3092 .close = alc880_dig_playback_pcm_close, 2791 .prepare = alc880_dig_playback_pcm_prepare 3093 .prepare = alc880_dig_playback_pcm_prepare, 3094 .cleanup = alc880_dig_playback_pcm_cleanup 2792 3095 }, 2793 3096 }; … … 2815 3118 codec->num_pcms = 1; 2816 3119 codec->pcm_info = info; 3120 3121 if (spec->no_analog) 3122 goto skip_analog; 2817 3123 2818 3124 info->name = spec->stream_name_analog; … … 2839 3145 } 2840 3146 3147 skip_analog: 2841 3148 /* SPDIF for stream index #1 */ 2842 3149 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 2843 3150 codec->num_pcms = 2; 3151 codec->slave_dig_outs = spec->multiout.slave_dig_outs; 2844 3152 info = spec->pcm_rec + 1; 2845 3153 info->name = spec->stream_name_digital; 2846 info->pcm_type = HDA_PCM_TYPE_SPDIF; 3154 if (spec->dig_out_type) 3155 info->pcm_type = spec->dig_out_type; 3156 else 3157 info->pcm_type = HDA_PCM_TYPE_SPDIF; 2847 3158 if (spec->multiout.dig_out_nid && 2848 3159 spec->stream_digital_playback) { … … 2858 3169 codec->spdif_status_reset = 1; 2859 3170 } 3171 3172 if (spec->no_analog) 3173 return 0; 2860 3174 2861 3175 /* If the use of more than one ADC is requested for the current … … 2917 3231 alc_free_kctls(codec); 2918 3232 kfree(spec); 2919 codec->spec = NULL; /* to be sure */3233 snd_hda_detach_beep_device(codec); 2920 3234 } 2921 3235 2922 3236 #ifdef SND_HDA_NEEDS_RESUME 2923 static void store_pin_configs(struct hda_codec *codec)2924 {2925 struct alc_spec *spec = codec->spec;2926 hda_nid_t nid, end_nid;2927 2928 end_nid = codec->start_nid + codec->num_nodes;2929 for (nid = codec->start_nid; nid < end_nid; nid++) {2930 unsigned int wid_caps = get_wcaps(codec, nid);2931 unsigned int wid_type =2932 (wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;2933 if (wid_type != AC_WID_PIN)2934 continue;2935 if (spec->num_pins >= ARRAY_SIZE(spec->pin_nids))2936 break;2937 spec->pin_nids[spec->num_pins] = nid;2938 spec->pin_cfgs[spec->num_pins] =2939 snd_hda_codec_read(codec, nid, 0,2940 AC_VERB_GET_CONFIG_DEFAULT, 0);2941 spec->num_pins++;2942 }2943 }2944 2945 static void resume_pin_configs(struct hda_codec *codec)2946 {2947 struct alc_spec *spec = codec->spec;2948 int i;2949 2950 for (i = 0; i < spec->num_pins; i++) {2951 hda_nid_t pin_nid = spec->pin_nids[i];2952 unsigned int pin_config = spec->pin_cfgs[i];2953 snd_hda_codec_write(codec, pin_nid, 0,2954 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,2955 pin_config & 0x000000ff);2956 snd_hda_codec_write(codec, pin_nid, 0,2957 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,2958 (pin_config & 0x0000ff00) >> 8);2959 snd_hda_codec_write(codec, pin_nid, 0,2960 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,2961 (pin_config & 0x00ff0000) >> 16);2962 snd_hda_codec_write(codec, pin_nid, 0,2963 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,2964 pin_config >> 24);2965 }2966 }2967 2968 3237 static int alc_resume(struct hda_codec *codec) 2969 3238 { 2970 resume_pin_configs(codec);2971 3239 codec->patch_ops.init(codec); 2972 3240 snd_hda_codec_resume_amp(codec); … … 2974 3242 return 0; 2975 3243 } 2976 #else2977 #define store_pin_configs(codec)2978 3244 #endif 2979 3245 … … 3314 3580 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), 3315 3581 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), 3316 SND_PCI_QUIRK (0x1043, 0, "ASUS", ALC880_ASUS), /* default ASUS */3582 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS", ALC880_ASUS), /* default ASUS */ 3317 3583 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), 3318 3584 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), … … 3357 3623 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), 3358 3624 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), 3359 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), /* default Intel */ 3625 /* default Intel */ 3626 SND_PCI_QUIRK_VENDOR(0x8086, "Intel mobo", ALC880_3ST), 3360 3627 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), 3361 3628 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), … … 3537 3804 }, 3538 3805 [ALC880_UNIWILL_DIG] = { 3539 .mixers = { alc880_asus_mixer , alc880_pcbeep_mixer},3806 .mixers = { alc880_asus_mixer }, 3540 3807 .init_verbs = { alc880_volume_init_verbs, 3541 3808 alc880_pin_asus_init_verbs }, … … 3575 3842 }, 3576 3843 [ALC880_FUJITSU] = { 3577 .mixers = { alc880_fujitsu_mixer, 3578 alc880_pcbeep_mixer, }, 3844 .mixers = { alc880_fujitsu_mixer }, 3579 3845 .init_verbs = { alc880_volume_init_verbs, 3580 3846 alc880_uniwill_p53_init_verbs, … … 3869 4135 const struct auto_pin_cfg *cfg) 3870 4136 { 3871 struct hda_input_mux *imux = &spec->private_imux ;4137 struct hda_input_mux *imux = &spec->private_imux[0]; 3872 4138 int i, err, idx; 3873 4139 … … 3957 4223 hda_nid_t nid = spec->autocfg.input_pins[i]; 3958 4224 if (alc880_is_input_pin(nid)) { 3959 snd_hda_codec_write(codec, nid, 0, 3960 AC_VERB_SET_PIN_WIDGET_CONTROL, 3961 i <= AUTO_PIN_FRONT_MIC ? 3962 PIN_VREF80 : PIN_IN); 3963 if (nid != ALC880_PIN_CD_NID) 4225 alc_set_input_pin(codec, nid, i); 4226 if (nid != ALC880_PIN_CD_NID && 4227 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) 3964 4228 snd_hda_codec_write(codec, nid, 0, 3965 4229 AC_VERB_SET_AMP_GAIN_MUTE, … … 3976 4240 { 3977 4241 struct alc_spec *spec = codec->spec; 3978 int err;4242 int i, err; 3979 4243 static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; 3980 4244 … … 4007 4271 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 4008 4272 4009 if (spec->autocfg.dig_out_pin) 4010 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; 4273 /* check multiple SPDIF-out (for recent codecs) */ 4274 for (i = 0; i < spec->autocfg.dig_outs; i++) { 4275 hda_nid_t dig_nid; 4276 err = snd_hda_get_connections(codec, 4277 spec->autocfg.dig_out_pins[i], 4278 &dig_nid, 1); 4279 if (err < 0) 4280 continue; 4281 if (!i) 4282 spec->multiout.dig_out_nid = dig_nid; 4283 else { 4284 spec->multiout.slave_dig_outs = spec->slave_dig_outs; 4285 spec->slave_dig_outs[i - 1] = dig_nid; 4286 if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) 4287 break; 4288 } 4289 } 4011 4290 if (spec->autocfg.dig_in_pin) 4012 4291 spec->dig_in_nid = ALC880_DIGIN_NID; … … 4018 4297 4019 4298 spec->num_mux_defs = 1; 4020 spec->input_mux = &spec->private_imux; 4021 4022 store_pin_configs(codec); 4299 spec->input_mux = &spec->private_imux[0]; 4300 4023 4301 return 1; 4024 4302 } … … 4035 4313 } 4036 4314 4315 static void set_capture_mixer(struct alc_spec *spec) 4316 { 4317 static struct snd_kcontrol_new *caps[2][3] = { 4318 { alc_capture_mixer_nosrc1, 4319 alc_capture_mixer_nosrc2, 4320 alc_capture_mixer_nosrc3 }, 4321 { alc_capture_mixer1, 4322 alc_capture_mixer2, 4323 alc_capture_mixer3 }, 4324 }; 4325 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { 4326 int mux; 4327 if (spec->input_mux && spec->input_mux->num_items > 1) 4328 mux = 1; 4329 else 4330 mux = 0; 4331 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; 4332 } 4333 } 4334 4335 #define set_beep_amp(spec, nid, idx, dir) \ 4336 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 3, idx, dir)) 4337 4037 4338 /* 4038 4339 * OK, here we have finally the patch for ALC880 4039 4340 */ 4040 4041 static void set_capture_mixer(struct alc_spec *spec)4042 {4043 static struct snd_kcontrol_new *caps[3] = {4044 alc_capture_mixer1,4045 alc_capture_mixer2,4046 alc_capture_mixer3,4047 };4048 if (spec->num_adc_nids > 0 && spec->num_adc_nids < 3)4049 spec->cap_mixer = caps[spec->num_adc_nids - 1];4050 }4051 4341 4052 4342 static int patch_alc880(struct hda_codec *codec) … … 4083 4373 board_config = ALC880_3ST; 4084 4374 } 4375 } 4376 4377 err = snd_hda_attach_beep_device(codec, 0x1); 4378 if (err < 0) { 4379 alc_free(codec); 4380 return err; 4085 4381 } 4086 4382 … … 4111 4407 } 4112 4408 set_capture_mixer(spec); 4409 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 4113 4410 4114 4411 spec->vmaster_nid = 0x0c; … … 4121 4418 spec->loopback.amplist = alc880_loopbacks; 4122 4419 #endif 4420 codec->proc_widget_hook = print_realtek_coef; 4123 4421 4124 4422 return 0; … … 4217 4515 }, 4218 4516 }; 4517 4518 /* Maxdata Favorit 100XS */ 4519 static struct hda_input_mux alc260_favorit100_capture_sources[2] = { 4520 { 4521 .num_items = 2, 4522 .items = { 4523 { "Line/Mic", 0x0 }, 4524 { "CD", 0x4 }, 4525 }, 4526 }, 4527 { 4528 .num_items = 3, 4529 .items = { 4530 { "Line/Mic", 0x0 }, 4531 { "CD", 0x4 }, 4532 { "Mixer", 0x5 }, 4533 }, 4534 }, 4535 }; 4536 4219 4537 /* 4220 4538 * This is just place-holder, so there's something for alc_build_pcms to look … … 4256 4574 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), 4257 4575 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), 4258 {0} /* end */4259 };4260 4261 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = {4262 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT),4263 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT),4264 4576 {0} /* end */ 4265 4577 }; … … 4456 4768 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), 4457 4769 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), 4458 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),4459 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),4460 4770 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), 4461 4771 HDA_BIND_MUTE("Speaker Playback Switch", 0x09, 2, HDA_INPUT), … … 4502 4812 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), 4503 4813 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), 4504 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 4505 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 4814 {0} /* end */ 4815 }; 4816 4817 /* Maxdata Favorit 100XS: one output and one input (0x12) jack 4818 */ 4819 static struct snd_kcontrol_new alc260_favorit100_mixer[] = { 4820 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), 4821 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), 4822 ALC_PIN_MODE("Output Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), 4823 HDA_CODEC_VOLUME("Line/Mic Playback Volume", 0x07, 0x0, HDA_INPUT), 4824 HDA_CODEC_MUTE("Line/Mic Playback Switch", 0x07, 0x0, HDA_INPUT), 4825 ALC_PIN_MODE("Line/Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), 4506 4826 {0} /* end */ 4507 4827 }; … … 4521 4841 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 4522 4842 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 4523 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),4524 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),4525 4843 {0} /* end */ 4526 4844 }; … … 4880 5198 }; 4881 5199 5200 /* Initialisation sequence for Maxdata Favorit 100XS 5201 * (adapted from Acer init verbs). 5202 */ 5203 static struct hda_verb alc260_favorit100_init_verbs[] = { 5204 /* GPIO 0 enables the output jack. 5205 * Turn this on and rely on the standard mute 5206 * methods whenever the user wants to turn these outputs off. 5207 */ 5208 {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, 5209 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, 5210 {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, 5211 /* Line/Mic input jack is connected to Mic1 pin */ 5212 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, 5213 /* Ensure all other unused pins are disabled and muted. */ 5214 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 5215 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5216 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 5217 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5218 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 5219 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5220 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 5221 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5222 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 5223 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5224 /* Disable digital (SPDIF) pins */ 5225 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 5226 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 5227 5228 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum 5229 * bus when acting as outputs. 5230 */ 5231 {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, 5232 {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, 5233 5234 /* Start with output sum widgets muted and their output gains at min */ 5235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5236 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 5237 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5238 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5239 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 5240 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5241 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5242 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 5243 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5244 5245 /* Unmute Line-out pin widget amp left and right 5246 * (no equiv mixer ctrl) 5247 */ 5248 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5249 /* Unmute Mic1 and Line1 pin widget input buffers since they start as 5250 * inputs. If the pin mode is changed by the user the pin mode control 5251 * will take care of enabling the pin's input/output buffers as needed. 5252 * Therefore there's no need to enable the input buffer at this 5253 * stage. 5254 */ 5255 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5256 5257 /* Mute capture amp left and right */ 5258 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5259 /* Set ADC connection select to match default mixer setting - mic 5260 * (on mic1 pin) 5261 */ 5262 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, 5263 5264 /* Do similar with the second ADC: mute capture input amp and 5265 * set ADC connection to mic to match ALSA's default state. 5266 */ 5267 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5268 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, 5269 5270 /* Mute all inputs to mixer widget (even unconnected ones) */ 5271 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ 5272 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ 5273 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ 5274 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ 5275 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ 5276 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ 5277 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ 5278 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ 5279 5280 {0} 5281 }; 5282 4882 5283 static struct hda_verb alc260_will_verbs[] = { 4883 5284 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, … … 5026 5427 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 5027 5428 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 5028 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT),5029 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT),5030 5429 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), 5031 5430 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), … … 5225 5624 const struct auto_pin_cfg *cfg) 5226 5625 { 5227 struct hda_input_mux *imux = &spec->private_imux ;5626 struct hda_input_mux *imux = &spec->private_imux[0]; 5228 5627 int i, err, idx; 5229 5628 … … 5300 5699 hda_nid_t nid = spec->autocfg.input_pins[i]; 5301 5700 if (nid >= 0x12) { 5302 snd_hda_codec_write(codec, nid, 0, 5303 AC_VERB_SET_PIN_WIDGET_CONTROL, 5304 i <= AUTO_PIN_FRONT_MIC ? 5305 PIN_VREF80 : PIN_IN); 5306 if (nid != ALC260_PIN_CD_NID) 5701 alc_set_input_pin(codec, nid, i); 5702 if (nid != ALC260_PIN_CD_NID && 5703 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) 5307 5704 snd_hda_codec_write(codec, nid, 0, 5308 5705 AC_VERB_SET_AMP_GAIN_MUTE, … … 5377 5774 spec->multiout.max_channels = 2; 5378 5775 5379 if (spec->autocfg.dig_out _pin)5776 if (spec->autocfg.dig_outs) 5380 5777 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; 5381 5778 if (spec->kctls.list) … … 5385 5782 5386 5783 spec->num_mux_defs = 1; 5387 spec->input_mux = &spec->private_imux; 5388 5389 store_pin_configs(codec); 5784 spec->input_mux = &spec->private_imux[0]; 5785 5390 5786 return 1; 5391 5787 } … … 5424 5820 [ALC260_WILL] = "will", 5425 5821 [ALC260_REPLACER_672V] = "replacer", 5822 [ALC260_FAVORIT100] = "favorit100", 5426 5823 #ifdef CONFIG_SND_DEBUG 5427 5824 [ALC260_TEST] = "test", … … 5433 5830 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), 5434 5831 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), 5832 SND_PCI_QUIRK(0x1509, 0x4540, "Favorit 100XS", ALC260_FAVORIT100), 5435 5833 SND_PCI_QUIRK(0x103c, 0x2808, "HP d5700", ALC260_HP_3013), 5436 5834 SND_PCI_QUIRK(0x103c, 0x280a, "HP d5750", ALC260_HP_3013), … … 5455 5853 [ALC260_BASIC] = { 5456 5854 .mixers = { alc260_base_output_mixer, 5457 alc260_input_mixer, 5458 alc260_pc_beep_mixer }, 5855 alc260_input_mixer }, 5459 5856 .init_verbs = { alc260_init_verbs }, 5460 5857 .num_dacs = ARRAY_SIZE(alc260_dac_nids), … … 5535 5932 .input_mux = alc260_acer_capture_sources, 5536 5933 }, 5934 [ALC260_FAVORIT100] = { 5935 .mixers = { alc260_favorit100_mixer }, 5936 .init_verbs = { alc260_favorit100_init_verbs }, 5937 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 5938 .dac_nids = alc260_dac_nids, 5939 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), 5940 .adc_nids = alc260_dual_adc_nids, 5941 .num_channel_mode = ARRAY_SIZE(alc260_modes), 5942 .channel_mode = alc260_modes, 5943 .num_mux_defs = ARRAY_SIZE(alc260_favorit100_capture_sources), 5944 .input_mux = alc260_favorit100_capture_sources, 5945 }, 5537 5946 [ALC260_WILL] = { 5538 5947 .mixers = { alc260_will_mixer }, … … 5609 6018 board_config = ALC260_BASIC; 5610 6019 } 6020 } 6021 6022 err = snd_hda_attach_beep_device(codec, 0x1); 6023 if (err < 0) { 6024 alc_free(codec); 6025 return err; 5611 6026 } 5612 6027 … … 5636 6051 } 5637 6052 set_capture_mixer(spec); 6053 set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); 5638 6054 5639 6055 spec->vmaster_nid = 0x08; … … 5646 6062 spec->loopback.amplist = alc260_loopbacks; 5647 6063 #endif 6064 codec->proc_widget_hook = print_realtek_coef; 5648 6065 5649 6066 return 0; … … 5806 6223 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 5807 6224 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 5808 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),5809 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),5810 6225 {0} /* end */ 5811 6226 }; … … 5834 6249 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 5835 6250 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5836 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),5837 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),5838 6251 {0} /* end */ 5839 6252 }; … … 5887 6300 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 5888 6301 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5889 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),5890 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),5891 6302 {0} /* end */ 5892 6303 }; … … 5997 6408 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), 5998 6409 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), 6410 /* FIXME: this looks suspicious... 5999 6411 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), 6000 6412 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), 6413 */ 6001 6414 {0} /* end */ 6002 6415 }; … … 6630 7043 for (i = 0; i < AUTO_PIN_LAST; i++) { 6631 7044 hda_nid_t nid = spec->autocfg.input_pins[i]; 6632 unsigned int vref;6633 7045 if (!nid) 6634 7046 continue; 6635 vref = PIN_IN; 6636 if (1 /*i <= AUTO_PIN_FRONT_MIC*/) { 6637 unsigned int pincap; 6638 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 6639 if ((pincap >> AC_PINCAP_VREF_SHIFT) & 6640 AC_PINCAP_VREF_80) 6641 vref = PIN_VREF80; 6642 } 6643 snd_hda_codec_write(codec, nid, 0, 6644 AC_VERB_SET_PIN_WIDGET_CONTROL, vref); 7047 alc_set_input_pin(codec, nid, AUTO_PIN_FRONT_MIC /*i*/); 6645 7048 if (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) 6646 7049 snd_hda_codec_write(codec, nid, 0, … … 6653 7056 { 6654 7057 struct alc_spec *spec = codec->spec; 6655 const struct hda_input_mux *imux = spec->input_mux;6656 7058 int c; 6657 7059 … … 6659 7061 hda_nid_t conn_list[HDA_MAX_NUM_INPUTS]; 6660 7062 hda_nid_t nid = spec->capsrc_nids[c]; 7063 unsigned int mux_idx; 7064 const struct hda_input_mux *imux; 6661 7065 int conns, mute, idx, item; 6662 7066 … … 6665 7069 if (conns < 0) 6666 7070 continue; 7071 mux_idx = c >= spec->num_mux_defs ? 0 : c; 7072 imux = &spec->input_mux[mux_idx]; 6667 7073 for (idx = 0; idx < conns; idx++) { 6668 7074 /* if the current connection is the selected one, … … 6677 7083 } 6678 7084 } 6679 snd_hda_codec_write(codec, nid, 0, 6680 AC_VERB_SET_AMP_GAIN_MUTE, mute); 7085 /* check if we have a selector or mixer 7086 * we could check for the widget type instead, but 7087 * just check for Amp-In presence (in case of mixer 7088 * without amp-in there is something wrong, this 7089 * function shouldn't be used or capsrc nid is wrong) 7090 */ 7091 if (get_wcaps(codec, nid) & AC_WCAP_IN_AMP) 7092 snd_hda_codec_write(codec, nid, 0, 7093 AC_VERB_SET_AMP_GAIN_MUTE, 7094 mute); 7095 else if (mute != AMP_IN_MUTE(idx)) 7096 snd_hda_codec_write(codec, nid, 0, 7097 AC_VERB_SET_CONNECT_SEL, 7098 idx); 6681 7099 } 6682 7100 } … … 6767 7185 case 0x106b1000: /* iMac 24 */ 6768 7186 case 0x106b2800: /* AppleTV */ 7187 case 0x106b3e00: /* iMac 24 Aluminium */ 6769 7188 board_config = ALC885_IMAC24; 6770 7189 break; 7190 case 0x106b00a0: /* MacBookPro3,1 - Another revision */ 6771 7191 case 0x106b00a1: /* Macbook (might be wrong - PCI SSID?) */ 6772 7192 case 0x106b00a4: /* MacbookPro4,1 */ 6773 7193 case 0x106b2c00: /* Macbook Pro rev3 */ 6774 7194 case 0x106b3600: /* Macbook 3.1 */ 7195 case 0x106b3800: /* MacbookPro4,1 - latter revision */ 6775 7196 board_config = ALC885_MBP3; 6776 7197 break; … … 6804 7225 } 6805 7226 7227 err = snd_hda_attach_beep_device(codec, 0x1); 7228 if (err < 0) { 7229 alc_free(codec); 7230 return err; 7231 } 7232 6806 7233 if (board_config != ALC882_AUTO) 6807 7234 setup_preset(spec, &alc882_presets[board_config]); … … 6824 7251 spec->stream_digital_capture = &alc882_pcm_digital_capture; 6825 7252 6826 spec-> is_mix_capture = 1; /* matrix-style capture */7253 spec->capture_style = CAPT_MIX; /* matrix-style capture */ 6827 7254 if (!spec->adc_nids && spec->input_mux) { 6828 7255 /* check whether NID 0x07 is valid */ … … 6841 7268 } 6842 7269 set_capture_mixer(spec); 7270 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 6843 7271 6844 7272 spec->vmaster_nid = 0x0c; … … 6851 7279 spec->loopback.amplist = alc882_loopbacks; 6852 7280 #endif 7281 codec->proc_widget_hook = print_realtek_coef; 6853 7282 6854 7283 return 0; … … 6869 7298 #define ALC883_DIGIN_NID 0x0a 6870 7299 7300 #define ALC1200_DIGOUT_NID 0x10 7301 6871 7302 static hda_nid_t alc883_dac_nids[4] = { 6872 7303 /* front, rear, clfe, rear_surr */ … … 6884 7315 }; 6885 7316 7317 static hda_nid_t alc883_adc_nids_rev[2] = { 7318 /* ADC2-1 */ 7319 0x09, 0x08 7320 }; 7321 7322 #define alc889_adc_nids alc880_adc_nids 7323 6886 7324 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; 7325 7326 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 }; 7327 7328 #define alc889_capsrc_nids alc882_capsrc_nids 6887 7329 6888 7330 /* input MUX */ … … 7103 7545 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 7104 7546 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 7105 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),7106 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),7107 7547 {0} /* end */ 7108 7548 }; … … 7167 7607 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 7168 7608 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 7169 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),7170 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),7171 7609 {0} /* end */ 7172 7610 }; … … 7192 7630 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 7193 7631 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 7194 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),7195 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),7196 7632 {0} /* end */ 7197 7633 }; … … 7218 7654 HDA_CODEC_VOLUME("Front Mic Boost", 0x18, 0, HDA_INPUT), 7219 7655 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 7220 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),7221 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),7222 7656 {0} /* end */ 7223 7657 }; … … 7243 7677 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 7244 7678 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 7245 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),7246 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),7247 7679 {0} /* end */ 7248 7680 }; … … 7652 8084 }; 7653 8085 8086 static struct hda_verb alc888_6st_dell_verbs[] = { 8087 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 8088 {0} 8089 }; 8090 8091 static void alc888_3st_hp_front_automute(struct hda_codec *codec) 8092 { 8093 unsigned int present, bits; 8094 8095 present = snd_hda_codec_read(codec, 0x1b, 0, 8096 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 8097 bits = present ? HDA_AMP_MUTE : 0; 8098 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 8099 HDA_AMP_MUTE, bits); 8100 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, 8101 HDA_AMP_MUTE, bits); 8102 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, 8103 HDA_AMP_MUTE, bits); 8104 } 8105 8106 static void alc888_3st_hp_unsol_event(struct hda_codec *codec, 8107 unsigned int res) 8108 { 8109 switch (res >> 26) { 8110 case ALC880_HP_EVENT: 8111 alc888_3st_hp_front_automute(codec); 8112 break; 8113 } 8114 } 8115 7654 8116 static struct hda_verb alc888_3st_hp_verbs[] = { 7655 8117 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */ 7656 8118 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */ 7657 8119 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */ 7658 {0}7659 };7660 7661 static struct hda_verb alc888_6st_dell_verbs[] = {7662 8120 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 7663 {0} 7664 }; 7665 8121 {0} /* end */ 8122 }; 8123 8124 /* 8125 * 2ch mode 8126 */ 7666 8127 static struct hda_verb alc888_3st_hp_2ch_init[] = { 7667 8128 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, … … 7669 8130 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 7670 8131 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 7671 {0} 7672 }; 7673 8132 {0} /* end */ 8133 }; 8134 8135 /* 8136 * 4ch mode 8137 */ 8138 static struct hda_verb alc888_3st_hp_4ch_init[] = { 8139 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 8140 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 8141 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 8142 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 8143 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, 8144 {0} /* end */ 8145 }; 8146 8147 /* 8148 * 6ch mode 8149 */ 7674 8150 static struct hda_verb alc888_3st_hp_6ch_init[] = { 7675 8151 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7676 8152 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 8153 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, 7677 8154 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 7678 8155 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 7679 {0} 7680 }; 7681 7682 static struct hda_channel_mode alc888_3st_hp_modes[2] = { 8156 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 }, 8157 {0} /* end */ 8158 }; 8159 8160 static struct hda_channel_mode alc888_3st_hp_modes[3] = { 7683 8161 { 2, alc888_3st_hp_2ch_init }, 8162 { 4, alc888_3st_hp_4ch_init }, 7684 8163 { 6, alc888_3st_hp_6ch_init }, 7685 8164 }; … … 7942 8421 switch (res >> 26) { 7943 8422 case ALC880_HP_EVENT: 7944 printk("hp_event\n");8423 /* printk(KERN_DEBUG "hp_event\n"); */ 7945 8424 alc888_6st_dell_front_automute(codec); 7946 8425 break; … … 8177 8656 [ALC883_ACER] = "acer", 8178 8657 [ALC883_ACER_ASPIRE] = "acer-aspire", 8658 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g", 8179 8659 [ALC883_MEDION] = "medion", 8180 8660 [ALC883_MEDION_MD2] = "medion-md2", … … 8190 8670 [ALC883_CLEVO_M720] = "clevo-m720", 8191 8671 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", 8672 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530", 8192 8673 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", 8674 [ALC1200_ASUS_P5Q] = "asus-p5q", 8193 8675 [ALC883_AUTO] = "auto", 8194 8676 }; … … 8198 8680 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE), 8199 8681 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE), 8682 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE), 8200 8683 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE), 8201 8684 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), 8202 8685 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), 8203 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ 8686 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", 8687 ALC888_ACER_ASPIRE_4930G), 8688 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G", 8689 ALC888_ACER_ASPIRE_4930G), 8690 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC883_AUTO), 8691 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC883_AUTO), 8692 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G", 8693 ALC888_ACER_ASPIRE_4930G), 8694 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G", 8695 ALC888_ACER_ASPIRE_4930G), 8696 /* default Acer */ 8697 SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), 8204 8698 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), 8205 8699 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG), … … 8207 8701 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 8208 8702 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), 8703 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP), 8704 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP), 8209 8705 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), 8210 8706 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 8707 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG), 8708 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q), 8211 8709 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), 8212 8710 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), 8213 8711 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), 8712 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC), 8214 8713 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), 8215 8714 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), … … 8235 8734 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), 8236 8735 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), 8736 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG), 8237 8737 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), 8238 8738 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), … … 8242 8742 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720), 8243 8743 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720), 8244 SND_PCI_QUIRK (0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD),8744 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD), 8245 8745 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch), 8246 8746 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 8247 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), 8747 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx", 8748 ALC883_FUJITSU_PI2515), 8749 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx", 8750 ALC888_FUJITSU_XA3530), 8248 8751 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), 8249 8752 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), … … 8257 8760 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), 8258 8761 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), 8762 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC), 8763 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL), 8259 8764 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), 8260 8765 {0} 8766 }; 8767 8768 static hda_nid_t alc883_slave_dig_outs[] = { 8769 ALC1200_DIGOUT_NID, 0, 8770 }; 8771 8772 static hda_nid_t alc1200_slave_dig_outs[] = { 8773 ALC883_DIGOUT_NID, 0, 8261 8774 }; 8262 8775 … … 8302 8815 .dig_out_nid = ALC883_DIGOUT_NID, 8303 8816 .dig_in_nid = ALC883_DIGIN_NID, 8817 .slave_dig_outs = alc883_slave_dig_outs, 8304 8818 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes), 8305 8819 .channel_mode = alc883_3ST_6ch_intel_modes, … … 8371 8885 .init_hook = alc883_acer_aspire_automute, 8372 8886 }, 8887 [ALC888_ACER_ASPIRE_4930G] = { 8888 .mixers = { alc888_base_mixer, 8889 alc883_chmode_mixer }, 8890 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 8891 alc888_acer_aspire_4930g_verbs }, 8892 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 8893 .dac_nids = alc883_dac_nids, 8894 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), 8895 .adc_nids = alc883_adc_nids_rev, 8896 .capsrc_nids = alc883_capsrc_nids_rev, 8897 .dig_out_nid = ALC883_DIGOUT_NID, 8898 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 8899 .channel_mode = alc883_3ST_6ch_modes, 8900 .need_dac_fix = 1, 8901 .num_mux_defs = 8902 ARRAY_SIZE(alc888_2_capture_sources), 8903 .input_mux = alc888_2_capture_sources, 8904 .unsol_event = alc888_acer_aspire_4930g_unsol_event, 8905 .init_hook = alc888_acer_aspire_4930g_automute, 8906 }, 8373 8907 [ALC883_MEDION] = { 8374 8908 .mixers = { alc883_fivestack_mixer, … … 8476 9010 .need_dac_fix = 1, 8477 9011 .input_mux = &alc883_capture_source, 9012 .unsol_event = alc888_3st_hp_unsol_event, 9013 .init_hook = alc888_3st_hp_front_automute, 8478 9014 }, 8479 9015 [ALC888_6ST_DELL] = { … … 8513 9049 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, 8514 9050 .init_hook = alc883_2ch_fujitsu_pi2515_automute, 9051 }, 9052 [ALC888_FUJITSU_XA3530] = { 9053 .mixers = { alc888_base_mixer, alc883_chmode_mixer }, 9054 .init_verbs = { alc883_init_verbs, 9055 alc888_fujitsu_xa3530_verbs }, 9056 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9057 .dac_nids = alc883_dac_nids, 9058 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev), 9059 .adc_nids = alc883_adc_nids_rev, 9060 .capsrc_nids = alc883_capsrc_nids_rev, 9061 .dig_out_nid = ALC883_DIGOUT_NID, 9062 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes), 9063 .channel_mode = alc888_4ST_8ch_intel_modes, 9064 .num_mux_defs = 9065 ARRAY_SIZE(alc888_2_capture_sources), 9066 .input_mux = alc888_2_capture_sources, 9067 .unsol_event = alc888_fujitsu_xa3530_unsol_event, 9068 .init_hook = alc888_fujitsu_xa3530_automute, 8515 9069 }, 8516 9070 [ALC888_LENOVO_SKY] = { … … 8556 9110 .init_hook = alc883_eee1601_inithook, 8557 9111 }, 9112 [ALC1200_ASUS_P5Q] = { 9113 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 9114 .init_verbs = { alc883_init_verbs }, 9115 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 9116 .dac_nids = alc883_dac_nids, 9117 .dig_out_nid = ALC1200_DIGOUT_NID, 9118 .dig_in_nid = ALC883_DIGIN_NID, 9119 .slave_dig_outs = alc1200_slave_dig_outs, 9120 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 9121 .channel_mode = alc883_sixstack_modes, 9122 .input_mux = &alc883_capture_source, 9123 }, 8558 9124 }; 8559 9125 … … 8619 9185 hda_nid_t nid = spec->autocfg.input_pins[i]; 8620 9186 if (alc883_is_input_pin(nid)) { 8621 snd_hda_codec_write(codec, nid, 0, 8622 AC_VERB_SET_PIN_WIDGET_CONTROL, 8623 (i <= AUTO_PIN_FRONT_MIC ? 8624 PIN_VREF80 : PIN_IN)); 8625 if (nid != ALC883_PIN_CD_NID) 9187 alc_set_input_pin(codec, nid, i); 9188 if (nid != ALC883_PIN_CD_NID && 9189 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) 8626 9190 snd_hda_codec_write(codec, nid, 0, 8627 9191 AC_VERB_SET_AMP_GAIN_MUTE, … … 8638 9202 struct alc_spec *spec = codec->spec; 8639 9203 int err = alc880_parse_auto_config(codec); 9204 struct auto_pin_cfg *cfg = &spec->autocfg; 9205 int i; 8640 9206 8641 9207 if (err < 0) … … 8650 9216 /* hack - override the init verbs */ 8651 9217 spec->init_verbs[0] = alc883_auto_init_verbs; 9218 9219 /* setup input_mux for ALC889 */ 9220 if (codec->vendor_id == 0x10ec0889) { 9221 /* digital-mic input pin is excluded in alc880_auto_create..() 9222 * because it's under 0x18 9223 */ 9224 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || 9225 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { 9226 struct hda_input_mux *imux = &spec->private_imux[0]; 9227 for (i = 1; i < 3; i++) 9228 memcpy(&spec->private_imux[i], 9229 &spec->private_imux[0], 9230 sizeof(spec->private_imux[0])); 9231 imux->items[imux->num_items].label = "Int DMic"; 9232 imux->items[imux->num_items].index = 0x0b; 9233 imux->num_items++; 9234 spec->num_mux_defs = 3; 9235 spec->input_mux = spec->private_imux; 9236 } 9237 } 8652 9238 8653 9239 return 1; /* config found */ … … 8702 9288 } 8703 9289 9290 err = snd_hda_attach_beep_device(codec, 0x1); 9291 if (err < 0) { 9292 alc_free(codec); 9293 return err; 9294 } 9295 8704 9296 if (board_config != ALC883_AUTO) 8705 9297 setup_preset(spec, &alc883_presets[board_config]); … … 8714 9306 spec->stream_name_digital = "ALC888 Digital"; 8715 9307 } 9308 if (!spec->num_adc_nids) { 9309 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 9310 spec->adc_nids = alc883_adc_nids; 9311 } 9312 if (!spec->capsrc_nids) 9313 spec->capsrc_nids = alc883_capsrc_nids; 9314 spec->capture_style = CAPT_MIX; /* matrix-style capture */ 8716 9315 break; 8717 9316 case 0x10ec0889: 8718 9317 spec->stream_name_analog = "ALC889 Analog"; 8719 9318 spec->stream_name_digital = "ALC889 Digital"; 9319 if (!spec->num_adc_nids) { 9320 spec->num_adc_nids = ARRAY_SIZE(alc889_adc_nids); 9321 spec->adc_nids = alc889_adc_nids; 9322 } 9323 if (!spec->capsrc_nids) 9324 spec->capsrc_nids = alc889_capsrc_nids; 9325 spec->capture_style = CAPT_1MUX_MIX; /* 1mux/Nmix-style 9326 capture */ 8720 9327 break; 8721 9328 default: 8722 9329 spec->stream_name_analog = "ALC883 Analog"; 8723 9330 spec->stream_name_digital = "ALC883 Digital"; 9331 if (!spec->num_adc_nids) { 9332 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 9333 spec->adc_nids = alc883_adc_nids; 9334 } 9335 if (!spec->capsrc_nids) 9336 spec->capsrc_nids = alc883_capsrc_nids; 9337 spec->capture_style = CAPT_MIX; /* matrix-style capture */ 8724 9338 break; 8725 9339 } … … 8732 9346 spec->stream_digital_capture = &alc883_pcm_digital_capture; 8733 9347 8734 if (!spec->num_adc_nids) {8735 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids);8736 spec->adc_nids = alc883_adc_nids;8737 }8738 if (!spec->capsrc_nids)8739 spec->capsrc_nids = alc883_capsrc_nids;8740 spec->is_mix_capture = 1; /* matrix-style capture */8741 9348 if (!spec->cap_mixer) 8742 9349 set_capture_mixer(spec); 9350 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 8743 9351 8744 9352 spec->vmaster_nid = 0x0c; … … 8752 9360 spec->loopback.amplist = alc883_loopbacks; 8753 9361 #endif 9362 codec->proc_widget_hook = print_realtek_coef; 8754 9363 8755 9364 return 0; … … 8792 9401 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 8793 9402 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 8794 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),8795 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */8796 9403 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), 8797 9404 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), … … 8814 9421 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 8815 9422 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 8816 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),8817 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), */8818 9423 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ 8819 9424 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), … … 8924 9529 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 8925 9530 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 8926 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),8927 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),8928 9531 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), 8929 9532 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), … … 8954 9557 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 8955 9558 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 8956 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT),8957 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT),8958 9559 {0} /* end */ 8959 9560 }; … … 9102 9703 {0} /* end */ 9103 9704 }; 9705 9706 static struct snd_kcontrol_new alc262_tyan_mixer[] = { 9707 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9708 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), 9709 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT), 9710 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT), 9711 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 9712 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 9713 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 9714 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 9715 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 9716 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 9717 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 9718 HDA_CODEC_VOLUME("Front Mic Boost", 0x19, 0, HDA_INPUT), 9719 {0} /* end */ 9720 }; 9721 9722 static struct hda_verb alc262_tyan_verbs[] = { 9723 /* Headphone automute */ 9724 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 9725 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 9726 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 9727 9728 /* P11 AUX_IN, white 4-pin connector */ 9729 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 9730 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1}, 9731 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93}, 9732 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19}, 9733 9734 {0} 9735 }; 9736 9737 /* unsolicited event for HP jack sensing */ 9738 static void alc262_tyan_automute(struct hda_codec *codec) 9739 { 9740 unsigned int mute; 9741 unsigned int present; 9742 9743 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); 9744 present = snd_hda_codec_read(codec, 0x1b, 0, 9745 AC_VERB_GET_PIN_SENSE, 0); 9746 present = (present & 0x80000000) != 0; 9747 if (present) { 9748 /* mute line output on ATX panel */ 9749 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 9750 HDA_AMP_MUTE, HDA_AMP_MUTE); 9751 } else { 9752 /* unmute line output if necessary */ 9753 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); 9754 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, 9755 HDA_AMP_MUTE, mute); 9756 } 9757 } 9758 9759 static void alc262_tyan_unsol_event(struct hda_codec *codec, 9760 unsigned int res) 9761 { 9762 if ((res >> 26) != ALC880_HP_EVENT) 9763 return; 9764 alc262_tyan_automute(codec); 9765 } 9104 9766 9105 9767 #define alc262_capture_mixer alc882_capture_mixer … … 9569 10231 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 9570 10232 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 9571 HDA_CODEC_VOLUME("PC Speaker Volume", 0x0b, 0x05, HDA_INPUT),9572 HDA_CODEC_MUTE("PC Speaker Switch", 0x0b, 0x05, HDA_INPUT),9573 10233 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 9574 10234 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), … … 10142 10802 if (err < 0) 10143 10803 return err; 10144 if (!spec->autocfg.line_outs) 10804 if (!spec->autocfg.line_outs) { 10805 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { 10806 spec->multiout.max_channels = 2; 10807 spec->no_analog = 1; 10808 goto dig_only; 10809 } 10145 10810 return 0; /* can't find valid BIOS pin config */ 10811 } 10146 10812 err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg); 10147 10813 if (err < 0) … … 10153 10819 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 10154 10820 10155 if (spec->autocfg.dig_out_pin) 10821 dig_only: 10822 if (spec->autocfg.dig_outs) { 10156 10823 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; 10824 spec->dig_out_type = spec->autocfg.dig_out_type[0]; 10825 } 10157 10826 if (spec->autocfg.dig_in_pin) 10158 10827 spec->dig_in_nid = ALC262_DIGIN_NID; … … 10163 10832 add_verb(spec, alc262_volume_init_verbs); 10164 10833 spec->num_mux_defs = 1; 10165 spec->input_mux = &spec->private_imux ;10834 spec->input_mux = &spec->private_imux[0]; 10166 10835 10167 10836 err = alc_auto_add_mic_boost(codec); … … 10169 10838 return err; 10170 10839 10171 store_pin_configs(codec);10172 10840 return 1; 10173 10841 } … … 10211 10879 [ALC262_LENOVO_3000] = "lenovo-3000", 10212 10880 [ALC262_NEC] = "nec", 10881 [ALC262_TYAN] = "tyan", 10213 10882 [ALC262_AUTO] = "auto", 10214 10883 }; … … 10217 10886 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), 10218 10887 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC), 10219 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), 10220 SND_PCI_QUIRK(0x103c, 0x12ff, "HP xw4550", ALC262_HP_BPC), 10221 SND_PCI_QUIRK(0x103c, 0x1306, "HP xw8600", ALC262_HP_BPC), 10222 SND_PCI_QUIRK(0x103c, 0x1307, "HP xw6600", ALC262_HP_BPC), 10223 SND_PCI_QUIRK(0x103c, 0x1308, "HP xw4600", ALC262_HP_BPC), 10224 SND_PCI_QUIRK(0x103c, 0x1309, "HP xw4*00", ALC262_HP_BPC), 10225 SND_PCI_QUIRK(0x103c, 0x130a, "HP xw6*00", ALC262_HP_BPC), 10226 SND_PCI_QUIRK(0x103c, 0x130b, "HP xw8*00", ALC262_HP_BPC), 10888 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1200, "HP xw series", 10889 ALC262_HP_BPC), 10890 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1300, "HP xw series", 10891 ALC262_HP_BPC), 10892 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x1700, "HP xw series", 10893 ALC262_HP_BPC), 10227 10894 SND_PCI_QUIRK(0x103c, 0x2800, "HP D7000", ALC262_HP_BPC_D7000_WL), 10228 10895 SND_PCI_QUIRK(0x103c, 0x2801, "HP D7000", ALC262_HP_BPC_D7000_WF), … … 10242 10909 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), 10243 10910 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD), 10244 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), 10245 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), 10911 SND_PCI_QUIRK(0x104d, 0x9016, "Sony VAIO", ALC262_AUTO), /* dig-only */ 10912 SND_PCI_QUIRK_MASK(0x104d, 0xff00, 0x9000, "Sony VAIO", 10913 ALC262_SONY_ASSAMD), 10246 10914 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", 10247 10915 ALC262_TOSHIBA_RX1), … … 10249 10917 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), 10250 10918 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), 10251 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 10252 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), 10919 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN), 10920 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1", 10921 ALC262_ULTRA), 10922 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO), 10253 10923 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), 10254 10924 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), … … 10466 11136 .init_hook = alc262_hippo_automute, 10467 11137 }, 11138 [ALC262_TYAN] = { 11139 .mixers = { alc262_tyan_mixer }, 11140 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs}, 11141 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 11142 .dac_nids = alc262_dac_nids, 11143 .hp_nid = 0x02, 11144 .dig_out_nid = ALC262_DIGOUT_NID, 11145 .num_channel_mode = ARRAY_SIZE(alc262_modes), 11146 .channel_mode = alc262_modes, 11147 .input_mux = &alc262_capture_source, 11148 .unsol_event = alc262_tyan_unsol_event, 11149 .init_hook = alc262_tyan_automute, 11150 }, 10468 11151 }; 10469 11152 … … 10518 11201 } 10519 11202 11203 if (!spec->no_analog) { 11204 err = snd_hda_attach_beep_device(codec, 0x1); 11205 if (err < 0) { 11206 alc_free(codec); 11207 return err; 11208 } 11209 } 11210 10520 11211 if (board_config != ALC262_AUTO) 10521 11212 setup_preset(spec, &alc262_presets[board_config]); … … 10529 11220 spec->stream_digital_capture = &alc262_pcm_digital_capture; 10530 11221 10531 spec-> is_mix_capture = 1;11222 spec->capture_style = CAPT_MIX; 10532 11223 if (!spec->adc_nids && spec->input_mux) { 10533 11224 /* check whether NID 0x07 is valid */ … … 10546 11237 } 10547 11238 } 10548 if (!spec->cap_mixer )11239 if (!spec->cap_mixer && !spec->no_analog) 10549 11240 set_capture_mixer(spec); 11241 if (!spec->no_analog) 11242 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 10550 11243 10551 11244 spec->vmaster_nid = 0x0c; … … 10558 11251 spec->loopback.amplist = alc262_loopbacks; 10559 11252 #endif 11253 codec->proc_widget_hook = print_realtek_coef; 10560 11254 10561 11255 return 0; … … 10926 11620 /* Unmute DAC0-1 and set vol = 0 */ 10927 11621 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 10928 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},10929 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},10930 11622 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 10931 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},10932 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},10933 11623 10934 11624 /* … … 10937 11627 /* set vol=0 to output mixers */ 10938 11628 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 10939 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},10940 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},10941 11629 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, 10942 11630 … … 10957 11645 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 10958 11646 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 10959 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},10960 11647 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 10961 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},10962 11648 10963 11649 /* set PCBEEP vol = 0, mute connections */ … … 10981 11667 static struct hda_verb alc268_volume_init_verbs[] = { 10982 11668 /* set output DAC */ 10983 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 10984 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 10985 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 10986 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 11669 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 11670 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 10987 11671 10988 11672 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, … … 10992 11676 {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 10993 11677 10994 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},10995 11678 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 10996 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},10997 11679 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 10998 11680 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 10999 11681 11000 11682 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11001 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},11002 11683 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 11003 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},11004 11684 11005 11685 /* set PCBEEP vol = 0, mute connections */ … … 11200 11880 const struct auto_pin_cfg *cfg) 11201 11881 { 11202 struct hda_input_mux *imux = &spec->private_imux ;11882 struct hda_input_mux *imux = &spec->private_imux[0]; 11203 11883 int i, idx1; 11204 11884 … … 11294 11974 if (err < 0) 11295 11975 return err; 11296 if (!spec->autocfg.line_outs) 11976 if (!spec->autocfg.line_outs) { 11977 if (spec->autocfg.dig_outs || spec->autocfg.dig_in_pin) { 11978 spec->multiout.max_channels = 2; 11979 spec->no_analog = 1; 11980 goto dig_only; 11981 } 11297 11982 return 0; /* can't find valid BIOS pin config */ 11298 11983 } 11299 11984 err = alc268_auto_create_multi_out_ctls(spec, &spec->autocfg); 11300 11985 if (err < 0) … … 11306 11991 spec->multiout.max_channels = 2; 11307 11992 11993 dig_only: 11308 11994 /* digital only support output */ 11309 if (spec->autocfg.dig_out _pin)11995 if (spec->autocfg.dig_outs) { 11310 11996 spec->multiout.dig_out_nid = ALC268_DIGOUT_NID; 11311 11997 spec->dig_out_type = spec->autocfg.dig_out_type[0]; 11998 } 11312 11999 if (spec->kctls.list) 11313 12000 add_mixer(spec, spec->kctls.list); 11314 12001 11315 if ( spec->autocfg.speaker_pins[0] != 0x1d)12002 if (!spec->no_analog && spec->autocfg.speaker_pins[0] != 0x1d) 11316 12003 add_mixer(spec, alc268_beep_mixer); 11317 12004 11318 12005 add_verb(spec, alc268_volume_init_verbs); 11319 12006 spec->num_mux_defs = 1; 11320 spec->input_mux = &spec->private_imux ;12007 spec->input_mux = &spec->private_imux[0]; 11321 12008 11322 12009 err = alc_auto_add_mic_boost(codec); … … 11324 12011 return err; 11325 12012 11326 store_pin_configs(codec);11327 12013 return 1; 11328 12014 } … … 11371 12057 ALC268_ACER_ASPIRE_ONE), 11372 12058 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), 12059 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), 11373 12060 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), 11374 12061 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), … … 11385 12072 static struct alc_config_preset alc268_presets[] = { 11386 12073 [ALC267_QUANTA_IL1] = { 11387 .mixers = { alc267_quanta_il1_mixer },12074 .mixers = { alc267_quanta_il1_mixer, alc268_beep_mixer }, 11388 12075 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 11389 12076 alc267_quanta_il1_verbs }, … … 11467 12154 [ALC268_ACER_ASPIRE_ONE] = { 11468 12155 .mixers = { alc268_acer_aspire_one_mixer, 11469 alc268_capture_alt_mixer }, 12156 alc268_beep_mixer, 12157 alc268_capture_alt_mixer }, 11470 12158 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 11471 12159 alc268_acer_aspire_one_verbs }, … … 11536 12224 struct alc_spec *spec; 11537 12225 int board_config; 11538 int err;12226 int i, has_beep, err; 11539 12227 11540 12228 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); … … 11585 12273 spec->stream_digital_playback = &alc268_pcm_digital_playback; 11586 12274 11587 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) 11588 /* override the amp caps for beep generator */ 11589 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, 12275 has_beep = 0; 12276 for (i = 0; i < spec->num_mixers; i++) { 12277 if (spec->mixers[i] == alc268_beep_mixer) { 12278 has_beep = 1; 12279 break; 12280 } 12281 } 12282 12283 if (has_beep) { 12284 err = snd_hda_attach_beep_device(codec, 0x1); 12285 if (err < 0) { 12286 alc_free(codec); 12287 return err; 12288 } 12289 if (!query_amp_caps(codec, 0x1d, HDA_INPUT)) 12290 /* override the amp caps for beep generator */ 12291 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT, 11590 12292 (0x0c << AC_AMPCAP_OFFSET_SHIFT) | 11591 12293 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) | 11592 12294 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) | 11593 12295 (0 << AC_AMPCAP_MUTE_SHIFT)); 11594 11595 if (!spec->adc_nids && spec->input_mux) { 12296 } 12297 12298 if (!spec->no_analog && !spec->adc_nids && spec->input_mux) { 11596 12299 /* check whether NID 0x07 is valid */ 11597 12300 unsigned int wcap = get_wcaps(codec, 0x07); … … 11623 12326 spec->init_hook = alc268_auto_init; 11624 12327 12328 codec->proc_widget_hook = print_realtek_coef; 12329 11625 12330 return 0; 11626 12331 } … … 11672 12377 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 11673 12378 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 11674 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),11675 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),11676 12379 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 11677 12380 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), … … 11700 12403 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 11701 12404 HDA_CODEC_VOLUME("Internal Mic Boost", 0x19, 0, HDA_INPUT), 11702 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),11703 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),11704 12405 {0} 11705 12406 }; … … 11725 12426 HDA_CODEC_MUTE("Dock Mic Playback Switch", 0x0b, 0x03, HDA_INPUT), 11726 12427 HDA_CODEC_VOLUME("Dock Mic Boost", 0x1b, 0, HDA_INPUT), 11727 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x04, HDA_INPUT),11728 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x04, HDA_INPUT),11729 12428 {0} 11730 12429 }; … … 11760 12459 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 11761 12460 HDA_BIND_VOL("PCM Playback Volume", &alc269_epc_bind_vol), 11762 {0} /* end */11763 };11764 11765 /* beep control */11766 static struct snd_kcontrol_new alc269_beep_mixer[] = {11767 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x4, HDA_INPUT),11768 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x4, HDA_INPUT),11769 12461 {0} /* end */ 11770 12462 }; … … 12169 12861 if (cfg->input_pins[AUTO_PIN_MIC] == 0x12 || 12170 12862 cfg->input_pins[AUTO_PIN_FRONT_MIC] == 0x12) { 12171 struct hda_input_mux *imux = &spec->private_imux ;12863 struct hda_input_mux *imux = &spec->private_imux[0]; 12172 12864 imux->items[imux->num_items].label = "Int Mic"; 12173 12865 imux->items[imux->num_items].index = 0x05; … … 12187 12879 #define alc269_pcm_digital_capture alc880_pcm_digital_capture 12188 12880 12881 static struct hda_pcm_stream alc269_44k_pcm_analog_playback = { 12882 .substreams = 1, 12883 .channels_min = 2, 12884 .channels_max = 8, 12885 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ 12886 /* NID is set in alc_build_pcms */ 12887 .ops = { 12888 .open = alc880_playback_pcm_open, 12889 .prepare = alc880_playback_pcm_prepare, 12890 .cleanup = alc880_playback_pcm_cleanup 12891 }, 12892 }; 12893 12894 static struct hda_pcm_stream alc269_44k_pcm_analog_capture = { 12895 .substreams = 1, 12896 .channels_min = 2, 12897 .channels_max = 2, 12898 .rates = SNDRV_PCM_RATE_44100, /* fixed rate */ 12899 /* NID is set in alc_build_pcms */ 12900 }; 12901 12189 12902 /* 12190 12903 * BIOS auto configuration … … 12193 12906 { 12194 12907 struct alc_spec *spec = codec->spec; 12195 int i,err;12908 int err; 12196 12909 static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; 12197 12910 … … 12210 12923 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 12211 12924 12212 if (spec->autocfg.dig_out _pin)12925 if (spec->autocfg.dig_outs) 12213 12926 spec->multiout.dig_out_nid = ALC269_DIGOUT_NID; 12214 12927 … … 12216 12929 add_mixer(spec, spec->kctls.list); 12217 12930 12218 /* create a beep mixer control if the pin 0x1d isn't assigned */12219 for (i = 0; i < ARRAY_SIZE(spec->autocfg.input_pins); i++)12220 if (spec->autocfg.input_pins[i] == 0x1d)12221 break;12222 if (i >= ARRAY_SIZE(spec->autocfg.input_pins))12223 add_mixer(spec, alc269_beep_mixer);12224 12225 12931 add_verb(spec, alc269_init_verbs); 12226 12932 spec->num_mux_defs = 1; 12227 spec->input_mux = &spec->private_imux ;12933 spec->input_mux = &spec->private_imux[0]; 12228 12934 /* set default input source */ 12229 12935 snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], … … 12235 12941 return err; 12236 12942 12237 if (!spec->cap_mixer )12943 if (!spec->cap_mixer && !spec->no_analog) 12238 12944 set_capture_mixer(spec); 12239 12945 12240 store_pin_configs(codec);12241 12946 return 1; 12242 12947 } … … 12274 12979 SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", 12275 12980 ALC269_ASUS_EEEPC_P703), 12981 SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_EEEPC_P703), 12982 SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_EEEPC_P703), 12983 SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_EEEPC_P703), 12984 SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_EEEPC_P703), 12985 SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_EEEPC_P703), 12986 SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_EEEPC_P703), 12276 12987 SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", 12277 12988 ALC269_ASUS_EEEPC_P901), 12278 12989 SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", 12279 12990 ALC269_ASUS_EEEPC_P901), 12991 SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_EEEPC_P901), 12280 12992 SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), 12281 12993 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), … … 12335 13047 }, 12336 13048 [ALC269_FUJITSU] = { 12337 .mixers = { alc269_fujitsu_mixer , alc269_beep_mixer},13049 .mixers = { alc269_fujitsu_mixer }, 12338 13050 .cap_mixer = alc269_epc_capture_mixer, 12339 13051 .init_verbs = { alc269_init_verbs, … … 12400 13112 } 12401 13113 13114 err = snd_hda_attach_beep_device(codec, 0x1); 13115 if (err < 0) { 13116 alc_free(codec); 13117 return err; 13118 } 13119 12402 13120 if (board_config != ALC269_AUTO) 12403 13121 setup_preset(spec, &alc269_presets[board_config]); 12404 13122 12405 13123 spec->stream_name_analog = "ALC269 Analog"; 12406 spec->stream_analog_playback = &alc269_pcm_analog_playback; 12407 spec->stream_analog_capture = &alc269_pcm_analog_capture; 12408 13124 if (codec->subsystem_id == 0x17aa3bf8) { 13125 /* Due to a hardware problem on Lenovo Ideadpad, we need to 13126 * fix the sample rate of analog I/O to 44.1kHz 13127 */ 13128 spec->stream_analog_playback = &alc269_44k_pcm_analog_playback; 13129 spec->stream_analog_capture = &alc269_44k_pcm_analog_capture; 13130 } else { 13131 spec->stream_analog_playback = &alc269_pcm_analog_playback; 13132 spec->stream_analog_capture = &alc269_pcm_analog_capture; 13133 } 12409 13134 spec->stream_name_digital = "ALC269 Digital"; 12410 13135 spec->stream_digital_playback = &alc269_pcm_digital_playback; … … 12416 13141 if (!spec->cap_mixer) 12417 13142 set_capture_mixer(spec); 13143 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 12418 13144 12419 13145 codec->patch_ops = alc_patch_ops; … … 12424 13150 spec->loopback.amplist = alc269_loopbacks; 12425 13151 #endif 13152 codec->proc_widget_hook = print_realtek_coef; 12426 13153 12427 13154 return 0; … … 12664 13391 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), 12665 13392 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), 12666 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT),12667 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT),12668 13393 {0} 12669 13394 }; … … 13139 13864 const struct auto_pin_cfg *cfg) 13140 13865 { 13141 struct hda_input_mux *imux = &spec->private_imux ;13866 struct hda_input_mux *imux = &spec->private_imux[0]; 13142 13867 int i, err, idx, idx1; 13143 13868 … … 13226 13951 for (i = 0; i < AUTO_PIN_LAST; i++) { 13227 13952 hda_nid_t nid = spec->autocfg.input_pins[i]; 13228 if (nid >= 0x0c && nid <= 0x11) { 13229 snd_hda_codec_write(codec, nid, 0, 13230 AC_VERB_SET_PIN_WIDGET_CONTROL, 13231 i <= AUTO_PIN_FRONT_MIC ? 13232 PIN_VREF80 : PIN_IN); 13233 } 13953 if (nid >= 0x0c && nid <= 0x11) 13954 alc_set_input_pin(codec, nid, i); 13234 13955 } 13235 13956 } … … 13267 13988 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 13268 13989 13269 if (spec->autocfg.dig_out _pin)13990 if (spec->autocfg.dig_outs) 13270 13991 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; 13271 13992 … … 13276 13997 13277 13998 spec->num_mux_defs = 1; 13278 spec->input_mux = &spec->private_imux ;13999 spec->input_mux = &spec->private_imux[0]; 13279 14000 13280 14001 spec->adc_nids = alc861_adc_nids; … … 13282 14003 set_capture_mixer(spec); 13283 14004 13284 store_pin_configs(codec);13285 14005 return 1; 13286 14006 } … … 13491 14211 } 13492 14212 14213 err = snd_hda_attach_beep_device(codec, 0x23); 14214 if (err < 0) { 14215 alc_free(codec); 14216 return err; 14217 } 14218 13493 14219 if (board_config != ALC861_AUTO) 13494 14220 setup_preset(spec, &alc861_presets[board_config]); … … 13501 14227 spec->stream_digital_playback = &alc861_pcm_digital_playback; 13502 14228 spec->stream_digital_capture = &alc861_pcm_digital_capture; 14229 14230 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); 13503 14231 13504 14232 spec->vmaster_nid = 0x03; … … 13511 14239 spec->loopback.amplist = alc861_loopbacks; 13512 14240 #endif 14241 codec->proc_widget_hook = print_realtek_coef; 13513 14242 13514 14243 return 0; … … 13657 14386 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 13658 14387 13659 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),13660 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),13661 13662 14388 {0} /* end */ 13663 14389 }; … … 13682 14408 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 13683 14409 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 13684 13685 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),13686 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),13687 14410 13688 14411 {0} /* end */ … … 13724 14447 HDA_CODEC_VOLUME("Int Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 13725 14448 HDA_CODEC_MUTE("Int Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 13726 HDA_CODEC_VOLUME("PC Beep Volume", 0x0b, 0x05, HDA_INPUT),13727 HDA_CODEC_MUTE("PC Beep Switch", 0x0b, 0x05, HDA_INPUT),13728 14449 {0} /* end */ 13729 14450 }; … … 14036 14757 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba L30-149", ALC861VD_DALLAS), 14037 14758 SND_PCI_QUIRK(0x1565, 0x820d, "Biostar NF61S SE", ALC861VD_6ST_DIG), 14038 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo", ALC861VD_LENOVO), 14039 SND_PCI_QUIRK(0x17aa, 0x3802, "Lenovo 3000 C200", ALC861VD_LENOVO), 14040 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 N200", ALC861VD_LENOVO), 14759 SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo", ALC861VD_LENOVO), 14041 14760 SND_PCI_QUIRK(0x1849, 0x0862, "ASRock K8NF6G-VSTA", ALC861VD_6ST_DIG), 14042 14761 {0} … … 14200 14919 hda_nid_t nid = spec->autocfg.input_pins[i]; 14201 14920 if (alc861vd_is_input_pin(nid)) { 14202 snd_hda_codec_write(codec, nid, 0, 14203 AC_VERB_SET_PIN_WIDGET_CONTROL, 14204 i <= AUTO_PIN_FRONT_MIC ? 14205 PIN_VREF80 : PIN_IN); 14206 if (nid != ALC861VD_PIN_CD_NID) 14921 alc_set_input_pin(codec, nid, i); 14922 if (nid != ALC861VD_PIN_CD_NID && 14923 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) 14207 14924 snd_hda_codec_write(codec, nid, 0, 14208 14925 AC_VERB_SET_AMP_GAIN_MUTE, … … 14370 15087 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 14371 15088 14372 if (spec->autocfg.dig_out _pin)15089 if (spec->autocfg.dig_outs) 14373 15090 spec->multiout.dig_out_nid = ALC861VD_DIGOUT_NID; 14374 15091 … … 14379 15096 14380 15097 spec->num_mux_defs = 1; 14381 spec->input_mux = &spec->private_imux ;15098 spec->input_mux = &spec->private_imux[0]; 14382 15099 14383 15100 err = alc_auto_add_mic_boost(codec); … … 14385 15102 return err; 14386 15103 14387 store_pin_configs(codec);14388 15104 return 1; 14389 15105 } … … 14436 15152 } 14437 15153 15154 err = snd_hda_attach_beep_device(codec, 0x23); 15155 if (err < 0) { 15156 alc_free(codec); 15157 return err; 15158 } 15159 14438 15160 if (board_config != ALC861VD_AUTO) 14439 15161 setup_preset(spec, &alc861vd_presets[board_config]); … … 14458 15180 spec->num_adc_nids = ARRAY_SIZE(alc861vd_adc_nids); 14459 15181 spec->capsrc_nids = alc861vd_capsrc_nids; 14460 spec-> is_mix_capture = 1;15182 spec->capture_style = CAPT_MIX; 14461 15183 14462 15184 set_capture_mixer(spec); 15185 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 14463 15186 14464 15187 spec->vmaster_nid = 0x02; … … 14472 15195 spec->loopback.amplist = alc861vd_loopbacks; 14473 15196 #endif 15197 codec->proc_widget_hook = print_realtek_coef; 14474 15198 14475 15199 return 0; … … 14495 15219 }; 14496 15220 15221 static hda_nid_t alc272_dac_nids[2] = { 15222 0x02, 0x03 15223 }; 15224 14497 15225 static hda_nid_t alc662_adc_nids[1] = { 14498 15226 /* ADC1-2 */ … … 14500 15228 }; 14501 15229 15230 static hda_nid_t alc272_adc_nids[1] = { 15231 /* ADC1-2 */ 15232 0x08, 15233 }; 15234 14502 15235 static hda_nid_t alc662_capsrc_nids[1] = { 0x22 }; 15236 static hda_nid_t alc272_capsrc_nids[1] = { 0x23 }; 15237 14503 15238 14504 15239 /* input MUX */ … … 14648 15383 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 14649 15384 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 14650 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),14651 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),14652 15385 {0} /* end */ 14653 15386 }; … … 14671 15404 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 14672 15405 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 14673 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),14674 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),14675 15406 {0} /* end */ 14676 15407 }; … … 14930 15661 /* Input mixer */ 14931 15662 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 14932 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},14933 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},14934 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},14935 14936 15663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 14937 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},14938 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},14939 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)},14940 15664 14941 15665 /* always trun on EAPD */ … … 15132 15856 }; 15133 15857 15858 static struct hda_verb alc272_dell_zm1_init_verbs[] = { 15859 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 15860 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 15861 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 15862 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 15863 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 15864 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 15865 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ 15866 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 15867 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, 15868 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 15869 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 15870 {0} 15871 }; 15872 15873 static struct hda_verb alc272_dell_init_verbs[] = { 15874 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 15875 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 15876 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 15877 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 15878 {0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 15879 {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 15880 {0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Headphone */ 15881 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 15882 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)}, 15883 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 15884 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 15885 {0} 15886 }; 15887 15134 15888 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = { 15135 15889 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), 15136 15890 HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), 15891 {0} /* end */ 15892 }; 15893 15894 static struct snd_kcontrol_new alc272_auto_capture_mixer[] = { 15895 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 15896 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 15137 15897 {0} /* end */ 15138 15898 }; … … 15648 16408 15649 16409 static struct snd_pci_quirk alc662_cfg_tbl[] = { 16410 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS), 16411 SND_PCI_QUIRK(0x1028, 0x02d6, "DELL", ALC272_DELL), 16412 SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1), 16413 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), 16414 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), 16415 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), 16416 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), 16417 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), 16418 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), 16419 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), 16420 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), 16421 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), 16422 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), 16423 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), 16424 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), 16425 SND_PCI_QUIRK(0x1043, 0x17b3, "ASUS F70SL", ALC663_ASUS_MODE3), 16426 SND_PCI_QUIRK(0x1043, 0x17c3, "ASUS UX20", ALC663_ASUS_M51VA), 16427 SND_PCI_QUIRK(0x1043, 0x17f3, "ASUS X58LE", ALC662_ASUS_MODE2), 16428 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), 16429 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), 16430 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), 16431 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), 16432 SND_PCI_QUIRK(0x1043, 0x1853, "ASUS F50Z", ALC663_ASUS_MODE1), 16433 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), 16434 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), 15650 16435 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M51VA", ALC663_ASUS_M51VA), 16436 /*SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1),*/ 16437 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), 16438 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), 16439 SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), 16440 SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1), 16441 SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1), 16442 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), 16443 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), 16444 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), 16445 SND_PCI_QUIRK(0x1043, 0x1943, "ASUS Vx3V", ALC663_ASUS_MODE1), 16446 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), 16447 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), 16448 SND_PCI_QUIRK(0x1043, 0x1983, "ASUS N5051A", ALC663_ASUS_MODE1), 16449 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), 15651 16450 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS G50V", ALC663_ASUS_G50V), 16451 /*SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1),*/ 16452 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), 16453 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), 16454 SND_PCI_QUIRK(0x1043, 0x19d3, "ASUS NB", ALC663_ASUS_M51VA), 16455 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), 16456 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), 15652 16457 SND_PCI_QUIRK(0x1043, 0x8290, "ASUS P5GC-MX", ALC662_3ST_6ch_DIG), 15653 16458 SND_PCI_QUIRK(0x1043, 0x82a1, "ASUS Eeepc", ALC662_ASUS_EEEPC_P701), 15654 16459 SND_PCI_QUIRK(0x1043, 0x82d1, "ASUS Eeepc EP20", ALC662_ASUS_EEEPC_EP20), 15655 SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), 15656 SND_PCI_QUIRK(0x1043, 0x1878, "ASUS M50Vr", ALC663_ASUS_MODE1), 15657 SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1), 15658 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS F7Z", ALC663_ASUS_MODE1), 15659 SND_PCI_QUIRK(0x1043, 0x1953, "ASUS NB", ALC663_ASUS_MODE1), 15660 SND_PCI_QUIRK(0x1043, 0x19a3, "ASUS NB", ALC663_ASUS_MODE1), 15661 SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1), 15662 SND_PCI_QUIRK(0x1043, 0x1203, "ASUS NB", ALC663_ASUS_MODE1), 15663 SND_PCI_QUIRK(0x1043, 0x19e3, "ASUS NB", ALC663_ASUS_MODE1), 15664 SND_PCI_QUIRK(0x1043, 0x1993, "ASUS N20", ALC663_ASUS_MODE1), 15665 SND_PCI_QUIRK(0x1043, 0x19c3, "ASUS F5Z/F6x", ALC662_ASUS_MODE2), 15666 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS NB", ALC662_ASUS_MODE2), 15667 SND_PCI_QUIRK(0x1043, 0x1913, "ASUS NB", ALC662_ASUS_MODE2), 15668 SND_PCI_QUIRK(0x1043, 0x1843, "ASUS NB", ALC662_ASUS_MODE2), 15669 SND_PCI_QUIRK(0x1043, 0x1813, "ASUS NB", ALC662_ASUS_MODE2), 15670 SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), 15671 SND_PCI_QUIRK(0x1043, 0x1876, "ASUS NB", ALC662_ASUS_MODE2), 15672 SND_PCI_QUIRK(0x1043, 0x1864, "ASUS NB", ALC662_ASUS_MODE2), 15673 SND_PCI_QUIRK(0x1043, 0x1783, "ASUS NB", ALC662_ASUS_MODE2), 15674 SND_PCI_QUIRK(0x1043, 0x1753, "ASUS NB", ALC662_ASUS_MODE2), 15675 SND_PCI_QUIRK(0x1043, 0x16c3, "ASUS NB", ALC662_ASUS_MODE2), 15676 SND_PCI_QUIRK(0x1043, 0x1933, "ASUS F80Q", ALC662_ASUS_MODE2), 15677 SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3), 15678 SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3), 15679 SND_PCI_QUIRK(0x1043, 0x1963, "ASUS X71C", ALC663_ASUS_MODE3), 15680 SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3), 15681 SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), 15682 SND_PCI_QUIRK(0x1043, 0x19f3, "ASUS NB", ALC663_ASUS_MODE4), 15683 SND_PCI_QUIRK(0x1043, 0x1823, "ASUS NB", ALC663_ASUS_MODE5), 15684 SND_PCI_QUIRK(0x1043, 0x1833, "ASUS NB", ALC663_ASUS_MODE6), 15685 SND_PCI_QUIRK(0x1043, 0x1763, "ASUS NB", ALC663_ASUS_MODE6), 15686 SND_PCI_QUIRK(0x1043, 0x1765, "ASUS NB", ALC663_ASUS_MODE6), 16460 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), 15687 16461 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 15688 16462 ALC662_3ST_6ch_DIG), 15689 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E),15690 SND_PCI_QUIRK(0x1019, 0x9087, "ECS", ALC662_ECS),15691 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),15692 16463 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 15693 16464 ALC662_3ST_6ch_DIG), 15694 16465 SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG), 16466 SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA), 16467 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), 15695 16468 SND_PCI_QUIRK(0x1849, 0x3662, "ASROCK K10N78FullHD-hSLI R3.0", 15696 16469 ALC662_3ST_6ch_DIG), 15697 SND_PCI_QUIRK(0x1854, 0x2000, "ASUS H13-2000", ALC663_ASUS_H13), 15698 SND_PCI_QUIRK(0x1854, 0x2001, "ASUS H13-2001", ALC663_ASUS_H13), 15699 SND_PCI_QUIRK(0x1854, 0x2002, "ASUS H13-2002", ALC663_ASUS_H13), 16470 SND_PCI_QUIRK_MASK(0x1854, 0xf000, 0x2000, "ASUS H13-200x", 16471 ALC663_ASUS_H13), 15700 16472 {0} 15701 16473 }; … … 15929 16701 .unsol_event = alc663_mode6_unsol_event, 15930 16702 .init_hook = alc663_mode6_inithook, 16703 }, 16704 [ALC272_DELL] = { 16705 .mixers = { alc663_m51va_mixer }, 16706 .cap_mixer = alc272_auto_capture_mixer, 16707 .init_verbs = { alc662_init_verbs, alc272_dell_init_verbs }, 16708 .num_dacs = ARRAY_SIZE(alc272_dac_nids), 16709 .dac_nids = alc662_dac_nids, 16710 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 16711 .adc_nids = alc272_adc_nids, 16712 .num_adc_nids = ARRAY_SIZE(alc272_adc_nids), 16713 .capsrc_nids = alc272_capsrc_nids, 16714 .channel_mode = alc662_3ST_2ch_modes, 16715 .input_mux = &alc663_m51va_capture_source, 16716 .unsol_event = alc663_m51va_unsol_event, 16717 .init_hook = alc663_m51va_inithook, 16718 }, 16719 [ALC272_DELL_ZM1] = { 16720 .mixers = { alc663_m51va_mixer }, 16721 .cap_mixer = alc662_auto_capture_mixer, 16722 .init_verbs = { alc662_init_verbs, alc272_dell_zm1_init_verbs }, 16723 .num_dacs = ARRAY_SIZE(alc272_dac_nids), 16724 .dac_nids = alc662_dac_nids, 16725 .num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes), 16726 .adc_nids = alc662_adc_nids, 16727 .num_adc_nids = ARRAY_SIZE(alc662_adc_nids), 16728 .capsrc_nids = alc662_capsrc_nids, 16729 .channel_mode = alc662_3ST_2ch_modes, 16730 .input_mux = &alc663_m51va_capture_source, 16731 .unsol_event = alc663_m51va_unsol_event, 16732 .init_hook = alc663_m51va_inithook, 15931 16733 }, 15932 16734 }; … … 16017 16819 if (alc880_is_fixed_pin(pin)) { 16018 16820 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); 16019 /* printk("DAC nid=%x\n",nid); */16821 /* printk(KERN_DEBUG "DAC nid=%x\n",nid); */ 16020 16822 /* specify the DAC as the extra output */ 16021 16823 if (!spec->multiout.hp_nid) … … 16047 16849 } 16048 16850 16851 /* return the index of the src widget from the connection list of the nid. 16852 * return -1 if not found 16853 */ 16854 static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid, 16855 hda_nid_t src) 16856 { 16857 hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; 16858 int i, conns; 16859 16860 conns = snd_hda_get_connections(codec, nid, conn_list, 16861 ARRAY_SIZE(conn_list)); 16862 if (conns < 0) 16863 return -1; 16864 for (i = 0; i < conns; i++) 16865 if (conn_list[i] == src) 16866 return i; 16867 return -1; 16868 } 16869 16870 static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) 16871 { 16872 unsigned int pincap = snd_hda_query_pin_caps(codec, nid); 16873 return (pincap & AC_PINCAP_IN) != 0; 16874 } 16875 16049 16876 /* create playback/capture controls for input pins */ 16050 static int alc662_auto_create_analog_input_ctls(struct alc_spec *spec,16877 static int alc662_auto_create_analog_input_ctls(struct hda_codec *codec, 16051 16878 const struct auto_pin_cfg *cfg) 16052 16879 { 16053 struct hda_input_mux *imux = &spec->private_imux; 16880 struct alc_spec *spec = codec->spec; 16881 struct hda_input_mux *imux = &spec->private_imux[0]; 16054 16882 int i, err, idx; 16055 16883 16056 16884 for (i = 0; i < AUTO_PIN_LAST; i++) { 16057 if (alc880_is_input_pin(cfg->input_pins[i])) { 16058 idx = alc880_input_pin_idx(cfg->input_pins[i]); 16059 err = new_analog_input(spec, cfg->input_pins[i], 16060 auto_pin_cfg_labels[i], 16061 idx, 0x0b); 16062 if (err < 0) 16063 return err; 16064 imux->items[imux->num_items].label = 16065 auto_pin_cfg_labels[i]; 16066 imux->items[imux->num_items].index = 16067 alc880_input_pin_idx(cfg->input_pins[i]); 16068 imux->num_items++; 16885 if (alc662_is_input_pin(codec, cfg->input_pins[i])) { 16886 idx = alc662_input_pin_idx(codec, 0x0b, 16887 cfg->input_pins[i]); 16888 if (idx >= 0) { 16889 err = new_analog_input(spec, cfg->input_pins[i], 16890 auto_pin_cfg_labels[i], 16891 idx, 0x0b); 16892 if (err < 0) 16893 return err; 16894 } 16895 idx = alc662_input_pin_idx(codec, 0x22, 16896 cfg->input_pins[i]); 16897 if (idx >= 0) { 16898 imux->items[imux->num_items].label = 16899 auto_pin_cfg_labels[i]; 16900 imux->items[imux->num_items].index = idx; 16901 imux->num_items++; 16902 } 16069 16903 } 16070 16904 } … … 16116 16950 } 16117 16951 16118 #define alc662_is_input_pin(nid) alc880_is_input_pin(nid)16119 16952 #define ALC662_PIN_CD_NID ALC880_PIN_CD_NID 16120 16953 … … 16126 16959 for (i = 0; i < AUTO_PIN_LAST; i++) { 16127 16960 hda_nid_t nid = spec->autocfg.input_pins[i]; 16128 if (alc662_is_input_pin(nid)) { 16129 snd_hda_codec_write(codec, nid, 0, 16130 AC_VERB_SET_PIN_WIDGET_CONTROL, 16131 (i <= AUTO_PIN_FRONT_MIC ? 16132 PIN_VREF80 : PIN_IN)); 16133 if (nid != ALC662_PIN_CD_NID) 16961 if (alc662_is_input_pin(codec, nid)) { 16962 alc_set_input_pin(codec, nid, i); 16963 if (nid != ALC662_PIN_CD_NID && 16964 (get_wcaps(codec, nid) & AC_WCAP_OUT_AMP)) 16134 16965 snd_hda_codec_write(codec, nid, 0, 16135 16966 AC_VERB_SET_AMP_GAIN_MUTE, … … 16169 17000 if (err < 0) 16170 17001 return err; 16171 err = alc662_auto_create_analog_input_ctls( spec, &spec->autocfg);17002 err = alc662_auto_create_analog_input_ctls(codec, &spec->autocfg); 16172 17003 if (err < 0) 16173 17004 return err; … … 16175 17006 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 16176 17007 16177 if (spec->autocfg.dig_out _pin)17008 if (spec->autocfg.dig_outs) 16178 17009 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; 16179 17010 … … 16182 17013 16183 17014 spec->num_mux_defs = 1; 16184 spec->input_mux = &spec->private_imux ;17015 spec->input_mux = &spec->private_imux[0]; 16185 17016 16186 17017 add_verb(spec, alc662_auto_init_verbs); … … 16192 17023 return err; 16193 17024 16194 store_pin_configs(codec);16195 17025 return 1; 16196 17026 } … … 16244 17074 } 16245 17075 17076 err = snd_hda_attach_beep_device(codec, 0x1); 17077 if (err < 0) { 17078 alc_free(codec); 17079 return err; 17080 } 17081 16246 17082 if (board_config != ALC662_AUTO) 16247 17083 setup_preset(spec, &alc662_presets[board_config]); … … 16267 17103 spec->num_adc_nids = ARRAY_SIZE(alc662_adc_nids); 16268 17104 spec->capsrc_nids = alc662_capsrc_nids; 16269 spec-> is_mix_capture = 1;17105 spec->capture_style = CAPT_MIX; 16270 17106 16271 17107 if (!spec->cap_mixer) 16272 17108 set_capture_mixer(spec); 17109 if (codec->vendor_id == 0x10ec0662) 17110 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 17111 else 17112 set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); 16273 17113 16274 17114 spec->vmaster_nid = 0x02; … … 16281 17121 spec->loopback.amplist = alc662_loopbacks; 16282 17122 #endif 17123 codec->proc_widget_hook = print_realtek_coef; 16283 17124 16284 17125 return 0; … … 16288 17129 * patch entries 16289 17130 */ 16290 st ruct hda_codec_preset snd_hda_preset_realtek[] = {17131 static struct hda_codec_preset snd_hda_preset_realtek[] = { 16291 17132 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, 16292 17133 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, … … 16314 17155 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 16315 17156 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, 16316 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },16317 17157 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", 16318 17158 .patch = patch_alc883 }, 17159 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, 16319 17160 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, 16320 17161 {0} /* terminator */ 16321 17162 }; 17163 17164 MODULE_ALIAS("snd-hda-codec-id:10ec*"); 17165 17166 MODULE_LICENSE("GPL"); 17167 MODULE_DESCRIPTION("Realtek HD-audio codec"); 17168 17169 static struct hda_codec_preset_list realtek_list = { 17170 .preset = snd_hda_preset_realtek, 17171 .owner = THIS_MODULE, 17172 }; 17173 17174 static int __init patch_realtek_init(void) 17175 { 17176 return snd_hda_add_codec_preset(&realtek_list); 17177 } 17178 17179 static void __exit patch_realtek_exit(void) 17180 { 17181 snd_hda_delete_codec_preset(&realtek_list); 17182 } 17183 17184 module_init(patch_realtek_init) 17185 module_exit(patch_realtek_exit) -
GPL/trunk/alsa-kernel/pci/hda/patch_si3054.c
r417 r426 29 29 #include "hda_codec.h" 30 30 #include "hda_local.h" 31 #include "hda_patch.h"32 31 33 32 /* si3054 verbs */ … … 284 283 * patch entries 285 284 */ 286 st ruct hda_codec_preset snd_hda_preset_si3054[] = {285 static struct hda_codec_preset snd_hda_preset_si3054[] = { 287 286 { .id = 0x163c3055, .name = "Si3054", .patch = patch_si3054 }, 288 287 { .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 }, … … 302 301 }; 303 302 303 MODULE_ALIAS("snd-hda-codec-id:163c3055"); 304 MODULE_ALIAS("snd-hda-codec-id:163c3155"); 305 MODULE_ALIAS("snd-hda-codec-id:11c13026"); 306 MODULE_ALIAS("snd-hda-codec-id:11c13055"); 307 MODULE_ALIAS("snd-hda-codec-id:11c13155"); 308 MODULE_ALIAS("snd-hda-codec-id:10573055"); 309 MODULE_ALIAS("snd-hda-codec-id:10573057"); 310 MODULE_ALIAS("snd-hda-codec-id:10573155"); 311 MODULE_ALIAS("snd-hda-codec-id:11063288"); 312 MODULE_ALIAS("snd-hda-codec-id:15433155"); 313 MODULE_ALIAS("snd-hda-codec-id:18540018"); 314 315 MODULE_LICENSE("GPL"); 316 MODULE_DESCRIPTION("Si3054 HD-audio modem codec"); 317 318 static struct hda_codec_preset_list si3054_list = { 319 .preset = snd_hda_preset_si3054, 320 .owner = THIS_MODULE, 321 }; 322 323 static int __init patch_si3054_init(void) 324 { 325 return snd_hda_add_codec_preset(&si3054_list); 326 } 327 328 static void __exit patch_si3054_exit(void) 329 { 330 snd_hda_delete_codec_preset(&si3054_list); 331 } 332 333 module_init(patch_si3054_init) 334 module_exit(patch_si3054_exit) -
GPL/trunk/alsa-kernel/pci/hda/patch_sigmatel.c
r417 r426 34 34 #include "hda_codec.h" 35 35 #include "hda_local.h" 36 #include "hda_patch.h"37 36 #include "hda_beep.h" 38 37 39 #define STAC_INSERT_EVENT 0x1040 #define STAC_PWR_EVENT 0x2041 #define STAC_HP_EVENT 0x3042 #define STAC_VREF_EVENT 0x4043 44 38 enum { 39 STAC_VREF_EVENT = 1, 40 STAC_INSERT_EVENT, 41 STAC_PWR_EVENT, 42 STAC_HP_EVENT, 43 }; 44 45 enum { 46 STAC_AUTO, 45 47 STAC_REF, 46 48 STAC_9200_OQO, … … 55 57 STAC_9200_DELL_M26, 56 58 STAC_9200_DELL_M27, 57 STAC_9200_GATEWAY, 59 STAC_9200_M4, 60 STAC_9200_M4_2, 58 61 STAC_9200_PANASONIC, 59 62 STAC_9200_MODELS … … 61 64 62 65 enum { 66 STAC_9205_AUTO, 63 67 STAC_9205_REF, 64 68 STAC_9205_DELL_M42, 65 69 STAC_9205_DELL_M43, 66 70 STAC_9205_DELL_M44, 71 STAC_9205_EAPD, 67 72 STAC_9205_MODELS 68 73 }; 69 74 70 75 enum { 76 STAC_92HD73XX_AUTO, 77 STAC_92HD73XX_NO_JD, /* no jack-detection */ 71 78 STAC_92HD73XX_REF, 72 STAC_DELL_M6, 79 STAC_DELL_M6_AMIC, 80 STAC_DELL_M6_DMIC, 81 STAC_DELL_M6_BOTH, 73 82 STAC_DELL_EQ, 74 83 STAC_92HD73XX_MODELS … … 76 85 77 86 enum { 87 STAC_92HD83XXX_AUTO, 78 88 STAC_92HD83XXX_REF, 89 STAC_92HD83XXX_PWR_REF, 90 STAC_DELL_S14, 79 91 STAC_92HD83XXX_MODELS 80 92 }; 81 93 82 94 enum { 95 STAC_92HD71BXX_AUTO, 83 96 STAC_92HD71BXX_REF, 84 97 STAC_DELL_M4_1, 85 98 STAC_DELL_M4_2, 99 STAC_DELL_M4_3, 86 100 STAC_HP_M4, 101 STAC_HP_DV5, 102 STAC_HP_HDX, 87 103 STAC_92HD71BXX_MODELS 88 104 }; 89 105 90 106 enum { 107 STAC_925x_AUTO, 91 108 STAC_925x_REF, 109 STAC_M1, 110 STAC_M1_2, 111 STAC_M2, 92 112 STAC_M2_2, 93 STAC_MA6, 94 STAC_PA6, 113 STAC_M3, 114 STAC_M5, 115 STAC_M6, 95 116 STAC_925x_MODELS 96 117 }; 97 118 98 119 enum { 120 STAC_922X_AUTO, 99 121 STAC_D945_REF, 100 122 STAC_D945GTP3, … … 124 146 125 147 enum { 148 STAC_927X_AUTO, 149 STAC_D965_REF_NO_JD, /* no jack-detection */ 126 150 STAC_D965_REF, 127 151 STAC_D965_3ST, … … 132 156 }; 133 157 158 enum { 159 STAC_9872_AUTO, 160 STAC_9872_VAIO, 161 STAC_9872_MODELS 162 }; 163 134 164 struct sigmatel_event { 135 165 hda_nid_t nid; 166 unsigned char type; 167 unsigned char tag; 136 168 int data; 137 169 }; … … 148 180 149 181 int board_config; 182 unsigned int eapd_switch: 1; 150 183 unsigned int surr_switch: 1; 151 unsigned int line_switch: 1;152 unsigned int mic_switch: 1;153 184 unsigned int alt_switch: 1; 154 185 unsigned int hp_detect: 1; 155 186 unsigned int spdif_mute: 1; 187 unsigned int check_volume_offset:1; 156 188 157 189 /* gpio lines */ … … 166 198 167 199 /* analog loopback */ 200 struct snd_kcontrol_new *aloopback_ctl; 168 201 unsigned char aloopback_mask; 169 202 unsigned char aloopback_shift; … … 187 220 struct hda_multi_out multiout; 188 221 hda_nid_t dac_nids[5]; 222 hda_nid_t hp_dacs[5]; 223 hda_nid_t speaker_dacs[5]; 224 225 int volume_offset; 189 226 190 227 /* capture */ … … 209 246 hda_nid_t *pin_nids; 210 247 unsigned int num_pins; 211 unsigned int *pin_configs;212 unsigned int *bios_pin_configs;213 248 214 249 /* codec specific stuff */ … … 231 266 unsigned int io_switch[2]; 232 267 unsigned int clfe_swap; 233 unsigned int hp_switch; 268 hda_nid_t line_switch; /* shared line-in for input and output */ 269 hda_nid_t mic_switch; /* shared mic-in for input and output */ 270 hda_nid_t hp_switch; /* NID of HP as line-out */ 234 271 unsigned int aloopback; 235 272 … … 282 319 283 320 #define STAC92HD73_DAC_COUNT 5 284 static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = {285 0x15, 0x16, 0x17, 0x18, 0x19,286 };287 321 288 322 static hda_nid_t stac92hd73xx_mux_nids[4] = { … … 303 337 }; 304 338 305 #define STAC92HD81_DAC_COUNT 2306 339 #define STAC92HD83_DAC_COUNT 3 307 static hda_nid_t stac92hd83xxx_dac_nids[STAC92HD73_DAC_COUNT] = {308 0x13, 0x14, 0x22,309 };310 340 311 341 static hda_nid_t stac92hd83xxx_dmux_nids[2] = { … … 326 356 327 357 static unsigned int stac92hd83xxx_pwr_mapping[4] = { 328 0x03, 0x0c, 0x10, 0x40, 358 0x03, 0x0c, 0x20, 0x40, 359 }; 360 361 static hda_nid_t stac92hd83xxx_amp_nids[1] = { 362 0xc, 329 363 }; 330 364 … … 347 381 static hda_nid_t stac92hd71bxx_smux_nids[2] = { 348 382 0x24, 0x25, 349 };350 351 static hda_nid_t stac92hd71bxx_dac_nids[1] = {352 0x10, /*0x11, */353 383 }; 354 384 … … 389 419 static hda_nid_t stac922x_mux_nids[2] = { 390 420 0x12, 0x13, 421 }; 422 423 static hda_nid_t stac927x_slave_dig_outs[2] = { 424 0x1f, 0, 391 425 }; 392 426 … … 463 497 }; 464 498 465 static hda_nid_t stac92hd83xxx_pin_nids[1 4] = {499 static hda_nid_t stac92hd83xxx_pin_nids[10] = { 466 500 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 467 0x0f, 0x10, 0x11, 0x12, 0x13, 468 0x1d, 0x1e, 0x1f, 0x20 469 }; 470 static hda_nid_t stac92hd71bxx_pin_nids[11] = { 501 0x0f, 0x10, 0x11, 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 509 }; 510 static hda_nid_t stac92hd71bxx_pin_nids_6port[STAC92HD71BXX_NUM_PINS] = { 471 511 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 472 512 0x0f, 0x14, 0x18, 0x19, 0x1e, 473 0x1f, 513 0x1f, 0x20, 0x27 474 514 }; 475 515 … … 584 624 nid = codec->slave_dig_outs[smux_idx - 1]; 585 625 if (spec->cur_smux[smux_idx] == smux->num_items - 1) 586 val = AMP_OUT_MUTE;626 val = HDA_AMP_MUTE; 587 627 else 588 val = AMP_OUT_UNMUTE;628 val = 0; 589 629 /* un/mute SPDIF out */ 590 snd_hda_codec_ write_cache(codec, nid, 0,591 AC_VERB_SET_AMP_GAIN_MUTE, val);630 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0, 631 HDA_AMP_MUTE, val); 592 632 } 593 633 return 0; … … 754 794 /* set master volume and direct control */ 755 795 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 756 /* setup audio connections */757 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},758 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},759 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},760 796 /* setup adcs to point to mixer */ 761 797 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 776 812 * and direct control */ 777 813 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, 778 /* setup audio connections */779 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},780 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x02},781 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01},782 814 /* setup adcs to point to mixer */ 783 815 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 793 825 static struct hda_verb dell_m6_core_init[] = { 794 826 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 795 /* setup audio connections */796 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00},797 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},798 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02},799 827 /* setup adcs to point to mixer */ 800 828 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 811 839 /* set master volume and direct control */ 812 840 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 813 /* setup audio connections */814 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00},815 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01},816 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02},817 /* connect hp ports to dac3 */818 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03},819 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03},820 841 /* setup adcs to point to mixer */ 821 842 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 835 856 /* set master volume and direct control */ 836 857 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 837 /* setup audio connections */838 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 },839 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 },840 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 },841 858 /* dac3 is connected to import3 mux */ 842 859 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f}, 843 /* connect hp ports to dac4 */844 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04},845 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04},846 860 /* setup adcs to point to mixer */ 847 861 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 859 873 860 874 static struct hda_verb stac92hd83xxx_core_init[] = { 861 /* start of config #1 */ 862 { 0xe, AC_VERB_SET_CONNECT_SEL, 0x3}, 863 864 /* start of config #2 */ 865 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x0}, 866 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x0}, 867 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x1}, 875 { 0xa, AC_VERB_SET_CONNECT_SEL, 0x1}, 876 { 0xb, AC_VERB_SET_CONNECT_SEL, 0x1}, 877 { 0xd, AC_VERB_SET_CONNECT_SEL, 0x0}, 868 878 869 879 /* power state controls amps */ 870 880 { 0x01, AC_VERB_SET_EAPD, 1 << 2}, 881 {0} 871 882 }; 872 883 … … 874 885 /* set master volume and direct control */ 875 886 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 876 /* connect headphone jack to dac1 */ 877 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, 878 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ 879 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 880 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 881 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 882 }; 883 884 #define HD_DISABLE_PORTF 2 887 {0} 888 }; 889 890 #define HD_DISABLE_PORTF 1 885 891 static struct hda_verb stac92hd71bxx_analog_core_init[] = { 886 892 /* start of config #1 */ … … 888 894 /* connect port 0f to audio mixer */ 889 895 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, 890 /* unmute right and left channels for node 0x0f */891 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},892 896 /* start of config #2 */ 893 897 894 898 /* set master volume and direct control */ 895 899 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 896 /* connect headphone jack to dac1 */ 897 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, 898 /* unmute right and left channels for nodes 0x0a, 0xd */ 900 {0} 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)}, 899 906 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 900 907 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, … … 905 912 /* set dac0mux for dac converter */ 906 913 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, 914 /* mute the master volume */ 915 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 907 916 {0} 908 917 }; … … 975 984 } 976 985 977 #define STAC_INPUT_SOURCE(cnt) \978 { \979 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \980 .name = "Input Source", \981 .count = cnt, \982 .info = stac92xx_mux_enum_info, \983 .get = stac92xx_mux_enum_get, \984 .put = stac92xx_mux_enum_put, \985 }986 987 986 #define STAC_ANALOG_LOOPBACK(verb_read, verb_write, cnt) \ 988 987 { \ … … 999 998 HDA_CODEC_VOLUME("Master Playback Volume", 0xb, 0, HDA_OUTPUT), 1000 999 HDA_CODEC_MUTE("Master Playback Switch", 0xb, 0, HDA_OUTPUT), 1001 STAC_INPUT_SOURCE(1),1002 1000 HDA_CODEC_VOLUME("Capture Volume", 0x0a, 0, HDA_OUTPUT), 1003 1001 HDA_CODEC_MUTE("Capture Switch", 0x0a, 0, HDA_OUTPUT), … … 1024 1022 HDA_CODEC_MUTE("DAC Mixer Capture Switch", 0x1d, 0x3, HDA_INPUT), 1025 1023 1026 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3),1027 1028 1024 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), 1029 1025 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), … … 1035 1031 }; 1036 1032 1033 static struct snd_kcontrol_new stac92hd73xx_6ch_loopback[] = { 1034 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 3), 1035 {0} 1036 }; 1037 1038 static struct snd_kcontrol_new stac92hd73xx_8ch_loopback[] = { 1039 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4), 1040 {0} 1041 }; 1042 1043 static struct snd_kcontrol_new stac92hd73xx_10ch_loopback[] = { 1044 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5), 1045 {0} 1046 }; 1047 1037 1048 static struct snd_kcontrol_new stac92hd73xx_8ch_mixer[] = { 1038 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 4),1039 1040 1049 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), 1041 1050 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), … … 1062 1071 1063 1072 static struct snd_kcontrol_new stac92hd73xx_10ch_mixer[] = { 1064 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A1, 5),1065 1066 1073 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x20, 0x0, HDA_OUTPUT), 1067 1074 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x20, 0x0, HDA_OUTPUT), … … 1095 1102 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT), 1096 1103 1097 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0 , HDA_INPUT),1098 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0 , HDA_INPUT),1099 1100 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x 1, HDA_INPUT),1101 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x 1, HDA_INPUT),1102 1103 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x 2, HDA_INPUT),1104 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x 2, HDA_INPUT),1105 1106 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x 3, HDA_INPUT),1107 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x 3, HDA_INPUT),1104 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0x3, HDA_INPUT), 1105 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0x3, HDA_INPUT), 1106 1107 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x4, HDA_INPUT), 1108 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x4, HDA_INPUT), 1109 1110 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x0, HDA_INPUT), 1111 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x0, HDA_INPUT), 1112 1113 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x2, HDA_INPUT), 1114 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x2, HDA_INPUT), 1108 1115 1109 1116 /* 1110 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x 4, HDA_INPUT),1111 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x 4, HDA_INPUT),1117 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x1, HDA_INPUT), 1118 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x1, HDA_INPUT), 1112 1119 */ 1113 1120 {0} /* end */ … … 1115 1122 1116 1123 static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { 1117 STAC_INPUT_SOURCE(2),1118 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),1119 1120 1124 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), 1121 1125 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), … … 1143 1147 }; 1144 1148 1149 static struct snd_kcontrol_new stac92hd71bxx_loopback[] = { 1150 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2) 1151 }; 1152 1145 1153 static struct snd_kcontrol_new stac92hd71bxx_mixer[] = { 1146 STAC_INPUT_SOURCE(2),1147 STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),1148 1149 1154 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), 1150 1155 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), … … 1156 1161 1157 1162 static struct snd_kcontrol_new stac925x_mixer[] = { 1158 STAC_INPUT_SOURCE(1), 1163 HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT), 1164 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT), 1159 1165 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), 1160 1166 HDA_CODEC_MUTE("Capture Switch", 0x14, 0, HDA_OUTPUT), … … 1163 1169 1164 1170 static struct snd_kcontrol_new stac9205_mixer[] = { 1165 STAC_INPUT_SOURCE(2),1166 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1),1167 1168 1171 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1b, 0x0, HDA_INPUT), 1169 1172 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1d, 0x0, HDA_OUTPUT), … … 1174 1177 }; 1175 1178 1179 static struct snd_kcontrol_new stac9205_loopback[] = { 1180 STAC_ANALOG_LOOPBACK(0xFE0, 0x7E0, 1), 1181 {0} 1182 }; 1183 1176 1184 /* This needs to be generated dynamically based on sequence */ 1177 1185 static struct snd_kcontrol_new stac922x_mixer[] = { 1178 STAC_INPUT_SOURCE(2),1179 1186 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x17, 0x0, HDA_INPUT), 1180 1187 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x17, 0x0, HDA_INPUT), … … 1187 1194 1188 1195 static struct snd_kcontrol_new stac927x_mixer[] = { 1189 STAC_INPUT_SOURCE(3),1190 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1),1191 1192 1196 HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x18, 0x0, HDA_INPUT), 1193 1197 HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1b, 0x0, HDA_OUTPUT), … … 1199 1203 HDA_CODEC_MUTE_IDX("Capture Switch", 0x2, 0x1d, 0x0, HDA_OUTPUT), 1200 1204 {0} /* end */ 1205 }; 1206 1207 static struct snd_kcontrol_new stac927x_loopback[] = { 1208 STAC_ANALOG_LOOPBACK(0xFEB, 0x7EB, 1), 1209 {0} 1201 1210 }; 1202 1211 … … 1226 1235 "Side Playback Volume", 1227 1236 "Headphone Playback Volume", 1228 "Headphone Playback Volume",1229 1237 "Speaker Playback Volume", 1230 "External Speaker Playback Volume",1231 "Speaker2 Playback Volume",1232 1238 NULL 1233 1239 }; … … 1240 1246 "Side Playback Switch", 1241 1247 "Headphone Playback Switch", 1242 "Headphone Playback Switch",1243 1248 "Speaker Playback Switch", 1244 "External Speaker Playback Switch",1245 "Speaker2 Playback Switch",1246 1249 "IEC958 Playback Switch", 1247 1250 NULL … … 1249 1252 1250 1253 static void stac92xx_free_kctls(struct hda_codec *codec); 1254 static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type); 1251 1255 1252 1256 static int stac92xx_build_controls(struct hda_codec *codec) 1253 1257 { 1254 1258 struct sigmatel_spec *spec = codec->spec; 1259 struct auto_pin_cfg *cfg = &spec->autocfg; 1260 hda_nid_t nid; 1255 1261 int err; 1256 1262 int i; … … 1283 1289 } 1284 1290 stac_smux_mixer.count = spec->num_smuxes; 1285 err = snd_ ctl_add(codec->bus->card,1291 err = snd_hda_ctl_add(codec, 1286 1292 snd_ctl_new1(&stac_smux_mixer, codec)); 1287 1293 if (err < 0) … … 1310 1316 snd_hda_set_vmaster_tlv(codec, spec->multiout.dac_nids[0], 1311 1317 HDA_OUTPUT, vmaster_tlv); 1318 /* correct volume offset */ 1319 vmaster_tlv[2] += vmaster_tlv[3] * spec->volume_offset; 1312 1320 err = snd_hda_add_vmaster(codec, "Master Playback Volume", 1313 1321 vmaster_tlv, slave_vols); … … 1322 1330 } 1323 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 1324 1339 stac92xx_free_kctls(codec); /* no longer needed */ 1340 1341 /* create jack input elements */ 1342 if (spec->hp_detect) { 1343 for (i = 0; i < cfg->hp_outs; i++) { 1344 int type = SND_JACK_HEADPHONE; 1345 nid = cfg->hp_pins[i]; 1346 /* jack detection */ 1347 if (cfg->hp_outs == i) 1348 type |= SND_JACK_LINEOUT; 1349 err = stac92xx_add_jack(codec, nid, type); 1350 if (err < 0) 1351 return err; 1352 } 1353 } 1354 for (i = 0; i < cfg->line_outs; i++) { 1355 err = stac92xx_add_jack(codec, cfg->line_out_pins[i], 1356 SND_JACK_LINEOUT); 1357 if (err < 0) 1358 return err; 1359 } 1360 for (i = 0; i < AUTO_PIN_LAST; i++) { 1361 nid = cfg->input_pins[i]; 1362 if (nid) { 1363 err = stac92xx_add_jack(codec, nid, 1364 SND_JACK_MICROPHONE); 1365 if (err < 0) 1366 return err; 1367 } 1368 } 1369 1325 1370 return 0; 1326 1371 } … … 1331 1376 }; 1332 1377 1333 /* 1378 static unsigned int gateway9200_m4_pin_configs[8] = { 1379 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, 1380 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, 1381 }; 1382 static unsigned int gateway9200_m4_2_pin_configs[8] = { 1383 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, 1384 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, 1385 }; 1386 1387 /* 1334 1388 STAC 9200 pin configs for 1335 1389 102801A8 … … 1461 1515 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, 1462 1516 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, 1517 [STAC_9200_M4] = gateway9200_m4_pin_configs, 1518 [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs, 1463 1519 [STAC_9200_PANASONIC] = ref9200_pin_configs, 1464 1520 }; 1465 1521 1466 1522 static const char *stac9200_models[STAC_9200_MODELS] = { 1523 [STAC_AUTO] = "auto", 1467 1524 [STAC_REF] = "ref", 1468 1525 [STAC_9200_OQO] = "oqo", … … 1477 1534 [STAC_9200_DELL_M26] = "dell-m26", 1478 1535 [STAC_9200_DELL_M27] = "dell-m27", 1479 [STAC_9200_GATEWAY] = "gateway", 1536 [STAC_9200_M4] = "gateway-m4", 1537 [STAC_9200_M4_2] = "gateway-m4-2", 1480 1538 [STAC_9200_PANASONIC] = "panasonic", 1481 1539 }; … … 1484 1542 /* SigmaTel reference board */ 1485 1543 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1544 "DFI LanParty", STAC_REF), 1545 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, 1486 1546 "DFI LanParty", STAC_REF), 1487 1547 /* Dell laptops have BIOS problem */ … … 1547 1607 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), 1548 1608 /* Gateway machines needs EAPD to be set on resume */ 1549 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), 1550 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", 1551 STAC_9200_GATEWAY), 1552 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", 1553 STAC_9200_GATEWAY), 1609 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4), 1610 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2), 1611 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2), 1554 1612 /* OQO Mobile */ 1555 1613 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), … … 1562 1620 }; 1563 1621 1564 static unsigned int stac925x_MA6_pin_configs[8] = { 1565 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1566 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, 1567 }; 1568 1569 static unsigned int stac925x_PA6_pin_configs[8] = { 1570 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1571 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, 1622 static unsigned int stac925xM1_pin_configs[8] = { 1623 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1624 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1625 }; 1626 1627 static unsigned int stac925xM1_2_pin_configs[8] = { 1628 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1629 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1630 }; 1631 1632 static unsigned int stac925xM2_pin_configs[8] = { 1633 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1634 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1572 1635 }; 1573 1636 1574 1637 static unsigned int stac925xM2_2_pin_configs[8] = { 1575 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, 1576 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, 1638 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1639 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1640 }; 1641 1642 static unsigned int stac925xM3_pin_configs[8] = { 1643 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1644 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, 1645 }; 1646 1647 static unsigned int stac925xM5_pin_configs[8] = { 1648 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1649 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1650 }; 1651 1652 static unsigned int stac925xM6_pin_configs[8] = { 1653 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1654 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, 1577 1655 }; 1578 1656 1579 1657 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { 1580 1658 [STAC_REF] = ref925x_pin_configs, 1659 [STAC_M1] = stac925xM1_pin_configs, 1660 [STAC_M1_2] = stac925xM1_2_pin_configs, 1661 [STAC_M2] = stac925xM2_pin_configs, 1581 1662 [STAC_M2_2] = stac925xM2_2_pin_configs, 1582 [STAC_MA6] = stac925x_MA6_pin_configs, 1583 [STAC_PA6] = stac925x_PA6_pin_configs, 1663 [STAC_M3] = stac925xM3_pin_configs, 1664 [STAC_M5] = stac925xM5_pin_configs, 1665 [STAC_M6] = stac925xM6_pin_configs, 1584 1666 }; 1585 1667 1586 1668 static const char *stac925x_models[STAC_925x_MODELS] = { 1669 [STAC_925x_AUTO] = "auto", 1587 1670 [STAC_REF] = "ref", 1671 [STAC_M1] = "m1", 1672 [STAC_M1_2] = "m1-2", 1673 [STAC_M2] = "m2", 1588 1674 [STAC_M2_2] = "m2-2", 1589 [STAC_MA6] = "m6", 1590 [STAC_PA6] = "pa6", 1675 [STAC_M3] = "m3", 1676 [STAC_M5] = "m5", 1677 [STAC_M6] = "m6", 1678 }; 1679 1680 static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { 1681 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), 1682 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), 1683 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), 1684 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2), 1685 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), 1686 /* Not sure about the brand name for those */ 1687 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), 1688 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), 1689 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), 1690 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), 1691 {0} /* terminator */ 1591 1692 }; 1592 1693 … … 1594 1695 /* SigmaTel reference board */ 1595 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), 1596 1698 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), 1597 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), 1598 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), 1599 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), 1600 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), 1601 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), 1699 1700 /* Default table for unknown ID */ 1701 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2), 1702 1602 1703 {0} /* terminator */ 1603 1704 }; … … 1619 1720 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { 1620 1721 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, 1621 [STAC_DELL_M6] = dell_m6_pin_configs, 1722 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, 1723 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, 1724 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, 1622 1725 [STAC_DELL_EQ] = dell_m6_pin_configs, 1623 1726 }; 1624 1727 1625 1728 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { 1729 [STAC_92HD73XX_AUTO] = "auto", 1730 [STAC_92HD73XX_NO_JD] = "no-jd", 1626 1731 [STAC_92HD73XX_REF] = "ref", 1627 [STAC_DELL_M6] = "dell-m6", 1732 [STAC_DELL_M6_AMIC] = "dell-m6-amic", 1733 [STAC_DELL_M6_DMIC] = "dell-m6-dmic", 1734 [STAC_DELL_M6_BOTH] = "dell-m6", 1628 1735 [STAC_DELL_EQ] = "dell-eq", 1629 1736 }; … … 1633 1740 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1634 1741 "DFI LanParty", STAC_92HD73XX_REF), 1742 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, 1743 "DFI LanParty", STAC_92HD73XX_REF), 1635 1744 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, 1636 " unknown Dell", STAC_DELL_M6),1745 "Dell Studio 1535", STAC_DELL_M6_DMIC), 1637 1746 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, 1638 "unknown Dell", STAC_DELL_M6 ),1747 "unknown Dell", STAC_DELL_M6_DMIC), 1639 1748 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, 1640 "unknown Dell", STAC_DELL_M6 ),1749 "unknown Dell", STAC_DELL_M6_BOTH), 1641 1750 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, 1642 "unknown Dell", STAC_DELL_M6 ),1751 "unknown Dell", STAC_DELL_M6_BOTH), 1643 1752 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, 1644 "unknown Dell", STAC_DELL_M6 ),1753 "unknown Dell", STAC_DELL_M6_AMIC), 1645 1754 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, 1646 "unknown Dell", STAC_DELL_M6 ),1755 "unknown Dell", STAC_DELL_M6_AMIC), 1647 1756 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, 1648 "unknown Dell", STAC_DELL_M6), 1757 "unknown Dell", STAC_DELL_M6_DMIC), 1758 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272, 1759 "unknown Dell", STAC_DELL_M6_DMIC), 1760 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, 1761 "Dell Studio 1537", STAC_DELL_M6_DMIC), 1762 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0, 1763 "Dell Studio 17", STAC_DELL_M6_DMIC), 1649 1764 {0} /* terminator */ 1650 1765 }; 1651 1766 1652 static unsigned int ref92hd83xxx_pin_configs[1 4] = {1767 static unsigned int ref92hd83xxx_pin_configs[10] = { 1653 1768 0x02214030, 0x02211010, 0x02a19020, 0x02170130, 1654 1769 0x01014050, 0x01819040, 0x01014020, 0x90a3014e, 1655 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x40f000f0,1656 1770 0x01451160, 0x98560170, 1771 }; 1772 1773 static unsigned int dell_s14_pin_configs[10] = { 1774 0x02214030, 0x02211010, 0x02a19020, 0x01014050, 1775 0x40f000f0, 0x01819040, 0x40f000f0, 0x90a60160, 1776 0x40f000f0, 0x40f000f0, 1657 1777 }; 1658 1778 1659 1779 static unsigned int *stac92hd83xxx_brd_tbl[STAC_92HD83XXX_MODELS] = { 1660 1780 [STAC_92HD83XXX_REF] = ref92hd83xxx_pin_configs, 1781 [STAC_92HD83XXX_PWR_REF] = ref92hd83xxx_pin_configs, 1782 [STAC_DELL_S14] = dell_s14_pin_configs, 1661 1783 }; 1662 1784 1663 1785 static const char *stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = { 1786 [STAC_92HD83XXX_AUTO] = "auto", 1664 1787 [STAC_92HD83XXX_REF] = "ref", 1788 [STAC_92HD83XXX_PWR_REF] = "mic-ref", 1789 [STAC_DELL_S14] = "dell-s14", 1665 1790 }; 1666 1791 … … 1668 1793 /* SigmaTel reference board */ 1669 1794 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1670 "DFI LanParty", STAC_92HD71BXX_REF), 1671 }; 1672 1673 static unsigned int ref92hd71bxx_pin_configs[11] = { 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), 1800 {0} /* terminator */ 1801 }; 1802 1803 static unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { 1674 1804 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, 1675 1805 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, 1676 0x90a000f0, 0x01452050, 0x01452050, 1677 }; 1678 1679 static unsigned int dell_m4_1_pin_configs[11] = { 1806 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, 1807 0x00000000 1808 }; 1809 1810 static unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { 1680 1811 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, 1681 1812 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, 1682 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 1683 }; 1684 1685 static unsigned int dell_m4_2_pin_configs[11] = { 1813 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, 1814 0x00000000 1815 }; 1816 1817 static unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { 1686 1818 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, 1687 1819 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, 1688 0x40f000f0, 0x044413b0, 0x044413b0, 1820 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, 1821 0x00000000 1822 }; 1823 1824 static unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { 1825 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, 1826 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, 1827 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, 1828 0x00000000 1689 1829 }; 1690 1830 … … 1693 1833 [STAC_DELL_M4_1] = dell_m4_1_pin_configs, 1694 1834 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 1835 [STAC_DELL_M4_3] = dell_m4_3_pin_configs, 1695 1836 [STAC_HP_M4] = NULL, 1837 [STAC_HP_DV5] = NULL, 1838 [STAC_HP_HDX] = NULL, 1696 1839 }; 1697 1840 1698 1841 static const char *stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { 1842 [STAC_92HD71BXX_AUTO] = "auto", 1699 1843 [STAC_92HD71BXX_REF] = "ref", 1700 1844 [STAC_DELL_M4_1] = "dell-m4-1", 1701 1845 [STAC_DELL_M4_2] = "dell-m4-2", 1846 [STAC_DELL_M4_3] = "dell-m4-3", 1702 1847 [STAC_HP_M4] = "hp-m4", 1848 [STAC_HP_DV5] = "hp-dv5", 1849 [STAC_HP_HDX] = "hp-hdx", 1703 1850 }; 1704 1851 … … 1707 1854 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1708 1855 "DFI LanParty", STAC_92HD71BXX_REF), 1856 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, 1857 "DFI LanParty", STAC_92HD71BXX_REF), 1858 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3080, 1859 "HP", STAC_HP_DV5), 1860 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x30f0, 1861 "HP dv4-7", STAC_HP_DV5), 1862 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x3600, 1863 "HP dv4-7", STAC_HP_DV5), 1864 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3610, 1865 "HP HDX", STAC_HP_HDX), /* HDX18 */ 1709 1866 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, 1710 "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 */ 1711 1870 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, 1712 1871 "unknown Dell", STAC_DELL_M4_1), … … 1731 1890 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, 1732 1891 "unknown Dell", STAC_DELL_M4_2), 1892 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa, 1893 "unknown Dell", STAC_DELL_M4_3), 1733 1894 {0} /* terminator */ 1734 1895 }; … … 1858 2019 1859 2020 static const char *stac922x_models[STAC_922X_MODELS] = { 2021 [STAC_922X_AUTO] = "auto", 1860 2022 [STAC_D945_REF] = "ref", 1861 2023 [STAC_D945GTP5] = "5stack", … … 1884 2046 /* SigmaTel reference board */ 1885 2047 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 2048 "DFI LanParty", STAC_D945_REF), 2049 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, 1886 2050 "DFI LanParty", STAC_D945_REF), 1887 2051 /* Intel 945G based systems */ … … 1938 2102 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, 1939 2103 "Intel D945P", STAC_D945GTP5), 2104 /* other intel */ 2105 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0204, 2106 "Intel D945", STAC_D945_REF), 1940 2107 /* other systems */ 1941 2108 /* Apple Intel Mac (Mac Mini, MacBook, MacBook Pro...) */ … … 1962 2129 "Dell XPS M1210", STAC_922X_DELL_M82), 1963 2130 /* ECS/PC Chips boards */ 1964 SND_PCI_QUIRK(0x1019, 0x2144, 1965 "ECS/PC chips", STAC_ECS_202), 1966 SND_PCI_QUIRK(0x1019, 0x2608, 1967 "ECS/PC chips", STAC_ECS_202), 1968 SND_PCI_QUIRK(0x1019, 0x2633, 1969 "ECS/PC chips P17G/1333", STAC_ECS_202), 1970 SND_PCI_QUIRK(0x1019, 0x2811, 1971 "ECS/PC chips", STAC_ECS_202), 1972 SND_PCI_QUIRK(0x1019, 0x2812, 1973 "ECS/PC chips", STAC_ECS_202), 1974 SND_PCI_QUIRK(0x1019, 0x2813, 1975 "ECS/PC chips", STAC_ECS_202), 1976 SND_PCI_QUIRK(0x1019, 0x2814, 1977 "ECS/PC chips", STAC_ECS_202), 1978 SND_PCI_QUIRK(0x1019, 0x2815, 1979 "ECS/PC chips", STAC_ECS_202), 1980 SND_PCI_QUIRK(0x1019, 0x2816, 1981 "ECS/PC chips", STAC_ECS_202), 1982 SND_PCI_QUIRK(0x1019, 0x2817, 1983 "ECS/PC chips", STAC_ECS_202), 1984 SND_PCI_QUIRK(0x1019, 0x2818, 1985 "ECS/PC chips", STAC_ECS_202), 1986 SND_PCI_QUIRK(0x1019, 0x2819, 1987 "ECS/PC chips", STAC_ECS_202), 1988 SND_PCI_QUIRK(0x1019, 0x2820, 2131 SND_PCI_QUIRK_MASK(0x1019, 0xf000, 0x2000, 1989 2132 "ECS/PC chips", STAC_ECS_202), 1990 2133 {0} /* terminator */ … … 2020 2163 2021 2164 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { 2165 [STAC_D965_REF_NO_JD] = ref927x_pin_configs, 2022 2166 [STAC_D965_REF] = ref927x_pin_configs, 2023 2167 [STAC_D965_3ST] = d965_3st_pin_configs, … … 2028 2172 2029 2173 static const char *stac927x_models[STAC_927X_MODELS] = { 2174 [STAC_927X_AUTO] = "auto", 2175 [STAC_D965_REF_NO_JD] = "ref-no-jd", 2030 2176 [STAC_D965_REF] = "ref", 2031 2177 [STAC_D965_3ST] = "3stack", … … 2039 2185 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 2040 2186 "DFI LanParty", STAC_D965_REF), 2187 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, 2188 "DFI LanParty", STAC_D965_REF), 2041 2189 /* Intel 946 based systems */ 2042 2190 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), 2043 2191 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST), 2044 2192 /* 965 based 3 stack systems */ 2045 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST), 2046 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST), 2047 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST), 2048 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST), 2049 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST), 2050 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST), 2051 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST), 2052 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST), 2053 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST), 2054 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST), 2055 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST), 2056 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST), 2057 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST), 2058 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST), 2059 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST), 2060 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST), 2193 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2100, 2194 "Intel D965", STAC_D965_3ST), 2195 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2000, 2196 "Intel D965", STAC_D965_3ST), 2061 2197 /* Dell 3 stack systems */ 2062 2198 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f7, "Dell XPS M1730", STAC_DELL_3ST), … … 2074 2210 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0209, "Dell XPS 1330", STAC_DELL_BIOS), 2075 2211 /* 965 based 5 stack systems */ 2076 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST), 2077 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST), 2078 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST), 2079 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST), 2080 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST), 2081 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST), 2082 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST), 2083 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST), 2084 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST), 2212 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2300, 2213 "Intel D965", STAC_D965_5ST), 2214 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_INTEL, 0xff00, 0x2500, 2215 "Intel D965", STAC_D965_5ST), 2085 2216 {0} /* terminator */ 2086 2217 }; … … 2135 2266 [STAC_9205_DELL_M43] = dell_9205_m43_pin_configs, 2136 2267 [STAC_9205_DELL_M44] = dell_9205_m44_pin_configs, 2268 [STAC_9205_EAPD] = NULL, 2137 2269 }; 2138 2270 2139 2271 static const char *stac9205_models[STAC_9205_MODELS] = { 2272 [STAC_9205_AUTO] = "auto", 2140 2273 [STAC_9205_REF] = "ref", 2141 2274 [STAC_9205_DELL_M42] = "dell-m42", 2142 2275 [STAC_9205_DELL_M43] = "dell-m43", 2143 2276 [STAC_9205_DELL_M44] = "dell-m44", 2277 [STAC_9205_EAPD] = "eapd", 2144 2278 }; 2145 2279 … … 2148 2282 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 2149 2283 "DFI LanParty", STAC_9205_REF), 2284 SND_PCI_QUIRK(PCI_VENDOR_ID_DFI, 0x3101, 2285 "DFI LanParty", STAC_9205_REF), 2286 /* Dell */ 2150 2287 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01f1, 2151 2288 "unknown Dell", STAC_9205_DELL_M42), … … 2178 2315 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0228, 2179 2316 "Dell Vostro 1500", STAC_9205_DELL_M42), 2317 /* Gateway */ 2318 SND_PCI_QUIRK(0x107b, 0x0565, "Gateway T1616", STAC_9205_EAPD), 2180 2319 {0} /* terminator */ 2181 2320 }; 2182 2321 2183 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) 2184 2324 { 2185 2325 int i; 2186 2326 struct sigmatel_spec *spec = codec->spec; 2187 2188 if (! spec->bios_pin_configs) { 2189 spec->bios_pin_configs = kcalloc(spec->num_pins, 2190 sizeof(*spec->bios_pin_configs), GFP_KERNEL); 2191 if (! spec->bios_pin_configs) 2192 return -ENOMEM; 2193 } 2194 2195 for (i = 0; i < spec->num_pins; i++) { 2196 hda_nid_t nid = spec->pin_nids[i]; 2197 unsigned int pin_cfg; 2198 2199 pin_cfg = snd_hda_codec_read(codec, nid, 0, 2200 AC_VERB_GET_CONFIG_DEFAULT, 0x00); 2201 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", 2202 nid, pin_cfg); 2203 spec->bios_pin_configs[i] = pin_cfg; 2204 } 2205 2206 return 0; 2207 } 2208 2209 static void stac92xx_set_config_reg(struct hda_codec *codec, 2210 hda_nid_t pin_nid, unsigned int pin_config) 2211 { 2212 int i; 2213 snd_hda_codec_write(codec, pin_nid, 0, 2214 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, 2215 pin_config & 0x000000ff); 2216 snd_hda_codec_write(codec, pin_nid, 0, 2217 AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 2218 (pin_config & 0x0000ff00) >> 8); 2219 snd_hda_codec_write(codec, pin_nid, 0, 2220 AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 2221 (pin_config & 0x00ff0000) >> 16); 2222 snd_hda_codec_write(codec, pin_nid, 0, 2223 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 2224 pin_config >> 24); 2225 i = snd_hda_codec_read(codec, pin_nid, 0, 2226 AC_VERB_GET_CONFIG_DEFAULT, 2227 0x00); 2228 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", 2229 pin_nid, i); 2230 } 2231 2232 static void stac92xx_set_config_regs(struct hda_codec *codec) 2233 { 2234 int i; 2235 struct sigmatel_spec *spec = codec->spec; 2236 2237 if (!spec->pin_configs) 2238 return; 2327 2328 if (!pincfgs) 2329 return; 2239 2330 2240 2331 for (i = 0; i < spec->num_pins; i++) 2241 stac92xx_set_config_reg(codec, spec->pin_nids[i], 2242 spec->pin_configs[i]); 2332 if (spec->pin_nids[i] && pincfgs[i]) 2333 snd_hda_codec_set_pincfg(codec, spec->pin_nids[i], 2334 pincfgs[i]); 2243 2335 } 2244 2336 … … 2303 2395 return snd_hda_multi_out_dig_prepare(codec, &spec->multiout, 2304 2396 stream_tag, format, substream); 2397 } 2398 2399 static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, 2400 struct hda_codec *codec, 2401 struct snd_pcm_substream *substream) 2402 { 2403 struct sigmatel_spec *spec = codec->spec; 2404 return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout); 2305 2405 } 2306 2406 … … 2320 2420 if (spec->powerdown_adcs) { 2321 2421 msleep(40); 2322 snd_hda_codec_write _cache(codec, nid, 0,2422 snd_hda_codec_write(codec, nid, 0, 2323 2423 AC_VERB_SET_POWER_STATE, AC_PWRST_D0); 2324 2424 } … … 2336 2436 snd_hda_codec_cleanup_stream(codec, nid); 2337 2437 if (spec->powerdown_adcs) 2338 snd_hda_codec_write _cache(codec, nid, 0,2438 snd_hda_codec_write(codec, nid, 0, 2339 2439 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 2340 2440 return 0; … … 2349 2449 .open = stac92xx_dig_playback_pcm_open, 2350 2450 .close = stac92xx_dig_playback_pcm_close, 2351 .prepare = stac92xx_dig_playback_pcm_prepare 2451 .prepare = stac92xx_dig_playback_pcm_prepare, 2452 .cleanup = stac92xx_dig_playback_pcm_cleanup 2352 2453 }, 2353 2454 }; … … 2404 2505 info->name = "STAC92xx Analog"; 2405 2506 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; 2507 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 2508 spec->multiout.dac_nids[0]; 2406 2509 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; 2407 2510 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; … … 2419 2522 info++; 2420 2523 info->name = "STAC92xx Digital"; 2421 info->pcm_type = HDA_PCM_TYPE_SPDIF;2524 info->pcm_type = spec->autocfg.dig_out_type[0]; 2422 2525 if (spec->multiout.dig_out_nid) { 2423 2526 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_digital_playback; … … 2435 2538 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) 2436 2539 { 2437 unsigned int pincap = snd_hda_param_read(codec, nid, 2438 AC_PAR_PIN_CAP); 2540 unsigned int pincap = snd_hda_query_pin_caps(codec, nid); 2439 2541 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; 2440 2542 if (pincap & AC_PINCAP_VREF_100) … … 2464 2566 struct sigmatel_spec *spec = codec->spec; 2465 2567 2466 ucontrol->value.integer.value[0] = spec->hp_switch;2568 ucontrol->value.integer.value[0] = !!spec->hp_switch; 2467 2569 return 0; 2468 2570 } 2571 2572 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, 2573 unsigned char type); 2469 2574 2470 2575 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, … … 2473 2578 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2474 2579 struct sigmatel_spec *spec = codec->spec; 2475 struct auto_pin_cfg *cfg = &spec->autocfg; 2476 int nid = cfg->hp_pins[cfg->hp_outs - 1]; 2477 2478 spec->hp_switch = ucontrol->value.integer.value[0]; 2580 int nid = kcontrol->private_value; 2581 2582 spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; 2479 2583 2480 2584 /* check to be sure that the ports are upto date with 2481 2585 * switch changes 2482 2586 */ 2483 codec->patch_ops.unsol_event(codec, (STAC_HP_EVENT | nid) << 26);2587 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); 2484 2588 2485 2589 return 1; … … 2521 2625 */ 2522 2626 if (spec->hp_detect) 2523 codec->patch_ops.unsol_event(codec, 2524 (STAC_HP_EVENT | nid) << 26); 2627 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); 2525 2628 2526 2629 return 1; … … 2610 2713 2611 2714 /* add dynamic controls */ 2612 static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, 2613 int idx, const char *name, unsigned long val) 2715 static struct snd_kcontrol_new * 2716 stac_control_new(struct sigmatel_spec *spec, 2717 struct snd_kcontrol_new *ktemp, 2718 const char *name) 2614 2719 { 2615 2720 struct snd_kcontrol_new *knew; … … 2618 2723 knew = snd_array_new(&spec->kctls); 2619 2724 if (!knew) 2725 return NULL; 2726 *knew = *ktemp; 2727 knew->name = kstrdup(name, GFP_KERNEL); 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) 2620 2744 return -ENOMEM; 2621 *knew = stac92xx_control_templates[type];2622 2745 knew->index = idx; 2623 knew->name = kstrdup(name, GFP_KERNEL);2624 if (! knew->name)2625 return -ENOMEM;2626 2746 knew->private_value = val; 2627 2747 return 0; 2628 2748 } 2629 2749 2750 static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec, 2751 int type, int idx, const char *name, 2752 unsigned long val) 2753 { 2754 return stac92xx_add_control_temp(spec, 2755 &stac92xx_control_templates[type], 2756 idx, name, val); 2757 } 2758 2630 2759 2631 2760 /* add dynamic controls */ 2632 static in t stac92xx_add_control(struct sigmatel_spec *spec, int type,2633 const char *name, unsigned long val)2761 static inline int stac92xx_add_control(struct sigmatel_spec *spec, int type, 2762 const char *name, unsigned long val) 2634 2763 { 2635 2764 return stac92xx_add_control_idx(spec, type, 0, name, val); 2636 2765 } 2637 2766 2638 /* flag inputs as additional dynamic lineouts */ 2639 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) 2640 { 2641 struct sigmatel_spec *spec = codec->spec; 2642 unsigned int wcaps, wtype; 2643 int i, num_dacs = 0; 2644 2645 /* use the wcaps cache to count all DACs available for line-outs */ 2646 for (i = 0; i < codec->num_nodes; i++) { 2647 wcaps = codec->wcaps[i]; 2648 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 2649 2650 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL)) 2651 num_dacs++; 2652 } 2653 2654 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs); 2655 2656 switch (cfg->line_outs) { 2657 case 3: 2658 /* add line-in as side */ 2659 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) { 2660 cfg->line_out_pins[cfg->line_outs] = 2661 cfg->input_pins[AUTO_PIN_LINE]; 2662 spec->line_switch = 1; 2663 cfg->line_outs++; 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 2790 /* check whether the line-input can be used as line-out */ 2791 static hda_nid_t check_line_out_switch(struct hda_codec *codec) 2792 { 2793 struct sigmatel_spec *spec = codec->spec; 2794 struct auto_pin_cfg *cfg = &spec->autocfg; 2795 hda_nid_t nid; 2796 unsigned int pincap; 2797 2798 if (cfg->line_out_type != AUTO_PIN_LINE_OUT) 2799 return 0; 2800 nid = cfg->input_pins[AUTO_PIN_LINE]; 2801 pincap = snd_hda_query_pin_caps(codec, nid); 2802 if (pincap & AC_PINCAP_OUT) 2803 return nid; 2804 return 0; 2805 } 2806 2807 /* check whether the mic-input can be used as line-out */ 2808 static hda_nid_t check_mic_out_switch(struct hda_codec *codec) 2809 { 2810 struct sigmatel_spec *spec = codec->spec; 2811 struct auto_pin_cfg *cfg = &spec->autocfg; 2812 unsigned int def_conf, pincap; 2813 unsigned int mic_pin; 2814 2815 if (cfg->line_out_type != AUTO_PIN_LINE_OUT) 2816 return 0; 2817 mic_pin = AUTO_PIN_MIC; 2818 for (;;) { 2819 hda_nid_t nid = cfg->input_pins[mic_pin]; 2820 def_conf = snd_hda_codec_get_pincfg(codec, nid); 2821 /* some laptops have an internal analog microphone 2822 * which can't be used as a output */ 2823 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { 2824 pincap = snd_hda_query_pin_caps(codec, nid); 2825 if (pincap & AC_PINCAP_OUT) 2826 return nid; 2664 2827 } 2665 break; 2666 case 2: 2667 /* add line-in as clfe and mic as side */ 2668 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) { 2669 cfg->line_out_pins[cfg->line_outs] = 2670 cfg->input_pins[AUTO_PIN_LINE]; 2671 spec->line_switch = 1; 2672 cfg->line_outs++; 2673 } 2674 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) { 2675 cfg->line_out_pins[cfg->line_outs] = 2676 cfg->input_pins[AUTO_PIN_MIC]; 2677 spec->mic_switch = 1; 2678 cfg->line_outs++; 2679 } 2680 break; 2681 case 1: 2682 /* add line-in as surr and mic as clfe */ 2683 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) { 2684 cfg->line_out_pins[cfg->line_outs] = 2685 cfg->input_pins[AUTO_PIN_LINE]; 2686 spec->line_switch = 1; 2687 cfg->line_outs++; 2688 } 2689 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) { 2690 cfg->line_out_pins[cfg->line_outs] = 2691 cfg->input_pins[AUTO_PIN_MIC]; 2692 spec->mic_switch = 1; 2693 cfg->line_outs++; 2694 } 2695 break; 2696 } 2697 2828 if (mic_pin == AUTO_PIN_MIC) 2829 mic_pin = AUTO_PIN_FRONT_MIC; 2830 else 2831 break; 2832 } 2698 2833 return 0; 2699 2834 } 2700 2701 2835 2702 2836 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) … … 2711 2845 return 0; 2712 2846 } 2847 2848 static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) 2849 { 2850 int i; 2851 if (is_in_dac_nids(spec, nid)) 2852 return 1; 2853 for (i = 0; i < spec->autocfg.hp_outs; i++) 2854 if (spec->hp_dacs[i] == nid) 2855 return 1; 2856 for (i = 0; i < spec->autocfg.speaker_outs; i++) 2857 if (spec->speaker_dacs[i] == nid) 2858 return 1; 2859 return 0; 2860 } 2861 2862 static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid) 2863 { 2864 struct sigmatel_spec *spec = codec->spec; 2865 int j, conn_len; 2866 hda_nid_t conn[HDA_MAX_CONNECTIONS]; 2867 unsigned int wcaps, wtype; 2868 2869 conn_len = snd_hda_get_connections(codec, nid, conn, 2870 HDA_MAX_CONNECTIONS); 2871 for (j = 0; j < conn_len; j++) { 2872 wcaps = get_wcaps(codec, conn[j]); 2873 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 2874 /* we check only analog outputs */ 2875 if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL)) 2876 continue; 2877 /* if this route has a free DAC, assign it */ 2878 if (!check_all_dac_nids(spec, conn[j])) { 2879 if (conn_len > 1) { 2880 /* select this DAC in the pin's input mux */ 2881 snd_hda_codec_write_cache(codec, nid, 0, 2882 AC_VERB_SET_CONNECT_SEL, j); 2883 } 2884 return conn[j]; 2885 } 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 } 2897 return 0; 2898 } 2899 2900 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid); 2901 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid); 2713 2902 2714 2903 /* … … 2719 2908 * and 9202/925x. For those, dac_nids[] must be hard-coded. 2720 2909 */ 2721 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, 2722 struct auto_pin_cfg *cfg) 2723 { 2724 struct sigmatel_spec *spec = codec->spec; 2725 int i, j, conn_len = 0; 2726 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS]; 2727 unsigned int wcaps, wtype; 2910 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) 2911 { 2912 struct sigmatel_spec *spec = codec->spec; 2913 struct auto_pin_cfg *cfg = &spec->autocfg; 2914 int i; 2915 hda_nid_t nid, dac; 2728 2916 2729 2917 for (i = 0; i < cfg->line_outs; i++) { 2730 2918 nid = cfg->line_out_pins[i]; 2731 conn_len = snd_hda_get_connections(codec, nid, conn, 2732 HDA_MAX_CONNECTIONS); 2733 for (j = 0; j < conn_len; j++) { 2734 wcaps = snd_hda_param_read(codec, conn[j], 2735 AC_PAR_AUDIO_WIDGET_CAP); 2736 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 2737 if (wtype != AC_WID_AUD_OUT || 2738 (wcaps & AC_WCAP_DIGITAL)) 2739 continue; 2740 /* conn[j] is a DAC routed to this line-out */ 2741 if (!is_in_dac_nids(spec, conn[j])) 2742 break; 2743 } 2744 2745 if (j == conn_len) { 2919 dac = get_unassigned_dac(codec, nid); 2920 if (!dac) { 2746 2921 if (spec->multiout.num_dacs > 0) { 2747 2922 /* we have already working output pins, … … 2757 2932 return -ENODEV; 2758 2933 } 2759 2760 spec->multiout.dac_nids[i] = conn[j]; 2761 spec->multiout.num_dacs++; 2762 if (conn_len > 1) { 2763 /* select this DAC in the pin's input mux */ 2764 snd_hda_codec_write_cache(codec, nid, 0, 2765 AC_VERB_SET_CONNECT_SEL, j); 2766 2934 add_spec_dacs(spec, dac); 2935 } 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); 2767 2945 } 2768 } 2769 2770 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", 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 2957 /* add line-in as output */ 2958 nid = check_line_out_switch(codec); 2959 if (nid) { 2960 dac = get_unassigned_dac(codec, nid); 2961 if (dac) { 2962 snd_printdd("STAC: Add line-in 0x%x as output %d\n", 2963 nid, cfg->line_outs); 2964 cfg->line_out_pins[cfg->line_outs] = nid; 2965 cfg->line_outs++; 2966 spec->line_switch = nid; 2967 add_spec_dacs(spec, dac); 2968 } 2969 } 2970 /* add mic as output */ 2971 nid = check_mic_out_switch(codec); 2972 if (nid) { 2973 dac = get_unassigned_dac(codec, nid); 2974 if (dac) { 2975 snd_printdd("STAC: Add mic-in 0x%x as output %d\n", 2976 nid, cfg->line_outs); 2977 cfg->line_out_pins[cfg->line_outs] = nid; 2978 cfg->line_outs++; 2979 spec->mic_switch = nid; 2980 add_spec_dacs(spec, dac); 2981 } 2982 } 2983 2984 snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", 2771 2985 spec->multiout.num_dacs, 2772 2986 spec->multiout.dac_nids[0], … … 2775 2989 spec->multiout.dac_nids[3], 2776 2990 spec->multiout.dac_nids[4]); 2991 2777 2992 return 0; 2778 2993 } 2779 2994 2780 2995 /* create volume control/switch for the given prefx type */ 2781 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs) 2782 { 2996 static int create_controls_idx(struct hda_codec *codec, const char *pfx, 2997 int idx, hda_nid_t nid, int chs) 2998 { 2999 struct sigmatel_spec *spec = codec->spec; 2783 3000 char name[32]; 2784 3001 int err; 2785 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 2786 3020 sprintf(name, "%s Playback Volume", pfx); 2787 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, 2788 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); 3021 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_VOL, idx, name, 3022 HDA_COMPOSE_AMP_VAL_OFS(nid, chs, 0, HDA_OUTPUT, 3023 spec->volume_offset)); 2789 3024 if (err < 0) 2790 3025 return err; 2791 3026 sprintf(name, "%s Playback Switch", pfx); 2792 err = stac92xx_add_control (spec, STAC_CTL_WIDGET_MUTE, name,3027 err = stac92xx_add_control_idx(spec, STAC_CTL_WIDGET_MUTE, idx, name, 2793 3028 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); 2794 3029 if (err < 0) … … 2797 3032 } 2798 3033 3034 #define create_controls(codec, pfx, nid, chs) \ 3035 create_controls_idx(codec, pfx, 0, nid, chs) 3036 2799 3037 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) 2800 3038 { 2801 if (!spec->multiout.hp_nid) 2802 spec->multiout.hp_nid = nid; 2803 else if (spec->multiout.num_dacs > 4) { 3039 if (spec->multiout.num_dacs > 4) { 2804 3040 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); 2805 3041 return 1; … … 2811 3047 } 2812 3048 2813 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) 2814 { 2815 if (is_in_dac_nids(spec, nid)) 2816 return 1; 2817 if (spec->multiout.hp_nid == nid) 2818 return 1; 2819 return 0; 2820 } 2821 2822 /* add playback controls from the parsed DAC table */ 2823 static int stac92xx_auto_create_multi_out_ctls(struct hda_codec *codec, 2824 const struct auto_pin_cfg *cfg) 2825 { 3049 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid) 3050 { 3051 int i; 3052 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) { 3053 if (!spec->multiout.extra_out_nid[i]) { 3054 spec->multiout.extra_out_nid[i] = nid; 3055 return 0; 3056 } 3057 } 3058 printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid); 3059 return 1; 3060 } 3061 3062 /* Create output controls 3063 * The mixer elements are named depending on the given type (AUTO_PIN_XXX_OUT) 3064 */ 3065 static int create_multi_out_ctls(struct hda_codec *codec, int num_outs, 3066 const hda_nid_t *pins, 3067 const hda_nid_t *dac_nids, 3068 int type) 3069 { 3070 struct sigmatel_spec *spec = codec->spec; 2826 3071 static const char *chname[4] = { 2827 3072 "Front", "Surround", NULL /*CLFE*/, "Side" 2828 3073 }; 2829 hda_nid_t nid = 0;3074 hda_nid_t nid; 2830 3075 int i, err; 2831 2832 struct sigmatel_spec *spec = codec->spec; 2833 unsigned int wid_caps, pincap; 2834 2835 2836 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) { 2837 if (!spec->multiout.dac_nids[i]) 3076 unsigned int wid_caps; 3077 3078 for (i = 0; i < num_outs && i < ARRAY_SIZE(chname); i++) { 3079 if (type == AUTO_PIN_HP_OUT && !spec->hp_detect) { 3080 wid_caps = get_wcaps(codec, pins[i]); 3081 if (wid_caps & AC_WCAP_UNSOL_CAP) 3082 spec->hp_detect = 1; 3083 } 3084 nid = dac_nids[i]; 3085 if (!nid) 2838 3086 continue; 2839 2840 nid = spec->multiout.dac_nids[i]; 2841 2842 if (i == 2) { 3087 if (type != AUTO_PIN_HP_OUT && i == 2) { 2843 3088 /* Center/LFE */ 2844 err = create_controls( spec, "Center", nid, 1);3089 err = create_controls(codec, "Center", nid, 1); 2845 3090 if (err < 0) 2846 3091 return err; 2847 err = create_controls( spec, "LFE", nid, 2);3092 err = create_controls(codec, "LFE", nid, 2); 2848 3093 if (err < 0) 2849 3094 return err; … … 2861 3106 2862 3107 } else { 2863 err = create_controls(spec, chname[i], nid, 3); 3108 const char *name; 3109 int idx; 3110 switch (type) { 3111 case AUTO_PIN_HP_OUT: 3112 name = "Headphone"; 3113 idx = i; 3114 break; 3115 case AUTO_PIN_SPEAKER_OUT: 3116 name = "Speaker"; 3117 idx = i; 3118 break; 3119 default: 3120 name = chname[i]; 3121 idx = 0; 3122 break; 3123 } 3124 err = create_controls_idx(codec, name, idx, nid, 3); 2864 3125 if (err < 0) 2865 3126 return err; 2866 3127 } 2867 3128 } 2868 2869 if ((spec->multiout.num_dacs - cfg->line_outs) > 0 && 2870 cfg->hp_outs && !spec->multiout.hp_nid) 2871 spec->multiout.hp_nid = nid; 2872 2873 if (cfg->hp_outs > 1) { 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; 3144 3145 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { 2874 3146 err = stac92xx_add_control(spec, 2875 3147 STAC_CTL_WIDGET_HP_SWITCH, 2876 "Headphone as Line Out Switch", 0); 3148 "Headphone as Line Out Switch", 3149 cfg->hp_pins[cfg->hp_outs - 1]); 2877 3150 if (err < 0) 2878 3151 return err; … … 2880 3153 2881 3154 if (spec->line_switch) { 2882 nid = cfg->input_pins[AUTO_PIN_LINE]; 2883 pincap = snd_hda_param_read(codec, nid, 2884 AC_PAR_PIN_CAP); 2885 if (pincap & AC_PINCAP_OUT) { 2886 err = stac92xx_add_control(spec, 2887 STAC_CTL_WIDGET_IO_SWITCH, 2888 "Line In as Output Switch", nid << 8); 2889 if (err < 0) 2890 return err; 2891 } 3155 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, 3156 "Line In as Output Switch", 3157 spec->line_switch << 8); 3158 if (err < 0) 3159 return err; 2892 3160 } 2893 3161 2894 3162 if (spec->mic_switch) { 2895 unsigned int def_conf; 2896 unsigned int mic_pin = AUTO_PIN_MIC; 2897 again: 2898 nid = cfg->input_pins[mic_pin]; 2899 def_conf = snd_hda_codec_read(codec, nid, 0, 2900 AC_VERB_GET_CONFIG_DEFAULT, 0); 2901 /* some laptops have an internal analog microphone 2902 * which can't be used as a output */ 2903 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { 2904 pincap = snd_hda_param_read(codec, nid, 2905 AC_PAR_PIN_CAP); 2906 if (pincap & AC_PINCAP_OUT) { 2907 err = stac92xx_add_control(spec, 2908 STAC_CTL_WIDGET_IO_SWITCH, 2909 "Mic as Output Switch", (nid << 8) | 1); 2910 nid = snd_hda_codec_read(codec, nid, 0, 2911 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 2912 if (!check_in_dac_nids(spec, nid)) 2913 add_spec_dacs(spec, nid); 2914 if (err < 0) 2915 return err; 2916 } 2917 } else if (mic_pin == AUTO_PIN_MIC) { 2918 mic_pin = AUTO_PIN_FRONT_MIC; 2919 goto again; 2920 } 3163 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, 3164 "Mic as Output Switch", 3165 (spec->mic_switch << 8) | 1); 3166 if (err < 0) 3167 return err; 2921 3168 } 2922 3169 … … 2929 3176 { 2930 3177 struct sigmatel_spec *spec = codec->spec; 2931 hda_nid_t nid; 2932 int i, old_num_dacs, err; 2933 2934 old_num_dacs = spec->multiout.num_dacs; 2935 for (i = 0; i < cfg->hp_outs; i++) { 2936 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); 2937 if (wid_caps & AC_WCAP_UNSOL_CAP) 2938 spec->hp_detect = 1; 2939 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, 2940 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 2941 if (check_in_dac_nids(spec, nid)) 2942 nid = 0; 2943 if (! nid) 2944 continue; 2945 add_spec_dacs(spec, nid); 2946 } 2947 for (i = 0; i < cfg->speaker_outs; i++) { 2948 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0, 2949 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 2950 if (check_in_dac_nids(spec, nid)) 2951 nid = 0; 2952 if (! nid) 2953 continue; 2954 add_spec_dacs(spec, nid); 2955 } 2956 for (i = 0; i < cfg->line_outs; i++) { 2957 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0, 2958 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 2959 if (check_in_dac_nids(spec, nid)) 2960 nid = 0; 2961 if (! nid) 2962 continue; 2963 add_spec_dacs(spec, nid); 2964 } 2965 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) { 2966 static const char *pfxs[] = { 2967 "Speaker", "External Speaker", "Speaker2", 2968 }; 2969 err = create_controls(spec, pfxs[i - old_num_dacs], 2970 spec->multiout.dac_nids[i], 3); 2971 if (err < 0) 2972 return err; 2973 } 2974 if (spec->multiout.hp_nid) { 2975 err = create_controls(spec, "Headphone", 2976 spec->multiout.hp_nid, 3); 2977 if (err < 0) 2978 return err; 2979 } 3178 int err; 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; 2980 3189 2981 3190 return 0; … … 3072 3281 } 3073 3282 3283 #ifdef CONFIG_SND_HDA_INPUT_BEEP 3284 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info 3285 3286 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol, 3287 struct snd_ctl_elem_value *ucontrol) 3288 { 3289 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 3290 ucontrol->value.integer.value[0] = codec->beep->enabled; 3291 return 0; 3292 } 3293 3294 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol, 3295 struct snd_ctl_elem_value *ucontrol) 3296 { 3297 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 3298 int enabled = !!ucontrol->value.integer.value[0]; 3299 if (codec->beep->enabled != enabled) { 3300 codec->beep->enabled = enabled; 3301 return 1; 3302 } 3303 return 0; 3304 } 3305 3306 static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = { 3307 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3308 .info = stac92xx_dig_beep_switch_info, 3309 .get = stac92xx_dig_beep_switch_get, 3310 .put = stac92xx_dig_beep_switch_put, 3311 }; 3312 3313 static int stac92xx_beep_switch_ctl(struct hda_codec *codec) 3314 { 3315 return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl, 3316 0, "PC Beep Playback Switch", 0); 3317 } 3318 #endif 3319 3074 3320 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) 3075 3321 { … … 3150 3396 unsigned int def_conf; 3151 3397 3152 def_conf = snd_hda_codec_read(codec, 3153 spec->dmic_nids[i], 3154 0, 3155 AC_VERB_GET_CONFIG_DEFAULT, 3156 0); 3398 def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]); 3157 3399 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) 3158 3400 continue; … … 3278 3520 { 3279 3521 struct sigmatel_spec *spec = codec->spec; 3522 int hp_swap = 0; 3280 3523 int err; 3281 int hp_speaker_swap = 0;3282 3524 3283 3525 if ((err = snd_hda_parse_pin_def_config(codec, … … 3297 3539 * HP pins as primary outputs. 3298 3540 */ 3541 snd_printdd("stac92xx: Enabling multi-HPs workaround\n"); 3299 3542 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins, 3300 3543 sizeof(spec->autocfg.line_out_pins)); … … 3303 3546 sizeof(spec->autocfg.hp_pins)); 3304 3547 spec->autocfg.line_outs = spec->autocfg.hp_outs; 3305 hp_speaker_swap = 1; 3548 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; 3549 spec->autocfg.hp_outs = 0; 3550 hp_swap = 1; 3306 3551 } 3307 3552 if (spec->autocfg.mono_out_pin) { … … 3355 3600 } 3356 3601 3357 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) 3358 return err; 3359 if (spec->multiout.num_dacs == 0) 3360 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) 3602 if (!spec->multiout.num_dacs) { 3603 err = stac92xx_auto_fill_dac_nids(codec); 3604 if (err < 0) 3361 3605 return err; 3362 3363 err = stac92xx_auto_create_multi_out_ctls(codec,&spec->autocfg);3364 3365 if (err < 0)3366 return err;3606 err = stac92xx_auto_create_multi_out_ctls(codec, 3607 &spec->autocfg); 3608 if (err < 0) 3609 return err; 3610 } 3367 3611 3368 3612 /* setup analog beep controls */ … … 3378 3622 if (spec->digbeep_nid > 0) { 3379 3623 hda_nid_t nid = spec->digbeep_nid; 3624 unsigned int caps; 3380 3625 3381 3626 err = stac92xx_auto_create_beep_ctls(codec, nid); … … 3385 3630 if (err < 0) 3386 3631 return err; 3632 /* if no beep switch is available, make its own one */ 3633 caps = query_amp_caps(codec, nid, HDA_OUTPUT); 3634 if (codec->beep && 3635 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) { 3636 err = stac92xx_beep_switch_ctl(codec); 3637 if (err < 0) 3638 return err; 3639 } 3387 3640 } 3388 3641 #endif 3389 3642 3390 if (hp_speaker_swap == 1) {3391 /* Restore the hp_outs and line_outs */3392 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins,3393 sizeof(spec->autocfg.line_out_pins));3394 spec->autocfg.hp_outs = spec->autocfg.line_outs;3395 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins,3396 sizeof(spec->autocfg.speaker_pins));3397 spec->autocfg.line_outs = spec->autocfg.speaker_outs;3398 memset(spec->autocfg.speaker_pins, 0,3399 sizeof(spec->autocfg.speaker_pins));3400 spec->autocfg.speaker_outs = 0;3401 }3402 3403 3643 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); 3404 3405 3644 if (err < 0) 3406 3645 return err; 3407 3646 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 } 3655 3408 3656 err = stac92xx_auto_create_analog_input_ctls(codec, &spec->autocfg); 3409 3410 3657 if (err < 0) 3411 3658 return err; … … 3436 3683 } 3437 3684 3685 err = stac92xx_add_input_source(spec); 3686 if (err < 0) 3687 return err; 3688 3438 3689 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 3439 3690 if (spec->multiout.max_channels > 2) 3440 3691 spec->surr_switch = 1; 3441 3692 3442 if (spec->autocfg.dig_out _pin)3693 if (spec->autocfg.dig_outs) 3443 3694 spec->multiout.dig_out_nid = dig_out; 3444 3695 if (dig_in && spec->autocfg.dig_in_pin) … … 3449 3700 3450 3701 spec->input_mux = &spec->private_imux; 3451 spec->dinput_mux = &spec->private_dimux; 3702 if (!spec->dinput_mux) 3703 spec->dinput_mux = &spec->private_dimux; 3452 3704 spec->sinput_mux = &spec->private_smux; 3453 3705 spec->mono_mux = &spec->private_mono_mux; … … 3502 3754 hda_nid_t pin = spec->autocfg.line_out_pins[i]; 3503 3755 unsigned int defcfg; 3504 defcfg = snd_hda_codec_read(codec, pin, 0, 3505 AC_VERB_GET_CONFIG_DEFAULT, 3506 0x00); 3756 defcfg = snd_hda_codec_get_pincfg(codec, pin); 3507 3757 if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { 3508 3758 unsigned int wcaps = get_wcaps(codec, pin); … … 3517 3767 3518 3768 if (lfe_pin) { 3519 err = create_controls( spec, "LFE", lfe_pin, 1);3769 err = create_controls(codec, "LFE", lfe_pin, 1); 3520 3770 if (err < 0) 3521 3771 return err; … … 3542 3792 return err; 3543 3793 3544 if (spec->autocfg.dig_out_pin) 3794 if (spec->num_muxes > 0) { 3795 err = stac92xx_auto_create_mux_input_ctls(codec); 3796 if (err < 0) 3797 return err; 3798 } 3799 3800 err = stac92xx_add_input_source(spec); 3801 if (err < 0) 3802 return err; 3803 3804 if (spec->autocfg.dig_outs) 3545 3805 spec->multiout.dig_out_nid = 0x05; 3546 3806 if (spec->autocfg.dig_in_pin) … … 3592 3852 } 3593 3853 3854 #ifdef CONFIG_SND_JACK 3855 static void stac92xx_free_jack_priv(struct snd_jack *jack) 3856 { 3857 struct sigmatel_jack *jacks = jack->private_data; 3858 jacks->nid = 0; 3859 jacks->jack = NULL; 3860 } 3861 #endif 3862 3594 3863 static int stac92xx_add_jack(struct hda_codec *codec, 3595 3864 hda_nid_t nid, int type) 3596 3865 { 3866 #ifdef CONFIG_SND_JACK 3597 3867 struct sigmatel_spec *spec = codec->spec; 3598 3868 struct sigmatel_jack *jack; 3599 int def_conf = snd_hda_codec_read(codec, nid, 3600 0, AC_VERB_GET_CONFIG_DEFAULT, 0); 3869 int def_conf = snd_hda_codec_get_pincfg(codec, nid); 3601 3870 int connectivity = get_defcfg_connect(def_conf); 3602 3871 char name[32]; 3872 int err; 3603 3873 3604 3874 if (connectivity && connectivity != AC_JACK_PORT_FIXED) … … 3617 3887 snd_hda_get_jack_location(def_conf)); 3618 3888 3619 return snd_jack_new(codec->bus->card, name, type, &jack->jack); 3620 } 3621 3622 static int stac92xx_add_event(struct sigmatel_spec *spec, hda_nid_t nid, 3623 int data) 3889 err = snd_jack_new(codec->bus->card, name, type, &jack->jack); 3890 if (err < 0) { 3891 jack->nid = 0; 3892 return err; 3893 } 3894 jack->jack->private_data = jack; 3895 jack->jack->private_free = stac92xx_free_jack_priv; 3896 #endif 3897 return 0; 3898 } 3899 3900 static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, 3901 unsigned char type, int data) 3624 3902 { 3625 3903 struct sigmatel_event *event; … … 3630 3908 return -ENOMEM; 3631 3909 event->nid = nid; 3910 event->type = type; 3911 event->tag = spec->events.used; 3632 3912 event->data = data; 3633 3913 3634 return 0; 3635 } 3636 3637 static int stac92xx_event_data(struct hda_codec *codec, hda_nid_t nid) 3638 { 3639 struct sigmatel_spec *spec = codec->spec; 3640 struct sigmatel_event *events = spec->events.list; 3641 if (events) { 3642 int i; 3643 for (i = 0; i < spec->events.used; i++) 3644 if (events[i].nid == nid) 3645 return events[i].data; 3646 } 3647 return 0; 3914 return event->tag; 3915 } 3916 3917 static struct sigmatel_event *stac_get_event(struct hda_codec *codec, 3918 hda_nid_t nid, unsigned char type) 3919 { 3920 struct sigmatel_spec *spec = codec->spec; 3921 struct sigmatel_event *event = spec->events.list; 3922 int i; 3923 3924 for (i = 0; i < spec->events.used; i++, event++) { 3925 if (event->nid == nid && event->type == type) 3926 return event; 3927 } 3928 return NULL; 3929 } 3930 3931 static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, 3932 unsigned char tag) 3933 { 3934 struct sigmatel_spec *spec = codec->spec; 3935 struct sigmatel_event *event = spec->events.list; 3936 int i; 3937 3938 for (i = 0; i < spec->events.used; i++, event++) { 3939 if (event->tag == tag) 3940 return event; 3941 } 3942 return NULL; 3648 3943 } 3649 3944 3650 3945 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, 3651 unsigned int event) 3652 { 3653 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { 3654 snd_hda_codec_write_cache(codec, nid, 0, 3655 AC_VERB_SET_UNSOLICITED_ENABLE, 3656 (AC_USRSP_EN | event | nid)); 3657 } 3946 unsigned int type) 3947 { 3948 struct sigmatel_event *event; 3949 int tag; 3950 3951 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) 3952 return; 3953 event = stac_get_event(codec, nid, type); 3954 if (event) 3955 tag = event->tag; 3956 else 3957 tag = stac_add_event(codec->spec, nid, type, 0); 3958 if (tag < 0) 3959 return; 3960 snd_hda_codec_write_cache(codec, nid, 0, 3961 AC_VERB_SET_UNSOLICITED_ENABLE, 3962 AC_USRSP_EN | tag); 3658 3963 } 3659 3964 … … 3675 3980 hda_nid_t *dac; 3676 3981 for (dac = spec->dac_list; *dac; dac++) 3677 if (!is_in_dac_nids(spec, *dac) && 3678 spec->multiout.hp_nid != *dac) 3679 snd_hda_codec_write_cache(codec, *dac, 0, 3982 if (!check_all_dac_nids(spec, *dac)) 3983 snd_hda_codec_write(codec, *dac, 0, 3680 3984 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 3681 3985 } 3682 3986 3987 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, 3988 int enable); 3989 3990 /* override some hints from the hwdep entry */ 3991 static void stac_store_hints(struct hda_codec *codec) 3992 { 3993 struct sigmatel_spec *spec = codec->spec; 3994 const char *p; 3995 int val; 3996 3997 val = snd_hda_get_bool_hint(codec, "hp_detect"); 3998 if (val >= 0) 3999 spec->hp_detect = val; 4000 p = snd_hda_get_hint(codec, "gpio_mask"); 4001 if (p) { 4002 spec->gpio_mask = simple_strtoul(p, NULL, 0); 4003 spec->eapd_mask = spec->gpio_dir = spec->gpio_data = 4004 spec->gpio_mask; 4005 } 4006 p = snd_hda_get_hint(codec, "gpio_dir"); 4007 if (p) 4008 spec->gpio_dir = simple_strtoul(p, NULL, 0) & spec->gpio_mask; 4009 p = snd_hda_get_hint(codec, "gpio_data"); 4010 if (p) 4011 spec->gpio_data = simple_strtoul(p, NULL, 0) & spec->gpio_mask; 4012 p = snd_hda_get_hint(codec, "eapd_mask"); 4013 if (p) 4014 spec->eapd_mask = simple_strtoul(p, NULL, 0) & spec->gpio_mask; 4015 val = snd_hda_get_bool_hint(codec, "eapd_switch"); 4016 if (val >= 0) 4017 spec->eapd_switch = val; 4018 } 4019 3683 4020 static int stac92xx_init(struct hda_codec *codec) 3684 4021 { 3685 4022 struct sigmatel_spec *spec = codec->spec; 3686 4023 struct auto_pin_cfg *cfg = &spec->autocfg; 3687 int i, err; 4024 unsigned int gpio; 4025 int i; 3688 4026 3689 4027 snd_hda_sequence_write(codec, spec->init); … … 3692 4030 if (spec->powerdown_adcs) 3693 4031 for (i = 0; i < spec->num_adcs; i++) 3694 snd_hda_codec_write _cache(codec,4032 snd_hda_codec_write(codec, 3695 4033 spec->adc_nids[i], 0, 3696 4034 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 4035 4036 /* override some hints */ 4037 stac_store_hints(codec); 4038 4039 /* set up GPIO */ 4040 gpio = spec->gpio_data; 4041 /* turn on EAPD statically when spec->eapd_switch isn't set. 4042 * otherwise, unsol event will turn it on/off dynamically 4043 */ 4044 if (!spec->eapd_switch) 4045 gpio |= spec->eapd_mask; 4046 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio); 4047 3697 4048 /* set up pins */ 3698 4049 if (spec->hp_detect) { 3699 4050 /* Enable unsolicited responses on the HP widget */ 3700 4051 for (i = 0; i < cfg->hp_outs; i++) { 3701 int type = SND_JACK_HEADPHONE;3702 4052 hda_nid_t nid = cfg->hp_pins[i]; 3703 enable_pin_detect(codec, nid, STAC_HP_EVENT | nid); 3704 /* jack detection */ 3705 if (cfg->hp_outs == i) 3706 type |= SND_JACK_LINEOUT; 3707 err = stac92xx_add_jack(codec, nid, type); 3708 if (err < 0) 3709 return err; 3710 4053 enable_pin_detect(codec, nid, STAC_HP_EVENT); 3711 4054 } 3712 4055 /* force to enable the first line-out; the others are set up … … 3716 4059 AC_PINCTL_OUT_EN); 3717 4060 /* fake event to set up pins */ 3718 codec->patch_ops.unsol_event(codec,3719 (STAC_HP_EVENT | spec->autocfg.hp_pins[0]) << 26);4061 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], 4062 STAC_HP_EVENT); 3720 4063 } else { 3721 4064 stac92xx_auto_init_multi_out(codec); 3722 4065 stac92xx_auto_init_hp_out(codec); 3723 } 3724 for (i = 0; i < cfg->line_outs; i++) { 3725 err = stac92xx_add_jack(codec, 3726 cfg->line_out_pins[i], SND_JACK_LINEOUT); 3727 if (err < 0) 3728 return err; 4066 for (i = 0; i < cfg->hp_outs; i++) 4067 stac_toggle_power_map(codec, cfg->hp_pins[i], 1); 3729 4068 } 3730 4069 for (i = 0; i < AUTO_PIN_LAST; i++) { 3731 4070 hda_nid_t nid = cfg->input_pins[i]; 3732 4071 if (nid) { 3733 unsigned int pinctl = snd_hda_codec_read(codec, nid, 3734 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3735 /* if PINCTL already set then skip */ 3736 if (pinctl & AC_PINCAP_IN) 3737 continue; 3738 pinctl = AC_PINCTL_IN_EN; 3739 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) 3740 pinctl |= stac92xx_get_vref(codec, nid); 3741 stac92xx_auto_set_pinctl(codec, nid, pinctl); 3742 err = stac92xx_add_jack(codec, nid, 3743 SND_JACK_MICROPHONE); 3744 if (err < 0) 3745 return err; 3746 enable_pin_detect(codec, nid, STAC_INSERT_EVENT | nid); 4072 unsigned int pinctl, conf; 4073 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { 4074 /* for mic pins, force to initialize */ 4075 pinctl = stac92xx_get_vref(codec, nid); 4076 pinctl |= AC_PINCTL_IN_EN; 4077 stac92xx_auto_set_pinctl(codec, nid, pinctl); 4078 } else { 4079 pinctl = snd_hda_codec_read(codec, nid, 0, 4080 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 4081 /* if PINCTL already set then skip */ 4082 if (!(pinctl & AC_PINCTL_IN_EN)) { 4083 pinctl |= AC_PINCTL_IN_EN; 4084 stac92xx_auto_set_pinctl(codec, nid, 4085 pinctl); 4086 } 4087 } 4088 conf = snd_hda_codec_get_pincfg(codec, nid); 4089 if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { 4090 enable_pin_detect(codec, nid, 4091 STAC_INSERT_EVENT); 4092 stac_issue_unsol_event(codec, nid, 4093 STAC_INSERT_EVENT); 4094 } 3747 4095 } 3748 4096 } … … 3750 4098 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], 3751 4099 AC_PINCTL_IN_EN); 4100 if (cfg->dig_out_pins[0]) 4101 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pins[0], 4102 AC_PINCTL_OUT_EN); 4103 if (cfg->dig_in_pin) 4104 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, 4105 AC_PINCTL_IN_EN); 3752 4106 for (i = 0; i < spec->num_pwrs; i++) { 3753 int event = is_nid_hp_pin(cfg, spec->pwr_nids[i]) 3754 ? STAC_HP_EVENT : STAC_PWR_EVENT; 3755 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], 3756 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3757 int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i], 3758 0, AC_VERB_GET_CONFIG_DEFAULT, 0); 3759 def_conf = get_defcfg_connect(def_conf); 4107 hda_nid_t nid = spec->pwr_nids[i]; 4108 int pinctl, def_conf; 4109 4110 /* power on when no jack detection is available */ 4111 if (!spec->hp_detect) { 4112 stac_toggle_power_map(codec, nid, 1); 4113 continue; 4114 } 4115 4116 if (is_nid_hp_pin(cfg, nid)) 4117 continue; /* already has an unsol event */ 4118 4119 pinctl = snd_hda_codec_read(codec, nid, 0, 4120 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3760 4121 /* outputs are only ports capable of power management 3761 4122 * any attempts on powering down a input port cause the 3762 4123 * referenced VREF to act quirky. 3763 4124 */ 3764 if (pinctl & AC_PINCTL_IN_EN) 4125 if (pinctl & AC_PINCTL_IN_EN) { 4126 stac_toggle_power_map(codec, nid, 1); 3765 4127 continue; 4128 } 4129 def_conf = snd_hda_codec_get_pincfg(codec, nid); 4130 def_conf = get_defcfg_connect(def_conf); 3766 4131 /* skip any ports that don't have jacks since presence 3767 4132 * detection is useless */ 3768 if (def_conf && def_conf != AC_JACK_PORT_FIXED) 4133 if (def_conf != AC_JACK_PORT_COMPLEX) { 4134 if (def_conf != AC_JACK_PORT_NONE) 4135 stac_toggle_power_map(codec, nid, 1); 3769 4136 continue; 3770 enable_pin_detect(codec, spec->pwr_nids[i], event | i); 3771 codec->patch_ops.unsol_event(codec, (event | i) << 26); 4137 } 4138 if (!stac_get_event(codec, nid, STAC_INSERT_EVENT)) { 4139 enable_pin_detect(codec, nid, STAC_PWR_EVENT); 4140 stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); 4141 } 3772 4142 } 3773 4143 if (spec->dac_list) 3774 4144 stac92xx_power_down(codec); 3775 if (cfg->dig_out_pin)3776 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin,3777 AC_PINCTL_OUT_EN);3778 if (cfg->dig_in_pin)3779 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin,3780 AC_PINCTL_IN_EN);3781 3782 stac_gpio_set(codec, spec->gpio_mask,3783 spec->gpio_dir, spec->gpio_data);3784 3785 4145 return 0; 3786 4146 } … … 3788 4148 static void stac92xx_free_jacks(struct hda_codec *codec) 3789 4149 { 3790 struct sigmatel_spec *spec = codec->spec; 3791 if (spec->jacks.list) { 4150 #ifdef CONFIG_SND_JACK 4151 /* free jack instances manually when clearing/reconfiguring */ 4152 struct sigmatel_spec *spec = codec->spec; 4153 if (!codec->bus->shutdown && spec->jacks.list) { 3792 4154 struct sigmatel_jack *jacks = spec->jacks.list; 3793 4155 int i; 3794 for (i = 0; i < spec->jacks.used; i++) 3795 snd_device_free(codec->bus->card, &jacks[i].jack); 4156 for (i = 0; i < spec->jacks.used; i++, jacks++) { 4157 if (jacks->jack) 4158 snd_device_free(codec->bus->card, jacks->jack); 4159 } 3796 4160 } 3797 4161 snd_array_free(&spec->jacks); 4162 #endif 3798 4163 } 3799 4164 … … 3818 4183 return; 3819 4184 3820 if (spec->bios_pin_configs)3821 kfree(spec->bios_pin_configs);3822 4185 stac92xx_free_jacks(codec); 3823 4186 snd_array_free(&spec->events); … … 3830 4193 unsigned int flag) 3831 4194 { 3832 unsigned int pin_ctl = snd_hda_codec_read(codec, nid, 4195 unsigned int old_ctl, pin_ctl; 4196 4197 pin_ctl = snd_hda_codec_read(codec, nid, 3833 4198 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); 3834 4199 … … 3840 4205 */ 3841 4206 struct sigmatel_spec *spec = codec->spec; 3842 struct auto_pin_cfg *cfg = &spec->autocfg; 3843 if ((nid == cfg->input_pins[AUTO_PIN_LINE] && 3844 spec->line_switch) || 3845 (nid == cfg->input_pins[AUTO_PIN_MIC] && 3846 spec->mic_switch)) 4207 if (nid == spec->line_switch || nid == spec->mic_switch) 3847 4208 return; 3848 4209 } 3849 4210 4211 old_ctl = pin_ctl; 3850 4212 /* if setting pin direction bits, clear the current 3851 4213 direction bits first */ … … 3853 4215 pin_ctl &= ~(AC_PINCTL_IN_EN | AC_PINCTL_OUT_EN); 3854 4216 3855 snd_hda_codec_write_cache(codec, nid, 0, 3856 AC_VERB_SET_PIN_WIDGET_CONTROL, 3857 pin_ctl | flag); 4217 pin_ctl |= flag; 4218 if (old_ctl != pin_ctl) 4219 snd_hda_codec_write_cache(codec, nid, 0, 4220 AC_VERB_SET_PIN_WIDGET_CONTROL, 4221 pin_ctl); 3858 4222 } 3859 4223 … … 3863 4227 unsigned int pin_ctl = snd_hda_codec_read(codec, nid, 3864 4228 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); 3865 snd_hda_codec_write_cache(codec, nid, 0, 3866 AC_VERB_SET_PIN_WIDGET_CONTROL, 3867 pin_ctl & ~flag); 3868 } 3869 3870 static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid) 4229 if (pin_ctl & flag) 4230 snd_hda_codec_write_cache(codec, nid, 0, 4231 AC_VERB_SET_PIN_WIDGET_CONTROL, 4232 pin_ctl & ~flag); 4233 } 4234 4235 static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) 3871 4236 { 3872 4237 if (!nid) 3873 4238 return 0; 3874 4239 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) 3875 & (1 << 31)) { 3876 unsigned int pinctl; 3877 pinctl = snd_hda_codec_read(codec, nid, 0, 3878 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3879 if (pinctl & AC_PINCTL_IN_EN) 3880 return 0; /* mic- or line-input */ 3881 else 3882 return 1; /* HP-output */ 3883 } 4240 & (1 << 31)) 4241 return 1; 3884 4242 return 0; 3885 4243 } 3886 4244 3887 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) 3888 { 3889 struct sigmatel_spec *spec = codec->spec; 4245 /* return non-zero if the hp-pin of the given array index isn't 4246 * a jack-detection target 4247 */ 4248 static int no_hp_sensing(struct sigmatel_spec *spec, int i) 4249 { 3890 4250 struct auto_pin_cfg *cfg = &spec->autocfg; 3891 int nid = cfg->hp_pins[cfg->hp_outs - 1]; 4251 4252 /* ignore sensing of shared line and mic jacks */ 4253 if (cfg->hp_pins[i] == spec->line_switch) 4254 return 1; 4255 if (cfg->hp_pins[i] == spec->mic_switch) 4256 return 1; 4257 /* ignore if the pin is set as line-out */ 4258 if (cfg->hp_pins[i] == spec->hp_switch) 4259 return 1; 4260 return 0; 4261 } 4262 4263 static void stac92xx_hp_detect(struct hda_codec *codec) 4264 { 4265 struct sigmatel_spec *spec = codec->spec; 4266 struct auto_pin_cfg *cfg = &spec->autocfg; 3892 4267 int i, presence; 3893 4268 … … 3900 4275 if (presence) 3901 4276 break; 3902 if (spec->hp_switch && cfg->hp_pins[i] == nid) 3903 break; 3904 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); 4277 if (no_hp_sensing(spec, i)) 4278 continue; 4279 presence = get_pin_presence(codec, cfg->hp_pins[i]); 4280 if (presence) { 4281 unsigned int pinctl; 4282 pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, 4283 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 4284 if (pinctl & AC_PINCTL_IN_EN) 4285 presence = 0; /* mic- or line-input */ 4286 } 3905 4287 } 3906 4288 3907 4289 if (presence) { 3908 /* disable lineouts , enable hp*/4290 /* disable lineouts */ 3909 4291 if (spec->hp_switch) 3910 stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN); 4292 stac92xx_reset_pinctl(codec, spec->hp_switch, 4293 AC_PINCTL_OUT_EN); 3911 4294 for (i = 0; i < cfg->line_outs; i++) 3912 4295 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], … … 3915 4298 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], 3916 4299 AC_PINCTL_OUT_EN); 3917 if (spec->eapd_mask )4300 if (spec->eapd_mask && spec->eapd_switch) 3918 4301 stac_gpio_set(codec, spec->gpio_mask, 3919 4302 spec->gpio_dir, spec->gpio_data & 3920 4303 ~spec->eapd_mask); 3921 4304 } else { 3922 /* enable lineouts , disable hp*/4305 /* enable lineouts */ 3923 4306 if (spec->hp_switch) 3924 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); 4307 stac92xx_set_pinctl(codec, spec->hp_switch, 4308 AC_PINCTL_OUT_EN); 3925 4309 for (i = 0; i < cfg->line_outs; i++) 3926 4310 stac92xx_set_pinctl(codec, cfg->line_out_pins[i], … … 3929 4313 stac92xx_set_pinctl(codec, cfg->speaker_pins[i], 3930 4314 AC_PINCTL_OUT_EN); 3931 if (spec->eapd_mask )4315 if (spec->eapd_mask && spec->eapd_switch) 3932 4316 stac_gpio_set(codec, spec->gpio_mask, 3933 4317 spec->gpio_dir, spec->gpio_data | 3934 4318 spec->eapd_mask); 3935 4319 } 3936 if (!spec->hp_switch && cfg->hp_outs > 1 && presence) 3937 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); 4320 /* toggle hp outs */ 4321 for (i = 0; i < cfg->hp_outs; i++) { 4322 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; 4323 if (no_hp_sensing(spec, i)) 4324 continue; 4325 if (presence) 4326 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); 4327 #if 0 /* FIXME */ 4328 /* Resetting the pinctl like below may lead to (a sort of) regressions 4329 * on some devices since they use the HP pin actually for line/speaker 4330 * outs although the default pin config shows a different pin (that is 4331 * wrong and useless). 4332 * 4333 * So, it's basically a problem of default pin configs, likely a BIOS issue. 4334 * But, disabling the code below just works around it, and I'm too tired of 4335 * bug reports with such devices... 4336 */ 4337 else 4338 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); 4339 #endif /* FIXME */ 4340 } 3938 4341 } 3939 4342 3940 static void stac92xx_pin_sense(struct hda_codec *codec, int idx) 3941 { 3942 struct sigmatel_spec *spec = codec->spec; 3943 hda_nid_t nid = spec->pwr_nids[idx]; 3944 int presence, val; 3945 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) 3946 & 0x000000ff; 3947 presence = get_hp_pin_presence(codec, nid); 4343 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, 4344 int enable) 4345 { 4346 struct sigmatel_spec *spec = codec->spec; 4347 unsigned int idx, val; 4348 4349 for (idx = 0; idx < spec->num_pwrs; idx++) { 4350 if (spec->pwr_nids[idx] == nid) 4351 break; 4352 } 4353 if (idx >= spec->num_pwrs) 4354 return; 3948 4355 3949 4356 /* several codecs have two power down bits */ … … 3953 4360 idx = 1 << idx; 3954 4361 3955 if (presence) 4362 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; 4363 if (enable) 3956 4364 val &= ~idx; 3957 4365 else … … 3960 4368 /* power down unused output ports */ 3961 4369 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); 4370 } 4371 4372 static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) 4373 { 4374 stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid)); 3962 4375 } 3963 4376 … … 3981 4394 ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT; 3982 4395 snd_jack_report(jacks->jack, 3983 get_ hp_pin_presence(codec, nid)4396 get_pin_presence(codec, nid) 3984 4397 ? type : 0); 3985 4398 } … … 3989 4402 } 3990 4403 4404 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid, 4405 unsigned char type) 4406 { 4407 struct sigmatel_event *event = stac_get_event(codec, nid, type); 4408 if (!event) 4409 return; 4410 codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26); 4411 } 4412 3991 4413 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) 3992 4414 { 3993 4415 struct sigmatel_spec *spec = codec->spec; 3994 int event = (res >> 26) & 0x70; 3995 int nid = res >> 26 & 0x0f; 3996 3997 switch (event) { 4416 struct sigmatel_event *event; 4417 int tag, data; 4418 4419 tag = (res >> 26) & 0x7f; 4420 event = stac_get_event_from_tag(codec, tag); 4421 if (!event) 4422 return; 4423 4424 switch (event->type) { 3998 4425 case STAC_HP_EVENT: 3999 stac92xx_hp_detect(codec , res);4426 stac92xx_hp_detect(codec); 4000 4427 /* fallthru */ 4001 4428 case STAC_INSERT_EVENT: 4002 4429 case STAC_PWR_EVENT: 4003 if (nid) { 4004 if (spec->num_pwrs > 0) 4005 stac92xx_pin_sense(codec, nid); 4006 stac92xx_report_jack(codec, nid); 4430 if (spec->num_pwrs > 0) 4431 stac92xx_pin_sense(codec, event->nid); 4432 stac92xx_report_jack(codec, event->nid); 4433 4434 switch (codec->subsystem_id) { 4435 case 0x103c308f: 4436 if (event->nid == 0xb) { 4437 int pin = AC_PINCTL_IN_EN; 4438 4439 if (get_pin_presence(codec, 0xa) 4440 && get_pin_presence(codec, 0xb)) 4441 pin |= AC_PINCTL_VREF_80; 4442 if (!get_pin_presence(codec, 0xb)) 4443 pin |= AC_PINCTL_VREF_80; 4444 4445 /* toggle VREF state based on mic + hp pin 4446 * status 4447 */ 4448 stac92xx_auto_set_pinctl(codec, 0x0a, pin); 4449 } 4007 4450 } 4008 4451 break; 4009 case STAC_VREF_EVENT: { 4010 int data = snd_hda_codec_read(codec, codec->afg, 0, 4011 AC_VERB_GET_GPIO_DATA, 0); 4012 int idx = stac92xx_event_data(codec, nid); 4452 case STAC_VREF_EVENT: 4453 data = snd_hda_codec_read(codec, codec->afg, 0, 4454 AC_VERB_GET_GPIO_DATA, 0); 4013 4455 /* toggle VREF state based on GPIOx status */ 4014 4456 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, 4015 !!(data & (1 << idx)));4457 !!(data & (1 << event->data))); 4016 4458 break; 4017 } 4018 } 4019 } 4459 } 4460 } 4461 4462 #ifdef CONFIG_PROC_FS 4463 static void stac92hd_proc_hook(struct snd_info_buffer *buffer, 4464 struct hda_codec *codec, hda_nid_t nid) 4465 { 4466 if (nid == codec->afg) 4467 snd_iprintf(buffer, "Power-Map: 0x%02x\n", 4468 snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0)); 4469 } 4470 4471 static void analog_loop_proc_hook(struct snd_info_buffer *buffer, 4472 struct hda_codec *codec, 4473 unsigned int verb) 4474 { 4475 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n", 4476 snd_hda_codec_read(codec, codec->afg, 0, verb, 0)); 4477 } 4478 4479 /* stac92hd71bxx, stac92hd73xx */ 4480 static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer, 4481 struct hda_codec *codec, hda_nid_t nid) 4482 { 4483 stac92hd_proc_hook(buffer, codec, nid); 4484 if (nid == codec->afg) 4485 analog_loop_proc_hook(buffer, codec, 0xfa0); 4486 } 4487 4488 static void stac9205_proc_hook(struct snd_info_buffer *buffer, 4489 struct hda_codec *codec, hda_nid_t nid) 4490 { 4491 if (nid == codec->afg) 4492 analog_loop_proc_hook(buffer, codec, 0xfe0); 4493 } 4494 4495 static void stac927x_proc_hook(struct snd_info_buffer *buffer, 4496 struct hda_codec *codec, hda_nid_t nid) 4497 { 4498 if (nid == codec->afg) 4499 analog_loop_proc_hook(buffer, codec, 0xfeb); 4500 } 4501 #else 4502 #define stac92hd_proc_hook NULL 4503 #define stac92hd7x_proc_hook NULL 4504 #define stac9205_proc_hook NULL 4505 #define stac927x_proc_hook NULL 4506 #endif 4020 4507 4021 4508 #ifdef SND_HDA_NEEDS_RESUME … … 4024 4511 struct sigmatel_spec *spec = codec->spec; 4025 4512 4026 stac92xx_set_config_regs(codec); 4027 snd_hda_sequence_write(codec, spec->init); 4028 stac_gpio_set(codec, spec->gpio_mask, 4029 spec->gpio_dir, spec->gpio_data); 4513 stac92xx_init(codec); 4030 4514 snd_hda_codec_resume_amp(codec); 4031 4515 snd_hda_codec_resume_cache(codec); 4032 /* power down inactive DACs */ 4033 if (spec->dac_list) 4034 stac92xx_power_down(codec); 4035 /* invoke unsolicited event to reset the HP state */ 4516 /* fake event to set up pins again to override cached values */ 4036 4517 if (spec->hp_detect) 4037 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); 4518 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], 4519 STAC_HP_EVENT); 4520 return 0; 4521 } 4522 4523 4524 /* 4525 * using power check for controlling mute led of HP HDX notebooks 4526 * check for mute state only on Speakers (nid = 0x10) 4527 * 4528 * For this feature CONFIG_SND_HDA_POWER_SAVE is needed, otherwise 4529 * the LED is NOT working properly ! 4530 */ 4531 4532 #ifdef CONFIG_SND_HDA_POWER_SAVE 4533 static int stac92xx_hp_hdx_check_power_status(struct hda_codec *codec, 4534 hda_nid_t nid) 4535 { 4536 struct sigmatel_spec *spec = codec->spec; 4537 4538 if (nid == 0x10) { 4539 if (snd_hda_codec_amp_read(codec, nid, 0, HDA_OUTPUT, 0) & 4540 HDA_AMP_MUTE) 4541 spec->gpio_data &= ~0x08; /* orange */ 4542 else 4543 spec->gpio_data |= 0x08; /* white */ 4544 4545 stac_gpio_set(codec, spec->gpio_mask, 4546 spec->gpio_dir, 4547 spec->gpio_data); 4548 } 4549 4550 return 0; 4551 } 4552 #endif 4553 4554 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) 4555 { 4556 struct sigmatel_spec *spec = codec->spec; 4557 if (spec->eapd_mask) 4558 stac_gpio_set(codec, spec->gpio_mask, 4559 spec->gpio_dir, spec->gpio_data & 4560 ~spec->eapd_mask); 4038 4561 return 0; 4039 4562 } … … 4047 4570 .unsol_event = stac92xx_unsol_event, 4048 4571 #ifdef SND_HDA_NEEDS_RESUME 4572 .suspend = stac92xx_suspend, 4049 4573 .resume = stac92xx_resume, 4050 4574 #endif … … 4066 4590 stac9200_models, 4067 4591 stac9200_cfg_tbl); 4068 if (spec->board_config < 0) {4592 if (spec->board_config < 0) 4069 4593 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); 4070 err = stac92xx_save_bios_config_regs(codec); 4071 if (err < 0) { 4072 stac92xx_free(codec); 4073 return err; 4074 } 4075 spec->pin_configs = spec->bios_pin_configs; 4076 } else { 4077 spec->pin_configs = stac9200_brd_tbl[spec->board_config]; 4078 stac92xx_set_config_regs(codec); 4079 } 4594 else 4595 stac92xx_set_config_regs(codec, 4596 stac9200_brd_tbl[spec->board_config]); 4080 4597 4081 4598 spec->multiout.max_channels = 2; … … 4089 4606 spec->num_pwrs = 0; 4090 4607 4091 if (spec->board_config == STAC_9200_GATEWAY || 4608 if (spec->board_config == STAC_9200_M4 || 4609 spec->board_config == STAC_9200_M4_2 || 4092 4610 spec->board_config == STAC_9200_OQO) 4093 4611 spec->init = stac9200_eapd_init; … … 4107 4625 } 4108 4626 4627 /* CF-74 has no headphone detection, and the driver should *NOT* 4628 * do detection and HP/speaker toggle because the hardware does it. 4629 */ 4630 if (spec->board_config == STAC_9200_PANASONIC) 4631 spec->hp_detect = 0; 4632 4109 4633 codec->patch_ops = stac92xx_patch_ops; 4110 4634 … … 4124 4648 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 4125 4649 spec->pin_nids = stac925x_pin_nids; 4126 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, 4650 4651 /* Check first for codec ID */ 4652 spec->board_config = snd_hda_check_board_codec_sid_config(codec, 4653 STAC_925x_MODELS, 4654 stac925x_models, 4655 stac925x_codec_id_cfg_tbl); 4656 4657 /* Now checks for PCI ID, if codec ID is not found */ 4658 if (spec->board_config < 0) 4659 spec->board_config = snd_hda_check_board_config(codec, 4660 STAC_925x_MODELS, 4127 4661 stac925x_models, 4128 4662 stac925x_cfg_tbl); 4129 4663 again: 4130 if (spec->board_config < 0) {4131 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," 4664 if (spec->board_config < 0) 4665 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," 4132 4666 "using BIOS defaults\n"); 4133 err = stac92xx_save_bios_config_regs(codec); 4134 if (err < 0) { 4135 stac92xx_free(codec); 4136 return err; 4137 } 4138 spec->pin_configs = spec->bios_pin_configs; 4139 } else if (stac925x_brd_tbl[spec->board_config] != NULL){ 4140 spec->pin_configs = stac925x_brd_tbl[spec->board_config]; 4141 stac92xx_set_config_regs(codec); 4142 } 4667 else 4668 stac92xx_set_config_regs(codec, 4669 stac925x_brd_tbl[spec->board_config]); 4143 4670 4144 4671 spec->multiout.max_channels = 2; … … 4203 4730 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; 4204 4731 int err = 0; 4732 int num_dacs; 4205 4733 4206 4734 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 4217 4745 stac92hd73xx_cfg_tbl); 4218 4746 again: 4219 if (spec->board_config < 0) {4747 if (spec->board_config < 0) 4220 4748 snd_printdd(KERN_INFO "hda_codec: Unknown model for" 4221 4749 " STAC92HD73XX, using BIOS defaults\n"); 4222 err = stac92xx_save_bios_config_regs(codec); 4223 if (err < 0) { 4224 stac92xx_free(codec); 4225 return err; 4226 } 4227 spec->pin_configs = spec->bios_pin_configs; 4228 } else { 4229 spec->pin_configs = stac92hd73xx_brd_tbl[spec->board_config]; 4230 stac92xx_set_config_regs(codec); 4231 } 4232 4233 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a, 4750 else 4751 stac92xx_set_config_regs(codec, 4752 stac92hd73xx_brd_tbl[spec->board_config]); 4753 4754 num_dacs = snd_hda_get_connections(codec, 0x0a, 4234 4755 conn, STAC92HD73_DAC_COUNT + 2) - 1; 4235 4756 4236 if ( spec->multiout.num_dacs < 0) {4757 if (num_dacs < 3 || num_dacs > 5) { 4237 4758 printk(KERN_WARNING "hda_codec: Could not determine " 4238 4759 "number of channels defaulting to DAC count\n"); 4239 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT; 4240 } 4241 4242 switch (spec->multiout.num_dacs) { 4760 num_dacs = STAC92HD73_DAC_COUNT; 4761 } 4762 switch (num_dacs) { 4243 4763 case 0x3: /* 6 Channel */ 4244 4764 spec->mixer = stac92hd73xx_6ch_mixer; 4245 4765 spec->init = stac92hd73xx_6ch_core_init; 4766 spec->aloopback_ctl = stac92hd73xx_6ch_loopback; 4246 4767 break; 4247 4768 case 0x4: /* 8 Channel */ 4248 4769 spec->mixer = stac92hd73xx_8ch_mixer; 4249 4770 spec->init = stac92hd73xx_8ch_core_init; 4771 spec->aloopback_ctl = stac92hd73xx_8ch_loopback; 4250 4772 break; 4251 4773 case 0x5: /* 10 Channel */ 4252 4774 spec->mixer = stac92hd73xx_10ch_mixer; 4253 4775 spec->init = stac92hd73xx_10ch_core_init; 4254 }; 4255 4256 spec->multiout.dac_nids = stac92hd73xx_dac_nids; 4776 spec->aloopback_ctl = stac92hd73xx_10ch_loopback; 4777 break; 4778 } 4779 spec->multiout.dac_nids = spec->dac_nids; 4780 4257 4781 spec->aloopback_mask = 0x01; 4258 4782 spec->aloopback_shift = 8; … … 4277 4801 spec->init = dell_eq_core_init; 4278 4802 /* fallthru */ 4279 case STAC_DELL_M6: 4803 case STAC_DELL_M6_AMIC: 4804 case STAC_DELL_M6_DMIC: 4805 case STAC_DELL_M6_BOTH: 4280 4806 spec->num_smuxes = 0; 4281 4807 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; 4282 4808 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; 4809 spec->eapd_switch = 0; 4283 4810 spec->num_amps = 1; 4284 4811 4285 if ( !spec->init)4812 if (spec->board_config != STAC_DELL_EQ) 4286 4813 spec->init = dell_m6_core_init; 4287 switch (codec->subsystem_id) { 4288 case 0x1028025e: /* Analog Mics */ 4289 case 0x1028025f: 4290 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4814 switch (spec->board_config) { 4815 case STAC_DELL_M6_AMIC: /* Analog Mics */ 4816 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); 4291 4817 spec->num_dmics = 0; 4292 4818 spec->private_dimux.num_items = 1; 4293 4819 break; 4294 case 0x10280271: /* Digital Mics */ 4295 case 0x10280272: 4296 case 0x10280254: 4297 case 0x10280255: 4298 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 4820 case STAC_DELL_M6_DMIC: /* Digital Mics */ 4821 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); 4299 4822 spec->num_dmics = 1; 4300 4823 spec->private_dimux.num_items = 2; 4301 4824 break; 4302 case 0x10280256: /* Both */ 4303 case 0x10280057: 4304 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4305 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 4825 case STAC_DELL_M6_BOTH: /* Both */ 4826 snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); 4827 snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160); 4306 4828 spec->num_dmics = 1; 4307 4829 spec->private_dimux.num_items = 2; … … 4312 4834 spec->num_dmics = STAC92HD73XX_NUM_DMICS; 4313 4835 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); 4836 spec->eapd_switch = 1; 4314 4837 } 4315 4838 if (spec->board_config > STAC_92HD73XX_REF) { … … 4340 4863 } 4341 4864 4865 if (spec->board_config == STAC_92HD73XX_NO_JD) 4866 spec->hp_detect = 0; 4867 4342 4868 codec->patch_ops = stac92xx_patch_ops; 4869 4870 codec->proc_widget_hook = stac92hd7x_proc_hook; 4343 4871 4344 4872 return 0; … … 4357 4885 { 4358 4886 struct sigmatel_spec *spec; 4887 hda_nid_t conn[STAC92HD83_DAC_COUNT + 1]; 4359 4888 int err; 4889 int num_dacs; 4890 hda_nid_t nid; 4360 4891 4361 4892 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 4371 4902 spec->adc_nids = stac92hd83xxx_adc_nids; 4372 4903 spec->pwr_nids = stac92hd83xxx_pwr_nids; 4904 spec->amp_nids = stac92hd83xxx_amp_nids; 4373 4905 spec->pwr_mapping = stac92hd83xxx_pwr_mapping; 4374 4906 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); 4375 spec->multiout.dac_nids = s tac92hd83xxx_dac_nids;4907 spec->multiout.dac_nids = spec->dac_nids; 4376 4908 4377 4909 spec->init = stac92hd83xxx_core_init; 4378 switch (codec->vendor_id) {4379 case 0x111d7605:4380 spec->multiout.num_dacs = STAC92HD81_DAC_COUNT;4381 break;4382 default:4383 spec->num_pwrs--;4384 spec->init++; /* switch to config #2 */4385 spec->multiout.num_dacs = STAC92HD83_DAC_COUNT;4386 }4387 4388 4910 spec->mixer = stac92hd83xxx_mixer; 4389 4911 spec->num_pins = ARRAY_SIZE(stac92hd83xxx_pin_nids); 4390 4912 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); 4391 4913 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); 4914 spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids); 4392 4915 spec->num_dmics = STAC92HD83XXX_NUM_DMICS; 4393 4916 spec->dinput_mux = &stac92hd83xxx_dmux; … … 4398 4921 stac92hd83xxx_cfg_tbl); 4399 4922 again: 4400 if (spec->board_config < 0) {4923 if (spec->board_config < 0) 4401 4924 snd_printdd(KERN_INFO "hda_codec: Unknown model for" 4402 4925 " STAC92HD83XXX, using BIOS defaults\n"); 4403 err = stac92xx_save_bios_config_regs(codec); 4404 if (err < 0) { 4405 stac92xx_free(codec); 4406 return err; 4407 } 4408 spec->pin_configs = spec->bios_pin_configs; 4409 } else { 4410 spec->pin_configs = stac92hd83xxx_brd_tbl[spec->board_config]; 4411 stac92xx_set_config_regs(codec); 4926 else 4927 stac92xx_set_config_regs(codec, 4928 stac92hd83xxx_brd_tbl[spec->board_config]); 4929 4930 switch (codec->vendor_id) { 4931 case 0x111d7604: 4932 case 0x111d7605: 4933 case 0x111d76d5: 4934 if (spec->board_config == STAC_92HD83XXX_PWR_REF) 4935 break; 4936 spec->num_pwrs = 0; 4937 break; 4412 4938 } 4413 4939 … … 4428 4954 } 4429 4955 4956 switch (spec->board_config) { 4957 case STAC_DELL_S14: 4958 nid = 0xf; 4959 break; 4960 default: 4961 nid = 0xe; 4962 break; 4963 } 4964 4965 num_dacs = snd_hda_get_connections(codec, nid, 4966 conn, STAC92HD83_DAC_COUNT + 1) - 1; 4967 4968 /* set port X to select the last DAC 4969 */ 4970 snd_hda_codec_write_cache(codec, nid, 0, 4971 AC_VERB_SET_CONNECT_SEL, num_dacs); 4972 4430 4973 codec->patch_ops = stac92xx_patch_ops; 4431 4974 4975 codec->proc_widget_hook = stac92hd_proc_hook; 4976 4432 4977 return 0; 4433 4978 } 4434 4979 4435 #ifdef SND_HDA_NEEDS_RESUME 4436 static void stac92hd71xx_set_power_state(struct hda_codec *codec, int pwr) 4437 { 4438 struct sigmatel_spec *spec = codec->spec; 4439 int i; 4440 snd_hda_codec_write_cache(codec, codec->afg, 0, 4441 AC_VERB_SET_POWER_STATE, pwr); 4442 4443 msleep(1); 4444 for (i = 0; i < spec->num_adcs; i++) { 4445 snd_hda_codec_write_cache(codec, 4446 spec->adc_nids[i], 0, 4447 AC_VERB_SET_POWER_STATE, pwr); 4448 } 4449 }; 4450 4451 static int stac92hd71xx_resume(struct hda_codec *codec) 4452 { 4453 stac92hd71xx_set_power_state(codec, AC_PWRST_D0); 4454 return stac92xx_resume(codec); 4455 } 4456 4457 static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state) 4458 { 4459 stac92hd71xx_set_power_state(codec, AC_PWRST_D3); 4460 return 0; 4461 }; 4462 4463 #endif 4464 4465 static struct hda_codec_ops stac92hd71bxx_patch_ops = { 4466 .build_controls = stac92xx_build_controls, 4467 .build_pcms = stac92xx_build_pcms, 4468 .init = stac92xx_init, 4469 .free = stac92xx_free, 4470 .unsol_event = stac92xx_unsol_event, 4471 #ifdef SND_HDA_NEEDS_RESUME 4472 .resume = stac92hd71xx_resume, 4473 .suspend = stac92hd71xx_suspend, 4474 #endif 4475 }; 4476 4477 static struct hda_input_mux stac92hd71bxx_dmux = { 4980 static struct hda_input_mux stac92hd71bxx_dmux_nomixer = { 4981 .num_items = 3, 4982 .items = { 4983 { "Analog Inputs", 0x00 }, 4984 { "Digital Mic 1", 0x02 }, 4985 { "Digital Mic 2", 0x03 }, 4986 } 4987 }; 4988 4989 static struct hda_input_mux stac92hd71bxx_dmux_amixer = { 4478 4990 .num_items = 4, 4479 4991 .items = { … … 4485 4997 }; 4486 4998 4999 /* get the pin connection (fixed, none, etc) */ 5000 static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx) 5001 { 5002 struct sigmatel_spec *spec = codec->spec; 5003 unsigned int cfg; 5004 5005 cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]); 5006 return get_defcfg_connect(cfg); 5007 } 5008 5009 static int stac92hd71bxx_connected_ports(struct hda_codec *codec, 5010 hda_nid_t *nids, int num_nids) 5011 { 5012 struct sigmatel_spec *spec = codec->spec; 5013 int idx, num; 5014 unsigned int def_conf; 5015 5016 for (num = 0; num < num_nids; num++) { 5017 for (idx = 0; idx < spec->num_pins; idx++) 5018 if (spec->pin_nids[idx] == nids[num]) 5019 break; 5020 if (idx >= spec->num_pins) 5021 break; 5022 def_conf = stac_get_defcfg_connect(codec, idx); 5023 if (def_conf == AC_JACK_PORT_NONE) 5024 break; 5025 } 5026 return num; 5027 } 5028 5029 static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, 5030 hda_nid_t dig0pin) 5031 { 5032 struct sigmatel_spec *spec = codec->spec; 5033 int idx; 5034 5035 for (idx = 0; idx < spec->num_pins; idx++) 5036 if (spec->pin_nids[idx] == dig0pin) 5037 break; 5038 if ((idx + 2) >= spec->num_pins) 5039 return 0; 5040 5041 /* dig1pin case */ 5042 if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE) 5043 return 2; 5044 5045 /* dig0pin + dig2pin case */ 5046 if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE) 5047 return 2; 5048 if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE) 5049 return 1; 5050 else 5051 return 0; 5052 } 5053 4487 5054 static int patch_stac92hd71bxx(struct hda_codec *codec) 4488 5055 { 4489 5056 struct sigmatel_spec *spec; 5057 struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; 4490 5058 int err = 0; 5059 unsigned int ndmic_nids = 0; 4491 5060 4492 5061 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 4496 5065 codec->spec = spec; 4497 5066 codec->patch_ops = stac92xx_patch_ops; 4498 spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); 5067 spec->num_pins = STAC92HD71BXX_NUM_PINS; 5068 switch (codec->vendor_id) { 5069 case 0x111d76b6: 5070 case 0x111d76b7: 5071 spec->pin_nids = stac92hd71bxx_pin_nids_4port; 5072 break; 5073 case 0x111d7603: 5074 case 0x111d7608: 5075 /* On 92HD75Bx 0x27 isn't a pin nid */ 5076 spec->num_pins--; 5077 /* fallthrough */ 5078 default: 5079 spec->pin_nids = stac92hd71bxx_pin_nids_6port; 5080 } 4499 5081 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); 4500 spec->pin_nids = stac92hd71bxx_pin_nids;4501 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux,4502 sizeof(stac92hd71bxx_dmux));4503 5082 spec->board_config = snd_hda_check_board_config(codec, 4504 5083 STAC_92HD71BXX_MODELS, … … 4506 5085 stac92hd71bxx_cfg_tbl); 4507 5086 again: 4508 if (spec->board_config < 0) {5087 if (spec->board_config < 0) 4509 5088 snd_printdd(KERN_INFO "hda_codec: Unknown model for" 4510 5089 " STAC92HD71BXX, using BIOS defaults\n"); 4511 err = stac92xx_save_bios_config_regs(codec); 4512 if (err < 0) { 4513 stac92xx_free(codec); 4514 return err; 4515 } 4516 spec->pin_configs = spec->bios_pin_configs; 4517 } else { 4518 spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config]; 4519 stac92xx_set_config_regs(codec); 4520 } 4521 4522 switch (codec->vendor_id) { 4523 case 0x111d76b6: /* 4 Port without Analog Mixer */ 4524 case 0x111d76b7: 4525 case 0x111d76b4: /* 6 Port without Analog Mixer */ 4526 case 0x111d76b5: 4527 spec->mixer = stac92hd71bxx_mixer; 4528 spec->init = stac92hd71bxx_core_init; 4529 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; 4530 break; 4531 case 0x111d7608: /* 5 Port with Analog Mixer */ 4532 switch (codec->subsystem_id) { 4533 case 0x103c361a: 4534 /* Enable VREF power saving on GPIO1 detect */ 4535 snd_hda_codec_write(codec, codec->afg, 0, 4536 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); 4537 snd_hda_codec_write_cache(codec, codec->afg, 0, 4538 AC_VERB_SET_UNSOLICITED_ENABLE, 4539 (AC_USRSP_EN | STAC_VREF_EVENT | codec->afg)); 4540 err = stac92xx_add_event(spec, codec->afg, 0x02); 4541 if (err < 0) 4542 return err; 4543 spec->gpio_mask |= 0x02; 4544 break; 4545 } 4546 if ((codec->revision_id & 0xf) == 0 || 4547 (codec->revision_id & 0xf) == 1) { 4548 #ifdef SND_HDA_NEEDS_RESUME 4549 codec->patch_ops = stac92hd71bxx_patch_ops; 4550 #endif 4551 spec->stream_delay = 40; /* 40 milliseconds */ 4552 } 4553 4554 /* no output amps */ 4555 spec->num_pwrs = 0; 4556 spec->mixer = stac92hd71bxx_analog_mixer; 4557 spec->dinput_mux = &spec->private_dimux; 4558 4559 /* disable VSW */ 4560 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; 4561 stac92xx_set_config_reg(codec, 0xf, 0x40f000f0); 4562 break; 4563 case 0x111d7603: /* 6 Port with Analog Mixer */ 4564 if ((codec->revision_id & 0xf) == 1) { 4565 #ifdef SND_HDA_NEEDS_RESUME 4566 codec->patch_ops = stac92hd71bxx_patch_ops; 4567 #endif 4568 spec->stream_delay = 40; /* 40 milliseconds */ 4569 } 4570 4571 /* no output amps */ 4572 spec->num_pwrs = 0; 4573 /* fallthru */ 4574 default: 4575 spec->dinput_mux = &spec->private_dimux; 4576 spec->mixer = stac92hd71bxx_analog_mixer; 4577 spec->init = stac92hd71bxx_analog_core_init; 4578 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; 4579 } 4580 4581 spec->aloopback_mask = 0x50; 4582 spec->aloopback_shift = 0; 5090 else 5091 stac92xx_set_config_regs(codec, 5092 stac92hd71bxx_brd_tbl[spec->board_config]); 4583 5093 4584 5094 if (spec->board_config > STAC_92HD71BXX_REF) { … … 4589 5099 } 4590 5100 5101 spec->dmic_nids = stac92hd71bxx_dmic_nids; 5102 spec->dmux_nids = stac92hd71bxx_dmux_nids; 5103 5104 switch (codec->vendor_id) { 5105 case 0x111d76b6: /* 4 Port without Analog Mixer */ 5106 case 0x111d76b7: 5107 unmute_init++; 5108 /* fallthru */ 5109 case 0x111d76b4: /* 6 Port without Analog Mixer */ 5110 case 0x111d76b5: 5111 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_nomixer, 5112 sizeof(stac92hd71bxx_dmux_nomixer)); 5113 spec->mixer = stac92hd71bxx_mixer; 5114 spec->init = stac92hd71bxx_core_init; 5115 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; 5116 spec->num_dmics = stac92hd71bxx_connected_ports(codec, 5117 stac92hd71bxx_dmic_nids, 5118 STAC92HD71BXX_NUM_DMICS); 5119 if (spec->num_dmics) { 5120 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 5121 spec->dinput_mux = &spec->private_dimux; 5122 ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; 5123 } 5124 break; 5125 case 0x111d7608: /* 5 Port with Analog Mixer */ 5126 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, 5127 sizeof(stac92hd71bxx_dmux_amixer)); 5128 spec->private_dimux.num_items--; 5129 switch (spec->board_config) { 5130 case STAC_HP_M4: 5131 /* Enable VREF power saving on GPIO1 detect */ 5132 err = stac_add_event(spec, codec->afg, 5133 STAC_VREF_EVENT, 0x02); 5134 if (err < 0) 5135 return err; 5136 snd_hda_codec_write_cache(codec, codec->afg, 0, 5137 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); 5138 snd_hda_codec_write_cache(codec, codec->afg, 0, 5139 AC_VERB_SET_UNSOLICITED_ENABLE, 5140 AC_USRSP_EN | err); 5141 spec->gpio_mask |= 0x02; 5142 break; 5143 } 5144 if ((codec->revision_id & 0xf) == 0 || 5145 (codec->revision_id & 0xf) == 1) 5146 spec->stream_delay = 40; /* 40 milliseconds */ 5147 5148 /* no output amps */ 5149 spec->num_pwrs = 0; 5150 spec->mixer = stac92hd71bxx_analog_mixer; 5151 spec->dinput_mux = &spec->private_dimux; 5152 5153 /* disable VSW */ 5154 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; 5155 unmute_init++; 5156 snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0); 5157 snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3); 5158 stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0; 5159 spec->num_dmics = stac92hd71bxx_connected_ports(codec, 5160 stac92hd71bxx_dmic_nids, 5161 STAC92HD71BXX_NUM_DMICS - 1); 5162 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 5163 ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 2; 5164 break; 5165 case 0x111d7603: /* 6 Port with Analog Mixer */ 5166 if ((codec->revision_id & 0xf) == 1) 5167 spec->stream_delay = 40; /* 40 milliseconds */ 5168 5169 /* no output amps */ 5170 spec->num_pwrs = 0; 5171 /* fallthru */ 5172 default: 5173 memcpy(&spec->private_dimux, &stac92hd71bxx_dmux_amixer, 5174 sizeof(stac92hd71bxx_dmux_amixer)); 5175 spec->dinput_mux = &spec->private_dimux; 5176 spec->mixer = stac92hd71bxx_analog_mixer; 5177 spec->init = stac92hd71bxx_analog_core_init; 5178 codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; 5179 spec->num_dmics = stac92hd71bxx_connected_ports(codec, 5180 stac92hd71bxx_dmic_nids, 5181 STAC92HD71BXX_NUM_DMICS); 5182 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 5183 ndmic_nids = ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1; 5184 } 5185 5186 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) 5187 snd_hda_sequence_write_cache(codec, unmute_init); 5188 5189 spec->aloopback_ctl = stac92hd71bxx_loopback; 5190 spec->aloopback_mask = 0x50; 5191 spec->aloopback_shift = 0; 5192 4591 5193 spec->powerdown_adcs = 1; 4592 5194 spec->digbeep_nid = 0x26; 4593 5195 spec->mux_nids = stac92hd71bxx_mux_nids; 4594 5196 spec->adc_nids = stac92hd71bxx_adc_nids; 4595 spec->dmic_nids = stac92hd71bxx_dmic_nids;4596 spec->dmux_nids = stac92hd71bxx_dmux_nids;4597 5197 spec->smux_nids = stac92hd71bxx_smux_nids; 4598 5198 spec->pwr_nids = stac92hd71bxx_pwr_nids; … … 4600 5200 spec->num_muxes = ARRAY_SIZE(stac92hd71bxx_mux_nids); 4601 5201 spec->num_adcs = ARRAY_SIZE(stac92hd71bxx_adc_nids); 5202 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); 4602 5203 4603 5204 switch (spec->board_config) { 4604 5205 case STAC_HP_M4: 5206 /* enable internal microphone */ 5207 snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040); 5208 stac92xx_auto_set_pinctl(codec, 0x0e, 5209 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); 5210 /* fallthru */ 5211 case STAC_DELL_M4_2: 4605 5212 spec->num_dmics = 0; 4606 5213 spec->num_smuxes = 0; 4607 5214 spec->num_dmuxes = 0; 4608 4609 /* enable internal microphone */4610 stac92xx_set_config_reg(codec, 0x0e, 0x01813040);4611 stac92xx_auto_set_pinctl(codec, 0x0e,4612 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);4613 5215 break; 4614 default: 4615 spec->num_dmics = STAC92HD71BXX_NUM_DMICS; 4616 spec->num_smuxes = ARRAY_SIZE(stac92hd71bxx_smux_nids); 4617 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 5216 case STAC_DELL_M4_1: 5217 case STAC_DELL_M4_3: 5218 spec->num_dmics = 1; 5219 spec->num_smuxes = 0; 5220 spec->num_dmuxes = 1; 5221 break; 5222 case STAC_HP_DV5: 5223 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010); 5224 stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); 5225 break; 5226 case STAC_HP_HDX: 5227 spec->num_dmics = 1; 5228 spec->num_dmuxes = 1; 5229 spec->num_smuxes = 1; 5230 /* 5231 * For controlling MUTE LED on HP HDX16/HDX18 notebooks, 5232 * the CONFIG_SND_HDA_POWER_SAVE is needed to be set. 5233 */ 5234 #ifdef CONFIG_SND_HDA_POWER_SAVE 5235 /* orange/white mute led on GPIO3, orange=0, white=1 */ 5236 spec->gpio_mask |= 0x08; 5237 spec->gpio_dir |= 0x08; 5238 spec->gpio_data |= 0x08; /* set to white */ 5239 5240 /* register check_power_status callback. */ 5241 codec->patch_ops.check_power_status = 5242 stac92xx_hp_hdx_check_power_status; 5243 #endif 5244 break; 4618 5245 }; 4619 5246 4620 spec->multiout.num_dacs = 1; 4621 spec->multiout.hp_nid = 0x11; 4622 spec->multiout.dac_nids = stac92hd71bxx_dac_nids; 5247 spec->multiout.dac_nids = spec->dac_nids; 4623 5248 if (spec->dinput_mux) 4624 spec->private_dimux.num_items += 4625 spec->num_dmics - 4626 (ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1); 4627 4628 err = stac92xx_parse_auto_config(codec, 0x21, 0x23); 5249 spec->private_dimux.num_items += spec->num_dmics - ndmic_nids; 5250 5251 err = stac92xx_parse_auto_config(codec, 0x21, 0); 4629 5252 if (!err) { 4630 5253 if (spec->board_config < 0) { … … 4641 5264 return err; 4642 5265 } 5266 5267 codec->proc_widget_hook = stac92hd7x_proc_hook; 4643 5268 4644 5269 return 0; … … 4699 5324 4700 5325 again: 4701 if (spec->board_config < 0) {5326 if (spec->board_config < 0) 4702 5327 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " 4703 5328 "using BIOS defaults\n"); 4704 err = stac92xx_save_bios_config_regs(codec); 4705 if (err < 0) { 4706 stac92xx_free(codec); 4707 return err; 4708 } 4709 spec->pin_configs = spec->bios_pin_configs; 4710 } else if (stac922x_brd_tbl[spec->board_config] != NULL) { 4711 spec->pin_configs = stac922x_brd_tbl[spec->board_config]; 4712 stac92xx_set_config_regs(codec); 4713 } 5329 else 5330 stac92xx_set_config_regs(codec, 5331 stac922x_brd_tbl[spec->board_config]); 4714 5332 4715 5333 spec->adc_nids = stac922x_adc_nids; … … 4762 5380 4763 5381 codec->spec = spec; 5382 codec->slave_dig_outs = stac927x_slave_dig_outs; 4764 5383 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); 4765 5384 spec->pin_nids = stac927x_pin_nids; … … 4768 5387 stac927x_cfg_tbl); 4769 5388 again: 4770 if (spec->board_config < 0 || !stac927x_brd_tbl[spec->board_config]) { 4771 if (spec->board_config < 0) 4772 snd_printdd(KERN_INFO "hda_codec: Unknown model for" 4773 "STAC927x, using BIOS defaults\n"); 4774 err = stac92xx_save_bios_config_regs(codec); 4775 if (err < 0) { 4776 stac92xx_free(codec); 4777 return err; 4778 } 4779 spec->pin_configs = spec->bios_pin_configs; 4780 } else { 4781 spec->pin_configs = stac927x_brd_tbl[spec->board_config]; 4782 stac92xx_set_config_regs(codec); 4783 } 5389 if (spec->board_config < 0) 5390 snd_printdd(KERN_INFO "hda_codec: Unknown model for" 5391 "STAC927x, using BIOS defaults\n"); 5392 else 5393 stac92xx_set_config_regs(codec, 5394 stac927x_brd_tbl[spec->board_config]); 4784 5395 4785 5396 spec->digbeep_nid = 0x23; … … 4810 5421 case 0x1028022e: 4811 5422 /* correct the device field to SPDIF out */ 4812 s tac92xx_set_config_reg(codec, 0x21, 0x01442070);5423 snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070); 4813 5424 break; 4814 5425 }; 4815 5426 /* configure the analog microphone on some laptops */ 4816 s tac92xx_set_config_reg(codec, 0x0c, 0x90a79130);5427 snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130); 4817 5428 /* correct the front output jack as a hp out */ 4818 s tac92xx_set_config_reg(codec, 0x0f, 0x0227011f);5429 snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f); 4819 5430 /* correct the front input jack as a mic */ 4820 s tac92xx_set_config_reg(codec, 0x0e, 0x02a79130);5431 snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130); 4821 5432 /* fallthru */ 4822 5433 case STAC_DELL_3ST: … … 4845 5456 4846 5457 spec->num_pwrs = 0; 5458 spec->aloopback_ctl = stac927x_loopback; 4847 5459 spec->aloopback_mask = 0x40; 4848 5460 spec->aloopback_shift = 0; 5461 spec->eapd_switch = 1; 4849 5462 4850 5463 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); … … 4864 5477 4865 5478 codec->patch_ops = stac92xx_patch_ops; 5479 5480 codec->proc_widget_hook = stac927x_proc_hook; 4866 5481 4867 5482 /* … … 4877 5492 codec->bus->needs_damn_long_delay = 1; 4878 5493 5494 /* no jack detecion for ref-no-jd model */ 5495 if (spec->board_config == STAC_D965_REF_NO_JD) 5496 spec->hp_detect = 0; 5497 4879 5498 return 0; 4880 5499 } … … 4896 5515 stac9205_cfg_tbl); 4897 5516 again: 4898 if (spec->board_config < 0) {5517 if (spec->board_config < 0) 4899 5518 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); 4900 err = stac92xx_save_bios_config_regs(codec); 4901 if (err < 0) { 4902 stac92xx_free(codec); 4903 return err; 4904 } 4905 spec->pin_configs = spec->bios_pin_configs; 4906 } else { 4907 spec->pin_configs = stac9205_brd_tbl[spec->board_config]; 4908 stac92xx_set_config_regs(codec); 4909 } 5519 else 5520 stac92xx_set_config_regs(codec, 5521 stac9205_brd_tbl[spec->board_config]); 4910 5522 4911 5523 spec->digbeep_nid = 0x23; … … 4924 5536 spec->init = stac9205_core_init; 4925 5537 spec->mixer = stac9205_mixer; 5538 spec->aloopback_ctl = stac9205_loopback; 4926 5539 4927 5540 spec->aloopback_mask = 0x40; 4928 5541 spec->aloopback_shift = 0; 5542 /* Turn on/off EAPD per HP plugging */ 5543 if (spec->board_config != STAC_9205_EAPD) 5544 spec->eapd_switch = 1; 4929 5545 spec->multiout.dac_nids = spec->dac_nids; 4930 5546 … … 4932 5548 case STAC_9205_DELL_M43: 4933 5549 /* Enable SPDIF in/out */ 4934 s tac92xx_set_config_reg(codec, 0x1f, 0x01441030);4935 s tac92xx_set_config_reg(codec, 0x20, 0x1c410030);5550 snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030); 5551 snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); 4936 5552 4937 5553 /* Enable unsol response for GPIO4/Dock HP connection */ 4938 snd_hda_codec_write(codec, codec->afg, 0, 5554 err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); 5555 if (err < 0) 5556 return err; 5557 snd_hda_codec_write_cache(codec, codec->afg, 0, 4939 5558 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); 4940 5559 snd_hda_codec_write_cache(codec, codec->afg, 0, 4941 AC_VERB_SET_UNSOLICITED_ENABLE, 4942 (AC_USRSP_EN | STAC_VREF_EVENT | codec->afg)); 4943 err = stac92xx_add_event(spec, codec->afg, 0x01); 4944 if (err < 0) 4945 return err; 5560 AC_VERB_SET_UNSOLICITED_ENABLE, 5561 AC_USRSP_EN | err); 4946 5562 4947 5563 spec->gpio_dir = 0x0b; … … 4981 5597 codec->patch_ops = stac92xx_patch_ops; 4982 5598 5599 codec->proc_widget_hook = stac9205_proc_hook; 5600 4983 5601 return 0; 4984 5602 } … … 4988 5606 */ 4989 5607 4990 /* static config for Sony VAIO FE550G and Sony VAIO AR */ 4991 static hda_nid_t vaio_dacs[] = { 0x2 }; 4992 #define VAIO_HP_DAC 0x5 4993 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ }; 4994 static hda_nid_t vaio_mux_nids[] = { 0x15 }; 4995 4996 static struct hda_input_mux vaio_mux = { 4997 .num_items = 3, 4998 .items = { 4999 /* { "HP", 0x0 }, */ 5000 { "Mic Jack", 0x1 }, 5001 { "Internal Mic", 0x2 }, 5002 { "PCM", 0x3 }, 5003 } 5004 }; 5005 5006 static struct hda_verb vaio_init[] = { 5007 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ 5008 {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT}, 5009 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ 5010 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ 5011 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ 5012 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ 5608 static struct hda_verb stac9872_core_init[] = { 5013 5609 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ 5014 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */5015 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */5016 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */5017 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */5018 5610 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ 5019 5611 {0} 5020 5612 }; 5021 5613 5022 static struct hda_verb vaio_ar_init[] = { 5023 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ 5024 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ 5025 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ 5026 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ 5027 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */ 5028 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ 5029 {0x15, AC_VERB_SET_CONNECT_SEL, 0x1}, /* mic-sel: 0a,0d,14,02 */ 5030 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ 5031 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ 5032 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */ 5033 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ 5034 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ 5035 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ 5036 {0} 5037 }; 5038 5039 /* bind volumes of both NID 0x02 and 0x05 */ 5040 static struct hda_bind_ctls vaio_bind_master_vol = { 5041 .ops = &snd_hda_bind_vol, 5042 .values = { 5043 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 5044 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), 5045 0 5046 }, 5047 }; 5048 5049 /* bind volumes of both NID 0x02 and 0x05 */ 5050 static struct hda_bind_ctls vaio_bind_master_sw = { 5051 .ops = &snd_hda_bind_sw, 5052 .values = { 5053 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 5054 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), 5055 0, 5056 }, 5057 }; 5058 5059 static struct snd_kcontrol_new vaio_mixer[] = { 5060 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), 5061 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), 5062 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ 5614 static struct snd_kcontrol_new stac9872_mixer[] = { 5063 5615 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), 5064 5616 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), 5065 { 5066 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5067 .name = "Capture Source", 5068 .count = 1, 5069 .info = stac92xx_mux_enum_info, 5070 .get = stac92xx_mux_enum_get, 5071 .put = stac92xx_mux_enum_put, 5072 }, 5073 {0} 5074 }; 5075 5076 static struct snd_kcontrol_new vaio_ar_mixer[] = { 5077 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), 5078 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), 5079 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ 5080 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), 5081 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), 5082 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT), 5083 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/ 5084 { 5085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5086 .name = "Capture Source", 5087 .count = 1, 5088 .info = stac92xx_mux_enum_info, 5089 .get = stac92xx_mux_enum_get, 5090 .put = stac92xx_mux_enum_put, 5091 }, 5092 {0} 5093 }; 5094 5095 static struct hda_codec_ops stac9872_patch_ops = { 5096 .build_controls = stac92xx_build_controls, 5097 .build_pcms = stac92xx_build_pcms, 5098 .init = stac92xx_init, 5099 .free = stac92xx_free, 5100 #ifdef SND_HDA_NEEDS_RESUME 5101 .resume = stac92xx_resume, 5102 #endif 5103 }; 5104 5105 static int stac9872_vaio_init(struct hda_codec *codec) 5106 { 5617 {0} /* end */ 5618 }; 5619 5620 static hda_nid_t stac9872_pin_nids[] = { 5621 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 5622 0x11, 0x13, 0x14, 5623 }; 5624 5625 static hda_nid_t stac9872_adc_nids[] = { 5626 0x8 /*,0x6*/ 5627 }; 5628 5629 static hda_nid_t stac9872_mux_nids[] = { 5630 0x15 5631 }; 5632 5633 static unsigned int stac9872_vaio_pin_configs[9] = { 5634 0x03211020, 0x411111f0, 0x411111f0, 0x03a15030, 5635 0x411111f0, 0x90170110, 0x411111f0, 0x411111f0, 5636 0x90a7013e 5637 }; 5638 5639 static const char *stac9872_models[STAC_9872_MODELS] = { 5640 [STAC_9872_AUTO] = "auto", 5641 [STAC_9872_VAIO] = "vaio", 5642 }; 5643 5644 static unsigned int *stac9872_brd_tbl[STAC_9872_MODELS] = { 5645 [STAC_9872_VAIO] = stac9872_vaio_pin_configs, 5646 }; 5647 5648 static struct snd_pci_quirk stac9872_cfg_tbl[] = { 5649 {0} /* terminator */ 5650 }; 5651 5652 static int patch_stac9872(struct hda_codec *codec) 5653 { 5654 struct sigmatel_spec *spec; 5107 5655 int err; 5108 5656 5109 err = stac92xx_init(codec);5110 if (err < 0)5111 return err;5112 if (codec->patch_ops.unsol_event)5113 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);5114 return 0;5115 }5116 5117 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)5118 {5119 if (get_hp_pin_presence(codec, 0x0a)) {5120 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);5121 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);5122 } else {5123 stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);5124 stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);5125 }5126 }5127 5128 static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)5129 {5130 switch (res >> 26) {5131 case STAC_HP_EVENT:5132 stac9872_vaio_hp_detect(codec, res);5133 break;5134 }5135 }5136 5137 static struct hda_codec_ops stac9872_vaio_patch_ops = {5138 .build_controls = stac92xx_build_controls,5139 .build_pcms = stac92xx_build_pcms,5140 .init = stac9872_vaio_init,5141 .free = stac92xx_free,5142 .unsol_event = stac9872_vaio_unsol_event,5143 #ifdef CONFIG_PM5144 .resume = stac92xx_resume,5145 #endif5146 };5147 5148 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */5149 CXD9872RD_VAIO,5150 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */5151 STAC9872AK_VAIO,5152 /* Unknown. id=0x83847661 and subsys=0x104D1200. */5153 STAC9872K_VAIO,5154 /* AR Series. id=0x83847664 and subsys=104D1300 */5155 CXD9872AKD_VAIO,5156 STAC_9872_MODELS,5157 };5158 5159 static const char *stac9872_models[STAC_9872_MODELS] = {5160 [CXD9872RD_VAIO] = "vaio",5161 [CXD9872AKD_VAIO] = "vaio-ar",5162 };5163 5164 static struct snd_pci_quirk stac9872_cfg_tbl[] = {5165 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO),5166 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO),5167 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO),5168 SND_PCI_QUIRK(0x104d, 0x8205, "Sony VAIO AR", CXD9872AKD_VAIO),5169 {0}5170 };5171 5172 static int patch_stac9872(struct hda_codec *codec)5173 {5174 struct sigmatel_spec *spec;5175 int board_config;5176 5177 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,5178 stac9872_models,5179 stac9872_cfg_tbl);5180 if (board_config < 0)5181 /* unknown config, let generic-parser do its job... */5182 return snd_hda_parse_generic_codec(codec);5183 5184 5657 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5185 5658 if (spec == NULL) 5186 5659 return -ENOMEM; 5187 5188 5660 codec->spec = spec; 5189 switch (board_config) { 5190 case CXD9872RD_VAIO: 5191 case STAC9872AK_VAIO: 5192 case STAC9872K_VAIO: 5193 spec->mixer = vaio_mixer; 5194 spec->init = vaio_init; 5195 spec->multiout.max_channels = 2; 5196 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); 5197 spec->multiout.dac_nids = vaio_dacs; 5198 spec->multiout.hp_nid = VAIO_HP_DAC; 5199 spec->num_adcs = ARRAY_SIZE(vaio_adcs); 5200 spec->adc_nids = vaio_adcs; 5201 spec->num_pwrs = 0; 5202 spec->input_mux = &vaio_mux; 5203 spec->mux_nids = vaio_mux_nids; 5204 codec->patch_ops = stac9872_vaio_patch_ops; 5205 break; 5206 5207 case CXD9872AKD_VAIO: 5208 spec->mixer = vaio_ar_mixer; 5209 spec->init = vaio_ar_init; 5210 spec->multiout.max_channels = 2; 5211 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); 5212 spec->multiout.dac_nids = vaio_dacs; 5213 spec->multiout.hp_nid = VAIO_HP_DAC; 5214 spec->num_adcs = ARRAY_SIZE(vaio_adcs); 5215 spec->num_pwrs = 0; 5216 spec->adc_nids = vaio_adcs; 5217 spec->input_mux = &vaio_mux; 5218 spec->mux_nids = vaio_mux_nids; 5219 codec->patch_ops = stac9872_patch_ops; 5220 break; 5221 } 5222 5661 5662 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, 5663 stac9872_models, 5664 stac9872_cfg_tbl); 5665 if (spec->board_config < 0) 5666 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9872, " 5667 "using BIOS defaults\n"); 5668 else 5669 stac92xx_set_config_regs(codec, 5670 stac9872_brd_tbl[spec->board_config]); 5671 5672 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); 5673 spec->pin_nids = stac9872_pin_nids; 5674 spec->multiout.dac_nids = spec->dac_nids; 5675 spec->num_adcs = ARRAY_SIZE(stac9872_adc_nids); 5676 spec->adc_nids = stac9872_adc_nids; 5677 spec->num_muxes = ARRAY_SIZE(stac9872_mux_nids); 5678 spec->mux_nids = stac9872_mux_nids; 5679 spec->mixer = stac9872_mixer; 5680 spec->init = stac9872_core_init; 5681 5682 err = stac92xx_parse_auto_config(codec, 0x10, 0x12); 5683 if (err < 0) { 5684 stac92xx_free(codec); 5685 return -EINVAL; 5686 } 5687 spec->input_mux = &spec->private_imux; 5688 codec->patch_ops = stac92xx_patch_ops; 5223 5689 return 0; 5224 5690 } … … 5228 5694 * patch entries 5229 5695 */ 5230 st ruct hda_codec_preset snd_hda_preset_sigmatel[] = {5696 static struct hda_codec_preset snd_hda_preset_sigmatel[] = { 5231 5697 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, 5232 5698 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, … … 5278 5744 { .id = 0x111d7604, .name = "92HD83C1X5", .patch = patch_stac92hd83xxx}, 5279 5745 { .id = 0x111d7605, .name = "92HD81B1X5", .patch = patch_stac92hd83xxx}, 5746 { .id = 0x111d76d5, .name = "92HD81B1C5", .patch = patch_stac92hd83xxx}, 5280 5747 { .id = 0x111d7608, .name = "92HD75B2X5", .patch = patch_stac92hd71bxx}, 5281 5748 { .id = 0x111d7674, .name = "92HD73D1X5", .patch = patch_stac92hd73xx }, … … 5292 5759 {0} /* terminator */ 5293 5760 }; 5761 5762 MODULE_ALIAS("snd-hda-codec-id:8384*"); 5763 MODULE_ALIAS("snd-hda-codec-id:111d*"); 5764 5765 MODULE_LICENSE("GPL"); 5766 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec"); 5767 5768 static struct hda_codec_preset_list sigmatel_list = { 5769 .preset = snd_hda_preset_sigmatel, 5770 .owner = THIS_MODULE, 5771 }; 5772 5773 static int __init patch_sigmatel_init(void) 5774 { 5775 return snd_hda_add_codec_preset(&sigmatel_list); 5776 } 5777 5778 static void __exit patch_sigmatel_exit(void) 5779 { 5780 snd_hda_delete_codec_preset(&sigmatel_list); 5781 } 5782 5783 module_init(patch_sigmatel_init) 5784 module_exit(patch_sigmatel_exit) -
GPL/trunk/alsa-kernel/pci/hda/patch_via.c
r417 r426 48 48 #include "hda_codec.h" 49 49 #include "hda_local.h" 50 #include "hda_patch.h"51 50 52 51 /* amp values */ … … 142 141 AUTO_SEQ_SIDE 143 142 }; 144 145 #define get_amp_nid(kc) ((kc)->private_value & 0xffff)146 143 147 144 /* Some VT1708S based boards gets the micboost setting wrong, so we have … … 1312 1309 unsigned char seqassoc; 1313 1310 1314 def_conf = snd_hda_codec_read(codec, nid, 0, 1315 AC_VERB_GET_CONFIG_DEFAULT, 0); 1311 def_conf = snd_hda_codec_get_pincfg(codec, nid); 1316 1312 seqassoc = (unsigned char) get_defcfg_association(def_conf); 1317 1313 seqassoc = (seqassoc << 4) | get_defcfg_sequence(def_conf); … … 1319 1315 if (seqassoc == 0xff) { 1320 1316 def_conf = def_conf & (~(AC_JACK_PORT_BOTH << 30)); 1321 snd_hda_codec_write(codec, nid, 0, 1322 AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 1323 def_conf >> 24); 1317 snd_hda_codec_set_pincfg(codec, nid, def_conf); 1324 1318 } 1325 1319 } … … 1358 1352 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 1359 1353 1360 if (spec->autocfg.dig_out _pin)1354 if (spec->autocfg.dig_outs) 1361 1355 spec->multiout.dig_out_nid = VT1708_DIGOUT_NID; 1362 1356 if (spec->autocfg.dig_in_pin) … … 1831 1825 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 1832 1826 1833 if (spec->autocfg.dig_out _pin)1827 if (spec->autocfg.dig_outs) 1834 1828 spec->multiout.dig_out_nid = VT1709_DIGOUT_NID; 1835 1829 if (spec->autocfg.dig_in_pin) … … 2379 2373 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 2380 2374 2381 if (spec->autocfg.dig_out _pin)2375 if (spec->autocfg.dig_outs) 2382 2376 spec->multiout.dig_out_nid = VT1708B_DIGOUT_NID; 2383 2377 if (spec->autocfg.dig_in_pin) … … 2841 2835 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 2842 2836 2843 if (spec->autocfg.dig_out _pin)2837 if (spec->autocfg.dig_outs) 2844 2838 spec->multiout.dig_out_nid = VT1708S_DIGOUT_NID; 2845 2839 … … 3160 3154 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 3161 3155 3162 if (spec->autocfg.dig_out _pin)3156 if (spec->autocfg.dig_outs) 3163 3157 spec->multiout.dig_out_nid = VT1702_DIGOUT_NID; 3164 3158 … … 3253 3247 * patch entries 3254 3248 */ 3255 st ruct hda_codec_preset snd_hda_preset_via[] = {3256 { .id = 0x11061708, .name = "V IA VT1708", .patch = patch_vt1708},3257 { .id = 0x11061709, .name = "V IA VT1708", .patch = patch_vt1708},3258 { .id = 0x1106170 A, .name = "VIAVT1708", .patch = patch_vt1708},3259 { .id = 0x1106170 B, .name = "VIAVT1708", .patch = patch_vt1708},3260 { .id = 0x1106 E710, .name = "VIAVT1709 10-Ch",3249 static struct hda_codec_preset snd_hda_preset_via[] = { 3250 { .id = 0x11061708, .name = "VT1708", .patch = patch_vt1708}, 3251 { .id = 0x11061709, .name = "VT1708", .patch = patch_vt1708}, 3252 { .id = 0x1106170a, .name = "VT1708", .patch = patch_vt1708}, 3253 { .id = 0x1106170b, .name = "VT1708", .patch = patch_vt1708}, 3254 { .id = 0x1106e710, .name = "VT1709 10-Ch", 3261 3255 .patch = patch_vt1709_10ch}, 3262 { .id = 0x1106 E711, .name = "VIAVT1709 10-Ch",3256 { .id = 0x1106e711, .name = "VT1709 10-Ch", 3263 3257 .patch = patch_vt1709_10ch}, 3264 { .id = 0x1106 E712, .name = "VIAVT1709 10-Ch",3258 { .id = 0x1106e712, .name = "VT1709 10-Ch", 3265 3259 .patch = patch_vt1709_10ch}, 3266 { .id = 0x1106 E713, .name = "VIAVT1709 10-Ch",3260 { .id = 0x1106e713, .name = "VT1709 10-Ch", 3267 3261 .patch = patch_vt1709_10ch}, 3268 { .id = 0x1106 E714, .name = "VIAVT1709 6-Ch",3262 { .id = 0x1106e714, .name = "VT1709 6-Ch", 3269 3263 .patch = patch_vt1709_6ch}, 3270 { .id = 0x1106 E715, .name = "VIAVT1709 6-Ch",3264 { .id = 0x1106e715, .name = "VT1709 6-Ch", 3271 3265 .patch = patch_vt1709_6ch}, 3272 { .id = 0x1106 E716, .name = "VIAVT1709 6-Ch",3266 { .id = 0x1106e716, .name = "VT1709 6-Ch", 3273 3267 .patch = patch_vt1709_6ch}, 3274 { .id = 0x1106 E717, .name = "VIAVT1709 6-Ch",3268 { .id = 0x1106e717, .name = "VT1709 6-Ch", 3275 3269 .patch = patch_vt1709_6ch}, 3276 { .id = 0x1106 E720, .name = "VIAVT1708B 8-Ch",3270 { .id = 0x1106e720, .name = "VT1708B 8-Ch", 3277 3271 .patch = patch_vt1708B_8ch}, 3278 { .id = 0x1106 E721, .name = "VIAVT1708B 8-Ch",3272 { .id = 0x1106e721, .name = "VT1708B 8-Ch", 3279 3273 .patch = patch_vt1708B_8ch}, 3280 { .id = 0x1106 E722, .name = "VIAVT1708B 8-Ch",3274 { .id = 0x1106e722, .name = "VT1708B 8-Ch", 3281 3275 .patch = patch_vt1708B_8ch}, 3282 { .id = 0x1106 E723, .name = "VIAVT1708B 8-Ch",3276 { .id = 0x1106e723, .name = "VT1708B 8-Ch", 3283 3277 .patch = patch_vt1708B_8ch}, 3284 { .id = 0x1106 E724, .name = "VIAVT1708B 4-Ch",3278 { .id = 0x1106e724, .name = "VT1708B 4-Ch", 3285 3279 .patch = patch_vt1708B_4ch}, 3286 { .id = 0x1106 E725, .name = "VIAVT1708B 4-Ch",3280 { .id = 0x1106e725, .name = "VT1708B 4-Ch", 3287 3281 .patch = patch_vt1708B_4ch}, 3288 { .id = 0x1106 E726, .name = "VIAVT1708B 4-Ch",3282 { .id = 0x1106e726, .name = "VT1708B 4-Ch", 3289 3283 .patch = patch_vt1708B_4ch}, 3290 { .id = 0x1106 E727, .name = "VIAVT1708B 4-Ch",3284 { .id = 0x1106e727, .name = "VT1708B 4-Ch", 3291 3285 .patch = patch_vt1708B_4ch}, 3292 { .id = 0x11060397, .name = "V IA VT1708S",3286 { .id = 0x11060397, .name = "VT1708S", 3293 3287 .patch = patch_vt1708S}, 3294 { .id = 0x11061397, .name = "V IA VT1708S",3288 { .id = 0x11061397, .name = "VT1708S", 3295 3289 .patch = patch_vt1708S}, 3296 { .id = 0x11062397, .name = "V IA VT1708S",3290 { .id = 0x11062397, .name = "VT1708S", 3297 3291 .patch = patch_vt1708S}, 3298 { .id = 0x11063397, .name = "V IA VT1708S",3292 { .id = 0x11063397, .name = "VT1708S", 3299 3293 .patch = patch_vt1708S}, 3300 { .id = 0x11064397, .name = "V IA VT1708S",3294 { .id = 0x11064397, .name = "VT1708S", 3301 3295 .patch = patch_vt1708S}, 3302 { .id = 0x11065397, .name = "V IA VT1708S",3296 { .id = 0x11065397, .name = "VT1708S", 3303 3297 .patch = patch_vt1708S}, 3304 { .id = 0x11066397, .name = "V IA VT1708S",3298 { .id = 0x11066397, .name = "VT1708S", 3305 3299 .patch = patch_vt1708S}, 3306 { .id = 0x11067397, .name = "V IA VT1708S",3300 { .id = 0x11067397, .name = "VT1708S", 3307 3301 .patch = patch_vt1708S}, 3308 { .id = 0x11060398, .name = "V IA VT1702",3302 { .id = 0x11060398, .name = "VT1702", 3309 3303 .patch = patch_vt1702}, 3310 { .id = 0x11061398, .name = "V IA VT1702",3304 { .id = 0x11061398, .name = "VT1702", 3311 3305 .patch = patch_vt1702}, 3312 { .id = 0x11062398, .name = "V IA VT1702",3306 { .id = 0x11062398, .name = "VT1702", 3313 3307 .patch = patch_vt1702}, 3314 { .id = 0x11063398, .name = "V IA VT1702",3308 { .id = 0x11063398, .name = "VT1702", 3315 3309 .patch = patch_vt1702}, 3316 { .id = 0x11064398, .name = "V IA VT1702",3310 { .id = 0x11064398, .name = "VT1702", 3317 3311 .patch = patch_vt1702}, 3318 { .id = 0x11065398, .name = "V IA VT1702",3312 { .id = 0x11065398, .name = "VT1702", 3319 3313 .patch = patch_vt1702}, 3320 { .id = 0x11066398, .name = "V IA VT1702",3314 { .id = 0x11066398, .name = "VT1702", 3321 3315 .patch = patch_vt1702}, 3322 { .id = 0x11067398, .name = "V IA VT1702",3316 { .id = 0x11067398, .name = "VT1702", 3323 3317 .patch = patch_vt1702}, 3324 3318 {0} /* terminator */ 3325 3319 }; 3320 3321 MODULE_ALIAS("snd-hda-codec-id:1106*"); 3322 3323 static struct hda_codec_preset_list via_list = { 3324 .preset = snd_hda_preset_via, 3325 .owner = THIS_MODULE, 3326 }; 3327 3328 MODULE_LICENSE("GPL"); 3329 MODULE_DESCRIPTION("VIA HD-audio codec"); 3330 3331 static int __init patch_via_init(void) 3332 { 3333 return snd_hda_add_codec_preset(&via_list); 3334 } 3335 3336 static void __exit patch_via_exit(void) 3337 { 3338 snd_hda_delete_codec_preset(&via_list); 3339 } 3340 3341 module_init(patch_via_init) 3342 module_exit(patch_via_exit) -
GPL/trunk/alsa-kernel/pci/intel8x0.c
r410 r426 358 358 unsigned int position; 359 359 unsigned int pos_shift; 360 unsigned int last_pos; 361 unsigned long last_pos_jiffies; 362 unsigned int jiffy_to_bytes; 360 363 int frags; 361 364 int lvi; … … 620 623 if (chip->buggy_semaphore) 621 624 return 0; /* just ignore ... */ 622 while ( time--&& (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY))625 while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY)) 623 626 udelay(1); 624 627 if (! time && ! chip->in_ac97_init) … … 692 695 ichdev->fragsize >> ichdev->pos_shift); 693 696 #if 0 694 printk( "bdbar[%i] = 0x%x [0x%x]\n",697 printk(KERN_DEBUG "bdbar[%i] = 0x%x [0x%x]\n", 695 698 idx + 0, bdbar[idx + 0], bdbar[idx + 1]); 696 699 #endif … … 704 707 ichdev->position = 0; 705 708 #if 0 706 printk("lvi_frag = %i, frags = %i, period_size = 0x%x, period_size1 = 0x%x\n", 707 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, ichdev->fragsize1); 709 printk(KERN_DEBUG "lvi_frag = %i, frags = %i, period_size = 0x%x, " 710 "period_size1 = 0x%x\n", 711 ichdev->lvi_frag, ichdev->frags, ichdev->fragsize, 712 ichdev->fragsize1); 708 713 #endif 709 714 /* clear interrupts */ … … 771 776 ichdev->bdbar[ichdev->lvi * 2] = cpu_to_le32(ichdev->physbuf + ichdev->lvi_frag * ichdev->fragsize1); 772 777 #if 0 773 printk("new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, all = 0x%x, 0x%x\n", 778 printk(KERN_DEBUG "new: bdbar[%i] = 0x%x [0x%x], prefetch = %i, " 779 "all = 0x%x, 0x%x\n", 774 780 ichdev->lvi * 2, ichdev->bdbar[ichdev->lvi * 2], 775 781 ichdev->bdbar[ichdev->lvi * 2 + 1], inb(ICH_REG_OFF_PIV + port), … … 838 844 /* fallthru */ 839 845 case SNDRV_PCM_TRIGGER_START: 846 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 840 847 val = ICH_IOCE | ICH_STARTBM; 848 ichdev->last_pos = ichdev->position; 849 ichdev->last_pos_jiffies = jiffies; 841 850 break; 842 851 case SNDRV_PCM_TRIGGER_SUSPEND: … … 848 857 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 849 858 val = ICH_IOCE; 850 break;851 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:852 val = ICH_IOCE | ICH_STARTBM;853 859 break; 854 860 default: … … 1045 1051 } 1046 1052 snd_intel8x0_setup_periods(chip, ichdev); 1053 ichdev->jiffy_to_bytes = (runtime->rate * 4 * ichdev->pos_shift) / HZ; 1047 1054 return 0; 1048 1055 } … … 1053 1060 struct ichdev *ichdev = get_ichdev(substream); 1054 1061 size_t ptr1, ptr; 1055 int civ, timeout = 10 0;1062 int civ, timeout = 10; 1056 1063 unsigned int position; 1057 1064 … … 1069 1076 break; 1070 1077 } while (timeout--); 1071 ptr1 <<= ichdev->pos_shift; 1072 ptr = ichdev->fragsize1 - ptr1; 1073 ptr += position; 1078 if (ptr1 != 0) { 1079 ptr1 <<= ichdev->pos_shift; 1080 ptr = ichdev->fragsize1 - ptr1; 1081 ptr += position; 1082 ichdev->last_pos = ptr; 1083 ichdev->last_pos_jiffies = jiffies; 1084 } else { 1085 ptr1 = jiffies - ichdev->last_pos_jiffies; 1086 if (ptr1) 1087 ptr1 -= 1; 1088 ptr = ichdev->last_pos + ptr1 * ichdev->jiffy_to_bytes; 1089 ptr %= ichdev->size; 1090 } 1074 1091 spin_unlock(&chip->reg_lock); 1075 1092 if (ptr >= ichdev->size) … … 1842 1859 { 1843 1860 .subvendor = 0x1028, 1861 .subdevice = 0x016a, 1862 .name = "Dell Inspiron 8600", /* STAC9750/51 */ 1863 .type = AC97_TUNE_HP_ONLY 1864 }, 1865 { 1866 .subvendor = 0x1028, 1844 1867 .subdevice = 0x0186, 1845 1868 .name = "Dell Latitude D810", /* cf. Malone #41015 */ … … 1880 1903 .subdevice = 0x0890, 1881 1904 .name = "HP nc6000", 1882 .type = AC97_TUNE_MUTE_LED1883 },1884 {1885 .subvendor = 0x103c,1886 .subdevice = 0x0934,1887 .name = "HP nx8220",1888 1905 .type = AC97_TUNE_MUTE_LED 1889 1906 }, … … 2292 2309 } 2293 2310 2294 static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing) 2295 { 2296 unsigned long end_time; 2297 unsigned int cnt, status, nstatus; 2298 2299 /* put logic to right state */ 2300 /* first clear status bits */ 2301 status = ICH_RCS | ICH_MCINT | ICH_POINT | ICH_PIINT; 2302 if (chip->device_type == DEVICE_NFORCE) 2303 status |= ICH_NVSPINT; 2304 cnt = igetdword(chip, ICHREG(GLOB_STA)); 2305 iputdword(chip, ICHREG(GLOB_STA), cnt & status); 2306 2311 #ifdef CONFIG_SND_AC97_POWER_SAVE 2312 static struct snd_pci_quirk ich_chip_reset_mode[] = { 2313 SND_PCI_QUIRK(0x1014, 0x051f, "Thinkpad R32", 1), 2314 { } /* end */ 2315 }; 2316 2317 static int snd_intel8x0_ich_chip_cold_reset(struct intel8x0 *chip) 2318 { 2319 unsigned int cnt; 2307 2320 /* ACLink on, 2 channels */ 2321 2322 if (snd_pci_quirk_lookup(chip->pci, ich_chip_reset_mode)) 2323 return -EIO; 2324 2308 2325 cnt = igetdword(chip, ICHREG(GLOB_CNT)); 2309 2326 cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK); 2310 #ifdef CONFIG_SND_AC97_POWER_SAVE 2327 2311 2328 /* do cold reset - the full ac97 powerdown may leave the controller 2312 2329 * in a warm state but actually it cannot communicate with the codec. … … 2317 2334 iputdword(chip, ICHREG(GLOB_CNT), cnt | ICH_AC97COLD); 2318 2335 msleep(1); 2336 return 0; 2337 } 2338 #define snd_intel8x0_ich_chip_can_cold_reset(chip) \ 2339 (!snd_pci_quirk_lookup(chip->pci, ich_chip_reset_mode)) 2319 2340 #else 2341 #define snd_intel8x0_ich_chip_cold_reset(chip) 0 2342 #define snd_intel8x0_ich_chip_can_cold_reset(chip) (0) 2343 #endif 2344 2345 static int snd_intel8x0_ich_chip_reset(struct intel8x0 *chip) 2346 { 2347 unsigned long end_time; 2348 unsigned int cnt; 2349 /* ACLink on, 2 channels */ 2350 cnt = igetdword(chip, ICHREG(GLOB_CNT)); 2351 cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK); 2320 2352 /* finish cold or do warm reset */ 2321 2353 cnt |= (cnt & ICH_AC97COLD) == 0 ? ICH_AC97COLD : ICH_AC97WARM; … … 2324 2356 do { 2325 2357 if ((igetdword(chip, ICHREG(GLOB_CNT)) & ICH_AC97WARM) == 0) 2326 goto __ok;2358 return 0; 2327 2359 schedule_timeout_uninterruptible(1); 2328 2360 } while (time_after_eq(end_time, jiffies)); … … 2330 2362 igetdword(chip, ICHREG(GLOB_CNT))); 2331 2363 return -EIO; 2332 2333 __ok: 2334 #endif 2364 } 2365 2366 static int snd_intel8x0_ich_chip_init(struct intel8x0 *chip, int probing) 2367 { 2368 unsigned long end_time; 2369 unsigned int status, nstatus; 2370 unsigned int cnt; 2371 int err; 2372 2373 /* put logic to right state */ 2374 /* first clear status bits */ 2375 status = ICH_RCS | ICH_MCINT | ICH_POINT | ICH_PIINT; 2376 if (chip->device_type == DEVICE_NFORCE) 2377 status |= ICH_NVSPINT; 2378 cnt = igetdword(chip, ICHREG(GLOB_STA)); 2379 iputdword(chip, ICHREG(GLOB_STA), cnt & status); 2380 2381 if (snd_intel8x0_ich_chip_can_cold_reset(chip)) 2382 err = snd_intel8x0_ich_chip_cold_reset(chip); 2383 else 2384 err = snd_intel8x0_ich_chip_reset(chip); 2385 if (err < 0) 2386 return err; 2387 2335 2388 if (probing) { 2336 2389 /* wait for any codec ready status. … … 2627 2680 struct ichdev *ichdev; 2628 2681 unsigned long port; 2629 unsigned long pos, t; 2630 struct timeval start_time, stop_time; 2682 unsigned long pos, pos1, t; 2683 int civ, timeout = 1000, attempt = 1; 2684 struct timespec start_time, stop_time; 2631 2685 2632 2686 if (chip->ac97_bus->clock != 48000) 2633 2687 return; /* specified in module option */ 2634 2688 2689 __again: 2635 2690 subs = chip->pcm[0]->streams[0].substream; 2636 2691 if (! subs || subs->dma_buffer.bytes < INTEL8X0_TESTBUF_SIZE) { … … 2640 2695 ichdev = &chip->ichd[ICHD_PCMOUT]; 2641 2696 ichdev->physbuf = subs->dma_buffer.addr; 2642 ichdev->size = chip->ichd[ICHD_PCMOUT].fragsize = INTEL8X0_TESTBUF_SIZE;2697 ichdev->size = ichdev->fragsize = INTEL8X0_TESTBUF_SIZE; 2643 2698 ichdev->substream = NULL; /* don't process interrupts */ 2644 2699 … … 2659 2714 iputdword(chip, ICHREG(ALI_DMACR), 1 << ichdev->ali_slot); 2660 2715 } 2661 do_ gettimeofday(&start_time);2716 do_posix_clock_monotonic_gettime(&start_time); 2662 2717 spin_unlock_irq(&chip->reg_lock); 2663 2718 msleep(50); 2664 2719 spin_lock_irq(&chip->reg_lock); 2665 2720 /* check the position */ 2666 pos = ichdev->fragsize1; 2667 pos -= igetword(chip, ichdev->reg_offset + ichdev->roff_picb) << ichdev->pos_shift; 2668 pos += ichdev->position; 2721 do { 2722 civ = igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV); 2723 pos1 = igetword(chip, ichdev->reg_offset + ichdev->roff_picb); 2724 if (pos1 == 0) { 2725 udelay(10); 2726 continue; 2727 } 2728 if (civ == igetbyte(chip, ichdev->reg_offset + ICH_REG_OFF_CIV) && 2729 pos1 == igetword(chip, ichdev->reg_offset + ichdev->roff_picb)) 2730 break; 2731 } while (timeout--); 2732 if (pos1 == 0) { /* oops, this value is not reliable */ 2733 pos = 0; 2734 } else { 2735 pos = ichdev->fragsize1; 2736 pos -= pos1 << ichdev->pos_shift; 2737 pos += ichdev->position; 2738 } 2669 2739 chip->in_measurement = 0; 2670 do_ gettimeofday(&stop_time);2740 do_posix_clock_monotonic_gettime(&stop_time); 2671 2741 /* stop */ 2672 2742 if (chip->device_type == DEVICE_ALI) { … … 2683 2753 spin_unlock_irq(&chip->reg_lock); 2684 2754 2755 if (pos == 0) { 2756 snd_printk(KERN_ERR "intel8x0: measure - unreliable DMA position..\n"); 2757 __retry: 2758 if (attempt < 3) { 2759 msleep(300); 2760 attempt++; 2761 goto __again; 2762 } 2763 goto __end; 2764 } 2765 2766 pos /= 4; 2685 2767 t = stop_time.tv_sec - start_time.tv_sec; 2686 2768 t *= 1000000; 2687 t += stop_time.tv_usec - start_time.tv_usec;2688 printk(KERN_INFO "%s: measured %lu usecs \n", __func__, t);2769 t += (stop_time.tv_nsec - start_time.tv_nsec) / 1000; 2770 printk(KERN_INFO "%s: measured %lu usecs (%lu samples)\n", __func__, t, pos); 2689 2771 if (t == 0) { 2690 snd_printk(KERN_ERR " ?? calculation error..\n");2691 return;2692 } 2693 pos = (pos / 4) *1000;2772 snd_printk(KERN_ERR "intel8x0: ?? calculation error..\n"); 2773 goto __retry; 2774 } 2775 pos *= 1000; 2694 2776 pos = (pos / t) * 1000 + ((pos % t) * 1000) / t; 2695 if (pos < 40000 || pos >= 60000) 2777 if (pos < 40000 || pos >= 60000) { 2696 2778 /* abnormal value. hw problem? */ 2697 2779 printk(KERN_INFO "intel8x0: measured clock %ld rejected\n", pos); 2780 goto __retry; 2781 } else if (pos > 40500 && pos < 41500) 2782 /* first exception - 41000Hz reference clock */ 2783 chip->ac97_bus->clock = 41000; 2784 else if (pos > 43600 && pos < 44600) 2785 /* second exception - 44100HZ reference clock */ 2786 chip->ac97_bus->clock = 44100; 2698 2787 else if (pos < 47500 || pos > 48500) 2699 2788 /* not 48000Hz, tuning the clock.. */ 2700 2789 chip->ac97_bus->clock = (chip->ac97_bus->clock * 48000) / pos; 2790 __end: 2701 2791 printk(KERN_INFO "intel8x0: clocking to %d\n", chip->ac97_bus->clock); 2702 2792 snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0); -
GPL/trunk/alsa-kernel/pci/maestro3.c
r410 r426 2535 2535 2536 2536 /* check, if we can restrict PCI DMA transfers to 28 bits */ 2537 if (pci_set_dma_mask(pci, DMA_ 28BIT_MASK) < 0 ||2538 pci_set_consistent_dma_mask(pci, DMA_ 28BIT_MASK) < 0) {2537 if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || 2538 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { 2539 2539 snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); 2540 2540 pci_disable_device(pci); -
GPL/trunk/alsa-kernel/pci/rme9652/hdsp.c
r410 r426 114 114 /* the meters are regular i/o-mapped registers, but offset 115 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 117 the actual peak value is in the most-significant 24 bits. 118 118 */ … … 132 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 135 #define HDSP_9652_rmsBase 4096 136 136 … … 174 174 #define HDSP_SPDIFNonAudio (1<<11) /* 0=off, 1=on */ 175 175 #define HDSP_SPDIFOpticalOut (1<<12) /* 1=use 1st ADAT connector for SPDIF, 0=do not */ 176 #define HDSP_SyncRef2 (1<<13) 177 #define HDSP_SPDIFInputSelect0 (1<<14) 178 #define HDSP_SPDIFInputSelect1 (1<<15) 179 #define HDSP_SyncRef0 (1<<16) 176 #define HDSP_SyncRef2 (1<<13) 177 #define HDSP_SPDIFInputSelect0 (1<<14) 178 #define HDSP_SPDIFInputSelect1 (1<<15) 179 #define HDSP_SyncRef0 (1<<16) 180 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 182 #define HDSP_XLRBreakoutCable (1<<20) /* For H9632 cards */ 183 183 #define HDSP_Midi0InterruptEnable (1<<22) … … 315 315 #define HDSP_AEBO (1<<28) /* H9632 specific Analog Extension Boards */ 316 316 #define HDSP_AEBI (1<<29) /* 0 = present, 1 = absent */ 317 #define HDSP_midi0IRQPending (1<<30) 317 #define HDSP_midi0IRQPending (1<<30) 318 318 #define HDSP_midi1IRQPending (1<<31) 319 319 … … 392 392 393 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 395 Multiface still uses the same memory area. 396 396 … … 461 461 unsigned char ds_in_channels; 462 462 unsigned char ss_in_channels; /* different for multiface/digiface */ 463 unsigned char qs_out_channels; 463 unsigned char qs_out_channels; 464 464 unsigned char ds_out_channels; 465 465 unsigned char ss_out_channels; … … 503 503 static char channel_map_mf_ss[HDSP_MAX_CHANNELS] = { /* Multiface */ 504 504 /* Analog */ 505 0, 1, 2, 3, 4, 5, 6, 7, 505 0, 1, 2, 3, 4, 5, 6, 7, 506 506 /* ADAT 2 */ 507 16, 17, 18, 19, 20, 21, 22, 23, 507 16, 17, 18, 19, 20, 21, 22, 23, 508 508 /* SPDIF */ 509 509 24, 25, … … 526 526 8, 9, 527 527 /* Analog */ 528 10, 11, 528 10, 11, 529 529 /* AO4S-192 and AI4S-192 extension boards */ 530 530 12, 13, 14, 15, 531 531 /* others don't exist */ 532 -1, -1, -1, -1, -1, -1, -1, -1, 532 -1, -1, -1, -1, -1, -1, -1, -1, 533 533 -1, -1 534 534 }; … … 540 540 8, 9, 541 541 /* Analog */ 542 10, 11, 542 10, 11, 543 543 /* AO4S-192 and AI4S-192 extension boards */ 544 544 12, 13, 14, 15, … … 588 588 { 589 589 .vendor = PCI_VENDOR_ID_XILINX, 590 .device = PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP, 590 .device = PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP, 591 591 .subvendor = PCI_ANY_ID, 592 592 .subdevice = PCI_ANY_ID, … … 654 654 static int hdsp_check_for_iobox (struct hdsp *hdsp) 655 655 { 656 657 656 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return 0; 658 657 if (hdsp_read (hdsp, HDSP_statusRegister) & HDSP_ConfigError) { … … 662 661 } 663 662 return 0; 664 663 } 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 … … 671 692 672 693 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 673 694 674 695 snd_printk ("Hammerfall-DSP: loading firmware\n"); 675 696 676 697 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_PROGRAM); 677 698 hdsp_write (hdsp, HDSP_fifoData, 0); 678 699 679 700 if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { 680 701 snd_printk ("Hammerfall-DSP: timeout waiting for download preparation\n"); 681 702 return -EIO; 682 703 } 683 704 684 705 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); 685 706 686 707 for (i = 0; i < 24413; ++i) { 687 708 hdsp_write(hdsp, HDSP_fifoData, hdsp->firmware_cache[i]); … … 693 714 694 715 ssleep(3); 695 716 696 717 if (hdsp_fifo_wait (hdsp, 0, HDSP_LONG_WAIT)) { 697 718 snd_printk ("Hammerfall-DSP: timeout at end of firmware loading\n"); … … 706 727 hdsp_write (hdsp, HDSP_control2Reg, hdsp->control2_register); 707 728 snd_printk ("Hammerfall-DSP: finished firmware loading\n"); 708 729 709 730 } 710 731 if (hdsp->state & HDSP_InitializationComplete) { … … 712 733 spin_lock_irqsave(&hdsp->lock, flags); 713 734 snd_hdsp_set_defaults(hdsp); 714 spin_unlock_irqrestore(&hdsp->lock, flags); 715 } 716 735 spin_unlock_irqrestore(&hdsp->lock, flags); 736 } 737 717 738 hdsp->state |= HDSP_FirmwareLoaded; 718 739 … … 723 744 { 724 745 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 725 746 726 747 hdsp_write (hdsp, HDSP_control2Reg, HDSP_PROGRAM); 727 748 hdsp_write (hdsp, HDSP_fifoData, 0); … … 739 760 } else { 740 761 hdsp->io_type = Digiface; 741 } 762 } 742 763 } else { 743 764 /* firmware was already loaded, get iobox type */ … … 787 808 788 809 static int hdsp_fifo_wait(struct hdsp *hdsp, int count, int timeout) 789 { 810 { 790 811 int i; 791 812 … … 793 814 are available in the command FIFO. 794 815 */ 795 816 796 817 for (i = 0; i < timeout; i++) { 797 818 … … 825 846 if (addr >= HDSP_MATRIX_MIXER_SIZE) 826 847 return -1; 827 848 828 849 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) { 829 850 830 851 /* from martin bjornsen: 831 852 832 853 "You can only write dwords to the 833 854 mixer memory which contain two … … 848 869 hdsp->mixer_matrix[addr] = data; 849 870 850 871 851 872 /* `addr' addresses a 16-bit wide address, but 852 873 the address space accessed via hdsp_write … … 857 878 */ 858 879 ad = addr/2; 859 860 hdsp_write (hdsp, 4096 + (ad*4), 861 (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + 880 881 hdsp_write (hdsp, 4096 + (ad*4), 882 (hdsp->mixer_matrix[(addr&0x7fe)+1] << 16) + 862 883 hdsp->mixer_matrix[addr&0x7fe]); 863 884 864 885 return 0; 865 886 … … 867 888 868 889 ad = (addr << 16) + data; 869 890 870 891 if (hdsp_fifo_wait(hdsp, 127, HDSP_LONG_WAIT)) 871 892 return -1; … … 903 924 if (status & HDSP_SPDIFErrorFlag) 904 925 return 0; 905 926 906 927 switch (rate_bits) { 907 928 case HDSP_spdifFrequency32KHz: return 32000; … … 911 932 case HDSP_spdifFrequency88_2KHz: return 88200; 912 933 case HDSP_spdifFrequency96KHz: return 96000; 913 case HDSP_spdifFrequency128KHz: 934 case HDSP_spdifFrequency128KHz: 914 935 if (hdsp->io_type == H9632) return 128000; 915 936 break; 916 case HDSP_spdifFrequency176_4KHz: 937 case HDSP_spdifFrequency176_4KHz: 917 938 if (hdsp->io_type == H9632) return 176400; 918 939 break; 919 case HDSP_spdifFrequency192KHz: 940 case HDSP_spdifFrequency192KHz: 920 941 if (hdsp->io_type == H9632) return 192000; 921 942 break; … … 1028 1049 u64 n; 1029 1050 u32 r; 1030 1051 1031 1052 if (rate >= 112000) 1032 1053 rate /= 4; … … 1054 1075 initialization). 1055 1076 */ 1056 1057 if (!(hdsp->control_register & HDSP_ClockModeMaster)) { 1077 1078 if (!(hdsp->control_register & HDSP_ClockModeMaster)) { 1058 1079 if (called_internally) { 1059 1080 /* request from ctl or card initialization */ 1060 1081 snd_printk(KERN_ERR "Hammerfall-DSP: device is not running as a clock master: cannot set sample rate.\n"); 1061 1082 return -1; 1062 } else { 1083 } else { 1063 1084 /* hw_param request while in AutoSync mode */ 1064 1085 int external_freq = hdsp_external_sample_rate(hdsp); 1065 1086 int spdif_freq = hdsp_spdif_sample_rate(hdsp); 1066 1087 1067 1088 if ((spdif_freq == external_freq*2) && (hdsp_autosync_ref(hdsp) >= HDSP_AUTOSYNC_FROM_ADAT1)) 1068 1089 snd_printk(KERN_INFO "Hammerfall-DSP: Detected ADAT in double speed mode\n"); 1069 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 1092 else if (rate != external_freq) { 1072 1093 snd_printk(KERN_INFO "Hammerfall-DSP: No AutoSync source for requested rate\n"); 1073 1094 return -1; 1074 } 1075 } 1095 } 1096 } 1076 1097 } 1077 1098 … … 1080 1101 /* Changing from a "single speed" to a "double speed" rate is 1081 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 1104 the DMA buffers and a reduction in the number of available 1084 buffers. 1105 buffers. 1085 1106 1086 1107 Note that a similar but essentially insoluble problem … … 1090 1111 if (rate > 96000 && hdsp->io_type != H9632) 1091 1112 return -EINVAL; 1092 1113 1093 1114 switch (rate) { 1094 1115 case 32000: … … 1180 1201 } 1181 1202 } 1182 1203 1183 1204 hdsp->system_sample_rate = rate; 1184 1205 … … 1246 1267 1247 1268 /* Output is not interrupt driven */ 1248 1269 1249 1270 spin_lock_irqsave (&hmidi->lock, flags); 1250 1271 if (hmidi->output) { … … 1253 1274 if (n_pending > (int)sizeof (buf)) 1254 1275 n_pending = sizeof (buf); 1255 1276 1256 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 1279 snd_hdsp_midi_write_byte (hmidi->hdsp, hmidi->id, buf[i]); 1259 1280 } … … 1326 1347 struct hdsp_midi *hmidi = (struct hdsp_midi *) data; 1327 1348 unsigned long flags; 1328 1349 1329 1350 snd_hdsp_midi_output_write(hmidi); 1330 1351 spin_lock_irqsave (&hmidi->lock, flags); … … 1333 1354 kernel automatically removed the timer when it 1334 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 … … 1502 1523 { 1503 1524 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1504 1525 1505 1526 snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif); 1506 1527 return 0; … … 1512 1533 int change; 1513 1534 u32 val; 1514 1535 1515 1536 val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); 1516 1537 spin_lock_irq(&hdsp->lock); … … 1531 1552 { 1532 1553 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1533 1554 1534 1555 snd_hdsp_convert_to_aes(&ucontrol->value.iec958, hdsp->creg_spdif_stream); 1535 1556 return 0; … … 1541 1562 int change; 1542 1563 u32 val; 1543 1564 1544 1565 val = snd_hdsp_convert_from_aes(&ucontrol->value.iec958); 1545 1566 spin_lock_irq(&hdsp->lock); … … 1603 1624 { 1604 1625 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1605 1626 1606 1627 ucontrol->value.enumerated.item[0] = hdsp_spdif_in(hdsp); 1607 1628 return 0; … … 1613 1634 int change; 1614 1635 unsigned int val; 1615 1636 1616 1637 if (!snd_hdsp_use_is_exclusive(hdsp)) 1617 1638 return -EBUSY; … … 1650 1671 { 1651 1672 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1652 1673 1653 1674 ucontrol->value.integer.value[0] = hdsp_spdif_out(hdsp); 1654 1675 return 0; … … 1660 1681 int change; 1661 1682 unsigned int val; 1662 1683 1663 1684 if (!snd_hdsp_use_is_exclusive(hdsp)) 1664 1685 return -EBUSY; … … 1694 1715 { 1695 1716 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1696 1717 1697 1718 ucontrol->value.integer.value[0] = hdsp_spdif_professional(hdsp); 1698 1719 return 0; … … 1704 1725 int change; 1705 1726 unsigned int val; 1706 1727 1707 1728 if (!snd_hdsp_use_is_exclusive(hdsp)) 1708 1729 return -EBUSY; … … 1738 1759 { 1739 1760 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1740 1761 1741 1762 ucontrol->value.integer.value[0] = hdsp_spdif_emphasis(hdsp); 1742 1763 return 0; … … 1748 1769 int change; 1749 1770 unsigned int val; 1750 1771 1751 1772 if (!snd_hdsp_use_is_exclusive(hdsp)) 1752 1773 return -EBUSY; … … 1782 1803 { 1783 1804 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1784 1805 1785 1806 ucontrol->value.integer.value[0] = hdsp_spdif_nonaudio(hdsp); 1786 1807 return 0; … … 1792 1813 int change; 1793 1814 unsigned int val; 1794 1815 1795 1816 if (!snd_hdsp_use_is_exclusive(hdsp)) 1796 1817 return -EBUSY; … … 1829 1850 { 1830 1851 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1831 1852 1832 1853 switch (hdsp_spdif_sample_rate(hdsp)) { 1833 1854 case 32000: … … 1859 1880 break; 1860 1881 default: 1861 ucontrol->value.enumerated.item[0] = 6; 1882 ucontrol->value.enumerated.item[0] = 6; 1862 1883 } 1863 1884 return 0; … … 1883 1904 { 1884 1905 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1885 1906 1886 1907 ucontrol->value.enumerated.item[0] = hdsp->system_sample_rate; 1887 1908 return 0; … … 1900 1921 { 1901 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 1924 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1904 1925 uinfo->count = 1; … … 1913 1934 { 1914 1935 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1915 1936 1916 1937 switch (hdsp_external_sample_rate(hdsp)) { 1917 1938 case 32000: … … 1941 1962 case 192000: 1942 1963 ucontrol->value.enumerated.item[0] = 9; 1943 break; 1964 break; 1944 1965 default: 1945 ucontrol->value.enumerated.item[0] = 6; 1966 ucontrol->value.enumerated.item[0] = 6; 1946 1967 } 1947 1968 return 0; … … 1969 1990 { 1970 1991 static char *texts[] = {"Master", "Slave" }; 1971 1992 1972 1993 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1973 1994 uinfo->count = 1; … … 1982 2003 { 1983 2004 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 1984 2005 1985 2006 ucontrol->value.enumerated.item[0] = hdsp_system_clock_mode(hdsp); 1986 2007 return 0; … … 2019 2040 return 9; 2020 2041 default: 2021 return 3; 2042 return 3; 2022 2043 } 2023 2044 } else { … … 2033 2054 if (hdsp_external_sample_rate(hdsp) != 0) { 2034 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 2057 hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); 2037 2058 return 0; … … 2044 2065 case HDSP_CLOCK_SOURCE_INTERNAL_44_1KHZ: 2045 2066 rate = 44100; 2046 break; 2067 break; 2047 2068 case HDSP_CLOCK_SOURCE_INTERNAL_48KHZ: 2048 2069 rate = 48000; … … 2079 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 2101 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2081 2102 2082 2103 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2083 2104 uinfo->count = 1; … … 2085 2106 uinfo->value.enumerated.items = 10; 2086 2107 else 2087 uinfo->value.enumerated.items = 7; 2108 uinfo->value.enumerated.items = 7; 2088 2109 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 2089 2110 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; … … 2095 2116 { 2096 2117 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2097 2118 2098 2119 ucontrol->value.enumerated.item[0] = hdsp_clock_source(hdsp); 2099 2120 return 0; … … 2105 2126 int change; 2106 2127 int val; 2107 2128 2108 2129 if (!snd_hdsp_use_is_exclusive(hdsp)) 2109 2130 return -EBUSY; … … 2131 2152 { 2132 2153 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2133 2154 2134 2155 ucontrol->value.integer.value[0] = hdsp->clock_source_locked; 2135 2156 return 0; … … 2166 2187 return 2; 2167 2188 default: 2168 return 1; 2189 return 1; 2169 2190 } 2170 2191 } … … 2181 2202 break; 2182 2203 case 2: 2183 hdsp->control_register |= HDSP_DAGainMinus10dBV; 2184 break; 2204 hdsp->control_register |= HDSP_DAGainMinus10dBV; 2205 break; 2185 2206 default: 2186 2207 return -1; … … 2194 2215 { 2195 2216 static char *texts[] = {"Hi Gain", "+4 dBu", "-10 dbV"}; 2196 2217 2197 2218 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2198 2219 uinfo->count = 1; … … 2207 2228 { 2208 2229 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2209 2230 2210 2231 ucontrol->value.enumerated.item[0] = hdsp_da_gain(hdsp); 2211 2232 return 0; … … 2217 2238 int change; 2218 2239 int val; 2219 2240 2220 2241 if (!snd_hdsp_use_is_exclusive(hdsp)) 2221 2242 return -EBUSY; … … 2251 2272 return 2; 2252 2273 default: 2253 return 1; 2274 return 1; 2254 2275 } 2255 2276 } … … 2263 2284 break; 2264 2285 case 1: 2265 hdsp->control_register |= HDSP_ADGainPlus4dBu; 2286 hdsp->control_register |= HDSP_ADGainPlus4dBu; 2266 2287 break; 2267 2288 case 2: 2268 hdsp->control_register |= HDSP_ADGainLowGain; 2269 break; 2289 hdsp->control_register |= HDSP_ADGainLowGain; 2290 break; 2270 2291 default: 2271 2292 return -1; … … 2279 2300 { 2280 2301 static char *texts[] = {"-10 dBV", "+4 dBu", "Lo Gain"}; 2281 2302 2282 2303 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2283 2304 uinfo->count = 1; … … 2292 2313 { 2293 2314 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2294 2315 2295 2316 ucontrol->value.enumerated.item[0] = hdsp_ad_gain(hdsp); 2296 2317 return 0; … … 2302 2323 int change; 2303 2324 int val; 2304 2325 2305 2326 if (!snd_hdsp_use_is_exclusive(hdsp)) 2306 2327 return -EBUSY; … … 2336 2357 return 2; 2337 2358 default: 2338 return 0; 2359 return 0; 2339 2360 } 2340 2361 } … … 2348 2369 break; 2349 2370 case 1: 2350 hdsp->control_register |= HDSP_PhoneGainMinus6dB; 2371 hdsp->control_register |= HDSP_PhoneGainMinus6dB; 2351 2372 break; 2352 2373 case 2: 2353 hdsp->control_register |= HDSP_PhoneGainMinus12dB; 2354 break; 2374 hdsp->control_register |= HDSP_PhoneGainMinus12dB; 2375 break; 2355 2376 default: 2356 2377 return -1; … … 2364 2385 { 2365 2386 static char *texts[] = {"0 dB", "-6 dB", "-12 dB"}; 2366 2387 2367 2388 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2368 2389 uinfo->count = 1; … … 2377 2398 { 2378 2399 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2379 2400 2380 2401 ucontrol->value.enumerated.item[0] = hdsp_phone_gain(hdsp); 2381 2402 return 0; … … 2387 2408 int change; 2388 2409 int val; 2389 2410 2390 2411 if (!snd_hdsp_use_is_exclusive(hdsp)) 2391 2412 return -EBUSY; … … 2433 2454 { 2434 2455 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2435 2456 2436 2457 ucontrol->value.enumerated.item[0] = hdsp_xlr_breakout_cable(hdsp); 2437 2458 return 0; … … 2443 2464 int change; 2444 2465 int val; 2445 2466 2446 2467 if (!snd_hdsp_use_is_exclusive(hdsp)) 2447 2468 return -EBUSY; … … 2489 2510 { 2490 2511 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2491 2512 2492 2513 ucontrol->value.enumerated.item[0] = hdsp_aeb(hdsp); 2493 2514 return 0; … … 2499 2520 int change; 2500 2521 int val; 2501 2522 2502 2523 if (!snd_hdsp_use_is_exclusive(hdsp)) 2503 2524 return -EBUSY; … … 2577 2598 static char *texts[] = {"Word", "IEC958", "ADAT1", "ADAT Sync", "ADAT2", "ADAT3" }; 2578 2599 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2579 2600 2580 2601 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2581 2602 uinfo->count = 1; … … 2596 2617 break; 2597 2618 } 2598 2619 2599 2620 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 2600 2621 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; … … 2606 2627 { 2607 2628 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2608 2629 2609 2630 ucontrol->value.enumerated.item[0] = hdsp_pref_sync_ref(hdsp); 2610 2631 return 0; … … 2616 2637 int change, max; 2617 2638 unsigned int val; 2618 2639 2619 2640 if (!snd_hdsp_use_is_exclusive(hdsp)) 2620 2641 return -EBUSY; … … 2665 2686 return HDSP_AUTOSYNC_FROM_SPDIF; 2666 2687 case HDSP_SelSyncRefMask: 2667 return HDSP_AUTOSYNC_FROM_NONE; 2688 return HDSP_AUTOSYNC_FROM_NONE; 2668 2689 case HDSP_SelSyncRef_ADAT1: 2669 2690 return HDSP_AUTOSYNC_FROM_ADAT1; … … 2681 2702 { 2682 2703 static char *texts[] = {"Word", "ADAT Sync", "IEC958", "None", "ADAT1", "ADAT2", "ADAT3" }; 2683 2704 2684 2705 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2685 2706 uinfo->count = 1; … … 2694 2715 { 2695 2716 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2696 2717 2697 2718 ucontrol->value.enumerated.item[0] = hdsp_autosync_ref(hdsp); 2698 2719 return 0; … … 2728 2749 { 2729 2750 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2730 2751 2731 2752 spin_lock_irq(&hdsp->lock); 2732 2753 ucontrol->value.integer.value[0] = hdsp_line_out(hdsp); … … 2740 2761 int change; 2741 2762 unsigned int val; 2742 2763 2743 2764 if (!snd_hdsp_use_is_exclusive(hdsp)) 2744 2765 return -EBUSY; … … 2774 2795 { 2775 2796 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2776 2797 2777 2798 spin_lock_irq(&hdsp->lock); 2778 2799 ucontrol->value.integer.value[0] = hdsp->precise_ptr; … … 2786 2807 int change; 2787 2808 unsigned int val; 2788 2809 2789 2810 if (!snd_hdsp_use_is_exclusive(hdsp)) 2790 2811 return -EBUSY; … … 2820 2841 { 2821 2842 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 2822 2843 2823 2844 spin_lock_irq(&hdsp->lock); 2824 2845 ucontrol->value.integer.value[0] = hdsp->use_midi_tasklet; … … 2832 2853 int change; 2833 2854 unsigned int val; 2834 2855 2835 2856 if (!snd_hdsp_use_is_exclusive(hdsp)) 2836 2857 return -EBUSY; … … 2874 2895 source = ucontrol->value.integer.value[0]; 2875 2896 destination = ucontrol->value.integer.value[1]; 2876 2897 2877 2898 if (source >= hdsp->max_channels) 2878 2899 addr = hdsp_playback_to_output_key(hdsp,source-hdsp->max_channels,destination); 2879 2900 else 2880 2901 addr = hdsp_input_to_output_key(hdsp,source, destination); 2881 2902 2882 2903 spin_lock_irq(&hdsp->lock); 2883 2904 ucontrol->value.integer.value[2] = hdsp_read_gain (hdsp, addr); … … 2927 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 2951 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2931 2952 uinfo->count = 1; … … 2972 2993 if (status & HDSP_SPDIFErrorFlag) 2973 2994 return 0; 2974 else { 2995 else { 2975 2996 if (status & HDSP_SPDIFSync) 2976 2997 return 2; … … 3008 3029 } else 3009 3030 return 0; 3010 } 3031 } 3011 3032 3012 3033 static int snd_hdsp_get_adatsync_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) … … 3026 3047 3027 3048 static int hdsp_adat_sync_check(struct hdsp *hdsp, int idx) 3028 { 3049 { 3029 3050 int status = hdsp_read(hdsp, HDSP_statusRegister); 3030 3051 3031 3052 if (status & (HDSP_Lock0>>idx)) { 3032 3053 if (status & (HDSP_Sync0>>idx)) 3033 3054 return 2; 3034 3055 else 3035 return 1; 3056 return 1; 3036 3057 } else 3037 3058 return 0; 3038 } 3059 } 3039 3060 3040 3061 static int snd_hdsp_get_adat_sync_check(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) … … 3054 3075 case Multiface: 3055 3076 case H9632: 3056 if (offset >= 1) 3077 if (offset >= 1) 3057 3078 return -EINVAL; 3058 3079 break; … … 3116 3137 { 3117 3138 struct hdsp *hdsp = snd_kcontrol_chip(kcontrol); 3118 3139 3119 3140 ucontrol->value.enumerated.item[0] = hdsp_dds_offset(hdsp); 3120 3141 return 0; … … 3126 3147 int change; 3127 3148 int val; 3128 3149 3129 3150 if (!snd_hdsp_use_is_exclusive(hdsp)) 3130 3151 return -EBUSY; … … 3171 3192 .private_value = IEC958_AES0_NONAUDIO | 3172 3193 IEC958_AES0_PROFESSIONAL | 3173 IEC958_AES0_CON_EMPHASIS, 3194 IEC958_AES0_CON_EMPHASIS, 3174 3195 }, 3175 3196 { … … 3189 3210 HDSP_SPDIF_EMPHASIS("IEC958 Emphasis Bit", 0), 3190 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 3213 HDSP_CLOCK_SOURCE("Sample Clock Source", 0), 3193 3214 { … … 3241 3262 } 3242 3263 } 3243 3264 3244 3265 /* DA, AD and Phone gain and XLR breakout cable controls for H9632 cards */ 3245 3266 if (hdsp->io_type == H9632) { … … 3260 3281 3261 3282 /*------------------------------------------------------------ 3262 /proc interface 3283 /proc interface 3263 3284 ------------------------------------------------------------*/ 3264 3285 … … 3299 3320 } 3300 3321 } 3301 3322 3302 3323 status = hdsp_read(hdsp, HDSP_statusRegister); 3303 3324 status2 = hdsp_read(hdsp, HDSP_status2Register); … … 3363 3384 case HDSP_CLOCK_SOURCE_INTERNAL_192KHZ: 3364 3385 clock_source = "Internal 192 kHz"; 3365 break; 3386 break; 3366 3387 default: 3367 clock_source = "Error"; 3388 clock_source = "Error"; 3368 3389 } 3369 3390 snd_iprintf (buffer, "Sample Clock Source: %s\n", clock_source); 3370 3391 3371 3392 if (hdsp_system_clock_mode(hdsp)) 3372 3393 system_clock_mode = "Slave"; 3373 3394 else 3374 3395 system_clock_mode = "Master"; 3375 3396 3376 3397 switch (hdsp_pref_sync_ref (hdsp)) { 3377 3398 case HDSP_SYNC_FROM_WORD: … … 3398 3419 } 3399 3420 snd_iprintf (buffer, "Preferred Sync Reference: %s\n", pref_sync_ref); 3400 3421 3401 3422 switch (hdsp_autosync_ref (hdsp)) { 3402 3423 case HDSP_AUTOSYNC_FROM_WORD: … … 3411 3432 case HDSP_AUTOSYNC_FROM_NONE: 3412 3433 autosync_ref = "None"; 3413 break; 3434 break; 3414 3435 case HDSP_AUTOSYNC_FROM_ADAT1: 3415 3436 autosync_ref = "ADAT1"; … … 3426 3447 } 3427 3448 snd_iprintf (buffer, "AutoSync Reference: %s\n", autosync_ref); 3428 3449 3429 3450 snd_iprintf (buffer, "AutoSync Frequency: %d\n", hdsp_external_sample_rate(hdsp)); 3430 3451 3431 3452 snd_iprintf (buffer, "System Clock Mode: %s\n", system_clock_mode); 3432 3453 3433 3454 snd_iprintf (buffer, "System Clock Frequency: %d\n", hdsp->system_sample_rate); 3434 3455 snd_iprintf (buffer, "System Clock Locked: %s\n", hdsp->clock_source_locked ? "Yes" : "No"); 3435 3456 3436 3457 snd_iprintf(buffer, "\n"); 3437 3458 … … 3453 3474 break; 3454 3475 } 3455 3476 3456 3477 if (hdsp->control_register & HDSP_SPDIFOpticalOut) 3457 3478 snd_iprintf(buffer, "IEC958 output: Coaxial & ADAT1\n"); … … 3511 3532 else 3512 3533 snd_iprintf (buffer, "SPDIF: %s\n", x ? "Sync" : "Lock"); 3513 3534 3514 3535 x = status2 & HDSP_wc_sync; 3515 3536 if (status2 & HDSP_wc_lock) … … 3517 3538 else 3518 3539 snd_iprintf (buffer, "Word Clock: No Lock\n"); 3519 3540 3520 3541 x = status & HDSP_TimecodeSync; 3521 3542 if (status & HDSP_TimecodeLock) … … 3525 3546 3526 3547 snd_iprintf(buffer, "\n"); 3527 3548 3528 3549 /* Informations about H9632 specific controls */ 3529 3550 if (hdsp->io_type == H9632) { 3530 3551 char *tmp; 3531 3552 3532 3553 switch (hdsp_ad_gain(hdsp)) { 3533 3554 case 0: … … 3555 3576 } 3556 3577 snd_iprintf(buffer, "DA Gain : %s\n", tmp); 3557 3578 3558 3579 switch (hdsp_phone_gain(hdsp)) { 3559 3580 case 0: … … 3569 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"); 3572 3592 snd_iprintf(buffer, "XLR Breakout Cable : %s\n", hdsp_xlr_breakout_cable(hdsp) ? "yes" : "no"); 3593 3573 3594 if (hdsp->control_register & HDSP_AnalogExtensionBoard) 3574 3595 snd_iprintf(buffer, "AEB : on (ADAT1 internal)\n"); … … 3633 3654 /* set defaults: 3634 3655 3635 SPDIF Input via Coax 3656 SPDIF Input via Coax 3636 3657 Master clock mode 3637 3658 maximum latency (7 => 2^7 = 8192 samples, 64Kbyte buffer, 3638 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 | 3643 HDSP_SPDIFInputCoaxial | 3644 hdsp_encode_latency(7) | 3663 hdsp->control_register = HDSP_ClockModeMaster | 3664 HDSP_SPDIFInputCoaxial | 3665 hdsp_encode_latency(7) | 3645 3666 HDSP_LineOut; 3646 3667 3647 3668 3648 3669 hdsp_write(hdsp, HDSP_controlRegister, hdsp->control_register); … … 3662 3683 3663 3684 /* silence everything */ 3664 3685 3665 3686 for (i = 0; i < HDSP_MATRIX_MIXER_SIZE; ++i) 3666 3687 hdsp->mixer_matrix[i] = MINUS_INFINITY_GAIN; … … 3670 3691 return -EIO; 3671 3692 } 3672 3693 3673 3694 /* H9632 specific defaults */ 3674 3695 if (hdsp->io_type == H9632) { … … 3688 3709 { 3689 3710 struct hdsp *hdsp = (struct hdsp *)arg; 3690 3711 3691 3712 if (hdsp->midi[0].pending) 3692 3713 snd_hdsp_midi_input_read (&hdsp->midi[0]); 3693 3714 if (hdsp->midi[1].pending) 3694 3715 snd_hdsp_midi_input_read (&hdsp->midi[1]); 3695 } 3716 } 3696 3717 3697 3718 static irqreturn_t snd_hdsp_interrupt(int irq, void *dev_id) … … 3705 3726 unsigned int midi1status; 3706 3727 int schedule = 0; 3707 3728 3708 3729 status = hdsp_read(hdsp, HDSP_statusRegister); 3709 3730 … … 3719 3740 midi0status = hdsp_read (hdsp, HDSP_midiStatusIn0) & 0xff; 3720 3741 midi1status = hdsp_read (hdsp, HDSP_midiStatusIn1) & 0xff; 3721 3742 3743 if (!(hdsp->state & HDSP_InitializationComplete)) 3744 return IRQ_HANDLED; 3745 3722 3746 if (audio) { 3723 3747 if (hdsp->capture_substream) 3724 3748 snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream); 3725 3749 3726 3750 if (hdsp->playback_substream) 3727 3751 snd_pcm_period_elapsed(hdsp->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream); 3728 3752 } 3729 3753 3730 3754 if (midi0 && midi0status) { 3731 3755 if (hdsp->use_midi_tasklet) { … … 3770 3794 if (snd_BUG_ON(channel < 0 || channel >= hdsp->max_channels)) 3771 3795 return NULL; 3772 3796 3773 3797 if ((mapped_channel = hdsp->channel_map[channel]) < 0) 3774 3798 return NULL; 3775 3799 3776 3800 if (stream == SNDRV_PCM_STREAM_CAPTURE) 3777 3801 return hdsp->capture_buffer + (mapped_channel * HDSP_CHANNEL_BUFFER_BYTES); … … 3966 3990 struct snd_pcm_substream *other; 3967 3991 int running; 3968 3992 3969 3993 if (hdsp_check_for_iobox (hdsp)) 3970 3994 return -EIO; … … 4060 4084 #endif 4061 4085 .rates = (SNDRV_PCM_RATE_32000 | 4062 SNDRV_PCM_RATE_44100 | 4063 SNDRV_PCM_RATE_48000 | 4064 SNDRV_PCM_RATE_64000 | 4065 SNDRV_PCM_RATE_88200 | 4086 SNDRV_PCM_RATE_44100 | 4087 SNDRV_PCM_RATE_48000 | 4088 SNDRV_PCM_RATE_64000 | 4089 SNDRV_PCM_RATE_88200 | 4066 4090 SNDRV_PCM_RATE_96000), 4067 4091 .rate_min = 32000, … … 4089 4113 #endif 4090 4114 .rates = (SNDRV_PCM_RATE_32000 | 4091 SNDRV_PCM_RATE_44100 | 4092 SNDRV_PCM_RATE_48000 | 4093 SNDRV_PCM_RATE_64000 | 4094 SNDRV_PCM_RATE_88200 | 4115 SNDRV_PCM_RATE_44100 | 4116 SNDRV_PCM_RATE_48000 | 4117 SNDRV_PCM_RATE_64000 | 4118 SNDRV_PCM_RATE_88200 | 4095 4119 SNDRV_PCM_RATE_96000), 4096 4120 .rate_min = 32000, … … 4171 4195 .integer = 1, 4172 4196 }; 4173 return snd_interval_refine(c, &t); 4197 return snd_interval_refine(c, &t); 4174 4198 } else if (r->min > 48000 && r->max <= 96000) { 4175 4199 struct snd_interval t = { … … 4202 4226 .integer = 1, 4203 4227 }; 4204 return snd_interval_refine(c, &t); 4228 return snd_interval_refine(c, &t); 4205 4229 } else if (r->min > 48000 && r->max <= 96000) { 4206 4230 struct snd_interval t = { … … 4319 4343 runtime->hw.channels_min = hdsp->qs_out_channels; 4320 4344 runtime->hw.channels_max = hdsp->ss_out_channels; 4321 } 4322 4345 } 4346 4323 4347 snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, 4324 4348 snd_hdsp_hw_rule_out_channels, hdsp, … … 4413 4437 return 0; 4414 4438 } 4415 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 4439 4423 4440 /* helper functions for copying meter values */ … … 4537 4554 hdsp->iobase + HDSP_playbackRmsLevel + i * 8)) 4538 4555 return -EFAULT; 4539 if (copy_u64_le(&peak_rms->input_rms[i], 4556 if (copy_u64_le(&peak_rms->input_rms[i], 4540 4557 hdsp->iobase + HDSP_inputRmsLevel + i * 8 + 4, 4541 4558 hdsp->iobase + HDSP_inputRmsLevel + i * 8)) … … 4547 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 4567 void __user *argp = (void __user *)arg; 4551 4568 int err; … … 4581 4598 unsigned long flags; 4582 4599 int i; 4583 4600 4584 4601 err = hdsp_check_for_iobox(hdsp); 4585 4602 if (err < 0) … … 4615 4632 info.phone_gain = (unsigned char)hdsp_phone_gain(hdsp); 4616 4633 info.xlr_breakout_cable = (unsigned char)hdsp_xlr_breakout_cable(hdsp); 4617 4634 4618 4635 } 4619 4636 if (hdsp->io_type == H9632 || hdsp->io_type == H9652) … … 4626 4643 case SNDRV_HDSP_IOCTL_GET_9632_AEB: { 4627 4644 struct hdsp_9632_aeb h9632_aeb; 4628 4645 4629 4646 if (hdsp->io_type != H9632) return -EINVAL; 4630 4647 h9632_aeb.aebi = hdsp->ss_in_channels - H9632_SS_CHANNELS; … … 4637 4654 struct hdsp_version hdsp_version; 4638 4655 int err; 4639 4656 4640 4657 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; 4641 4658 if (hdsp->io_type == Undefined) { … … 4653 4670 u32 __user *firmware_data; 4654 4671 int err; 4655 4672 4656 4673 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) return -EINVAL; 4657 4674 /* SNDRV_HDSP_IOCTL_GET_VERSION must have been called */ … … 4666 4683 if (get_user(firmware_data, &firmware->firmware_data)) 4667 4684 return -EFAULT; 4668 4685 4669 4686 if (hdsp_check_for_iobox (hdsp)) 4670 4687 return -EIO; … … 4672 4689 if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(hdsp->firmware_cache)) != 0) 4673 4690 return -EFAULT; 4674 4691 4675 4692 hdsp->state |= HDSP_FirmwareCached; 4676 4693 4677 4694 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) 4678 4695 return err; 4679 4696 4680 4697 if (!(hdsp->state & HDSP_InitializationComplete)) { 4681 4698 if ((err = snd_hdsp_enable_io(hdsp)) < 0) 4682 4699 return err; 4683 4684 snd_hdsp_initialize_channels(hdsp); 4700 4701 snd_hdsp_initialize_channels(hdsp); 4685 4702 snd_hdsp_initialize_midi_flush(hdsp); 4686 4703 4687 4704 if ((err = snd_hdsp_create_alsa_devices(hdsp->card, hdsp)) < 0) { 4688 4705 snd_printk(KERN_ERR "Hammerfall-DSP: error creating alsa devices\n"); … … 4731 4748 struct snd_hwdep *hw; 4732 4749 int err; 4733 4750 4734 4751 if ((err = snd_hwdep_new(card, "HDSP hwdep", 0, &hw)) < 0) 4735 4752 return err; 4736 4753 4737 4754 hdsp->hwdep = hw; 4738 4755 hw->private_data = hdsp; 4739 4756 strcpy(hw->name, "HDSP hwdep interface"); 4740 4757 4741 hw->ops.open = snd_hdsp_hwdep_dummy_op;4742 4758 hw->ops.ioctl = snd_hdsp_hwdep_ioctl; 4743 hw->ops.release = snd_hdsp_hwdep_dummy_op; 4744 4759 4745 4760 return 0; 4746 4761 } … … 4775 4790 { 4776 4791 int i; 4777 4792 4778 4793 if (hdsp_fifo_wait (hdsp, 0, 100)) { 4779 4794 snd_printk(KERN_ERR "Hammerfall-DSP: enable_io fifo_wait failed\n"); 4780 4795 return -EIO; 4781 4796 } 4782 4797 4783 4798 for (i = 0; i < hdsp->max_channels; ++i) { 4784 4799 hdsp_write (hdsp, HDSP_inputEnable + (4 * i), 1); 4785 4800 hdsp_write (hdsp, HDSP_outputEnable + (4 * i), 1); 4786 4801 } 4787 4802 4788 4803 return 0; 4789 4804 } … … 4792 4807 { 4793 4808 int status, aebi_channels, aebo_channels; 4794 4809 4795 4810 switch (hdsp->io_type) { 4796 4811 case Digiface: … … 4805 4820 hdsp->ds_in_channels = hdsp->ds_out_channels = H9652_DS_CHANNELS; 4806 4821 break; 4807 4822 4808 4823 case H9632: 4809 4824 status = hdsp_read(hdsp, HDSP_statusRegister); … … 4825 4840 hdsp->ds_in_channels = hdsp->ds_out_channels = MULTIFACE_DS_CHANNELS; 4826 4841 break; 4827 4842 4828 4843 default: 4829 4844 /* should never get here */ … … 4841 4856 { 4842 4857 int err; 4843 4858 4844 4859 if ((err = snd_hdsp_create_pcm(card, hdsp)) < 0) { 4845 4860 snd_printk(KERN_ERR "Hammerfall-DSP: Error creating pcm interface\n"); 4846 4861 return err; 4847 4862 } 4848 4863 4849 4864 4850 4865 if ((err = snd_hdsp_create_midi(card, hdsp, 0)) < 0) { … … 4877 4892 return err; 4878 4893 } 4879 4894 4880 4895 if (!(hdsp->state & HDSP_InitializationComplete)) { 4881 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 4898 hdsp->port, hdsp->irq); 4884 4899 4885 4900 if ((err = snd_card_register(card)) < 0) { 4886 4901 snd_printk(KERN_ERR "Hammerfall-DSP: error registering card\n"); … … 4889 4904 hdsp->state |= HDSP_InitializationComplete; 4890 4905 } 4891 4906 4892 4907 return 0; 4893 4908 } … … 4900 4915 const struct firmware *fw; 4901 4916 int err; 4902 4917 4903 4918 if (hdsp->io_type == H9652 || hdsp->io_type == H9632) 4904 4919 return 0; … … 4909 4924 return 0; 4910 4925 } 4911 4926 4912 4927 /* caution: max length of firmware filename is 30! */ 4913 4928 switch (hdsp->io_type) { … … 4943 4958 4944 4959 release_firmware(fw); 4945 4960 4946 4961 hdsp->state |= HDSP_FirmwareCached; 4947 4962 4948 4963 if ((err = snd_hdsp_load_firmware_from_cache(hdsp)) < 0) 4949 4964 return err; 4950 4965 4951 4966 if (!(hdsp->state & HDSP_InitializationComplete)) { 4952 4967 if ((err = snd_hdsp_enable_io(hdsp)) < 0) … … 4995 5010 4996 5011 hdsp->card = card; 4997 5012 4998 5013 spin_lock_init(&hdsp->lock); 4999 5014 5000 5015 tasklet_init(&hdsp->midi_tasklet, hdsp_midi_tasklet, (unsigned long)hdsp); 5001 5016 5002 5017 pci_read_config_word(hdsp->pci, PCI_CLASS_REVISION, &hdsp->firmware_rev); 5003 5018 hdsp->firmware_rev &= 0xff; 5004 5019 5005 5020 /* From Martin Bjoernsen : 5006 5021 "It is important that the card's latency timer register in … … 5011 5026 */ 5012 5027 pci_write_config_byte(hdsp->pci, PCI_LATENCY_TIMER, 0xFF); 5013 5028 5014 5029 strcpy(card->driver, "H-DSP"); 5015 5030 strcpy(card->mixername, "Xilinx FPGA"); … … 5025 5040 hdsp->card_name = "RME HDSP 9632"; 5026 5041 hdsp->max_channels = 16; 5027 is_9632 = 1; 5042 is_9632 = 1; 5028 5043 } 5029 5044 … … 5054 5069 if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) 5055 5070 return err; 5056 5071 5057 5072 if (!is_9652 && !is_9632) { 5058 /* we wait 2 seconds to let freshly inserted cardbus cards do their hardware init */5059 ssleep(2);5060 5061 err = hdsp_check_for_iobox(hdsp); 5073 /* we wait a maximum of 10 seconds to let freshly 5074 * inserted cardbus cards do their hardware init */ 5075 err = hdsp_wait_for_iobox(hdsp, 1000, 10); 5076 5062 5077 if (err < 0) 5063 5078 return err; … … 5081 5096 return 0; 5082 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 5099 if (hdsp_read(hdsp, HDSP_status2Register) & HDSP_version1) 5085 5100 hdsp->io_type = Multiface; 5086 else 5101 else 5087 5102 hdsp->io_type = Digiface; 5088 5103 } 5089 5104 } 5090 5105 5091 5106 if ((err = snd_hdsp_enable_io(hdsp)) != 0) 5092 5107 return err; 5093 5108 5094 5109 if (is_9652) 5095 5110 hdsp->io_type = H9652; 5096 5111 5097 5112 if (is_9632) 5098 5113 hdsp->io_type = H9632; … … 5100 5115 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) 5101 5116 return err; 5102 5117 5103 5118 snd_hdsp_initialize_channels(hdsp); 5104 5119 snd_hdsp_initialize_midi_flush(hdsp); 5105 5120 5106 hdsp->state |= HDSP_FirmwareLoaded; 5121 hdsp->state |= HDSP_FirmwareLoaded; 5107 5122 5108 5123 if ((err = snd_hdsp_create_alsa_devices(card, hdsp)) < 0) 5109 5124 return err; 5110 5125 5111 return 0; 5126 return 0; 5112 5127 } 5113 5128 … … 5125 5140 5126 5141 snd_hdsp_free_buffers(hdsp); 5127 5142 5128 5143 if (hdsp->iobase) 5129 5144 iounmap(hdsp->iobase); … … 5131 5146 if (hdsp->port) 5132 5147 pci_release_regions(hdsp->pci); 5133 5148 5134 5149 pci_disable_device(hdsp->pci); 5135 5150 return 0; … … 5176 5191 5177 5192 strcpy(card->shortname, "Hammerfall DSP"); 5178 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, 5179 5194 hdsp->port, hdsp->irq); 5180 5195 -
GPL/trunk/alsa-kernel/pci/rme9652/hdspm.c
r410 r426 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 4103 static int snd_hdspm_hwdep_ioctl(struct snd_hwdep * hw, struct file *file, 4111 4104 unsigned int cmd, unsigned long arg) … … 4214 4207 strcpy(hw->name, "HDSPM hwdep interface"); 4215 4208 4216 hw->ops.open = snd_hdspm_hwdep_dummy_op;4217 4209 hw->ops.ioctl = snd_hdspm_hwdep_ioctl; 4218 hw->ops.release = snd_hdspm_hwdep_dummy_op;4219 4210 4220 4211 return 0; -
GPL/trunk/alsa-kernel/pci/sonicvibes.c
r410 r426 274 274 outb(0x18, sonic->dmaa_port + SV_DMA_MODE); 275 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 278 #endif 278 279 } … … 289 290 outb(0x14, sonic->dmac_port + SV_DMA_MODE); 290 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 294 #endif 293 295 } … … 356 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 458 printk(" 0x3f: --- = 0x%02x\n", snd_sonicvibes_in(sonic, 0x3f)); 424 459 } … … 477 512 *res_n = n; 478 513 #if 0 479 printk( "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);514 printk(KERN_DEBUG "metric = %i, xm = %i, xn = %i\n", metric, xm, xn); 515 printk(KERN_DEBUG "pll: m = 0x%x, r = 0x%x, n = 0x%x\n", reg, m, r, n); 481 516 #endif 482 517 } … … 1230 1265 return err; 1231 1266 /* check, if we can restrict PCI DMA transfers to 24 bits */ 1232 if (pci_set_dma_mask(pci, DMA_ 24BIT_MASK) < 0 ||1233 pci_set_consistent_dma_mask(pci, DMA_ 24BIT_MASK) < 0) {1267 if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || 1268 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { 1234 1269 snd_printk(KERN_ERR "architecture does not support 24bit PCI busmaster DMA\n"); 1235 1270 pci_disable_device(pci); -
GPL/trunk/alsa-kernel/pci/trident/trident_main.c
r399 r426 69 69 unsigned int val, tmp; 70 70 71 printk( "Trident voice %i:\n", voice);71 printk(KERN_DEBUG "Trident voice %i:\n", voice); 72 72 outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR)); 73 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 75 val = inl(TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); 76 printk( "GVSel: %i\n", val >> 31);77 printk( "Pan: 0x%x\n", (val >> 24) & 0x7f);78 printk( "Vol: 0x%x\n", (val >> 16) & 0xff);79 printk( "CTRL: 0x%x\n", (val >> 12) & 0x0f);80 printk( "EC: 0x%x\n", val & 0x0fff);76 printk(KERN_DEBUG "GVSel: %i\n", val >> 31); 77 printk(KERN_DEBUG "Pan: 0x%x\n", (val >> 24) & 0x7f); 78 printk(KERN_DEBUG "Vol: 0x%x\n", (val >> 16) & 0xff); 79 printk(KERN_DEBUG "CTRL: 0x%x\n", (val >> 12) & 0x0f); 80 printk(KERN_DEBUG "EC: 0x%x\n", val & 0x0fff); 81 81 if (trident->device != TRIDENT_DEVICE_ID_NX) { 82 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 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 86 val = inl(TRID_REG(trident, CH_DX_ESO_DELTA)); 87 printk( "ESO: 0x%x\n", val >> 16);88 printk( "Delta: 0x%x\n", val & 0xffff);87 printk(KERN_DEBUG "ESO: 0x%x\n", val >> 16); 88 printk(KERN_DEBUG "Delta: 0x%x\n", val & 0xffff); 89 89 val = inl(TRID_REG(trident, CH_DX_FMC_RVOL_CVOL)); 90 90 } else { // TRIDENT_DEVICE_ID_NX 91 91 val = inl(TRID_REG(trident, CH_NX_DELTA_CSO)); 92 92 tmp = (val >> 24) & 0xff; 93 printk( "CSO: 0x%x\n", val & 0x00ffffff);93 printk(KERN_DEBUG "CSO: 0x%x\n", val & 0x00ffffff); 94 94 val = inl(TRID_REG(trident, CH_NX_DELTA_ESO)); 95 95 tmp |= (val >> 16) & 0xff00; 96 printk( "Delta: 0x%x\n", tmp);97 printk( "ESO: 0x%x\n", val & 0x00ffffff);96 printk(KERN_DEBUG "Delta: 0x%x\n", tmp); 97 printk(KERN_DEBUG "ESO: 0x%x\n", val & 0x00ffffff); 98 98 val = inl(TRID_REG(trident, CH_NX_ALPHA_FMS_FMC_RVOL_CVOL)); 99 printk( "Alpha: 0x%x\n", val >> 20);100 printk( "FMS: 0x%x\n", (val >> 16) & 0x0f);101 } 102 printk( "FMC: 0x%x\n", (val >> 14) & 3);103 printk( "RVol: 0x%x\n", (val >> 7) & 0x7f);104 printk( "CVol: 0x%x\n", val & 0x7f);99 printk(KERN_DEBUG "Alpha: 0x%x\n", val >> 20); 100 printk(KERN_DEBUG "FMS: 0x%x\n", (val >> 16) & 0x0f); 101 } 102 printk(KERN_DEBUG "FMC: 0x%x\n", (val >> 14) & 3); 103 printk(KERN_DEBUG "RVol: 0x%x\n", (val >> 7) & 0x7f); 104 printk(KERN_DEBUG "CVol: 0x%x\n", val & 0x7f); 105 105 } 106 106 #endif … … 497 497 498 498 #if 0 499 printk("written %i channel:\n", voice->number); 500 printk(" regs[0] = 0x%x/0x%x\n", regs[0], inl(TRID_REG(trident, CH_START + 0))); 501 printk(" regs[1] = 0x%x/0x%x\n", regs[1], inl(TRID_REG(trident, CH_START + 4))); 502 printk(" regs[2] = 0x%x/0x%x\n", regs[2], inl(TRID_REG(trident, CH_START + 8))); 503 printk(" regs[3] = 0x%x/0x%x\n", regs[3], inl(TRID_REG(trident, CH_START + 12))); 504 printk(" regs[4] = 0x%x/0x%x\n", regs[4], inl(TRID_REG(trident, CH_START + 16))); 499 printk(KERN_DEBUG "written %i channel:\n", voice->number); 500 printk(KERN_DEBUG " regs[0] = 0x%x/0x%x\n", 501 regs[0], inl(TRID_REG(trident, CH_START + 0))); 502 printk(KERN_DEBUG " regs[1] = 0x%x/0x%x\n", 503 regs[1], inl(TRID_REG(trident, CH_START + 4))); 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 510 #endif 506 511 } … … 584 589 break; 585 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 592 outw((voice->CTRL << 12) | voice->Vol, 588 593 TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); … … 3555 3560 return err; 3556 3561 /* check, if we can restrict PCI DMA transfers to 30 bits */ 3557 if (pci_set_dma_mask(pci, DMA_ 30BIT_MASK) < 0 ||3558 pci_set_consistent_dma_mask(pci, DMA_ 30BIT_MASK) < 0) {3562 if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0 || 3563 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { 3559 3564 snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n"); 3560 3565 pci_disable_device(pci); -
GPL/trunk/alsa-kernel/pci/via82xx.c
r410 r426 467 467 } else 468 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 473 ((u32 *)dev->table.area)[(idx<<1) + 1] = cpu_to_le32(r | flag); 471 474 dev->idx_table[idx].offset = ofs; … … 1685 1688 } 1686 1689 1687 static const DECLARE_TLV_DB_SCALE(db_scale_dxs, - 9450, 150, 1);1690 static const DECLARE_TLV_DB_SCALE(db_scale_dxs, -4650, 150, 1); 1688 1691 1689 1692 static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control __devinitdata = { … … 2361 2364 SND_PCI_QUIRK(0x1019, 0x0a81, "ECS K7VTA3 v8.0", VIA_DXS_NO_VRA), 2362 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 2367 SND_PCI_QUIRK(0x1019, 0xaa01, "ESC K8T890-A", VIA_DXS_SRC), 2365 2368 SND_PCI_QUIRK(0x1025, 0x0033, "Acer Inspire 1353LM", VIA_DXS_NO_VRA), 2366 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),2368 SND_PCI_QUIRK (0x1071, 0, "Diverse Notebook", VIA_DXS_NO_VRA),2370 SND_PCI_QUIRK_VENDOR(0x1043, "ASUS A7/A8", VIA_DXS_NO_VRA), 2371 SND_PCI_QUIRK_VENDOR(0x1071, "Diverse Notebook", VIA_DXS_NO_VRA), 2369 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 2374 SND_PCI_QUIRK(0x1297, 0xa231, "Shuttle AK31v2", VIA_DXS_SRC), 2372 2375 SND_PCI_QUIRK(0x1297, 0xa232, "Shuttle", VIA_DXS_SRC), … … 2376 2379 SND_PCI_QUIRK(0x1462, 0x7120, "MSI KT4V", VIA_DXS_ENABLE), 2377 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 2382 SND_PCI_QUIRK(0x147b, 0x1401, "ABIT KD7(-RAID)", VIA_DXS_ENABLE), 2380 2383 SND_PCI_QUIRK(0x147b, 0x1411, "ABIT VA-20", VIA_DXS_ENABLE), … … 2390 2393 SND_PCI_QUIRK(0x1631, 0xe004, "PB EasyNote 3174", VIA_DXS_ENABLE), 2391 2394 SND_PCI_QUIRK(0x1695, 0x3005, "EPoX EP-8K9A", VIA_DXS_ENABLE), 2392 SND_PCI_QUIRK (0x1695, 0, "EPoX mobo", VIA_DXS_SRC),2393 SND_PCI_QUIRK (0x16f3, 0, "Jetway K8", VIA_DXS_SRC),2394 SND_PCI_QUIRK (0x1734, 0, "FSC Laptop", VIA_DXS_SRC),2395 SND_PCI_QUIRK_VENDOR(0x1695, "EPoX mobo", VIA_DXS_SRC), 2396 SND_PCI_QUIRK_VENDOR(0x16f3, "Jetway K8", VIA_DXS_SRC), 2397 SND_PCI_QUIRK_VENDOR(0x1734, "FSC Laptop", VIA_DXS_SRC), 2395 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 2400 SND_PCI_QUIRK(0x1919, 0x200a, "Soltek SL-K8", VIA_DXS_NO_VRA), 2398 2401 SND_PCI_QUIRK(0x4005, 0x4710, "MSI K7T266", VIA_DXS_SRC), -
GPL/trunk/alsa-kernel/pci/ymfpci/ymfpci_main.c
r399 r426 324 324 ypcm->last_pos = pos; 325 325 if (ypcm->period_pos >= ypcm->period_size) { 326 // printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start); 326 /* 327 printk(KERN_DEBUG 328 "done - active_bank = 0x%x, start = 0x%x\n", 329 chip->active_bank, 330 voice->bank[chip->active_bank].start); 331 */ 327 332 ypcm->period_pos %= ypcm->period_size; 328 333 spin_unlock(&chip->reg_lock); … … 372 377 if (ypcm->period_pos >= ypcm->period_size) { 373 378 ypcm->period_pos %= ypcm->period_size; 374 // printk("done - active_bank = 0x%x, start = 0x%x\n", chip->active_bank, voice->bank[chip->active_bank].start); 379 /* 380 printk(KERN_DEBUG 381 "done - active_bank = 0x%x, start = 0x%x\n", 382 chip->active_bank, 383 voice->bank[chip->active_bank].start); 384 */ 375 385 spin_unlock(&chip->reg_lock); 376 386 snd_pcm_period_elapsed(substream);
Note:
See TracChangeset
for help on using the changeset viewer.
