Changeset 86 for GPL/trunk/alsa-kernel
- Timestamp:
- Jan 23, 2007, 10:34:32 PM (19 years ago)
- Location:
- GPL/trunk/alsa-kernel
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk/alsa-kernel/core/misc.c
r84 r86 712 712 } 713 713 714 /** 715 * snd_pci_quirk_lookup - look up a PCI SSID quirk list 716 * @pci: pci_dev handle 717 * @list: quirk list, terminated by a null entry 718 * 719 * Look through the given quirk list and finds a matching entry 720 * with the same PCI SSID. When subdevice is 0, all subdevice 721 * values may match. 722 * 723 * Returns the matched entry pointer, or NULL if nothing matched. 724 */ 725 const struct snd_pci_quirk * 726 snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list) 727 { 728 const struct snd_pci_quirk *q; 729 730 for (q = list; q->subvendor; q++) 731 if (q->subvendor == pci->subsystem_vendor && 732 (!q->subdevice || q->subdevice == pci->subsystem_device)) 733 return q; 734 return NULL; 735 } 736 -
GPL/trunk/alsa-kernel/include/sound/ac97_codec.h
r77 r86 32 32 #include "info.h" 33 33 34 #define CONFIG_SND_AC97_POWER_SAVE /* experimental !!! */35 34 /* 36 35 * AC'97 codec registers … … 376 375 #define AC97_SCAP_NO_SPDIF (1<<9) /* don't build SPDIF controls */ 377 376 #define AC97_SCAP_EAPD_LED (1<<10) /* EAPD as mute LED */ 377 #define AC97_SCAP_POWER_SAVE (1<<11) /* capable for aggresive power-saving */ 378 378 379 379 /* ac97->flags */ … … 425 425 426 426 struct snd_ac97_bus_ops { 427 void (*reset) (struct snd_ac97 *ac97); 427 void (*reset) (struct snd_ac97 *ac97); 428 void (*warm_reset)(struct snd_ac97 *ac97); 428 429 void (*write) (struct snd_ac97 *ac97, unsigned short reg, unsigned short val); 429 430 unsigned short (*read) (struct snd_ac97 *ac97, unsigned short reg); … … 501 502 unsigned short id[3]; // codec IDs (lower 16-bit word) 502 503 unsigned short pcmreg[3]; // PCM registers 503 unsigned short codec_cfg[3]; // CODEC_CFG bits 504 unsigned short codec_cfg[3]; // CODEC_CFG bits 505 unsigned char swap_mic_linein; // AD1986/AD1986A only 504 506 } ad18xx; 505 507 unsigned int dev_flags; /* device specific */ -
GPL/trunk/alsa-kernel/include/sound/config.h
r34 r86 204 204 }; 205 205 206 /* PCI quirk list helper */ 207 struct snd_pci_quirk { 208 unsigned short subvendor; /* PCI subvendor ID */ 209 unsigned short subdevice; /* PCI subdevice ID */ 210 int value; /* value */ 211 #ifdef CONFIG_SND_DEBUG_DETECT 212 const char *name; /* name of the device (optional) */ 213 #endif 214 }; 215 216 #define _SND_PCI_QUIRK_ID(vend,dev) \ 217 .subvendor = (vend), .subdevice = (dev) 218 #define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)} 219 #ifdef CONFIG_SND_DEBUG_DETECT 220 #define SND_PCI_QUIRK(vend,dev,xname,val) \ 221 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)} 222 #else 223 #define SND_PCI_QUIRK(vend,dev,xname,val) \ 224 {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)} 225 #endif 226 227 const struct snd_pci_quirk * 228 snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list); 229 206 230 /* misc.c */ 207 231 struct resource; -
GPL/trunk/alsa-kernel/include/sound/driver.h
r85 r86 753 753 #endif 754 754 755 static inline int snd_pci_enable_msi(struct pci_dev *dev) { return -1; } 756 #undef pci_enable_msi 757 #define pci_enable_msi(dev) snd_pci_enable_msi(dev) 758 #undef pci_disable_msi 759 #define pci_disable_msi(dev) 760 761 #undef pci_intx 762 #define pci_intx(pci,x) 763 764 755 765 #endif /* __DRIVER_H */ -
GPL/trunk/alsa-kernel/pci/ac97/ac97_codec.c
r77 r86 31 31 #include <sound/core.h> 32 32 #include <sound/pcm.h> 33 #include <sound/tlv.h> 33 34 #include <sound/ac97_codec.h> 34 35 #include <sound/asoundef.h> … … 110 111 { 0x41445374, 0xffffffff, "AD1981B", patch_ad1981b, NULL }, 111 112 { 0x41445375, 0xffffffff, "AD1985", patch_ad1985, NULL }, 112 { 0x41445378, 0xffffffff, "AD1986", patch_ad198 5, NULL },113 { 0x41445378, 0xffffffff, "AD1986", patch_ad1986, NULL }, 113 114 { 0x414c4300, 0xffffff00, "ALC100,100P", NULL, NULL }, 114 115 { 0x414c4710, 0xfffffff0, "ALC200,200P", NULL, NULL }, … … 128 129 { 0x434d4961, 0xffffffff, "CMI9739", patch_cm9739, NULL }, 129 130 { 0x434d4969, 0xffffffff, "CMI9780", patch_cm9780, NULL }, 130 { 0x434d4978, 0xffffffff, "CMI9761 ", patch_cm9761, NULL },131 { 0x434d4982, 0xffffffff, "CMI9761 ", patch_cm9761, NULL },132 { 0x434d4983, 0xffffffff, "CMI9761 ", patch_cm9761, NULL },131 { 0x434d4978, 0xffffffff, "CMI9761A", patch_cm9761, NULL }, 132 { 0x434d4982, 0xffffffff, "CMI9761B", patch_cm9761, NULL }, 133 { 0x434d4983, 0xffffffff, "CMI9761A+", patch_cm9761, NULL }, 133 134 { 0x43525900, 0xfffffff8, "CS4297", NULL, NULL }, 134 135 { 0x43525910, 0xfffffff8, "CS4297A", patch_cirrus_spdif, NULL }, … … 155 156 { 0x4e534300, 0xffffffff, "LM4540,43,45,46,48", NULL, NULL }, // only guess --jk 156 157 { 0x4e534331, 0xffffffff, "LM4549", NULL, NULL }, 157 { 0x4e534350, 0xffffffff, "LM4550", NULL, NULL },158 158 { 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix 159 159 { 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL }, … … 166 166 { 0x56494161, 0xffffffff, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF 167 167 { 0x56494170, 0xffffffff, "VIA1617A", patch_vt1617a, NULL }, // modified VT1616 with S/PDIF 168 { 0x56494182, 0xffffffff, "VIA1618", NULL, NULL }, 168 169 { 0x57454301, 0xffffffff, "W83971D", NULL, NULL }, 169 170 { 0x574d4c00, 0xffffffff, "WM9701A", NULL, NULL }, … … 192 193 193 194 static void update_power_regs(struct snd_ac97 *ac97); 195 #ifdef CONFIG_SND_AC97_POWER_SAVE 196 #define ac97_is_power_save_mode(ac97) \ 197 ((ac97->scaps & AC97_SCAP_POWER_SAVE) && power_save) 198 #else 199 #define ac97_is_power_save_mode(ac97) 0 200 #endif 201 194 202 195 203 /* … … 259 267 } 260 268 269 EXPORT_SYMBOL(snd_ac97_write); 270 261 271 /** 262 272 * snd_ac97_read - read a value from the given register … … 276 286 return ac97->bus->ops->read(ac97, reg); 277 287 } 288 289 EXPORT_SYMBOL(snd_ac97_read); 278 290 279 291 /* read a register - return the cached value if already read */ … … 369 381 unsigned short old, new; 370 382 371 372 new = (old & ~mask) | value;383 old = snd_ac97_read_cache(ac97, reg); 384 new = (old & ~mask) | (value & mask); 373 385 change = old != new; 374 386 if (change) { … … 386 398 387 399 down(&ac97->page_mutex); 388 389 new = (old & ~mask) | value;400 old = ac97->spec.ad18xx.pcmreg[codec]; 401 new = (old & ~mask) | (value & mask); 390 402 change = old != new; 391 403 if (change) { … … 557 569 ac97->power_up &= ~(1 << (reg>>1)); 558 570 else 559 ac97->power_up |= 1 << (reg>>1); 560 if (power_save) 561 update_power_regs(ac97); 571 ac97->power_up |= 1 << (reg>>1); 572 update_power_regs(ac97); 562 573 } 563 574 #endif … … 1173 1184 kctl = snd_ctl_new1(&tmp, ac97); 1174 1185 } else { 1175 struct snd_kcontrol_new tmp = AC97_SINGLE(name, reg, 15, 1, 1); 1186 struct snd_kcontrol_new tmp = AC97_SINGLE(name, reg, 15, 1, 1); 1187 if (check_amix) 1188 tmp.private_value |= (1 << 30); 1189 1176 1190 tmp.index = ac97->num; 1177 1191 kctl = snd_ctl_new1(&tmp, ac97); … … 1187 1201 1188 1202 /* 1203 * set dB information 1204 */ 1205 static DECLARE_TLV_DB_SCALE(db_scale_4bit, -4500, 300, 0); 1206 static DECLARE_TLV_DB_SCALE(db_scale_5bit, -4650, 150, 0); 1207 static DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0); 1208 static DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); 1209 static DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); 1210 1211 static unsigned int *find_db_scale(unsigned int maxval) 1212 { 1213 switch (maxval) { 1214 case 0x0f: return db_scale_4bit; 1215 case 0x1f: return db_scale_5bit; 1216 case 0x3f: return db_scale_6bit; 1217 } 1218 return NULL; 1219 } 1220 1221 static void set_tlv_db_scale(struct snd_kcontrol *kctl, unsigned int *tlv) 1222 { 1223 kctl->tlv.p = tlv; 1224 if (tlv) 1225 kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ; 1226 } 1227 1228 /* 1229 1189 1230 * create a volume for normal stereo/mono controls 1190 1231 */ … … 1228 1269 } 1229 1270 #endif 1230 err = snd_ctl_add(card, kctl); 1271 if (reg >= AC97_PHONE && reg <= AC97_PCM) 1272 set_tlv_db_scale(kctl, db_scale_5bit_12db_max); 1273 else 1274 set_tlv_db_scale(kctl, find_db_scale(lo_max)); 1275 err = snd_ctl_add(card, kctl); 1231 1276 if (err < 0) 1232 1277 return err; … … 1308 1353 snd_ac97_change_volume_params2(ac97, AC97_CENTER_LFE_MASTER, 0, &max); 1309 1354 kctl->private_value &= ~(0xff << 16); 1310 kctl->private_value |= (int)max << 16; 1355 kctl->private_value |= (int)max << 16; 1356 set_tlv_db_scale(kctl, find_db_scale(max)); 1311 1357 snd_ac97_write_cache(ac97, AC97_CENTER_LFE_MASTER, ac97->regs[AC97_CENTER_LFE_MASTER] | max); 1312 1358 } … … 1321 1367 snd_ac97_change_volume_params2(ac97, AC97_CENTER_LFE_MASTER, 8, &max); 1322 1368 kctl->private_value &= ~(0xff << 16); 1323 kctl->private_value |= (int)max << 16; 1369 kctl->private_value |= (int)max << 16; 1370 set_tlv_db_scale(kctl, find_db_scale(max)); 1324 1371 snd_ac97_write_cache(ac97, AC97_CENTER_LFE_MASTER, ac97->regs[AC97_CENTER_LFE_MASTER] | max << 8); 1325 1372 } … … 1369 1416 snd_ac97_try_volume_mix(ac97, AC97_PC_BEEP))) { 1370 1417 for (idx = 0; idx < 2; idx++) 1371 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97))) < 0) 1372 return err; 1418 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97))) < 0) 1419 return err; 1420 set_tlv_db_scale(kctl, db_scale_4bit); 1373 1421 snd_ac97_write_cache(ac97, AC97_PC_BEEP, 1374 1422 snd_ac97_read(ac97, AC97_PC_BEEP) | 0x801e); … … 1436 1484 else 1437 1485 init_val = 0x9f1f; 1438 for (idx = 0; idx < 2; idx++) 1439 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_ad18xx_pcm[idx], ac97))) < 0) 1440 return err; 1486 for (idx = 0; idx < 2; idx++) 1487 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_pcm[idx], ac97))) < 0) 1488 return err; 1489 set_tlv_db_scale(kctl, db_scale_5bit); 1441 1490 ac97->spec.ad18xx.pcmreg[0] = init_val; 1442 1491 if (ac97->scaps & AC97_SCAP_SURROUND_DAC) { 1443 for (idx = 0; idx < 2; idx++) 1444 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_ad18xx_surround[idx], ac97))) < 0) 1445 return err; 1446 ac97->spec.ad18xx.pcmreg[1] = init_val; 1492 for (idx = 0; idx < 2; idx++) 1493 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_surround[idx], ac97))) < 0) 1494 return err; 1495 set_tlv_db_scale(kctl, db_scale_5bit); 1496 ac97->spec.ad18xx.pcmreg[1] = init_val; 1447 1497 } 1448 1498 if (ac97->scaps & AC97_SCAP_CENTER_LFE_DAC) { 1449 for (idx = 0; idx < 2; idx++) 1450 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_ad18xx_center[idx], ac97))) < 0) 1451 return err; 1452 for (idx = 0; idx < 2; idx++) 1453 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_ad18xx_lfe[idx], ac97))) < 0) 1454 return err; 1499 for (idx = 0; idx < 2; idx++) 1500 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_center[idx], ac97))) < 0) 1501 return err; 1502 set_tlv_db_scale(kctl, db_scale_5bit); 1503 for (idx = 0; idx < 2; idx++) 1504 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_ad18xx_lfe[idx], ac97))) < 0) 1505 return err; 1506 set_tlv_db_scale(kctl, db_scale_5bit); 1455 1507 ac97->spec.ad18xx.pcmreg[2] = init_val; 1456 1508 } … … 1481 1533 if (err < 0) 1482 1534 return err; 1483 } 1484 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_control_capture_vol, ac97))) < 0) 1485 return err; 1535 } 1536 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_control_capture_vol, ac97))) < 0) 1537 return err; 1538 set_tlv_db_scale(kctl, db_scale_rec_gain); 1486 1539 snd_ac97_write_cache(ac97, AC97_REC_SEL, 0x0000); 1487 1540 snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x0000); … … 1489 1542 /* build MIC Capture controls */ 1490 1543 if (snd_ac97_try_volume_mix(ac97, AC97_REC_GAIN_MIC)) { 1491 for (idx = 0; idx < 2; idx++) 1492 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_capture[idx], ac97))) < 0) 1493 return err; 1494 snd_ac97_write_cache(ac97, AC97_REC_GAIN_MIC, 0x0000); 1544 for (idx = 0; idx < 2; idx++) 1545 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_mic_capture[idx], ac97))) < 0) 1546 return err; 1547 set_tlv_db_scale(kctl, db_scale_rec_gain); 1548 snd_ac97_write_cache(ac97, AC97_REC_GAIN_MIC, 0x0000); 1495 1549 } 1496 1550 … … 1561 1615 } 1562 1616 1563 /* build S/PDIF controls */ 1617 /* build S/PDIF controls */ 1618 1619 /* Hack for ASUS P5P800-VM, which does not indicate S/PDIF capability */ 1620 if (ac97->subsystem_vendor == 0x1043 && 1621 ac97->subsystem_device == 0x810f) 1622 ac97->ext_id |= AC97_EI_SPDIF; 1623 1564 1624 if ((ac97->ext_id & AC97_EI_SPDIF) && !(ac97->scaps & AC97_SCAP_NO_SPDIF)) { 1565 1625 if (ac97->build_ops->build_spdif) { … … 1642 1702 unsigned short saved; 1643 1703 1644 if (ac97->bus->no_vra || !(ac97->ext_id & AC97_EI_VRA)) {1704 if (ac97->bus->no_vra) { 1645 1705 *r_result = SNDRV_PCM_RATE_48000; 1646 1706 if ((ac97->flags & AC97_DOUBLE_RATE) && … … 2261 2321 power |= AC97_PD_PR2 | AC97_PD_PR3; /* Analog Mixer powerdown */ 2262 2322 snd_ac97_write(ac97, AC97_POWERDOWN, power); 2263 #ifdef CONFIG_SND_AC97_POWER_SAVE 2264 if (power_save) { 2323 if (ac97_is_power_save_mode(ac97)) { 2265 2324 udelay(100); 2266 2325 /* AC-link powerdown, internal Clk disable */ … … 2269 2328 snd_ac97_write(ac97, AC97_POWERDOWN, power); 2270 2329 } 2271 #endif2272 2330 } 2273 2331 … … 2323 2381 } 2324 2382 2325 if (! power_save) 2326 return 0; 2327 2328 if (! powerup && ac97->power_workq) 2383 if (ac97_is_power_save_mode(ac97) && !powerup) 2329 2384 /* adjust power-down bits after two seconds delay 2330 2385 * (for avoiding loud click noises for many (OSS) apps … … 2346 2401 int i; 2347 2402 2348 #ifdef CONFIG_SND_AC97_POWER_SAVE2349 if (power_save)2350 power_up = ac97->power_up;2351 else {2352 #endif2353 2403 power_up = (1 << PWIDX_FRONT) | (1 << PWIDX_ADC); 2354 2404 power_up |= (1 << PWIDX_MIC); … … 2358 2408 power_up |= (1 << PWIDX_CLFE); 2359 2409 #ifdef CONFIG_SND_AC97_POWER_SAVE 2360 } 2410 if (ac97_is_power_save_mode(ac97)) 2411 power_up = ac97->power_up; 2361 2412 #endif 2362 2413 if (power_up) { -
GPL/trunk/alsa-kernel/pci/ac97/ac97_patch.c
r77 r86 31 31 #include <sound/pcm.h> 32 32 #include <sound/control.h> 33 #include <sound/tlv.h> 33 34 #include <sound/ac97_codec.h> 34 35 #include "ac97_patch.h" … … 48 49 return err; 49 50 return 0; 51 } 52 53 /* replace with a new TLV */ 54 static void reset_tlv(struct snd_ac97 *ac97, const char *name, 55 unsigned int *tlv) 56 { 57 struct snd_ctl_elem_id sid; 58 struct snd_kcontrol *kctl; 59 memset(&sid, 0, sizeof(sid)); 60 strcpy(sid.name, name); 61 sid.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 62 kctl = snd_ctl_find_id(ac97->bus->card, &sid); 63 if (kctl && kctl->tlv.p) 64 kctl->tlv.p = tlv; 50 65 } 51 66 … … 174 189 } 175 190 191 /* system has shared jacks with surround out enabled */ 192 static inline int is_shared_surrout(struct snd_ac97 *ac97) 193 { 194 return ! ac97->indep_surround && is_surround_on(ac97); 195 } 196 197 /* system has shared jacks with center/lfe out enabled */ 198 static inline int is_shared_clfeout(struct snd_ac97 *ac97) 199 { 200 return ! ac97->indep_surround && is_clfe_on(ac97); 201 } 202 203 /* system has shared jacks with line in enabled */ 176 204 static inline int is_shared_linein(struct snd_ac97 *ac97) 177 205 { 178 return ! ac97->indep_surround && is_surround_on(ac97); 179 } 180 206 return !ac97->indep_surround && !is_surround_on(ac97); 207 } 208 209 /* system has shared jacks with mic in enabled */ 181 210 static inline int is_shared_micin(struct snd_ac97 *ac97) 182 211 { 183 return ! ac97->indep_surround && is_clfe_on(ac97); 184 } 185 212 return !ac97->indep_surround && !is_clfe_on(ac97); 213 } 186 214 187 215 /* The following snd_ac97_ymf753_... items added by David Shust (dshust@shustring.com) */ … … 514 542 515 543 AC97_SINGLE("Out3 Switch", AC97_AUX, 15, 1, 1), 516 AC97_SINGLE("Out3 ZC Switch", AC97_AUX, 7, 1, 1),544 AC97_SINGLE("Out3 ZC Switch", AC97_AUX, 7, 1, 0), 517 545 AC97_ENUM("Out3 Mux", wm9711_enum[2]), 518 546 AC97_ENUM("Out3 LR Mux", wm9711_enum[3]), … … 559 587 AC97_SINGLE("ADC Switch", AC97_REC_GAIN, 15, 1, 1), 560 588 AC97_ENUM("Capture Volume Steps", wm9711_enum[6]), 561 AC97_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 15, 1),589 AC97_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 63, 1), 562 590 AC97_SINGLE("Capture ZC Switch", AC97_REC_GAIN, 7, 1, 0), 563 591 … … 565 593 AC97_SINGLE("Mic 2 to Phone Switch", AC97_MIC, 13, 1, 1), 566 594 AC97_ENUM("Mic Select Source", wm9711_enum[7]), 567 AC97_SINGLE("Mic 1 Volume", AC97_MIC, 8, 32, 1), 595 AC97_SINGLE("Mic 1 Volume", AC97_MIC, 8, 31, 1), 596 AC97_SINGLE("Mic 2 Volume", AC97_MIC, 0, 31, 1), 568 597 AC97_SINGLE("Mic 20dB Boost Switch", AC97_MIC, 7, 1, 0), 569 598 … … 923 952 { 924 953 int err; 954 955 /* the register bit is writable, but the function is not implemented: */ 956 snd_ac97_remove_ctl(ac97, "PCM Out Path & Mute", NULL); 925 957 926 958 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Sigmatel Surround Playback"); … … 1379 1411 #endif 1380 1412 1413 static const struct snd_ac97_res_table ad1819_restbl[] = { 1414 { AC97_PHONE, 0x9f1f }, 1415 { AC97_MIC, 0x9f1f }, 1416 { AC97_LINE, 0x9f1f }, 1417 { AC97_CD, 0x9f1f }, 1418 { AC97_VIDEO, 0x9f1f }, 1419 { AC97_AUX, 0x9f1f }, 1420 { AC97_PCM, 0x9f1f }, 1421 {0} /* terminator */ 1422 }; 1423 1381 1424 int patch_ad1819(struct snd_ac97 * ac97) 1382 1425 { … … 1385 1428 // patch for Analog Devices 1386 1429 scfg = snd_ac97_read(ac97, AC97_AD_SERIAL_CFG); 1387 snd_ac97_write_cache(ac97, AC97_AD_SERIAL_CFG, scfg | 0x7000); /* select all codecs */ 1430 snd_ac97_write_cache(ac97, AC97_AD_SERIAL_CFG, scfg | 0x7000); /* select all codecs */ 1431 ac97->res_table = ad1819_restbl; 1388 1432 return 0; 1389 1433 } … … 1438 1482 ac97->spec.ad18xx.codec_cfg[unchained_idx] = 0x0002; 1439 1483 if (cidx1 >= 0) { 1440 if (patch_ad1881_chained1(ac97, cidx1, 0x0006)) // SDIE | ID1C 1484 if (cidx2 < 0) 1485 patch_ad1881_chained1(ac97, cidx1, 0); 1486 else if (patch_ad1881_chained1(ac97, cidx1, 0x0006)) // SDIE | ID1C 1441 1487 patch_ad1881_chained1(ac97, cidx2, 0); 1442 1488 else if (patch_ad1881_chained1(ac97, cidx2, 0x0006)) // SDIE | ID1C … … 1521 1567 }; 1522 1568 1569 static DECLARE_TLV_DB_SCALE(db_scale_6bit_6db_max, -8850, 150, 0); 1570 1523 1571 static int patch_ad1885_specific(struct snd_ac97 * ac97) 1524 1572 { … … 1527 1575 if ((err = patch_build_controls(ac97, snd_ac97_controls_ad1885, ARRAY_SIZE(snd_ac97_controls_ad1885))) < 0) 1528 1576 return err; 1577 reset_tlv(ac97, "Headphone Playback Volume", 1578 db_scale_6bit_6db_max); 1529 1579 return 0; 1530 1580 } … … 1550 1600 } 1551 1601 1602 static int patch_ad1886_specific(struct snd_ac97 * ac97) 1603 { 1604 reset_tlv(ac97, "Headphone Playback Volume", 1605 db_scale_6bit_6db_max); 1606 return 0; 1607 } 1608 1609 static struct snd_ac97_build_ops patch_ad1886_build_ops = { 1610 .build_specific = &patch_ad1886_specific, 1611 #ifdef CONFIG_PM 1612 .resume = ad18xx_resume 1613 #endif 1614 }; 1615 1552 1616 int patch_ad1886(struct snd_ac97 * ac97) 1553 1617 { … … 1555 1619 /* Presario700 workaround */ 1556 1620 /* for Jack Sense/SPDIF Register misetting causing */ 1557 snd_ac97_write_cache(ac97, AC97_AD_JACK_SPDIF, 0x0010); 1558 return 0; 1559 } 1560 1561 /* MISC bits */ 1621 snd_ac97_write_cache(ac97, AC97_AD_JACK_SPDIF, 0x0010); 1622 ac97->build_ops = &patch_ad1886_build_ops; 1623 return 0; 1624 } 1625 1626 /* MISC bits (AD1888/AD1980/AD1985 register 0x76) */ 1562 1627 #define AC97_AD198X_MBC 0x0003 /* mic boost */ 1563 1628 #define AC97_AD198X_MBC_20 0x0000 /* +20dB */ … … 1565 1630 #define AC97_AD198X_MBC_30 0x0002 /* +30dB */ 1566 1631 #define AC97_AD198X_VREFD 0x0004 /* VREF high-Z */ 1567 #define AC97_AD198X_VREFH 0x0008 /* 2.25V, 3.7V */ 1568 #define AC97_AD198X_VREF_0 0x000c /* 0V */ 1632 #define AC97_AD198X_VREFH 0x0008 /* 0=2.25V, 1=3.7V */ 1633 #define AC97_AD198X_VREF_0 0x000c /* 0V (AD1985 only) */ 1634 #define AC97_AD198X_VREF_MASK (AC97_AD198X_VREFH | AC97_AD198X_VREFD) 1635 #define AC97_AD198X_VREF_SHIFT 2 1569 1636 #define AC97_AD198X_SRU 0x0010 /* sample rate unlock */ 1570 1637 #define AC97_AD198X_LOSEL 0x0020 /* LINE_OUT amplifiers input select */ 1571 1638 #define AC97_AD198X_2MIC 0x0040 /* 2-channel mic select */ 1572 1639 #define AC97_AD198X_SPRD 0x0080 /* SPREAD enable */ 1573 #define AC97_AD198X_DMIX0 0x0100 /* downmix mode: 0 = 6-to-4, 1 = 6-to-2 downmix */ 1640 #define AC97_AD198X_DMIX0 0x0100 /* downmix mode: */ 1641 /* 0 = 6-to-4, 1 = 6-to-2 downmix */ 1574 1642 #define AC97_AD198X_DMIX1 0x0200 /* downmix mode: 1 = enabled */ 1575 1643 #define AC97_AD198X_HPSEL 0x0400 /* headphone amplifier input select */ … … 1579 1647 #define AC97_AD198X_AC97NC 0x4000 /* AC97 no compatible mode */ 1580 1648 #define AC97_AD198X_DACZ 0x8000 /* DAC zero-fill mode */ 1649 1650 /* MISC 1 bits (AD1986 register 0x76) */ 1651 #define AC97_AD1986_MBC 0x0003 /* mic boost */ 1652 #define AC97_AD1986_MBC_20 0x0000 /* +20dB */ 1653 #define AC97_AD1986_MBC_10 0x0001 /* +10dB */ 1654 #define AC97_AD1986_MBC_30 0x0002 /* +30dB */ 1655 #define AC97_AD1986_LISEL0 0x0004 /* LINE_IN select bit 0 */ 1656 #define AC97_AD1986_LISEL1 0x0008 /* LINE_IN select bit 1 */ 1657 #define AC97_AD1986_LISEL_MASK (AC97_AD1986_LISEL1 | AC97_AD1986_LISEL0) 1658 #define AC97_AD1986_LISEL_LI 0x0000 /* LINE_IN pins as LINE_IN source */ 1659 #define AC97_AD1986_LISEL_SURR 0x0004 /* SURROUND pins as LINE_IN source */ 1660 #define AC97_AD1986_LISEL_MIC 0x0008 /* MIC_1/2 pins as LINE_IN source */ 1661 #define AC97_AD1986_SRU 0x0010 /* sample rate unlock */ 1662 #define AC97_AD1986_SOSEL 0x0020 /* SURROUND_OUT amplifiers input sel */ 1663 #define AC97_AD1986_2MIC 0x0040 /* 2-channel mic select */ 1664 #define AC97_AD1986_SPRD 0x0080 /* SPREAD enable */ 1665 #define AC97_AD1986_DMIX0 0x0100 /* downmix mode: */ 1666 /* 0 = 6-to-4, 1 = 6-to-2 downmix */ 1667 #define AC97_AD1986_DMIX1 0x0200 /* downmix mode: 1 = enabled */ 1668 #define AC97_AD1986_CLDIS 0x0800 /* center/lfe disable */ 1669 #define AC97_AD1986_SODIS 0x1000 /* SURROUND_OUT disable */ 1670 #define AC97_AD1986_MSPLT 0x2000 /* mute split (read only 1) */ 1671 #define AC97_AD1986_AC97NC 0x4000 /* AC97 no compatible mode (r/o 1) */ 1672 #define AC97_AD1986_DACZ 0x8000 /* DAC zero-fill mode */ 1673 1674 /* MISC 2 bits (AD1986 register 0x70) */ 1675 #define AC97_AD_MISC2 0x70 /* Misc Control Bits 2 (AD1986) */ 1676 1677 #define AC97_AD1986_CVREF0 0x0004 /* C/LFE VREF_OUT 2.25V */ 1678 #define AC97_AD1986_CVREF1 0x0008 /* C/LFE VREF_OUT 0V */ 1679 #define AC97_AD1986_CVREF2 0x0010 /* C/LFE VREF_OUT 3.7V */ 1680 #define AC97_AD1986_CVREF_MASK \ 1681 (AC97_AD1986_CVREF2 | AC97_AD1986_CVREF1 | AC97_AD1986_CVREF0) 1682 #define AC97_AD1986_JSMAP 0x0020 /* Jack Sense Mapping 1 = alternate */ 1683 #define AC97_AD1986_MMDIS 0x0080 /* Mono Mute Disable */ 1684 #define AC97_AD1986_MVREF0 0x0400 /* MIC VREF_OUT 2.25V */ 1685 #define AC97_AD1986_MVREF1 0x0800 /* MIC VREF_OUT 0V */ 1686 #define AC97_AD1986_MVREF2 0x1000 /* MIC VREF_OUT 3.7V */ 1687 #define AC97_AD1986_MVREF_MASK \ 1688 (AC97_AD1986_MVREF2 | AC97_AD1986_MVREF1 | AC97_AD1986_MVREF0) 1689 1690 /* MISC 3 bits (AD1986 register 0x7a) */ 1691 #define AC97_AD_MISC3 0x7a /* Misc Control Bits 3 (AD1986) */ 1692 1693 #define AC97_AD1986_MMIX 0x0004 /* Mic Mix, left/right */ 1694 #define AC97_AD1986_GPO 0x0008 /* General Purpose Out */ 1695 #define AC97_AD1986_LOHPEN 0x0010 /* LINE_OUT headphone drive */ 1696 #define AC97_AD1986_LVREF0 0x0100 /* LINE_OUT VREF_OUT 2.25V */ 1697 #define AC97_AD1986_LVREF1 0x0200 /* LINE_OUT VREF_OUT 0V */ 1698 #define AC97_AD1986_LVREF2 0x0400 /* LINE_OUT VREF_OUT 3.7V */ 1699 #define AC97_AD1986_LVREF_MASK \ 1700 (AC97_AD1986_LVREF2 | AC97_AD1986_LVREF1 | AC97_AD1986_LVREF0) 1701 #define AC97_AD1986_JSINVA 0x0800 /* Jack Sense Invert SENSE_A */ 1702 #define AC97_AD1986_LOSEL 0x1000 /* LINE_OUT amplifiers input select */ 1703 #define AC97_AD1986_HPSEL0 0x2000 /* Headphone amplifiers */ 1704 /* input select Surround DACs */ 1705 #define AC97_AD1986_HPSEL1 0x4000 /* Headphone amplifiers input */ 1706 /* select C/LFE DACs */ 1707 #define AC97_AD1986_JSINVB 0x8000 /* Jack Sense Invert SENSE_B */ 1708 1709 /* Serial Config bits (AD1986 register 0x74) (incomplete) */ 1710 #define AC97_AD1986_OMS0 0x0100 /* Optional Mic Selector bit 0 */ 1711 #define AC97_AD1986_OMS1 0x0200 /* Optional Mic Selector bit 1 */ 1712 #define AC97_AD1986_OMS2 0x0400 /* Optional Mic Selector bit 2 */ 1713 #define AC97_AD1986_OMS_MASK \ 1714 (AC97_AD1986_OMS2 | AC97_AD1986_OMS1 | AC97_AD1986_OMS0) 1715 #define AC97_AD1986_OMS_M 0x0000 /* MIC_1/2 pins are MIC sources */ 1716 #define AC97_AD1986_OMS_L 0x0100 /* LINE_IN pins are MIC sources */ 1717 #define AC97_AD1986_OMS_C 0x0200 /* Center/LFE pins are MCI sources */ 1718 #define AC97_AD1986_OMS_MC 0x0400 /* Mix of MIC and C/LFE pins */ 1719 /* are MIC sources */ 1720 #define AC97_AD1986_OMS_ML 0x0500 /* MIX of MIC and LINE_IN pins */ 1721 /* are MIC sources */ 1722 #define AC97_AD1986_OMS_LC 0x0600 /* MIX of LINE_IN and C/LFE pins */ 1723 /* are MIC sources */ 1724 #define AC97_AD1986_OMS_MLC 0x0700 /* MIX of MIC, LINE_IN, C/LFE pins */ 1725 /* are MIC sources */ 1581 1726 1582 1727 … … 1902 2047 } 1903 2048 2049 static int snd_ac97_ad1985_vrefout_info(struct snd_kcontrol *kcontrol, 2050 struct snd_ctl_elem_info *uinfo) 2051 { 2052 static char *texts[4] = {"High-Z", "3.7 V", "2.25 V", "0 V"}; 2053 2054 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2055 uinfo->count = 1; 2056 uinfo->value.enumerated.items = 4; 2057 if (uinfo->value.enumerated.item > 3) 2058 uinfo->value.enumerated.item = 3; 2059 strcpy(uinfo->value.enumerated.name, 2060 texts[uinfo->value.enumerated.item]); 2061 return 0; 2062 } 2063 2064 static int snd_ac97_ad1985_vrefout_get(struct snd_kcontrol *kcontrol, 2065 struct snd_ctl_elem_value *ucontrol) 2066 { 2067 static const int reg2ctrl[4] = {2, 0, 1, 3}; 2068 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2069 unsigned short val; 2070 val = (ac97->regs[AC97_AD_MISC] & AC97_AD198X_VREF_MASK) 2071 >> AC97_AD198X_VREF_SHIFT; 2072 ucontrol->value.enumerated.item[0] = reg2ctrl[val]; 2073 return 0; 2074 } 2075 2076 static int snd_ac97_ad1985_vrefout_put(struct snd_kcontrol *kcontrol, 2077 struct snd_ctl_elem_value *ucontrol) 2078 { 2079 static const int ctrl2reg[4] = {1, 2, 0, 3}; 2080 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2081 unsigned short val; 2082 2083 if (ucontrol->value.enumerated.item[0] > 3 2084 || ucontrol->value.enumerated.item[0] < 0) 2085 return -EINVAL; 2086 val = ctrl2reg[ucontrol->value.enumerated.item[0]] 2087 << AC97_AD198X_VREF_SHIFT; 2088 return snd_ac97_update_bits(ac97, AC97_AD_MISC, 2089 AC97_AD198X_VREF_MASK, val); 2090 } 2091 2092 1904 2093 static const struct snd_kcontrol_new snd_ac97_ad1985_controls[] = { 1905 AC97_SINGLE("Exchange Center/LFE", AC97_AD_SERIAL_CFG, 3, 1, 0) 2094 AC97_SINGLE("Exchange Center/LFE", AC97_AD_SERIAL_CFG, 3, 1, 0), 2095 { 2096 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2097 .name = "Exchange Front/Surround", 2098 .info = snd_ac97_ad1888_lohpsel_info, 2099 .get = snd_ac97_ad1888_lohpsel_get, 2100 .put = snd_ac97_ad1888_lohpsel_put 2101 }, 2102 AC97_SINGLE("High Pass Filter Enable", AC97_AD_TEST2, 12, 1, 1), 2103 AC97_SINGLE("Spread Front to Surround and Center/LFE", 2104 AC97_AD_MISC, 7, 1, 0), 2105 { 2106 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2107 .name = "Downmix", 2108 .info = snd_ac97_ad1888_downmix_info, 2109 .get = snd_ac97_ad1888_downmix_get, 2110 .put = snd_ac97_ad1888_downmix_put 2111 }, 2112 { 2113 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2114 .name = "V_REFOUT", 2115 .info = snd_ac97_ad1985_vrefout_info, 2116 .get = snd_ac97_ad1985_vrefout_get, 2117 .put = snd_ac97_ad1985_vrefout_put 2118 }, 2119 AC97_SURROUND_JACK_MODE_CTL, 2120 AC97_CHANNEL_MODE_CTL, 2121 2122 AC97_SINGLE("Headphone Jack Sense", AC97_AD_JACK_SPDIF, 10, 1, 0), 2123 AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0), 1906 2124 }; 1907 2125 … … 1917 2135 int err; 1918 2136 1919 if ((err = patch_ad1980_specific(ac97)) < 0) 2137 /* rename 0x04 as "Master" and 0x02 as "Master Surround" */ 2138 snd_ac97_rename_vol_ctl(ac97, "Master Playback", 2139 "Master Surround Playback"); 2140 snd_ac97_rename_vol_ctl(ac97, "Headphone Playback", "Master Playback"); 2141 2142 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0) 1920 2143 return err; 1921 return patch_build_controls(ac97, snd_ac97_ad1985_controls, ARRAY_SIZE(snd_ac97_ad1985_controls)); 2144 2145 return patch_build_controls(ac97, snd_ac97_ad1985_controls, 2146 ARRAY_SIZE(snd_ac97_ad1985_controls)); 1922 2147 } 1923 2148 … … 1939 2164 misc = snd_ac97_read(ac97, AC97_AD_MISC); 1940 2165 /* switch front/surround line-out/hp-out */ 1941 /* center/LFE, mic in 3.75V mode */1942 2166 /* AD-compatible mode */ 1943 2167 /* Stereo mutes enabled */ 1944 /* in accordance with ADI driver: misc | 0x5c28 */1945 2168 snd_ac97_write_cache(ac97, AC97_AD_MISC, misc | 1946 AC97_AD198X_VREFH |1947 2169 AC97_AD198X_LOSEL | 1948 2170 AC97_AD198X_HPSEL | 1949 AC97_AD198X_CLDIS |1950 AC97_AD198X_LODIS |1951 2171 AC97_AD198X_MSPLT | 1952 2172 AC97_AD198X_AC97NC); 1953 2173 ac97->flags |= AC97_STEREO_MUTES; 1954 /* on AD1985 rev. 3, AC'97 revision bits are zero */ 2174 2175 /* update current jack configuration */ 2176 ad1985_update_jacks(ac97); 2177 2178 /* on AD1985 rev. 3, AC'97 revision bits are zero */ 1955 2179 ac97->ext_id = (ac97->ext_id & ~AC97_EI_REV_MASK) | AC97_EI_REV_23; 1956 2180 return 0; 1957 2181 } 2182 2183 static int snd_ac97_ad1986_bool_info(struct snd_kcontrol *kcontrol, 2184 struct snd_ctl_elem_info *uinfo) 2185 { 2186 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 2187 uinfo->count = 1; 2188 uinfo->value.integer.min = 0; 2189 uinfo->value.integer.max = 1; 2190 return 0; 2191 } 2192 2193 static int snd_ac97_ad1986_lososel_get(struct snd_kcontrol *kcontrol, 2194 struct snd_ctl_elem_value *ucontrol) 2195 { 2196 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2197 unsigned short val; 2198 2199 val = ac97->regs[AC97_AD_MISC3]; 2200 ucontrol->value.integer.value[0] = (val & AC97_AD1986_LOSEL) != 0; 2201 return 0; 2202 } 2203 2204 static int snd_ac97_ad1986_lososel_put(struct snd_kcontrol *kcontrol, 2205 struct snd_ctl_elem_value *ucontrol) 2206 { 2207 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2208 int ret0; 2209 int ret1; 2210 int sprd = (ac97->regs[AC97_AD_MISC] & AC97_AD1986_SPRD) != 0; 2211 2212 ret0 = snd_ac97_update_bits(ac97, AC97_AD_MISC3, AC97_AD1986_LOSEL, 2213 ucontrol->value.integer.value[0] != 0 2214 ? AC97_AD1986_LOSEL : 0); 2215 if (ret0 < 0) 2216 return ret0; 2217 2218 /* SOSEL is set to values of "Spread" or "Exchange F/S" controls */ 2219 ret1 = snd_ac97_update_bits(ac97, AC97_AD_MISC, AC97_AD1986_SOSEL, 2220 (ucontrol->value.integer.value[0] != 0 2221 || sprd) 2222 ? AC97_AD1986_SOSEL : 0); 2223 if (ret1 < 0) 2224 return ret1; 2225 2226 return (ret0 > 0 || ret1 > 0) ? 1 : 0; 2227 } 2228 2229 static int snd_ac97_ad1986_spread_get(struct snd_kcontrol *kcontrol, 2230 struct snd_ctl_elem_value *ucontrol) 2231 { 2232 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2233 unsigned short val; 2234 2235 val = ac97->regs[AC97_AD_MISC]; 2236 ucontrol->value.integer.value[0] = (val & AC97_AD1986_SPRD) != 0; 2237 return 0; 2238 } 2239 2240 static int snd_ac97_ad1986_spread_put(struct snd_kcontrol *kcontrol, 2241 struct snd_ctl_elem_value *ucontrol) 2242 { 2243 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2244 int ret0; 2245 int ret1; 2246 int sprd = (ac97->regs[AC97_AD_MISC3] & AC97_AD1986_LOSEL) != 0; 2247 2248 ret0 = snd_ac97_update_bits(ac97, AC97_AD_MISC, AC97_AD1986_SPRD, 2249 ucontrol->value.integer.value[0] != 0 2250 ? AC97_AD1986_SPRD : 0); 2251 if (ret0 < 0) 2252 return ret0; 2253 2254 /* SOSEL is set to values of "Spread" or "Exchange F/S" controls */ 2255 ret1 = snd_ac97_update_bits(ac97, AC97_AD_MISC, AC97_AD1986_SOSEL, 2256 (ucontrol->value.integer.value[0] != 0 2257 || sprd) 2258 ? AC97_AD1986_SOSEL : 0); 2259 if (ret1 < 0) 2260 return ret1; 2261 2262 return (ret0 > 0 || ret1 > 0) ? 1 : 0; 2263 } 2264 2265 static int snd_ac97_ad1986_miclisel_get(struct snd_kcontrol *kcontrol, 2266 struct snd_ctl_elem_value *ucontrol) 2267 { 2268 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2269 2270 ucontrol->value.integer.value[0] = ac97->spec.ad18xx.swap_mic_linein; 2271 return 0; 2272 } 2273 2274 static int snd_ac97_ad1986_miclisel_put(struct snd_kcontrol *kcontrol, 2275 struct snd_ctl_elem_value *ucontrol) 2276 { 2277 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2278 unsigned char swap = ucontrol->value.integer.value[0] != 0; 2279 2280 if (swap != ac97->spec.ad18xx.swap_mic_linein) { 2281 ac97->spec.ad18xx.swap_mic_linein = swap; 2282 if (ac97->build_ops->update_jacks) 2283 ac97->build_ops->update_jacks(ac97); 2284 return 1; 2285 } 2286 return 0; 2287 } 2288 2289 static int snd_ac97_ad1986_vrefout_get(struct snd_kcontrol *kcontrol, 2290 struct snd_ctl_elem_value *ucontrol) 2291 { 2292 /* Use MIC_1/2 V_REFOUT as the "get" value */ 2293 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2294 unsigned short val; 2295 unsigned short reg = ac97->regs[AC97_AD_MISC2]; 2296 if ((reg & AC97_AD1986_MVREF0) != 0) 2297 val = 2; 2298 else if ((reg & AC97_AD1986_MVREF1) != 0) 2299 val = 3; 2300 else if ((reg & AC97_AD1986_MVREF2) != 0) 2301 val = 1; 2302 else 2303 val = 0; 2304 ucontrol->value.enumerated.item[0] = val; 2305 return 0; 2306 } 2307 2308 static int snd_ac97_ad1986_vrefout_put(struct snd_kcontrol *kcontrol, 2309 struct snd_ctl_elem_value *ucontrol) 2310 { 2311 struct snd_ac97 *ac97 = snd_kcontrol_chip(kcontrol); 2312 unsigned short cval; 2313 unsigned short lval; 2314 unsigned short mval; 2315 int cret; 2316 int lret; 2317 int mret; 2318 2319 switch (ucontrol->value.enumerated.item[0]) 2320 { 2321 case 0: /* High-Z */ 2322 cval = 0; 2323 lval = 0; 2324 mval = 0; 2325 break; 2326 case 1: /* 3.7 V */ 2327 cval = AC97_AD1986_CVREF2; 2328 lval = AC97_AD1986_LVREF2; 2329 mval = AC97_AD1986_MVREF2; 2330 break; 2331 case 2: /* 2.25 V */ 2332 cval = AC97_AD1986_CVREF0; 2333 lval = AC97_AD1986_LVREF0; 2334 mval = AC97_AD1986_MVREF0; 2335 break; 2336 case 3: /* 0 V */ 2337 cval = AC97_AD1986_CVREF1; 2338 lval = AC97_AD1986_LVREF1; 2339 mval = AC97_AD1986_MVREF1; 2340 break; 2341 default: 2342 return -EINVAL; 2343 } 2344 2345 cret = snd_ac97_update_bits(ac97, AC97_AD_MISC2, 2346 AC97_AD1986_CVREF_MASK, cval); 2347 if (cret < 0) 2348 return cret; 2349 lret = snd_ac97_update_bits(ac97, AC97_AD_MISC3, 2350 AC97_AD1986_LVREF_MASK, lval); 2351 if (lret < 0) 2352 return lret; 2353 mret = snd_ac97_update_bits(ac97, AC97_AD_MISC2, 2354 AC97_AD1986_MVREF_MASK, mval); 2355 if (mret < 0) 2356 return mret; 2357 2358 return (cret > 0 || lret > 0 || mret > 0) ? 1 : 0; 2359 } 2360 2361 static const struct snd_kcontrol_new snd_ac97_ad1986_controls[] = { 2362 AC97_SINGLE("Exchange Center/LFE", AC97_AD_SERIAL_CFG, 3, 1, 0), 2363 { 2364 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2365 .name = "Exchange Front/Surround", 2366 .info = snd_ac97_ad1986_bool_info, 2367 .get = snd_ac97_ad1986_lososel_get, 2368 .put = snd_ac97_ad1986_lososel_put 2369 }, 2370 { 2371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2372 .name = "Exchange Mic/Line In", 2373 .info = snd_ac97_ad1986_bool_info, 2374 .get = snd_ac97_ad1986_miclisel_get, 2375 .put = snd_ac97_ad1986_miclisel_put 2376 }, 2377 { 2378 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2379 .name = "Spread Front to Surround and Center/LFE", 2380 .info = snd_ac97_ad1986_bool_info, 2381 .get = snd_ac97_ad1986_spread_get, 2382 .put = snd_ac97_ad1986_spread_put 2383 }, 2384 { 2385 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2386 .name = "Downmix", 2387 .info = snd_ac97_ad1888_downmix_info, 2388 .get = snd_ac97_ad1888_downmix_get, 2389 .put = snd_ac97_ad1888_downmix_put 2390 }, 2391 { 2392 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2393 .name = "V_REFOUT", 2394 .info = snd_ac97_ad1985_vrefout_info, 2395 .get = snd_ac97_ad1986_vrefout_get, 2396 .put = snd_ac97_ad1986_vrefout_put 2397 }, 2398 AC97_SURROUND_JACK_MODE_CTL, 2399 AC97_CHANNEL_MODE_CTL, 2400 2401 AC97_SINGLE("Headphone Jack Sense", AC97_AD_JACK_SPDIF, 10, 1, 0), 2402 AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0) 2403 }; 2404 2405 static void ad1986_update_jacks(struct snd_ac97 *ac97) 2406 { 2407 unsigned short misc_val = 0; 2408 unsigned short ser_val; 2409 2410 /* disable SURROUND and CENTER/LFE if not surround mode */ 2411 if (! is_surround_on(ac97)) 2412 misc_val |= AC97_AD1986_SODIS; 2413 if (! is_clfe_on(ac97)) 2414 misc_val |= AC97_AD1986_CLDIS; 2415 2416 /* select line input (default=LINE_IN, SURROUND or MIC_1/2) */ 2417 if (is_shared_linein(ac97)) 2418 misc_val |= AC97_AD1986_LISEL_SURR; 2419 else if (ac97->spec.ad18xx.swap_mic_linein != 0) 2420 misc_val |= AC97_AD1986_LISEL_MIC; 2421 snd_ac97_update_bits(ac97, AC97_AD_MISC, 2422 AC97_AD1986_SODIS | AC97_AD1986_CLDIS | 2423 AC97_AD1986_LISEL_MASK, 2424 misc_val); 2425 2426 /* select microphone input (MIC_1/2, Center/LFE or LINE_IN) */ 2427 if (is_shared_micin(ac97)) 2428 ser_val = AC97_AD1986_OMS_C; 2429 else if (ac97->spec.ad18xx.swap_mic_linein != 0) 2430 ser_val = AC97_AD1986_OMS_L; 2431 else 2432 ser_val = AC97_AD1986_OMS_M; 2433 snd_ac97_update_bits(ac97, AC97_AD_SERIAL_CFG, 2434 AC97_AD1986_OMS_MASK, 2435 ser_val); 2436 } 2437 2438 static int patch_ad1986_specific(struct snd_ac97 *ac97) 2439 { 2440 int err; 2441 2442 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0) 2443 return err; 2444 2445 return patch_build_controls(ac97, snd_ac97_ad1986_controls, 2446 ARRAY_SIZE(snd_ac97_ad1985_controls)); 2447 } 2448 2449 static struct snd_ac97_build_ops patch_ad1986_build_ops = { 2450 .build_post_spdif = patch_ad198x_post_spdif, 2451 .build_specific = patch_ad1986_specific, 2452 #ifdef CONFIG_PM 2453 .resume = ad18xx_resume, 2454 #endif 2455 .update_jacks = ad1986_update_jacks, 2456 }; 2457 2458 int patch_ad1986(struct snd_ac97 * ac97) 2459 { 2460 patch_ad1881(ac97); 2461 ac97->build_ops = &patch_ad1986_build_ops; 2462 ac97->flags |= AC97_STEREO_MUTES; 2463 2464 /* update current jack configuration */ 2465 ad1986_update_jacks(ac97); 2466 2467 return 0; 2468 } 2469 1958 2470 1959 2471 /* … … 1964 2476 int shared; 1965 2477 1966 /* shared Line-In */1967 shared = is_shared_ linein(ac97);2478 /* shared Line-In / Surround Out */ 2479 shared = is_shared_surrout(ac97); 1968 2480 snd_ac97_update_bits(ac97, AC97_ALC650_MULTICH, 1 << 9, 1969 2481 shared ? (1 << 9) : 0); 1970 /* update shared Mic */1971 shared = is_shared_ micin(ac97);2482 /* update shared Mic In / Center/LFE Out */ 2483 shared = is_shared_clfeout(ac97); 1972 2484 /* disable/enable vref */ 1973 2485 snd_ac97_update_bits(ac97, AC97_ALC650_CLOCK, 1 << 12, … … 2014 2526 }; 2015 2527 2528 static DECLARE_TLV_DB_SCALE(db_scale_5bit_3db_max, -4350, 150, 0); 2529 2016 2530 static int patch_alc650_specific(struct snd_ac97 * ac97) 2017 2531 { … … 2024 2538 return err; 2025 2539 } 2540 if (ac97->id != AC97_ID_ALC650F) 2541 reset_tlv(ac97, "Master Playback Volume", 2542 db_scale_5bit_3db_max); 2026 2543 return 0; 2027 2544 } … … 2094 2611 int shared; 2095 2612 2096 /* shared Line-In */2097 shared = is_shared_ linein(ac97);2613 /* shared Line-In / Surround Out */ 2614 shared = is_shared_surrout(ac97); 2098 2615 ac97_update_bits_page(ac97, AC97_ALC650_MULTICH, 1 << 9, 2099 2616 shared ? (1 << 9) : 0, 0); 2100 /* update shared mic*/2101 shared = is_shared_ micin(ac97);2617 /* update shared Mic In / Center/LFE Out */ 2618 shared = is_shared_clfeout(ac97); 2102 2619 /* misc control; vrefout disable */ 2103 2620 snd_ac97_update_bits(ac97, AC97_ALC650_CLOCK, 1 << 12, … … 2207 2724 else { /* ALC655 */ 2208 2725 if (ac97->subsystem_vendor == 0x1462 && 2209 ac97->subsystem_device == 0x0131) /* MSI S270 laptop */ 2726 (ac97->subsystem_device == 0x0131 || /* MSI S270 laptop */ 2727 ac97->subsystem_device == 0x0161 || /* LG K1 Express */ 2728 ac97->subsystem_device == 0x0351 || /* MSI L725 laptop */ 2729 ac97->subsystem_device == 0x0061)) /* MSI S250 laptop */ 2210 2730 val &= ~(1 << 1); /* Pin 47 is EAPD (for internal speaker) */ 2211 2731 else … … 2240 2760 int shared; 2241 2761 2242 /* shared Line-In */2243 shared = is_shared_ linein(ac97);2762 /* shared Line-In / Surround Out */ 2763 shared = is_shared_surrout(ac97); 2244 2764 /* SURR 1kOhm (bit4), Amp (bit5) */ 2245 2765 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<4)|(1<<5), … … 2248 2768 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 12, 2249 2769 shared ? (2<<12) : (0<<12)); 2250 /* update shared mic*/2251 shared = is_shared_ micin(ac97);2770 /* update shared Mic In / Center/LFE Out */ 2771 shared = is_shared_clfeout(ac97); 2252 2772 /* Vref disable (bit12), 1kOhm (bit13) */ 2253 2773 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<12)|(1<<13), … … 2322 2842 static void cm9738_update_jacks(struct snd_ac97 *ac97) 2323 2843 { 2324 /* shared Line-In */2844 /* shared Line-In / Surround Out */ 2325 2845 snd_ac97_update_bits(ac97, AC97_CM9738_VENDOR_CTRL, 1 << 10, 2326 is_shared_ linein(ac97) ? (1 << 10) : 0);2846 is_shared_surrout(ac97) ? (1 << 10) : 0); 2327 2847 } 2328 2848 … … 2406 2926 static void cm9739_update_jacks(struct snd_ac97 *ac97) 2407 2927 { 2408 /* shared Line-In */2928 /* shared Line-In / Surround Out */ 2409 2929 snd_ac97_update_bits(ac97, AC97_CM9739_MULTI_CHAN, 1 << 10, 2410 is_shared_ linein(ac97) ? (1 << 10) : 0);2411 /* shared Mic */2930 is_shared_surrout(ac97) ? (1 << 10) : 0); 2931 /* shared Mic In / Center/LFE Out **/ 2412 2932 snd_ac97_update_bits(ac97, AC97_CM9739_MULTI_CHAN, 0x3000, 2413 is_shared_ micin(ac97) ? 0x1000 : 0x2000);2933 is_shared_clfeout(ac97) ? 0x1000 : 0x2000); 2414 2934 } 2415 2935 … … 2523 3043 val |= surr_on[ac97->spec.dev_flags][is_surround_on(ac97)]; 2524 3044 val |= clfe_on[ac97->spec.dev_flags][is_clfe_on(ac97)]; 2525 val |= surr_shared[ac97->spec.dev_flags][is_shared_ linein(ac97)];2526 val |= clfe_shared[ac97->spec.dev_flags][is_shared_ micin(ac97)];3045 val |= surr_shared[ac97->spec.dev_flags][is_shared_surrout(ac97)]; 3046 val |= clfe_shared[ac97->spec.dev_flags][is_shared_clfeout(ac97)]; 2527 3047 2528 3048 snd_ac97_update_bits(ac97, AC97_CM9761_MULTI_CHAN, 0x3c88, val); … … 2758 3278 int patch_vt1617a(struct snd_ac97 * ac97) 2759 3279 { 3280 /* bring analog power consumption to normal, like WinXP driver 3281 * for EPIA SP 3282 */ 3283 snd_ac97_write_cache(ac97, 0x5c, 0x20); 2760 3284 ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */ 2761 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; 3285 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000; 3286 ac97->build_ops = &patch_vt1616_ops; 2762 3287 return 0; 2763 3288 } … … 2767 3292 static void it2646_update_jacks(struct snd_ac97 *ac97) 2768 3293 { 2769 /* shared Line-In */ 2770 snd_ac97_update_bits(ac97, 0x76, 1 << 9, 2771 is_shared_linein(ac97) ? (1<<9) : 0); 2772 /* shared Mic */ 3294 /* shared Line-In / Surround Out */ 3295 snd_ac97_update_bits(ac97, 0x76, 1 << 9, 3296 is_shared_surrout(ac97) ? (1<<9) : 0); 3297 /* shared Mic / Center/LFE Out */ 3298 2773 3299 snd_ac97_update_bits(ac97, 0x76, 1 << 10, 2774 is_shared_ micin(ac97) ? (1<<10) : 0);3300 is_shared_clfeout(ac97) ? (1<<10) : 0); 2775 3301 } 2776 3302 -
GPL/trunk/alsa-kernel/pci/ac97/ac97_patch.h
r77 r86 49 49 int patch_ad1981b(struct snd_ac97 * ac97); 50 50 int patch_ad1985(struct snd_ac97 * ac97); 51 int patch_ad1986(struct snd_ac97 * ac97); 51 52 int patch_alc650(struct snd_ac97 * ac97); 52 53 int patch_alc655(struct snd_ac97 * ac97); -
GPL/trunk/alsa-kernel/pci/hda/hda_codec.c
r77 r86 29 29 #include "hda_codec.h" 30 30 #include <sound/asoundef.h> 31 #include <sound/tlv.h> 31 32 #include <sound/initval.h> 32 33 #include "hda_local.h" … … 50 51 static struct hda_vendor_id hda_vendor_ids[] = { 51 52 { 0x10ec, "Realtek" }, 53 { 0x1057, "Motorola" }, 54 { 0x1106, "VIA" }, 52 55 { 0x11d4, "Analog Devices" }, 53 56 { 0x13f6, "C-Media" }, 57 { 0x14f1, "Conexant" }, 54 58 { 0x434d, "C-Media" }, 55 59 { 0x8384, "SigmaTel" }, … … 85 89 return res; 86 90 } 91 92 EXPORT_SYMBOL(snd_hda_codec_read); 87 93 88 94 /** … … 397 403 if (! mask) 398 404 mask = ~0; 399 if (preset->id == (codec->vendor_id & mask)) 400 if (preset->id == (codec->vendor_id & mask) && 401 (! preset->rev || 402 preset->rev == codec->revision_id)) 403 return preset; 405 if (preset->id == (codec->vendor_id & mask) && 406 (! preset->rev || 407 preset->rev == codec->revision_id)) 408 return preset; 404 409 } 405 410 } … … 827 832 return change; 828 833 } 834 835 int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, 836 unsigned int size, unsigned int __user *_tlv) 837 { 838 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 839 hda_nid_t nid = get_amp_nid(kcontrol); 840 int dir = get_amp_direction(kcontrol); 841 u32 caps, val1, val2; 842 843 if (size < 4 * sizeof(unsigned int)) 844 return -ENOMEM; 845 caps = query_amp_caps(codec, nid, dir); 846 val2 = (((caps & AC_AMPCAP_STEP_SIZE) >> AC_AMPCAP_STEP_SIZE_SHIFT) + 1) * 25; 847 val1 = -((caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT); 848 val1 = ((int)val1) * ((int)val2); 849 if (put_user(SNDRV_CTL_TLVT_DB_SCALE, _tlv)) 850 return -EFAULT; 851 if (put_user(2 * sizeof(unsigned int), _tlv + 1)) 852 return -EFAULT; 853 if (put_user(val1, _tlv + 2)) 854 return -EFAULT; 855 if (put_user(val2, _tlv + 3)) 856 return -EFAULT; 857 return 0; 858 } 859 829 860 830 861 /* switch */ … … 1323 1354 { 192000, SNDRV_PCM_RATE_192000, 0x1800 }, /* 4 x 48 */ 1324 1355 1325 /* not autodetected value */1326 { 9600, SNDRV_PCM_RATE_KNOT, 0x0400 }, /* 1/5 x 48 */1327 1328 1356 { 0 } /* terminator */ 1329 1357 }; … … 1461 1489 if (val & AC_SUPPCM_BITS_32) 1462 1490 bps = 32; 1491 else if (val & AC_SUPPCM_BITS_24) 1492 bps = 24; 1463 1493 else if (val & AC_SUPPCM_BITS_20) 1464 1494 bps = 20; 1465 else if (val & AC_SUPPCM_BITS_24)1466 bps = 24;1467 1495 } 1468 1496 } … … 1670 1698 * snd_hda_check_board_config - compare the current codec with the config table 1671 1699 * @codec: the HDA codec 1700 * @num_configs: number of config enums 1701 * @models: array of model name strings 1672 1702 * @tbl: configuration table, terminated by null entries 1673 1703 * … … 1678 1708 * If no entries are matching, the function returns a negative value. 1679 1709 */ 1680 int snd_hda_check_board_config(struct hda_codec *codec, const struct hda_board_config *tbl) 1681 { 1682 const struct hda_board_config *c; 1683 1684 if (codec->bus->modelname) { 1685 for (c = tbl; c->modelname || c->pci_subvendor; c++) { 1686 if (c->modelname && 1687 ! strcmp(codec->bus->modelname, c->modelname)) { 1688 snd_printd(KERN_INFO "hda_codec: model '%s' is selected\n", c->modelname); 1689 return c->config; 1710 int snd_hda_check_board_config(struct hda_codec *codec, 1711 int num_configs, const char **models, 1712 const struct snd_pci_quirk *tbl) 1713 { 1714 if (codec->bus->modelname && models) { 1715 int i; 1716 for (i = 0; i < num_configs; i++) { 1717 if (models[i] && 1718 !strcmp(codec->bus->modelname, models[i])) { 1719 snd_printd(KERN_INFO "hda_codec: model '%s' is " 1720 "selected\n", models[i]); 1721 return i; 1690 1722 } 1691 1723 } 1692 1724 } 1693 1725 1694 if (codec->bus->pci) { 1695 u16 subsystem_vendor, subsystem_device; 1696 pci_read_config_word(codec->bus->pci, PCI_SUBSYSTEM_VENDOR_ID, &subsystem_vendor); 1697 pci_read_config_word(codec->bus->pci, PCI_SUBSYSTEM_ID, &subsystem_device); 1698 for (c = tbl; c->modelname || c->pci_subvendor; c++) { 1699 if (c->pci_subvendor == subsystem_vendor && 1700 (! c->pci_subdevice /* all match */|| 1701 (c->pci_subdevice == subsystem_device))) { 1702 snd_printdd(KERN_INFO "hda_codec: PCI %x:%x, codec config %d is selected\n", 1703 subsystem_vendor, subsystem_device, c->config); 1704 return c->config; 1705 } 1726 if (!codec->bus->pci || !tbl) 1727 return -1; 1728 1729 tbl = snd_pci_quirk_lookup(codec->bus->pci, tbl); 1730 if (!tbl) 1731 return -1; 1732 if (tbl->value >= 0 && tbl->value < num_configs) { 1733 #ifdef CONFIG_SND_DEBUG_DETECT 1734 char tmp[10]; 1735 const char *model = NULL; 1736 if (models) 1737 model = models[tbl->value]; 1738 if (!model) { 1739 sprintf(tmp, "#%d", tbl->value); 1740 model = tmp; 1706 1741 } 1742 snd_printdd(KERN_INFO "hda_codec: model '%s' is selected " 1743 "for config %x:%x (%s)\n", 1744 model, tbl->subvendor, tbl->subdevice, 1745 (tbl->name ? tbl->name : "Unknown device")); 1746 #endif 1747 return tbl->value; 1707 1748 } 1708 1749 return -1; … … 1899 1940 /* front */ 1900 1941 snd_hda_codec_setup_stream(codec, nids[HDA_FRONT], stream_tag, 0, format); 1901 if (mout->hp_nid )1942 if (mout->hp_nid && mout->hp_nid != nids[HDA_FRONT]) 1902 1943 /* headphone out will just decode front left/right (stereo) */ 1903 1944 snd_hda_codec_setup_stream(codec, mout->hp_nid, stream_tag, 0, format); … … 1967 2008 * 1968 2009 * If more extra outputs (speaker and headphone) are found, the pins are 1969 * assisnged to hp_pin and speaker_pins[], respectively. If no line-out jack2010 * assisnged to hp_pins[] and speaker_pins[], respectively. If no line-out jack 1970 2011 * is detected, one of speaker of HP pins is assigned as the primary 1971 2012 * output, i.e. to line_out_pins[0]. So, line_outs is always positive … … 2029 2070 break; 2030 2071 case AC_JACK_HP_OUT: 2031 cfg->hp_pin = nid; 2072 if (cfg->hp_outs >= ARRAY_SIZE(cfg->hp_pins)) 2073 continue; 2074 cfg->hp_pins[cfg->hp_outs] = nid; 2075 cfg->hp_outs++; 2032 2076 break; 2033 case AC_JACK_MIC_IN: 2034 if (loc == AC_JACK_LOC_FRONT) 2035 cfg->input_pins[AUTO_PIN_FRONT_MIC] = nid; 2036 else 2037 cfg->input_pins[AUTO_PIN_MIC] = nid; 2077 case AC_JACK_MIC_IN: { 2078 int preferred, alt; 2079 if (loc == AC_JACK_LOC_FRONT) { 2080 preferred = AUTO_PIN_FRONT_MIC; 2081 alt = AUTO_PIN_MIC; 2082 } else { 2083 preferred = AUTO_PIN_MIC; 2084 alt = AUTO_PIN_FRONT_MIC; 2085 } 2086 if (!cfg->input_pins[preferred]) 2087 cfg->input_pins[preferred] = nid; 2088 else if (!cfg->input_pins[alt]) 2089 cfg->input_pins[alt] = nid; 2038 2090 break; 2091 } 2039 2092 case AC_JACK_LINE_IN: 2040 2093 if (loc == AC_JACK_LOC_FRONT) … … 2101 2154 cfg->speaker_pins[1], cfg->speaker_pins[2], 2102 2155 cfg->speaker_pins[3], cfg->speaker_pins[4]); 2103 snd_printd(" hp=0x%x, dig_out=0x%x, din_in=0x%x\n", 2104 cfg->hp_pin, cfg->dig_out_pin, cfg->dig_in_pin); 2156 snd_printd(" hp_outs=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", 2157 cfg->hp_outs, cfg->hp_pins[0], 2158 cfg->hp_pins[1], cfg->hp_pins[2], 2159 cfg->hp_pins[3], cfg->hp_pins[4]); 2105 2160 snd_printd(" inputs: mic=0x%x, fmic=0x%x, line=0x%x, fline=0x%x," 2106 2161 " cd=0x%x, aux=0x%x\n", … … 2123 2178 cfg->speaker_outs = 0; 2124 2179 memset(cfg->speaker_pins, 0, sizeof(cfg->speaker_pins)); 2125 } else if (cfg->hp_pin) { 2126 cfg->line_outs = 1; 2127 cfg->line_out_pins[0] = cfg->hp_pin; 2128 cfg->hp_pin = 0; 2180 } else if (cfg->hp_outs) { 2181 cfg->line_outs = cfg->hp_outs; 2182 memcpy(cfg->line_out_pins, cfg->hp_pins, 2183 sizeof(cfg->hp_pins)); 2184 cfg->hp_outs = 0; 2185 memset(cfg->hp_pins, 0, sizeof(cfg->hp_pins)); 2129 2186 } 2130 2187 } -
GPL/trunk/alsa-kernel/pci/hda/hda_generic.c
r76 r86 47 47 48 48 /* patch-specific record */ 49 50 #define MAX_PCM_VOLS 2 51 struct pcm_vol { 52 struct hda_gnode *node; /* Node for PCM volume */ 53 unsigned int index; /* connection of PCM volume */ 54 }; 55 49 56 struct hda_gspec { 50 struct hda_gnode *dac_node[2];/* DAC node */51 struct hda_gnode *out_pin_node[2];/* Output pin (Line-Out) node */52 struct hda_gnode *pcm_vol_node[2]; /* Node for PCM volume*/53 unsigned int pcm_vol_index[2]; /* connection of PCM volume*/57 struct hda_gnode *dac_node[2]; /* DAC node */ 58 struct hda_gnode *out_pin_node[2]; /* Output pin (Line-Out) node */ 59 struct pcm_vol pcm_vol[MAX_PCM_VOLS]; /* PCM volumes */ 60 unsigned int pcm_vol_nodes; /* number of PCM volumes */ 54 61 55 62 struct hda_gnode *adc_node; /* ADC node */ … … 71 78 */ 72 79 #define defcfg_type(node) (((node)->def_cfg & AC_DEFCFG_DEVICE) >> \ 73 80 AC_DEFCFG_DEVICE_SHIFT) 74 81 #define defcfg_location(node) (((node)->def_cfg & AC_DEFCFG_LOCATION) >> \ 75 AC_DEFCFG_LOCATION_SHIFT)82 AC_DEFCFG_LOCATION_SHIFT) 76 83 #define defcfg_port_conn(node) (((node)->def_cfg & AC_DEFCFG_PORT_CONN) >> \ 77 AC_DEFCFG_PORT_CONN_SHIFT) 84 AC_DEFCFG_PORT_CONN_SHIFT) 85 78 86 /* 79 87 * destructor … … 265 273 */ 266 274 static int parse_output_path(struct hda_codec *codec, struct hda_gspec *spec, 267 275 struct hda_gnode *node, int dac_idx) 268 276 { 269 277 int i, err; … … 279 287 return 0; 280 288 } 281 snd_printdd("AUD_OUT found %x\n", node->nid); 282 if (spec->dac_node[dac_idx]) { 283 /* already DAC node is assigned, just unmute & connect */ 284 return node == spec->dac_node[dac_idx]; 285 } 286 spec->dac_node[dac_idx] = node; 287 if (node->wid_caps & AC_WCAP_OUT_AMP) { 288 spec->pcm_vol_node[dac_idx] = node; 289 spec->pcm_vol_index[dac_idx] = 0; 289 snd_printdd("AUD_OUT found %x\n", node->nid); 290 if (spec->dac_node[dac_idx]) { 291 /* already DAC node is assigned, just unmute & connect */ 292 return node == spec->dac_node[dac_idx]; 293 } 294 spec->dac_node[dac_idx] = node; 295 if ((node->wid_caps & AC_WCAP_OUT_AMP) && 296 spec->pcm_vol_nodes < MAX_PCM_VOLS) { 297 spec->pcm_vol[spec->pcm_vol_nodes].node = node; 298 spec->pcm_vol[spec->pcm_vol_nodes].index = 0; 299 spec->pcm_vol_nodes++; 290 300 } 291 301 return 1; /* found */ … … 295 305 child = hda_get_node(spec, node->conn_list[i]); 296 306 if (! child) 297 298 307 continue; 308 err = parse_output_path(codec, spec, child, dac_idx); 299 309 if (err < 0) 300 310 return err; … … 306 316 select_input_connection(codec, node, i); 307 317 unmute_input(codec, node, i); 308 unmute_output(codec, node); 309 if (! spec->pcm_vol_node[dac_idx]) { 310 if (node->wid_caps & AC_WCAP_IN_AMP) { 311 spec->pcm_vol_node[dac_idx] = node; 312 spec->pcm_vol_index[dac_idx] = i; 313 } else if (node->wid_caps & AC_WCAP_OUT_AMP) { 314 spec->pcm_vol_node[dac_idx] = node; 315 spec->pcm_vol_index[dac_idx] = 0; 316 } 318 unmute_output(codec, node); 319 if (spec->dac_node[dac_idx] && 320 spec->pcm_vol_nodes < MAX_PCM_VOLS && 321 !(spec->dac_node[dac_idx]->wid_caps & 322 AC_WCAP_OUT_AMP)) { 323 if ((node->wid_caps & AC_WCAP_IN_AMP) || 324 (node->wid_caps & AC_WCAP_OUT_AMP)) { 325 int n = spec->pcm_vol_nodes; 326 spec->pcm_vol[n].node = node; 327 spec->pcm_vol[n].index = i; 328 spec->pcm_vol_nodes++; 329 } 317 330 } 318 331 return 1; … … 342 355 /* output capable? */ 343 356 if (! (node->pin_caps & AC_PINCAP_OUT)) 344 345 346 357 continue; 358 if (defcfg_port_conn(node) == AC_JACK_PORT_NONE) 359 continue; /* unconnected */ 347 360 if (jack_type >= 0) { 348 361 if (jack_type != defcfg_type(node)) … … 355 368 continue; 356 369 } 357 358 370 clear_check_flags(spec); 371 err = parse_output_path(codec, spec, node, 0); 359 372 if (err < 0) 360 361 362 363 364 365 366 373 return NULL; 374 if (! err && spec->out_pin_node[0]) { 375 err = parse_output_path(codec, spec, node, 1); 376 if (err < 0) 377 return NULL; 378 } 379 if (err > 0) { 367 380 /* unmute the PIN output */ 368 381 unmute_output(codec, node); … … 370 383 snd_hda_codec_write(codec, node->nid, 0, 371 384 AC_VERB_SET_PIN_WIDGET_CONTROL, 372 AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); 385 AC_PINCTL_OUT_EN | 386 ((node->pin_caps & AC_PINCAP_HP_DRV) ? 387 AC_PINCTL_HP_EN : 0)); 373 388 return node; 374 389 } … … 391 406 /* first, look for the line-out pin */ 392 407 node = parse_output_jack(codec, spec, AC_JACK_LINE_OUT); 393 394 395 396 397 398 399 400 408 if (node) /* found, remember the PIN node */ 409 spec->out_pin_node[0] = node; 410 else { 411 /* if no line-out is found, try speaker out */ 412 node = parse_output_jack(codec, spec, AC_JACK_SPEAKER); 413 if (node) 414 spec->out_pin_node[0] = node; 415 } 401 416 /* look for the HP-out pin */ 402 417 node = parse_output_jack(codec, spec, AC_JACK_HP_OUT); 403 404 405 406 407 408 } 409 410 418 if (node) { 419 if (! spec->out_pin_node[0]) 420 spec->out_pin_node[0] = node; 421 else 422 spec->out_pin_node[1] = node; 423 } 424 425 if (! spec->out_pin_node[0]) { 411 426 /* no line-out or HP pins found, 412 427 * then choose for the first output pin 413 414 415 416 428 */ 429 spec->out_pin_node[0] = parse_output_jack(codec, spec, -1); 430 if (! spec->out_pin_node[0]) 431 snd_printd("hda_generic: no proper output path found\n"); 417 432 } 418 433 … … 461 476 return "Line"; 462 477 case AC_JACK_CD: 478 #if 0 463 479 if (pinctl) 464 480 *pinctl |= AC_PINCTL_VREF_GRD; 481 #endif 465 482 return "CD"; 466 483 case AC_JACK_AUX: … … 469 486 return "Aux"; 470 487 case AC_JACK_MIC_IN: 471 if ((location & 0x0f) == AC_JACK_LOC_FRONT) 472 return "Front Mic"; 473 return "Mic"; 488 if (pinctl && 489 (node->pin_caps & 490 (AC_PINCAP_VREF_80 << AC_PINCAP_VREF_SHIFT))) 491 *pinctl |= AC_PINCTL_VREF_80; 492 if ((location & 0x0f) == AC_JACK_LOC_FRONT) 493 return "Front Mic"; 494 return "Mic"; 474 495 case AC_JACK_SPDIF_IN: 475 496 return "SPDIF"; … … 524 545 return 0; 525 546 526 527 528 529 547 if (defcfg_port_conn(node) == AC_JACK_PORT_NONE) 548 return 0; /* unconnected */ 549 550 if (node->wid_caps & AC_WCAP_DIGITAL) 530 551 return 0; /* skip SPDIF */ 531 552 … … 556 577 } 557 578 579 /* add a capture source element */ 580 static void add_cap_src(struct hda_gspec *spec, int idx) 581 { 582 struct hda_input_mux_item *csrc; 583 char *buf; 584 int num, ocap; 585 586 num = spec->input_mux.num_items; 587 csrc = &spec->input_mux.items[num]; 588 buf = spec->cap_labels[num]; 589 for (ocap = 0; ocap < num; ocap++) { 590 if (! strcmp(buf, spec->cap_labels[ocap])) { 591 /* same label already exists, 592 * put the index number to be unique 593 */ 594 sprintf(buf, "%s %d", spec->cap_labels[ocap], num); 595 break; 596 } 597 } 598 csrc->index = idx; 599 spec->input_mux.num_items++; 600 } 601 558 602 /* 559 603 * parse input … … 570 614 // awk added - fixed no recording due to muted widget 571 615 unmute_input(codec, adc_node, 0); 572 616 573 617 /* 574 618 * check each connection of the ADC … … 576 620 * input path. 577 621 */ 622 /* first, check the direct connections to PIN widgets */ 578 623 for (i = 0; i < adc_node->nconns; i++) { 579 624 node = hda_get_node(spec, adc_node->conn_list[i]); 580 if (! node) 581 continue; 582 err = parse_adc_sub_nodes(codec, spec, node); 583 if (err < 0) 584 return err; 585 else if (err > 0) { 586 struct hda_input_mux_item *csrc = &spec->input_mux.items[spec->input_mux.num_items]; 587 char *buf = spec->cap_labels[spec->input_mux.num_items]; 588 int ocap; 589 for (ocap = 0; ocap < spec->input_mux.num_items; ocap++) { 590 if (! strcmp(buf, spec->cap_labels[ocap])) { 591 /* same label already exists, 592 * put the index number to be unique 593 */ 594 sprintf(buf, "%s %d", spec->cap_labels[ocap], 595 spec->input_mux.num_items); 596 } 597 } 598 csrc->index = i; 599 spec->input_mux.num_items++; 625 if (node && node->type == AC_WID_PIN) { 626 err = parse_adc_sub_nodes(codec, spec, node); 627 if (err < 0) 628 return err; 629 else if (err > 0) 630 add_cap_src(spec, i); 631 } 632 } 633 /* ... then check the rests, more complicated connections */ 634 for (i = 0; i < adc_node->nconns; i++) { 635 node = hda_get_node(spec, adc_node->conn_list[i]); 636 if (node && node->type != AC_WID_PIN) { 637 err = parse_adc_sub_nodes(codec, spec, node); 638 if (err < 0) 639 return err; 640 else if (err > 0) 641 add_cap_src(spec, i); 600 642 } 601 643 } … … 644 686 } 645 687 688 646 689 /* 647 690 * create mixer controls if possible 648 691 */ 649 #define DIR_OUT 0x1650 #define DIR_IN 0x2651 652 692 static int create_mixer(struct hda_codec *codec, struct hda_gnode *node, 653 693 unsigned int index, const char *type, const char *dir_sfx) … … 656 696 int err; 657 697 int created = 0; 658 struct snd_kcontrol_new knew = {0};698 struct snd_kcontrol_new knew; 659 699 660 700 if (type) … … 663 703 sprintf(name, "%s Switch", dir_sfx); 664 704 if ((node->wid_caps & AC_WCAP_IN_AMP) && 665 (node->amp_in_caps & AC_AMPCAP_MUTE)) { 705 (node->amp_in_caps & AC_AMPCAP_MUTE)) { 706 /*knew = (struct snd_kcontrol_new)HDA_CODEC_MUTE(name, node->nid, index, HDA_INPUT);*/ 666 707 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 667 708 knew.name = name; … … 671 712 knew.private_value = (node->nid | (3 << 16) | (HDA_INPUT << 18) | (index << 19)); 672 713 673 //knew = (struct snd_kcontrol_new)HDA_CODEC_MUTE(name, node->nid, index, HDA_INPUT);674 714 snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index); 675 715 if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0) … … 677 717 created = 1; 678 718 } else if ((node->wid_caps & AC_WCAP_OUT_AMP) && 679 (node->amp_out_caps & AC_AMPCAP_MUTE)) { 719 (node->amp_out_caps & AC_AMPCAP_MUTE)) { 720 /*knew = (struct snd_kcontrol_new)HDA_CODEC_MUTE(name, node->nid, 0, HDA_OUTPUT);*/ 680 721 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 681 722 knew.name = name; … … 685 726 knew.private_value = (node->nid | (3 << 16) | (HDA_OUTPUT << 18) | (0 << 19)); 686 727 687 //knew = (struct snd_kcontrol_new)HDA_CODEC_MUTE(name, node->nid, 0, HDA_OUTPUT);688 728 snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid); 689 729 if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0) … … 697 737 sprintf(name, "%s Volume", dir_sfx); 698 738 if ((node->wid_caps & AC_WCAP_IN_AMP) && 699 (node->amp_in_caps & AC_AMPCAP_NUM_STEPS)) { 739 (node->amp_in_caps & AC_AMPCAP_NUM_STEPS)) { 740 /*knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, index, HDA_INPUT);*/ 700 741 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 701 742 knew.name = name; … … 705 746 knew.private_value = (node->nid | (3 << 16) | (HDA_INPUT << 18) | (index << 19)); 706 747 707 //knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, index, HDA_INPUT);708 748 snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index); 709 749 if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0) … … 712 752 } else if ((node->wid_caps & AC_WCAP_OUT_AMP) && 713 753 (node->amp_out_caps & AC_AMPCAP_NUM_STEPS)) { 714 //knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, 0, HDA_OUTPUT); 754 /*knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, 0, HDA_OUTPUT);*/ 715 755 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 716 756 knew.name = name; … … 719 759 knew.put = snd_hda_mixer_amp_volume_put; 720 760 knew.private_value = (node->nid | (3 << 16) | (HDA_OUTPUT << 18) | (0 << 19)); 721 722 761 snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid); 723 762 if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0) … … 750 789 * build output mixer controls 751 790 */ 791 static int create_output_mixers(struct hda_codec *codec, const char **names) 792 { 793 struct hda_gspec *spec = codec->spec; 794 int i, err; 795 796 for (i = 0; i < spec->pcm_vol_nodes; i++) { 797 err = create_mixer(codec, spec->pcm_vol[i].node, 798 spec->pcm_vol[i].index, 799 names[i], "Playback"); 800 if (err < 0) 801 return err; 802 } 803 return 0; 804 } 805 752 806 static int build_output_controls(struct hda_codec *codec) 753 807 { 754 808 struct hda_gspec *spec = codec->spec; 755 static const char *types[2] = { "Master", "Headphone" }; 756 int i, err; 757 758 for (i = 0; i < 2 && spec->pcm_vol_node[i]; i++) { 759 err = create_mixer(codec, spec->pcm_vol_node[i], 760 spec->pcm_vol_index[i], 761 types[i], "Playback"); 762 if (err < 0) 763 return err; 764 } 809 static const char *types_speaker[] = { "Speaker", "Headphone" }; 810 static const char *types_line[] = { "Front", "Headphone" }; 811 812 switch (spec->pcm_vol_nodes) { 813 case 1: 814 return create_mixer(codec, spec->pcm_vol[0].node, 815 spec->pcm_vol[0].index, 816 "Master", "Playback"); 817 case 2: 818 if (defcfg_type(spec->out_pin_node[0]) == AC_JACK_SPEAKER) 819 return create_output_mixers(codec, types_speaker); 820 else 821 return create_output_mixers(codec, types_line); 822 } 765 823 return 0; 766 824 } … … 771 829 struct hda_gspec *spec = codec->spec; 772 830 struct hda_gnode *adc_node = spec->adc_node; 773 int err; 774 775 if (! adc_node) 831 int i, err; 832 static struct snd_kcontrol_new cap_sel = { 833 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 834 .name = "Capture Source", 835 .info = capture_source_info, 836 .get = capture_source_get, 837 .put = capture_source_put, 838 }; 839 840 if (! adc_node || ! spec->input_mux.num_items) 776 841 return 0; /* not found */ 777 842 843 spec->cur_cap_src = 0; 844 select_input_connection(codec, adc_node, 845 spec->input_mux.items[0].index); 846 778 847 /* create capture volume and switch controls if the ADC has an amp */ 779 err = create_mixer(codec, adc_node, 0, NULL, "Capture"); 848 /* do we have only a single item? */ 849 if (spec->input_mux.num_items == 1) { 850 err = create_mixer(codec, adc_node, 851 spec->input_mux.items[0].index, 852 NULL, "Capture"); 853 if (err < 0) 854 return err; 855 return 0; 856 } 780 857 781 858 /* create input MUX if multiple sources are available */ 782 if (spec->input_mux.num_items > 1) { 783 static struct snd_kcontrol_new cap_sel = { 784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 785 .name = "Capture Source", 786 .info = capture_source_info, 787 .get = capture_source_get, 788 .put = capture_source_put, 789 }; 790 if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&cap_sel, codec))) < 0) 859 if ((err = snd_ctl_add(codec->bus->card, 860 snd_ctl_new1(&cap_sel, codec))) < 0) 861 return err; 862 863 /* no volume control? */ 864 if (! (adc_node->wid_caps & AC_WCAP_IN_AMP) || 865 ! (adc_node->amp_in_caps & AC_AMPCAP_NUM_STEPS)) 866 return 0; 867 868 for (i = 0; i < spec->input_mux.num_items; i++) { 869 struct snd_kcontrol_new knew; 870 char name[32]; 871 sprintf(name, "%s Capture Volume", 872 spec->input_mux.items[i].label); 873 /*knew = (struct snd_kcontrol_new) 874 HDA_CODEC_VOLUME(name, adc_node->nid, 875 spec->input_mux.items[i].index, 876 HDA_INPUT);*/ 877 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 878 knew.name = name; 879 knew.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 880 SNDRV_CTL_ELEM_ACCESS_TLV_READ | 881 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; 882 knew.info = snd_hda_mixer_amp_volume_info; 883 knew.get = snd_hda_mixer_amp_volume_get; 884 knew.put = snd_hda_mixer_amp_volume_put; 885 knew.tlv.c = snd_hda_mixer_amp_tlv, 886 knew.private_value = (adc_node->nid | (3 << 16) | (HDA_INPUT << 18) | (spec->input_mux.items[i].index << 19)); 887 888 if ((err = snd_ctl_add(codec->bus->card, 889 snd_ctl_new1(&knew, codec))) < 0) 791 890 return err; 792 spec->cur_cap_src = 0; 793 select_input_connection(codec, adc_node, spec->input_mux.items[0].index); 794 } 891 } 892 795 893 return 0; 796 894 } … … 859 957 const char *type; 860 958 861 959 if (! spec->out_pin_node[0]) 862 960 return 0; 863 961 … … 873 971 if (check_existing_control(codec, type, "Playback")) 874 972 continue; 875 876 877 973 clear_check_flags(spec); 974 err = parse_loopback_path(codec, spec, 975 spec->out_pin_node[0], 878 976 node, type); 879 977 if (err < 0) … … 911 1009 912 1010 static int generic_pcm2_prepare(struct hda_pcm_stream *hinfo, 913 914 915 916 917 { 918 919 920 921 922 923 1011 struct hda_codec *codec, 1012 unsigned int stream_tag, 1013 unsigned int format, 1014 struct snd_pcm_substream *substream) 1015 { 1016 struct hda_gspec *spec = codec->spec; 1017 1018 snd_hda_codec_setup_stream(codec, hinfo->nid, stream_tag, 0, format); 1019 snd_hda_codec_setup_stream(codec, spec->dac_node[1]->nid, 1020 stream_tag, 0, format); 1021 return 0; 924 1022 } 925 1023 926 1024 static int generic_pcm2_cleanup(struct hda_pcm_stream *hinfo, 927 928 929 { 930 931 932 933 934 1025 struct hda_codec *codec, 1026 struct snd_pcm_substream *substream) 1027 { 1028 struct hda_gspec *spec = codec->spec; 1029 1030 snd_hda_codec_setup_stream(codec, hinfo->nid, 0, 0, 0); 1031 snd_hda_codec_setup_stream(codec, spec->dac_node[1]->nid, 0, 0, 0); 1032 return 0; 935 1033 } 936 1034 … … 940 1038 struct hda_pcm *info = &spec->pcm_rec; 941 1039 942 1040 if (! spec->dac_node[0] && ! spec->adc_node) { 943 1041 snd_printd("hda_generic: no PCM found\n"); 944 1042 return 0; … … 948 1046 codec->pcm_info = info; 949 1047 950 951 952 953 954 955 956 957 1048 info->name = "HDA Generic"; 1049 if (spec->dac_node[0]) { 1050 info->stream[0] = generic_pcm_playback; 1051 info->stream[0].nid = spec->dac_node[0]->nid; 1052 if (spec->dac_node[1]) { 1053 info->stream[0].ops.prepare = generic_pcm2_prepare; 1054 info->stream[0].ops.cleanup = generic_pcm2_cleanup; 1055 } 958 1056 } 959 1057 if (spec->adc_node) { -
GPL/trunk/alsa-kernel/pci/hda/hda_intel.c
r84 r86 31 31 * 32 32 * 2004.12.01 Major rewrite by tiwai, merged the work of pshou 33 * 33 * 34 34 */ 35 35 … … 44 44 #include <linux/slab.h> 45 45 #include <linux/pci.h> 46 #include <linux/mutex.h> 46 47 #include <sound/core.h> 47 48 #include <sound/initval.h> … … 55 56 static int probe_mask = -1; 56 57 static int single_cmd; 58 static int enable_msi; 57 59 58 60 //module_param(index, int, 0444); … … 68 70 //module_param(single_cmd, bool, 0444); 69 71 MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs (for debugging only)."); 72 //module_param(enable_msi, int, 0); 73 MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)"); 70 74 71 75 … … 80 84 "{Intel, ESB2}," 81 85 "{Intel, ICH8}," 82 "{ATI, SB450}," 83 "{ATI, RS600}," 86 "{Intel, ICH9}," 87 "{ATI, SB450}," 88 "{ATI, SB600}," 89 "{ATI, RS600}," 90 "{ATI, RS690}," 84 91 "{VIA, VT8251}," 85 92 "{VIA, VT8237A}," … … 105 112 #define ICH6_REG_INTSTS 0x24 106 113 #define ICH6_REG_WALCLK 0x30 107 #define ICH6_REG_SYNC 0x34 114 #define ICH6_REG_SYNC 0x34 108 115 #define ICH6_REG_CORBLBASE 0x40 109 116 #define ICH6_REG_CORBUBASE 0x44 … … 251 258 u32 *bdl; /* virtual address of the BDL */ 252 259 dma_addr_t bdl_addr; /* physical address of the BDL */ 253 volatileu32 *posbuf; /* position buffer pointer */260 u32 *posbuf; /* position buffer pointer */ 254 261 255 262 unsigned int bufsize; /* size of the play buffer in bytes */ … … 266 273 unsigned int format_val; /* format value to be set in the controller and the codec */ 267 274 unsigned char stream_tag; /* assigned stream */ 268 269 270 271 272 unsigned int opened :1;273 unsigned int running :1;275 unsigned char index; /* stream index */ 276 /* for sanity check of position buffer */ 277 unsigned int period_intr; 278 279 unsigned int opened :1; 280 unsigned int running :1; 274 281 }; 275 282 … … 305 312 /* locks */ 306 313 spinlock_t reg_lock; 307 struct semaphoreopen_mutex;314 struct mutex open_mutex; 308 315 309 316 /* streams (x num_streams) */ … … 329 336 /* flags */ 330 337 int position_fix; 331 unsigned int initialized: 1; 332 unsigned int single_cmd: 1; 338 unsigned int initialized :1; 339 unsigned int single_cmd :1; 340 unsigned int polling_mode :1; 341 unsigned int msi :1; 333 342 }; 334 343 … … 336 345 enum { 337 346 AZX_DRIVER_ICH, 338 339 347 AZX_DRIVER_ATI, 348 AZX_DRIVER_ATIHDMI, 340 349 AZX_DRIVER_VIA, 341 350 AZX_DRIVER_SIS, … … 346 355 static char *driver_short_names[] __devinitdata = { 347 356 [AZX_DRIVER_ICH] = "HDA Intel", 348 349 357 [AZX_DRIVER_ATI] = "HDA ATI SB", 358 [AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI", 350 359 [AZX_DRIVER_VIA] = "HDA VIA VT82xx", 351 360 [AZX_DRIVER_SIS] = "HDA SIS966", … … 391 400 #define upper_32bit(addr) (sizeof(addr) > 4 ? (u32)((addr) >> 32) : (u32)0) 392 401 402 static int azx_acquire_irq(struct azx *chip, int do_disconnect); 393 403 394 404 /* … … 456 466 /* send a command */ 457 467 static int azx_corb_send_cmd(struct hda_codec *codec, hda_nid_t nid, int direct, 458 unsigned int verb, unsigned int para)468 unsigned int verb, unsigned int para) 459 469 { 460 470 struct azx *chip = codec->bus->private_data; … … 494 504 return; 495 505 chip->rirb.wp = wp; 496 506 497 507 while (chip->rirb.rp != wp) { 498 508 chip->rirb.rp++; … … 515 525 { 516 526 struct azx *chip = codec->bus->private_data; 517 int timeout = 50; 518 519 while (chip->rirb.cmds) { 520 if (! --timeout) { 521 snd_printk(KERN_ERR 522 "hda_intel: azx_get_response timeout, " 523 "switching to single_cmd mode...\n"); 524 chip->rirb.rp = azx_readb(chip, RIRBWP); 525 chip->rirb.cmds = 0; 526 /* switch to single_cmd mode */ 527 chip->single_cmd = 1; 528 azx_free_cmd_io(chip); 529 return -1; 530 } 531 msleep(1); 532 } 533 return chip->rirb.res; /* the last value */ 527 unsigned long timeout; 528 529 again: 530 timeout = jiffies + msecs_to_jiffies(1000); 531 do { 532 if (chip->polling_mode) { 533 spin_lock_irq(&chip->reg_lock); 534 azx_update_rirb(chip); 535 spin_unlock_irq(&chip->reg_lock); 536 } 537 if (! chip->rirb.cmds) 538 return chip->rirb.res; /* the last value */ 539 schedule_timeout_interruptible(1); 540 } while (time_after_eq(timeout, jiffies)); 541 542 if (chip->msi) { 543 snd_printk(KERN_WARNING "hda_intel: No response from codec, " 544 "disabling MSI...\n"); 545 free_irq(chip->irq, chip); 546 chip->irq = -1; 547 pci_disable_msi(chip->pci); 548 chip->msi = 0; 549 if (azx_acquire_irq(chip, 1) < 0) 550 return -1; 551 goto again; 552 } 553 554 if (!chip->polling_mode) { 555 snd_printk(KERN_WARNING "hda_intel: azx_get_response timeout, " 556 "switching to polling mode...\n"); 557 chip->polling_mode = 1; 558 goto again; 559 } 560 561 snd_printk(KERN_ERR "hda_intel: azx_get_response timeout, " 562 "switching to single_cmd mode...\n"); 563 chip->rirb.rp = azx_readb(chip, RIRBWP); 564 chip->rirb.cmds = 0; 565 /* switch to single_cmd mode */ 566 chip->single_cmd = 1; 567 azx_free_cmd_io(chip); 568 return -1; 534 569 } 535 570 … … 599 634 /* send a command */ 600 635 static int azx_send_cmd(struct hda_codec *codec, hda_nid_t nid, 601 602 603 { 604 605 606 607 608 636 int direct, unsigned int verb, 637 unsigned int para) 638 { 639 struct azx *chip = codec->bus->private_data; 640 if (chip->single_cmd) 641 return azx_single_send_cmd(codec, nid, direct, verb, para); 642 else 643 return azx_corb_send_cmd(codec, nid, direct, verb, para); 609 644 } 610 645 … … 612 647 static unsigned int azx_get_response(struct hda_codec *codec) 613 648 { 614 615 616 617 618 649 struct azx *chip = codec->bus->private_data; 650 if (chip->single_cmd) 651 return azx_single_get_response(codec); 652 else 653 return azx_rirb_get_response(codec); 619 654 } 620 655 … … 641 676 642 677 count = 50; 643 while (! 678 while (!azx_readb(chip, GCTL) && --count) 644 679 msleep(1); 645 680 646 /* Brent Chartrand said to wait >= 540us for codecs to in tialize */681 /* Brent Chartrand said to wait >= 540us for codecs to initialize */ 647 682 msleep(1); 648 683 649 684 /* check to see if controller is ready */ 650 if (! 685 if (!azx_readb(chip, GCTL)) { 651 686 snd_printd("azx_reset: controller not ready!\n"); 652 687 return -EBUSY; … … 657 692 658 693 /* detect codecs */ 659 if (! 694 if (!chip->codec_mask) { 660 695 chip->codec_mask = azx_readw(chip, STATESTS); 661 696 snd_printdd("codec_mask = 0x%x\n", chip->codec_mask); … … 668 703 /* 669 704 * Lowlevel interface 670 */ 705 */ 671 706 672 707 /* enable interrupts */ … … 765 800 766 801 /* initialize the codec command I/O */ 767 if (! 802 if (!chip->single_cmd) 768 803 azx_init_cmd_io(chip); 769 804 … … 775 810 case AZX_DRIVER_ATI: 776 811 /* For ATI SB450 azalia HD audio, we need to enable snoop */ 777 pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 812 pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 778 813 ®); 779 pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 814 pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 780 815 (reg & 0xf8) | ATI_SB450_HDAUDIO_ENABLE_SNOOP); 781 816 break; … … 793 828 * interrupt handler 794 829 */ 795 static irqreturn_t azx_interrupt(int irq, void *dev_id, struct pt_regs *regs)830 static irqreturn_t azx_interrupt(int irq, void *dev_id, struct pt_regs *regs) 796 831 { 797 832 struct azx *chip = dev_id; … … 807 842 return IRQ_NONE; 808 843 } 809 844 810 845 for (i = 0; i < chip->num_streams; i++) { 811 846 azx_dev = &chip->azx_dev[i]; 812 847 if (status & azx_dev->sd_int_sta_mask) { 813 848 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); 814 815 849 if (azx_dev->substream && azx_dev->running) { 850 azx_dev->period_intr++; 816 851 spin_unlock(&chip->reg_lock); 817 852 snd_pcm_period_elapsed(azx_dev->substream); … … 835 870 #endif 836 871 spin_unlock(&chip->reg_lock); 837 872 838 873 return IRQ_HANDLED; 839 874 } … … 940 975 bus_temp.private_data = chip; 941 976 bus_temp.modelname = model; 942 943 944 977 bus_temp.pci = chip->pci; 978 bus_temp.ops.command = azx_send_cmd; 979 bus_temp.ops.get_response = azx_get_response; 945 980 946 981 if ((err = snd_hda_bus_new(chip->card, &bus_temp, &chip->bus)) < 0) … … 998 1033 SNDRV_PCM_INFO_BLOCK_TRANSFER | 999 1034 SNDRV_PCM_INFO_MMAP_VALID | 1000 SNDRV_PCM_INFO_PAUSE /*|*/ 1001 /*SNDRV_PCM_INFO_RESUME*/), 1035 /* No full-resume yet implemented */ 1036 /* SNDRV_PCM_INFO_RESUME |*/ 1037 SNDRV_PCM_INFO_PAUSE), 1002 1038 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1003 1039 .rates = SNDRV_PCM_RATE_48000, … … 1030 1066 int err; 1031 1067 1032 down(&chip->open_mutex);1068 mutex_lock(&chip->open_mutex); 1033 1069 azx_dev = azx_assign_device(chip, substream->stream); 1034 1070 if (azx_dev == NULL) { 1035 up(&chip->open_mutex);1071 mutex_unlock(&chip->open_mutex); 1036 1072 return -EBUSY; 1037 1073 } … … 1040 1076 runtime->hw.channels_max = hinfo->channels_max; 1041 1077 runtime->hw.formats = hinfo->formats; 1042 runtime->hw.rates = hinfo->rates; 1043 printk("azx hw rates: %x. ratemin: %i, ratemax: %i\n", 1044 runtime->hw.rates, runtime->hw.rate_min, runtime->hw.rate_max); 1078 runtime->hw.rates = hinfo->rates; 1045 1079 snd_pcm_limit_hw_rates(runtime); 1046 1080 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); 1047 1081 if ((err = hinfo->ops.open(hinfo, apcm->codec, substream)) < 0) { 1048 1082 azx_release_device(azx_dev); 1049 up(&chip->open_mutex);1083 mutex_unlock(&chip->open_mutex); 1050 1084 return err; 1051 1085 } … … 1056 1090 1057 1091 runtime->private_data = azx_dev; 1058 up(&chip->open_mutex);1092 mutex_unlock(&chip->open_mutex); 1059 1093 return 0; 1060 1094 } … … 1068 1102 unsigned long flags; 1069 1103 1070 down(&chip->open_mutex);1104 mutex_lock(&chip->open_mutex); 1071 1105 spin_lock_irqsave(&chip->reg_lock, flags); 1072 1106 azx_dev->substream = NULL; … … 1075 1109 azx_release_device(azx_dev); 1076 1110 hinfo->ops.close(hinfo, apcm->codec, substream); 1077 up(&chip->open_mutex);1111 mutex_unlock(&chip->open_mutex); 1078 1112 return 0; 1079 1113 } … … 1176 1210 unsigned int pos; 1177 1211 1178 1179 1212 if (chip->position_fix == POS_FIX_POSBUF || 1213 chip->position_fix == POS_FIX_AUTO) { 1180 1214 /* use the position buffer */ 1181 pos = *azx_dev->posbuf;1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1215 pos = le32_to_cpu(*azx_dev->posbuf); 1216 if (chip->position_fix == POS_FIX_AUTO && 1217 azx_dev->period_intr == 1 && ! pos) { 1218 printk(KERN_WARNING 1219 "hda-intel: Invalid position buffer, " 1220 "using LPIB read method instead.\n"); 1221 chip->position_fix = POS_FIX_NONE; 1222 goto read_lpib; 1223 } 1224 } else { 1225 read_lpib: 1192 1226 /* read LPIB */ 1193 1227 pos = azx_sd_readl(azx_dev, SD_LPIB); … … 1223 1257 struct azx_pcm *apcm; 1224 1258 1225 snd_assert(cpcm->stream[0].substreams || cpcm->stream[1].substreams, return -EINVAL); 1259 /* if no substreams are defined for both playback and capture, 1260 * it's just a placeholder. ignore it. 1261 */ 1262 if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams) 1263 return 0; 1264 1226 1265 snd_assert(cpcm->name, return -EINVAL); 1227 1266 … … 1247 1286 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1248 1287 snd_dma_pci_data(chip->pci), 1249 1024 * 64, 1024 * 1 28);1288 1024 * 64, 1024 * 1024); 1250 1289 chip->pcm[pcm_dev] = pcm; 1251 chip->pcm_devs = pcm_dev + 1; 1290 if (chip->pcm_devs < pcm_dev + 1) 1291 chip->pcm_devs = pcm_dev + 1; 1252 1292 1253 1293 return 0; … … 1327 1367 azx_dev->bdl = (u32 *)(chip->bdl.area + off); 1328 1368 azx_dev->bdl_addr = chip->bdl.addr + off; 1329 azx_dev->posbuf = ( volatile u32*)(chip->posbuf.area + i * 8);1369 azx_dev->posbuf = (u32 __iomem *)(chip->posbuf.area + i * 8); 1330 1370 /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ 1331 1371 azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); … … 1340 1380 } 1341 1381 1382 static int azx_acquire_irq(struct azx *chip, int do_disconnect) 1383 { 1384 if (request_irq(chip->pci->irq, azx_interrupt, 1385 chip->msi ? 0 : SA_INTERRUPT|SA_SHIRQ, 1386 "HDA Intel", chip)) { 1387 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " 1388 "disabling device\n", chip->pci->irq); 1389 /* if (do_disconnect) 1390 snd_card_disconnect(chip->card);*/ 1391 return -1; 1392 } 1393 chip->irq = chip->pci->irq; 1394 pci_intx(chip->pci, !chip->msi); 1395 return 0; 1396 } 1397 1342 1398 1343 1399 #ifdef CONFIG_PM … … 1354 1410 for (i = 0; i < chip->pcm_devs; i++) 1355 1411 snd_pcm_suspend_all(chip->pcm[i]); 1356 snd_hda_suspend(chip->bus, state); 1357 azx_free_cmd_io(chip); 1412 snd_hda_suspend(chip->bus, state); 1413 azx_free_cmd_io(chip); 1414 if (chip->irq >= 0) { 1415 synchronize_irq(chip->irq); 1416 free_irq(chip->irq, chip); 1417 chip->irq = -1; 1418 } 1419 if (chip->msi) 1420 pci_disable_msi(chip->pci); 1358 1421 pci_disable_device(pci); 1359 1422 pci_save_state(pci); 1423 pci_set_power_state(pci, pci_choose_state(pci, state)); 1360 1424 return 0; 1361 1425 } … … 1366 1430 struct azx *chip = card->private_data; 1367 1431 1432 pci_set_power_state(pci, PCI_D0); 1368 1433 pci_restore_state(pci); 1369 pci_enable_device(pci); 1434 if (pci_enable_device(pci) < 0) { 1435 printk(KERN_ERR "hda-intel: pci_enable_device failed, " 1436 "disabling device\n"); 1437 snd_card_disconnect(card); 1438 return -EIO; 1439 } 1370 1440 pci_set_master(pci); 1441 if (chip->msi) 1442 if (pci_enable_msi(pci) < 0) 1443 chip->msi = 0; 1444 if (azx_acquire_irq(chip, 1) < 0) 1445 return -EIO; 1371 1446 azx_init_chip(chip); 1372 1447 snd_hda_resume(chip->bus); … … 1392 1467 azx_int_clear(chip); 1393 1468 1394 1395 1469 /* disable CORB/RIRB */ 1470 azx_free_cmd_io(chip); 1396 1471 1397 1472 /* disable position buffer */ 1398 1473 azx_writel(chip, DPLBASE, 0); 1399 1474 azx_writel(chip, DPUBASE, 0); 1400 1401 /* wait a little for interrupts to finish */ 1402 msleep(1); 1403 } 1404 1405 if (chip->irq >= 0) 1475 } 1476 1477 if (chip->irq >= 0) { 1478 synchronize_irq(chip->irq); 1406 1479 free_irq(chip->irq, (void*)chip); 1480 } 1481 if (chip->msi) 1482 pci_disable_msi(chip->pci); 1407 1483 if (chip->remap_addr) 1408 1484 iounmap(chip->remap_addr); … … 1435 1511 { 1436 1512 struct azx *chip; 1437 int err = 0;1513 int err; 1438 1514 static struct snd_device_ops ops = { 1439 1515 .dev_free = azx_dev_free, … … 1441 1517 1442 1518 *rchip = NULL; 1443 1444 if ((err = pci_enable_device(pci)) < 0) 1519 1520 err = pci_enable_device(pci); 1521 if (err < 0) 1445 1522 return err; 1446 1523 1447 1524 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 1448 1449 if (NULL == chip) { 1525 if (!chip) { 1450 1526 snd_printk(KERN_ERR SFX "cannot allocate chip\n"); 1451 1527 pci_disable_device(pci); … … 1454 1530 1455 1531 spin_lock_init(&chip->reg_lock); 1456 init_MUTEX(&chip->open_mutex);1532 mutex_init(&chip->open_mutex); 1457 1533 chip->card = card; 1458 1534 chip->pci = pci; 1459 1535 chip->irq = -1; 1460 1536 chip->driver_type = driver_type; 1461 1462 chip->position_fix = position_fix; 1537 chip->msi = enable_msi; 1538 1539 chip->position_fix = position_fix; 1463 1540 chip->single_cmd = single_cmd; 1464 1541 … … 1473 1550 #endif 1474 1551 1475 if ((err = pci_request_regions(pci, "ICH HD audio")) < 0) { 1552 err = pci_request_regions(pci, "ICH HD audio"); 1553 if (err < 0) { 1476 1554 kfree(chip); 1477 1555 pci_disable_device(pci); … … 1479 1557 } 1480 1558 1481 chip->addr = pci_resource_start(pci, 0);1559 chip->addr = pci_resource_start(pci, 0); 1482 1560 chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci,0)); 1483 1561 if (chip->remap_addr == NULL) { … … 1487 1565 } 1488 1566 1489 if (request_irq(pci->irq, azx_interrupt, SA_INTERRUPT|SA_SHIRQ, 1490 "HDA Intel", (void*)chip)) { 1491 snd_printk(KERN_ERR SFX "unable to grab IRQ %d\n", pci->irq); 1567 if (chip->msi) 1568 if (pci_enable_msi(pci) < 0) 1569 chip->msi = 0; 1570 1571 if (azx_acquire_irq(chip, 0) < 0) { 1492 1572 err = -EBUSY; 1493 1573 goto errout; 1494 1574 } 1495 chip->irq = pci->irq;1496 1575 1497 1576 pci_set_master(pci); … … 1504 1583 chip->playback_index_offset = ULI_PLAYBACK_INDEX; 1505 1584 chip->capture_index_offset = ULI_CAPTURE_INDEX; 1506 1507 1585 break; 1586 case AZX_DRIVER_ATIHDMI: 1508 1587 chip->playback_streams = ATIHDMI_NUM_PLAYBACK; 1509 1588 chip->capture_streams = ATIHDMI_NUM_CAPTURE; … … 1520 1599 chip->num_streams = chip->playback_streams + chip->capture_streams; 1521 1600 chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), GFP_KERNEL); 1522 if (! 1601 if (!chip->azx_dev) { 1523 1602 snd_printk(KERN_ERR "cannot malloc azx_dev\n"); 1524 1603 goto errout; … … 1551 1630 1552 1631 /* codec detection */ 1553 if (! 1632 if (!chip->codec_mask) { 1554 1633 snd_printk(KERN_ERR SFX "no codecs found!\n"); 1555 1634 err = -ENODEV; … … 1578 1657 struct snd_card *card; 1579 1658 struct azx *chip; 1580 int err = 0;1659 int err; 1581 1660 1582 1661 card = snd_card_new(index, id, THIS_MODULE, 0); 1583 if ( NULL ==card) {1662 if (!card) { 1584 1663 snd_printk(KERN_ERR SFX "Error creating card!\n"); 1585 1664 return -ENOMEM; 1586 1665 } 1587 1666 1588 if ((err = azx_create(card, pci, pci_id->driver_data,1589 &chip))< 0) {1667 err = azx_create(card, pci, pci_id->driver_data, &chip); 1668 if (err < 0) { 1590 1669 snd_card_free(card); 1591 1670 return err; … … 1635 1714 { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ESB2 */ 1636 1715 { 0x8086, 0x284b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH8 */ 1637 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ 1638 { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */ 1716 { 0x8086, 0x293e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */ 1717 { 0x8086, 0x293f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH9 */ 1718 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ 1719 { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */ 1720 { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */ 1721 { 0x1002, 0x7919, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS690 HDMI */ 1639 1722 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ 1640 1723 { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ 1641 1724 { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ 1642 { 0x10de, 0x026c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA 026c */ 1643 { 0x10de, 0x0371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA 0371 */ 1725 { 0x10de, 0x026c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP51 */ 1726 { 0x10de, 0x0371, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP55 */ 1727 { 0x10de, 0x03e4, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP61 */ 1728 { 0x10de, 0x03f0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP61 */ 1729 { 0x10de, 0x044a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP65 */ 1730 { 0x10de, 0x044b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP65 */ 1731 { 0x10de, 0x055c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP67 */ 1732 { 0x10de, 0x055d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_NVIDIA }, /* NVIDIA MCP67 */ 1644 1733 { 0, } 1645 1734 }; -
GPL/trunk/alsa-kernel/pci/hda/hda_local.h
r76 r86 31 31 #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \ 32 32 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \ 33 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ 34 SNDRV_CTL_ELEM_ACCESS_TLV_READ | \ 35 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, \ 33 36 .info = snd_hda_mixer_amp_volume_info, \ 34 37 .get = snd_hda_mixer_amp_volume_get, \ 35 38 .put = snd_hda_mixer_amp_volume_put, \ 39 .tlv = { .c = snd_hda_mixer_amp_tlv }, \ 36 40 .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) } 37 41 /* stereo volume with index */ … … 64 68 int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); 65 69 int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); 70 int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, unsigned int size, unsigned int __user *tlv); 66 71 int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo); 67 72 int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol); … … 169 174 * Misc 170 175 */ 171 struct hda_board_config { 172 const char *modelname; 173 int config; 174 unsigned short pci_subvendor; 175 unsigned short pci_subdevice; 176 }; 177 178 int snd_hda_check_board_config(struct hda_codec *codec, const struct hda_board_config *tbl); 176 int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, 177 const char **modelnames, 178 const struct snd_pci_quirk *pci_list); 179 179 int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew); 180 180 … … 225 225 int speaker_outs; 226 226 hda_nid_t speaker_pins[5]; 227 hda_nid_t hp_pin; 227 int hp_outs; 228 hda_nid_t hp_pins[5]; 228 229 hda_nid_t input_pins[AUTO_PIN_LAST]; 229 230 hda_nid_t dig_out_pin; -
GPL/trunk/alsa-kernel/pci/hda/makefile.os2
r77 r86 15 15 FILE1 = hda_intel.obj hda_codec.obj hda_generic.obj patch_realtek.obj 16 16 FILE2 = patch_cmedia.obj hda_proc.obj patch_analog.obj patch_sigmatel.obj 17 FILE3 = patch_si3054.obj patch_atihdmi.obj 18 FILE4 = 17 FILE3 = patch_si3054.obj patch_atihdmi.obj patch_conexant.obj 18 FILE4 = patch_via.obj 19 19 FILE5 = 20 20 FILE6 = -
GPL/trunk/alsa-kernel/pci/hda/patch_analog.c
r77 r86 24 24 #include <linux/slab.h> 25 25 #include <linux/pci.h> 26 #include <linux/mutex.h> 27 26 28 #include <sound/core.h> 27 29 #include "hda_codec.h" … … 43 45 */ 44 46 unsigned int cur_eapd; 47 unsigned int need_dac_fix; 45 48 46 49 /* capture */ … … 61 64 struct hda_pcm pcm_rec[2]; /* used in alc_build_pcms() */ 62 65 63 struct semaphoreamp_mutex; /* PCM volume/mute control mutex */66 struct mutex amp_mutex; /* PCM volume/mute control mutex */ 64 67 unsigned int spdif_route; 65 68 … … 132 135 if (err < 0) 133 136 return err; 134 } 137 } 135 138 if (spec->dig_in_nid) { 136 139 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); … … 309 312 int i; 310 313 311 314 codec->patch_ops.init(codec); 312 315 for (i = 0; i < spec->num_mixers; i++) 313 316 snd_hda_resume_ctls(codec, spec->mixers[i]); … … 336 339 */ 337 340 static int ad198x_eapd_info(struct snd_kcontrol *kcontrol, 338 339 { 340 341 342 343 344 341 struct snd_ctl_elem_info *uinfo) 342 { 343 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 344 uinfo->count = 1; 345 uinfo->value.integer.min = 0; 346 uinfo->value.integer.max = 1; 347 return 0; 345 348 } 346 349 347 350 static int ad198x_eapd_get(struct snd_kcontrol *kcontrol, 348 349 { 350 351 352 353 354 355 356 357 351 struct snd_ctl_elem_value *ucontrol) 352 { 353 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 354 struct ad198x_spec *spec = codec->spec; 355 int invert = (kcontrol->private_value >> 8) & 1; 356 if (invert) 357 ucontrol->value.integer.value[0] = ! spec->cur_eapd; 358 else 359 ucontrol->value.integer.value[0] = spec->cur_eapd; 360 return 0; 358 361 } 359 362 360 363 static int ad198x_eapd_put(struct snd_kcontrol *kcontrol, 361 362 { 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 364 struct snd_ctl_elem_value *ucontrol) 365 { 366 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 367 struct ad198x_spec *spec = codec->spec; 368 int invert = (kcontrol->private_value >> 8) & 1; 369 hda_nid_t nid = kcontrol->private_value & 0xff; 370 unsigned int eapd; 371 eapd = ucontrol->value.integer.value[0]; 372 if (invert) 373 eapd = !eapd; 374 if (eapd == spec->cur_eapd && ! codec->in_resume) 375 return 0; 376 spec->cur_eapd = eapd; 377 snd_hda_codec_write(codec, nid, 378 0, AC_VERB_SET_EAPD_BTLENABLE, 379 eapd ? 0x02 : 0x00); 380 return 1; 378 381 } 379 382 380 383 static int ad198x_ch_mode_info(struct snd_kcontrol *kcontrol, 381 384 struct snd_ctl_elem_info *uinfo); 382 385 static int ad198x_ch_mode_get(struct snd_kcontrol *kcontrol, 383 386 struct snd_ctl_elem_value *ucontrol); 384 387 static int ad198x_ch_mode_put(struct snd_kcontrol *kcontrol, 385 struct snd_ctl_elem_value *ucontrol); 388 struct snd_ctl_elem_value *ucontrol); 389 386 390 387 391 /* … … 427 431 struct ad198x_spec *ad = codec->spec; 428 432 429 down(&ad->amp_mutex);433 mutex_lock(&ad->amp_mutex); 430 434 snd_hda_mixer_amp_volume_get(kcontrol, ucontrol); 431 up(&ad->amp_mutex);435 mutex_unlock(&ad->amp_mutex); 432 436 return 0; 433 437 } … … 439 443 int i, change = 0; 440 444 441 down(&ad->amp_mutex);445 mutex_lock(&ad->amp_mutex); 442 446 for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) { 443 447 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT); … … 445 449 } 446 450 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT); 447 up(&ad->amp_mutex);451 mutex_unlock(&ad->amp_mutex); 448 452 return change; 449 453 } … … 456 460 struct ad198x_spec *ad = codec->spec; 457 461 458 down(&ad->amp_mutex);462 mutex_lock(&ad->amp_mutex); 459 463 snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); 460 up(&ad->amp_mutex);464 mutex_unlock(&ad->amp_mutex); 461 465 return 0; 462 466 } … … 468 472 int i, change = 0; 469 473 470 down(&ad->amp_mutex);474 mutex_lock(&ad->amp_mutex); 471 475 for (i = 0; i < ARRAY_SIZE(ad1986a_dac_nids); i++) { 472 476 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(ad1986a_dac_nids[i], 3, 0, HDA_OUTPUT); … … 474 478 } 475 479 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT); 476 up(&ad->amp_mutex);480 mutex_unlock(&ad->amp_mutex); 477 481 return change; 478 482 } … … 485 489 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 486 490 .name = "PCM Playback Volume", 491 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 492 SNDRV_CTL_ELEM_ACCESS_TLV_READ | 493 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, 487 494 .info = ad1986a_pcm_amp_vol_info, 488 495 .get = ad1986a_pcm_amp_vol_get, 489 496 .put = ad1986a_pcm_amp_vol_put, 497 .tlv = { .c = snd_hda_mixer_amp_tlv }, 490 498 .private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT) 491 499 }, … … 535 543 /* additional mixers for 3stack mode */ 536 544 static struct snd_kcontrol_new ad1986a_3st_mixers[] = { 537 538 539 540 541 542 543 544 545 { 546 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 547 .name = "Channel Mode", 548 .info = ad198x_ch_mode_info, 549 .get = ad198x_ch_mode_get, 550 .put = ad198x_ch_mode_put, 551 }, 552 {0} /* end */ 545 553 }; 546 554 … … 549 557 550 558 static struct snd_kcontrol_new ad1986a_laptop_mixers[] = { 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 559 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), 560 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), 561 HDA_CODEC_VOLUME("Master Playback Volume", 0x1b, 0x0, HDA_OUTPUT), 562 HDA_CODEC_MUTE("Master Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 563 /* HDA_CODEC_VOLUME("Headphone Playback Volume", 0x1a, 0x0, HDA_OUTPUT), 564 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT), */ 565 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_OUTPUT), 566 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_OUTPUT), 567 HDA_CODEC_VOLUME("Line Playback Volume", 0x17, 0x0, HDA_OUTPUT), 568 HDA_CODEC_MUTE("Line Playback Switch", 0x17, 0x0, HDA_OUTPUT), 569 HDA_CODEC_VOLUME("Aux Playback Volume", 0x16, 0x0, HDA_OUTPUT), 570 HDA_CODEC_MUTE("Aux Playback Switch", 0x16, 0x0, HDA_OUTPUT), 571 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), 572 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), 573 /* HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x18, 0x0, HDA_OUTPUT), 574 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x18, 0x0, HDA_OUTPUT), 575 HDA_CODEC_VOLUME("Mono Playback Volume", 0x1e, 0x0, HDA_OUTPUT), 576 HDA_CODEC_MUTE("Mono Playback Switch", 0x1e, 0x0, HDA_OUTPUT), */ 577 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), 578 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), 579 { 580 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 581 .name = "Capture Source", 582 .info = ad198x_mux_enum_info, 583 .get = ad198x_mux_enum_get, 584 .put = ad198x_mux_enum_put, 585 }, 586 {0} /* end */ 579 587 }; 580 588 … … 583 591 /* master controls both pins 0x1a and 0x1b */ 584 592 static int ad1986a_laptop_master_vol_put(struct snd_kcontrol *kcontrol, 585 586 { 587 588 589 590 591 592 593 594 595 596 597 598 599 593 struct snd_ctl_elem_value *ucontrol) 594 { 595 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 596 long *valp = ucontrol->value.integer.value; 597 int change; 598 599 change = snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_OUTPUT, 0, 600 0x7f, valp[0] & 0x7f); 601 change |= snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_OUTPUT, 0, 602 0x7f, valp[1] & 0x7f); 603 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, 604 0x7f, valp[0] & 0x7f); 605 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, 606 0x7f, valp[1] & 0x7f); 607 return change; 600 608 } 601 609 602 610 static int ad1986a_laptop_master_sw_put(struct snd_kcontrol *kcontrol, 603 604 { 605 606 607 608 609 610 611 612 613 614 615 616 617 611 struct snd_ctl_elem_value *ucontrol) 612 { 613 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 614 long *valp = ucontrol->value.integer.value; 615 int change; 616 617 change = snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_OUTPUT, 0, 618 0x80, valp[0] ? 0 : 0x80); 619 change |= snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_OUTPUT, 0, 620 0x80, valp[1] ? 0 : 0x80); 621 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, 622 0x80, valp[0] ? 0 : 0x80); 623 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, 624 0x80, valp[1] ? 0 : 0x80); 625 return change; 618 626 } 619 627 620 628 static struct hda_input_mux ad1986a_laptop_eapd_capture_source = { 621 622 623 624 625 626 629 .num_items = 3, 630 .items = { 631 { "Mic", 0x0 }, 632 { "Internal Mic", 0x4 }, 633 { "Mix", 0x5 }, 634 }, 627 635 }; 628 636 629 637 static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { 630 { 631 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 632 .name = "Master Playback Volume", 633 .info = snd_hda_mixer_amp_volume_info, 634 .get = snd_hda_mixer_amp_volume_get, 635 .put = ad1986a_laptop_master_vol_put, 636 .private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT), 637 }, 638 { 639 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 640 .name = "Master Playback Switch", 641 .info = snd_hda_mixer_amp_switch_info, 642 .get = snd_hda_mixer_amp_switch_get, 643 .put = ad1986a_laptop_master_sw_put, 644 .private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT), 645 }, 646 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), 647 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), 648 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT), 649 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT), 650 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), 651 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), 652 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), 653 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), 654 { 655 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 656 .name = "Capture Source", 657 .info = ad198x_mux_enum_info, 658 .get = ad198x_mux_enum_get, 659 .put = ad198x_mux_enum_put, 660 }, 661 { 662 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 663 .name = "External Amplifier", 664 .info = ad198x_eapd_info, 665 .get = ad198x_eapd_get, 666 .put = ad198x_eapd_put, 667 .private_value = 0x1b | (1 << 8), /* port-D, inversed */ 668 }, 669 {0} /* end */ 638 { 639 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 640 .name = "Master Playback Volume", 641 .info = snd_hda_mixer_amp_volume_info, 642 .get = snd_hda_mixer_amp_volume_get, 643 .put = ad1986a_laptop_master_vol_put, 644 .tlv = { .c = snd_hda_mixer_amp_tlv }, 645 .private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT), 646 }, 647 { 648 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 649 .name = "Master Playback Switch", 650 .info = snd_hda_mixer_amp_switch_info, 651 .get = snd_hda_mixer_amp_switch_get, 652 .put = ad1986a_laptop_master_sw_put, 653 .private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT), 654 }, 655 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT), 656 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT), 657 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT), 658 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT), 659 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT), 660 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT), 661 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT), 662 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT), 663 { 664 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 665 .name = "Capture Source", 666 .info = ad198x_mux_enum_info, 667 .get = ad198x_mux_enum_get, 668 .put = ad198x_mux_enum_put, 669 }, 670 { 671 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 672 .name = "External Amplifier", 673 .info = ad198x_eapd_info, 674 .get = ad198x_eapd_get, 675 .put = ad198x_eapd_put, 676 .private_value = 0x1b | (1 << 8), /* port-D, inversed */ 677 }, 678 {0} /* end */ 670 679 }; 671 680 … … 730 739 /* additional verbs for 3-stack model */ 731 740 static struct hda_verb ad1986a_3st_init_verbs[] = { 732 733 734 735 741 /* Mic and line-in selectors */ 742 {0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, 743 {0x10, AC_VERB_SET_CONNECT_SEL, 0x1}, 744 {0} /* end */ 736 745 }; 737 746 738 747 static struct hda_verb ad1986a_ch2_init[] = { 739 740 741 742 743 744 745 748 /* Surround out -> Line In */ 749 { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 750 { 0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 751 /* CLFE -> Mic in */ 752 { 0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 753 { 0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 754 {0} /* end */ 746 755 }; 747 756 748 757 static struct hda_verb ad1986a_ch4_init[] = { 749 750 751 752 753 754 755 758 /* Surround out -> Surround */ 759 { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 760 { 0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 761 /* CLFE -> Mic in */ 762 { 0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 763 { 0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 764 {0} /* end */ 756 765 }; 757 766 758 767 static struct hda_verb ad1986a_ch6_init[] = { 759 760 761 762 763 764 765 768 /* Surround out -> Surround out */ 769 { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 770 { 0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 771 /* CLFE -> CLFE */ 772 { 0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 773 { 0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 774 {0} /* end */ 766 775 }; 767 776 768 777 static struct hda_channel_mode ad1986a_modes[3] = { 769 770 771 778 { 2, ad1986a_ch2_init }, 779 { 4, ad1986a_ch4_init }, 780 { 6, ad1986a_ch6_init }, 772 781 }; 773 782 774 783 /* eapd initialization */ 775 784 static struct hda_verb ad1986a_eapd_init_verbs[] = { 776 777 785 {0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00}, 786 {0} 778 787 }; 779 788 780 789 /* models */ 781 enum { AD1986A_6STACK, AD1986A_3STACK, AD1986A_LAPTOP, AD1986A_LAPTOP_EAPD }; 782 783 static struct hda_board_config ad1986a_cfg_tbl[] = { 784 { .modelname = "6stack", .config = AD1986A_6STACK }, 785 { .modelname = "3stack", .config = AD1986A_3STACK }, 786 { .pci_subvendor = 0x10de, .pci_subdevice = 0xcb84, 787 .config = AD1986A_3STACK }, /* ASUS A8N-VM CSM */ 788 { .pci_subvendor = 0x1043, .pci_subdevice = 0x81b3, 789 .config = AD1986A_3STACK }, /* ASUS P5RD2-VM / P5GPL-X SE */ 790 { .modelname = "laptop", .config = AD1986A_LAPTOP }, 791 { .pci_subvendor = 0x144d, .pci_subdevice = 0xc01e, 792 .config = AD1986A_LAPTOP }, /* FSC V2060 */ 793 { .pci_subvendor = 0x17c0, .pci_subdevice = 0x2017, 794 .config = AD1986A_LAPTOP }, /* Samsung M50 */ 795 { .pci_subvendor = 0x1043, .pci_subdevice = 0x818f, 796 .config = AD1986A_LAPTOP }, /* ASUS P5GV-MX */ 797 { .pci_subvendor = 0x144d, .pci_subdevice = 0xc023, 798 .config = AD1986A_LAPTOP_EAPD }, /* Samsung X60 Chane */ 799 { .modelname = "laptop-eapd", .config = AD1986A_LAPTOP_EAPD }, 800 { .pci_subvendor = 0x144d, .pci_subdevice = 0xc024, 801 .config = AD1986A_LAPTOP_EAPD }, /* Samsung R65-T2300 Charis */ 802 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1213, 803 .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */ 804 { .pci_subvendor = 0x1043, .pci_subdevice = 0x11f7, 805 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5A */ 806 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297, 807 .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */ 808 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af, 809 .config = AD1986A_LAPTOP_EAPD }, /* HP Compaq Presario B2800 */ 810 { .pci_subvendor = 0x17aa, .pci_subdevice = 0x2066, 811 .config = AD1986A_LAPTOP_EAPD }, /* Lenovo 3000 N100-07684JU */ 812 {0} 790 enum { 791 AD1986A_6STACK, 792 AD1986A_3STACK, 793 AD1986A_LAPTOP, 794 AD1986A_LAPTOP_EAPD, 795 AD1986A_MODELS 796 }; 797 798 static const char *ad1986a_models[AD1986A_MODELS] = { 799 [AD1986A_6STACK] = "6stack", 800 [AD1986A_3STACK] = "3stack", 801 [AD1986A_LAPTOP] = "laptop", 802 [AD1986A_LAPTOP_EAPD] = "laptop-eapd", 803 }; 804 805 static struct snd_pci_quirk ad1986a_cfg_tbl[] = { 806 SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_LAPTOP_EAPD), 807 SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_3STACK), 808 SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9", AD1986A_LAPTOP_EAPD), 809 SND_PCI_QUIRK(0x1043, 0x1213, "ASUS A6J", AD1986A_LAPTOP_EAPD), 810 SND_PCI_QUIRK(0x1043, 0x11f7, "ASUS U5A", AD1986A_LAPTOP_EAPD), 811 SND_PCI_QUIRK(0x1043, 0x1263, "ASUS U5F", AD1986A_LAPTOP_EAPD), 812 SND_PCI_QUIRK(0x1043, 0x1297, "ASUS Z62F", AD1986A_LAPTOP_EAPD), 813 SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS V1j", AD1986A_LAPTOP_EAPD), 814 SND_PCI_QUIRK(0x1043, 0x1302, "ASUS W3j", AD1986A_LAPTOP_EAPD), 815 SND_PCI_QUIRK(0x1043, 0x817f, "ASUS P5", AD1986A_3STACK), 816 SND_PCI_QUIRK(0x1043, 0x818f, "ASUS P5", AD1986A_LAPTOP), 817 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS P5", AD1986A_3STACK), 818 SND_PCI_QUIRK(0x1043, 0x81cb, "ASUS M2N", AD1986A_3STACK), 819 SND_PCI_QUIRK(0x1043, 0x8234, "ASUS M2N", AD1986A_3STACK), 820 SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), 821 SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD), 822 SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD), 823 SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD), 824 SND_PCI_QUIRK(0x17aa, 0x1017, "Lenovo A60", AD1986A_3STACK), 825 SND_PCI_QUIRK(0x17aa, 0x2066, "Lenovo N100", AD1986A_LAPTOP_EAPD), 826 SND_PCI_QUIRK(0x17c0, 0x2017, "Samsung M50", AD1986A_LAPTOP), 827 {0} 813 828 }; 814 829 815 830 static int patch_ad1986a(struct hda_codec *codec) 816 831 { 817 818 832 struct ad198x_spec *spec; 833 int board_config; 819 834 820 835 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 822 837 return -ENOMEM; 823 838 824 init_MUTEX(&spec->amp_mutex);839 mutex_init(&spec->amp_mutex); 825 840 codec->spec = spec; 826 841 … … 830 845 spec->multiout.dig_out_nid = AD1986A_SPDIF_OUT; 831 846 spec->num_adc_nids = 1; 832 833 847 spec->adc_nids = ad1986a_adc_nids; 848 spec->capsrc_nids = ad1986a_capsrc_nids; 834 849 spec->input_mux = &ad1986a_capture_source; 835 850 spec->num_mixers = 1; … … 839 854 840 855 codec->patch_ops = ad198x_patch_ops; 841 /* override some parameters */ 842 board_config = snd_hda_check_board_config(codec, ad1986a_cfg_tbl); 843 switch (board_config) { 844 case AD1986A_3STACK: 845 spec->num_mixers = 2; 846 spec->mixers[1] = ad1986a_3st_mixers; 847 spec->num_init_verbs = 2; 848 spec->init_verbs[1] = ad1986a_3st_init_verbs; 849 spec->channel_mode = ad1986a_modes; 850 spec->num_channel_mode = ARRAY_SIZE(ad1986a_modes); 851 break; 852 case AD1986A_LAPTOP: 853 spec->mixers[0] = ad1986a_laptop_mixers; 854 spec->multiout.max_channels = 2; 855 spec->multiout.num_dacs = 1; 856 spec->multiout.dac_nids = ad1986a_laptop_dac_nids; 857 break; 858 case AD1986A_LAPTOP_EAPD: 859 spec->mixers[0] = ad1986a_laptop_eapd_mixers; 860 spec->num_init_verbs = 2; 861 spec->init_verbs[1] = ad1986a_eapd_init_verbs; 862 spec->multiout.max_channels = 2; 863 spec->multiout.num_dacs = 1; 864 spec->multiout.dac_nids = ad1986a_laptop_dac_nids; 865 spec->multiout.dig_out_nid = 0; 866 spec->input_mux = &ad1986a_laptop_eapd_capture_source; 867 break; 868 } 856 857 /* override some parameters */ 858 board_config = snd_hda_check_board_config(codec, AD1986A_MODELS, 859 ad1986a_models, 860 ad1986a_cfg_tbl); 861 switch (board_config) { 862 case AD1986A_3STACK: 863 spec->num_mixers = 2; 864 spec->mixers[1] = ad1986a_3st_mixers; 865 spec->num_init_verbs = 3; 866 spec->init_verbs[1] = ad1986a_3st_init_verbs; 867 spec->init_verbs[2] = ad1986a_ch2_init; 868 spec->channel_mode = ad1986a_modes; 869 spec->num_channel_mode = ARRAY_SIZE(ad1986a_modes); 870 spec->need_dac_fix = 1; 871 spec->multiout.max_channels = 2; 872 spec->multiout.num_dacs = 1; 873 break; 874 case AD1986A_LAPTOP: 875 spec->mixers[0] = ad1986a_laptop_mixers; 876 spec->multiout.max_channels = 2; 877 spec->multiout.num_dacs = 1; 878 spec->multiout.dac_nids = ad1986a_laptop_dac_nids; 879 break; 880 case AD1986A_LAPTOP_EAPD: 881 spec->mixers[0] = ad1986a_laptop_eapd_mixers; 882 spec->num_init_verbs = 2; 883 spec->init_verbs[1] = ad1986a_eapd_init_verbs; 884 spec->multiout.max_channels = 2; 885 spec->multiout.num_dacs = 1; 886 spec->multiout.dac_nids = ad1986a_laptop_dac_nids; 887 spec->multiout.dig_out_nid = 0; 888 spec->input_mux = &ad1986a_laptop_eapd_capture_source; 889 break; 890 } 869 891 870 892 return 0; … … 959 981 { 960 982 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 961 983 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Source", 962 984 .info = ad1983_spdif_route_info, 963 985 .get = ad1983_spdif_route_get, … … 1015 1037 return -ENOMEM; 1016 1038 1017 init_MUTEX(&spec->amp_mutex);1039 mutex_init(&spec->amp_mutex); 1018 1040 codec->spec = spec; 1019 1041 … … 1023 1045 spec->multiout.dig_out_nid = AD1983_SPDIF_OUT; 1024 1046 spec->num_adc_nids = 1; 1025 1026 1047 spec->adc_nids = ad1983_adc_nids; 1048 spec->capsrc_nids = ad1983_capsrc_nids; 1027 1049 spec->input_mux = &ad1983_capture_source; 1028 1050 spec->num_mixers = 1; … … 1098 1120 /* identical with AD1983 */ 1099 1121 { 1100 1101 1122 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1123 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Source", 1102 1124 .info = ad1983_spdif_route_info, 1103 1125 .get = ad1983_spdif_route_get, 1104 1126 .put = ad1983_spdif_route_put, 1105 1127 }, 1106 1128 {0} /* end */ 1107 1129 }; … … 1161 1183 */ 1162 1184 1163 #define AD1981_HP_EVENT 1164 #define AD1981_MIC_EVENT 1185 #define AD1981_HP_EVENT 0x37 1186 #define AD1981_MIC_EVENT 0x38 1165 1187 1166 1188 static struct hda_verb ad1981_hp_init_verbs[] = { 1167 1168 1169 1170 1171 1189 {0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x00 }, /* default off */ 1190 /* pin sensing on HP and Mic jacks */ 1191 {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT}, 1192 {0x08, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_MIC_EVENT}, 1193 {0} 1172 1194 }; 1173 1195 1174 1196 /* turn on/off EAPD (+ mute HP) as a master switch */ 1175 1197 static int ad1981_hp_master_sw_put(struct snd_kcontrol *kcontrol, 1176 1177 { 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1198 struct snd_ctl_elem_value *ucontrol) 1199 { 1200 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1201 struct ad198x_spec *spec = codec->spec; 1202 1203 if (! ad198x_eapd_put(kcontrol, ucontrol)) 1204 return 0; 1205 1206 /* toggle HP mute appropriately */ 1207 snd_hda_codec_amp_update(codec, 0x06, 0, HDA_OUTPUT, 0, 1208 0x80, spec->cur_eapd ? 0 : 0x80); 1209 snd_hda_codec_amp_update(codec, 0x06, 1, HDA_OUTPUT, 0, 1210 0x80, spec->cur_eapd ? 0 : 0x80); 1211 return 1; 1190 1212 } 1191 1213 1192 1214 /* bind volumes of both NID 0x05 and 0x06 */ 1193 1215 static int ad1981_hp_master_vol_put(struct snd_kcontrol *kcontrol, 1194 1195 { 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1216 struct snd_ctl_elem_value *ucontrol) 1217 { 1218 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1219 long *valp = ucontrol->value.integer.value; 1220 int change; 1221 1222 change = snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, 1223 0x7f, valp[0] & 0x7f); 1224 change |= snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, 1225 0x7f, valp[1] & 0x7f); 1226 snd_hda_codec_amp_update(codec, 0x06, 0, HDA_OUTPUT, 0, 1227 0x7f, valp[0] & 0x7f); 1228 snd_hda_codec_amp_update(codec, 0x06, 1, HDA_OUTPUT, 0, 1229 0x7f, valp[1] & 0x7f); 1230 return change; 1209 1231 } 1210 1232 … … 1212 1234 static void ad1981_hp_automute(struct hda_codec *codec) 1213 1235 { 1214 1215 1216 1217 1218 1219 1220 1221 1236 unsigned int present; 1237 1238 present = snd_hda_codec_read(codec, 0x06, 0, 1239 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1240 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, 1241 0x80, present ? 0x80 : 0); 1242 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, 1243 0x80, present ? 0x80 : 0); 1222 1244 } 1223 1245 … … 1225 1247 static void ad1981_hp_automic(struct hda_codec *codec) 1226 1248 { 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1249 static struct hda_verb mic_jack_on[] = { 1250 {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 1251 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 1252 {0} 1253 }; 1254 static struct hda_verb mic_jack_off[] = { 1255 {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080}, 1256 {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 1257 {0} 1258 }; 1259 unsigned int present; 1260 1261 present = snd_hda_codec_read(codec, 0x08, 0, 1262 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1263 if (present) 1264 snd_hda_sequence_write(codec, mic_jack_on); 1265 else 1266 snd_hda_sequence_write(codec, mic_jack_off); 1245 1267 } 1246 1268 1247 1269 /* unsolicited event for HP jack sensing */ 1248 1270 static void ad1981_hp_unsol_event(struct hda_codec *codec, 1249 1250 { 1251 1252 1253 1254 1255 1256 1257 1258 1259 1271 unsigned int res) 1272 { 1273 res >>= 26; 1274 switch (res) { 1275 case AD1981_HP_EVENT: 1276 ad1981_hp_automute(codec); 1277 break; 1278 case AD1981_MIC_EVENT: 1279 ad1981_hp_automic(codec); 1280 break; 1281 } 1260 1282 } 1261 1283 1262 1284 static struct hda_input_mux ad1981_hp_capture_source = { 1263 1264 1265 1266 1267 1268 1285 .num_items = 3, 1286 .items = { 1287 { "Mic", 0x0 }, 1288 { "Docking-Station", 0x1 }, 1289 { "Mix", 0x2 }, 1290 }, 1269 1291 }; 1270 1292 1271 1293 static struct snd_kcontrol_new ad1981_hp_mixers[] = { 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1294 { 1295 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1296 .name = "Master Playback Volume", 1297 .info = snd_hda_mixer_amp_volume_info, 1298 .get = snd_hda_mixer_amp_volume_get, 1299 .put = ad1981_hp_master_vol_put, 1300 .private_value = HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), 1301 }, 1302 { 1303 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1304 .name = "Master Playback Switch", 1305 .info = ad198x_eapd_info, 1306 .get = ad198x_eapd_get, 1307 .put = ad1981_hp_master_sw_put, 1308 .private_value = 0x05, 1309 }, 1310 HDA_CODEC_VOLUME("PCM Playback Volume", 0x11, 0x0, HDA_OUTPUT), 1311 HDA_CODEC_MUTE("PCM Playback Switch", 0x11, 0x0, HDA_OUTPUT), 1290 1312 #if 0 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1313 /* FIXME: analog mic/line loopback doesn't work with my tests... 1314 * (although recording is OK) 1315 */ 1316 HDA_CODEC_VOLUME("Mic Playback Volume", 0x12, 0x0, HDA_OUTPUT), 1317 HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), 1318 HDA_CODEC_VOLUME("Docking-Station Playback Volume", 0x13, 0x0, HDA_OUTPUT), 1319 HDA_CODEC_MUTE("Docking-Station Playback Switch", 0x13, 0x0, HDA_OUTPUT), 1320 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x1c, 0x0, HDA_OUTPUT), 1321 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x1c, 0x0, HDA_OUTPUT), 1322 /* FIXME: does this laptop have analog CD connection? */ 1323 HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), 1324 HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), 1303 1325 #endif 1304 HDA_CODEC_VOLUME("Mic Boost", 0x08, 0x0, HDA_INPUT), 1305 HDA_CODEC_VOLUME("Internal Mic Boost", 0x18, 0x0, HDA_INPUT), 1306 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), 1307 HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), 1308 { 1309 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1310 .name = "Capture Source", 1311 .info = ad198x_mux_enum_info, 1312 .get = ad198x_mux_enum_get, 1313 .put = ad198x_mux_enum_put, 1314 }, 1315 /* identical with AD1983 */ 1326 HDA_CODEC_VOLUME("Mic Boost", 0x08, 0x0, HDA_INPUT), 1327 HDA_CODEC_VOLUME("Internal Mic Boost", 0x18, 0x0, HDA_INPUT), 1328 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), 1329 HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), 1330 { 1331 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1332 .name = "Capture Source", 1333 .info = ad198x_mux_enum_info, 1334 .get = ad198x_mux_enum_get, 1335 .put = ad198x_mux_enum_put, 1336 }, 1337 {0} /* end */ 1338 }; 1339 1340 /* initialize jack-sensing, too */ 1341 static int ad1981_hp_init(struct hda_codec *codec) 1342 { 1343 ad198x_init(codec); 1344 ad1981_hp_automute(codec); 1345 ad1981_hp_automic(codec); 1346 return 0; 1347 } 1348 1349 /* configuration for Lenovo Thinkpad T60 */ 1350 static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = { 1351 HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT), 1352 HDA_CODEC_MUTE("Master Playback Switch", 0x05, 0x0, HDA_OUTPUT), 1353 HDA_CODEC_VOLUME("PCM Playback Volume", 0x11, 0x0, HDA_OUTPUT), 1354 HDA_CODEC_MUTE("PCM Playback Switch", 0x11, 0x0, HDA_OUTPUT), 1355 HDA_CODEC_VOLUME("Mic Playback Volume", 0x12, 0x0, HDA_OUTPUT), 1356 HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), 1357 HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), 1358 HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), 1359 HDA_CODEC_VOLUME("Mic Boost", 0x08, 0x0, HDA_INPUT), 1360 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), 1361 HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), 1362 { 1363 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1364 .name = "Capture Source", 1365 .info = ad198x_mux_enum_info, 1366 .get = ad198x_mux_enum_get, 1367 .put = ad198x_mux_enum_put, 1368 }, 1369 /* identical with AD1983 */ 1316 1370 { 1317 1371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 1321 1375 .put = ad1983_spdif_route_put, 1322 1376 }, 1323 {0} /* end */ 1324 }; 1325 1326 /* initialize jack-sensing, too */ 1327 static int ad1981_hp_init(struct hda_codec *codec) 1328 { 1329 ad198x_init(codec); 1330 ad1981_hp_automute(codec); 1331 ad1981_hp_automic(codec); 1332 return 0; 1333 } 1334 1335 /* configuration for Lenovo Thinkpad T60 */ 1336 static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = { 1337 HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT), 1338 HDA_CODEC_MUTE("Master Playback Switch", 0x05, 0x0, HDA_OUTPUT), 1339 HDA_CODEC_VOLUME("PCM Playback Volume", 0x11, 0x0, HDA_OUTPUT), 1340 HDA_CODEC_MUTE("PCM Playback Switch", 0x11, 0x0, HDA_OUTPUT), 1341 HDA_CODEC_VOLUME("Mic Playback Volume", 0x12, 0x0, HDA_OUTPUT), 1342 HDA_CODEC_MUTE("Mic Playback Switch", 0x12, 0x0, HDA_OUTPUT), 1343 HDA_CODEC_VOLUME("CD Playback Volume", 0x1d, 0x0, HDA_OUTPUT), 1344 HDA_CODEC_MUTE("CD Playback Switch", 0x1d, 0x0, HDA_OUTPUT), 1345 HDA_CODEC_VOLUME("Mic Boost", 0x08, 0x0, HDA_INPUT), 1346 HDA_CODEC_VOLUME("Capture Volume", 0x15, 0x0, HDA_OUTPUT), 1347 HDA_CODEC_MUTE("Capture Switch", 0x15, 0x0, HDA_OUTPUT), 1348 { 1349 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1350 .name = "Capture Source", 1351 .info = ad198x_mux_enum_info, 1352 .get = ad198x_mux_enum_get, 1353 .put = ad198x_mux_enum_put, 1354 }, 1355 {0} /* end */ 1377 {0} /* end */ 1356 1378 }; 1357 1379 1358 1380 static struct hda_input_mux ad1981_thinkpad_capture_source = { 1359 1360 1361 1362 1363 1364 1381 .num_items = 3, 1382 .items = { 1383 { "Mic", 0x0 }, 1384 { "Mix", 0x2 }, 1385 { "CD", 0x4 }, 1386 }, 1365 1387 }; 1366 1388 1367 1389 /* models */ 1368 enum { AD1981_BASIC, AD1981_HP, AD1981_THINKPAD }; 1369 1370 static struct hda_board_config ad1981_cfg_tbl[] = { 1371 { .modelname = "hp", .config = AD1981_HP }, 1372 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30aa, 1373 .config = AD1981_HP }, /* HP nx6320 */ 1374 { .pci_subvendor = 0x103c, .pci_subdevice = 0x309f, 1375 .config = AD1981_HP }, /* HP nx9420 AngelFire */ 1376 { .pci_subvendor = 0x30b0, .pci_subdevice = 0x103c, 1377 .config = AD1981_HP }, /* HP nx6320 (reversed SSID, H/W bug) */ 1378 { .modelname = "basic", .config = AD1981_BASIC }, 1379 { .modelname = "thinkpad", .config = AD1981_THINKPAD }, 1380 /* Lenovo Thinkpad T60/X60/Z6xx */ 1381 { .pci_subvendor = 0x17aa, .config = AD1981_THINKPAD }, 1382 { .pci_subvendor = 0x1014, .pci_subdevice = 0x0597, 1383 .config = AD1981_THINKPAD }, /* Z60m/t */ 1384 { .modelname = "basic", .config = AD1981_BASIC }, 1385 {0} 1390 enum { 1391 AD1981_BASIC, 1392 AD1981_HP, 1393 AD1981_THINKPAD, 1394 AD1981_MODELS 1395 }; 1396 1397 static const char *ad1981_models[AD1981_MODELS] = { 1398 [AD1981_HP] = "hp", 1399 [AD1981_THINKPAD] = "thinkpad", 1400 [AD1981_BASIC] = "basic", 1401 }; 1402 1403 static struct snd_pci_quirk ad1981_cfg_tbl[] = { 1404 /* All HP models */ 1405 SND_PCI_QUIRK(0x103c, 0, "HP nx", AD1981_HP), 1406 /* HP nx6320 (reversed SSID, H/W bug) */ 1407 SND_PCI_QUIRK(0x30b0, 0x103c, "HP nx6320", AD1981_HP), 1408 /* Lenovo Thinkpad T60/X60/Z6xx */ 1409 SND_PCI_QUIRK(0x17aa, 0, "Lenovo Thinkpad", AD1981_THINKPAD), 1410 SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD), 1411 {0} 1386 1412 }; 1387 1413 1388 1414 static int patch_ad1981(struct hda_codec *codec) 1389 1415 { 1390 1391 1416 struct ad198x_spec *spec; 1417 int board_config; 1392 1418 1393 1419 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 1395 1421 return -ENOMEM; 1396 1422 1397 init_MUTEX(&spec->amp_mutex);1423 mutex_init(&spec->amp_mutex); 1398 1424 codec->spec = spec; 1399 1425 … … 1404 1430 spec->num_adc_nids = 1; 1405 1431 spec->adc_nids = ad1981_adc_nids; 1406 1432 spec->capsrc_nids = ad1981_capsrc_nids; 1407 1433 spec->input_mux = &ad1981_capture_source; 1408 1434 spec->num_mixers = 1; … … 1414 1440 codec->patch_ops = ad198x_patch_ops; 1415 1441 1416 /* override some parameters */ 1417 board_config = snd_hda_check_board_config(codec, ad1981_cfg_tbl); 1418 switch (board_config) { 1419 case AD1981_HP: 1420 spec->mixers[0] = ad1981_hp_mixers; 1421 spec->num_init_verbs = 2; 1422 spec->init_verbs[1] = ad1981_hp_init_verbs; 1423 spec->multiout.dig_out_nid = 0; 1424 spec->input_mux = &ad1981_hp_capture_source; 1425 1426 codec->patch_ops.init = ad1981_hp_init; 1427 codec->patch_ops.unsol_event = ad1981_hp_unsol_event; 1428 break; 1429 case AD1981_THINKPAD: 1430 spec->mixers[0] = ad1981_thinkpad_mixers; 1431 spec->multiout.dig_out_nid = 0; 1432 spec->input_mux = &ad1981_thinkpad_capture_source; 1433 break; 1434 } 1442 /* override some parameters */ 1443 board_config = snd_hda_check_board_config(codec, AD1981_MODELS, 1444 ad1981_models, 1445 ad1981_cfg_tbl); 1446 switch (board_config) { 1447 case AD1981_HP: 1448 spec->mixers[0] = ad1981_hp_mixers; 1449 spec->num_init_verbs = 2; 1450 spec->init_verbs[1] = ad1981_hp_init_verbs; 1451 spec->multiout.dig_out_nid = 0; 1452 spec->input_mux = &ad1981_hp_capture_source; 1453 1454 codec->patch_ops.init = ad1981_hp_init; 1455 codec->patch_ops.unsol_event = ad1981_hp_unsol_event; 1456 break; 1457 case AD1981_THINKPAD: 1458 spec->mixers[0] = ad1981_thinkpad_mixers; 1459 spec->input_mux = &ad1981_thinkpad_capture_source; 1460 break; 1461 } 1462 1435 1463 return 0; 1436 1464 } … … 1541 1569 ((codec)->vendor_id == 0x11d41988 && \ 1542 1570 (codec)->revision_id == AD1988A_REV2) 1571 1543 1572 /* 1544 1573 * mixers … … 1618 1647 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1619 1648 struct ad198x_spec *spec = codec->spec; 1620 return snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, 1621 spec->num_channel_mode, &spec->multiout.max_channels); 1649 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, 1650 spec->num_channel_mode, 1651 &spec->multiout.max_channels); 1652 if (err >= 0 && spec->need_dac_fix) 1653 spec->multiout.num_dacs = spec->multiout.max_channels / 2; 1654 return err; 1622 1655 } 1623 1656 … … 1629 1662 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x05, 2, 0x0, HDA_OUTPUT), 1630 1663 HDA_CODEC_VOLUME("Side Playback Volume", 0x0a, 0x0, HDA_OUTPUT), 1664 {0} /* end */ 1631 1665 }; 1632 1666 … … 1637 1671 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0a, 2, 0x0, HDA_OUTPUT), 1638 1672 HDA_CODEC_VOLUME("Side Playback Volume", 0x06, 0x0, HDA_OUTPUT), 1673 {0} /* end */ 1639 1674 }; 1640 1675 … … 1675 1710 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT), 1676 1711 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x05, 2, 0x0, HDA_OUTPUT), 1712 {0} /* end */ 1677 1713 }; 1678 1714 … … 1682 1718 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x06, 1, 0x0, HDA_OUTPUT), 1683 1719 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x06, 2, 0x0, HDA_OUTPUT), 1720 {0} /* end */ 1684 1721 }; 1685 1722 … … 1743 1780 { 1744 1781 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1745 1746 1747 1748 1749 1782 .name = "External Amplifier", 1783 .info = ad198x_eapd_info, 1784 .get = ad198x_eapd_get, 1785 .put = ad198x_eapd_put, 1786 .private_value = 0x12 | (1 << 8), /* port-D, inversed */ 1750 1787 }, 1751 1788 … … 2119 2156 else 2120 2157 snd_hda_sequence_write(codec, ad1988_laptop_hp_off); 2121 } 2158 } 2122 2159 2123 2160 … … 2187 2224 /* A B C D E F G H */ 2188 2225 0x04, 0x05, 0x0a, 0x04, 0x06, 0x05, 0x0a, 0x06 2189 2190 2226 }; 2227 if (is_rev2(codec)) 2191 2228 return idx_to_dac_rev2[idx]; 2192 2229 else … … 2320 2357 idx = ad1988_pin_idx(pin); 2321 2358 nid = ad1988_idx_to_dac(codec, idx); 2322 2323 2324 2325 2326 2359 /* specify the DAC as the extra output */ 2360 if (! spec->multiout.hp_nid) 2361 spec->multiout.hp_nid = nid; 2362 else 2363 spec->multiout.extra_out_nid[0] = nid; 2327 2364 /* control HP volume/switch on the output mixer amp */ 2328 2365 sprintf(name, "%s Playback Volume", pfx); … … 2443 2480 hda_nid_t pin; 2444 2481 2445 2482 pin = spec->autocfg.speaker_pins[0]; 2446 2483 if (pin) /* connect to front */ 2447 2484 ad1988_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 2448 pin = spec->autocfg.hp_pin ;2485 pin = spec->autocfg.hp_pins[0]; 2449 2486 if (pin) /* connect to front */ 2450 2487 ad1988_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); … … 2491 2528 return err; 2492 2529 if ((err = ad1988_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) 2493 2494 2530 return err; 2531 if (! spec->autocfg.line_outs) 2495 2532 return 0; /* can't find valid BIOS pin config */ 2496 2497 2498 2499 2500 (err = ad1988_auto_create_extra_out(codec, spec->autocfg.hp_pin,2533 if ((err = ad1988_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 2534 (err = ad1988_auto_create_extra_out(codec, 2535 spec->autocfg.speaker_pins[0], 2536 "Speaker")) < 0 || 2537 (err = ad1988_auto_create_extra_out(codec, spec->autocfg.hp_pins[0], 2501 2538 "Headphone")) < 0 || 2502 2539 (err = ad1988_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) … … 2534 2571 */ 2535 2572 2536 static struct hda_board_config ad1988_cfg_tbl[] = { 2537 { .modelname = "6stack", .config = AD1988_6STACK }, 2538 { .modelname = "6stack-dig", .config = AD1988_6STACK_DIG }, 2539 { .modelname = "3stack", .config = AD1988_3STACK }, 2540 { .modelname = "3stack-dig", .config = AD1988_3STACK_DIG }, 2541 { .modelname = "laptop", .config = AD1988_LAPTOP }, 2542 { .modelname = "laptop-dig", .config = AD1988_LAPTOP_DIG }, 2543 { .modelname = "auto", .config = AD1988_AUTO }, 2544 {0} 2573 static const char *ad1988_models[AD1988_MODEL_LAST] = { 2574 [AD1988_6STACK] = "6stack", 2575 [AD1988_6STACK_DIG] = "6stack-dig", 2576 [AD1988_3STACK] = "3stack", 2577 [AD1988_3STACK_DIG] = "3stack-dig", 2578 [AD1988_LAPTOP] = "laptop", 2579 [AD1988_LAPTOP_DIG] = "laptop-dig", 2580 [AD1988_AUTO] = "auto", 2545 2581 }; 2546 2582 … … 2554 2590 return -ENOMEM; 2555 2591 2556 init_MUTEX(&spec->amp_mutex);2592 mutex_init(&spec->amp_mutex); 2557 2593 codec->spec = spec; 2558 2594 2559 2595 if (is_rev2(codec)) 2560 2596 snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n"); 2561 2597 2562 board_config = snd_hda_check_board_config(codec, ad1988_cfg_tbl); 2563 if (board_config < 0 || board_config >= AD1988_MODEL_LAST) { 2598 board_config = snd_hda_check_board_config(codec, AD1988_MODEL_LAST, 2599 ad1988_models, NULL); 2600 if (board_config < 0) { 2564 2601 printk(KERN_INFO "hda_codec: Unknown model for AD1988, trying auto-probe from BIOS...\n"); 2565 2602 board_config = AD1988_AUTO; … … 2582 2619 case AD1988_6STACK_DIG: 2583 2620 spec->multiout.max_channels = 8; 2584 2585 2621 spec->multiout.num_dacs = 4; 2622 if (is_rev2(codec)) 2586 2623 spec->multiout.dac_nids = ad1988_6stack_dac_nids_rev2; 2587 2624 else 2588 2625 spec->multiout.dac_nids = ad1988_6stack_dac_nids; 2589 2626 spec->input_mux = &ad1988_6stack_capture_source; 2590 2591 2627 spec->num_mixers = 2; 2628 if (is_rev2(codec)) 2592 2629 spec->mixers[0] = ad1988_6stack_mixers1_rev2; 2593 2630 else … … 2604 2641 case AD1988_3STACK_DIG: 2605 2642 spec->multiout.max_channels = 6; 2606 2607 2643 spec->multiout.num_dacs = 3; 2644 if (is_rev2(codec)) 2608 2645 spec->multiout.dac_nids = ad1988_3stack_dac_nids_rev2; 2609 2646 else … … 2612 2649 spec->channel_mode = ad1988_3stack_modes; 2613 2650 spec->num_channel_mode = ARRAY_SIZE(ad1988_3stack_modes); 2614 2615 2651 spec->num_mixers = 2; 2652 if (is_rev2(codec)) 2616 2653 spec->mixers[0] = ad1988_3stack_mixers1_rev2; 2617 2654 else … … 2673 2710 { .id = 0x11d41986, .name = "AD1986A", .patch = patch_ad1986a }, 2674 2711 { .id = 0x11d41988, .name = "AD1988", .patch = patch_ad1988 }, 2712 { .id = 0x11d4198b, .name = "AD1988B", .patch = patch_ad1988 }, 2675 2713 {0} /* terminator */ 2676 2714 }; -
GPL/trunk/alsa-kernel/pci/hda/patch_cmedia.c
r69 r86 41 41 CMI_ALLOUT, /* back 5-jack + front-panel 2-jack + digital out */ 42 42 CMI_AUTO, /* let driver guess it */ 43 CMI_MODELS 43 44 }; 44 45 … … 604 605 */ 605 606 606 static struct hda_board_config cmi9880_cfg_tbl[] = { 607 { .modelname = "minimal", .config = CMI_MINIMAL }, 608 { .modelname = "min_fp", .config = CMI_MIN_FP }, 609 { .modelname = "full", .config = CMI_FULL }, 610 { .modelname = "full_dig", .config = CMI_FULL_DIG }, 611 { .pci_subvendor = 0x1043, .pci_subdevice = 0x813d, .config = CMI_FULL_DIG }, /* ASUS P5AD2 */ 612 { .modelname = "allout", .config = CMI_ALLOUT }, 613 { .modelname = "auto", .config = CMI_AUTO }, 607 static const char *cmi9880_models[CMI_MODELS] = { 608 [CMI_MINIMAL] = "minimal", 609 [CMI_MIN_FP] = "min_fp", 610 [CMI_FULL] = "full", 611 [CMI_FULL_DIG] = "full_dig", 612 [CMI_ALLOUT] = "allout", 613 [CMI_AUTO] = "auto", 614 }; 615 616 static struct snd_pci_quirk cmi9880_cfg_tbl[] = { 617 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", CMI_FULL_DIG), 614 618 {0} /* terminator */ 615 619 }; … … 634 638 635 639 codec->spec = spec; 636 spec->board_config = snd_hda_check_board_config(codec, cmi9880_cfg_tbl); 640 spec->board_config = snd_hda_check_board_config(codec, CMI_MODELS, 641 cmi9880_models, 642 cmi9880_cfg_tbl); 637 643 if (spec->board_config < 0) { 638 644 snd_printdd(KERN_INFO "hda_codec: Unknown model for CMI9880\n"); -
GPL/trunk/alsa-kernel/pci/hda/patch_realtek.c
r77 r86 33 33 #include "hda_local.h" 34 34 35 #define ALC880_FRONT_EVENT 0x01 36 #define ALC880_DCVOL_EVENT 0x02 37 #define ALC880_HP_EVENT 0x04 38 #define ALC880_MIC_EVENT 0x08 35 39 36 40 /* ALC880 board config type */ 37 41 enum { 38 ALC880_3ST, 39 ALC880_3ST_DIG, 40 ALC880_5ST, 41 ALC880_5ST_DIG, 42 ALC880_W810, 43 ALC880_Z71V, 44 ALC880_6ST, 45 ALC880_6ST_DIG, 46 ALC880_F1734, 47 ALC880_ASUS, 48 ALC880_ASUS_DIG, 49 ALC880_ASUS_W1V, 50 ALC880_ASUS_DIG2, 51 ALC880_UNIWILL_DIG, 52 ALC880_CLEVO, 53 ALC880_TCL_S700, 54 ALC880_LG, 55 ALC880_LG_LW, 42 ALC880_3ST, 43 ALC880_3ST_DIG, 44 ALC880_5ST, 45 ALC880_5ST_DIG, 46 ALC880_W810, 47 ALC880_Z71V, 48 ALC880_6ST, 49 ALC880_6ST_DIG, 50 ALC880_F1734, 51 ALC880_ASUS, 52 ALC880_ASUS_DIG, 53 ALC880_ASUS_W1V, 54 ALC880_ASUS_DIG2, 55 ALC880_UNIWILL_DIG, 56 ALC880_UNIWILL, 57 ALC880_UNIWILL_P53, 58 ALC880_CLEVO, 59 ALC880_TCL_S700, 60 ALC880_LG, 61 ALC880_LG_LW, 56 62 #ifdef CONFIG_SND_DEBUG 57 63 ALC880_TEST, 58 64 #endif 59 60 65 ALC880_AUTO, 66 ALC880_MODEL_LAST /* last tag */ 61 67 }; 62 68 63 69 /* ALC260 models */ 64 70 enum { 65 66 67 68 69 71 ALC260_BASIC, 72 ALC260_HP, 73 ALC260_HP_3013, 74 ALC260_FUJITSU_S702X, 75 ALC260_ACER, 70 76 #ifdef CONFIG_SND_DEBUG 71 77 ALC260_TEST, 72 78 #endif 73 74 79 ALC260_AUTO, 80 ALC260_MODEL_LAST /* last tag */ 75 81 }; 76 82 77 83 /* ALC262 models */ 78 84 enum { 79 ALC262_BASIC, 80 ALC262_FUJITSU, 81 ALC262_HP_BPC, 82 ALC262_AUTO, 83 ALC262_MODEL_LAST /* last tag */ 85 ALC262_BASIC, 86 ALC262_HIPPO, 87 ALC262_HIPPO_1, 88 ALC262_FUJITSU, 89 ALC262_HP_BPC, 90 ALC262_BENQ_ED8, 91 ALC262_AUTO, 92 ALC262_MODEL_LAST /* last tag */ 84 93 }; 85 94 86 95 /* ALC861 models */ 87 96 enum { 88 ALC861_3ST, 89 ALC660_3ST, 90 ALC861_3ST_DIG, 91 ALC861_6ST_DIG, 92 ALC861_AUTO, 93 ALC861_MODEL_LAST, 97 ALC861_3ST, 98 ALC660_3ST, 99 ALC861_3ST_DIG, 100 ALC861_6ST_DIG, 101 ALC861_UNIWILL_M31, 102 ALC861_TOSHIBA, 103 ALC861_ASUS, 104 ALC861_ASUS_LAPTOP, 105 ALC861_AUTO, 106 ALC861_MODEL_LAST, 94 107 }; 95 108 96 109 /* ALC882 models */ 97 110 enum { 98 ALC882_3ST_DIG, 99 ALC882_6ST_DIG, 100 ALC882_AUTO, 101 ALC882_MODEL_LAST, 111 ALC882_3ST_DIG, 112 ALC882_6ST_DIG, 113 ALC882_ARIMA, 114 ALC882_AUTO, 115 ALC885_MACPRO, 116 ALC882_MODEL_LAST, 102 117 }; 103 118 104 119 /* ALC883 models */ 105 120 enum { 106 ALC883_3ST_2ch_DIG, 107 ALC883_3ST_6ch_DIG, 108 ALC883_3ST_6ch, 109 ALC883_6ST_DIG, 110 ALC888_DEMO_BOARD, 111 ALC883_AUTO, 112 ALC883_MODEL_LAST, 121 ALC883_3ST_2ch_DIG, 122 ALC883_3ST_6ch_DIG, 123 ALC883_3ST_6ch, 124 ALC883_6ST_DIG, 125 ALC883_TARGA_DIG, 126 ALC883_TARGA_2ch_DIG, 127 ALC888_DEMO_BOARD, 128 ALC883_ACER, 129 ALC883_MEDION, 130 ALC883_LAPTOP_EAPD, 131 ALC883_AUTO, 132 ALC883_MODEL_LAST, 113 133 }; 114 134 … … 117 137 118 138 struct alc_spec { 119 /* codec parameterization */ 120 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 121 unsigned int num_mixers; 122 123 const struct hda_verb *init_verbs[5]; /* initialization verbs 124 * don't forget NULL 125 * termination! 126 */ 127 unsigned int num_init_verbs; 128 129 char *stream_name_analog; /* analog PCM stream */ 130 struct hda_pcm_stream *stream_analog_playback; 131 struct hda_pcm_stream *stream_analog_capture; 132 133 char *stream_name_digital; /* digital PCM stream */ 134 struct hda_pcm_stream *stream_digital_playback; 135 struct hda_pcm_stream *stream_digital_capture; 136 137 /* playback */ 138 struct hda_multi_out multiout; /* playback set-up 139 * max_channels, dacs must be set 140 * dig_out_nid and hp_nid are optional 141 */ 142 143 /* capture */ 144 unsigned int num_adc_nids; 145 hda_nid_t *adc_nids; 146 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 147 148 /* capture source */ 149 const struct hda_input_mux *input_mux; 150 unsigned int cur_mux[3]; 151 152 /* channel model */ 153 const struct hda_channel_mode *channel_mode; 154 int num_channel_mode; 155 156 /* PCM information */ 157 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ 158 159 /* dynamic controls, init_verbs and input_mux */ 160 struct auto_pin_cfg autocfg; 161 unsigned int num_kctl_alloc, num_kctl_used; 162 struct snd_kcontrol_new *kctl_alloc; 163 struct hda_input_mux private_imux; 164 hda_nid_t private_dac_nids[5]; 165 166 /* hooks */ 167 void (*init_hook)(struct hda_codec *codec); 168 void (*unsol_event)(struct hda_codec *codec, unsigned int res); 169 170 /* for pin sensing */ 171 unsigned int sense_updated: 1; 172 unsigned int jack_present: 1; 139 /* codec parameterization */ 140 struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ 141 unsigned int num_mixers; 142 143 const struct hda_verb *init_verbs[5]; /* initialization verbs 144 * don't forget NULL 145 * termination! 146 */ 147 unsigned int num_init_verbs; 148 149 char *stream_name_analog; /* analog PCM stream */ 150 struct hda_pcm_stream *stream_analog_playback; 151 struct hda_pcm_stream *stream_analog_capture; 152 153 char *stream_name_digital; /* digital PCM stream */ 154 struct hda_pcm_stream *stream_digital_playback; 155 struct hda_pcm_stream *stream_digital_capture; 156 157 /* playback */ 158 struct hda_multi_out multiout; /* playback set-up 159 * max_channels, dacs must be set 160 * dig_out_nid and hp_nid are optional 161 */ 162 163 /* capture */ 164 unsigned int num_adc_nids; 165 hda_nid_t *adc_nids; 166 hda_nid_t dig_in_nid; /* digital-in NID; optional */ 167 168 /* capture source */ 169 unsigned int num_mux_defs; 170 const struct hda_input_mux *input_mux; 171 unsigned int cur_mux[3]; 172 173 /* channel model */ 174 const struct hda_channel_mode *channel_mode; 175 int num_channel_mode; 176 int need_dac_fix; 177 178 /* PCM information */ 179 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ 180 181 /* dynamic controls, init_verbs and input_mux */ 182 struct auto_pin_cfg autocfg; 183 unsigned int num_kctl_alloc, num_kctl_used; 184 struct snd_kcontrol_new *kctl_alloc; 185 struct hda_input_mux private_imux; 186 hda_nid_t private_dac_nids[5]; 187 188 /* hooks */ 189 void (*init_hook)(struct hda_codec *codec); 190 void (*unsol_event)(struct hda_codec *codec, unsigned int res); 191 192 /* for pin sensing */ 193 unsigned int sense_updated: 1; 194 unsigned int jack_present: 1; 173 195 }; 174 196 … … 177 199 */ 178 200 struct alc_config_preset { 179 struct snd_kcontrol_new *mixers[5]; /* should be identical size with spec */ 180 const struct hda_verb *init_verbs[5]; 181 unsigned int num_dacs; 182 hda_nid_t *dac_nids; 183 hda_nid_t dig_out_nid; /* optional */ 184 hda_nid_t hp_nid; /* optional */ 185 unsigned int num_adc_nids; 186 hda_nid_t *adc_nids; 187 hda_nid_t dig_in_nid; 188 unsigned int num_channel_mode; 189 const struct hda_channel_mode *channel_mode; 190 const struct hda_input_mux *input_mux; 191 void (*unsol_event)(struct hda_codec *, unsigned int); 192 void (*init_hook)(struct hda_codec *); 201 struct snd_kcontrol_new *mixers[5]; /* should be identical size 202 * with spec 203 */ 204 const struct hda_verb *init_verbs[5]; 205 unsigned int num_dacs; 206 hda_nid_t *dac_nids; 207 hda_nid_t dig_out_nid; /* optional */ 208 hda_nid_t hp_nid; /* optional */ 209 unsigned int num_adc_nids; 210 hda_nid_t *adc_nids; 211 hda_nid_t dig_in_nid; 212 unsigned int num_channel_mode; 213 const struct hda_channel_mode *channel_mode; 214 int need_dac_fix; 215 unsigned int num_mux_defs; 216 const struct hda_input_mux *input_mux; 217 void (*unsol_event)(struct hda_codec *, unsigned int); 218 void (*init_hook)(struct hda_codec *); 193 219 }; 194 220 … … 197 223 * input MUX handling 198 224 */ 199 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 200 { 201 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 202 struct alc_spec *spec = codec->spec; 203 return snd_hda_input_mux_info(spec->input_mux, uinfo); 204 } 205 206 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 207 { 208 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 209 struct alc_spec *spec = codec->spec; 210 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 211 212 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; 213 return 0; 214 } 215 216 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 217 { 218 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 219 struct alc_spec *spec = codec->spec; 220 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 221 return snd_hda_input_mux_put(codec, spec->input_mux, ucontrol, 222 spec->adc_nids[adc_idx], &spec->cur_mux[adc_idx]); 225 static int alc_mux_enum_info(struct snd_kcontrol *kcontrol, 226 struct snd_ctl_elem_info *uinfo) 227 { 228 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 229 struct alc_spec *spec = codec->spec; 230 unsigned int mux_idx = snd_ctl_get_ioffidx(kcontrol, &uinfo->id); 231 if (mux_idx >= spec->num_mux_defs) 232 mux_idx = 0; 233 return snd_hda_input_mux_info(&spec->input_mux[mux_idx], uinfo); 234 } 235 236 static int alc_mux_enum_get(struct snd_kcontrol *kcontrol, 237 struct snd_ctl_elem_value *ucontrol) 238 { 239 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 240 struct alc_spec *spec = codec->spec; 241 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 242 243 ucontrol->value.enumerated.item[0] = spec->cur_mux[adc_idx]; 244 return 0; 245 } 246 247 static int alc_mux_enum_put(struct snd_kcontrol *kcontrol, 248 struct snd_ctl_elem_value *ucontrol) 249 { 250 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 251 struct alc_spec *spec = codec->spec; 252 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 253 unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 254 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], ucontrol, 255 spec->adc_nids[adc_idx], 256 &spec->cur_mux[adc_idx]); 223 257 } 224 258 … … 227 261 * channel mode setting 228 262 */ 229 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 230 { 231 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 232 struct alc_spec *spec = codec->spec; 233 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, 234 spec->num_channel_mode); 263 static int alc_ch_mode_info(struct snd_kcontrol *kcontrol, 264 struct snd_ctl_elem_info *uinfo) 265 { 266 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 267 struct alc_spec *spec = codec->spec; 268 return snd_hda_ch_mode_info(codec, uinfo, spec->channel_mode, 269 spec->num_channel_mode); 235 270 } 236 271 237 272 static int alc_ch_mode_get(struct snd_kcontrol *kcontrol, 238 239 { 240 241 242 243 244 273 struct snd_ctl_elem_value *ucontrol) 274 { 275 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 276 struct alc_spec *spec = codec->spec; 277 return snd_hda_ch_mode_get(codec, ucontrol, spec->channel_mode, 278 spec->num_channel_mode, 279 spec->multiout.max_channels); 245 280 } 246 281 247 282 static int alc_ch_mode_put(struct snd_kcontrol *kcontrol, 248 struct snd_ctl_elem_value *ucontrol) 249 { 250 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 251 struct alc_spec *spec = codec->spec; 252 return snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, 253 spec->num_channel_mode, 254 &spec->multiout.max_channels); 283 struct snd_ctl_elem_value *ucontrol) 284 { 285 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 286 struct alc_spec *spec = codec->spec; 287 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, 288 spec->num_channel_mode, 289 &spec->multiout.max_channels); 290 if (err >= 0 && spec->need_dac_fix) 291 spec->multiout.num_dacs = spec->multiout.max_channels / 2; 292 return err; 255 293 } 256 294 257 295 /* 258 296 * Control the mode of pin widget settings via the mixer. "pc" is used 259 * instead of "%" to avoid consequences of accidently treating the % as 297 * instead of "%" to avoid consequences of accidently treating the % as 260 298 * being part of a format specifier. Maximum allowed length of a value is 261 299 * 63 characters plus NULL terminator. … … 265 303 * are requested. Therefore order this list so that this behaviour will not 266 304 * cause problems when mixer clients move through the enum sequentially. 267 * NIDs 0x0f and 0x10 have been observed to have this behaviour. 305 * NIDs 0x0f and 0x10 have been observed to have this behaviour as of 306 * March 2006. 268 307 */ 269 308 static char *alc_pin_mode_names[] = { 270 271 309 "Mic 50pc bias", "Mic 80pc bias", 310 "Line in", "Line out", "Headphone out", 272 311 }; 273 312 static unsigned char alc_pin_mode_values[] = { 274 313 PIN_VREF50, PIN_VREF80, PIN_IN, PIN_OUT, PIN_HP, 275 314 }; 276 315 /* The control can present all 5 options, or it can limit the options based 277 * in the pin being assumed to be exclusively an input or an output pin. 278 */ 279 #define ALC_PIN_DIR_IN 0x00 280 #define ALC_PIN_DIR_OUT 0x01 281 #define ALC_PIN_DIR_INOUT 0x02 282 283 /* Info about the pin modes supported by the three different pin directions. 316 * in the pin being assumed to be exclusively an input or an output pin. In 317 * addition, "input" pins may or may not process the mic bias option 318 * depending on actual widget capability (NIDs 0x0f and 0x10 don't seem to 319 * accept requests for bias as of chip versions up to March 2006) and/or 320 * wiring in the computer. 321 */ 322 #define ALC_PIN_DIR_IN 0x00 323 #define ALC_PIN_DIR_OUT 0x01 324 #define ALC_PIN_DIR_INOUT 0x02 325 #define ALC_PIN_DIR_IN_NOMICBIAS 0x03 326 #define ALC_PIN_DIR_INOUT_NOMICBIAS 0x04 327 328 /* Info about the pin modes supported by the different pin direction modes. 284 329 * For each direction the minimum and maximum values are given. 285 330 */ 286 static signed char alc_pin_mode_dir_info[3][2] = { 287 { 0, 2 }, /* ALC_PIN_DIR_IN */ 288 { 3, 4 }, /* ALC_PIN_DIR_OUT */ 289 { 0, 4 }, /* ALC_PIN_DIR_INOUT */ 331 static signed char alc_pin_mode_dir_info[5][2] = { 332 { 0, 2 }, /* ALC_PIN_DIR_IN */ 333 { 3, 4 }, /* ALC_PIN_DIR_OUT */ 334 { 0, 4 }, /* ALC_PIN_DIR_INOUT */ 335 { 2, 2 }, /* ALC_PIN_DIR_IN_NOMICBIAS */ 336 { 2, 4 }, /* ALC_PIN_DIR_INOUT_NOMICBIAS */ 290 337 }; 291 338 #define alc_pin_mode_min(_dir) (alc_pin_mode_dir_info[_dir][0]) 292 339 #define alc_pin_mode_max(_dir) (alc_pin_mode_dir_info[_dir][1]) 293 340 #define alc_pin_mode_n_items(_dir) \ 294 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) 295 296 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 297 { 298 unsigned int item_num = uinfo->value.enumerated.item; 299 unsigned char dir = (kcontrol->private_value >> 16) & 0xff; 300 301 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 302 uinfo->count = 1; 303 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); 304 305 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) 306 item_num = alc_pin_mode_min(dir); 307 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); 308 return 0; 309 } 310 311 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 312 { 313 unsigned int i; 314 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 315 hda_nid_t nid = kcontrol->private_value & 0xffff; 316 unsigned char dir = (kcontrol->private_value >> 16) & 0xff; 317 long *valp = ucontrol->value.integer.value; 318 unsigned int pinctl = snd_hda_codec_read(codec,nid,0,AC_VERB_GET_PIN_WIDGET_CONTROL,0x00); 319 320 /* Find enumerated value for current pinctl setting */ 321 i = alc_pin_mode_min(dir); 322 while (alc_pin_mode_values[i]!=pinctl && i<=alc_pin_mode_max(dir)) 323 i++; 324 *valp = i<=alc_pin_mode_max(dir)?i:alc_pin_mode_min(dir); 325 return 0; 326 } 327 328 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 329 { 330 signed int change; 331 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 332 hda_nid_t nid = kcontrol->private_value & 0xffff; 333 unsigned char dir = (kcontrol->private_value >> 16) & 0xff; 334 long val = *ucontrol->value.integer.value; 335 unsigned int pinctl = snd_hda_codec_read(codec,nid,0,AC_VERB_GET_PIN_WIDGET_CONTROL,0x00); 336 337 if (val<alc_pin_mode_min(dir) || val>alc_pin_mode_max(dir)) 338 val = alc_pin_mode_min(dir); 339 340 change = pinctl != alc_pin_mode_values[val]; 341 if (change) { 342 /* Set pin mode to that requested */ 343 snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL, 344 alc_pin_mode_values[val]); 345 346 /* Also enable the retasking pin's input/output as required 347 * for the requested pin mode. Enum values of 2 or less are 348 * input modes. 349 * 350 * Dynamically switching the input/output buffers probably 351 * reduces noise slightly, particularly on input. However, 352 * havingboth input and output buffers enabled 353 * simultaneously doesn't seem to be problematic. 354 */ 355 if (val <= 2) { 356 snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, 357 AMP_OUT_MUTE); 358 snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, 359 AMP_IN_UNMUTE(0)); 360 } else { 361 snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, 362 AMP_IN_MUTE(0)); 363 snd_hda_codec_write(codec,nid,0,AC_VERB_SET_AMP_GAIN_MUTE, 364 AMP_OUT_UNMUTE); 365 } 366 } 367 return change; 341 (alc_pin_mode_max(_dir)-alc_pin_mode_min(_dir)+1) 342 343 static int alc_pin_mode_info(struct snd_kcontrol *kcontrol, 344 struct snd_ctl_elem_info *uinfo) 345 { 346 unsigned int item_num = uinfo->value.enumerated.item; 347 unsigned char dir = (kcontrol->private_value >> 16) & 0xff; 348 349 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 350 uinfo->count = 1; 351 uinfo->value.enumerated.items = alc_pin_mode_n_items(dir); 352 353 if (item_num<alc_pin_mode_min(dir) || item_num>alc_pin_mode_max(dir)) 354 item_num = alc_pin_mode_min(dir); 355 strcpy(uinfo->value.enumerated.name, alc_pin_mode_names[item_num]); 356 return 0; 357 } 358 359 static int alc_pin_mode_get(struct snd_kcontrol *kcontrol, 360 struct snd_ctl_elem_value *ucontrol) 361 { 362 unsigned int i; 363 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 364 hda_nid_t nid = kcontrol->private_value & 0xffff; 365 unsigned char dir = (kcontrol->private_value >> 16) & 0xff; 366 long *valp = ucontrol->value.integer.value; 367 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, 368 AC_VERB_GET_PIN_WIDGET_CONTROL, 369 0x00); 370 371 /* Find enumerated value for current pinctl setting */ 372 i = alc_pin_mode_min(dir); 373 while (alc_pin_mode_values[i] != pinctl && i <= alc_pin_mode_max(dir)) 374 i++; 375 *valp = i <= alc_pin_mode_max(dir) ? i: alc_pin_mode_min(dir); 376 return 0; 377 } 378 379 static int alc_pin_mode_put(struct snd_kcontrol *kcontrol, 380 struct snd_ctl_elem_value *ucontrol) 381 { 382 signed int change; 383 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 384 hda_nid_t nid = kcontrol->private_value & 0xffff; 385 unsigned char dir = (kcontrol->private_value >> 16) & 0xff; 386 long val = *ucontrol->value.integer.value; 387 unsigned int pinctl = snd_hda_codec_read(codec, nid, 0, 388 AC_VERB_GET_PIN_WIDGET_CONTROL, 389 0x00); 390 391 if (val < alc_pin_mode_min(dir) || val > alc_pin_mode_max(dir)) 392 val = alc_pin_mode_min(dir); 393 394 change = pinctl != alc_pin_mode_values[val]; 395 if (change) { 396 /* Set pin mode to that requested */ 397 snd_hda_codec_write(codec,nid,0,AC_VERB_SET_PIN_WIDGET_CONTROL, 398 alc_pin_mode_values[val]); 399 400 /* Also enable the retasking pin's input/output as required 401 * for the requested pin mode. Enum values of 2 or less are 402 * input modes. 403 * 404 * Dynamically switching the input/output buffers probably 405 * reduces noise slightly (particularly on input) so we'll 406 * do it. However, having both input and output buffers 407 * enabled simultaneously doesn't seem to be problematic if 408 * this turns out to be necessary in the future. 409 */ 410 if (val <= 2) { 411 snd_hda_codec_write(codec, nid, 0, 412 AC_VERB_SET_AMP_GAIN_MUTE, 413 AMP_OUT_MUTE); 414 snd_hda_codec_write(codec, nid, 0, 415 AC_VERB_SET_AMP_GAIN_MUTE, 416 AMP_IN_UNMUTE(0)); 417 } else { 418 snd_hda_codec_write(codec, nid, 0, 419 AC_VERB_SET_AMP_GAIN_MUTE, 420 AMP_IN_MUTE(0)); 421 snd_hda_codec_write(codec, nid, 0, 422 AC_VERB_SET_AMP_GAIN_MUTE, 423 AMP_OUT_UNMUTE); 424 } 425 } 426 return change; 368 427 } 369 428 370 429 #define ALC_PIN_MODE(xname, nid, dir) \ 371 372 373 374 375 430 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ 431 .info = alc_pin_mode_info, \ 432 .get = alc_pin_mode_get, \ 433 .put = alc_pin_mode_put, \ 434 .private_value = nid | (dir<<16) } 376 435 377 436 /* A switch control for ALC260 GPIO pins. Multiple GPIOs can be ganged … … 381 440 */ 382 441 #ifdef CONFIG_SND_DEBUG 383 static int alc_gpio_data_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 384 { 385 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 386 uinfo->count = 1; 387 uinfo->value.integer.min = 0; 388 uinfo->value.integer.max = 1; 389 return 0; 390 } 391 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 392 { 393 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 394 hda_nid_t nid = kcontrol->private_value & 0xffff; 395 unsigned char mask = (kcontrol->private_value >> 16) & 0xff; 396 long *valp = ucontrol->value.integer.value; 397 unsigned int val = snd_hda_codec_read(codec,nid,0,AC_VERB_GET_GPIO_DATA,0x00); 398 399 *valp = (val & mask) != 0; 400 return 0; 401 } 402 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 403 { 404 signed int change; 405 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 406 hda_nid_t nid = kcontrol->private_value & 0xffff; 407 unsigned char mask = (kcontrol->private_value >> 16) & 0xff; 408 long val = *ucontrol->value.integer.value; 409 unsigned int gpio_data = snd_hda_codec_read(codec,nid,0,AC_VERB_GET_GPIO_DATA,0x00); 410 411 /* Set/unset the masked GPIO bit(s) as needed */ 412 change = (val==0?0:mask) != (gpio_data & mask); 413 if (val==0) 414 gpio_data &= ~mask; 415 else 416 gpio_data |= mask; 417 snd_hda_codec_write(codec,nid,0,AC_VERB_SET_GPIO_DATA,gpio_data); 418 419 return change; 442 static int alc_gpio_data_info(struct snd_kcontrol *kcontrol, 443 struct snd_ctl_elem_info *uinfo) 444 { 445 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 446 uinfo->count = 1; 447 uinfo->value.integer.min = 0; 448 uinfo->value.integer.max = 1; 449 return 0; 450 } 451 static int alc_gpio_data_get(struct snd_kcontrol *kcontrol, 452 struct snd_ctl_elem_value *ucontrol) 453 { 454 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 455 hda_nid_t nid = kcontrol->private_value & 0xffff; 456 unsigned char mask = (kcontrol->private_value >> 16) & 0xff; 457 long *valp = ucontrol->value.integer.value; 458 unsigned int val = snd_hda_codec_read(codec, nid, 0, 459 AC_VERB_GET_GPIO_DATA, 0x00); 460 461 *valp = (val & mask) != 0; 462 return 0; 463 } 464 static int alc_gpio_data_put(struct snd_kcontrol *kcontrol, 465 struct snd_ctl_elem_value *ucontrol) 466 { 467 signed int change; 468 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 469 hda_nid_t nid = kcontrol->private_value & 0xffff; 470 unsigned char mask = (kcontrol->private_value >> 16) & 0xff; 471 long val = *ucontrol->value.integer.value; 472 unsigned int gpio_data = snd_hda_codec_read(codec, nid, 0, 473 AC_VERB_GET_GPIO_DATA, 474 0x00); 475 476 /* Set/unset the masked GPIO bit(s) as needed */ 477 change = (val == 0 ? 0 : mask) != (gpio_data & mask); 478 if (val == 0) 479 gpio_data &= ~mask; 480 else 481 gpio_data |= mask; 482 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_GPIO_DATA, gpio_data); 483 484 return change; 420 485 } 421 486 #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \ 422 423 424 425 426 487 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ 488 .info = alc_gpio_data_info, \ 489 .get = alc_gpio_data_get, \ 490 .put = alc_gpio_data_put, \ 491 .private_value = nid | (mask<<16) } 427 492 #endif /* CONFIG_SND_DEBUG */ 428 493 … … 435 500 */ 436 501 #ifdef CONFIG_SND_DEBUG 437 static int alc_spdif_ctrl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 438 { 439 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 440 uinfo->count = 1; 441 uinfo->value.integer.min = 0; 442 uinfo->value.integer.max = 1; 443 return 0; 444 } 445 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 446 { 447 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 448 hda_nid_t nid = kcontrol->private_value & 0xffff; 449 unsigned char mask = (kcontrol->private_value >> 16) & 0xff; 450 long *valp = ucontrol->value.integer.value; 451 unsigned int val = snd_hda_codec_read(codec,nid,0,AC_VERB_GET_DIGI_CONVERT,0x00); 452 453 *valp = (val & mask) != 0; 454 return 0; 455 } 456 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 457 { 458 signed int change; 459 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 460 hda_nid_t nid = kcontrol->private_value & 0xffff; 461 unsigned char mask = (kcontrol->private_value >> 16) & 0xff; 462 long val = *ucontrol->value.integer.value; 463 unsigned int ctrl_data = snd_hda_codec_read(codec,nid,0,AC_VERB_GET_DIGI_CONVERT,0x00); 464 465 /* Set/unset the masked control bit(s) as needed */ 466 change = (val==0?0:mask) != (ctrl_data & mask); 467 if (val==0) 468 ctrl_data &= ~mask; 469 else 470 ctrl_data |= mask; 471 snd_hda_codec_write(codec,nid,0,AC_VERB_SET_DIGI_CONVERT_1,ctrl_data); 472 473 return change; 502 static int alc_spdif_ctrl_info(struct snd_kcontrol *kcontrol, 503 struct snd_ctl_elem_info *uinfo) 504 { 505 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 506 uinfo->count = 1; 507 uinfo->value.integer.min = 0; 508 uinfo->value.integer.max = 1; 509 return 0; 510 } 511 static int alc_spdif_ctrl_get(struct snd_kcontrol *kcontrol, 512 struct snd_ctl_elem_value *ucontrol) 513 { 514 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 515 hda_nid_t nid = kcontrol->private_value & 0xffff; 516 unsigned char mask = (kcontrol->private_value >> 16) & 0xff; 517 long *valp = ucontrol->value.integer.value; 518 unsigned int val = snd_hda_codec_read(codec, nid, 0, 519 AC_VERB_GET_DIGI_CONVERT, 0x00); 520 521 *valp = (val & mask) != 0; 522 return 0; 523 } 524 static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol, 525 struct snd_ctl_elem_value *ucontrol) 526 { 527 signed int change; 528 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 529 hda_nid_t nid = kcontrol->private_value & 0xffff; 530 unsigned char mask = (kcontrol->private_value >> 16) & 0xff; 531 long val = *ucontrol->value.integer.value; 532 unsigned int ctrl_data = snd_hda_codec_read(codec, nid, 0, 533 AC_VERB_GET_DIGI_CONVERT, 534 0x00); 535 536 /* Set/unset the masked control bit(s) as needed */ 537 change = (val == 0 ? 0 : mask) != (ctrl_data & mask); 538 if (val==0) 539 ctrl_data &= ~mask; 540 else 541 ctrl_data |= mask; 542 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_DIGI_CONVERT_1, 543 ctrl_data); 544 545 return change; 474 546 } 475 547 #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \ 476 477 478 479 480 548 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ 549 .info = alc_spdif_ctrl_info, \ 550 .get = alc_spdif_ctrl_get, \ 551 .put = alc_spdif_ctrl_put, \ 552 .private_value = nid | (mask<<16) } 481 553 #endif /* CONFIG_SND_DEBUG */ 482 554 … … 484 556 * set up from the preset table 485 557 */ 486 static void setup_preset(struct alc_spec *spec, const struct alc_config_preset *preset) 487 { 488 int i; 489 490 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) 491 spec->mixers[spec->num_mixers++] = preset->mixers[i]; 492 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; i++) 493 spec->init_verbs[spec->num_init_verbs++] = preset->init_verbs[i]; 494 495 spec->channel_mode = preset->channel_mode; 496 spec->num_channel_mode = preset->num_channel_mode; 497 498 spec->multiout.max_channels = spec->channel_mode[0].channels; 499 500 spec->multiout.num_dacs = preset->num_dacs; 501 spec->multiout.dac_nids = preset->dac_nids; 502 spec->multiout.dig_out_nid = preset->dig_out_nid; 503 spec->multiout.hp_nid = preset->hp_nid; 504 505 spec->input_mux = preset->input_mux; 506 507 spec->num_adc_nids = preset->num_adc_nids; 508 spec->adc_nids = preset->adc_nids; 509 spec->dig_in_nid = preset->dig_in_nid; 510 spec->unsol_event = preset->unsol_event; 511 spec->init_hook = preset->init_hook; 558 static void setup_preset(struct alc_spec *spec, 559 const struct alc_config_preset *preset) 560 { 561 int i; 562 563 for (i = 0; i < ARRAY_SIZE(preset->mixers) && preset->mixers[i]; i++) 564 spec->mixers[spec->num_mixers++] = preset->mixers[i]; 565 for (i = 0; i < ARRAY_SIZE(preset->init_verbs) && preset->init_verbs[i]; 566 i++) 567 spec->init_verbs[spec->num_init_verbs++] = 568 preset->init_verbs[i]; 569 570 spec->channel_mode = preset->channel_mode; 571 spec->num_channel_mode = preset->num_channel_mode; 572 spec->need_dac_fix = preset->need_dac_fix; 573 574 spec->multiout.max_channels = spec->channel_mode[0].channels; 575 576 spec->multiout.num_dacs = preset->num_dacs; 577 spec->multiout.dac_nids = preset->dac_nids; 578 spec->multiout.dig_out_nid = preset->dig_out_nid; 579 spec->multiout.hp_nid = preset->hp_nid; 580 581 spec->num_mux_defs = preset->num_mux_defs; 582 if (! spec->num_mux_defs) 583 spec->num_mux_defs = 1; 584 spec->input_mux = preset->input_mux; 585 586 spec->num_adc_nids = preset->num_adc_nids; 587 spec->adc_nids = preset->adc_nids; 588 spec->dig_in_nid = preset->dig_in_nid; 589 590 spec->unsol_event = preset->unsol_event; 591 spec->init_hook = preset->init_hook; 512 592 } 513 593 … … 516 596 * 517 597 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e) 518 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, F-Mic = 0x1b519 * HP = 0x19598 * Pin assignment: Front = 0x14, Line-In/Surr = 0x1a, Mic/CLFE = 0x18, 599 * F-Mic = 0x1b, HP = 0x19 520 600 */ 521 601 522 602 static hda_nid_t alc880_dac_nids[4] = { 523 524 603 /* front, rear, clfe, rear_surr */ 604 0x02, 0x05, 0x04, 0x03 525 605 }; 526 606 527 607 static hda_nid_t alc880_adc_nids[3] = { 528 529 608 /* ADC0-2 */ 609 0x07, 0x08, 0x09, 530 610 }; 531 611 … … 535 615 */ 536 616 static hda_nid_t alc880_adc_nids_alt[2] = { 537 538 617 /* ADC1-2 */ 618 0x08, 0x09, 539 619 }; 540 620 … … 543 623 544 624 static struct hda_input_mux alc880_capture_source = { 545 546 547 548 549 550 551 625 .num_items = 4, 626 .items = { 627 { "Mic", 0x0 }, 628 { "Front Mic", 0x3 }, 629 { "Line", 0x2 }, 630 { "CD", 0x4 }, 631 }, 552 632 }; 553 633 … … 555 635 /* 2ch mode */ 556 636 static struct hda_verb alc880_threestack_ch2_init[] = { 557 558 559 560 561 562 563 637 /* set line-in to input, mute it */ 638 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 639 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 640 /* set mic-in to input vref 80%, mute it */ 641 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 642 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 643 {0} /* end */ 564 644 }; 565 645 566 646 /* 6ch mode */ 567 647 static struct hda_verb alc880_threestack_ch6_init[] = { 568 569 570 571 572 573 574 648 /* set line-in to output, unmute it */ 649 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 650 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 651 /* set mic-in to output, unmute it */ 652 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 653 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 654 {0} /* end */ 575 655 }; 576 656 577 657 static struct hda_channel_mode alc880_threestack_modes[2] = { 578 579 658 { 2, alc880_threestack_ch2_init }, 659 { 6, alc880_threestack_ch6_init }, 580 660 }; 581 661 582 662 static struct snd_kcontrol_new alc880_three_stack_mixer[] = { 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 664 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 665 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 666 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT), 667 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 668 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 669 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 670 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 671 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 672 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 673 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 674 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 675 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 676 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 677 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x3, HDA_INPUT), 678 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x3, HDA_INPUT), 679 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 680 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 681 HDA_CODEC_MUTE("Headphone Playback Switch", 0x19, 0x0, HDA_OUTPUT), 682 { 683 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 684 .name = "Channel Mode", 685 .info = alc_ch_mode_info, 686 .get = alc_ch_mode_get, 687 .put = alc_ch_mode_put, 688 }, 689 {0} /* end */ 610 690 }; 611 691 612 692 /* capture mixer elements */ 613 693 static struct snd_kcontrol_new alc880_capture_mixer[] = { 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 694 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), 695 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), 696 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), 697 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), 698 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), 699 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), 700 { 701 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 702 /* The multiple "Capture Source" controls confuse alsamixer 703 * So call somewhat different.. 704 * FIXME: the controls appear in the "playback" view! 705 */ 706 /* .name = "Capture Source", */ 707 .name = "Input Source", 708 .count = 3, 709 .info = alc_mux_enum_info, 710 .get = alc_mux_enum_get, 711 .put = alc_mux_enum_put, 712 }, 713 {0} /* end */ 634 714 }; 635 715 636 716 /* capture mixer elements (in case NID 0x07 not available) */ 637 717 static struct snd_kcontrol_new alc880_capture_alt_mixer[] = { 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 718 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 719 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 720 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 721 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 722 { 723 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 724 /* The multiple "Capture Source" controls confuse alsamixer 725 * So call somewhat different.. 726 * FIXME: the controls appear in the "playback" view! 727 */ 728 /* .name = "Capture Source", */ 729 .name = "Input Source", 730 .count = 2, 731 .info = alc_mux_enum_info, 732 .get = alc_mux_enum_get, 733 .put = alc_mux_enum_put, 734 }, 735 {0} /* end */ 656 736 }; 657 737 … … 661 741 * ALC880 5-stack model 662 742 * 663 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), Side = 0x02 (0xd) 743 * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0d), 744 * Side = 0x02 (0xd) 664 745 * Pin assignment: Front = 0x14, Surr = 0x17, CLFE = 0x16 665 746 * Line-In/Side = 0x1a, Mic = 0x18, F-Mic = 0x1b, HP = 0x19 … … 668 749 /* additional mixers to alc880_three_stack_mixer */ 669 750 static struct snd_kcontrol_new alc880_five_stack_mixer[] = { 670 671 672 751 HDA_CODEC_VOLUME("Side Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 752 HDA_BIND_MUTE("Side Playback Switch", 0x0d, 2, HDA_INPUT), 753 {0} /* end */ 673 754 }; 674 755 … … 676 757 /* 6ch mode */ 677 758 static struct hda_verb alc880_fivestack_ch6_init[] = { 678 679 680 681 759 /* set line-in to input, mute it */ 760 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 761 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 762 {0} /* end */ 682 763 }; 683 764 684 765 /* 8ch mode */ 685 766 static struct hda_verb alc880_fivestack_ch8_init[] = { 686 687 688 689 767 /* set line-in to output, unmute it */ 768 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 769 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 770 {0} /* end */ 690 771 }; 691 772 692 773 static struct hda_channel_mode alc880_fivestack_modes[2] = { 693 694 774 { 6, alc880_fivestack_ch6_init }, 775 { 8, alc880_fivestack_ch8_init }, 695 776 }; 696 777 … … 699 780 * ALC880 6-stack model 700 781 * 701 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), Side = 0x05 (0x0f) 782 * DAC: Front = 0x02 (0x0c), Surr = 0x03 (0x0d), CLFE = 0x04 (0x0e), 783 * Side = 0x05 (0x0f) 702 784 * Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, Side = 0x17, 703 785 * Mic = 0x18, F-Mic = 0x19, Line = 0x1a, HP = 0x1b … … 705 787 706 788 static hda_nid_t alc880_6st_dac_nids[4] = { 707 708 709 }; 789 /* front, rear, clfe, rear_surr */ 790 0x02, 0x03, 0x04, 0x05 791 }; 710 792 711 793 static struct hda_input_mux alc880_6stack_capture_source = { 712 713 714 715 716 717 718 794 .num_items = 4, 795 .items = { 796 { "Mic", 0x0 }, 797 { "Front Mic", 0x1 }, 798 { "Line", 0x2 }, 799 { "CD", 0x4 }, 800 }, 719 801 }; 720 802 721 803 /* fixed 8-channels */ 722 804 static struct hda_channel_mode alc880_sixstack_modes[1] = { 723 805 { 8, NULL }, 724 806 }; 725 807 726 808 static struct snd_kcontrol_new alc880_six_stack_mixer[] = { 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 809 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 810 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 811 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 812 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 813 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 814 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 815 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 816 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 817 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 818 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 819 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 820 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 821 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 822 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 823 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 824 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 825 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 826 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 827 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 828 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 829 { 830 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 831 .name = "Channel Mode", 832 .info = alc_ch_mode_info, 833 .get = alc_ch_mode_get, 834 .put = alc_ch_mode_put, 835 }, 836 {0} /* end */ 755 837 }; 756 838 … … 767 849 * The system also has a pair of internal speakers, and a headphone jack. 768 850 * These are both connected to Line2 on the codec, hence to DAC 02. 769 * 851 * 770 852 * There is a variable resistor to control the speaker or headphone 771 853 * volume. This is a hardware-only device without a software API. … … 782 864 783 865 static hda_nid_t alc880_w810_dac_nids[3] = { 784 785 866 /* front, rear/surround, clfe */ 867 0x02, 0x03, 0x04 786 868 }; 787 869 788 870 /* fixed 6 channels */ 789 871 static struct hda_channel_mode alc880_w810_modes[1] = { 790 872 { 6, NULL } 791 873 }; 792 874 793 875 /* Pin assignment: Front = 0x14, Surr = 0x15, CLFE = 0x16, HP = 0x1b */ 794 876 static struct snd_kcontrol_new alc880_w810_base_mixer[] = { 795 796 797 798 799 800 801 802 803 804 877 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 878 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 879 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 880 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 881 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 882 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 883 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 884 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 885 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 886 {0} /* end */ 805 887 }; 806 888 … … 810 892 * 811 893 * DAC: Front = 0x02 (0x0c), HP = 0x03 (0x0d) 812 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), Line = 0x1a 894 * Pin assignment: Front = 0x14, HP = 0x15, Mic = 0x18, Mic2 = 0x19(?), 895 * Line = 0x1a 813 896 */ 814 897 815 898 static hda_nid_t alc880_z71v_dac_nids[1] = { 816 899 0x02 817 900 }; 818 901 #define ALC880_Z71V_HP_DAC 0x03 … … 820 903 /* fixed 2 channels */ 821 904 static struct hda_channel_mode alc880_2_jack_modes[1] = { 822 905 { 2, NULL } 823 906 }; 824 907 825 908 static struct snd_kcontrol_new alc880_z71v_mixer[] = { 826 827 828 829 830 831 832 833 834 909 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 910 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 911 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 912 HDA_BIND_MUTE("Headphone Playback Switch", 0x0d, 2, HDA_INPUT), 913 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 914 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 915 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 916 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 917 {0} /* end */ 835 918 }; 836 919 … … 845 928 846 929 static hda_nid_t alc880_f1734_dac_nids[1] = { 847 930 0x03 848 931 }; 849 932 #define ALC880_F1734_HP_DAC 0x02 850 933 851 934 static struct snd_kcontrol_new alc880_f1734_mixer[] = { 852 853 854 855 856 857 858 859 860 935 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 936 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT), 937 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 938 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x0d, 2, HDA_INPUT), 939 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 940 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 941 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 943 {0} /* end */ 861 944 }; 862 945 … … 875 958 876 959 static struct snd_kcontrol_new alc880_asus_mixer[] = { 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 960 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 961 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 962 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 963 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 964 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 965 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 966 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 967 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 968 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 969 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 970 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 971 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 972 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 974 { 975 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 976 .name = "Channel Mode", 977 .info = alc_ch_mode_info, 978 .get = alc_ch_mode_get, 979 .put = alc_ch_mode_put, 980 }, 981 {0} /* end */ 899 982 }; 900 983 … … 910 993 /* additional mixers to alc880_asus_mixer */ 911 994 static struct snd_kcontrol_new alc880_asus_w1v_mixer[] = { 912 913 914 995 HDA_CODEC_VOLUME("Line2 Playback Volume", 0x0b, 0x03, HDA_INPUT), 996 HDA_CODEC_MUTE("Line2 Playback Switch", 0x0b, 0x03, HDA_INPUT), 997 {0} /* end */ 915 998 }; 916 999 917 1000 /* additional mixers to alc880_asus_mixer */ 918 1001 static struct snd_kcontrol_new alc880_pcbeep_mixer[] = { 919 920 921 1002 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 1003 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 1004 {0} /* end */ 922 1005 }; 923 1006 924 1007 /* TCL S700 */ 925 1008 static struct snd_kcontrol_new alc880_tcl_s700_mixer[] = { 926 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 927 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 928 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 929 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), 930 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), 931 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), 932 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), 933 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 934 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 935 { 936 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 937 /* The multiple "Capture Source" controls confuse alsamixer 938 * So call somewhat different.. 939 * FIXME: the controls appear in the "playback" view! 940 */ 941 /* .name = "Capture Source", */ 942 .name = "Input Source", 943 .count = 1, 944 .info = alc_mux_enum_info, 945 .get = alc_mux_enum_get, 946 .put = alc_mux_enum_put, 947 }, 948 {0} /* end */ 1009 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 1010 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 1011 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 1012 HDA_CODEC_VOLUME("CD Playback Volume", 0x0B, 0x04, HDA_INPUT), 1013 HDA_CODEC_MUTE("CD Playback Switch", 0x0B, 0x04, HDA_INPUT), 1014 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0B, 0x0, HDA_INPUT), 1015 HDA_CODEC_MUTE("Mic Playback Switch", 0x0B, 0x0, HDA_INPUT), 1016 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 1017 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 1018 { 1019 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1020 /* The multiple "Capture Source" controls confuse alsamixer 1021 * So call somewhat different.. 1022 * FIXME: the controls appear in the "playback" view! 1023 */ 1024 /* .name = "Capture Source", */ 1025 .name = "Input Source", 1026 .count = 1, 1027 .info = alc_mux_enum_info, 1028 .get = alc_mux_enum_get, 1029 .put = alc_mux_enum_put, 1030 }, 1031 {0} /* end */ 1032 }; 1033 1034 /* Uniwill */ 1035 static struct snd_kcontrol_new alc880_uniwill_mixer[] = { 1036 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 1037 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), 1038 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 1039 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), 1040 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 1041 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 1042 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 1043 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 1044 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 1045 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 1046 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 1047 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 1048 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 1049 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 1050 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 1051 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 1052 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 1053 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 1054 { 1055 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1056 .name = "Channel Mode", 1057 .info = alc_ch_mode_info, 1058 .get = alc_ch_mode_get, 1059 .put = alc_ch_mode_put, 1060 }, 1061 {0} /* end */ 1062 }; 1063 1064 static struct snd_kcontrol_new alc880_uniwill_p53_mixer[] = { 1065 HDA_CODEC_VOLUME("HPhone Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 1066 HDA_BIND_MUTE("HPhone Playback Switch", 0x0c, 2, HDA_INPUT), 1067 HDA_CODEC_VOLUME("iSpeaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 1068 HDA_BIND_MUTE("iSpeaker Playback Switch", 0x0d, 2, HDA_INPUT), 1069 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 1070 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 1071 {0} /* end */ 949 1072 }; 950 1073 … … 954 1077 static int alc_build_controls(struct hda_codec *codec) 955 1078 { 956 struct alc_spec *spec = codec->spec; 957 int err; 958 int i; 959 960 for (i = 0; i < spec->num_mixers; i++) { 961 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); 962 if (err < 0) 963 return err; 964 } 965 966 if (spec->multiout.dig_out_nid) { 967 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid); 968 if (err < 0) 969 return err; 970 } 971 if (spec->dig_in_nid) { 972 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); 973 if (err < 0) 974 return err; 975 } 976 return 0; 1079 struct alc_spec *spec = codec->spec; 1080 int err; 1081 int i; 1082 1083 for (i = 0; i < spec->num_mixers; i++) { 1084 err = snd_hda_add_new_ctls(codec, spec->mixers[i]); 1085 if (err < 0) 1086 return err; 1087 } 1088 1089 if (spec->multiout.dig_out_nid) { 1090 err = snd_hda_create_spdif_out_ctls(codec, 1091 spec->multiout.dig_out_nid); 1092 if (err < 0) 1093 return err; 1094 } 1095 if (spec->dig_in_nid) { 1096 err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in_nid); 1097 if (err < 0) 1098 return err; 1099 } 1100 return 0; 977 1101 } 978 1102 … … 986 1110 */ 987 1111 static struct hda_verb alc880_volume_init_verbs[] = { 988 989 990 991 992 993 994 995 996 997 998 999 1000 * Note: PASD motherboards uses the Line In 2 as the input for front panel 1001 *mic (mic 2)1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1112 /* 1113 * Unmute ADC0-2 and set the default input to mic-in 1114 */ 1115 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 1116 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 1117 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 1118 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 1119 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 1120 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 1121 1122 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 1123 * mixer widget 1124 * Note: PASD motherboards uses the Line In 2 as the input for front 1125 * panel mic (mic 2) 1126 */ 1127 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ 1128 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 1129 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 1130 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 1131 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 1132 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 1133 1134 /* 1135 * Set up output mixers (0x0c - 0x0f) 1136 */ 1137 /* set vol=0 to output mixers */ 1138 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 1139 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 1140 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 1141 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 1142 /* set up input amps for analog loopback */ 1143 /* Amp Indices: DAC = 0, mixer = 1 */ 1144 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 1145 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 1146 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 1147 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 1148 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 1149 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 1150 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 1151 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 1152 1153 {0} 1030 1154 }; 1031 1155 … … 1035 1159 */ 1036 1160 static struct hda_verb alc880_pin_3stack_init_verbs[] = { 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1161 /* 1162 * preset connection lists of input pins 1163 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround 1164 */ 1165 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ 1166 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 1167 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */ 1168 1169 /* 1170 * Set pin mode and muting 1171 */ 1172 /* set front pin widgets 0x14 for output */ 1173 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1174 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1175 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 1176 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1177 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1178 /* Mic2 (as headphone out) for HP output */ 1179 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1180 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1181 /* Line In pin widget for input */ 1182 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1183 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1184 /* Line2 (as front mic) pin widget for input and vref at 80% */ 1185 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1186 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1187 /* CD pin widget for input */ 1188 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1189 1190 {0} 1067 1191 }; 1068 1192 … … 1073 1197 */ 1074 1198 static struct hda_verb alc880_pin_5stack_init_verbs[] = { 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1199 /* 1200 * preset connection lists of input pins 1201 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround 1202 */ 1203 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 1204 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */ 1205 1206 /* 1207 * Set pin mode and muting 1208 */ 1209 /* set pin widgets 0x14-0x17 for output */ 1210 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1211 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1212 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1213 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1214 /* unmute pins for output (no gain on this amp) */ 1215 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1216 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1217 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1218 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1219 1220 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 1221 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1222 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1223 /* Mic2 (as headphone out) for HP output */ 1224 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1225 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1226 /* Line In pin widget for input */ 1227 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1228 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1229 /* Line2 (as front mic) pin widget for input and vref at 80% */ 1230 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1231 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1232 /* CD pin widget for input */ 1233 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1234 1235 {0} 1112 1236 }; 1113 1237 … … 1117 1241 */ 1118 1242 static struct hda_verb alc880_pin_w810_init_verbs[] = { 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1243 /* hphone/speaker input selector: front DAC */ 1244 {0x13, AC_VERB_SET_CONNECT_SEL, 0x0}, 1245 1246 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1247 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1248 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1250 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1251 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1252 1253 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1254 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1255 1256 {0} 1133 1257 }; 1134 1258 … … 1138 1262 */ 1139 1263 static struct hda_verb alc880_pin_z71v_init_verbs[] = { 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1264 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1265 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1266 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1267 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1268 1269 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1270 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1271 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1272 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1273 1274 {0} 1151 1275 }; 1152 1276 1153 1277 /* 1154 1278 * 6-stack pin configuration: 1155 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, f-mic = 0x19,1156 * line = 0x1a, HP = 0x1b1279 * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, 1280 * f-mic = 0x19, line = 0x1a, HP = 0x1b 1157 1281 */ 1158 1282 static struct hda_verb alc880_pin_6stack_init_verbs[] = { 1159 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 1160 1161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1162 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1163 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1164 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1165 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1166 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1167 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1168 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1169 1170 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1171 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1172 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1173 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1174 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1175 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1176 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1177 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1178 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1179 1180 {0} 1181 }; 1283 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 1284 1285 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1286 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1287 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1288 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1289 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1290 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1291 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1292 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1293 1294 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1295 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1296 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1297 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1298 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1299 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1300 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1301 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1302 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1303 1304 {0} 1305 }; 1306 1307 /* 1308 * Uniwill pin configuration: 1309 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x18, internal mic = 0x19, 1310 * line = 0x1a 1311 */ 1312 static struct hda_verb alc880_uniwill_init_verbs[] = { 1313 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 1314 1315 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1316 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1317 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1318 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1319 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1320 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1321 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1322 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1323 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 1324 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 1325 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 1326 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 1327 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 1328 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 1329 1330 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1331 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1332 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1333 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1334 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1335 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1336 /* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */ 1337 /* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */ 1338 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1339 1340 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 1341 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, 1342 1343 {0} 1344 }; 1345 1346 /* 1347 * Uniwill P53 1348 * HP = 0x14, InternalSpeaker = 0x15, mic = 0x19, 1349 */ 1350 static struct hda_verb alc880_uniwill_p53_init_verbs[] = { 1351 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 1352 1353 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1354 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1355 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1356 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1357 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1358 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1359 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 1360 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 1361 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 1362 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 1363 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 1364 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 1365 1366 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1367 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1368 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1369 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1370 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1371 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1372 1373 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 1374 {0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT}, 1375 1376 {0} 1377 }; 1378 1379 /* toggle speaker-output according to the hp-jack state */ 1380 static void alc880_uniwill_automute(struct hda_codec *codec) 1381 { 1382 unsigned int present; 1383 1384 present = snd_hda_codec_read(codec, 0x14, 0, 1385 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1386 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 1387 0x80, present ? 0x80 : 0); 1388 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 1389 0x80, present ? 0x80 : 0); 1390 snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0, 1391 0x80, present ? 0x80 : 0); 1392 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0, 1393 0x80, present ? 0x80 : 0); 1394 1395 present = snd_hda_codec_read(codec, 0x18, 0, 1396 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1397 snd_hda_codec_write(codec, 0x0b, 0, AC_VERB_SET_AMP_GAIN_MUTE, 1398 0x7000 | (0x01 << 8) | (present ? 0x80 : 0)); 1399 } 1400 1401 static void alc880_uniwill_unsol_event(struct hda_codec *codec, 1402 unsigned int res) 1403 { 1404 /* Looks like the unsol event is incompatible with the standard 1405 * definition. 4bit tag is placed at 28 bit! 1406 */ 1407 if ((res >> 28) == ALC880_HP_EVENT || 1408 (res >> 28) == ALC880_MIC_EVENT) 1409 alc880_uniwill_automute(codec); 1410 } 1411 1412 static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec) 1413 { 1414 unsigned int present; 1415 1416 present = snd_hda_codec_read(codec, 0x14, 0, 1417 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1418 1419 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, 1420 0x80, present ? 0x80 : 0); 1421 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0, 1422 0x80, present ? 0x80 : 0); 1423 } 1424 1425 static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) 1426 { 1427 unsigned int present; 1428 1429 present = snd_hda_codec_read(codec, 0x21, 0, 1430 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; 1431 1432 snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, 1433 0x7f, present); 1434 snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, 1435 0x7f, present); 1436 1437 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, 1438 0x7f, present); 1439 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, 1440 0x7f, present); 1441 1442 } 1443 static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, 1444 unsigned int res) 1445 { 1446 /* Looks like the unsol event is incompatible with the standard 1447 * definition. 4bit tag is placed at 28 bit! 1448 */ 1449 if ((res >> 28) == ALC880_HP_EVENT) 1450 alc880_uniwill_p53_hp_automute(codec); 1451 if ((res >> 28) == ALC880_DCVOL_EVENT) 1452 alc880_uniwill_p53_dcvol_automute(codec); 1453 } 1182 1454 1183 1455 /* FIXME! */ … … 1187 1459 */ 1188 1460 static struct hda_verb alc880_pin_f1734_init_verbs[] = { 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1461 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, 1462 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, 1463 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, 1464 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, 1465 1466 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1467 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1468 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1469 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1470 1471 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1472 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1473 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1474 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1475 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1476 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1477 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1478 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1479 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1480 1481 {0} 1210 1482 }; 1211 1483 … … 1216 1488 */ 1217 1489 static struct hda_verb alc880_pin_asus_init_verbs[] = { 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1490 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, 1491 {0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, 1492 {0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, 1493 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, 1494 1495 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1496 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1497 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1498 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1499 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1500 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1501 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1502 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1503 1504 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1505 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1506 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1507 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1508 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1509 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 1510 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1511 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1512 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1513 1514 {0} 1243 1515 }; 1244 1516 1245 1517 /* Enable GPIO mask and set output */ 1246 1518 static struct hda_verb alc880_gpio1_init_verbs[] = { 1247 1248 1249 1250 1251 1519 {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, 1520 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, 1521 {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, 1522 1523 {0} 1252 1524 }; 1253 1525 1254 1526 /* Enable GPIO mask and set output */ 1255 1527 static struct hda_verb alc880_gpio2_init_verbs[] = { 1256 1257 1258 1259 1260 1528 {0x01, AC_VERB_SET_GPIO_MASK, 0x02}, 1529 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02}, 1530 {0x01, AC_VERB_SET_GPIO_DATA, 0x02}, 1531 1532 {0} 1261 1533 }; 1262 1534 1263 1535 /* Clevo m520g init */ 1264 1536 static struct hda_verb alc880_pin_clevo_init_verbs[] = { 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 /* change to EAPD mode */1286 1287 1288 1289 1537 /* headphone output */ 1538 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, 1539 /* line-out */ 1540 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1541 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1542 /* Line-in */ 1543 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1544 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1545 /* CD */ 1546 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1547 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1548 /* Mic1 (rear panel) */ 1549 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1550 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1551 /* Mic2 (front panel) */ 1552 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1553 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1554 /* headphone */ 1555 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1556 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1557 /* change to EAPD mode */ 1558 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 1559 {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, 1560 1561 {0} 1290 1562 }; 1291 1563 1292 1564 static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = { 1293 /* Headphone output */ 1294 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1295 /* Front output*/ 1296 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1297 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 1298 1299 /* Line In pin widget for input */ 1300 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1301 /* CD pin widget for input */ 1302 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1303 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 1304 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1305 1306 /* change to EAPD mode */ 1307 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 1308 {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, 1309 1310 {0} 1565 /* change to EAPD mode */ 1566 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 1567 {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, 1568 1569 /* Headphone output */ 1570 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1571 /* Front output*/ 1572 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 1573 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 1574 1575 /* Line In pin widget for input */ 1576 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1577 /* CD pin widget for input */ 1578 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1579 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 1580 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1581 1582 /* change to EAPD mode */ 1583 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 1584 {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, 1585 1586 {0} 1311 1587 }; 1312 1588 … … 1325 1601 /* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */ 1326 1602 static hda_nid_t alc880_lg_dac_nids[3] = { 1327 1603 0x05, 0x02, 0x03 1328 1604 }; 1329 1605 1330 1606 /* seems analog CD is not working */ 1331 1607 static struct hda_input_mux alc880_lg_capture_source = { 1332 1333 1334 1335 1336 1337 1608 .num_items = 3, 1609 .items = { 1610 { "Mic", 0x1 }, 1611 { "Line", 0x5 }, 1612 { "Internal Mic", 0x6 }, 1613 }, 1338 1614 }; 1339 1615 1340 1616 /* 2,4,6 channel modes */ 1341 1617 static struct hda_verb alc880_lg_ch2_init[] = { 1342 1343 1344 1345 1618 /* set line-in and mic-in to input */ 1619 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 1620 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 1621 {0} 1346 1622 }; 1347 1623 1348 1624 static struct hda_verb alc880_lg_ch4_init[] = { 1349 1350 1351 1352 1625 /* set line-in to out and mic-in to input */ 1626 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 1627 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 1628 {0} 1353 1629 }; 1354 1630 1355 1631 static struct hda_verb alc880_lg_ch6_init[] = { 1356 1357 1358 1359 1632 /* set line-in and mic-in to output */ 1633 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 1634 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, 1635 {0} 1360 1636 }; 1361 1637 1362 1638 static struct hda_channel_mode alc880_lg_ch_modes[3] = { 1363 1364 1365 1639 { 2, alc880_lg_ch2_init }, 1640 { 4, alc880_lg_ch4_init }, 1641 { 6, alc880_lg_ch6_init }, 1366 1642 }; 1367 1643 1368 1644 static struct snd_kcontrol_new alc880_lg_mixer[] = { 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1645 /* FIXME: it's not really "master" but front channels */ 1646 HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 1647 HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT), 1648 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 1649 HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT), 1650 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT), 1651 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT), 1652 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT), 1653 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT), 1654 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 1655 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 1656 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT), 1657 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT), 1658 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT), 1659 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT), 1660 { 1661 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1662 .name = "Channel Mode", 1663 .info = alc_ch_mode_info, 1664 .get = alc_ch_mode_get, 1665 .put = alc_ch_mode_put, 1666 }, 1667 {0} /* end */ 1392 1668 }; 1393 1669 1394 1670 static struct hda_verb alc880_lg_init_verbs[] = { 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1671 /* set capture source to mic-in */ 1672 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 1673 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 1674 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 1675 /* mute all amp mixer inputs */ 1676 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, 1677 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, 1678 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, 1679 /* line-in to input */ 1680 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 1681 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1682 /* built-in mic */ 1683 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1684 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1685 /* speaker-out */ 1686 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1687 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1688 /* mic-in to input */ 1689 {0x11, AC_VERB_SET_CONNECT_SEL, 0x01}, 1690 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1691 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1692 /* HP-out */ 1693 {0x13, AC_VERB_SET_CONNECT_SEL, 0x03}, 1694 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1695 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1696 /* jack sense */ 1697 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, 1698 {0} 1423 1699 }; 1424 1700 … … 1426 1702 static void alc880_lg_automute(struct hda_codec *codec) 1427 1703 { 1428 1429 1430 1431 1432 1433 1434 1435 1704 unsigned int present; 1705 1706 present = snd_hda_codec_read(codec, 0x1b, 0, 1707 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1708 snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, 1709 0x80, present ? 0x80 : 0); 1710 snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0, 1711 0x80, present ? 0x80 : 0); 1436 1712 } 1437 1713 1438 1714 static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) 1439 1715 { 1440 1441 1442 1443 1444 1716 /* Looks like the unsol event is incompatible with the standard 1717 * definition. 4bit tag is placed at 28 bit! 1718 */ 1719 if ((res >> 28) == 0x01) 1720 alc880_lg_automute(codec); 1445 1721 } 1446 1722 … … 1458 1734 /* seems analog CD is not working */ 1459 1735 static struct hda_input_mux alc880_lg_lw_capture_source = { 1460 1461 1462 1463 1464 1736 .num_items = 2, 1737 .items = { 1738 { "Mic", 0x0 }, 1739 { "Internal Mic", 0x1 }, 1740 }, 1465 1741 }; 1466 1742 1467 1743 static struct snd_kcontrol_new alc880_lg_lw_mixer[] = { 1468 1469 1470 1471 1472 1473 1474 1744 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 1745 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT), 1746 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 1747 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 1748 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 1749 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 1750 {0} /* end */ 1475 1751 }; 1476 1752 1477 1753 static struct hda_verb alc880_lg_lw_init_verbs[] = { 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1754 /* set capture source to mic-in */ 1755 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 1756 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 1757 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 1758 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(7)}, 1759 /* speaker-out */ 1760 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1761 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1762 /* HP-out */ 1763 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, 1764 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 1765 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1766 /* mic-in to input */ 1767 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1768 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1769 /* built-in mic */ 1770 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 1771 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 1772 /* jack sense */ 1773 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1}, 1774 {0} 1499 1775 }; 1500 1776 … … 1502 1778 static void alc880_lg_lw_automute(struct hda_codec *codec) 1503 1779 { 1504 1505 1506 1507 1508 1509 1510 1511 1780 unsigned int present; 1781 1782 present = snd_hda_codec_read(codec, 0x1b, 0, 1783 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1784 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 1785 0x80, present ? 0x80 : 0); 1786 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 1787 0x80, present ? 0x80 : 0); 1512 1788 } 1513 1789 1514 1790 static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) 1515 1791 { 1516 1517 1518 1519 1520 1792 /* Looks like the unsol event is incompatible with the standard 1793 * definition. 4bit tag is placed at 28 bit! 1794 */ 1795 if ((res >> 28) == 0x01) 1796 alc880_lg_lw_automute(codec); 1521 1797 } 1522 1798 … … 1527 1803 static int alc_init(struct hda_codec *codec) 1528 1804 { 1529 struct alc_spec *spec = codec->spec; 1530 unsigned int i; 1531 1532 for (i = 0; i < spec->num_init_verbs; i++) 1533 snd_hda_sequence_write(codec, spec->init_verbs[i]); 1534 if (spec->init_hook) 1535 spec->init_hook(codec); 1536 return 0; 1805 struct alc_spec *spec = codec->spec; 1806 unsigned int i; 1807 1808 for (i = 0; i < spec->num_init_verbs; i++) 1809 snd_hda_sequence_write(codec, spec->init_verbs[i]); 1810 1811 if (spec->init_hook) 1812 spec->init_hook(codec); 1813 1814 return 0; 1537 1815 } 1538 1816 1539 1817 static void alc_unsol_event(struct hda_codec *codec, unsigned int res) 1540 1818 { 1541 1542 1543 1544 1819 struct alc_spec *spec = codec->spec; 1820 1821 if (spec->unsol_event) 1822 spec->unsol_event(codec, res); 1545 1823 } 1546 1824 … … 1551 1829 static int alc_resume(struct hda_codec *codec) 1552 1830 { 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1831 struct alc_spec *spec = codec->spec; 1832 int i; 1833 1834 alc_init(codec); 1835 for (i = 0; i < spec->num_mixers; i++) 1836 snd_hda_resume_ctls(codec, spec->mixers[i]); 1837 if (spec->multiout.dig_out_nid) 1838 snd_hda_resume_spdif_out(codec); 1839 if (spec->dig_in_nid) 1840 snd_hda_resume_spdif_in(codec); 1841 1842 return 0; 1565 1843 } 1566 1844 #endif … … 1570 1848 */ 1571 1849 static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo, 1572 1573 1574 { 1575 1576 1850 struct hda_codec *codec, 1851 struct snd_pcm_substream *substream) 1852 { 1853 struct alc_spec *spec = codec->spec; 1854 return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream); 1577 1855 } 1578 1856 1579 1857 static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo, 1580 1581 1582 1583 1584 { 1585 1586 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag,1587 1858 struct hda_codec *codec, 1859 unsigned int stream_tag, 1860 unsigned int format, 1861 struct snd_pcm_substream *substream) 1862 { 1863 struct alc_spec *spec = codec->spec; 1864 return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, 1865 stream_tag, format, substream); 1588 1866 } 1589 1867 1590 1868 static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, 1591 1592 1593 { 1594 1595 1869 struct hda_codec *codec, 1870 struct snd_pcm_substream *substream) 1871 { 1872 struct alc_spec *spec = codec->spec; 1873 return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); 1596 1874 } 1597 1875 … … 1600 1878 */ 1601 1879 static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo, 1602 1603 1604 { 1605 1606 1880 struct hda_codec *codec, 1881 struct snd_pcm_substream *substream) 1882 { 1883 struct alc_spec *spec = codec->spec; 1884 return snd_hda_multi_out_dig_open(codec, &spec->multiout); 1607 1885 } 1608 1886 1609 1887 static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo, 1610 1611 1612 { 1613 1614 1888 struct hda_codec *codec, 1889 struct snd_pcm_substream *substream) 1890 { 1891 struct alc_spec *spec = codec->spec; 1892 return snd_hda_multi_out_dig_close(codec, &spec->multiout); 1615 1893 } 1616 1894 … … 1619 1897 */ 1620 1898 static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo, 1621 1622 1623 1624 1625 { 1626 1627 1628 1629 1630 1899 struct hda_codec *codec, 1900 unsigned int stream_tag, 1901 unsigned int format, 1902 struct snd_pcm_substream *substream) 1903 { 1904 struct alc_spec *spec = codec->spec; 1905 1906 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 1907 stream_tag, 0, format); 1908 return 0; 1631 1909 } 1632 1910 1633 1911 static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, 1634 struct hda_codec *codec, 1635 struct snd_pcm_substream *substream) 1636 { 1637 struct alc_spec *spec = codec->spec; 1638 1639 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0); 1640 return 0; 1912 struct hda_codec *codec, 1913 struct snd_pcm_substream *substream) 1914 { 1915 struct alc_spec *spec = codec->spec; 1916 1917 snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 1918 0, 0, 0); 1919 return 0; 1641 1920 } 1642 1921 … … 1645 1924 */ 1646 1925 static struct hda_pcm_stream alc880_pcm_analog_playback = { 1647 1648 1649 1650 1651 1652 1653 1654 1655 1926 .substreams = 1, 1927 .channels_min = 2, 1928 .channels_max = 8, 1929 /* NID is set in alc_build_pcms */ 1930 .ops = { 1931 .open = alc880_playback_pcm_open, 1932 .prepare = alc880_playback_pcm_prepare, 1933 .cleanup = alc880_playback_pcm_cleanup 1934 }, 1656 1935 }; 1657 1936 1658 1937 static struct hda_pcm_stream alc880_pcm_analog_capture = { 1659 1660 1661 1662 1663 1664 1665 1666 1938 .substreams = 2, 1939 .channels_min = 2, 1940 .channels_max = 2, 1941 /* NID is set in alc_build_pcms */ 1942 .ops = { 1943 .prepare = alc880_capture_pcm_prepare, 1944 .cleanup = alc880_capture_pcm_cleanup 1945 }, 1667 1946 }; 1668 1947 1669 1948 static struct hda_pcm_stream alc880_pcm_digital_playback = { 1670 1671 1672 1673 1674 1675 1676 1677 1949 .substreams = 1, 1950 .channels_min = 2, 1951 .channels_max = 2, 1952 /* NID is set in alc_build_pcms */ 1953 .ops = { 1954 .open = alc880_dig_playback_pcm_open, 1955 .close = alc880_dig_playback_pcm_close 1956 }, 1678 1957 }; 1679 1958 1680 1959 static struct hda_pcm_stream alc880_pcm_digital_capture = { 1681 1682 1683 1684 1960 .substreams = 1, 1961 .channels_min = 2, 1962 .channels_max = 2, 1963 /* NID is set in alc_build_pcms */ 1685 1964 }; 1686 1965 1687 1966 /* Used by alc_build_pcms to flag that a PCM has no playback stream */ 1688 1967 static struct hda_pcm_stream alc_pcm_null_playback = { 1689 1690 1691 1968 .substreams = 0, 1969 .channels_min = 0, 1970 .channels_max = 0, 1692 1971 }; 1693 1972 1694 1973 static int alc_build_pcms(struct hda_codec *codec) 1695 1974 { 1696 struct alc_spec *spec = codec->spec; 1697 struct hda_pcm *info = spec->pcm_rec; 1698 int i; 1699 1700 codec->num_pcms = 1; 1701 codec->pcm_info = info; 1702 1703 info->name = spec->stream_name_analog; 1704 if (spec->stream_analog_playback) { 1705 snd_assert(spec->multiout.dac_nids, return -EINVAL); 1706 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); 1707 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; 1708 } 1709 if (spec->stream_analog_capture) { 1710 snd_assert(spec->adc_nids, return -EINVAL); 1711 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); 1712 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 1713 } 1714 1715 if (spec->channel_mode) { 1716 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; 1717 for (i = 0; i < spec->num_channel_mode; i++) { 1718 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { 1719 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; 1720 } 1721 } 1722 } 1723 1724 /* If the use of more than one ADC is requested for the current 1725 * model, configure a second analog capture-only PCM. 1726 */ 1727 if (spec->num_adc_nids > 1) { 1728 codec->num_pcms++; 1729 info++; 1730 info->name = spec->stream_name_analog; 1731 /* No playback stream for second PCM */ 1732 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; 1733 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; 1734 if (spec->stream_analog_capture) { 1735 snd_assert(spec->adc_nids, return -EINVAL); 1736 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); 1737 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; 1738 } 1739 } 1740 1741 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 1742 codec->num_pcms++; 1743 info++; 1744 info->name = spec->stream_name_digital; 1745 if (spec->multiout.dig_out_nid && 1746 spec->stream_digital_playback) { 1747 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); 1748 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; 1749 } 1750 if (spec->dig_in_nid && 1751 spec->stream_digital_capture) { 1752 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); 1753 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; 1754 } 1755 } 1756 1757 return 0; 1975 struct alc_spec *spec = codec->spec; 1976 struct hda_pcm *info = spec->pcm_rec; 1977 int i; 1978 1979 codec->num_pcms = 1; 1980 codec->pcm_info = info; 1981 1982 info->name = spec->stream_name_analog; 1983 if (spec->stream_analog_playback) { 1984 snd_assert(spec->multiout.dac_nids, return -EINVAL); 1985 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback); 1986 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; 1987 } 1988 if (spec->stream_analog_capture) { 1989 snd_assert(spec->adc_nids, return -EINVAL); 1990 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); 1991 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 1992 } 1993 1994 if (spec->channel_mode) { 1995 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 0; 1996 for (i = 0; i < spec->num_channel_mode; i++) { 1997 if (spec->channel_mode[i].channels > info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max) { 1998 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = spec->channel_mode[i].channels; 1999 } 2000 } 2001 } 2002 2003 /* SPDIF for stream index #1 */ 2004 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 2005 codec->num_pcms = 2; 2006 info = spec->pcm_rec + 1; 2007 info->name = spec->stream_name_digital; 2008 if (spec->multiout.dig_out_nid && 2009 spec->stream_digital_playback) { 2010 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_digital_playback); 2011 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dig_out_nid; 2012 } 2013 if (spec->dig_in_nid && 2014 spec->stream_digital_capture) { 2015 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_digital_capture); 2016 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->dig_in_nid; 2017 } 2018 } 2019 2020 /* If the use of more than one ADC is requested for the current 2021 * model, configure a second analog capture-only PCM. 2022 */ 2023 /* Additional Analaog capture for index #2 */ 2024 if (spec->num_adc_nids > 1 && spec->stream_analog_capture && 2025 spec->adc_nids) { 2026 codec->num_pcms = 3; 2027 info = spec->pcm_rec + 2; 2028 info->name = spec->stream_name_analog; 2029 /* No playback stream for second PCM */ 2030 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; 2031 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 0; 2032 if (spec->stream_analog_capture) { 2033 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture); 2034 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[1]; 2035 } 2036 } 2037 2038 return 0; 1758 2039 } 1759 2040 1760 2041 static void alc_free(struct hda_codec *codec) 1761 2042 { 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 2043 struct alc_spec *spec = codec->spec; 2044 unsigned int i; 2045 2046 if (! spec) 2047 return; 2048 2049 if (spec->kctl_alloc) { 2050 for (i = 0; i < spec->num_kctl_used; i++) 2051 kfree(spec->kctl_alloc[i].name); 2052 kfree(spec->kctl_alloc); 2053 } 2054 kfree(spec); 1774 2055 } 1775 2056 … … 1777 2058 */ 1778 2059 static struct hda_codec_ops alc_patch_ops = { 1779 1780 1781 1782 1783 2060 .build_controls = alc_build_controls, 2061 .build_pcms = alc_build_pcms, 2062 .init = alc_init, 2063 .free = alc_free, 2064 .unsol_event = alc_unsol_event, 1784 2065 #ifdef CONFIG_PM 1785 2066 .resume = alc_resume, 1786 2067 #endif 1787 2068 }; … … 1796 2077 #ifdef CONFIG_SND_DEBUG 1797 2078 static hda_nid_t alc880_test_dac_nids[4] = { 1798 2079 0x02, 0x03, 0x04, 0x05 1799 2080 }; 1800 2081 1801 2082 static struct hda_input_mux alc880_test_capture_source = { 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 2083 .num_items = 7, 2084 .items = { 2085 { "In-1", 0x0 }, 2086 { "In-2", 0x1 }, 2087 { "In-3", 0x2 }, 2088 { "In-4", 0x3 }, 2089 { "CD", 0x4 }, 2090 { "Front", 0x5 }, 2091 { "Surround", 0x6 }, 2092 }, 1812 2093 }; 1813 2094 1814 2095 static struct hda_channel_mode alc880_test_modes[4] = { 1815 { 2, NULL }, 1816 { 4, NULL }, 1817 { 6, NULL }, 1818 { 8, NULL }, 1819 }; 1820 1821 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 1822 { 1823 static char *texts[] = { 1824 "N/A", "Line Out", "HP Out", 1825 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" 1826 }; 1827 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1828 uinfo->count = 1; 1829 uinfo->value.enumerated.items = 8; 1830 if (uinfo->value.enumerated.item >= 8) 1831 uinfo->value.enumerated.item = 7; 1832 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 1833 return 0; 1834 } 1835 1836 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1837 { 1838 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1839 hda_nid_t nid = (hda_nid_t)kcontrol->private_value; 1840 unsigned int pin_ctl, item = 0; 1841 1842 pin_ctl = snd_hda_codec_read(codec, nid, 0, 1843 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 1844 if (pin_ctl & AC_PINCTL_OUT_EN) { 1845 if (pin_ctl & AC_PINCTL_HP_EN) 1846 item = 2; 1847 else 1848 item = 1; 1849 } else if (pin_ctl & AC_PINCTL_IN_EN) { 1850 switch (pin_ctl & AC_PINCTL_VREFEN) { 1851 case AC_PINCTL_VREF_HIZ: item = 3; break; 1852 case AC_PINCTL_VREF_50: item = 4; break; 1853 case AC_PINCTL_VREF_GRD: item = 5; break; 1854 case AC_PINCTL_VREF_80: item = 6; break; 1855 case AC_PINCTL_VREF_100: item = 7; break; 1856 } 1857 } 1858 ucontrol->value.enumerated.item[0] = item; 1859 return 0; 1860 } 1861 1862 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1863 { 1864 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1865 hda_nid_t nid = (hda_nid_t)kcontrol->private_value; 1866 static unsigned int ctls[] = { 1867 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, 1868 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, 1869 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, 1870 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, 1871 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, 1872 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, 1873 }; 1874 unsigned int old_ctl, new_ctl; 1875 1876 old_ctl = snd_hda_codec_read(codec, nid, 0, 1877 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 1878 new_ctl = ctls[ucontrol->value.enumerated.item[0]]; 1879 if (old_ctl != new_ctl) { 1880 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl); 1881 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 1882 ucontrol->value.enumerated.item[0] >= 3 ? 0xb080 : 0xb000); 1883 return 1; 1884 } 1885 return 0; 1886 } 1887 1888 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 1889 { 1890 static char *texts[] = { 1891 "Front", "Surround", "CLFE", "Side" 1892 }; 1893 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1894 uinfo->count = 1; 1895 uinfo->value.enumerated.items = 4; 1896 if (uinfo->value.enumerated.item >= 4) 1897 uinfo->value.enumerated.item = 3; 1898 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 1899 return 0; 1900 } 1901 1902 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1903 { 1904 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1905 hda_nid_t nid = (hda_nid_t)kcontrol->private_value; 1906 unsigned int sel; 1907 1908 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); 1909 ucontrol->value.enumerated.item[0] = sel & 3; 1910 return 0; 1911 } 1912 1913 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1914 { 1915 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1916 hda_nid_t nid = (hda_nid_t)kcontrol->private_value; 1917 unsigned int sel; 1918 1919 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; 1920 if (ucontrol->value.enumerated.item[0] != sel) { 1921 sel = ucontrol->value.enumerated.item[0] & 3; 1922 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel); 1923 return 1; 1924 } 1925 return 0; 2096 { 2, NULL }, 2097 { 4, NULL }, 2098 { 6, NULL }, 2099 { 8, NULL }, 2100 }; 2101 2102 static int alc_test_pin_ctl_info(struct snd_kcontrol *kcontrol, 2103 struct snd_ctl_elem_info *uinfo) 2104 { 2105 static char *texts[] = { 2106 "N/A", "Line Out", "HP Out", 2107 "In Hi-Z", "In 50%", "In Grd", "In 80%", "In 100%" 2108 }; 2109 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2110 uinfo->count = 1; 2111 uinfo->value.enumerated.items = 8; 2112 if (uinfo->value.enumerated.item >= 8) 2113 uinfo->value.enumerated.item = 7; 2114 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 2115 return 0; 2116 } 2117 2118 static int alc_test_pin_ctl_get(struct snd_kcontrol *kcontrol, 2119 struct snd_ctl_elem_value *ucontrol) 2120 { 2121 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2122 hda_nid_t nid = (hda_nid_t)kcontrol->private_value; 2123 unsigned int pin_ctl, item = 0; 2124 2125 pin_ctl = snd_hda_codec_read(codec, nid, 0, 2126 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 2127 if (pin_ctl & AC_PINCTL_OUT_EN) { 2128 if (pin_ctl & AC_PINCTL_HP_EN) 2129 item = 2; 2130 else 2131 item = 1; 2132 } else if (pin_ctl & AC_PINCTL_IN_EN) { 2133 switch (pin_ctl & AC_PINCTL_VREFEN) { 2134 case AC_PINCTL_VREF_HIZ: item = 3; break; 2135 case AC_PINCTL_VREF_50: item = 4; break; 2136 case AC_PINCTL_VREF_GRD: item = 5; break; 2137 case AC_PINCTL_VREF_80: item = 6; break; 2138 case AC_PINCTL_VREF_100: item = 7; break; 2139 } 2140 } 2141 ucontrol->value.enumerated.item[0] = item; 2142 return 0; 2143 } 2144 2145 static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol, 2146 struct snd_ctl_elem_value *ucontrol) 2147 { 2148 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2149 hda_nid_t nid = (hda_nid_t)kcontrol->private_value; 2150 static unsigned int ctls[] = { 2151 0, AC_PINCTL_OUT_EN, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN, 2152 AC_PINCTL_IN_EN | AC_PINCTL_VREF_HIZ, 2153 AC_PINCTL_IN_EN | AC_PINCTL_VREF_50, 2154 AC_PINCTL_IN_EN | AC_PINCTL_VREF_GRD, 2155 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80, 2156 AC_PINCTL_IN_EN | AC_PINCTL_VREF_100, 2157 }; 2158 unsigned int old_ctl, new_ctl; 2159 2160 old_ctl = snd_hda_codec_read(codec, nid, 0, 2161 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 2162 new_ctl = ctls[ucontrol->value.enumerated.item[0]]; 2163 if (old_ctl != new_ctl) { 2164 snd_hda_codec_write(codec, nid, 0, 2165 AC_VERB_SET_PIN_WIDGET_CONTROL, new_ctl); 2166 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 2167 (ucontrol->value.enumerated.item[0] >= 3 ? 2168 0xb080 : 0xb000)); 2169 return 1; 2170 } 2171 return 0; 2172 } 2173 2174 static int alc_test_pin_src_info(struct snd_kcontrol *kcontrol, 2175 struct snd_ctl_elem_info *uinfo) 2176 { 2177 static char *texts[] = { 2178 "Front", "Surround", "CLFE", "Side" 2179 }; 2180 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2181 uinfo->count = 1; 2182 uinfo->value.enumerated.items = 4; 2183 if (uinfo->value.enumerated.item >= 4) 2184 uinfo->value.enumerated.item = 3; 2185 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 2186 return 0; 2187 } 2188 2189 static int alc_test_pin_src_get(struct snd_kcontrol *kcontrol, 2190 struct snd_ctl_elem_value *ucontrol) 2191 { 2192 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2193 hda_nid_t nid = (hda_nid_t)kcontrol->private_value; 2194 unsigned int sel; 2195 2196 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0); 2197 ucontrol->value.enumerated.item[0] = sel & 3; 2198 return 0; 2199 } 2200 2201 static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol, 2202 struct snd_ctl_elem_value *ucontrol) 2203 { 2204 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2205 hda_nid_t nid = (hda_nid_t)kcontrol->private_value; 2206 unsigned int sel; 2207 2208 sel = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONNECT_SEL, 0) & 3; 2209 if (ucontrol->value.enumerated.item[0] != sel) { 2210 sel = ucontrol->value.enumerated.item[0] & 3; 2211 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, sel); 2212 return 1; 2213 } 2214 return 0; 1926 2215 } 1927 2216 1928 2217 #define PIN_CTL_TEST(xname,nid) { \ 1929 1930 1931 1932 1933 1934 1935 2218 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2219 .name = xname, \ 2220 .info = alc_test_pin_ctl_info, \ 2221 .get = alc_test_pin_ctl_get, \ 2222 .put = alc_test_pin_ctl_put, \ 2223 .private_value = nid \ 2224 } 1936 2225 1937 2226 #define PIN_SRC_TEST(xname,nid) { \ 1938 1939 1940 1941 1942 1943 1944 2227 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2228 .name = xname, \ 2229 .info = alc_test_pin_src_info, \ 2230 .get = alc_test_pin_src_get, \ 2231 .put = alc_test_pin_src_put, \ 2232 .private_value = nid \ 2233 } 1945 2234 1946 2235 static struct snd_kcontrol_new alc880_test_mixer[] = { 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 2236 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 2237 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 2238 HDA_CODEC_VOLUME("CLFE Playback Volume", 0x0e, 0x0, HDA_OUTPUT), 2239 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 2240 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 2241 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 2242 HDA_BIND_MUTE("CLFE Playback Switch", 0x0e, 2, HDA_INPUT), 2243 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 2244 PIN_CTL_TEST("Front Pin Mode", 0x14), 2245 PIN_CTL_TEST("Surround Pin Mode", 0x15), 2246 PIN_CTL_TEST("CLFE Pin Mode", 0x16), 2247 PIN_CTL_TEST("Side Pin Mode", 0x17), 2248 PIN_CTL_TEST("In-1 Pin Mode", 0x18), 2249 PIN_CTL_TEST("In-2 Pin Mode", 0x19), 2250 PIN_CTL_TEST("In-3 Pin Mode", 0x1a), 2251 PIN_CTL_TEST("In-4 Pin Mode", 0x1b), 2252 PIN_SRC_TEST("In-1 Pin Source", 0x18), 2253 PIN_SRC_TEST("In-2 Pin Source", 0x19), 2254 PIN_SRC_TEST("In-3 Pin Source", 0x1a), 2255 PIN_SRC_TEST("In-4 Pin Source", 0x1b), 2256 HDA_CODEC_VOLUME("In-1 Playback Volume", 0x0b, 0x0, HDA_INPUT), 2257 HDA_CODEC_MUTE("In-1 Playback Switch", 0x0b, 0x0, HDA_INPUT), 2258 HDA_CODEC_VOLUME("In-2 Playback Volume", 0x0b, 0x1, HDA_INPUT), 2259 HDA_CODEC_MUTE("In-2 Playback Switch", 0x0b, 0x1, HDA_INPUT), 2260 HDA_CODEC_VOLUME("In-3 Playback Volume", 0x0b, 0x2, HDA_INPUT), 2261 HDA_CODEC_MUTE("In-3 Playback Switch", 0x0b, 0x2, HDA_INPUT), 2262 HDA_CODEC_VOLUME("In-4 Playback Volume", 0x0b, 0x3, HDA_INPUT), 2263 HDA_CODEC_MUTE("In-4 Playback Switch", 0x0b, 0x3, HDA_INPUT), 2264 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x4, HDA_INPUT), 2265 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x4, HDA_INPUT), 2266 { 2267 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2268 .name = "Channel Mode", 2269 .info = alc_ch_mode_info, 2270 .get = alc_ch_mode_get, 2271 .put = alc_ch_mode_put, 2272 }, 2273 {0} /* end */ 1985 2274 }; 1986 2275 1987 2276 static struct hda_verb alc880_test_init_verbs[] = { 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2277 /* Unmute inputs of 0x0c - 0x0f */ 2278 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 2279 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 2280 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 2281 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 2282 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 2283 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 2284 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 2285 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 2286 /* Vol output for 0x0c-0x0f */ 2287 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 2288 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 2289 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 2290 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 2291 /* Set output pins 0x14-0x17 */ 2292 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 2293 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 2294 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 2295 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 2296 /* Unmute output pins 0x14-0x17 */ 2297 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2298 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2299 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2300 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 2301 /* Set input pins 0x18-0x1c */ 2302 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 2303 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 2304 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2305 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2306 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 2307 /* Mute input pins 0x18-0x1b */ 2308 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 2309 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 2310 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 2311 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 2312 /* ADC set up */ 2313 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2314 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 2315 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2316 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 2317 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2318 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 2319 /* Analog input/passthru */ 2320 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 2321 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 2322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 2323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 2324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 2325 {0} 2037 2326 }; 2038 2327 #endif … … 2041 2330 */ 2042 2331 2043 static struct hda_board_config alc880_cfg_tbl[] = { 2044 /* Back 3 jack, front 2 jack */ 2045 { .modelname = "3stack", .config = ALC880_3ST }, 2046 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe200, .config = ALC880_3ST }, 2047 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe201, .config = ALC880_3ST }, 2048 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe202, .config = ALC880_3ST }, 2049 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe203, .config = ALC880_3ST }, 2050 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe204, .config = ALC880_3ST }, 2051 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe205, .config = ALC880_3ST }, 2052 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe206, .config = ALC880_3ST }, 2053 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe207, .config = ALC880_3ST }, 2054 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe208, .config = ALC880_3ST }, 2055 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe209, .config = ALC880_3ST }, 2056 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20a, .config = ALC880_3ST }, 2057 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20b, .config = ALC880_3ST }, 2058 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20c, .config = ALC880_3ST }, 2059 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20d, .config = ALC880_3ST }, 2060 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20e, .config = ALC880_3ST }, 2061 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe20f, .config = ALC880_3ST }, 2062 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe210, .config = ALC880_3ST }, 2063 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe211, .config = ALC880_3ST }, 2064 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe214, .config = ALC880_3ST }, 2065 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe302, .config = ALC880_3ST }, 2066 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe303, .config = ALC880_3ST }, 2067 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe304, .config = ALC880_3ST }, 2068 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe306, .config = ALC880_3ST }, 2069 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe307, .config = ALC880_3ST }, 2070 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe404, .config = ALC880_3ST }, 2071 { .pci_subvendor = 0x8086, .pci_subdevice = 0xa101, .config = ALC880_3ST }, 2072 { .pci_subvendor = 0x107b, .pci_subdevice = 0x3031, .config = ALC880_3ST }, 2073 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4036, .config = ALC880_3ST }, 2074 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4037, .config = ALC880_3ST }, 2075 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4038, .config = ALC880_3ST }, 2076 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4040, .config = ALC880_3ST }, 2077 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4041, .config = ALC880_3ST }, 2078 /* TCL S700 */ 2079 { .pci_subvendor = 0x19db, .pci_subdevice = 0x4188, .config = ALC880_TCL_S700 }, 2080 2081 /* Back 3 jack, front 2 jack (Internal add Aux-In) */ 2082 { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST }, 2083 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST }, 2084 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81a0, .config = ALC880_3ST }, 2085 2086 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */ 2087 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, 2088 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe308, .config = ALC880_3ST_DIG }, 2089 { .pci_subvendor = 0x1025, .pci_subdevice = 0x0070, .config = ALC880_3ST_DIG }, 2090 /* Clevo m520G NB */ 2091 { .pci_subvendor = 0x1558, .pci_subdevice = 0x0520, .config = ALC880_CLEVO }, 2092 2093 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/ 2094 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe305, .config = ALC880_3ST_DIG }, 2095 { .pci_subvendor = 0x8086, .pci_subdevice = 0xd402, .config = ALC880_3ST_DIG }, 2096 { .pci_subvendor = 0x1025, .pci_subdevice = 0xe309, .config = ALC880_3ST_DIG }, 2097 2098 /* Back 5 jack, front 2 jack */ 2099 { .modelname = "5stack", .config = ALC880_5ST }, 2100 { .pci_subvendor = 0x107b, .pci_subdevice = 0x3033, .config = ALC880_5ST }, 2101 { .pci_subvendor = 0x107b, .pci_subdevice = 0x4039, .config = ALC880_5ST }, 2102 { .pci_subvendor = 0x107b, .pci_subdevice = 0x3032, .config = ALC880_5ST }, 2103 { .pci_subvendor = 0x103c, .pci_subdevice = 0x2a09, .config = ALC880_5ST }, 2104 { .pci_subvendor = 0x1043, .pci_subdevice = 0x814e, .config = ALC880_5ST }, 2105 2106 /* Back 5 jack plus 1 SPDIF out jack, front 2 jack */ 2107 { .modelname = "5stack-digout", .config = ALC880_5ST_DIG }, 2108 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe224, .config = ALC880_5ST_DIG }, 2109 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe400, .config = ALC880_5ST_DIG }, 2110 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe401, .config = ALC880_5ST_DIG }, 2111 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe402, .config = ALC880_5ST_DIG }, 2112 { .pci_subvendor = 0x8086, .pci_subdevice = 0xd400, .config = ALC880_5ST_DIG }, 2113 { .pci_subvendor = 0x8086, .pci_subdevice = 0xd401, .config = ALC880_5ST_DIG }, 2114 { .pci_subvendor = 0x8086, .pci_subdevice = 0xa100, .config = ALC880_5ST_DIG }, 2115 { .pci_subvendor = 0x1565, .pci_subdevice = 0x8202, .config = ALC880_5ST_DIG }, 2116 { .pci_subvendor = 0x1019, .pci_subdevice = 0xa880, .config = ALC880_5ST_DIG }, 2117 { .pci_subvendor = 0xa0a0, .pci_subdevice = 0x0560, .config = ALC880_5ST_DIG }, /* Aopen i915GMm-HFS */ 2118 /* { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_5ST_DIG }, */ /* conflict with 6stack */ 2119 { .pci_subvendor = 0x1695, .pci_subdevice = 0x400d, .config = ALC880_5ST_DIG }, 2120 /* note subvendor = 0 below */ 2121 /* { .pci_subvendor = 0x0000, .pci_subdevice = 0x8086, .config = ALC880_5ST_DIG }, */ 2122 2123 { .modelname = "w810", .config = ALC880_W810 }, 2124 { .pci_subvendor = 0x161f, .pci_subdevice = 0x203d, .config = ALC880_W810 }, 2125 2126 { .modelname = "z71v", .config = ALC880_Z71V }, 2127 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_Z71V }, 2128 2129 { .modelname = "6stack", .config = ALC880_6ST }, 2130 { .pci_subvendor = 0x1043, .pci_subdevice = 0x8196, .config = ALC880_6ST }, /* ASUS P5GD1-HVM */ 2131 { .pci_subvendor = 0x1043, .pci_subdevice = 0x81b4, .config = ALC880_6ST }, 2132 { .pci_subvendor = 0x1019, .pci_subdevice = 0xa884, .config = ALC880_6ST }, /* Acer APFV */ 2133 { .pci_subvendor = 0x1458, .pci_subdevice = 0xa102, .config = ALC880_6ST }, /* Gigabyte K8N51 */ 2134 2135 { .modelname = "6stack-digout", .config = ALC880_6ST_DIG }, 2136 { .pci_subvendor = 0x2668, .pci_subdevice = 0x8086, .config = ALC880_6ST_DIG }, 2137 { .pci_subvendor = 0x8086, .pci_subdevice = 0x2668, .config = ALC880_6ST_DIG }, 2138 { .pci_subvendor = 0x1462, .pci_subdevice = 0x1150, .config = ALC880_6ST_DIG }, 2139 { .pci_subvendor = 0xe803, .pci_subdevice = 0x1019, .config = ALC880_6ST_DIG }, 2140 { .pci_subvendor = 0x1039, .pci_subdevice = 0x1234, .config = ALC880_6ST_DIG }, 2141 { .pci_subvendor = 0x1025, .pci_subdevice = 0x0077, .config = ALC880_6ST_DIG }, 2142 { .pci_subvendor = 0x1025, .pci_subdevice = 0x0078, .config = ALC880_6ST_DIG }, 2143 { .pci_subvendor = 0x1025, .pci_subdevice = 0x0087, .config = ALC880_6ST_DIG }, 2144 { .pci_subvendor = 0x1297, .pci_subdevice = 0xc790, .config = ALC880_6ST_DIG }, /* Shuttle ST20G5 */ 2145 { .pci_subvendor = 0x1509, .pci_subdevice = 0x925d, .config = ALC880_6ST_DIG }, /* FIC P4M-915GD1 */ 2146 2147 { .modelname = "asus", .config = ALC880_ASUS }, 2148 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1964, .config = ALC880_ASUS_DIG }, 2149 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG }, 2150 { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG }, 2151 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG }, 2152 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1173, .config = ALC880_ASUS_DIG }, 2153 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS }, 2154 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG }, 2155 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS }, 2156 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1123, .config = ALC880_ASUS_DIG }, 2157 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1143, .config = ALC880_ASUS }, 2158 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10b3, .config = ALC880_ASUS_W1V }, 2159 { .pci_subvendor = 0x1043, .pci_subdevice = 0x8181, .config = ALC880_ASUS_DIG }, /* ASUS P4GPL-X */ 2160 { .pci_subvendor = 0x1558, .pci_subdevice = 0x5401, .config = ALC880_ASUS_DIG2 }, 2161 2162 { .modelname = "uniwill", .config = ALC880_UNIWILL_DIG }, 2163 { .pci_subvendor = 0x1584, .pci_subdevice = 0x9050, .config = ALC880_UNIWILL_DIG }, 2164 2165 { .modelname = "F1734", .config = ALC880_F1734 }, 2166 { .pci_subvendor = 0x1734, .pci_subdevice = 0x107c, .config = ALC880_F1734 }, 2167 { .pci_subvendor = 0x1584, .pci_subdevice = 0x9054, .config = ALC880_F1734 }, 2168 2169 { .modelname = "lg", .config = ALC880_LG }, 2170 { .pci_subvendor = 0x1854, .pci_subdevice = 0x003b, .config = ALC880_LG }, 2171 { .pci_subvendor = 0x1854, .pci_subdevice = 0x0068, .config = ALC880_LG }, 2172 { .modelname = "lg-lw", .config = ALC880_LG_LW }, 2173 { .pci_subvendor = 0x1854, .pci_subdevice = 0x0018, .config = ALC880_LG_LW }, 2174 2332 static const char *alc880_models[ALC880_MODEL_LAST] = { 2333 [ALC880_3ST] = "3stack", 2334 [ALC880_TCL_S700] = "tcl", 2335 [ALC880_3ST_DIG] = "3stack-digout", 2336 [ALC880_CLEVO] = "clevo", 2337 [ALC880_5ST] = "5stack", 2338 [ALC880_5ST_DIG] = "5stack-digout", 2339 [ALC880_W810] = "w810", 2340 [ALC880_Z71V] = "z71v", 2341 [ALC880_6ST] = "6stack", 2342 [ALC880_6ST_DIG] = "6stack-digout", 2343 [ALC880_ASUS] = "asus", 2344 [ALC880_ASUS_W1V] = "asus-w1v", 2345 [ALC880_ASUS_DIG] = "asus-dig", 2346 [ALC880_ASUS_DIG2] = "asus-dig2", 2347 [ALC880_UNIWILL_DIG] = "uniwill", 2348 [ALC880_F1734] = "F1734", 2349 [ALC880_LG] = "lg", 2350 [ALC880_LG_LW] = "lg-lw", 2175 2351 #ifdef CONFIG_SND_DEBUG 2176 { .modelname = "test", .config = ALC880_TEST },2352 [ALC880_TEST] = "test", 2177 2353 #endif 2178 { .modelname = "auto", .config = ALC880_AUTO }, 2179 2180 {0} 2354 [ALC880_AUTO] = "auto", 2355 }; 2356 2357 static struct snd_pci_quirk alc880_cfg_tbl[] = { 2358 /* Broken BIOS configuration */ 2359 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), 2360 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), 2361 2362 SND_PCI_QUIRK(0x1019, 0xa880, "ECS", ALC880_5ST_DIG), 2363 SND_PCI_QUIRK(0x1019, 0xa884, "Acer APFV", ALC880_6ST), 2364 SND_PCI_QUIRK(0x1019, 0x0f69, "Coeus G610P", ALC880_W810), 2365 SND_PCI_QUIRK(0x1025, 0x0070, "ULI", ALC880_3ST_DIG), 2366 SND_PCI_QUIRK(0x1025, 0x0077, "ULI", ALC880_6ST_DIG), 2367 SND_PCI_QUIRK(0x1025, 0x0078, "ULI", ALC880_6ST_DIG), 2368 SND_PCI_QUIRK(0x1025, 0x0087, "ULI", ALC880_6ST_DIG), 2369 SND_PCI_QUIRK(0x1025, 0xe309, "ULI", ALC880_3ST_DIG), 2370 SND_PCI_QUIRK(0x1025, 0xe310, "ULI", ALC880_3ST), 2371 2372 SND_PCI_QUIRK(0x1039, 0x1234, NULL, ALC880_6ST_DIG), 2373 SND_PCI_QUIRK(0x103c, 0x2a09, "HP", ALC880_5ST), 2374 2375 SND_PCI_QUIRK(0x1043, 0x10b3, "ASUS W1V", ALC880_ASUS_W1V), 2376 SND_PCI_QUIRK(0x1043, 0x10c2, "ASUS W6A", ALC880_ASUS_DIG), 2377 SND_PCI_QUIRK(0x1043, 0x10c3, "ASUS Wxx", ALC880_ASUS_DIG), 2378 SND_PCI_QUIRK(0x1043, 0x1113, "ASUS", ALC880_ASUS_DIG), 2379 SND_PCI_QUIRK(0x1043, 0x1123, "ASUS", ALC880_ASUS_DIG), 2380 SND_PCI_QUIRK(0x1043, 0x1173, "ASUS", ALC880_ASUS_DIG), 2381 SND_PCI_QUIRK(0x1043, 0x1964, "ASUS Z71V", ALC880_Z71V), 2382 /* SND_PCI_QUIRK(0x1043, 0x1964, "ASUS", ALC880_ASUS_DIG), */ 2383 SND_PCI_QUIRK(0x1043, 0x1973, "ASUS", ALC880_ASUS_DIG), 2384 SND_PCI_QUIRK(0x1043, 0x19b3, "ASUS", ALC880_ASUS_DIG), 2385 SND_PCI_QUIRK(0x1043, 0x814e, "ASUS", ALC880_ASUS), 2386 SND_PCI_QUIRK(0x1043, 0x8181, "ASUS P4GPL", ALC880_ASUS_DIG), 2387 SND_PCI_QUIRK(0x1043, 0x8196, "ASUS P5GD1", ALC880_6ST), 2388 SND_PCI_QUIRK(0x1043, 0x81b4, "ASUS", ALC880_6ST), 2389 SND_PCI_QUIRK(0x1043, 0, "ASUS", ALC880_ASUS), 2390 2391 SND_PCI_QUIRK(0x104d, 0x81d6, "Sony", ALC880_3ST), 2392 SND_PCI_QUIRK(0x104d, 0x81a0, "Sony", ALC880_3ST), 2393 SND_PCI_QUIRK(0x107b, 0x3033, "Gateway", ALC880_5ST), 2394 SND_PCI_QUIRK(0x107b, 0x4039, "Gateway", ALC880_5ST), 2395 SND_PCI_QUIRK(0x107b, 0x3032, "Gateway", ALC880_5ST), 2396 SND_PCI_QUIRK(0x1558, 0x0520, "Clevo m520G", ALC880_CLEVO), 2397 SND_PCI_QUIRK(0x1558, 0x0660, "Clevo m655n", ALC880_CLEVO), 2398 SND_PCI_QUIRK(0x1565, 0x8202, "Biostar", ALC880_5ST_DIG), 2399 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), 2400 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), 2401 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), 2402 SND_PCI_QUIRK(0xa0a0, 0x0560, "AOpen i915GMm-HFS", ALC880_5ST_DIG), 2403 SND_PCI_QUIRK(0xe803, 0x1019, NULL, ALC880_6ST_DIG), 2404 SND_PCI_QUIRK(0x1297, 0xc790, "Shuttle ST20G5", ALC880_6ST_DIG), 2405 SND_PCI_QUIRK(0x1458, 0xa102, "Gigabyte K8", ALC880_6ST_DIG), 2406 SND_PCI_QUIRK(0x1462, 0x1150, "MSI", ALC880_6ST_DIG), 2407 SND_PCI_QUIRK(0x1509, 0x925d, "FIC P4M", ALC880_6ST_DIG), 2408 SND_PCI_QUIRK(0x1558, 0x5401, "ASUS", ALC880_ASUS_DIG2), 2409 2410 SND_PCI_QUIRK(0x1584, 0x9050, "Uniwill", ALC880_UNIWILL_DIG), 2411 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), 2412 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), 2413 SND_PCI_QUIRK(0x1584, 0x9054, "Uniwlll", ALC880_F1734), 2414 2415 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), 2416 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC", ALC880_UNIWILL), 2417 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), 2418 2419 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), 2420 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), 2421 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW), 2422 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW), 2423 2424 SND_PCI_QUIRK(0x8086, 0xe308, "Intel mobo", ALC880_3ST_DIG), 2425 SND_PCI_QUIRK(0x8086, 0xe305, "Intel mobo", ALC880_3ST_DIG), 2426 SND_PCI_QUIRK(0x8086, 0xd402, "Intel mobo", ALC880_3ST_DIG), 2427 SND_PCI_QUIRK(0x8086, 0xd400, "Intel mobo", ALC880_5ST_DIG), 2428 SND_PCI_QUIRK(0x8086, 0xd401, "Intel mobo", ALC880_5ST_DIG), 2429 SND_PCI_QUIRK(0x8086, 0xe224, "Intel mobo", ALC880_5ST_DIG), 2430 SND_PCI_QUIRK(0x8086, 0xe400, "Intel mobo", ALC880_5ST_DIG), 2431 SND_PCI_QUIRK(0x8086, 0xe401, "Intel mobo", ALC880_5ST_DIG), 2432 SND_PCI_QUIRK(0x8086, 0xe402, "Intel mobo", ALC880_5ST_DIG), 2433 SND_PCI_QUIRK(0x8086, 0xa100, "Intel mobo", ALC880_5ST_DIG), 2434 SND_PCI_QUIRK(0x8086, 0, "Intel mobo", ALC880_3ST), 2435 2436 {0} 2181 2437 }; 2182 2438 … … 2185 2441 */ 2186 2442 static struct alc_config_preset alc880_presets[] = { 2187 [ALC880_3ST] = { 2188 .mixers = { alc880_three_stack_mixer }, 2189 .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, 2190 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2191 .dac_nids = alc880_dac_nids, 2192 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2193 .channel_mode = alc880_threestack_modes, 2194 .input_mux = &alc880_capture_source, 2195 }, 2196 [ALC880_3ST_DIG] = { 2197 .mixers = { alc880_three_stack_mixer }, 2198 .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, 2199 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2200 .dac_nids = alc880_dac_nids, 2201 .dig_out_nid = ALC880_DIGOUT_NID, 2202 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2203 .channel_mode = alc880_threestack_modes, 2204 .input_mux = &alc880_capture_source, 2205 }, 2206 [ALC880_TCL_S700] = { 2207 .mixers = { alc880_tcl_s700_mixer }, 2208 .init_verbs = { alc880_volume_init_verbs, 2209 alc880_pin_tcl_S700_init_verbs, 2210 alc880_gpio2_init_verbs }, 2211 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2212 .dac_nids = alc880_dac_nids, 2213 .hp_nid = 0x03, 2214 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 2215 .channel_mode = alc880_2_jack_modes, 2216 .input_mux = &alc880_capture_source, 2217 }, 2218 [ALC880_5ST] = { 2219 .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer}, 2220 .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, 2221 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2222 .dac_nids = alc880_dac_nids, 2223 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), 2224 .channel_mode = alc880_fivestack_modes, 2225 .input_mux = &alc880_capture_source, 2226 }, 2227 [ALC880_5ST_DIG] = { 2228 .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer }, 2229 .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, 2230 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2231 .dac_nids = alc880_dac_nids, 2232 .dig_out_nid = ALC880_DIGOUT_NID, 2233 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), 2234 .channel_mode = alc880_fivestack_modes, 2235 .input_mux = &alc880_capture_source, 2236 }, 2237 [ALC880_6ST] = { 2238 .mixers = { alc880_six_stack_mixer }, 2239 .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, 2240 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), 2241 .dac_nids = alc880_6st_dac_nids, 2242 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), 2243 .channel_mode = alc880_sixstack_modes, 2244 .input_mux = &alc880_6stack_capture_source, 2245 }, 2246 [ALC880_6ST_DIG] = { 2247 .mixers = { alc880_six_stack_mixer }, 2248 .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, 2249 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), 2250 .dac_nids = alc880_6st_dac_nids, 2251 .dig_out_nid = ALC880_DIGOUT_NID, 2252 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), 2253 .channel_mode = alc880_sixstack_modes, 2254 .input_mux = &alc880_6stack_capture_source, 2255 }, 2256 [ALC880_W810] = { 2257 .mixers = { alc880_w810_base_mixer }, 2258 .init_verbs = { alc880_volume_init_verbs, alc880_pin_w810_init_verbs, 2259 alc880_gpio2_init_verbs }, 2260 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), 2261 .dac_nids = alc880_w810_dac_nids, 2262 .dig_out_nid = ALC880_DIGOUT_NID, 2263 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), 2264 .channel_mode = alc880_w810_modes, 2265 .input_mux = &alc880_capture_source, 2266 }, 2267 [ALC880_Z71V] = { 2268 .mixers = { alc880_z71v_mixer }, 2269 .init_verbs = { alc880_volume_init_verbs, alc880_pin_z71v_init_verbs }, 2270 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), 2271 .dac_nids = alc880_z71v_dac_nids, 2272 .dig_out_nid = ALC880_DIGOUT_NID, 2273 .hp_nid = 0x03, 2274 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 2275 .channel_mode = alc880_2_jack_modes, 2276 .input_mux = &alc880_capture_source, 2277 }, 2278 [ALC880_F1734] = { 2279 .mixers = { alc880_f1734_mixer }, 2280 .init_verbs = { alc880_volume_init_verbs, alc880_pin_f1734_init_verbs }, 2281 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), 2282 .dac_nids = alc880_f1734_dac_nids, 2283 .hp_nid = 0x02, 2284 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 2285 .channel_mode = alc880_2_jack_modes, 2286 .input_mux = &alc880_capture_source, 2287 }, 2288 [ALC880_ASUS] = { 2289 .mixers = { alc880_asus_mixer }, 2290 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, 2291 alc880_gpio1_init_verbs }, 2292 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2293 .dac_nids = alc880_asus_dac_nids, 2294 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2295 .channel_mode = alc880_asus_modes, 2296 .input_mux = &alc880_capture_source, 2297 }, 2298 [ALC880_ASUS_DIG] = { 2299 .mixers = { alc880_asus_mixer }, 2300 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, 2301 alc880_gpio1_init_verbs }, 2302 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2303 .dac_nids = alc880_asus_dac_nids, 2304 .dig_out_nid = ALC880_DIGOUT_NID, 2305 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2306 .channel_mode = alc880_asus_modes, 2307 .input_mux = &alc880_capture_source, 2308 }, 2309 [ALC880_ASUS_DIG2] = { 2310 .mixers = { alc880_asus_mixer }, 2311 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, 2312 alc880_gpio2_init_verbs }, /* use GPIO2 */ 2313 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2314 .dac_nids = alc880_asus_dac_nids, 2315 .dig_out_nid = ALC880_DIGOUT_NID, 2316 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2317 .channel_mode = alc880_asus_modes, 2318 .input_mux = &alc880_capture_source, 2319 }, 2320 [ALC880_ASUS_W1V] = { 2321 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, 2322 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, 2323 alc880_gpio1_init_verbs }, 2324 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2325 .dac_nids = alc880_asus_dac_nids, 2326 .dig_out_nid = ALC880_DIGOUT_NID, 2327 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2328 .channel_mode = alc880_asus_modes, 2329 .input_mux = &alc880_capture_source, 2330 }, 2331 [ALC880_UNIWILL_DIG] = { 2332 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, 2333 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs }, 2334 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2335 .dac_nids = alc880_asus_dac_nids, 2336 .dig_out_nid = ALC880_DIGOUT_NID, 2337 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2338 .channel_mode = alc880_asus_modes, 2339 .input_mux = &alc880_capture_source, 2340 }, 2341 [ALC880_CLEVO] = { 2342 .mixers = { alc880_three_stack_mixer }, 2343 .init_verbs = { alc880_volume_init_verbs, 2344 alc880_pin_clevo_init_verbs }, 2345 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2346 .dac_nids = alc880_dac_nids, 2347 .hp_nid = 0x03, 2348 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2349 .channel_mode = alc880_threestack_modes, 2350 .input_mux = &alc880_capture_source, 2351 }, 2352 [ALC880_LG] = { 2353 .mixers = { alc880_lg_mixer }, 2354 .init_verbs = { alc880_volume_init_verbs, 2355 alc880_lg_init_verbs }, 2356 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), 2357 .dac_nids = alc880_lg_dac_nids, 2358 .dig_out_nid = ALC880_DIGOUT_NID, 2359 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), 2360 .channel_mode = alc880_lg_ch_modes, 2361 .input_mux = &alc880_lg_capture_source, 2362 .unsol_event = alc880_lg_unsol_event, 2363 .init_hook = alc880_lg_automute, 2364 }, 2365 [ALC880_LG_LW] = { 2366 .mixers = { alc880_lg_lw_mixer }, 2367 .init_verbs = { alc880_volume_init_verbs, 2368 alc880_lg_lw_init_verbs }, 2369 .num_dacs = 1, 2370 .dac_nids = alc880_dac_nids, 2371 .dig_out_nid = ALC880_DIGOUT_NID, 2372 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 2373 .channel_mode = alc880_2_jack_modes, 2374 .input_mux = &alc880_lg_lw_capture_source, 2375 .unsol_event = alc880_lg_lw_unsol_event, 2376 .init_hook = alc880_lg_lw_automute, 2377 }, 2443 [ALC880_3ST] = { 2444 .mixers = { alc880_three_stack_mixer }, 2445 .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, 2446 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2447 .dac_nids = alc880_dac_nids, 2448 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2449 .channel_mode = alc880_threestack_modes, 2450 .need_dac_fix = 1, 2451 .input_mux = &alc880_capture_source, 2452 }, 2453 [ALC880_3ST_DIG] = { 2454 .mixers = { alc880_three_stack_mixer }, 2455 .init_verbs = { alc880_volume_init_verbs, alc880_pin_3stack_init_verbs }, 2456 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2457 .dac_nids = alc880_dac_nids, 2458 .dig_out_nid = ALC880_DIGOUT_NID, 2459 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2460 .channel_mode = alc880_threestack_modes, 2461 .need_dac_fix = 1, 2462 .input_mux = &alc880_capture_source, 2463 }, 2464 [ALC880_TCL_S700] = { 2465 .mixers = { alc880_tcl_s700_mixer }, 2466 .init_verbs = { alc880_volume_init_verbs, 2467 alc880_pin_tcl_S700_init_verbs, 2468 alc880_gpio2_init_verbs }, 2469 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2470 .dac_nids = alc880_dac_nids, 2471 .hp_nid = 0x03, 2472 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 2473 .channel_mode = alc880_2_jack_modes, 2474 .input_mux = &alc880_capture_source, 2475 }, 2476 [ALC880_5ST] = { 2477 .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer}, 2478 .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, 2479 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2480 .dac_nids = alc880_dac_nids, 2481 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), 2482 .channel_mode = alc880_fivestack_modes, 2483 .input_mux = &alc880_capture_source, 2484 }, 2485 [ALC880_5ST_DIG] = { 2486 .mixers = { alc880_three_stack_mixer, alc880_five_stack_mixer }, 2487 .init_verbs = { alc880_volume_init_verbs, alc880_pin_5stack_init_verbs }, 2488 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2489 .dac_nids = alc880_dac_nids, 2490 .dig_out_nid = ALC880_DIGOUT_NID, 2491 .num_channel_mode = ARRAY_SIZE(alc880_fivestack_modes), 2492 .channel_mode = alc880_fivestack_modes, 2493 .input_mux = &alc880_capture_source, 2494 }, 2495 [ALC880_6ST] = { 2496 .mixers = { alc880_six_stack_mixer }, 2497 .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, 2498 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), 2499 .dac_nids = alc880_6st_dac_nids, 2500 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), 2501 .channel_mode = alc880_sixstack_modes, 2502 .input_mux = &alc880_6stack_capture_source, 2503 }, 2504 [ALC880_6ST_DIG] = { 2505 .mixers = { alc880_six_stack_mixer }, 2506 .init_verbs = { alc880_volume_init_verbs, alc880_pin_6stack_init_verbs }, 2507 .num_dacs = ARRAY_SIZE(alc880_6st_dac_nids), 2508 .dac_nids = alc880_6st_dac_nids, 2509 .dig_out_nid = ALC880_DIGOUT_NID, 2510 .num_channel_mode = ARRAY_SIZE(alc880_sixstack_modes), 2511 .channel_mode = alc880_sixstack_modes, 2512 .input_mux = &alc880_6stack_capture_source, 2513 }, 2514 [ALC880_W810] = { 2515 .mixers = { alc880_w810_base_mixer }, 2516 .init_verbs = { alc880_volume_init_verbs, alc880_pin_w810_init_verbs, 2517 alc880_gpio2_init_verbs }, 2518 .num_dacs = ARRAY_SIZE(alc880_w810_dac_nids), 2519 .dac_nids = alc880_w810_dac_nids, 2520 .dig_out_nid = ALC880_DIGOUT_NID, 2521 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), 2522 .channel_mode = alc880_w810_modes, 2523 .input_mux = &alc880_capture_source, 2524 }, 2525 [ALC880_Z71V] = { 2526 .mixers = { alc880_z71v_mixer }, 2527 .init_verbs = { alc880_volume_init_verbs, alc880_pin_z71v_init_verbs }, 2528 .num_dacs = ARRAY_SIZE(alc880_z71v_dac_nids), 2529 .dac_nids = alc880_z71v_dac_nids, 2530 .dig_out_nid = ALC880_DIGOUT_NID, 2531 .hp_nid = 0x03, 2532 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 2533 .channel_mode = alc880_2_jack_modes, 2534 .input_mux = &alc880_capture_source, 2535 }, 2536 [ALC880_F1734] = { 2537 .mixers = { alc880_f1734_mixer }, 2538 .init_verbs = { alc880_volume_init_verbs, alc880_pin_f1734_init_verbs }, 2539 .num_dacs = ARRAY_SIZE(alc880_f1734_dac_nids), 2540 .dac_nids = alc880_f1734_dac_nids, 2541 .hp_nid = 0x02, 2542 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 2543 .channel_mode = alc880_2_jack_modes, 2544 .input_mux = &alc880_capture_source, 2545 }, 2546 [ALC880_ASUS] = { 2547 .mixers = { alc880_asus_mixer }, 2548 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, 2549 alc880_gpio1_init_verbs }, 2550 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2551 .dac_nids = alc880_asus_dac_nids, 2552 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2553 .channel_mode = alc880_asus_modes, 2554 .need_dac_fix = 1, 2555 .input_mux = &alc880_capture_source, 2556 }, 2557 [ALC880_ASUS_DIG] = { 2558 .mixers = { alc880_asus_mixer }, 2559 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, 2560 alc880_gpio1_init_verbs }, 2561 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2562 .dac_nids = alc880_asus_dac_nids, 2563 .dig_out_nid = ALC880_DIGOUT_NID, 2564 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2565 .channel_mode = alc880_asus_modes, 2566 .need_dac_fix = 1, 2567 .input_mux = &alc880_capture_source, 2568 }, 2569 [ALC880_ASUS_DIG2] = { 2570 .mixers = { alc880_asus_mixer }, 2571 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, 2572 alc880_gpio2_init_verbs }, /* use GPIO2 */ 2573 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2574 .dac_nids = alc880_asus_dac_nids, 2575 .dig_out_nid = ALC880_DIGOUT_NID, 2576 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2577 .channel_mode = alc880_asus_modes, 2578 .need_dac_fix = 1, 2579 .input_mux = &alc880_capture_source, 2580 }, 2581 [ALC880_ASUS_W1V] = { 2582 .mixers = { alc880_asus_mixer, alc880_asus_w1v_mixer }, 2583 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs, 2584 alc880_gpio1_init_verbs }, 2585 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2586 .dac_nids = alc880_asus_dac_nids, 2587 .dig_out_nid = ALC880_DIGOUT_NID, 2588 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2589 .channel_mode = alc880_asus_modes, 2590 .need_dac_fix = 1, 2591 .input_mux = &alc880_capture_source, 2592 }, 2593 [ALC880_UNIWILL_DIG] = { 2594 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer }, 2595 .init_verbs = { alc880_volume_init_verbs, 2596 alc880_pin_asus_init_verbs }, 2597 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2598 .dac_nids = alc880_asus_dac_nids, 2599 .dig_out_nid = ALC880_DIGOUT_NID, 2600 .num_channel_mode = ARRAY_SIZE(alc880_asus_modes), 2601 .channel_mode = alc880_asus_modes, 2602 .need_dac_fix = 1, 2603 .input_mux = &alc880_capture_source, 2604 }, 2605 [ALC880_UNIWILL] = { 2606 .mixers = { alc880_uniwill_mixer }, 2607 .init_verbs = { alc880_volume_init_verbs, 2608 alc880_uniwill_init_verbs }, 2609 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2610 .dac_nids = alc880_asus_dac_nids, 2611 .dig_out_nid = ALC880_DIGOUT_NID, 2612 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2613 .channel_mode = alc880_threestack_modes, 2614 .need_dac_fix = 1, 2615 .input_mux = &alc880_capture_source, 2616 .unsol_event = alc880_uniwill_unsol_event, 2617 .init_hook = alc880_uniwill_automute, 2618 }, 2619 [ALC880_UNIWILL_P53] = { 2620 .mixers = { alc880_uniwill_p53_mixer }, 2621 .init_verbs = { alc880_volume_init_verbs, 2622 alc880_uniwill_p53_init_verbs }, 2623 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 2624 .dac_nids = alc880_asus_dac_nids, 2625 .num_channel_mode = ARRAY_SIZE(alc880_w810_modes), 2626 .channel_mode = alc880_w810_modes, 2627 .input_mux = &alc880_capture_source, 2628 .unsol_event = alc880_uniwill_p53_unsol_event, 2629 .init_hook = alc880_uniwill_p53_hp_automute, 2630 }, 2631 [ALC880_CLEVO] = { 2632 .mixers = { alc880_three_stack_mixer }, 2633 .init_verbs = { alc880_volume_init_verbs, 2634 alc880_pin_clevo_init_verbs }, 2635 .num_dacs = ARRAY_SIZE(alc880_dac_nids), 2636 .dac_nids = alc880_dac_nids, 2637 .hp_nid = 0x03, 2638 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes), 2639 .channel_mode = alc880_threestack_modes, 2640 .need_dac_fix = 1, 2641 .input_mux = &alc880_capture_source, 2642 }, 2643 [ALC880_LG] = { 2644 .mixers = { alc880_lg_mixer }, 2645 .init_verbs = { alc880_volume_init_verbs, 2646 alc880_lg_init_verbs }, 2647 .num_dacs = ARRAY_SIZE(alc880_lg_dac_nids), 2648 .dac_nids = alc880_lg_dac_nids, 2649 .dig_out_nid = ALC880_DIGOUT_NID, 2650 .num_channel_mode = ARRAY_SIZE(alc880_lg_ch_modes), 2651 .channel_mode = alc880_lg_ch_modes, 2652 .need_dac_fix = 1, 2653 .input_mux = &alc880_lg_capture_source, 2654 .unsol_event = alc880_lg_unsol_event, 2655 .init_hook = alc880_lg_automute, 2656 }, 2657 [ALC880_LG_LW] = { 2658 .mixers = { alc880_lg_lw_mixer }, 2659 .init_verbs = { alc880_volume_init_verbs, 2660 alc880_lg_lw_init_verbs }, 2661 .num_dacs = 1, 2662 .dac_nids = alc880_dac_nids, 2663 .dig_out_nid = ALC880_DIGOUT_NID, 2664 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes), 2665 .channel_mode = alc880_2_jack_modes, 2666 .input_mux = &alc880_lg_lw_capture_source, 2667 .unsol_event = alc880_lg_lw_unsol_event, 2668 .init_hook = alc880_lg_lw_automute, 2669 }, 2378 2670 #ifdef CONFIG_SND_DEBUG 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2671 [ALC880_TEST] = { 2672 .mixers = { alc880_test_mixer }, 2673 .init_verbs = { alc880_test_init_verbs }, 2674 .num_dacs = ARRAY_SIZE(alc880_test_dac_nids), 2675 .dac_nids = alc880_test_dac_nids, 2676 .dig_out_nid = ALC880_DIGOUT_NID, 2677 .num_channel_mode = ARRAY_SIZE(alc880_test_modes), 2678 .channel_mode = alc880_test_modes, 2679 .input_mux = &alc880_test_capture_source, 2680 }, 2389 2681 #endif 2390 2682 }; … … 2398 2690 2399 2691 enum { 2400 2401 2402 2692 ALC_CTL_WIDGET_VOL, 2693 ALC_CTL_WIDGET_MUTE, 2694 ALC_CTL_BIND_MUTE, 2403 2695 }; 2404 2696 static struct snd_kcontrol_new alc880_control_templates[] = { 2405 2406 2407 2697 HDA_CODEC_VOLUME(NULL, 0, 0, 0), 2698 HDA_CODEC_MUTE(NULL, 0, 0, 0), 2699 HDA_BIND_MUTE(NULL, 0, 0, 0), 2408 2700 }; 2409 2701 … … 2411 2703 static int add_control(struct alc_spec *spec, int type, const char *name, unsigned long val) 2412 2704 { 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2705 struct snd_kcontrol_new *knew; 2706 2707 if (spec->num_kctl_used >= spec->num_kctl_alloc) { 2708 int num = spec->num_kctl_alloc + NUM_CONTROL_ALLOC; 2709 2710 knew = kcalloc(num + 1, sizeof(*knew), GFP_KERNEL); /* array + terminator */ 2711 if (! knew) 2712 return -ENOMEM; 2713 if (spec->kctl_alloc) { 2714 memcpy(knew, spec->kctl_alloc, sizeof(*knew) * spec->num_kctl_alloc); 2715 kfree(spec->kctl_alloc); 2716 } 2717 spec->kctl_alloc = knew; 2718 spec->num_kctl_alloc = num; 2719 } 2720 2721 knew = &spec->kctl_alloc[spec->num_kctl_used]; 2722 *knew = alc880_control_templates[type]; 2723 knew->name = kstrdup(name, GFP_KERNEL); 2724 if (! knew->name) 2725 return -ENOMEM; 2726 knew->private_value = val; 2727 spec->num_kctl_used++; 2728 return 0; 2437 2729 } 2438 2730 … … 2452 2744 static int alc880_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pin_cfg *cfg) 2453 2745 { 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2746 hda_nid_t nid; 2747 int assigned[4]; 2748 int i, j; 2749 2750 memset(assigned, 0, sizeof(assigned)); 2751 spec->multiout.dac_nids = spec->private_dac_nids; 2752 2753 /* check the pins hardwired to audio widget */ 2754 for (i = 0; i < cfg->line_outs; i++) { 2755 nid = cfg->line_out_pins[i]; 2756 if (alc880_is_fixed_pin(nid)) { 2757 int idx = alc880_fixed_pin_idx(nid); 2758 spec->multiout.dac_nids[i] = alc880_idx_to_dac(idx); 2759 assigned[idx] = 1; 2760 } 2761 } 2762 /* left pins can be connect to any audio widget */ 2763 for (i = 0; i < cfg->line_outs; i++) { 2764 nid = cfg->line_out_pins[i]; 2765 if (alc880_is_fixed_pin(nid)) 2766 continue; 2767 /* search for an empty channel */ 2768 for (j = 0; j < cfg->line_outs; j++) { 2769 if (! assigned[j]) { 2770 spec->multiout.dac_nids[i] = alc880_idx_to_dac(j); 2771 assigned[j] = 1; 2772 break; 2773 } 2774 } 2775 } 2776 spec->multiout.num_dacs = cfg->line_outs; 2777 return 0; 2486 2778 } 2487 2779 2488 2780 /* add playback controls from the parsed DAC table */ 2489 2781 static int alc880_auto_create_multi_out_ctls(struct alc_spec *spec, 2490 2491 { 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2782 const struct auto_pin_cfg *cfg) 2783 { 2784 char name[32]; 2785 static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; 2786 hda_nid_t nid; 2787 int i, err; 2788 2789 for (i = 0; i < cfg->line_outs; i++) { 2790 if (! spec->multiout.dac_nids[i]) 2791 continue; 2792 nid = alc880_idx_to_mixer(alc880_dac_to_idx(spec->multiout.dac_nids[i])); 2793 if (i == 2) { 2794 /* Center/LFE */ 2795 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Center Playback Volume", 2796 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) 2797 return err; 2798 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "LFE Playback Volume", 2799 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) 2800 return err; 2801 if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "Center Playback Switch", 2802 HDA_COMPOSE_AMP_VAL(nid, 1, 2, HDA_INPUT))) < 0) 2803 return err; 2804 if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "LFE Playback Switch", 2805 HDA_COMPOSE_AMP_VAL(nid, 2, 2, HDA_INPUT))) < 0) 2806 return err; 2807 } else { 2808 sprintf(name, "%s Playback Volume", chname[i]); 2809 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, 2810 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 2811 return err; 2812 sprintf(name, "%s Playback Switch", chname[i]); 2813 if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, 2814 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0) 2815 return err; 2816 } 2817 } 2818 return 0; 2527 2819 } 2528 2820 2529 2821 /* add playback controls for speaker and HP outputs */ 2530 2822 static int alc880_auto_create_extra_out(struct alc_spec *spec, hda_nid_t pin, 2531 2532 { 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2823 const char *pfx) 2824 { 2825 hda_nid_t nid; 2826 int err; 2827 char name[32]; 2828 2829 if (! pin) 2830 return 0; 2831 2832 if (alc880_is_fixed_pin(pin)) { 2833 nid = alc880_idx_to_dac(alc880_fixed_pin_idx(pin)); 2834 /* specify the DAC as the extra output */ 2835 if (! spec->multiout.hp_nid) 2836 spec->multiout.hp_nid = nid; 2837 else 2838 spec->multiout.extra_out_nid[0] = nid; 2839 /* control HP volume/switch on the output mixer amp */ 2840 nid = alc880_idx_to_mixer(alc880_fixed_pin_idx(pin)); 2841 sprintf(name, "%s Playback Volume", pfx); 2842 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, 2843 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 2844 return err; 2845 sprintf(name, "%s Playback Switch", pfx); 2846 if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, 2847 HDA_COMPOSE_AMP_VAL(nid, 3, 2, HDA_INPUT))) < 0) 2848 return err; 2849 } else if (alc880_is_multi_pin(pin)) { 2850 /* set manual connection */ 2851 /* we have only a switch on HP-out PIN */ 2852 sprintf(name, "%s Playback Switch", pfx); 2853 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, 2854 HDA_COMPOSE_AMP_VAL(pin, 3, 0, HDA_OUTPUT))) < 0) 2855 return err; 2856 } 2857 return 0; 2566 2858 } 2567 2859 2568 2860 /* create input playback/capture controls for the given pin */ 2569 2861 static int new_analog_input(struct alc_spec *spec, hda_nid_t pin, const char *ctlname, 2570 2571 { 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2862 int idx, hda_nid_t mix_nid) 2863 { 2864 char name[32]; 2865 int err; 2866 2867 sprintf(name, "%s Playback Volume", ctlname); 2868 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, 2869 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT))) < 0) 2870 return err; 2871 sprintf(name, "%s Playback Switch", ctlname); 2872 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, 2873 HDA_COMPOSE_AMP_VAL(mix_nid, 3, idx, HDA_INPUT))) < 0) 2874 return err; 2875 return 0; 2584 2876 } 2585 2877 2586 2878 /* create playback/capture controls for input pins */ 2587 2879 static int alc880_auto_create_analog_input_ctls(struct alc_spec *spec, 2588 2589 { 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2880 const struct auto_pin_cfg *cfg) 2881 { 2882 struct hda_input_mux *imux = &spec->private_imux; 2883 int i, err, idx; 2884 2885 for (i = 0; i < AUTO_PIN_LAST; i++) { 2886 if (alc880_is_input_pin(cfg->input_pins[i])) { 2887 idx = alc880_input_pin_idx(cfg->input_pins[i]); 2888 err = new_analog_input(spec, cfg->input_pins[i], 2889 auto_pin_cfg_labels[i], 2890 idx, 0x0b); 2891 if (err < 0) 2892 return err; 2893 imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; 2894 imux->items[imux->num_items].index = alc880_input_pin_idx(cfg->input_pins[i]); 2895 imux->num_items++; 2896 } 2897 } 2898 return 0; 2607 2899 } 2608 2900 2609 2901 static void alc880_auto_set_output_and_unmute(struct hda_codec *codec, 2610 2611 2612 { 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2902 hda_nid_t nid, int pin_type, 2903 int dac_idx) 2904 { 2905 /* set as output */ 2906 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); 2907 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 2908 /* need the manual connection? */ 2909 if (alc880_is_multi_pin(nid)) { 2910 struct alc_spec *spec = codec->spec; 2911 int idx = alc880_multi_pin_idx(nid); 2912 snd_hda_codec_write(codec, alc880_idx_to_selector(idx), 0, 2913 AC_VERB_SET_CONNECT_SEL, 2914 alc880_dac_to_idx(spec->multiout.dac_nids[dac_idx])); 2915 } 2624 2916 } 2625 2917 2626 2918 static void alc880_auto_init_multi_out(struct hda_codec *codec) 2627 2919 { 2628 2629 2630 2631 2632 2633 2634 2920 struct alc_spec *spec = codec->spec; 2921 int i; 2922 2923 for (i = 0; i < spec->autocfg.line_outs; i++) { 2924 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 2925 alc880_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); 2926 } 2635 2927 } 2636 2928 2637 2929 static void alc880_auto_init_extra_out(struct hda_codec *codec) 2638 2930 { 2639 2640 2641 2642 2643 2644 2645 pin = spec->autocfg.hp_pin;2646 2647 2931 struct alc_spec *spec = codec->spec; 2932 hda_nid_t pin; 2933 2934 pin = spec->autocfg.speaker_pins[0]; 2935 if (pin) /* connect to front */ 2936 alc880_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); 2937 pin = spec->autocfg.hp_pins[0]; 2938 if (pin) /* connect to front */ 2939 alc880_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 2648 2940 } 2649 2941 2650 2942 static void alc880_auto_init_analog_input(struct hda_codec *codec) 2651 2943 { 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2944 struct alc_spec *spec = codec->spec; 2945 int i; 2946 2947 for (i = 0; i < AUTO_PIN_LAST; i++) { 2948 hda_nid_t nid = spec->autocfg.input_pins[i]; 2949 if (alc880_is_input_pin(nid)) { 2950 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 2951 i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); 2952 if (nid != ALC880_PIN_CD_NID) 2953 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 2954 AMP_OUT_MUTE); 2955 } 2956 } 2665 2957 } 2666 2958 … … 2669 2961 static int alc880_parse_auto_config(struct hda_codec *codec) 2670 2962 { 2671 struct alc_spec *spec = codec->spec; 2672 int err; 2673 static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; 2674 2675 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 2676 alc880_ignore)) < 0) 2677 return err; 2678 if (! spec->autocfg.line_outs) 2679 return 0; /* can't find valid BIOS pin config */ 2680 2681 if ((err = alc880_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || 2682 (err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 2683 (err = alc880_auto_create_extra_out(spec, 2684 spec->autocfg.speaker_pins[0], 2685 "Speaker")) < 0 || 2686 (err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pin, 2687 "Headphone")) < 0 || 2688 (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 2689 return err; 2690 2691 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 2692 2693 if (spec->autocfg.dig_out_pin) 2694 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; 2695 if (spec->autocfg.dig_in_pin) 2696 spec->dig_in_nid = ALC880_DIGIN_NID; 2697 2698 if (spec->kctl_alloc) 2699 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 2700 2701 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; 2702 2703 spec->input_mux = &spec->private_imux; 2704 2705 return 1; 2963 struct alc_spec *spec = codec->spec; 2964 int err; 2965 static hda_nid_t alc880_ignore[] = { 0x1d, 0 }; 2966 2967 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 2968 alc880_ignore)) < 0) 2969 return err; 2970 if (! spec->autocfg.line_outs) 2971 return 0; /* can't find valid BIOS pin config */ 2972 2973 if ((err = alc880_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || 2974 (err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 2975 (err = alc880_auto_create_extra_out(spec, 2976 spec->autocfg.speaker_pins[0], 2977 "Speaker")) < 0 || 2978 (err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0], 2979 "Headphone")) < 0 || 2980 (err = alc880_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 2981 return err; 2982 2983 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 2984 2985 if (spec->autocfg.dig_out_pin) 2986 spec->multiout.dig_out_nid = ALC880_DIGOUT_NID; 2987 if (spec->autocfg.dig_in_pin) 2988 spec->dig_in_nid = ALC880_DIGIN_NID; 2989 2990 if (spec->kctl_alloc) 2991 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 2992 2993 spec->init_verbs[spec->num_init_verbs++] = alc880_volume_init_verbs; 2994 2995 spec->num_mux_defs = 1; 2996 spec->input_mux = &spec->private_imux; 2997 2998 return 1; 2706 2999 } 2707 3000 … … 2709 3002 static void alc880_auto_init(struct hda_codec *codec) 2710 3003 { 2711 2712 2713 3004 alc880_auto_init_multi_out(codec); 3005 alc880_auto_init_extra_out(codec); 3006 alc880_auto_init_analog_input(codec); 2714 3007 } 2715 3008 … … 2720 3013 static int patch_alc880(struct hda_codec *codec) 2721 3014 { 2722 struct alc_spec *spec; 2723 int board_config; 2724 int err; 2725 2726 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 2727 if (spec == NULL) 2728 return -ENOMEM; 2729 2730 codec->spec = spec; 2731 2732 board_config = snd_hda_check_board_config(codec, alc880_cfg_tbl); 2733 if (board_config < 0 || board_config >= ALC880_MODEL_LAST) { 2734 printk(KERN_INFO "hda_codec: Unknown model for ALC880, trying auto-probe from BIOS...\n"); 2735 board_config = ALC880_AUTO; 2736 } 2737 2738 if (board_config == ALC880_AUTO) { 2739 /* automatic parse from the BIOS config */ 2740 err = alc880_parse_auto_config(codec); 2741 if (err < 0) { 2742 alc_free(codec); 2743 return err; 2744 } else if (! err) { 2745 printk(KERN_INFO "hda_codec: Cannot set up configuration from BIOS. Using 3-stack mode...\n"); 2746 board_config = ALC880_3ST; 2747 } 2748 } 2749 2750 if (board_config != ALC880_AUTO) 2751 setup_preset(spec, &alc880_presets[board_config]); 2752 2753 spec->stream_name_analog = "ALC880 Analog"; 2754 spec->stream_analog_playback = &alc880_pcm_analog_playback; 2755 spec->stream_analog_capture = &alc880_pcm_analog_capture; 2756 2757 spec->stream_name_digital = "ALC880 Digital"; 2758 spec->stream_digital_playback = &alc880_pcm_digital_playback; 2759 spec->stream_digital_capture = &alc880_pcm_digital_capture; 2760 2761 if (! spec->adc_nids && spec->input_mux) { 2762 /* check whether NID 0x07 is valid */ 2763 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); 2764 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 2765 if (wcap != AC_WID_AUD_IN) { 2766 spec->adc_nids = alc880_adc_nids_alt; 2767 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); 2768 spec->mixers[spec->num_mixers] = alc880_capture_alt_mixer; 2769 spec->num_mixers++; 2770 } else { 2771 spec->adc_nids = alc880_adc_nids; 2772 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); 2773 spec->mixers[spec->num_mixers] = alc880_capture_mixer; 2774 spec->num_mixers++; 2775 } 2776 } 2777 2778 codec->patch_ops = alc_patch_ops; 2779 if (board_config == ALC880_AUTO) 2780 spec->init_hook = alc880_auto_init; 2781 2782 return 0; 3015 struct alc_spec *spec; 3016 int board_config; 3017 int err; 3018 3019 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 3020 if (spec == NULL) 3021 return -ENOMEM; 3022 3023 codec->spec = spec; 3024 3025 board_config = snd_hda_check_board_config(codec, ALC880_MODEL_LAST, 3026 alc880_models, 3027 alc880_cfg_tbl); 3028 if (board_config < 0) { 3029 printk(KERN_INFO "hda_codec: Unknown model for ALC880, " 3030 "trying auto-probe from BIOS...\n"); 3031 board_config = ALC880_AUTO; 3032 } 3033 3034 if (board_config == ALC880_AUTO) { 3035 /* automatic parse from the BIOS config */ 3036 err = alc880_parse_auto_config(codec); 3037 if (err < 0) { 3038 alc_free(codec); 3039 return err; 3040 } else if (! err) { 3041 printk(KERN_INFO 3042 "hda_codec: Cannot set up configuration " 3043 "from BIOS. Using 3-stack mode...\n"); 3044 board_config = ALC880_3ST; 3045 } 3046 } 3047 3048 if (board_config != ALC880_AUTO) 3049 setup_preset(spec, &alc880_presets[board_config]); 3050 3051 spec->stream_name_analog = "ALC880 Analog"; 3052 spec->stream_analog_playback = &alc880_pcm_analog_playback; 3053 spec->stream_analog_capture = &alc880_pcm_analog_capture; 3054 3055 spec->stream_name_digital = "ALC880 Digital"; 3056 spec->stream_digital_playback = &alc880_pcm_digital_playback; 3057 spec->stream_digital_capture = &alc880_pcm_digital_capture; 3058 3059 if (! spec->adc_nids && spec->input_mux) { 3060 /* check whether NID 0x07 is valid */ 3061 unsigned int wcap = get_wcaps(codec, alc880_adc_nids[0]); 3062 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 3063 if (wcap != AC_WID_AUD_IN) { 3064 spec->adc_nids = alc880_adc_nids_alt; 3065 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids_alt); 3066 spec->mixers[spec->num_mixers] = alc880_capture_alt_mixer; 3067 spec->num_mixers++; 3068 } else { 3069 spec->adc_nids = alc880_adc_nids; 3070 spec->num_adc_nids = ARRAY_SIZE(alc880_adc_nids); 3071 spec->mixers[spec->num_mixers] = alc880_capture_mixer; 3072 spec->num_mixers++; 3073 } 3074 } 3075 3076 codec->patch_ops = alc_patch_ops; 3077 if (board_config == ALC880_AUTO) 3078 spec->init_hook = alc880_auto_init; 3079 3080 return 0; 2783 3081 } 2784 3082 … … 2789 3087 2790 3088 static hda_nid_t alc260_dac_nids[1] = { 2791 2792 3089 /* front */ 3090 0x02, 2793 3091 }; 2794 3092 2795 3093 static hda_nid_t alc260_adc_nids[1] = { 2796 2797 3094 /* ADC0 */ 3095 0x04, 2798 3096 }; 2799 3097 2800 3098 static hda_nid_t alc260_adc_nids_alt[1] = { 2801 2802 3099 /* ADC1 */ 3100 0x05, 2803 3101 }; 2804 3102 2805 3103 static hda_nid_t alc260_hp_adc_nids[2] = { 2806 2807 3104 /* ADC1, 0 */ 3105 0x05, 0x04 2808 3106 }; 2809 3107 … … 2812 3110 */ 2813 3111 static hda_nid_t alc260_dual_adc_nids[2] = { 2814 2815 3112 /* ADC0, ADC1 */ 3113 0x04, 0x05 2816 3114 }; 2817 3115 … … 2820 3118 2821 3119 static struct hda_input_mux alc260_capture_source = { 2822 2823 2824 2825 2826 2827 2828 3120 .num_items = 4, 3121 .items = { 3122 { "Mic", 0x0 }, 3123 { "Front Mic", 0x1 }, 3124 { "Line", 0x2 }, 3125 { "CD", 0x4 }, 3126 }, 2829 3127 }; 2830 3128 2831 3129 /* On Fujitsu S702x laptops capture only makes sense from Mic/LineIn jack, 2832 * headphone jack and the internal CD lines. 2833 */ 2834 static struct hda_input_mux alc260_fujitsu_capture_source = { 2835 .num_items = 3, 2836 .items = { 2837 { "Mic/Line", 0x0 }, 2838 { "CD", 0x4 }, 2839 { "Headphone", 0x2 }, 2840 }, 2841 }; 2842 2843 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configutation to 2844 * the Fujitsu S702x, but jacks are marked differently. We won't allow 2845 * retasking the Headphone jack, so it won't be available here. 2846 */ 2847 static struct hda_input_mux alc260_acer_capture_source = { 2848 .num_items = 3, 2849 .items = { 2850 { "Mic", 0x0 }, 2851 { "Line", 0x2 }, 2852 { "CD", 0x4 }, 2853 }, 2854 }; 2855 3130 * headphone jack and the internal CD lines since these are the only pins at 3131 * which audio can appear. For flexibility, also allow the option of 3132 * recording the mixer output on the second ADC (ADC0 doesn't have a 3133 * connection to the mixer output). 3134 */ 3135 static struct hda_input_mux alc260_fujitsu_capture_sources[2] = { 3136 { 3137 .num_items = 3, 3138 .items = { 3139 { "Mic/Line", 0x0 }, 3140 { "CD", 0x4 }, 3141 { "Headphone", 0x2 }, 3142 }, 3143 }, 3144 { 3145 .num_items = 4, 3146 .items = { 3147 { "Mic/Line", 0x0 }, 3148 { "CD", 0x4 }, 3149 { "Headphone", 0x2 }, 3150 { "Mixer", 0x5 }, 3151 }, 3152 }, 3153 3154 }; 3155 3156 /* Acer TravelMate(/Extensa/Aspire) notebooks have similar configuration to 3157 * the Fujitsu S702x, but jacks are marked differently. 3158 */ 3159 static struct hda_input_mux alc260_acer_capture_sources[2] = { 3160 { 3161 .num_items = 4, 3162 .items = { 3163 { "Mic", 0x0 }, 3164 { "Line", 0x2 }, 3165 { "CD", 0x4 }, 3166 { "Headphone", 0x5 }, 3167 }, 3168 }, 3169 { 3170 .num_items = 5, 3171 .items = { 3172 { "Mic", 0x0 }, 3173 { "Line", 0x2 }, 3174 { "CD", 0x4 }, 3175 { "Headphone", 0x6 }, 3176 { "Mixer", 0x5 }, 3177 }, 3178 }, 3179 }; 2856 3180 /* 2857 3181 * This is just place-holder, so there's something for alc_build_pcms to look … … 2861 3185 */ 2862 3186 static struct hda_channel_mode alc260_modes[1] = { 2863 3187 { 2, NULL }, 2864 3188 }; 2865 3189 … … 2875 3199 2876 3200 static struct snd_kcontrol_new alc260_base_output_mixer[] = { 2877 2878 2879 2880 2881 2882 2883 2884 }; 3201 HDA_CODEC_VOLUME("Front Playback Volume", 0x08, 0x0, HDA_OUTPUT), 3202 HDA_BIND_MUTE("Front Playback Switch", 0x08, 2, HDA_INPUT), 3203 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x09, 0x0, HDA_OUTPUT), 3204 HDA_BIND_MUTE("Headphone Playback Switch", 0x09, 2, HDA_INPUT), 3205 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 3206 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), 3207 {0} /* end */ 3208 }; 2885 3209 2886 3210 static struct snd_kcontrol_new alc260_input_mixer[] = { 2887 2888 2889 2890 2891 2892 2893 2894 2895 3211 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 3212 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 3213 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), 3214 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), 3215 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), 3216 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), 3217 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x07, 0x01, HDA_INPUT), 3218 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x07, 0x01, HDA_INPUT), 3219 {0} /* end */ 2896 3220 }; 2897 3221 2898 3222 static struct snd_kcontrol_new alc260_pc_beep_mixer[] = { 2899 2900 2901 3223 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x07, 0x05, HDA_INPUT), 3224 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x07, 0x05, HDA_INPUT), 3225 {0} /* end */ 2902 3226 }; 2903 3227 2904 3228 static struct snd_kcontrol_new alc260_hp_3013_mixer[] = { 2905 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), 2906 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), 2907 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), 2908 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), 2909 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), 2910 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 2911 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 2912 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), 2913 {0} /* end */ 2914 }; 2915 3229 HDA_CODEC_VOLUME("Front Playback Volume", 0x09, 0x0, HDA_OUTPUT), 3230 HDA_CODEC_MUTE("Front Playback Switch", 0x10, 0x0, HDA_OUTPUT), 3231 HDA_CODEC_VOLUME("Aux-In Playback Volume", 0x07, 0x06, HDA_INPUT), 3232 HDA_CODEC_MUTE("Aux-In Playback Switch", 0x07, 0x06, HDA_INPUT), 3233 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), 3234 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 3235 HDA_CODEC_VOLUME_MONO("iSpeaker Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 3236 HDA_CODEC_MUTE_MONO("iSpeaker Playback Switch", 0x11, 1, 0x0, HDA_OUTPUT), 3237 {0} /* end */ 3238 }; 3239 3240 /* Fujitsu S702x series laptops. ALC260 pin usage: Mic/Line jack = 0x12, 3241 * HP jack = 0x14, CD audio = 0x16, internal speaker = 0x10. 3242 */ 2916 3243 static struct snd_kcontrol_new alc260_fujitsu_mixer[] = { 2917 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), 2918 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), 2919 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), 2920 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 2921 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 2922 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), 2923 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), 2924 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), 2925 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 2926 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 2927 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), 2928 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), 2929 {0} /* end */ 2930 }; 2931 3244 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x08, 0x0, HDA_OUTPUT), 3245 HDA_BIND_MUTE("Headphone Playback Switch", 0x08, 2, HDA_INPUT), 3246 ALC_PIN_MODE("Headphone Jack Mode", 0x14, ALC_PIN_DIR_INOUT), 3247 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 3248 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 3249 HDA_CODEC_VOLUME("Mic/Line Playback Volume", 0x07, 0x0, HDA_INPUT), 3250 HDA_CODEC_MUTE("Mic/Line Playback Switch", 0x07, 0x0, HDA_INPUT), 3251 ALC_PIN_MODE("Mic/Line Jack Mode", 0x12, ALC_PIN_DIR_IN), 3252 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 3253 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 3254 HDA_CODEC_VOLUME("Internal Speaker Playback Volume", 0x09, 0x0, HDA_OUTPUT), 3255 HDA_BIND_MUTE("Internal Speaker Playback Switch", 0x09, 2, HDA_INPUT), 3256 {0} /* end */ 3257 }; 3258 3259 /* Mixer for Acer TravelMate(/Extensa/Aspire) notebooks. Note that current 3260 * versions of the ALC260 don't act on requests to enable mic bias from NID 3261 * 0x0f (used to drive the headphone jack in these laptops). The ALC260 3262 * datasheet doesn't mention this restriction. At this stage it's not clear 3263 * whether this behaviour is intentional or is a hardware bug in chip 3264 * revisions available in early 2006. Therefore for now allow the 3265 * "Headphone Jack Mode" control to span all choices, but if it turns out 3266 * that the lack of mic bias for this NID is intentional we could change the 3267 * mode from ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. 3268 * 3269 * In addition, Acer TravelMate(/Extensa/Aspire) notebooks in early 2006 3270 * don't appear to make the mic bias available from the "line" jack, even 3271 * though the NID used for this jack (0x14) can supply it. The theory is 3272 * that perhaps Acer have included blocking capacitors between the ALC260 3273 * and the output jack. If this turns out to be the case for all such 3274 * models the "Line Jack Mode" mode could be changed from ALC_PIN_DIR_INOUT 3275 * to ALC_PIN_DIR_INOUT_NOMICBIAS. 3276 * 3277 * The C20x Tablet series have a mono internal speaker which is controlled 3278 * via the chip's Mono sum widget and pin complex, so include the necessary 3279 * controls for such models. On models without a "mono speaker" the control 3280 * won't do anything. 3281 */ 2932 3282 static struct snd_kcontrol_new alc260_acer_mixer[] = { 2933 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), 2934 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), 2935 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 2936 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 2937 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), 2938 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), 2939 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), 2940 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), 2941 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), 2942 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), 2943 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 2944 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 2945 {0} /* end */ 3283 HDA_CODEC_VOLUME("Master Playback Volume", 0x08, 0x0, HDA_OUTPUT), 3284 HDA_BIND_MUTE("Master Playback Switch", 0x08, 2, HDA_INPUT), 3285 ALC_PIN_MODE("Headphone Jack Mode", 0x0f, ALC_PIN_DIR_INOUT), 3286 HDA_CODEC_VOLUME_MONO("Mono Speaker Playback Volume", 0x0a, 1, 0x0, 3287 HDA_OUTPUT), 3288 HDA_BIND_MUTE_MONO("Mono Speaker Playback Switch", 0x0a, 1, 2, 3289 HDA_INPUT), 3290 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 3291 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 3292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x07, 0x0, HDA_INPUT), 3293 HDA_CODEC_MUTE("Mic Playback Switch", 0x07, 0x0, HDA_INPUT), 3294 ALC_PIN_MODE("Mic Jack Mode", 0x12, ALC_PIN_DIR_IN), 3295 HDA_CODEC_VOLUME("Line Playback Volume", 0x07, 0x02, HDA_INPUT), 3296 HDA_CODEC_MUTE("Line Playback Switch", 0x07, 0x02, HDA_INPUT), 3297 ALC_PIN_MODE("Line Jack Mode", 0x14, ALC_PIN_DIR_INOUT), 3298 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 3299 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 3300 {0} /* end */ 2946 3301 }; 2947 3302 2948 3303 /* capture mixer elements */ 2949 3304 static struct snd_kcontrol_new alc260_capture_mixer[] = { 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 3305 HDA_CODEC_VOLUME("Capture Volume", 0x04, 0x0, HDA_INPUT), 3306 HDA_CODEC_MUTE("Capture Switch", 0x04, 0x0, HDA_INPUT), 3307 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x05, 0x0, HDA_INPUT), 3308 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x05, 0x0, HDA_INPUT), 3309 { 3310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3311 /* The multiple "Capture Source" controls confuse alsamixer 3312 * So call somewhat different.. 3313 * FIXME: the controls appear in the "playback" view! 3314 */ 3315 /* .name = "Capture Source", */ 3316 .name = "Input Source", 3317 .count = 2, 3318 .info = alc_mux_enum_info, 3319 .get = alc_mux_enum_get, 3320 .put = alc_mux_enum_put, 3321 }, 3322 {0} /* end */ 2968 3323 }; 2969 3324 2970 3325 static struct snd_kcontrol_new alc260_capture_alt_mixer[] = { 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 3326 HDA_CODEC_VOLUME("Capture Volume", 0x05, 0x0, HDA_INPUT), 3327 HDA_CODEC_MUTE("Capture Switch", 0x05, 0x0, HDA_INPUT), 3328 { 3329 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3330 /* The multiple "Capture Source" controls confuse alsamixer 3331 * So call somewhat different.. 3332 * FIXME: the controls appear in the "playback" view! 3333 */ 3334 /* .name = "Capture Source", */ 3335 .name = "Input Source", 3336 .count = 1, 3337 .info = alc_mux_enum_info, 3338 .get = alc_mux_enum_get, 3339 .put = alc_mux_enum_put, 3340 }, 3341 {0} /* end */ 2987 3342 }; 2988 3343 … … 2991 3346 */ 2992 3347 static struct hda_verb alc260_init_verbs[] = { 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3348 /* Line In pin widget for input */ 3349 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 3350 /* CD pin widget for input */ 3351 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 3352 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 3353 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3354 /* Mic2 (front panel) pin widget for input and vref at 80% */ 3355 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 3356 /* LINE-2 is used for line-out in rear */ 3357 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3358 /* select line-out */ 3359 {0x0e, AC_VERB_SET_CONNECT_SEL, 0x00}, 3360 /* LINE-OUT pin */ 3361 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3362 /* enable HP */ 3363 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3364 /* enable Mono */ 3365 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3366 /* mute capture amp left and right */ 3367 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3368 /* set connection select to line in (default select for this ADC) */ 3369 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, 3370 /* mute capture amp left and right */ 3371 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3372 /* set connection select to line in (default select for this ADC) */ 3373 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, 3374 /* set vol=0 Line-Out mixer amp left and right */ 3375 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3376 /* unmute pin widget amp left and right (no gain on this amp) */ 3377 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3378 /* set vol=0 HP mixer amp left and right */ 3379 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3380 /* unmute pin widget amp left and right (no gain on this amp) */ 3381 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3382 /* set vol=0 Mono mixer amp left and right */ 3383 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3384 /* unmute pin widget amp left and right (no gain on this amp) */ 3385 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3386 /* unmute LINE-2 out pin */ 3387 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3388 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ 3389 /* mute CD */ 3390 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 3391 /* mute Line In */ 3392 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 3393 /* mute Mic */ 3394 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3395 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ 3396 /* mute Front out path */ 3397 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3398 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3399 /* mute Headphone out path */ 3400 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3401 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3402 /* mute Mono out path */ 3403 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3404 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3405 {0} 3051 3406 }; 3052 3407 3053 3408 #if 0 /* should be identical with alc260_init_verbs? */ 3054 3409 static struct hda_verb alc260_hp_init_verbs[] = { 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3410 /* Headphone and output */ 3411 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 3412 /* mono output */ 3413 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 3414 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 3415 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 3416 /* Mic2 (front panel) pin widget for input and vref at 80% */ 3417 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 3418 /* Line In pin widget for input */ 3419 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 3420 /* Line-2 pin widget for output */ 3421 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 3422 /* CD pin widget for input */ 3423 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 3424 /* unmute amp left and right */ 3425 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, 3426 /* set connection select to line in (default select for this ADC) */ 3427 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, 3428 /* unmute Line-Out mixer amp left and right (volume = 0) */ 3429 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 3430 /* mute pin widget amp left and right (no gain on this amp) */ 3431 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 3432 /* unmute HP mixer amp left and right (volume = 0) */ 3433 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 3434 /* mute pin widget amp left and right (no gain on this amp) */ 3435 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 3436 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ 3437 /* unmute CD */ 3438 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, 3439 /* unmute Line In */ 3440 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, 3441 /* unmute Mic */ 3442 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 3443 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ 3444 /* Unmute Front out path */ 3445 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 3446 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 3447 /* Unmute Headphone out path */ 3448 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 3449 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 3450 /* Unmute Mono out path */ 3451 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 3452 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 3453 {0} 3099 3454 }; 3100 3455 #endif 3101 3456 3102 3457 static struct hda_verb alc260_hp_3013_init_verbs[] = { 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3458 /* Line out and output */ 3459 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 3460 /* mono output */ 3461 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 3462 /* Mic1 (rear panel) pin widget for input and vref at 80% */ 3463 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 3464 /* Mic2 (front panel) pin widget for input and vref at 80% */ 3465 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 3466 /* Line In pin widget for input */ 3467 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 3468 /* Headphone pin widget for output */ 3469 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 3470 /* CD pin widget for input */ 3471 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 3472 /* unmute amp left and right */ 3473 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000}, 3474 /* set connection select to line in (default select for this ADC) */ 3475 {0x04, AC_VERB_SET_CONNECT_SEL, 0x02}, 3476 /* unmute Line-Out mixer amp left and right (volume = 0) */ 3477 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 3478 /* mute pin widget amp left and right (no gain on this amp) */ 3479 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 3480 /* unmute HP mixer amp left and right (volume = 0) */ 3481 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 3482 /* mute pin widget amp left and right (no gain on this amp) */ 3483 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 3484 /* Amp Indexes: CD = 0x04, Line In 1 = 0x02, Mic 1 = 0x00 & Line In 2 = 0x03 */ 3485 /* unmute CD */ 3486 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, 3487 /* unmute Line In */ 3488 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, 3489 /* unmute Mic */ 3490 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 3491 /* Amp Indexes: DAC = 0x01 & mixer = 0x00 */ 3492 /* Unmute Front out path */ 3493 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 3494 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 3495 /* Unmute Headphone out path */ 3496 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 3497 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 3498 /* Unmute Mono out path */ 3499 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 3500 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, 3501 {0} 3147 3502 }; 3148 3503 3149 3504 /* Initialisation sequence for ALC260 as configured in Fujitsu S702x 3150 * laptops. 3505 * laptops. ALC260 pin usage: Mic/Line jack = 0x12, HP jack = 0x14, CD 3506 * audio = 0x16, internal speaker = 0x10. 3151 3507 */ 3152 3508 static struct hda_verb alc260_fujitsu_init_verbs[] = { 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 /* Unmute input buffer of pin widget used for Line-in (no equiv 3201 3202 3203 3204 3205 3206 3207 /* Set ADC connection select to match default mixer setting - line 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3509 /* Disable all GPIOs */ 3510 {0x01, AC_VERB_SET_GPIO_MASK, 0}, 3511 /* Internal speaker is connected to headphone pin */ 3512 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3513 /* Headphone/Line-out jack connects to Line1 pin; make it an output */ 3514 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3515 /* Mic/Line-in jack is connected to mic1 pin, so make it an input */ 3516 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 3517 /* Ensure all other unused pins are disabled and muted. */ 3518 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3519 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3520 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3521 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3522 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3523 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3524 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3525 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3526 3527 /* Disable digital (SPDIF) pins */ 3528 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 3529 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 3530 3531 /* Ensure Line1 pin widget takes its input from the OUT1 sum bus 3532 * when acting as an output. 3533 */ 3534 {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, 3535 3536 /* Start with output sum widgets muted and their output gains at min */ 3537 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3538 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3539 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3540 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3541 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3542 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3543 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3544 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3545 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3546 3547 /* Unmute HP pin widget amp left and right (no equiv mixer ctrl) */ 3548 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3549 /* Unmute Line1 pin widget output buffer since it starts as an output. 3550 * If the pin mode is changed by the user the pin mode control will 3551 * take care of enabling the pin's input/output buffers as needed. 3552 * Therefore there's no need to enable the input buffer at this 3553 * stage. 3554 */ 3555 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3556 /* Unmute input buffer of pin widget used for Line-in (no equiv 3557 * mixer ctrl) 3558 */ 3559 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3560 3561 /* Mute capture amp left and right */ 3562 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3563 /* Set ADC connection select to match default mixer setting - line 3564 * in (on mic1 pin) 3565 */ 3566 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, 3567 3568 /* Do the same for the second ADC: mute capture input amp and 3569 * set ADC connection to line in (on mic1 pin) 3570 */ 3571 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3572 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, 3573 3574 /* Mute all inputs to mixer widget (even unconnected ones) */ 3575 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ 3576 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ 3577 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ 3578 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ 3579 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ 3580 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ 3581 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ 3582 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ 3583 3584 {0} 3229 3585 }; 3230 3586 … … 3233 3589 */ 3234 3590 static struct hda_verb alc260_acer_init_verbs[] = { 3235 /* On TravelMate laptops, GPIO 0 enables the internal speaker and 3236 * the headphone jack. Turn this on and rely on the standard mute 3237 * methods whenever the user wants to turn these outputs off. 3238 */ 3239 {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, 3240 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, 3241 {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, 3242 /* Internal speaker/Headphone jack is connected to Line-out pin */ 3243 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3244 /* Internal microphone/Mic jack is connected to Mic1 pin */ 3245 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, 3246 /* Line In jack is connected to Line1 pin */ 3247 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 3248 /* Ensure all other unused pins are disabled and muted. */ 3249 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3250 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3251 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3252 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3253 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3254 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3255 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3256 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3257 /* Disable digital (SPDIF) pins */ 3258 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 3259 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 3260 3261 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum 3262 * bus when acting as outputs. 3263 */ 3264 {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, 3265 {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, 3266 3267 /* Start with output sum widgets muted and their output gains at min */ 3268 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3269 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3270 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3271 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3272 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3273 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3274 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3275 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3276 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3277 3278 /* Unmute Line-out pin widget amp left and right (no equiv mixer ctrl) */ 3279 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3280 /* Unmute Mic1 and Line1 pin widget input buffers since they start as 3281 * inputs. If the pin mode is changed by the user the pin mode control 3282 * will take care of enabling the pin's input/output buffers as needed. 3283 * Therefore there's no need to enable the input buffer at this 3284 * stage. 3285 */ 3286 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3287 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3288 3289 /* Mute capture amp left and right */ 3290 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3291 /* Set ADC connection select to match default mixer setting - mic 3292 * (on mic1 pin) 3293 */ 3294 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, 3295 3296 /* Do similar with the second ADC: mute capture input amp and 3297 * set ADC connection to line (on line1 pin) 3298 */ 3299 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3300 {0x05, AC_VERB_SET_CONNECT_SEL, 0x02}, 3301 3302 /* Mute all inputs to mixer widget (even unconnected ones) */ 3303 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ 3304 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ 3305 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ 3306 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ 3307 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ 3308 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ 3309 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ 3310 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ 3311 3312 {0} 3591 /* On TravelMate laptops, GPIO 0 enables the internal speaker and 3592 * the headphone jack. Turn this on and rely on the standard mute 3593 * methods whenever the user wants to turn these outputs off. 3594 */ 3595 {0x01, AC_VERB_SET_GPIO_MASK, 0x01}, 3596 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, 3597 {0x01, AC_VERB_SET_GPIO_DATA, 0x01}, 3598 /* Internal speaker/Headphone jack is connected to Line-out pin */ 3599 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3600 /* Internal microphone/Mic jack is connected to Mic1 pin */ 3601 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50}, 3602 /* Line In jack is connected to Line1 pin */ 3603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 3604 /* Some Acers (eg: C20x Tablets) use Mono pin for internal speaker */ 3605 {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 3606 /* Ensure all other unused pins are disabled and muted. */ 3607 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3608 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3609 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3610 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3611 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0}, 3612 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3613 /* Disable digital (SPDIF) pins */ 3614 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 3615 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 3616 3617 /* Ensure Mic1 and Line1 pin widgets take input from the OUT1 sum 3618 * bus when acting as outputs. 3619 */ 3620 {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, 3621 {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, 3622 3623 /* Start with output sum widgets muted and their output gains at min */ 3624 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3625 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3626 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3627 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3628 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3629 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3630 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3631 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3632 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3633 3634 /* Unmute Line-out pin widget amp left and right (no equiv mixer ctrl) */ 3635 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3636 /* Unmute mono pin widget amp output (no equiv mixer ctrl) */ 3637 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3638 /* Unmute Mic1 and Line1 pin widget input buffers since they start as 3639 * inputs. If the pin mode is changed by the user the pin mode control 3640 * will take care of enabling the pin's input/output buffers as needed. 3641 * Therefore there's no need to enable the input buffer at this 3642 * stage. 3643 */ 3644 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 3646 3647 /* Mute capture amp left and right */ 3648 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3649 /* Set ADC connection select to match default mixer setting - mic 3650 * (on mic1 pin) 3651 */ 3652 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, 3653 3654 /* Do similar with the second ADC: mute capture input amp and 3655 * set ADC connection to mic to match ALSA's default state. 3656 */ 3657 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3658 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, 3659 3660 /* Mute all inputs to mixer widget (even unconnected ones) */ 3661 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ 3662 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ 3663 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ 3664 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ 3665 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ 3666 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ 3667 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ 3668 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ 3669 3670 {0} 3313 3671 }; 3314 3672 … … 3318 3676 #ifdef CONFIG_SND_DEBUG 3319 3677 static hda_nid_t alc260_test_dac_nids[1] = { 3320 3678 0x02, 3321 3679 }; 3322 3680 static hda_nid_t alc260_test_adc_nids[2] = { 3323 0x04, 0x05, 3324 }; 3325 /* This is a bit messy since the two input muxes in the ALC260 have slight 3326 * variations in their signal assignments. The ideal way to deal with this 3327 * is to extend alc_spec.input_mux to allow a different input MUX for each 3328 * ADC. For the purposes of the test model it's sufficient to just list 3329 * both options for affected signal indices. The separate input mux 3330 * functionality only needs to be considered if a model comes along which 3331 * actually uses signals 0x5, 0x6 and 0x7 for something which makes sense to 3332 * record. 3333 */ 3334 static struct hda_input_mux alc260_test_capture_source = { 3335 .num_items = 8, 3336 .items = { 3337 { "MIC1 pin", 0x0 }, 3338 { "MIC2 pin", 0x1 }, 3339 { "LINE1 pin", 0x2 }, 3340 { "LINE2 pin", 0x3 }, 3341 { "CD pin", 0x4 }, 3342 { "LINE-OUT pin (cap1), Mixer (cap2)", 0x5 }, 3343 { "HP-OUT pin (cap1), LINE-OUT pin (cap2)", 0x6 }, 3344 { "HP-OUT pin (cap2 only)", 0x7 }, 3345 }, 3681 0x04, 0x05, 3682 }; 3683 /* For testing the ALC260, each input MUX needs its own definition since 3684 * the signal assignments are different. This assumes that the first ADC 3685 * is NID 0x04. 3686 */ 3687 static struct hda_input_mux alc260_test_capture_sources[2] = { 3688 { 3689 .num_items = 7, 3690 .items = { 3691 { "MIC1 pin", 0x0 }, 3692 { "MIC2 pin", 0x1 }, 3693 { "LINE1 pin", 0x2 }, 3694 { "LINE2 pin", 0x3 }, 3695 { "CD pin", 0x4 }, 3696 { "LINE-OUT pin", 0x5 }, 3697 { "HP-OUT pin", 0x6 }, 3698 }, 3699 }, 3700 { 3701 .num_items = 8, 3702 .items = { 3703 { "MIC1 pin", 0x0 }, 3704 { "MIC2 pin", 0x1 }, 3705 { "LINE1 pin", 0x2 }, 3706 { "LINE2 pin", 0x3 }, 3707 { "CD pin", 0x4 }, 3708 { "Mixer", 0x5 }, 3709 { "LINE-OUT pin", 0x6 }, 3710 { "HP-OUT pin", 0x7 }, 3711 }, 3712 }, 3346 3713 }; 3347 3714 static struct snd_kcontrol_new alc260_test_mixer[] = { 3348 /* Output driver widgets */ 3349 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 3350 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), 3351 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), 3352 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), 3353 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), 3354 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), 3355 3356 /* Modes for retasking pin widgets */ 3357 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), 3358 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), 3359 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), 3360 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), 3361 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), 3362 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), 3363 3364 /* Loopback mixer controls */ 3365 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), 3366 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), 3367 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), 3368 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), 3369 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), 3370 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), 3371 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), 3372 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), 3373 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 3374 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 3375 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 3376 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 3377 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), 3378 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), 3379 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), 3380 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), 3381 3382 /* Controls for GPIO pins, assuming they are configured as outputs */ 3383 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), 3384 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), 3385 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), 3386 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), 3387 3388 /* Switches to allow the digital IO pins to be enabled. The datasheet 3389 * is ambigious as to which NID is which; testing on laptops which 3390 * make this output available should provide clarification. 3391 */ 3392 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), 3393 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), 3394 3395 {0} /* end */ 3715 /* Output driver widgets */ 3716 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT), 3717 HDA_BIND_MUTE_MONO("Mono Playback Switch", 0x0a, 1, 2, HDA_INPUT), 3718 HDA_CODEC_VOLUME("LOUT2 Playback Volume", 0x09, 0x0, HDA_OUTPUT), 3719 HDA_BIND_MUTE("LOUT2 Playback Switch", 0x09, 2, HDA_INPUT), 3720 HDA_CODEC_VOLUME("LOUT1 Playback Volume", 0x08, 0x0, HDA_OUTPUT), 3721 HDA_BIND_MUTE("LOUT1 Playback Switch", 0x08, 2, HDA_INPUT), 3722 3723 /* Modes for retasking pin widgets 3724 * Note: the ALC260 doesn't seem to act on requests to enable mic 3725 * bias from NIDs 0x0f and 0x10. The ALC260 datasheet doesn't 3726 * mention this restriction. At this stage it's not clear whether 3727 * this behaviour is intentional or is a hardware bug in chip 3728 * revisions available at least up until early 2006. Therefore for 3729 * now allow the "HP-OUT" and "LINE-OUT" Mode controls to span all 3730 * choices, but if it turns out that the lack of mic bias for these 3731 * NIDs is intentional we could change their modes from 3732 * ALC_PIN_DIR_INOUT to ALC_PIN_DIR_INOUT_NOMICBIAS. 3733 */ 3734 ALC_PIN_MODE("HP-OUT pin mode", 0x10, ALC_PIN_DIR_INOUT), 3735 ALC_PIN_MODE("LINE-OUT pin mode", 0x0f, ALC_PIN_DIR_INOUT), 3736 ALC_PIN_MODE("LINE2 pin mode", 0x15, ALC_PIN_DIR_INOUT), 3737 ALC_PIN_MODE("LINE1 pin mode", 0x14, ALC_PIN_DIR_INOUT), 3738 ALC_PIN_MODE("MIC2 pin mode", 0x13, ALC_PIN_DIR_INOUT), 3739 ALC_PIN_MODE("MIC1 pin mode", 0x12, ALC_PIN_DIR_INOUT), 3740 3741 /* Loopback mixer controls */ 3742 HDA_CODEC_VOLUME("MIC1 Playback Volume", 0x07, 0x00, HDA_INPUT), 3743 HDA_CODEC_MUTE("MIC1 Playback Switch", 0x07, 0x00, HDA_INPUT), 3744 HDA_CODEC_VOLUME("MIC2 Playback Volume", 0x07, 0x01, HDA_INPUT), 3745 HDA_CODEC_MUTE("MIC2 Playback Switch", 0x07, 0x01, HDA_INPUT), 3746 HDA_CODEC_VOLUME("LINE1 Playback Volume", 0x07, 0x02, HDA_INPUT), 3747 HDA_CODEC_MUTE("LINE1 Playback Switch", 0x07, 0x02, HDA_INPUT), 3748 HDA_CODEC_VOLUME("LINE2 Playback Volume", 0x07, 0x03, HDA_INPUT), 3749 HDA_CODEC_MUTE("LINE2 Playback Switch", 0x07, 0x03, HDA_INPUT), 3750 HDA_CODEC_VOLUME("CD Playback Volume", 0x07, 0x04, HDA_INPUT), 3751 HDA_CODEC_MUTE("CD Playback Switch", 0x07, 0x04, HDA_INPUT), 3752 HDA_CODEC_VOLUME("Beep Playback Volume", 0x07, 0x05, HDA_INPUT), 3753 HDA_CODEC_MUTE("Beep Playback Switch", 0x07, 0x05, HDA_INPUT), 3754 HDA_CODEC_VOLUME("LINE-OUT loopback Playback Volume", 0x07, 0x06, HDA_INPUT), 3755 HDA_CODEC_MUTE("LINE-OUT loopback Playback Switch", 0x07, 0x06, HDA_INPUT), 3756 HDA_CODEC_VOLUME("HP-OUT loopback Playback Volume", 0x07, 0x7, HDA_INPUT), 3757 HDA_CODEC_MUTE("HP-OUT loopback Playback Switch", 0x07, 0x7, HDA_INPUT), 3758 3759 /* Controls for GPIO pins, assuming they are configured as outputs */ 3760 ALC_GPIO_DATA_SWITCH("GPIO pin 0", 0x01, 0x01), 3761 ALC_GPIO_DATA_SWITCH("GPIO pin 1", 0x01, 0x02), 3762 ALC_GPIO_DATA_SWITCH("GPIO pin 2", 0x01, 0x04), 3763 ALC_GPIO_DATA_SWITCH("GPIO pin 3", 0x01, 0x08), 3764 3765 /* Switches to allow the digital IO pins to be enabled. The datasheet 3766 * is ambigious as to which NID is which; testing on laptops which 3767 * make this output available should provide clarification. 3768 */ 3769 ALC_SPDIF_CTRL_SWITCH("SPDIF Playback Switch", 0x03, 0x01), 3770 ALC_SPDIF_CTRL_SWITCH("SPDIF Capture Switch", 0x06, 0x01), 3771 3772 {0} /* end */ 3396 3773 }; 3397 3774 static struct hda_verb alc260_test_init_verbs[] = { 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3775 /* Enable all GPIOs as outputs with an initial value of 0 */ 3776 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x0f}, 3777 {0x01, AC_VERB_SET_GPIO_DATA, 0x00}, 3778 {0x01, AC_VERB_SET_GPIO_MASK, 0x0f}, 3779 3780 /* Enable retasking pins as output, initially without power amp */ 3781 {0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3782 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3783 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3784 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3785 {0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3786 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 3787 3788 /* Disable digital (SPDIF) pins initially, but users can enable 3789 * them via a mixer switch. In the case of SPDIF-out, this initverb 3790 * payload also sets the generation to 0, output to be in "consumer" 3791 * PCM format, copyright asserted, no pre-emphasis and no validity 3792 * control. 3793 */ 3794 {0x03, AC_VERB_SET_DIGI_CONVERT_1, 0}, 3795 {0x06, AC_VERB_SET_DIGI_CONVERT_1, 0}, 3796 3797 /* Ensure mic1, mic2, line1 and line2 pin widgets take input from the 3798 * OUT1 sum bus when acting as an output. 3799 */ 3800 {0x0b, AC_VERB_SET_CONNECT_SEL, 0}, 3801 {0x0c, AC_VERB_SET_CONNECT_SEL, 0}, 3802 {0x0d, AC_VERB_SET_CONNECT_SEL, 0}, 3803 {0x0e, AC_VERB_SET_CONNECT_SEL, 0}, 3804 3805 /* Start with output sum widgets muted and their output gains at min */ 3806 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3807 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3808 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3809 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3810 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3811 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3812 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3813 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 3814 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 3815 3816 /* Unmute retasking pin widget output buffers since the default 3817 * state appears to be output. As the pin mode is changed by the 3818 * user the pin mode control will take care of enabling the pin's 3819 * input/output buffers as needed. 3820 */ 3821 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3822 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3823 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3824 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3825 {0x13, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3826 {0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3827 /* Also unmute the mono-out pin widget */ 3828 {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 3829 3830 /* Mute capture amp left and right */ 3831 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3832 /* Set ADC connection select to match default mixer setting (mic1 3833 * pin) 3834 */ 3835 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, 3836 3837 /* Do the same for the second ADC: mute capture input amp and 3838 * set ADC connection to mic1 pin 3839 */ 3840 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 3841 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, 3842 3843 /* Mute all inputs to mixer widget (even unconnected ones) */ 3844 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* mic1 pin */ 3845 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, /* mic2 pin */ 3846 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, /* line1 pin */ 3847 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, /* line2 pin */ 3848 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, /* CD pin */ 3849 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)}, /* Beep-gen pin */ 3850 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)}, /* Line-out pin */ 3851 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)}, /* HP-pin pin */ 3852 3853 {0} 3477 3854 }; 3478 3855 #endif 3479 3856 3480 3857 static struct hda_pcm_stream alc260_pcm_analog_playback = { 3481 3482 3483 3858 .substreams = 1, 3859 .channels_min = 2, 3860 .channels_max = 2, 3484 3861 }; 3485 3862 3486 3863 static struct hda_pcm_stream alc260_pcm_analog_capture = { 3487 3488 3489 3864 .substreams = 1, 3865 .channels_min = 2, 3866 .channels_max = 2, 3490 3867 }; 3491 3868 … … 3498 3875 3499 3876 static int alc260_add_playback_controls(struct alc_spec *spec, hda_nid_t nid, 3500 3501 { 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 sprintf(name, /*sizeof(name), */"%s Playback Volume", pfx);3523 3524 3525 sprintf(name, /*sizeof(name), */"%s Playback Switch", pfx);3526 3527 3528 3877 const char *pfx) 3878 { 3879 hda_nid_t nid_vol; 3880 unsigned long vol_val, sw_val; 3881 char name[32]; 3882 int err; 3883 3884 if (nid >= 0x0f && nid < 0x11) { 3885 nid_vol = nid - 0x7; 3886 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); 3887 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); 3888 } else if (nid == 0x11) { 3889 nid_vol = nid - 0x7; 3890 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 2, 0, HDA_OUTPUT); 3891 sw_val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); 3892 } else if (nid >= 0x12 && nid <= 0x15) { 3893 nid_vol = 0x08; 3894 vol_val = HDA_COMPOSE_AMP_VAL(nid_vol, 3, 0, HDA_OUTPUT); 3895 sw_val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); 3896 } else 3897 return 0; /* N/A */ 3898 3899 sprintf(name, "%s Playback Volume", pfx); 3900 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, name, vol_val)) < 0) 3901 return err; 3902 sprintf(name, "%s Playback Switch", pfx); 3903 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, name, sw_val)) < 0) 3904 return err; 3905 return 1; 3529 3906 } 3530 3907 3531 3908 /* add playback controls from the parsed DAC table */ 3532 3909 static int alc260_auto_create_multi_out_ctls(struct alc_spec *spec, 3533 3534 { 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 nid = cfg->hp_pin;3557 3558 3559 3560 3561 3562 return 0; 3910 const struct auto_pin_cfg *cfg) 3911 { 3912 hda_nid_t nid; 3913 int err; 3914 3915 spec->multiout.num_dacs = 1; 3916 spec->multiout.dac_nids = spec->private_dac_nids; 3917 spec->multiout.dac_nids[0] = 0x02; 3918 3919 nid = cfg->line_out_pins[0]; 3920 if (nid) { 3921 err = alc260_add_playback_controls(spec, nid, "Front"); 3922 if (err < 0) 3923 return err; 3924 } 3925 3926 nid = cfg->speaker_pins[0]; 3927 if (nid) { 3928 err = alc260_add_playback_controls(spec, nid, "Speaker"); 3929 if (err < 0) 3930 return err; 3931 } 3932 3933 nid = cfg->hp_pins[0]; 3934 if (nid) { 3935 err = alc260_add_playback_controls(spec, nid, "Headphone"); 3936 if (err < 0) 3937 return err; 3938 } 3939 return 0; 3563 3940 } 3564 3941 3565 3942 /* create playback/capture controls for input pins */ 3566 3943 static int alc260_auto_create_analog_input_ctls(struct alc_spec *spec, 3567 3568 { 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3944 const struct auto_pin_cfg *cfg) 3945 { 3946 struct hda_input_mux *imux = &spec->private_imux; 3947 int i, err, idx; 3948 3949 for (i = 0; i < AUTO_PIN_LAST; i++) { 3950 if (cfg->input_pins[i] >= 0x12) { 3951 idx = cfg->input_pins[i] - 0x12; 3952 err = new_analog_input(spec, cfg->input_pins[i], 3953 auto_pin_cfg_labels[i], idx, 0x07); 3954 if (err < 0) 3955 return err; 3956 imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; 3957 imux->items[imux->num_items].index = idx; 3958 imux->num_items++; 3959 } 3960 if ((cfg->input_pins[i] >= 0x0f) && (cfg->input_pins[i] <= 0x10)){ 3961 idx = cfg->input_pins[i] - 0x09; 3962 err = new_analog_input(spec, cfg->input_pins[i], 3963 auto_pin_cfg_labels[i], idx, 0x07); 3964 if (err < 0) 3965 return err; 3966 imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; 3967 imux->items[imux->num_items].index = idx; 3968 imux->num_items++; 3969 } 3970 } 3971 return 0; 3595 3972 } 3596 3973 3597 3974 static void alc260_auto_set_output_and_unmute(struct hda_codec *codec, 3598 3599 3600 { 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3975 hda_nid_t nid, int pin_type, 3976 int sel_idx) 3977 { 3978 /* set as output */ 3979 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); 3980 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 3981 /* need the manual connection? */ 3982 if (nid >= 0x12) { 3983 int idx = nid - 0x12; 3984 snd_hda_codec_write(codec, idx + 0x0b, 0, 3985 AC_VERB_SET_CONNECT_SEL, sel_idx); 3986 3987 } 3611 3988 } 3612 3989 3613 3990 static void alc260_auto_init_multi_out(struct hda_codec *codec) 3614 3991 { 3615 3616 3617 3618 nid = spec->autocfg.line_out_pins[0]; 3619 3620 3621 3622 3623 3624 3625 3626 nid = spec->autocfg.hp_pin;3627 3628 3629 } 3992 struct alc_spec *spec = codec->spec; 3993 hda_nid_t nid; 3994 3995 nid = spec->autocfg.line_out_pins[0]; 3996 if (nid) 3997 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); 3998 3999 nid = spec->autocfg.speaker_pins[0]; 4000 if (nid) 4001 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); 4002 4003 nid = spec->autocfg.hp_pins[0]; 4004 if (nid) 4005 alc260_auto_set_output_and_unmute(codec, nid, PIN_OUT, 0); 4006 } 3630 4007 3631 4008 #define ALC260_PIN_CD_NID 0x16 3632 4009 static void alc260_auto_init_analog_input(struct hda_codec *codec) 3633 4010 { 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 4011 struct alc_spec *spec = codec->spec; 4012 int i; 4013 4014 for (i = 0; i < AUTO_PIN_LAST; i++) { 4015 hda_nid_t nid = spec->autocfg.input_pins[i]; 4016 if (nid >= 0x12) { 4017 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 4018 i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); 4019 if (nid != ALC260_PIN_CD_NID) 4020 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 4021 AMP_OUT_MUTE); 4022 } 4023 } 3647 4024 } 3648 4025 … … 3651 4028 */ 3652 4029 static struct hda_verb alc260_volume_init_verbs[] = { 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 4030 /* 4031 * Unmute ADC0-1 and set the default input to mic-in 4032 */ 4033 {0x04, AC_VERB_SET_CONNECT_SEL, 0x00}, 4034 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4035 {0x05, AC_VERB_SET_CONNECT_SEL, 0x00}, 4036 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4037 4038 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 4039 * mixer widget 4040 * Note: PASD motherboards uses the Line In 2 as the input for front panel 4041 * mic (mic 2) 4042 */ 4043 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ 4044 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4045 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4046 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 4047 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 4048 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 4049 4050 /* 4051 * Set up output mixers (0x08 - 0x0a) 4052 */ 4053 /* set vol=0 to output mixers */ 4054 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4055 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4056 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4057 /* set up input amps for analog loopback */ 4058 /* Amp Indices: DAC = 0, mixer = 1 */ 4059 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4060 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4061 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4062 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4063 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4064 {0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4065 4066 {0} 3690 4067 }; 3691 4068 3692 4069 static int alc260_parse_auto_config(struct hda_codec *codec) 3693 4070 { 3694 struct alc_spec *spec = codec->spec; 3695 unsigned int wcap; 3696 int err; 3697 static hda_nid_t alc260_ignore[] = { 0x17, 0 }; 3698 3699 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 3700 alc260_ignore)) < 0) 3701 return err; 3702 if ((err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0) 3703 return err; 3704 if (! spec->kctl_alloc) 3705 return 0; /* can't find valid BIOS pin config */ 3706 if ((err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 3707 return err; 3708 3709 spec->multiout.max_channels = 2; 3710 3711 if (spec->autocfg.dig_out_pin) 3712 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; 3713 if (spec->kctl_alloc) 3714 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 3715 3716 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; 3717 3718 spec->input_mux = &spec->private_imux; 3719 3720 /* check whether NID 0x04 is valid */ 3721 wcap = get_wcaps(codec, 0x04); 3722 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 3723 if (wcap != AC_WID_AUD_IN) { 3724 spec->adc_nids = alc260_adc_nids_alt; 3725 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); 3726 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; 3727 } else { 3728 spec->adc_nids = alc260_adc_nids; 3729 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); 3730 spec->mixers[spec->num_mixers] = alc260_capture_mixer; 3731 } 3732 spec->num_mixers++; 3733 3734 return 1; 4071 struct alc_spec *spec = codec->spec; 4072 unsigned int wcap; 4073 int err; 4074 static hda_nid_t alc260_ignore[] = { 0x17, 0 }; 4075 4076 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 4077 alc260_ignore)) < 0) 4078 return err; 4079 if ((err = alc260_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0) 4080 return err; 4081 if (! spec->kctl_alloc) 4082 return 0; /* can't find valid BIOS pin config */ 4083 if ((err = alc260_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 4084 return err; 4085 4086 spec->multiout.max_channels = 2; 4087 4088 if (spec->autocfg.dig_out_pin) 4089 spec->multiout.dig_out_nid = ALC260_DIGOUT_NID; 4090 if (spec->kctl_alloc) 4091 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 4092 4093 spec->init_verbs[spec->num_init_verbs++] = alc260_volume_init_verbs; 4094 4095 spec->num_mux_defs = 1; 4096 spec->input_mux = &spec->private_imux; 4097 4098 /* check whether NID 0x04 is valid */ 4099 wcap = get_wcaps(codec, 0x04); 4100 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 4101 if (wcap != AC_WID_AUD_IN) { 4102 spec->adc_nids = alc260_adc_nids_alt; 4103 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids_alt); 4104 spec->mixers[spec->num_mixers] = alc260_capture_alt_mixer; 4105 } else { 4106 spec->adc_nids = alc260_adc_nids; 4107 spec->num_adc_nids = ARRAY_SIZE(alc260_adc_nids); 4108 spec->mixers[spec->num_mixers] = alc260_capture_mixer; 4109 } 4110 spec->num_mixers++; 4111 4112 return 1; 3735 4113 } 3736 4114 … … 3738 4116 static void alc260_auto_init(struct hda_codec *codec) 3739 4117 { 3740 3741 4118 alc260_auto_init_multi_out(codec); 4119 alc260_auto_init_analog_input(codec); 3742 4120 } 3743 4121 … … 3745 4123 * ALC260 configurations 3746 4124 */ 3747 static struct hda_board_config alc260_cfg_tbl[] = { 3748 { .modelname = "basic", .config = ALC260_BASIC }, 3749 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81bb, 3750 .config = ALC260_BASIC }, /* Sony VAIO */ 3751 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81cc, 3752 .config = ALC260_BASIC }, /* Sony VAIO VGN-S3HP */ 3753 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81cd, 3754 .config = ALC260_BASIC }, /* Sony VAIO */ 3755 { .pci_subvendor = 0x152d, .pci_subdevice = 0x0729, 3756 .config = ALC260_BASIC }, /* CTL Travel Master U553W */ 3757 { .modelname = "hp", .config = ALC260_HP }, 3758 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3010, .config = ALC260_HP }, 3759 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3011, .config = ALC260_HP }, 3760 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3012, .config = ALC260_HP_3013 }, 3761 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3013, .config = ALC260_HP_3013 }, 3762 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, .config = ALC260_HP }, 3763 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3015, .config = ALC260_HP }, 3764 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3016, .config = ALC260_HP }, 3765 { .modelname = "fujitsu", .config = ALC260_FUJITSU_S702X }, 3766 { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1326, .config = ALC260_FUJITSU_S702X }, 3767 { .modelname = "acer", .config = ALC260_ACER }, 3768 { .pci_subvendor = 0x1025, .pci_subdevice = 0x008f, .config = ALC260_ACER }, 4125 static const char *alc260_models[ALC260_MODEL_LAST] = { 4126 [ALC260_BASIC] = "basic", 4127 [ALC260_HP] = "hp", 4128 [ALC260_HP_3013] = "hp-3013", 4129 [ALC260_FUJITSU_S702X] = "fujitsu", 4130 [ALC260_ACER] = "acer", 3769 4131 #ifdef CONFIG_SND_DEBUG 3770 { .modelname = "test", .config = ALC260_TEST },4132 [ALC260_TEST] = "test", 3771 4133 #endif 3772 { .modelname = "auto", .config = ALC260_AUTO }, 3773 {0} 4134 [ALC260_AUTO] = "auto", 4135 }; 4136 4137 static struct snd_pci_quirk alc260_cfg_tbl[] = { 4138 SND_PCI_QUIRK(0x1025, 0x007b, "Acer C20x", ALC260_ACER), 4139 SND_PCI_QUIRK(0x1025, 0x008f, "Acer", ALC260_ACER), 4140 SND_PCI_QUIRK(0x103c, 0x3010, "HP", ALC260_HP_3013), 4141 SND_PCI_QUIRK(0x103c, 0x3011, "HP", ALC260_HP), 4142 SND_PCI_QUIRK(0x103c, 0x3012, "HP", ALC260_HP_3013), 4143 SND_PCI_QUIRK(0x103c, 0x3013, "HP", ALC260_HP_3013), 4144 SND_PCI_QUIRK(0x103c, 0x3014, "HP", ALC260_HP), 4145 SND_PCI_QUIRK(0x103c, 0x3015, "HP", ALC260_HP), 4146 SND_PCI_QUIRK(0x103c, 0x3016, "HP", ALC260_HP), 4147 SND_PCI_QUIRK(0x104d, 0x81bb, "Sony VAIO", ALC260_BASIC), 4148 SND_PCI_QUIRK(0x104d, 0x81cc, "Sony VAIO", ALC260_BASIC), 4149 SND_PCI_QUIRK(0x104d, 0x81cd, "Sony VAIO", ALC260_BASIC), 4150 SND_PCI_QUIRK(0x10cf, 0x1326, "Fujitsu S702X", ALC260_FUJITSU_S702X), 4151 SND_PCI_QUIRK(0x152d, 0x0729, "CTL U553W", ALC260_BASIC), 4152 {0} 3774 4153 }; 3775 4154 3776 4155 static struct alc_config_preset alc260_presets[] = { 3777 [ALC260_BASIC] = { 3778 .mixers = { alc260_base_output_mixer, 3779 alc260_input_mixer, 3780 alc260_pc_beep_mixer, 3781 alc260_capture_mixer }, 3782 .init_verbs = { alc260_init_verbs }, 3783 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 3784 .dac_nids = alc260_dac_nids, 3785 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), 3786 .adc_nids = alc260_adc_nids, 3787 .num_channel_mode = ARRAY_SIZE(alc260_modes), 3788 .channel_mode = alc260_modes, 3789 .input_mux = &alc260_capture_source, 3790 }, 3791 [ALC260_HP] = { 3792 .mixers = { alc260_base_output_mixer, 3793 alc260_input_mixer, 3794 alc260_capture_alt_mixer }, 3795 .init_verbs = { alc260_init_verbs }, 3796 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 3797 .dac_nids = alc260_dac_nids, 3798 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), 3799 .adc_nids = alc260_hp_adc_nids, 3800 .num_channel_mode = ARRAY_SIZE(alc260_modes), 3801 .channel_mode = alc260_modes, 3802 .input_mux = &alc260_capture_source, 3803 }, 3804 [ALC260_HP_3013] = { 3805 .mixers = { alc260_hp_3013_mixer, 3806 alc260_input_mixer, 3807 alc260_capture_alt_mixer }, 3808 .init_verbs = { alc260_hp_3013_init_verbs }, 3809 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 3810 .dac_nids = alc260_dac_nids, 3811 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), 3812 .adc_nids = alc260_hp_adc_nids, 3813 .num_channel_mode = ARRAY_SIZE(alc260_modes), 3814 .channel_mode = alc260_modes, 3815 .input_mux = &alc260_capture_source, 3816 }, 3817 [ALC260_FUJITSU_S702X] = { 3818 .mixers = { alc260_fujitsu_mixer, 3819 alc260_capture_mixer }, 3820 .init_verbs = { alc260_fujitsu_init_verbs }, 3821 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 3822 .dac_nids = alc260_dac_nids, 3823 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), 3824 .adc_nids = alc260_dual_adc_nids, 3825 .num_channel_mode = ARRAY_SIZE(alc260_modes), 3826 .channel_mode = alc260_modes, 3827 .input_mux = &alc260_fujitsu_capture_source, 3828 }, 3829 [ALC260_ACER] = { 3830 .mixers = { alc260_acer_mixer, 3831 alc260_capture_mixer }, 3832 .init_verbs = { alc260_acer_init_verbs }, 3833 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 3834 .dac_nids = alc260_dac_nids, 3835 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), 3836 .adc_nids = alc260_dual_adc_nids, 3837 .num_channel_mode = ARRAY_SIZE(alc260_modes), 3838 .channel_mode = alc260_modes, 3839 .input_mux = &alc260_acer_capture_source, 3840 }, 4156 [ALC260_BASIC] = { 4157 .mixers = { alc260_base_output_mixer, 4158 alc260_input_mixer, 4159 alc260_pc_beep_mixer, 4160 alc260_capture_mixer }, 4161 .init_verbs = { alc260_init_verbs }, 4162 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 4163 .dac_nids = alc260_dac_nids, 4164 .num_adc_nids = ARRAY_SIZE(alc260_adc_nids), 4165 .adc_nids = alc260_adc_nids, 4166 .num_channel_mode = ARRAY_SIZE(alc260_modes), 4167 .channel_mode = alc260_modes, 4168 .input_mux = &alc260_capture_source, 4169 }, 4170 [ALC260_HP] = { 4171 .mixers = { alc260_base_output_mixer, 4172 alc260_input_mixer, 4173 alc260_capture_alt_mixer }, 4174 .init_verbs = { alc260_init_verbs }, 4175 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 4176 .dac_nids = alc260_dac_nids, 4177 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), 4178 .adc_nids = alc260_hp_adc_nids, 4179 .num_channel_mode = ARRAY_SIZE(alc260_modes), 4180 .channel_mode = alc260_modes, 4181 .input_mux = &alc260_capture_source, 4182 }, 4183 [ALC260_HP_3013] = { 4184 .mixers = { alc260_hp_3013_mixer, 4185 alc260_input_mixer, 4186 alc260_capture_alt_mixer }, 4187 .init_verbs = { alc260_hp_3013_init_verbs }, 4188 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 4189 .dac_nids = alc260_dac_nids, 4190 .num_adc_nids = ARRAY_SIZE(alc260_hp_adc_nids), 4191 .adc_nids = alc260_hp_adc_nids, 4192 .num_channel_mode = ARRAY_SIZE(alc260_modes), 4193 .channel_mode = alc260_modes, 4194 .input_mux = &alc260_capture_source, 4195 }, 4196 [ALC260_FUJITSU_S702X] = { 4197 .mixers = { alc260_fujitsu_mixer, 4198 alc260_capture_mixer }, 4199 .init_verbs = { alc260_fujitsu_init_verbs }, 4200 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 4201 .dac_nids = alc260_dac_nids, 4202 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), 4203 .adc_nids = alc260_dual_adc_nids, 4204 .num_channel_mode = ARRAY_SIZE(alc260_modes), 4205 .channel_mode = alc260_modes, 4206 .num_mux_defs = ARRAY_SIZE(alc260_fujitsu_capture_sources), 4207 .input_mux = alc260_fujitsu_capture_sources, 4208 }, 4209 [ALC260_ACER] = { 4210 .mixers = { alc260_acer_mixer, 4211 alc260_capture_mixer }, 4212 .init_verbs = { alc260_acer_init_verbs }, 4213 .num_dacs = ARRAY_SIZE(alc260_dac_nids), 4214 .dac_nids = alc260_dac_nids, 4215 .num_adc_nids = ARRAY_SIZE(alc260_dual_adc_nids), 4216 .adc_nids = alc260_dual_adc_nids, 4217 .num_channel_mode = ARRAY_SIZE(alc260_modes), 4218 .channel_mode = alc260_modes, 4219 .num_mux_defs = ARRAY_SIZE(alc260_acer_capture_sources), 4220 .input_mux = alc260_acer_capture_sources, 4221 }, 3841 4222 #ifdef CONFIG_SND_DEBUG 3842 [ALC260_TEST] = { 3843 .mixers = { alc260_test_mixer, 3844 alc260_capture_mixer }, 3845 .init_verbs = { alc260_test_init_verbs }, 3846 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), 3847 .dac_nids = alc260_test_dac_nids, 3848 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), 3849 .adc_nids = alc260_test_adc_nids, 3850 .num_channel_mode = ARRAY_SIZE(alc260_modes), 3851 .channel_mode = alc260_modes, 3852 .input_mux = &alc260_test_capture_source, 3853 }, 4223 [ALC260_TEST] = { 4224 .mixers = { alc260_test_mixer, 4225 alc260_capture_mixer }, 4226 .init_verbs = { alc260_test_init_verbs }, 4227 .num_dacs = ARRAY_SIZE(alc260_test_dac_nids), 4228 .dac_nids = alc260_test_dac_nids, 4229 .num_adc_nids = ARRAY_SIZE(alc260_test_adc_nids), 4230 .adc_nids = alc260_test_adc_nids, 4231 .num_channel_mode = ARRAY_SIZE(alc260_modes), 4232 .channel_mode = alc260_modes, 4233 .num_mux_defs = ARRAY_SIZE(alc260_test_capture_sources), 4234 .input_mux = alc260_test_capture_sources, 4235 }, 3854 4236 #endif 3855 4237 }; … … 3857 4239 static int patch_alc260(struct hda_codec *codec) 3858 4240 { 3859 struct alc_spec *spec; 3860 int err, board_config; 3861 3862 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 3863 if (spec == NULL) 3864 return -ENOMEM; 3865 3866 codec->spec = spec; 3867 3868 board_config = snd_hda_check_board_config(codec, alc260_cfg_tbl); 3869 if (board_config < 0 || board_config >= ALC260_MODEL_LAST) { 3870 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260\n"); 3871 board_config = ALC260_AUTO; 3872 } 3873 3874 if (board_config == ALC260_AUTO) { 3875 /* automatic parse from the BIOS config */ 3876 err = alc260_parse_auto_config(codec); 3877 if (err < 0) { 3878 alc_free(codec); 3879 return err; 3880 } else if (! err) { 3881 printk(KERN_INFO "hda_codec: Cannot set up configuration from BIOS. Using base mode...\n"); 3882 board_config = ALC260_BASIC; 3883 } 3884 } 3885 3886 if (board_config != ALC260_AUTO) 3887 setup_preset(spec, &alc260_presets[board_config]); 3888 3889 spec->stream_name_analog = "ALC260 Analog"; 3890 spec->stream_analog_playback = &alc260_pcm_analog_playback; 3891 spec->stream_analog_capture = &alc260_pcm_analog_capture; 3892 3893 spec->stream_name_digital = "ALC260 Digital"; 3894 spec->stream_digital_playback = &alc260_pcm_digital_playback; 3895 spec->stream_digital_capture = &alc260_pcm_digital_capture; 3896 3897 codec->patch_ops = alc_patch_ops; 3898 if (board_config == ALC260_AUTO) 3899 spec->init_hook = alc260_auto_init; 3900 3901 return 0; 4241 struct alc_spec *spec; 4242 int err, board_config; 4243 4244 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4245 if (spec == NULL) 4246 return -ENOMEM; 4247 4248 codec->spec = spec; 4249 4250 board_config = snd_hda_check_board_config(codec, ALC260_MODEL_LAST, 4251 alc260_models, 4252 alc260_cfg_tbl); 4253 if (board_config < 0) { 4254 snd_printd(KERN_INFO "hda_codec: Unknown model for ALC260, " 4255 "trying auto-probe from BIOS...\n"); 4256 board_config = ALC260_AUTO; 4257 } 4258 4259 if (board_config == ALC260_AUTO) { 4260 /* automatic parse from the BIOS config */ 4261 err = alc260_parse_auto_config(codec); 4262 if (err < 0) { 4263 alc_free(codec); 4264 return err; 4265 } else if (! err) { 4266 printk(KERN_INFO 4267 "hda_codec: Cannot set up configuration " 4268 "from BIOS. Using base mode...\n"); 4269 board_config = ALC260_BASIC; 4270 } 4271 } 4272 4273 if (board_config != ALC260_AUTO) 4274 setup_preset(spec, &alc260_presets[board_config]); 4275 4276 spec->stream_name_analog = "ALC260 Analog"; 4277 spec->stream_analog_playback = &alc260_pcm_analog_playback; 4278 spec->stream_analog_capture = &alc260_pcm_analog_capture; 4279 4280 spec->stream_name_digital = "ALC260 Digital"; 4281 spec->stream_digital_playback = &alc260_pcm_digital_playback; 4282 spec->stream_digital_capture = &alc260_pcm_digital_capture; 4283 4284 codec->patch_ops = alc_patch_ops; 4285 if (board_config == ALC260_AUTO) 4286 spec->init_hook = alc260_auto_init; 4287 4288 return 0; 3902 4289 } 3903 4290 … … 3918 4305 3919 4306 static struct hda_channel_mode alc882_ch_modes[1] = { 3920 4307 { 8, NULL } 3921 4308 }; 3922 4309 3923 4310 static hda_nid_t alc882_dac_nids[4] = { 3924 3925 4311 /* front, rear, clfe, rear_surr */ 4312 0x02, 0x03, 0x04, 0x05 3926 4313 }; 3927 4314 … … 3934 4321 3935 4322 static struct hda_input_mux alc882_capture_source = { 3936 .num_items = 4, 3937 .items = { 3938 { "Mic", 0x0 }, 3939 { "Front Mic", 0x1 }, 3940 { "Line", 0x2 }, 3941 { "CD", 0x4 }, 3942 }, 3943 }; 3944 4323 .num_items = 4, 4324 .items = { 4325 { "Mic", 0x0 }, 4326 { "Front Mic", 0x1 }, 4327 { "Line", 0x2 }, 4328 { "CD", 0x4 }, 4329 }, 4330 }; 3945 4331 #define alc882_mux_enum_info alc_mux_enum_info 3946 4332 #define alc882_mux_enum_get alc_mux_enum_get … … 3948 4334 static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 3949 4335 { 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 4336 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 4337 struct alc_spec *spec = codec->spec; 4338 const struct hda_input_mux *imux = spec->input_mux; 4339 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 4340 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; 4341 hda_nid_t nid = capture_mixers[adc_idx]; 4342 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 4343 unsigned int i, idx; 4344 4345 idx = ucontrol->value.enumerated.item[0]; 4346 if (idx >= imux->num_items) 4347 idx = imux->num_items - 1; 4348 if (*cur_val == idx && ! codec->in_resume) 4349 return 0; 4350 for (i = 0; i < imux->num_items; i++) { 4351 unsigned int v = (i == idx) ? 0x7000 : 0x7080; 4352 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 4353 v | (imux->items[i].index << 8)); 4354 } 4355 *cur_val = idx; 4356 return 1; 3971 4357 } 3972 4358 … … 3975 4361 */ 3976 4362 static struct hda_verb alc882_sixstack_ch6_init[] = { 3977 3978 3979 3980 3981 4363 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 4364 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 4365 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 4366 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 4367 {0} /* end */ 3982 4368 }; 3983 4369 … … 3986 4372 */ 3987 4373 static struct hda_verb alc882_sixstack_ch8_init[] = { 3988 3989 3990 3991 3992 4374 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 4375 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 4376 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 4377 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 4378 {0} /* end */ 3993 4379 }; 3994 4380 3995 4381 static struct hda_channel_mode alc882_sixstack_modes[2] = { 3996 3997 4382 { 6, alc882_sixstack_ch6_init }, 4383 { 8, alc882_sixstack_ch8_init }, 3998 4384 }; 3999 4385 … … 4002 4388 */ 4003 4389 static struct snd_kcontrol_new alc882_base_mixer[] = { 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4390 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 4391 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 4392 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 4393 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 4394 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 4395 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 4396 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 4397 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 4398 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 4399 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 4400 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 4401 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 4402 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 4403 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 4404 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 4405 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 4406 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 4407 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 4408 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 4409 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 4410 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 4411 {0} /* end */ 4026 4412 }; 4027 4413 4028 4414 static struct snd_kcontrol_new alc882_chmode_mixer[] = { 4029 4030 4031 4032 4033 4034 4035 4036 4415 { 4416 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 4417 .name = "Channel Mode", 4418 .info = alc_ch_mode_info, 4419 .get = alc_ch_mode_get, 4420 .put = alc_ch_mode_put, 4421 }, 4422 {0} /* end */ 4037 4423 }; 4038 4424 4039 4425 static struct hda_verb alc882_init_verbs[] = { 4040 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 4041 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4042 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4043 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4044 /* Rear mixer */ 4045 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4046 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4047 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4048 /* CLFE mixer */ 4049 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4050 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4051 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4052 /* Side mixer */ 4053 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4054 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4055 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4056 4057 /* Front Pin: output 0 (0x0c) */ 4058 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4059 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4060 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 4061 /* Rear Pin: output 1 (0x0d) */ 4062 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4063 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4064 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 4065 /* CLFE Pin: output 2 (0x0e) */ 4066 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4067 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4068 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, 4069 /* Side Pin: output 3 (0x0f) */ 4070 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4071 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4072 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, 4073 /* Mic (rear) pin: input vref at 80% */ 4074 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 4075 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4076 /* Front Mic pin: input vref at 80% */ 4077 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 4078 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4079 /* Line In pin: input */ 4080 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 4081 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4082 /* Line-2 In: Headphone output (output 0 - 0x0c) */ 4083 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 4084 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4085 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 4086 /* CD pin widget for input */ 4087 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 4088 4089 /* FIXME: use matrix-type input source selection */ 4090 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 4091 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 4092 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4093 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4094 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4095 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 4096 /* Input mixer2 */ 4097 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4098 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4099 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4100 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 4101 /* Input mixer3 */ 4102 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4103 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4104 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4105 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 4106 /* ADC1: mute amp left and right */ 4107 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4108 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 4109 /* ADC2: mute amp left and right */ 4110 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4111 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 4112 /* ADC3: mute amp left and right */ 4113 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4114 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 4115 4116 {0} 4117 }; 4426 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 4427 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4428 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4429 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4430 /* Rear mixer */ 4431 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4432 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4433 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4434 /* CLFE mixer */ 4435 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4436 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4437 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4438 /* Side mixer */ 4439 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4440 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4441 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4442 4443 /* Front Pin: output 0 (0x0c) */ 4444 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4445 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4446 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 4447 /* Rear Pin: output 1 (0x0d) */ 4448 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4449 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4450 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 4451 /* CLFE Pin: output 2 (0x0e) */ 4452 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4453 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4454 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, 4455 /* Side Pin: output 3 (0x0f) */ 4456 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4457 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4458 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, 4459 /* Mic (rear) pin: input vref at 80% */ 4460 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 4461 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4462 /* Front Mic pin: input vref at 80% */ 4463 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 4464 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4465 /* Line In pin: input */ 4466 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 4467 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4468 /* Line-2 In: Headphone output (output 0 - 0x0c) */ 4469 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 4470 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4471 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 4472 /* CD pin widget for input */ 4473 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 4474 4475 /* FIXME: use matrix-type input source selection */ 4476 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 4477 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 4478 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4479 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4480 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4481 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 4482 /* Input mixer2 */ 4483 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4484 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4485 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4486 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 4487 /* Input mixer3 */ 4488 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4489 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4490 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4491 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 4492 /* ADC1: mute amp left and right */ 4493 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4494 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 4495 /* ADC2: mute amp left and right */ 4496 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4497 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 4498 /* ADC3: mute amp left and right */ 4499 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4500 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 4501 4502 {0} 4503 }; 4504 4505 static struct hda_verb alc882_eapd_verbs[] = { 4506 /* change to EAPD mode */ 4507 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 4508 {0x20, AC_VERB_SET_PROC_COEF, 0x3060}, 4509 {0} 4510 }; 4511 4512 4513 /* Mac Pro test */ 4514 static struct snd_kcontrol_new alc882_macpro_mixer[] = { 4515 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 4516 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 4517 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT), 4518 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT), 4519 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT), 4520 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x02, HDA_INPUT), 4521 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x02, HDA_INPUT), 4522 {0} /* end */ 4523 }; 4524 4525 static struct hda_verb alc882_macpro_init_verbs[] = { 4526 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 4527 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4528 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4529 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4530 /* Front Pin: output 0 (0x0c) */ 4531 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4532 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4533 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 4534 /* Front Mic pin: input vref at 80% */ 4535 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 4536 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4537 /* Speaker: output */ 4538 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4539 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4540 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04}, 4541 /* Headphone output (output 0 - 0x0c) */ 4542 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 4543 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4544 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, 4545 4546 /* FIXME: use matrix-type input source selection */ 4547 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 4548 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 4549 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4550 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4551 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4552 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 4553 /* Input mixer2 */ 4554 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4555 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4556 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4557 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 4558 /* Input mixer3 */ 4559 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4560 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, 4561 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, 4562 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, 4563 /* ADC1: mute amp left and right */ 4564 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4565 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 4566 /* ADC2: mute amp left and right */ 4567 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4568 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 4569 /* ADC3: mute amp left and right */ 4570 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4571 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 4572 4573 {0} 4574 }; 4575 static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted) 4576 { 4577 unsigned int gpiostate, gpiomask, gpiodir; 4578 4579 gpiostate = snd_hda_codec_read(codec, codec->afg, 0, 4580 AC_VERB_GET_GPIO_DATA, 0); 4581 4582 if (!muted) 4583 gpiostate |= (1 << pin); 4584 else 4585 gpiostate &= ~(1 << pin); 4586 4587 gpiomask = snd_hda_codec_read(codec, codec->afg, 0, 4588 AC_VERB_GET_GPIO_MASK, 0); 4589 gpiomask |= (1 << pin); 4590 4591 gpiodir = snd_hda_codec_read(codec, codec->afg, 0, 4592 AC_VERB_GET_GPIO_DIRECTION, 0); 4593 gpiodir |= (1 << pin); 4594 4595 4596 snd_hda_codec_write(codec, codec->afg, 0, 4597 AC_VERB_SET_GPIO_MASK, gpiomask); 4598 snd_hda_codec_write(codec, codec->afg, 0, 4599 AC_VERB_SET_GPIO_DIRECTION, gpiodir); 4600 4601 msleep(1); 4602 4603 snd_hda_codec_write(codec, codec->afg, 0, 4604 AC_VERB_SET_GPIO_DATA, gpiostate); 4605 } 4606 4118 4607 4119 4608 /* … … 4121 4610 */ 4122 4611 static struct hda_verb alc882_auto_init_verbs[] = { 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4612 /* 4613 * Unmute ADC0-2 and set the default input to mic-in 4614 */ 4615 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 4616 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4617 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 4618 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4619 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 4620 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4621 4622 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 4623 * mixer widget 4624 * Note: PASD motherboards uses the Line In 2 as the input for front panel 4625 * mic (mic 2) 4626 */ 4627 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ 4628 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4629 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4630 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 4631 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 4632 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 4633 4634 /* 4635 * Set up output mixers (0x0c - 0x0f) 4636 */ 4637 /* set vol=0 to output mixers */ 4638 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4639 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4640 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4641 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4642 /* set up input amps for analog loopback */ 4643 /* Amp Indices: DAC = 0, mixer = 1 */ 4644 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4645 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4646 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4647 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4648 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4649 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4650 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4651 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4652 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4653 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4654 4655 /* FIXME: use matrix-type input source selection */ 4656 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 4657 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 4658 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 4659 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 4660 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 4661 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 4662 /* Input mixer2 */ 4663 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 4664 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 4665 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 4666 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 4667 /* Input mixer3 */ 4668 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 4669 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 4670 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 4671 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 4672 4673 {0} 4185 4674 }; 4186 4675 4187 4676 /* capture mixer elements */ 4188 4677 static struct snd_kcontrol_new alc882_capture_alt_mixer[] = { 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4678 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 4679 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 4680 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 4681 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 4682 { 4683 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 4684 /* The multiple "Capture Source" controls confuse alsamixer 4685 * So call somewhat different.. 4686 * FIXME: the controls appear in the "playback" view! 4687 */ 4688 /* .name = "Capture Source", */ 4689 .name = "Input Source", 4690 .count = 2, 4691 .info = alc882_mux_enum_info, 4692 .get = alc882_mux_enum_get, 4693 .put = alc882_mux_enum_put, 4694 }, 4695 {0} /* end */ 4207 4696 }; 4208 4697 4209 4698 static struct snd_kcontrol_new alc882_capture_mixer[] = { 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4699 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT), 4700 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT), 4701 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x08, 0x0, HDA_INPUT), 4702 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x08, 0x0, HDA_INPUT), 4703 HDA_CODEC_VOLUME_IDX("Capture Volume", 2, 0x09, 0x0, HDA_INPUT), 4704 HDA_CODEC_MUTE_IDX("Capture Switch", 2, 0x09, 0x0, HDA_INPUT), 4705 { 4706 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 4707 /* The multiple "Capture Source" controls confuse alsamixer 4708 * So call somewhat different.. 4709 * FIXME: the controls appear in the "playback" view! 4710 */ 4711 /* .name = "Capture Source", */ 4712 .name = "Input Source", 4713 .count = 3, 4714 .info = alc882_mux_enum_info, 4715 .get = alc882_mux_enum_get, 4716 .put = alc882_mux_enum_put, 4717 }, 4718 {0} /* end */ 4230 4719 }; 4231 4720 … … 4239 4728 * configuration and preset 4240 4729 */ 4241 static struct hda_board_config alc882_cfg_tbl[] = { 4242 { .modelname = "3stack-dig", .config = ALC882_3ST_DIG }, 4243 { .modelname = "6stack-dig", .config = ALC882_6ST_DIG }, 4244 { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668, .config = ALC882_6ST_DIG }, /* MSI */ 4245 { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668, .config = ALC882_6ST_DIG }, /* Foxconn */ 4246 { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668, .config = ALC882_6ST_DIG }, /* ECS */ 4247 { .modelname = "auto", .config = ALC882_AUTO }, 4248 {0} 4730 static const char *alc882_models[ALC882_MODEL_LAST] = { 4731 [ALC882_3ST_DIG] = "3stack-dig", 4732 [ALC882_6ST_DIG] = "6stack-dig", 4733 [ALC882_ARIMA] = "arima", 4734 [ALC885_MACPRO] = "macpro", 4735 [ALC882_AUTO] = "auto", 4736 }; 4737 4738 static struct snd_pci_quirk alc882_cfg_tbl[] = { 4739 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG), 4740 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG), 4741 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG), 4742 SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), 4743 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG), 4744 {0} 4249 4745 }; 4250 4746 4251 4747 static struct alc_config_preset alc882_presets[] = { 4252 [ALC882_3ST_DIG] = { 4253 .mixers = { alc882_base_mixer }, 4254 .init_verbs = { alc882_init_verbs }, 4255 .num_dacs = ARRAY_SIZE(alc882_dac_nids), 4256 .dac_nids = alc882_dac_nids, 4257 .dig_out_nid = ALC882_DIGOUT_NID, 4258 .dig_in_nid = ALC882_DIGIN_NID, 4259 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), 4260 .channel_mode = alc882_ch_modes, 4261 .input_mux = &alc882_capture_source, 4262 }, 4263 [ALC882_6ST_DIG] = { 4264 .mixers = { alc882_base_mixer, alc882_chmode_mixer }, 4265 .init_verbs = { alc882_init_verbs }, 4266 .num_dacs = ARRAY_SIZE(alc882_dac_nids), 4267 .dac_nids = alc882_dac_nids, 4268 .dig_out_nid = ALC882_DIGOUT_NID, 4269 .dig_in_nid = ALC882_DIGIN_NID, 4270 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), 4271 .channel_mode = alc882_sixstack_modes, 4272 .input_mux = &alc882_capture_source, 4273 }, 4748 [ALC882_3ST_DIG] = { 4749 .mixers = { alc882_base_mixer }, 4750 .init_verbs = { alc882_init_verbs }, 4751 .num_dacs = ARRAY_SIZE(alc882_dac_nids), 4752 .dac_nids = alc882_dac_nids, 4753 .dig_out_nid = ALC882_DIGOUT_NID, 4754 .dig_in_nid = ALC882_DIGIN_NID, 4755 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), 4756 .channel_mode = alc882_ch_modes, 4757 .need_dac_fix = 1, 4758 .input_mux = &alc882_capture_source, 4759 }, 4760 [ALC882_6ST_DIG] = { 4761 .mixers = { alc882_base_mixer, alc882_chmode_mixer }, 4762 .init_verbs = { alc882_init_verbs }, 4763 .num_dacs = ARRAY_SIZE(alc882_dac_nids), 4764 .dac_nids = alc882_dac_nids, 4765 .dig_out_nid = ALC882_DIGOUT_NID, 4766 .dig_in_nid = ALC882_DIGIN_NID, 4767 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), 4768 .channel_mode = alc882_sixstack_modes, 4769 .input_mux = &alc882_capture_source, 4770 }, 4771 [ALC882_ARIMA] = { 4772 .mixers = { alc882_base_mixer, alc882_chmode_mixer }, 4773 .init_verbs = { alc882_init_verbs, alc882_eapd_verbs }, 4774 .num_dacs = ARRAY_SIZE(alc882_dac_nids), 4775 .dac_nids = alc882_dac_nids, 4776 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes), 4777 .channel_mode = alc882_sixstack_modes, 4778 .input_mux = &alc882_capture_source, 4779 }, 4780 [ALC885_MACPRO] = { 4781 .mixers = { alc882_macpro_mixer }, 4782 .init_verbs = { alc882_macpro_init_verbs }, 4783 .num_dacs = ARRAY_SIZE(alc882_dac_nids), 4784 .dac_nids = alc882_dac_nids, 4785 .dig_out_nid = ALC882_DIGOUT_NID, 4786 .dig_in_nid = ALC882_DIGIN_NID, 4787 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes), 4788 .channel_mode = alc882_ch_modes, 4789 .input_mux = &alc882_capture_source, 4790 }, 4274 4791 }; 4275 4792 … … 4279 4796 */ 4280 4797 static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, 4281 4282 4283 { 4284 4285 4286 int idx; 4287 4288 4289 4290 4291 4292 4293 4294 4295 4798 hda_nid_t nid, int pin_type, 4799 int dac_idx) 4800 { 4801 /* set as output */ 4802 struct alc_spec *spec = codec->spec; 4803 int idx; 4804 4805 if (spec->multiout.dac_nids[dac_idx] == 0x25) 4806 idx = 4; 4807 else 4808 idx = spec->multiout.dac_nids[dac_idx] - 2; 4809 4810 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); 4811 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 4812 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); 4296 4813 4297 4814 } … … 4299 4816 static void alc882_auto_init_multi_out(struct hda_codec *codec) 4300 4817 { 4301 4302 4303 4304 4305 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 4306 4307 4308 4818 struct alc_spec *spec = codec->spec; 4819 int i; 4820 4821 for (i = 0; i <= HDA_SIDE; i++) { 4822 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 4823 if (nid) 4824 alc882_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); 4825 } 4309 4826 } 4310 4827 4311 4828 static void alc882_auto_init_hp_out(struct hda_codec *codec) 4312 4829 { 4313 4314 4315 4316 pin = spec->autocfg.hp_pin;4317 4318 4830 struct alc_spec *spec = codec->spec; 4831 hda_nid_t pin; 4832 4833 pin = spec->autocfg.hp_pins[0]; 4834 if (pin) /* connect to front */ 4835 alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); /* use dac 0 */ 4319 4836 } 4320 4837 … … 4324 4841 static void alc882_auto_init_analog_input(struct hda_codec *codec) 4325 4842 { 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4843 struct alc_spec *spec = codec->spec; 4844 int i; 4845 4846 for (i = 0; i < AUTO_PIN_LAST; i++) { 4847 hda_nid_t nid = spec->autocfg.input_pins[i]; 4848 if (alc882_is_input_pin(nid)) { 4849 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 4850 i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); 4851 if (nid != ALC882_PIN_CD_NID) 4852 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 4853 AMP_OUT_MUTE); 4854 } 4855 } 4339 4856 } 4340 4857 … … 4342 4859 static int alc882_parse_auto_config(struct hda_codec *codec) 4343 4860 { 4344 4345 4346 4347 4348 4349 4350 4351 4352 4861 struct alc_spec *spec = codec->spec; 4862 int err = alc880_parse_auto_config(codec); 4863 4864 if (err < 0) 4865 return err; 4866 else if (err > 0) 4867 /* hack - override the init verbs */ 4868 spec->init_verbs[0] = alc882_auto_init_verbs; 4869 return err; 4353 4870 } 4354 4871 … … 4356 4873 static void alc882_auto_init(struct hda_codec *codec) 4357 4874 { 4358 4359 4360 4875 alc882_auto_init_multi_out(codec); 4876 alc882_auto_init_hp_out(codec); 4877 alc882_auto_init_analog_input(codec); 4361 4878 } 4362 4879 4363 4880 static int patch_alc882(struct hda_codec *codec) 4364 4881 { 4365 struct alc_spec *spec; 4366 int err, board_config; 4367 4368 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4369 if (spec == NULL) 4370 return -ENOMEM; 4371 4372 codec->spec = spec; 4373 4374 board_config = snd_hda_check_board_config(codec, alc882_cfg_tbl); 4375 4376 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { 4377 printk(KERN_INFO "hda_codec: Unknown model for ALC882, trying auto-probe from BIOS...\n"); 4378 board_config = ALC882_AUTO; 4379 } 4380 4381 if (board_config == ALC882_AUTO) { 4382 /* automatic parse from the BIOS config */ 4383 err = alc882_parse_auto_config(codec); 4384 if (err < 0) { 4385 alc_free(codec); 4386 return err; 4387 } else if (! err) { 4388 printk(KERN_INFO "hda_codec: Cannot set up configuration from BIOS. Using base mode...\n"); 4389 board_config = ALC882_3ST_DIG; 4390 } 4391 } 4392 4393 if (board_config != ALC882_AUTO) 4394 setup_preset(spec, &alc882_presets[board_config]); 4395 4396 spec->stream_name_analog = "ALC882 Analog"; 4397 spec->stream_analog_playback = &alc882_pcm_analog_playback; 4398 spec->stream_analog_capture = &alc882_pcm_analog_capture; 4399 4400 spec->stream_name_digital = "ALC882 Digital"; 4401 spec->stream_digital_playback = &alc882_pcm_digital_playback; 4402 spec->stream_digital_capture = &alc882_pcm_digital_capture; 4403 4404 if (! spec->adc_nids && spec->input_mux) { 4405 /* check whether NID 0x07 is valid */ 4406 unsigned int wcap = get_wcaps(codec, 0x07); 4407 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 4408 if (wcap != AC_WID_AUD_IN) { 4409 spec->adc_nids = alc882_adc_nids_alt; 4410 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); 4411 spec->mixers[spec->num_mixers] = alc882_capture_alt_mixer; 4412 spec->num_mixers++; 4413 } else { 4414 spec->adc_nids = alc882_adc_nids; 4415 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); 4416 spec->mixers[spec->num_mixers] = alc882_capture_mixer; 4417 spec->num_mixers++; 4418 } 4419 } 4420 4421 codec->patch_ops = alc_patch_ops; 4422 if (board_config == ALC882_AUTO) 4423 spec->init_hook = alc882_auto_init; 4424 4425 return 0; 4882 struct alc_spec *spec; 4883 int err, board_config; 4884 4885 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4886 if (spec == NULL) 4887 return -ENOMEM; 4888 4889 codec->spec = spec; 4890 4891 board_config = snd_hda_check_board_config(codec, ALC882_MODEL_LAST, 4892 alc882_models, 4893 alc882_cfg_tbl); 4894 4895 if (board_config < 0 || board_config >= ALC882_MODEL_LAST) { 4896 printk(KERN_INFO "hda_codec: Unknown model for ALC882, " 4897 "trying auto-probe from BIOS...\n"); 4898 board_config = ALC882_AUTO; 4899 } 4900 4901 if (board_config == ALC882_AUTO) { 4902 /* automatic parse from the BIOS config */ 4903 err = alc882_parse_auto_config(codec); 4904 if (err < 0) { 4905 alc_free(codec); 4906 return err; 4907 } else if (! err) { 4908 printk(KERN_INFO 4909 "hda_codec: Cannot set up configuration " 4910 "from BIOS. Using base mode...\n"); 4911 board_config = ALC882_3ST_DIG; 4912 } 4913 } 4914 4915 if (board_config != ALC882_AUTO) 4916 setup_preset(spec, &alc882_presets[board_config]); 4917 4918 if (board_config == ALC885_MACPRO) { 4919 alc882_gpio_mute(codec, 0, 0); 4920 alc882_gpio_mute(codec, 1, 0); 4921 } 4922 4923 spec->stream_name_analog = "ALC882 Analog"; 4924 spec->stream_analog_playback = &alc882_pcm_analog_playback; 4925 spec->stream_analog_capture = &alc882_pcm_analog_capture; 4926 4927 spec->stream_name_digital = "ALC882 Digital"; 4928 spec->stream_digital_playback = &alc882_pcm_digital_playback; 4929 spec->stream_digital_capture = &alc882_pcm_digital_capture; 4930 4931 if (! spec->adc_nids && spec->input_mux) { 4932 /* check whether NID 0x07 is valid */ 4933 unsigned int wcap = get_wcaps(codec, 0x07); 4934 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 4935 if (wcap != AC_WID_AUD_IN) { 4936 spec->adc_nids = alc882_adc_nids_alt; 4937 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids_alt); 4938 spec->mixers[spec->num_mixers] = alc882_capture_alt_mixer; 4939 spec->num_mixers++; 4940 } else { 4941 spec->adc_nids = alc882_adc_nids; 4942 spec->num_adc_nids = ARRAY_SIZE(alc882_adc_nids); 4943 spec->mixers[spec->num_mixers] = alc882_capture_mixer; 4944 spec->num_mixers++; 4945 } 4946 } 4947 4948 codec->patch_ops = alc_patch_ops; 4949 if (board_config == ALC882_AUTO) 4950 spec->init_hook = alc882_auto_init; 4951 4952 return 0; 4426 4953 } 4427 4954 … … 4441 4968 4442 4969 static hda_nid_t alc883_dac_nids[4] = { 4443 4444 4970 /* front, rear, clfe, rear_surr */ 4971 0x02, 0x04, 0x03, 0x05 4445 4972 }; 4446 4973 4447 4974 static hda_nid_t alc883_adc_nids[2] = { 4448 4449 4975 /* ADC1-2 */ 4976 0x08, 0x09, 4450 4977 }; 4451 4978 /* input MUX */ … … 4453 4980 4454 4981 static struct hda_input_mux alc883_capture_source = { 4455 4456 4457 4458 4459 4460 4461 4982 .num_items = 4, 4983 .items = { 4984 { "Mic", 0x0 }, 4985 { "Front Mic", 0x1 }, 4986 { "Line", 0x2 }, 4987 { "CD", 0x4 }, 4988 }, 4462 4989 }; 4463 4990 #define alc883_mux_enum_info alc_mux_enum_info … … 4465 4992 4466 4993 static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol, 4467 4468 { 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4994 struct snd_ctl_elem_value *ucontrol) 4995 { 4996 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 4997 struct alc_spec *spec = codec->spec; 4998 const struct hda_input_mux *imux = spec->input_mux; 4999 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 5000 static hda_nid_t capture_mixers[3] = { 0x24, 0x23, 0x22 }; 5001 hda_nid_t nid = capture_mixers[adc_idx]; 5002 unsigned int *cur_val = &spec->cur_mux[adc_idx]; 5003 unsigned int i, idx; 5004 5005 idx = ucontrol->value.enumerated.item[0]; 5006 if (idx >= imux->num_items) 5007 idx = imux->num_items - 1; 5008 if (*cur_val == idx && ! codec->in_resume) 5009 return 0; 5010 for (i = 0; i < imux->num_items; i++) { 5011 unsigned int v = (i == idx) ? 0x7000 : 0x7080; 5012 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 5013 v | (imux->items[i].index << 8)); 5014 } 5015 *cur_val = idx; 5016 return 1; 4490 5017 } 4491 5018 /* … … 4493 5020 */ 4494 5021 static struct hda_channel_mode alc883_3ST_2ch_modes[1] = { 4495 5022 { 2, NULL } 4496 5023 }; 4497 5024 … … 4500 5027 */ 4501 5028 static struct hda_verb alc883_3ST_ch2_init[] = { 4502 4503 4504 4505 4506 5029 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, 5030 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 5031 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, 5032 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE }, 5033 {0} /* end */ 4507 5034 }; 4508 5035 … … 4511 5038 */ 4512 5039 static struct hda_verb alc883_3ST_ch6_init[] = { 4513 4514 4515 4516 4517 4518 4519 5040 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 5041 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 5042 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 }, 5043 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 5044 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 5045 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 }, 5046 {0} /* end */ 4520 5047 }; 4521 5048 4522 5049 static struct hda_channel_mode alc883_3ST_6ch_modes[2] = { 4523 4524 5050 { 2, alc883_3ST_ch2_init }, 5051 { 6, alc883_3ST_ch6_init }, 4525 5052 }; 4526 5053 … … 4529 5056 */ 4530 5057 static struct hda_verb alc883_sixstack_ch6_init[] = { 4531 4532 4533 4534 4535 5058 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 5059 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 5060 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 5061 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 5062 {0} /* end */ 4536 5063 }; 4537 5064 … … 4540 5067 */ 4541 5068 static struct hda_verb alc883_sixstack_ch8_init[] = { 4542 4543 4544 4545 4546 5069 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 5070 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 5071 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 5072 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 5073 {0} /* end */ 4547 5074 }; 4548 5075 4549 5076 static struct hda_channel_mode alc883_sixstack_modes[2] = { 4550 { 6, alc883_sixstack_ch6_init }, 4551 { 8, alc883_sixstack_ch8_init }, 5077 { 6, alc883_sixstack_ch6_init }, 5078 { 8, alc883_sixstack_ch8_init }, 5079 }; 5080 5081 static struct hda_verb alc883_medion_eapd_verbs[] = { 5082 /* eanable EAPD on medion laptop */ 5083 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 5084 {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, 5085 {0} 4552 5086 }; 4553 5087 … … 4557 5091 4558 5092 static struct snd_kcontrol_new alc883_base_mixer[] = { 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 5093 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5094 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 5095 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 5096 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 5097 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 5098 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 5099 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 5100 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 5101 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT), 5102 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT), 5103 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 5104 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5105 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5106 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 5107 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 5108 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5109 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5110 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 5111 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 5112 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 5113 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 5114 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 5115 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 5116 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 5117 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 5118 { 5119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5120 /* .name = "Capture Source", */ 5121 .name = "Input Source", 5122 .count = 2, 5123 .info = alc883_mux_enum_info, 5124 .get = alc883_mux_enum_get, 5125 .put = alc883_mux_enum_put, 5126 }, 5127 {0} /* end */ 4594 5128 }; 4595 5129 4596 5130 static struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = { 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 5131 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5132 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 5133 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 5134 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5135 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5136 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 5137 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 5138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5139 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5140 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 5141 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 5142 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 5143 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 5144 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 5145 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 5146 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 5147 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 5148 { 5149 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5150 /* .name = "Capture Source", */ 5151 .name = "Input Source", 5152 .count = 2, 5153 .info = alc883_mux_enum_info, 5154 .get = alc883_mux_enum_get, 5155 .put = alc883_mux_enum_put, 5156 }, 5157 {0} /* end */ 4624 5158 }; 4625 5159 4626 5160 static struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { 4627 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 4628 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 4629 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 4630 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 4631 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 4632 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 4633 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 4634 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 4635 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 4636 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 4637 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 4638 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 4639 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 4640 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 4641 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 4642 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 4643 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 4644 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 4645 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 4646 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 4647 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 4648 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 4649 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 4650 { 4651 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 4652 /* .name = "Capture Source", */ 4653 .name = "Input Source", 4654 .count = 2, 4655 .info = alc883_mux_enum_info, 4656 .get = alc883_mux_enum_get, 4657 .put = alc883_mux_enum_put, 4658 }, 4659 {0} /* end */ 4660 }; 5161 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5162 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 5163 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 5164 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 5165 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 5166 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 5167 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 5168 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 5169 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 5170 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5171 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5172 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 5173 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 5174 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5175 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5176 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 5177 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 5178 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 5179 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 5180 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 5181 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 5182 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 5183 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 5184 { 5185 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5186 /* .name = "Capture Source", */ 5187 .name = "Input Source", 5188 .count = 2, 5189 .info = alc883_mux_enum_info, 5190 .get = alc883_mux_enum_get, 5191 .put = alc883_mux_enum_put, 5192 }, 5193 {0} /* end */ 5194 }; 5195 5196 static struct snd_kcontrol_new alc883_fivestack_mixer[] = { 5197 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5198 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 5199 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 5200 HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT), 5201 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 5202 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 5203 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x16, 1, 0x0, HDA_OUTPUT), 5204 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), 5205 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 5206 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5207 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5208 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 5209 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 5210 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5211 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5212 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT), 5213 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT), 5214 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT), 5215 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT), 5216 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 5217 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 5218 5219 { 5220 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5221 /* .name = "Capture Source", */ 5222 .name = "Input Source", 5223 .count = 1, 5224 .info = alc883_mux_enum_info, 5225 .get = alc883_mux_enum_get, 5226 .put = alc883_mux_enum_put, 5227 }, 5228 {0} /* end */ 5229 }; 5230 5231 static struct snd_kcontrol_new alc883_tagra_mixer[] = { 5232 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5233 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 5234 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 5235 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 5236 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT), 5237 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT), 5238 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 5239 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT), 5240 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT), 5241 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5242 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5243 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 5244 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 5245 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5246 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5247 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 5248 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 5249 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 5250 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 5251 { 5252 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5253 /* .name = "Capture Source", */ 5254 .name = "Input Source", 5255 .count = 2, 5256 .info = alc883_mux_enum_info, 5257 .get = alc883_mux_enum_get, 5258 .put = alc883_mux_enum_put, 5259 }, 5260 {0} /* end */ 5261 }; 5262 5263 static struct snd_kcontrol_new alc883_tagra_2ch_mixer[] = { 5264 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5265 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT), 5266 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 5267 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5268 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5269 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5270 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5271 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 5272 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 5273 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 5274 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 5275 { 5276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5277 /* .name = "Capture Source", */ 5278 .name = "Input Source", 5279 .count = 2, 5280 .info = alc883_mux_enum_info, 5281 .get = alc883_mux_enum_get, 5282 .put = alc883_mux_enum_put, 5283 }, 5284 {0} /* end */ 5285 }; 4661 5286 4662 5287 static struct snd_kcontrol_new alc883_chmode_mixer[] = { 4663 4664 4665 4666 4667 4668 4669 4670 5288 { 5289 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5290 .name = "Channel Mode", 5291 .info = alc_ch_mode_info, 5292 .get = alc_ch_mode_get, 5293 .put = alc_ch_mode_put, 5294 }, 5295 {0} /* end */ 4671 5296 }; 4672 5297 4673 5298 static struct hda_verb alc883_init_verbs[] = { 4674 /* ADC1: mute amp left and right */ 4675 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4676 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 4677 /* ADC2: mute amp left and right */ 4678 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4679 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 4680 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 4681 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4682 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4683 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4684 /* Rear mixer */ 4685 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4686 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4687 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4688 /* CLFE mixer */ 4689 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4690 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4691 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4692 /* Side mixer */ 4693 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 4694 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 4695 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 4696 4697 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4698 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4699 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 4700 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 4701 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 4702 4703 /* Front Pin: output 0 (0x0c) */ 4704 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4705 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4706 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 4707 /* Rear Pin: output 1 (0x0d) */ 4708 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4709 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4710 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 4711 /* CLFE Pin: output 2 (0x0e) */ 4712 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4713 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4714 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, 4715 /* Side Pin: output 3 (0x0f) */ 4716 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 4717 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4718 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, 4719 /* Mic (rear) pin: input vref at 80% */ 4720 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 4721 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4722 /* Front Mic pin: input vref at 80% */ 4723 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 4724 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4725 /* Line In pin: input */ 4726 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 4727 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 4728 /* Line-2 In: Headphone output (output 0 - 0x0c) */ 4729 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 4730 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 4731 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 4732 /* CD pin widget for input */ 4733 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 4734 4735 /* FIXME: use matrix-type input source selection */ 4736 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 4737 /* Input mixer2 */ 4738 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4739 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4740 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 4741 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 4742 /* Input mixer3 */ 4743 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 4744 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 4745 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 4746 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 4747 {0} 4748 }; 5299 /* ADC1: mute amp left and right */ 5300 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5301 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 5302 /* ADC2: mute amp left and right */ 5303 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5304 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 5305 /* Front mixer: unmute input/output amp left and right (volume = 0) */ 5306 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5307 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5308 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 5309 /* Rear mixer */ 5310 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5311 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5312 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 5313 /* CLFE mixer */ 5314 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5315 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5316 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 5317 /* Side mixer */ 5318 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5319 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 5320 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 5321 5322 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5323 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5324 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5325 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 5326 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 5327 5328 /* Front Pin: output 0 (0x0c) */ 5329 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 5330 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5331 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 5332 /* Rear Pin: output 1 (0x0d) */ 5333 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 5334 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5335 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 5336 /* CLFE Pin: output 2 (0x0e) */ 5337 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 5338 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5339 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02}, 5340 /* Side Pin: output 3 (0x0f) */ 5341 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 5342 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5343 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03}, 5344 /* Mic (rear) pin: input vref at 80% */ 5345 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 5346 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 5347 /* Front Mic pin: input vref at 80% */ 5348 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 5349 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 5350 /* Line In pin: input */ 5351 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 5352 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 5353 /* Line-2 In: Headphone output (output 0 - 0x0c) */ 5354 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 5355 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5356 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 5357 /* CD pin widget for input */ 5358 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, 5359 5360 /* FIXME: use matrix-type input source selection */ 5361 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 5362 /* Input mixer2 */ 5363 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5364 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5365 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5366 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 5367 /* Input mixer3 */ 5368 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5369 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5370 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5371 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 5372 {0} 5373 }; 5374 5375 static struct hda_verb alc883_tagra_verbs[] = { 5376 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5377 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5378 5379 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 5380 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 5381 5382 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */ 5383 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */ 5384 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */ 5385 5386 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, 5387 {0x01, AC_VERB_SET_GPIO_MASK, 0x03}, 5388 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x03}, 5389 {0x01, AC_VERB_SET_GPIO_DATA, 0x03}, 5390 5391 {0} /* end */ 5392 }; 5393 5394 /* toggle speaker-output according to the hp-jack state */ 5395 static void alc883_tagra_automute(struct hda_codec *codec) 5396 { 5397 unsigned int present; 5398 5399 present = snd_hda_codec_read(codec, 0x14, 0, 5400 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 5401 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, 5402 0x80, present ? 0x80 : 0); 5403 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0, 5404 0x80, present ? 0x80 : 0); 5405 snd_hda_codec_write(codec, 1, 0, AC_VERB_SET_GPIO_DATA, present ? 1 : 3); 5406 } 5407 5408 static void alc883_tagra_unsol_event(struct hda_codec *codec, unsigned int res) 5409 { 5410 if ((res >> 26) == ALC880_HP_EVENT) 5411 alc883_tagra_automute(codec); 5412 } 4749 5413 4750 5414 /* … … 4752 5416 */ 4753 5417 static struct hda_verb alc883_auto_init_verbs[] = { 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 5418 /* 5419 * Unmute ADC0-2 and set the default input to mic-in 5420 */ 5421 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 5422 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5423 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 5424 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5425 5426 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 5427 * mixer widget 5428 * Note: PASD motherboards uses the Line In 2 as the input for front panel 5429 * mic (mic 2) 5430 */ 5431 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ 5432 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5433 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5434 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5435 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 5436 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 5437 5438 /* 5439 * Set up output mixers (0x0c - 0x0f) 5440 */ 5441 /* set vol=0 to output mixers */ 5442 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5443 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5444 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5445 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5446 /* set up input amps for analog loopback */ 5447 /* Amp Indices: DAC = 0, mixer = 1 */ 5448 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5449 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5450 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5451 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5452 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5453 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5454 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5455 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5456 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5457 {0x26, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5458 5459 /* FIXME: use matrix-type input source selection */ 5460 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 5461 /* Input mixer1 */ 5462 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5463 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5464 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5465 //{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 5466 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 5467 /* Input mixer2 */ 5468 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5469 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5470 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5471 //{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 5472 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 5473 5474 {0} 4811 5475 }; 4812 5476 4813 5477 /* capture mixer elements */ 4814 5478 static struct snd_kcontrol_new alc883_capture_mixer[] = { 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 5479 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 5480 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 5481 HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT), 5482 HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT), 5483 { 5484 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5485 /* The multiple "Capture Source" controls confuse alsamixer 5486 * So call somewhat different.. 5487 * FIXME: the controls appear in the "playback" view! 5488 */ 5489 /* .name = "Capture Source", */ 5490 .name = "Input Source", 5491 .count = 2, 5492 .info = alc882_mux_enum_info, 5493 .get = alc882_mux_enum_get, 5494 .put = alc882_mux_enum_put, 5495 }, 5496 {0} /* end */ 4833 5497 }; 4834 5498 … … 4842 5506 * configuration and preset 4843 5507 */ 4844 static struct hda_board_config alc883_cfg_tbl[] = { 4845 { .modelname = "3stack-dig", .config = ALC883_3ST_2ch_DIG }, 4846 { .modelname = "6stack-dig", .config = ALC883_6ST_DIG }, 4847 { .modelname = "6stack-dig-demo", .config = ALC888_DEMO_BOARD }, 4848 { .pci_subvendor = 0x1462, .pci_subdevice = 0x6668, 4849 .config = ALC883_6ST_DIG }, /* MSI */ 4850 { .pci_subvendor = 0x105b, .pci_subdevice = 0x6668, 4851 .config = ALC883_6ST_DIG }, /* Foxconn */ 4852 { .pci_subvendor = 0x1019, .pci_subdevice = 0x6668, 4853 .config = ALC883_3ST_6ch_DIG }, /* ECS to Intel*/ 4854 { .pci_subvendor = 0x108e, .pci_subdevice = 0x534d, 4855 .config = ALC883_3ST_6ch }, 4856 { .modelname = "auto", .config = ALC883_AUTO }, 4857 {0} 5508 static const char *alc883_models[ALC883_MODEL_LAST] = { 5509 [ALC883_3ST_2ch_DIG] = "3stack-dig", 5510 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig", 5511 [ALC883_3ST_6ch] = "3stack-6ch", 5512 [ALC883_6ST_DIG] = "6stack-dig", 5513 [ALC883_TARGA_DIG] = "targa-dig", 5514 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig", 5515 [ALC888_DEMO_BOARD] = "6stack-dig-demo", 5516 [ALC883_ACER] = "acer", 5517 [ALC883_MEDION] = "medion", 5518 [ALC883_LAPTOP_EAPD] = "laptop-eapd", 5519 [ALC883_AUTO] = "auto", 5520 }; 5521 5522 static struct snd_pci_quirk alc883_cfg_tbl[] = { 5523 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC883_3ST_6ch_DIG), 5524 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch), 5525 SND_PCI_QUIRK(0x1558, 0, "Clevo laptop", ALC883_LAPTOP_EAPD), 5526 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), 5527 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG), 5528 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), 5529 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), 5530 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG), 5531 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG), 5532 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG), 5533 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG), 5534 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG), 5535 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG), 5536 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG), 5537 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG), 5538 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG), 5539 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG), 5540 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), 5541 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 5542 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), 5543 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), 5544 {0} 4858 5545 }; 4859 5546 4860 5547 static struct alc_config_preset alc883_presets[] = { 4861 [ALC883_3ST_2ch_DIG] = { 4862 .mixers = { alc883_3ST_2ch_mixer }, 4863 .init_verbs = { alc883_init_verbs }, 4864 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 4865 .dac_nids = alc883_dac_nids, 4866 .dig_out_nid = ALC883_DIGOUT_NID, 4867 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 4868 .adc_nids = alc883_adc_nids, 4869 .dig_in_nid = ALC883_DIGIN_NID, 4870 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 4871 .channel_mode = alc883_3ST_2ch_modes, 4872 .input_mux = &alc883_capture_source, 4873 }, 4874 [ALC883_3ST_6ch_DIG] = { 4875 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 4876 .init_verbs = { alc883_init_verbs }, 4877 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 4878 .dac_nids = alc883_dac_nids, 4879 .dig_out_nid = ALC883_DIGOUT_NID, 4880 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 4881 .adc_nids = alc883_adc_nids, 4882 .dig_in_nid = ALC883_DIGIN_NID, 4883 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 4884 .channel_mode = alc883_3ST_6ch_modes, 4885 .input_mux = &alc883_capture_source, 4886 }, 4887 [ALC883_3ST_6ch] = { 4888 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 4889 .init_verbs = { alc883_init_verbs }, 4890 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 4891 .dac_nids = alc883_dac_nids, 4892 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 4893 .adc_nids = alc883_adc_nids, 4894 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 4895 .channel_mode = alc883_3ST_6ch_modes, 4896 .input_mux = &alc883_capture_source, 4897 }, 4898 [ALC883_6ST_DIG] = { 4899 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 4900 .init_verbs = { alc883_init_verbs }, 4901 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 4902 .dac_nids = alc883_dac_nids, 4903 .dig_out_nid = ALC883_DIGOUT_NID, 4904 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 4905 .adc_nids = alc883_adc_nids, 4906 .dig_in_nid = ALC883_DIGIN_NID, 4907 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 4908 .channel_mode = alc883_sixstack_modes, 4909 .input_mux = &alc883_capture_source, 4910 }, 4911 [ALC888_DEMO_BOARD] = { 4912 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 4913 .init_verbs = { alc883_init_verbs }, 4914 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 4915 .dac_nids = alc883_dac_nids, 4916 .dig_out_nid = ALC883_DIGOUT_NID, 4917 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 4918 .adc_nids = alc883_adc_nids, 4919 .dig_in_nid = ALC883_DIGIN_NID, 4920 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 4921 .channel_mode = alc883_sixstack_modes, 4922 .input_mux = &alc883_capture_source, 4923 }, 5548 [ALC883_3ST_2ch_DIG] = { 5549 .mixers = { alc883_3ST_2ch_mixer }, 5550 .init_verbs = { alc883_init_verbs }, 5551 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5552 .dac_nids = alc883_dac_nids, 5553 .dig_out_nid = ALC883_DIGOUT_NID, 5554 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5555 .adc_nids = alc883_adc_nids, 5556 .dig_in_nid = ALC883_DIGIN_NID, 5557 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 5558 .channel_mode = alc883_3ST_2ch_modes, 5559 .input_mux = &alc883_capture_source, 5560 }, 5561 [ALC883_3ST_6ch_DIG] = { 5562 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 5563 .init_verbs = { alc883_init_verbs }, 5564 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5565 .dac_nids = alc883_dac_nids, 5566 .dig_out_nid = ALC883_DIGOUT_NID, 5567 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5568 .adc_nids = alc883_adc_nids, 5569 .dig_in_nid = ALC883_DIGIN_NID, 5570 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 5571 .channel_mode = alc883_3ST_6ch_modes, 5572 .need_dac_fix = 1, 5573 .input_mux = &alc883_capture_source, 5574 }, 5575 [ALC883_3ST_6ch] = { 5576 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer }, 5577 .init_verbs = { alc883_init_verbs }, 5578 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5579 .dac_nids = alc883_dac_nids, 5580 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5581 .adc_nids = alc883_adc_nids, 5582 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 5583 .channel_mode = alc883_3ST_6ch_modes, 5584 .need_dac_fix = 1, 5585 .input_mux = &alc883_capture_source, 5586 }, 5587 [ALC883_6ST_DIG] = { 5588 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 5589 .init_verbs = { alc883_init_verbs }, 5590 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5591 .dac_nids = alc883_dac_nids, 5592 .dig_out_nid = ALC883_DIGOUT_NID, 5593 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5594 .adc_nids = alc883_adc_nids, 5595 .dig_in_nid = ALC883_DIGIN_NID, 5596 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 5597 .channel_mode = alc883_sixstack_modes, 5598 .input_mux = &alc883_capture_source, 5599 }, 5600 [ALC883_TARGA_DIG] = { 5601 .mixers = { alc883_tagra_mixer, alc883_chmode_mixer }, 5602 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, 5603 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5604 .dac_nids = alc883_dac_nids, 5605 .dig_out_nid = ALC883_DIGOUT_NID, 5606 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5607 .adc_nids = alc883_adc_nids, 5608 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes), 5609 .channel_mode = alc883_3ST_6ch_modes, 5610 .need_dac_fix = 1, 5611 .input_mux = &alc883_capture_source, 5612 .unsol_event = alc883_tagra_unsol_event, 5613 .init_hook = alc883_tagra_automute, 5614 }, 5615 [ALC883_TARGA_2ch_DIG] = { 5616 .mixers = { alc883_tagra_2ch_mixer}, 5617 .init_verbs = { alc883_init_verbs, alc883_tagra_verbs}, 5618 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5619 .dac_nids = alc883_dac_nids, 5620 .dig_out_nid = ALC883_DIGOUT_NID, 5621 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5622 .adc_nids = alc883_adc_nids, 5623 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 5624 .channel_mode = alc883_3ST_2ch_modes, 5625 .input_mux = &alc883_capture_source, 5626 .unsol_event = alc883_tagra_unsol_event, 5627 .init_hook = alc883_tagra_automute, 5628 }, 5629 [ALC888_DEMO_BOARD] = { 5630 .mixers = { alc883_base_mixer, alc883_chmode_mixer }, 5631 .init_verbs = { alc883_init_verbs }, 5632 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5633 .dac_nids = alc883_dac_nids, 5634 .dig_out_nid = ALC883_DIGOUT_NID, 5635 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5636 .adc_nids = alc883_adc_nids, 5637 .dig_in_nid = ALC883_DIGIN_NID, 5638 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 5639 .channel_mode = alc883_sixstack_modes, 5640 .input_mux = &alc883_capture_source, 5641 }, 5642 [ALC883_ACER] = { 5643 .mixers = { alc883_base_mixer, 5644 alc883_chmode_mixer }, 5645 /* On TravelMate laptops, GPIO 0 enables the internal speaker 5646 * and the headphone jack. Turn this on and rely on the 5647 * standard mute methods whenever the user wants to turn 5648 * these outputs off. 5649 */ 5650 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs }, 5651 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5652 .dac_nids = alc883_dac_nids, 5653 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5654 .adc_nids = alc883_adc_nids, 5655 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 5656 .channel_mode = alc883_3ST_2ch_modes, 5657 .input_mux = &alc883_capture_source, 5658 }, 5659 [ALC883_MEDION] = { 5660 .mixers = { alc883_fivestack_mixer, 5661 alc883_chmode_mixer }, 5662 .init_verbs = { alc883_init_verbs, 5663 alc883_medion_eapd_verbs }, 5664 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5665 .dac_nids = alc883_dac_nids, 5666 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5667 .adc_nids = alc883_adc_nids, 5668 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes), 5669 .channel_mode = alc883_sixstack_modes, 5670 .input_mux = &alc883_capture_source, 5671 }, 5672 [ALC883_LAPTOP_EAPD] = { 5673 .mixers = { alc883_base_mixer, 5674 alc883_chmode_mixer }, 5675 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs }, 5676 .num_dacs = ARRAY_SIZE(alc883_dac_nids), 5677 .dac_nids = alc883_dac_nids, 5678 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids), 5679 .adc_nids = alc883_adc_nids, 5680 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 5681 .channel_mode = alc883_3ST_2ch_modes, 5682 .input_mux = &alc883_capture_source, 5683 }, 4924 5684 }; 4925 5685 … … 4929 5689 */ 4930 5690 static void alc883_auto_set_output_and_unmute(struct hda_codec *codec, 4931 4932 4933 { 4934 4935 4936 int idx; 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 5691 hda_nid_t nid, int pin_type, 5692 int dac_idx) 5693 { 5694 /* set as output */ 5695 struct alc_spec *spec = codec->spec; 5696 int idx; 5697 5698 if (spec->multiout.dac_nids[dac_idx] == 0x25) 5699 idx = 4; 5700 else 5701 idx = spec->multiout.dac_nids[dac_idx] - 2; 5702 5703 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 5704 pin_type); 5705 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_AMP_GAIN_MUTE, 5706 AMP_OUT_UNMUTE); 5707 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); 4948 5708 4949 5709 } … … 4951 5711 static void alc883_auto_init_multi_out(struct hda_codec *codec) 4952 5712 { 4953 4954 4955 4956 4957 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 4958 4959 4960 5713 struct alc_spec *spec = codec->spec; 5714 int i; 5715 5716 for (i = 0; i <= HDA_SIDE; i++) { 5717 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 5718 if (nid) 5719 alc883_auto_set_output_and_unmute(codec, nid, PIN_OUT, i); 5720 } 4961 5721 } 4962 5722 4963 5723 static void alc883_auto_init_hp_out(struct hda_codec *codec) 4964 5724 { 4965 4966 4967 4968 pin = spec->autocfg.hp_pin;4969 4970 4971 5725 struct alc_spec *spec = codec->spec; 5726 hda_nid_t pin; 5727 5728 pin = spec->autocfg.hp_pins[0]; 5729 if (pin) /* connect to front */ 5730 /* use dac 0 */ 5731 alc883_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); 4972 5732 } 4973 5733 … … 4977 5737 static void alc883_auto_init_analog_input(struct hda_codec *codec) 4978 5738 { 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 5739 struct alc_spec *spec = codec->spec; 5740 int i; 5741 5742 for (i = 0; i < AUTO_PIN_LAST; i++) { 5743 hda_nid_t nid = spec->autocfg.input_pins[i]; 5744 if (alc883_is_input_pin(nid)) { 5745 snd_hda_codec_write(codec, nid, 0, 5746 AC_VERB_SET_PIN_WIDGET_CONTROL, 5747 (i <= AUTO_PIN_FRONT_MIC ? 5748 PIN_VREF80 : PIN_IN)); 5749 if (nid != ALC883_PIN_CD_NID) 5750 snd_hda_codec_write(codec, nid, 0, 5751 AC_VERB_SET_AMP_GAIN_MUTE, 5752 AMP_OUT_MUTE); 5753 } 5754 } 4995 5755 } 4996 5756 … … 4998 5758 static int alc883_parse_auto_config(struct hda_codec *codec) 4999 5759 { 5000 5001 5002 5003 5004 5005 5006 5007 5008 spec->mixers[spec->num_mixers] = alc883_capture_mixer;5009 5010 5760 struct alc_spec *spec = codec->spec; 5761 int err = alc880_parse_auto_config(codec); 5762 5763 if (err < 0) 5764 return err; 5765 else if (err > 0) 5766 /* hack - override the init verbs */ 5767 spec->init_verbs[0] = alc883_auto_init_verbs; 5768 spec->mixers[spec->num_mixers] = alc883_capture_mixer; 5769 spec->num_mixers++; 5770 return err; 5011 5771 } 5012 5772 … … 5014 5774 static void alc883_auto_init(struct hda_codec *codec) 5015 5775 { 5016 5017 5018 5776 alc883_auto_init_multi_out(codec); 5777 alc883_auto_init_hp_out(codec); 5778 alc883_auto_init_analog_input(codec); 5019 5779 } 5020 5780 5021 5781 static int patch_alc883(struct hda_codec *codec) 5022 5782 { 5023 struct alc_spec *spec; 5024 int err, board_config; 5025 5026 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5027 if (spec == NULL) 5028 return -ENOMEM; 5029 5030 codec->spec = spec; 5031 5032 board_config = snd_hda_check_board_config(codec, alc883_cfg_tbl); 5033 if (board_config < 0 || board_config >= ALC883_MODEL_LAST) { 5034 printk(KERN_INFO "hda_codec: Unknown model for ALC883, " 5035 "trying auto-probe from BIOS...\n"); 5036 board_config = ALC883_AUTO; 5037 } 5038 5039 if (board_config == ALC883_AUTO) { 5040 /* automatic parse from the BIOS config */ 5041 err = alc883_parse_auto_config(codec); 5042 if (err < 0) { 5043 alc_free(codec); 5044 return err; 5045 } else if (! err) { 5046 printk(KERN_INFO 5047 "hda_codec: Cannot set up configuration " 5048 "from BIOS. Using base mode...\n"); 5049 board_config = ALC883_3ST_2ch_DIG; 5050 } 5051 } 5052 5053 if (board_config != ALC883_AUTO) 5054 setup_preset(spec, &alc883_presets[board_config]); 5055 5056 spec->stream_name_analog = "ALC883 Analog"; 5057 spec->stream_analog_playback = &alc883_pcm_analog_playback; 5058 spec->stream_analog_capture = &alc883_pcm_analog_capture; 5059 5060 spec->stream_name_digital = "ALC883 Digital"; 5061 spec->stream_digital_playback = &alc883_pcm_digital_playback; 5062 spec->stream_digital_capture = &alc883_pcm_digital_capture; 5063 5064 spec->adc_nids = alc883_adc_nids; 5065 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 5066 5067 codec->patch_ops = alc_patch_ops; 5068 if (board_config == ALC883_AUTO) 5069 spec->init_hook = alc883_auto_init; 5070 return 0; 5783 struct alc_spec *spec; 5784 int err, board_config; 5785 5786 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5787 if (spec == NULL) 5788 return -ENOMEM; 5789 5790 codec->spec = spec; 5791 5792 board_config = snd_hda_check_board_config(codec, ALC883_MODEL_LAST, 5793 alc883_models, 5794 alc883_cfg_tbl); 5795 if (board_config < 0) { 5796 printk(KERN_INFO "hda_codec: Unknown model for ALC883, " 5797 "trying auto-probe from BIOS...\n"); 5798 board_config = ALC883_AUTO; 5799 } 5800 5801 if (board_config == ALC883_AUTO) { 5802 /* automatic parse from the BIOS config */ 5803 err = alc883_parse_auto_config(codec); 5804 if (err < 0) { 5805 alc_free(codec); 5806 return err; 5807 } else if (! err) { 5808 printk(KERN_INFO 5809 "hda_codec: Cannot set up configuration " 5810 "from BIOS. Using base mode...\n"); 5811 board_config = ALC883_3ST_2ch_DIG; 5812 } 5813 } 5814 5815 if (board_config != ALC883_AUTO) 5816 setup_preset(spec, &alc883_presets[board_config]); 5817 5818 spec->stream_name_analog = "ALC883 Analog"; 5819 spec->stream_analog_playback = &alc883_pcm_analog_playback; 5820 spec->stream_analog_capture = &alc883_pcm_analog_capture; 5821 5822 spec->stream_name_digital = "ALC883 Digital"; 5823 spec->stream_digital_playback = &alc883_pcm_digital_playback; 5824 spec->stream_digital_capture = &alc883_pcm_digital_capture; 5825 5826 if (! spec->adc_nids && spec->input_mux) { 5827 spec->adc_nids = alc883_adc_nids; 5828 spec->num_adc_nids = ARRAY_SIZE(alc883_adc_nids); 5829 } 5830 5831 codec->patch_ops = alc_patch_ops; 5832 if (board_config == ALC883_AUTO) 5833 spec->init_hook = alc883_auto_init; 5834 5835 return 0; 5071 5836 } 5072 5837 … … 5086 5851 5087 5852 static struct snd_kcontrol_new alc262_base_mixer[] = { 5088 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5089 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 5090 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5091 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5092 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 5093 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 5094 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5095 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5096 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 5097 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 5098 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), 5099 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ 5100 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), 5101 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 5102 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 5103 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), 5104 {0} /* end */ 5853 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5854 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 5855 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5856 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5857 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 5858 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 5859 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5860 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5861 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 5862 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 5863 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), 5864 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ 5865 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT), 5866 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), 5867 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 5868 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), 5869 {0} /* end */ 5870 }; 5871 5872 static struct snd_kcontrol_new alc262_hippo1_mixer[] = { 5873 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5874 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), 5875 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5876 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5877 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 5878 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 5879 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5880 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5881 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 5882 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 5883 /* HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), 5884 HDA_CODEC_MUTE("PC Beelp Playback Switch", 0x0b, 0x05, HDA_INPUT), */ 5885 /*HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),*/ 5886 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 5887 {0} /* end */ 5105 5888 }; 5106 5889 5107 5890 static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5891 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 5892 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), 5893 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 5894 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT), 5895 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT), 5896 5897 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5898 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5899 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 5900 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), 5901 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 5902 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 5903 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5904 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5905 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x0b, 0x05, HDA_INPUT), 5906 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x0b, 0x05, HDA_INPUT), 5907 HDA_CODEC_VOLUME("AUX IN Playback Volume", 0x0b, 0x06, HDA_INPUT), 5908 HDA_CODEC_MUTE("AUX IN Playback Switch", 0x0b, 0x06, HDA_INPUT), 5909 {0} /* end */ 5127 5910 }; 5128 5911 … … 5134 5917 */ 5135 5918 static struct hda_verb alc262_init_verbs[] = { 5136 /* 5137 * Unmute ADC0-2 and set the default input to mic-in 5138 */ 5139 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 5140 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5141 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 5142 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5143 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 5144 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5145 5146 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 5147 * mixer widget 5148 * Note: PASD motherboards uses the Line In 2 as the input for front panel 5149 * mic (mic 2) 5150 */ 5151 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ 5152 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5153 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5154 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5155 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 5156 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 5157 5158 /* 5159 * Set up output mixers (0x0c - 0x0e) 5160 */ 5161 /* set vol=0 to output mixers */ 5162 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5163 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5164 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5165 /* set up input amps for analog loopback */ 5166 /* Amp Indices: DAC = 0, mixer = 1 */ 5167 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5168 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5169 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5170 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5171 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5172 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5173 5174 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 5175 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 5176 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 5177 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 5178 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 5179 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 5180 5181 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5182 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5183 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5184 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5185 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5186 5187 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 5188 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 5189 5190 /* FIXME: use matrix-type input source selection */ 5191 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 5192 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 5193 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 5194 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 5195 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 5196 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 5197 /* Input mixer2 */ 5198 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 5199 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 5200 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 5201 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 5202 /* Input mixer3 */ 5203 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 5204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 5205 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 5206 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 5207 5208 {0} 5209 }; 5919 /* 5920 * Unmute ADC0-2 and set the default input to mic-in 5921 */ 5922 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 5923 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5924 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 5925 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5926 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 5927 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5928 5929 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 5930 * mixer widget 5931 * Note: PASD motherboards uses the Line In 2 as the input for front panel 5932 * mic (mic 2) 5933 */ 5934 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ 5935 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5936 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5937 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5938 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 5939 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 5940 5941 /* 5942 * Set up output mixers (0x0c - 0x0e) 5943 */ 5944 /* set vol=0 to output mixers */ 5945 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5946 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5947 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 5948 /* set up input amps for analog loopback */ 5949 /* Amp Indices: DAC = 0, mixer = 1 */ 5950 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5951 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5952 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5953 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5954 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5955 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5956 5957 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 5958 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 5959 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, 5960 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 5961 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 5962 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 5963 5964 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5965 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5966 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5967 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5968 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 5969 5970 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, 5971 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, 5972 5973 /* FIXME: use matrix-type input source selection */ 5974 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 5975 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 5976 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 5977 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 5978 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 5979 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 5980 /* Input mixer2 */ 5981 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 5982 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 5983 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 5984 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 5985 /* Input mixer3 */ 5986 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 5987 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 5988 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 5989 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 5990 5991 {0} 5992 }; 5993 5994 static struct hda_verb alc262_hippo_unsol_verbs[] = { 5995 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 5996 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 5997 {0} 5998 }; 5999 6000 static struct hda_verb alc262_hippo1_unsol_verbs[] = { 6001 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 6002 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 6003 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000}, 6004 6005 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 6006 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6007 {0} 6008 }; 6009 6010 /* mute/unmute internal speaker according to the hp jack and mute state */ 6011 static void alc262_hippo_automute(struct hda_codec *codec, int force) 6012 { 6013 struct alc_spec *spec = codec->spec; 6014 unsigned int mute; 6015 6016 if (force || ! spec->sense_updated) { 6017 unsigned int present; 6018 /* need to execute and sync at first */ 6019 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); 6020 present = snd_hda_codec_read(codec, 0x15, 0, 6021 AC_VERB_GET_PIN_SENSE, 0); 6022 spec->jack_present = (present & 0x80000000) != 0; 6023 spec->sense_updated = 1; 6024 } 6025 if (spec->jack_present) { 6026 /* mute internal speaker */ 6027 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 6028 0x80, 0x80); 6029 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 6030 0x80, 0x80); 6031 } else { 6032 /* unmute internal speaker if necessary */ 6033 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); 6034 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 6035 0x80, mute & 0x80); 6036 mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0); 6037 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 6038 0x80, mute & 0x80); 6039 } 6040 } 6041 6042 /* unsolicited event for HP jack sensing */ 6043 static void alc262_hippo_unsol_event(struct hda_codec *codec, 6044 unsigned int res) 6045 { 6046 if ((res >> 26) != ALC880_HP_EVENT) 6047 return; 6048 alc262_hippo_automute(codec, 1); 6049 } 6050 6051 static void alc262_hippo1_automute(struct hda_codec *codec, int force) 6052 { 6053 struct alc_spec *spec = codec->spec; 6054 unsigned int mute; 6055 6056 if (force || ! spec->sense_updated) { 6057 unsigned int present; 6058 /* need to execute and sync at first */ 6059 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); 6060 present = snd_hda_codec_read(codec, 0x1b, 0, 6061 AC_VERB_GET_PIN_SENSE, 0); 6062 spec->jack_present = (present & 0x80000000) != 0; 6063 spec->sense_updated = 1; 6064 } 6065 if (spec->jack_present) { 6066 /* mute internal speaker */ 6067 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 6068 0x80, 0x80); 6069 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 6070 0x80, 0x80); 6071 } else { 6072 /* unmute internal speaker if necessary */ 6073 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); 6074 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 6075 0x80, mute & 0x80); 6076 mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0); 6077 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 6078 0x80, mute & 0x80); 6079 } 6080 } 6081 6082 /* unsolicited event for HP jack sensing */ 6083 static void alc262_hippo1_unsol_event(struct hda_codec *codec, 6084 unsigned int res) 6085 { 6086 if ((res >> 26) != ALC880_HP_EVENT) 6087 return; 6088 alc262_hippo1_automute(codec, 1); 6089 } 5210 6090 5211 6091 /* … … 5217 6097 5218 6098 static struct hda_verb alc262_fujitsu_unsol_verbs[] = { 5219 5220 5221 6099 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT}, 6100 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, 6101 {0} 5222 6102 }; 5223 6103 5224 6104 static struct hda_input_mux alc262_fujitsu_capture_source = { 5225 5226 5227 5228 5229 6105 .num_items = 2, 6106 .items = { 6107 { "Mic", 0x0 }, 6108 { "CD", 0x4 }, 6109 }, 5230 6110 }; 5231 6111 5232 6112 static struct hda_input_mux alc262_HP_capture_source = { 5233 5234 5235 5236 5237 5238 5239 5240 6113 .num_items = 5, 6114 .items = { 6115 { "Mic", 0x0 }, 6116 { "Front Mic", 0x3 }, 6117 { "Line", 0x2 }, 6118 { "CD", 0x4 }, 6119 { "AUX IN", 0x6 }, 6120 }, 5241 6121 }; 5242 6122 … … 5244 6124 static void alc262_fujitsu_automute(struct hda_codec *codec, int force) 5245 6125 { 5246 5247 5248 5249 5250 5251 5252 5253 5254 5255 5256 5257 5258 5259 5260 5261 5262 5263 5264 5265 5266 5267 5268 5269 5270 5271 5272 6126 struct alc_spec *spec = codec->spec; 6127 unsigned int mute; 6128 6129 if (force || ! spec->sense_updated) { 6130 unsigned int present; 6131 /* need to execute and sync at first */ 6132 snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0); 6133 present = snd_hda_codec_read(codec, 0x14, 0, 6134 AC_VERB_GET_PIN_SENSE, 0); 6135 spec->jack_present = (present & 0x80000000) != 0; 6136 spec->sense_updated = 1; 6137 } 6138 if (spec->jack_present) { 6139 /* mute internal speaker */ 6140 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6141 0x80, 0x80); 6142 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 6143 0x80, 0x80); 6144 } else { 6145 /* unmute internal speaker if necessary */ 6146 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); 6147 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6148 0x80, mute & 0x80); 6149 mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0); 6150 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 6151 0x80, mute & 0x80); 6152 } 5273 6153 } 5274 6154 5275 6155 /* unsolicited event for HP jack sensing */ 5276 6156 static void alc262_fujitsu_unsol_event(struct hda_codec *codec, 5277 5278 { 5279 5280 5281 6157 unsigned int res) 6158 { 6159 if ((res >> 26) != ALC_HP_EVENT) 6160 return; 6161 alc262_fujitsu_automute(codec, 1); 5282 6162 } 5283 6163 5284 6164 /* bind volumes of both NID 0x0c and 0x0d */ 5285 6165 static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol, 5286 5287 { 5288 5289 5290 5291 5292 5293 5294 5295 5296 5297 5298 5299 5300 6166 struct snd_ctl_elem_value *ucontrol) 6167 { 6168 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 6169 long *valp = ucontrol->value.integer.value; 6170 int change; 6171 6172 change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, 6173 0x7f, valp[0] & 0x7f); 6174 change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, 6175 0x7f, valp[1] & 0x7f); 6176 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, 6177 0x7f, valp[0] & 0x7f); 6178 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, 6179 0x7f, valp[1] & 0x7f); 6180 return change; 5301 6181 } 5302 6182 5303 6183 /* bind hp and internal speaker mute (with plug check) */ 5304 6184 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, 5305 5306 { 5307 5308 5309 5310 5311 5312 5313 5314 5315 5316 5317 6185 struct snd_ctl_elem_value *ucontrol) 6186 { 6187 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 6188 long *valp = ucontrol->value.integer.value; 6189 int change; 6190 6191 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 6192 0x80, valp[0] ? 0 : 0x80); 6193 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 6194 0x80, valp[1] ? 0 : 0x80); 6195 if (change || codec->in_resume) 6196 alc262_fujitsu_automute(codec, codec->in_resume); 6197 return change; 5318 6198 } 5319 6199 5320 6200 static struct snd_kcontrol_new alc262_fujitsu_mixer[] = { 5321 { 5322 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5323 .name = "Master Playback Volume", 5324 .info = snd_hda_mixer_amp_volume_info, 5325 .get = snd_hda_mixer_amp_volume_get, 5326 .put = alc262_fujitsu_master_vol_put, 5327 .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), 5328 }, 5329 { 5330 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5331 .name = "Master Playback Switch", 5332 .info = snd_hda_mixer_amp_switch_info, 5333 .get = snd_hda_mixer_amp_switch_get, 5334 .put = alc262_fujitsu_master_sw_put, 5335 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 5336 }, 5337 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 5338 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 5339 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 5340 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 5341 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 5342 {0} /* end */ 6201 { 6202 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6203 .name = "Master Playback Volume", 6204 .info = snd_hda_mixer_amp_volume_info, 6205 .get = snd_hda_mixer_amp_volume_get, 6206 .put = alc262_fujitsu_master_vol_put, 6207 .tlv = { .c = snd_hda_mixer_amp_tlv }, 6208 .private_value = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT), 6209 }, 6210 { 6211 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6212 .name = "Master Playback Switch", 6213 .info = snd_hda_mixer_amp_switch_info, 6214 .get = snd_hda_mixer_amp_switch_get, 6215 .put = alc262_fujitsu_master_sw_put, 6216 .private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), 6217 }, 6218 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT), 6219 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT), 6220 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), 6221 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 6222 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 6223 {0} /* end */ 6224 }; 6225 6226 /* additional init verbs for Benq laptops */ 6227 static struct hda_verb alc262_EAPD_verbs[] = { 6228 {0x20, AC_VERB_SET_COEF_INDEX, 0x07}, 6229 {0x20, AC_VERB_SET_PROC_COEF, 0x3070}, 6230 {0} 5343 6231 }; 5344 6232 … … 5346 6234 static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) 5347 6235 { 5348 hda_nid_t nid; 5349 int err; 5350 5351 spec->multiout.num_dacs = 1; /* only use one dac */ 5352 spec->multiout.dac_nids = spec->private_dac_nids; 5353 spec->multiout.dac_nids[0] = 2; 5354 5355 nid = cfg->line_out_pins[0]; 5356 if (nid) { 5357 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Front Playback Volume", 5358 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT))) < 0) 5359 return err; 5360 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Front Playback Switch", 5361 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 5362 return err; 5363 } 5364 5365 nid = cfg->speaker_pins[0]; 5366 if (nid) { 5367 if (nid == 0x16) { 5368 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", 5369 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) 5370 return err; 5371 } else { 5372 if (! cfg->line_out_pins[0]) 5373 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Speaker Playback Volume", 5374 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT))) < 0) 5375 return err; 5376 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", 5377 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 5378 return err; 5379 } 5380 } 5381 nid = cfg->hp_pin; 5382 if (nid) { 5383 /* spec->multiout.hp_nid = 2; */ 5384 if (nid == 0x16) { 5385 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Headphone Playback Volume", 5386 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT))) < 0) 5387 return err; 5388 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", 5389 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) 5390 return err; 5391 } else { 5392 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", 5393 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 5394 return err; 5395 } 5396 } 5397 return 0; 6236 hda_nid_t nid; 6237 int err; 6238 6239 spec->multiout.num_dacs = 1; /* only use one dac */ 6240 spec->multiout.dac_nids = spec->private_dac_nids; 6241 spec->multiout.dac_nids[0] = 2; 6242 6243 nid = cfg->line_out_pins[0]; 6244 if (nid) { 6245 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Front Playback Volume", 6246 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT))) < 0) 6247 return err; 6248 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Front Playback Switch", 6249 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 6250 return err; 6251 } 6252 6253 nid = cfg->speaker_pins[0]; 6254 if (nid) { 6255 if (nid == 0x16) { 6256 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Speaker Playback Volume", 6257 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT))) < 0) 6258 return err; 6259 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", 6260 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) 6261 return err; 6262 } else { 6263 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Speaker Playback Switch", 6264 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 6265 return err; 6266 } 6267 } 6268 nid = cfg->hp_pins[0]; 6269 if (nid) { 6270 /* spec->multiout.hp_nid = 2; */ 6271 if (nid == 0x16) { 6272 if ((err = add_control(spec, ALC_CTL_WIDGET_VOL, "Headphone Playback Volume", 6273 HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT))) < 0) 6274 return err; 6275 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", 6276 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) 6277 return err; 6278 } else { 6279 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", 6280 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 6281 return err; 6282 } 6283 } 6284 return 0; 5398 6285 } 5399 6286 … … 5405 6292 */ 5406 6293 static struct hda_verb alc262_volume_init_verbs[] = { 5407 5408 5409 5410 5411 5412 5413 5414 5415 5416 5417 5418 5419 5420 5421 5422 5423 5424 5425 5426 5427 5428 5429 5430 5431 5432 5433 5434 5435 5436 5437 5438 5439 5440 5441 5442 5443 5444 5445 5446 5447 5448 5449 5450 5451 5452 5453 5454 5455 5456 5457 5458 5459 5460 5461 5462 5463 5464 6294 /* 6295 * Unmute ADC0-2 and set the default input to mic-in 6296 */ 6297 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 6298 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6299 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 6300 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6301 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 6302 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6303 6304 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 6305 * mixer widget 6306 * Note: PASD motherboards uses the Line In 2 as the input for front panel 6307 * mic (mic 2) 6308 */ 6309 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ 6310 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6311 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6312 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 6313 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 6314 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 6315 6316 /* 6317 * Set up output mixers (0x0c - 0x0f) 6318 */ 6319 /* set vol=0 to output mixers */ 6320 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 6321 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 6322 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 6323 6324 /* set up input amps for analog loopback */ 6325 /* Amp Indices: DAC = 0, mixer = 1 */ 6326 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6327 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6328 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6329 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6330 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6331 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6332 6333 /* FIXME: use matrix-type input source selection */ 6334 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 6335 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 6336 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 6337 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 6338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 6339 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 6340 /* Input mixer2 */ 6341 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 6342 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 6343 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 6344 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 6345 /* Input mixer3 */ 6346 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 6347 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, 6348 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, 6349 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, 6350 6351 {0} 5465 6352 }; 5466 6353 5467 6354 static struct hda_verb alc262_HP_BPC_init_verbs[] = { 5468 5469 5470 5471 5472 5473 5474 5475 5476 5477 5478 5479 5480 5481 5482 5483 5484 5485 5486 5487 5488 5489 5490 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)},5491 5492 5493 5494 5495 5496 5497 5498 5499 5500 5501 5502 5503 5504 5505 5506 5507 5508 5509 5510 5511 5512 5513 5514 5515 5516 5517 5518 5519 5520 5521 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},5522 5523 5524 5525 5526 5527 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 },5528 5529 5530 5531 5532 5533 5534 5535 5536 5537 5538 5539 5540 5541 5542 5543 5544 5545 5546 5547 5548 5549 5550 5551 6355 /* 6356 * Unmute ADC0-2 and set the default input to mic-in 6357 */ 6358 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00}, 6359 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6360 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 6361 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6362 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, 6363 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6364 6365 /* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback 6366 * mixer widget 6367 * Note: PASD motherboards uses the Line In 2 as the input for front panel 6368 * mic (mic 2) 6369 */ 6370 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ 6371 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6372 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6373 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 6374 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 6375 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(4)}, 6376 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)}, 6377 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(6)}, 6378 6379 /* 6380 * Set up output mixers (0x0c - 0x0e) 6381 */ 6382 /* set vol=0 to output mixers */ 6383 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 6384 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 6385 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, 6386 6387 /* set up input amps for analog loopback */ 6388 /* Amp Indices: DAC = 0, mixer = 1 */ 6389 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6390 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6391 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6392 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6393 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6395 6396 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0}, 6397 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 6398 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, 6399 6400 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 6401 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, 6402 6403 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, 6404 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, 6405 6406 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 6407 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 6408 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, 6409 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 6410 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20}, 6411 6412 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, 6413 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, 6414 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, 6415 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x7023 }, 6416 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, 6417 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, 0x7000 }, 6418 6419 6420 /* FIXME: use matrix-type input source selection */ 6421 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ 6422 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ 6423 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 6424 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, 6425 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, 6426 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, 6427 /* Input mixer2 */ 6428 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 6429 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, 6430 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, 6431 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, 6432 /* Input mixer3 */ 6433 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 6434 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x03 << 8))}, 6435 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8))}, 6436 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x04 << 8))}, 6437 6438 {0} 5552 6439 }; 5553 6440 … … 5563 6450 static int alc262_parse_auto_config(struct hda_codec *codec) 5564 6451 { 5565 struct alc_spec *spec = codec->spec; 5566 int err; 5567 static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; 5568 5569 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 5570 alc262_ignore)) < 0) 5571 return err; 5572 if (! spec->autocfg.line_outs) 5573 return 0; /* can't find valid BIOS pin config */ 5574 if ((err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 5575 (err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 5576 return err; 5577 5578 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 5579 5580 if (spec->autocfg.dig_out_pin) 5581 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; 5582 if (spec->autocfg.dig_in_pin) 5583 spec->dig_in_nid = ALC262_DIGIN_NID; 5584 5585 if (spec->kctl_alloc) 5586 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 5587 5588 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; 5589 spec->input_mux = &spec->private_imux; 5590 5591 return 1; 6452 struct alc_spec *spec = codec->spec; 6453 int err; 6454 static hda_nid_t alc262_ignore[] = { 0x1d, 0 }; 6455 6456 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 6457 alc262_ignore)) < 0) 6458 return err; 6459 if (! spec->autocfg.line_outs) 6460 return 0; /* can't find valid BIOS pin config */ 6461 if ((err = alc262_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 6462 (err = alc262_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 6463 return err; 6464 6465 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 6466 6467 if (spec->autocfg.dig_out_pin) 6468 spec->multiout.dig_out_nid = ALC262_DIGOUT_NID; 6469 if (spec->autocfg.dig_in_pin) 6470 spec->dig_in_nid = ALC262_DIGIN_NID; 6471 6472 if (spec->kctl_alloc) 6473 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 6474 6475 spec->init_verbs[spec->num_init_verbs++] = alc262_volume_init_verbs; 6476 spec->num_mux_defs = 1; 6477 spec->input_mux = &spec->private_imux; 6478 6479 return 1; 5592 6480 } 5593 6481 … … 5600 6488 static void alc262_auto_init(struct hda_codec *codec) 5601 6489 { 5602 5603 5604 6490 alc262_auto_init_multi_out(codec); 6491 alc262_auto_init_hp_out(codec); 6492 alc262_auto_init_analog_input(codec); 5605 6493 } 5606 6494 … … 5608 6496 * configuration and preset 5609 6497 */ 5610 static struct hda_board_config alc262_cfg_tbl[] = { 5611 { .modelname = "basic", .config = ALC262_BASIC }, 5612 { .modelname = "fujitsu", .config = ALC262_FUJITSU }, 5613 { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1397, 5614 .config = ALC262_FUJITSU }, 5615 { .pci_subvendor = 0x103c, .pci_subdevice = 0x208c, 5616 .config = ALC262_HP_BPC }, /* xw4400 */ 5617 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, 5618 .config = ALC262_HP_BPC }, /* xw6400 */ 5619 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3015, 5620 .config = ALC262_HP_BPC }, /* xw8400 */ 5621 { .pci_subvendor = 0x103c, .pci_subdevice = 0x12fe, 5622 .config = ALC262_HP_BPC }, /* xw9400 */ 5623 { .modelname = "auto", .config = ALC262_AUTO }, 5624 {0} 6498 static const char *alc262_models[ALC262_MODEL_LAST] = { 6499 [ALC262_BASIC] = "basic", 6500 [ALC262_HIPPO] = "hippo", 6501 [ALC262_HIPPO_1] = "hippo_1", 6502 [ALC262_FUJITSU] = "fujitsu", 6503 [ALC262_HP_BPC] = "hp-bpc", 6504 [ALC262_BENQ_ED8] = "benq", 6505 [ALC262_AUTO] = "auto", 6506 }; 6507 6508 static struct snd_pci_quirk alc262_cfg_tbl[] = { 6509 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO), 6510 SND_PCI_QUIRK(0x103c, 0x12fe, "HP xw9400", ALC262_HP_BPC), 6511 SND_PCI_QUIRK(0x103c, 0x280c, "HP xw4400", ALC262_HP_BPC), 6512 SND_PCI_QUIRK(0x103c, 0x2801, "HP q954", ALC262_HP_BPC), 6513 SND_PCI_QUIRK(0x103c, 0x3014, "HP xw6400", ALC262_HP_BPC), 6514 SND_PCI_QUIRK(0x103c, 0x3015, "HP xw8400", ALC262_HP_BPC), 6515 SND_PCI_QUIRK(0x104d, 0x8203, "Sony UX-90", ALC262_HIPPO), 6516 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), 6517 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), 6518 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), 6519 {0} 5625 6520 }; 5626 6521 5627 6522 static struct alc_config_preset alc262_presets[] = { 5628 [ALC262_BASIC] = { 5629 .mixers = { alc262_base_mixer }, 5630 .init_verbs = { alc262_init_verbs }, 5631 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 5632 .dac_nids = alc262_dac_nids, 5633 .hp_nid = 0x03, 5634 .num_channel_mode = ARRAY_SIZE(alc262_modes), 5635 .channel_mode = alc262_modes, 5636 .input_mux = &alc262_capture_source, 5637 }, 5638 [ALC262_FUJITSU] = { 5639 .mixers = { alc262_fujitsu_mixer }, 5640 .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, 5641 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 5642 .dac_nids = alc262_dac_nids, 5643 .hp_nid = 0x03, 5644 .dig_out_nid = ALC262_DIGOUT_NID, 5645 .num_channel_mode = ARRAY_SIZE(alc262_modes), 5646 .channel_mode = alc262_modes, 5647 .input_mux = &alc262_fujitsu_capture_source, 5648 .unsol_event = alc262_fujitsu_unsol_event, 5649 }, 5650 [ALC262_HP_BPC] = { 5651 .mixers = { alc262_HP_BPC_mixer }, 5652 .init_verbs = { alc262_HP_BPC_init_verbs }, 5653 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 5654 .dac_nids = alc262_dac_nids, 5655 .hp_nid = 0x03, 5656 .num_channel_mode = ARRAY_SIZE(alc262_modes), 5657 .channel_mode = alc262_modes, 5658 .input_mux = &alc262_HP_capture_source, 5659 }, 6523 [ALC262_BASIC] = { 6524 .mixers = { alc262_base_mixer }, 6525 .init_verbs = { alc262_init_verbs }, 6526 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 6527 .dac_nids = alc262_dac_nids, 6528 .hp_nid = 0x03, 6529 .num_channel_mode = ARRAY_SIZE(alc262_modes), 6530 .channel_mode = alc262_modes, 6531 .input_mux = &alc262_capture_source, 6532 }, 6533 [ALC262_HIPPO] = { 6534 .mixers = { alc262_base_mixer }, 6535 .init_verbs = { alc262_init_verbs, alc262_hippo_unsol_verbs}, 6536 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 6537 .dac_nids = alc262_dac_nids, 6538 .hp_nid = 0x03, 6539 .dig_out_nid = ALC262_DIGOUT_NID, 6540 .num_channel_mode = ARRAY_SIZE(alc262_modes), 6541 .channel_mode = alc262_modes, 6542 .input_mux = &alc262_capture_source, 6543 .unsol_event = alc262_hippo_unsol_event, 6544 }, 6545 [ALC262_HIPPO_1] = { 6546 .mixers = { alc262_hippo1_mixer }, 6547 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs}, 6548 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 6549 .dac_nids = alc262_dac_nids, 6550 .hp_nid = 0x02, 6551 .dig_out_nid = ALC262_DIGOUT_NID, 6552 .num_channel_mode = ARRAY_SIZE(alc262_modes), 6553 .channel_mode = alc262_modes, 6554 .input_mux = &alc262_capture_source, 6555 .unsol_event = alc262_hippo1_unsol_event, 6556 }, 6557 [ALC262_FUJITSU] = { 6558 .mixers = { alc262_fujitsu_mixer }, 6559 .init_verbs = { alc262_init_verbs, alc262_fujitsu_unsol_verbs }, 6560 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 6561 .dac_nids = alc262_dac_nids, 6562 .hp_nid = 0x03, 6563 .dig_out_nid = ALC262_DIGOUT_NID, 6564 .num_channel_mode = ARRAY_SIZE(alc262_modes), 6565 .channel_mode = alc262_modes, 6566 .input_mux = &alc262_fujitsu_capture_source, 6567 .unsol_event = alc262_fujitsu_unsol_event, 6568 }, 6569 [ALC262_HP_BPC] = { 6570 .mixers = { alc262_HP_BPC_mixer }, 6571 .init_verbs = { alc262_HP_BPC_init_verbs }, 6572 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 6573 .dac_nids = alc262_dac_nids, 6574 .hp_nid = 0x03, 6575 .num_channel_mode = ARRAY_SIZE(alc262_modes), 6576 .channel_mode = alc262_modes, 6577 .input_mux = &alc262_HP_capture_source, 6578 }, 6579 [ALC262_BENQ_ED8] = { 6580 .mixers = { alc262_base_mixer }, 6581 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs }, 6582 .num_dacs = ARRAY_SIZE(alc262_dac_nids), 6583 .dac_nids = alc262_dac_nids, 6584 .hp_nid = 0x03, 6585 .num_channel_mode = ARRAY_SIZE(alc262_modes), 6586 .channel_mode = alc262_modes, 6587 .input_mux = &alc262_capture_source, 6588 }, 5660 6589 }; 5661 6590 5662 6591 static int patch_alc262(struct hda_codec *codec) 5663 6592 { 5664 5665 5666 5667 5668 5669 5670 5671 5672 6593 struct alc_spec *spec; 6594 int board_config; 6595 int err; 6596 6597 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 6598 if (spec == NULL) 6599 return -ENOMEM; 6600 6601 codec->spec = spec; 5673 6602 #if 0 5674 5675 5676 5677 5678 5679 5680 5681 6603 /* pshou 07/11/05 set a zero PCM sample to DAC when FIFO is under-run */ 6604 { 6605 int tmp; 6606 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); 6607 tmp = snd_hda_codec_read(codec, 0x20, 0, AC_VERB_GET_PROC_COEF, 0); 6608 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_COEF_INDEX, 7); 6609 snd_hda_codec_write(codec, 0x1a, 0, AC_VERB_SET_PROC_COEF, tmp | 0x80); 6610 } 5682 6611 #endif 5683 6612 5684 board_config = snd_hda_check_board_config(codec, alc262_cfg_tbl); 5685 5686 if (board_config < 0 || board_config >= ALC262_MODEL_LAST) { 5687 printk(KERN_INFO "hda_codec: Unknown model for ALC262, trying auto-probe from BIOS...\n"); 5688 board_config = ALC262_AUTO; 5689 } 5690 5691 if (board_config == ALC262_AUTO) { 5692 /* automatic parse from the BIOS config */ 5693 err = alc262_parse_auto_config(codec); 5694 if (err < 0) { 5695 alc_free(codec); 5696 return err; 5697 } else if (! err) { 5698 printk(KERN_INFO "hda_codec: Cannot set up configuration from BIOS. Using base mode...\n"); 5699 board_config = ALC262_BASIC; 5700 } 5701 } 5702 5703 if (board_config != ALC262_AUTO) 5704 setup_preset(spec, &alc262_presets[board_config]); 5705 5706 spec->stream_name_analog = "ALC262 Analog"; 5707 spec->stream_analog_playback = &alc262_pcm_analog_playback; 5708 spec->stream_analog_capture = &alc262_pcm_analog_capture; 5709 5710 spec->stream_name_digital = "ALC262 Digital"; 5711 spec->stream_digital_playback = &alc262_pcm_digital_playback; 5712 spec->stream_digital_capture = &alc262_pcm_digital_capture; 5713 5714 if (! spec->adc_nids && spec->input_mux) { 5715 /* check whether NID 0x07 is valid */ 5716 unsigned int wcap = get_wcaps(codec, 0x07); 5717 5718 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 5719 if (wcap != AC_WID_AUD_IN) { 5720 spec->adc_nids = alc262_adc_nids_alt; 5721 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); 5722 spec->mixers[spec->num_mixers] = alc262_capture_alt_mixer; 5723 spec->num_mixers++; 5724 } else { 5725 spec->adc_nids = alc262_adc_nids; 5726 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); 5727 spec->mixers[spec->num_mixers] = alc262_capture_mixer; 5728 spec->num_mixers++; 5729 } 5730 } 5731 5732 codec->patch_ops = alc_patch_ops; 5733 if (board_config == ALC262_AUTO) 5734 spec->init_hook = alc262_auto_init; 5735 5736 return 0; 5737 } 5738 6613 board_config = snd_hda_check_board_config(codec, ALC262_MODEL_LAST, 6614 alc262_models, 6615 alc262_cfg_tbl); 6616 6617 if (board_config < 0) { 6618 printk(KERN_INFO "hda_codec: Unknown model for ALC262, " 6619 "trying auto-probe from BIOS...\n"); 6620 board_config = ALC262_AUTO; 6621 } 6622 6623 if (board_config == ALC262_AUTO) { 6624 /* automatic parse from the BIOS config */ 6625 err = alc262_parse_auto_config(codec); 6626 if (err < 0) { 6627 alc_free(codec); 6628 return err; 6629 } else if (! err) { 6630 printk(KERN_INFO 6631 "hda_codec: Cannot set up configuration " 6632 "from BIOS. Using base mode...\n"); 6633 board_config = ALC262_BASIC; 6634 } 6635 } 6636 6637 if (board_config != ALC262_AUTO) 6638 setup_preset(spec, &alc262_presets[board_config]); 6639 6640 spec->stream_name_analog = "ALC262 Analog"; 6641 spec->stream_analog_playback = &alc262_pcm_analog_playback; 6642 spec->stream_analog_capture = &alc262_pcm_analog_capture; 6643 6644 spec->stream_name_digital = "ALC262 Digital"; 6645 spec->stream_digital_playback = &alc262_pcm_digital_playback; 6646 spec->stream_digital_capture = &alc262_pcm_digital_capture; 6647 6648 if (! spec->adc_nids && spec->input_mux) { 6649 /* check whether NID 0x07 is valid */ 6650 unsigned int wcap = get_wcaps(codec, 0x07); 6651 6652 wcap = (wcap & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; /* get type */ 6653 if (wcap != AC_WID_AUD_IN) { 6654 spec->adc_nids = alc262_adc_nids_alt; 6655 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids_alt); 6656 spec->mixers[spec->num_mixers] = alc262_capture_alt_mixer; 6657 spec->num_mixers++; 6658 } else { 6659 spec->adc_nids = alc262_adc_nids; 6660 spec->num_adc_nids = ARRAY_SIZE(alc262_adc_nids); 6661 spec->mixers[spec->num_mixers] = alc262_capture_mixer; 6662 spec->num_mixers++; 6663 } 6664 } 6665 6666 codec->patch_ops = alc_patch_ops; 6667 if (board_config == ALC262_AUTO) 6668 spec->init_hook = alc262_auto_init; 6669 6670 return 0; 6671 } 5739 6672 5740 6673 /* … … 5747 6680 */ 5748 6681 static struct hda_verb alc861_threestack_ch2_init[] = { 5749 5750 5751 5752 5753 5754 6682 /* set pin widget 1Ah (line in) for input */ 6683 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 6684 /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */ 6685 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 6686 6687 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, 5755 6688 #if 0 5756 5757 6689 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ 6690 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ 5758 6691 #endif 5759 6692 {0} /* end */ 5760 6693 }; 5761 6694 /* … … 5764 6697 */ 5765 6698 static struct hda_verb alc861_threestack_ch6_init[] = { 5766 5767 5768 5769 5770 5771 5772 5773 5774 6699 /* set pin widget 1Ah (line in) for output (Back Surround)*/ 6700 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 6701 /* set pin widget 18h (mic1) for output (CLFE)*/ 6702 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 6703 6704 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, 6705 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, 6706 6707 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, 5775 6708 #if 0 5776 5777 6709 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ 6710 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ 5778 6711 #endif 5779 6712 {0} /* end */ 5780 6713 }; 5781 6714 5782 6715 static struct hda_channel_mode alc861_threestack_modes[2] = { 5783 { 2, alc861_threestack_ch2_init }, 5784 { 6, alc861_threestack_ch6_init }, 6716 { 2, alc861_threestack_ch2_init }, 6717 { 6, alc861_threestack_ch6_init }, 6718 }; 6719 /* Set mic1 as input and unmute the mixer */ 6720 static struct hda_verb alc861_uniwill_m31_ch2_init[] = { 6721 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 6722 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ 6723 {0} /* end */ 6724 }; 6725 /* Set mic1 as output and mute mixer */ 6726 static struct hda_verb alc861_uniwill_m31_ch4_init[] = { 6727 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 6728 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ 6729 {0} /* end */ 6730 }; 6731 6732 static struct hda_channel_mode alc861_uniwill_m31_modes[2] = { 6733 { 2, alc861_uniwill_m31_ch2_init }, 6734 { 4, alc861_uniwill_m31_ch4_init }, 6735 }; 6736 6737 /* Set mic1 and line-in as input and unmute the mixer */ 6738 static struct hda_verb alc861_asus_ch2_init[] = { 6739 /* set pin widget 1Ah (line in) for input */ 6740 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 6741 /* set pin widget 18h (mic1/2) for input, for mic also enable the vref */ 6742 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 6743 6744 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, 6745 #if 0 6746 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8)) }, /*mic*/ 6747 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x02 << 8)) }, /*line-in*/ 6748 #endif 6749 {0} /* end */ 6750 }; 6751 /* Set mic1 nad line-in as output and mute mixer */ 6752 static struct hda_verb alc861_asus_ch6_init[] = { 6753 /* set pin widget 1Ah (line in) for output (Back Surround)*/ 6754 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 6755 /* { 0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ 6756 /* set pin widget 18h (mic1) for output (CLFE)*/ 6757 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 6758 /* { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE }, */ 6759 { 0x0c, AC_VERB_SET_CONNECT_SEL, 0x00 }, 6760 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00 }, 6761 6762 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080 }, 6763 #if 0 6764 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x01 << 8)) }, /*mic*/ 6765 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8)) }, /*line in*/ 6766 #endif 6767 {0} /* end */ 6768 }; 6769 6770 static struct hda_channel_mode alc861_asus_modes[2] = { 6771 { 2, alc861_asus_ch2_init }, 6772 { 6, alc861_asus_ch6_init }, 5785 6773 }; 5786 6774 … … 5788 6776 5789 6777 static struct snd_kcontrol_new alc861_base_mixer[] = { 5790 /* output mixer control */5791 5792 5793 5794 5795 5796 5797 /*Input mixer control */5798 5799 5800 5801 5802 5803 5804 5805 5806 5807 5808 5809 /* Capture mixer control */5810 5811 5812 5813 5814 5815 5816 5817 5818 5819 5820 6778 /* output mixer control */ 6779 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), 6780 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), 6781 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), 6782 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), 6783 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), 6784 6785 /*Input mixer control */ 6786 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), 6787 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ 6788 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), 6789 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), 6790 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), 6791 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), 6792 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), 6793 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), 6794 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), 6795 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), 6796 6797 /* Capture mixer control */ 6798 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 6799 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 6800 { 6801 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6802 .name = "Capture Source", 6803 .count = 1, 6804 .info = alc_mux_enum_info, 6805 .get = alc_mux_enum_get, 6806 .put = alc_mux_enum_put, 6807 }, 6808 {0} /* end */ 5821 6809 }; 5822 6810 5823 6811 static struct snd_kcontrol_new alc861_3ST_mixer[] = { 5824 /* output mixer control */ 5825 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), 5826 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), 5827 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), 5828 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), 5829 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ 5830 5831 /* Input mixer control */ 5832 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), 5833 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ 5834 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), 5835 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), 5836 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), 5837 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), 5838 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), 5839 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), 5840 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), 5841 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), 5842 5843 /* Capture mixer control */ 5844 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 5845 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 5846 { 5847 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5848 .name = "Capture Source", 5849 .count = 1, 5850 .info = alc_mux_enum_info, 5851 .get = alc_mux_enum_get, 5852 .put = alc_mux_enum_put, 5853 }, 5854 { 5855 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 5856 .name = "Channel Mode", 5857 .info = alc_ch_mode_info, 5858 .get = alc_ch_mode_get, 5859 .put = alc_ch_mode_put, 5860 .private_value = ARRAY_SIZE(alc861_threestack_modes), 5861 }, 5862 {0} /* end */ 6812 /* output mixer control */ 6813 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), 6814 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), 6815 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), 6816 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), 6817 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ 6818 6819 /* Input mixer control */ 6820 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), 6821 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ 6822 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), 6823 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), 6824 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), 6825 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), 6826 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), 6827 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), 6828 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), 6829 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), 6830 6831 /* Capture mixer control */ 6832 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 6833 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 6834 { 6835 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6836 .name = "Capture Source", 6837 .count = 1, 6838 .info = alc_mux_enum_info, 6839 .get = alc_mux_enum_get, 6840 .put = alc_mux_enum_put, 6841 }, 6842 { 6843 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6844 .name = "Channel Mode", 6845 .info = alc_ch_mode_info, 6846 .get = alc_ch_mode_get, 6847 .put = alc_ch_mode_put, 6848 .private_value = ARRAY_SIZE(alc861_threestack_modes), 6849 }, 6850 {0} /* end */ 6851 }; 6852 6853 static struct snd_kcontrol_new alc861_toshiba_mixer[] = { 6854 /* output mixer control */ 6855 HDA_CODEC_MUTE("Master Playback Switch", 0x03, 0x0, HDA_OUTPUT), 6856 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), 6857 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), 6858 6859 /*Capture mixer control */ 6860 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 6861 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 6862 { 6863 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6864 .name = "Capture Source", 6865 .count = 1, 6866 .info = alc_mux_enum_info, 6867 .get = alc_mux_enum_get, 6868 .put = alc_mux_enum_put, 6869 }, 6870 6871 {0} /* end */ 6872 }; 6873 6874 static struct snd_kcontrol_new alc861_uniwill_m31_mixer[] = { 6875 /* output mixer control */ 6876 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), 6877 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), 6878 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), 6879 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), 6880 /*HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), */ 6881 6882 /* Input mixer control */ 6883 /* HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), 6884 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), */ 6885 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), 6886 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), 6887 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), 6888 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), 6889 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), 6890 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), 6891 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), 6892 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_INPUT), 6893 6894 /* Capture mixer control */ 6895 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 6896 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 6897 { 6898 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6899 .name = "Capture Source", 6900 .count = 1, 6901 .info = alc_mux_enum_info, 6902 .get = alc_mux_enum_get, 6903 .put = alc_mux_enum_put, 6904 }, 6905 { 6906 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6907 .name = "Channel Mode", 6908 .info = alc_ch_mode_info, 6909 .get = alc_ch_mode_get, 6910 .put = alc_ch_mode_put, 6911 .private_value = ARRAY_SIZE(alc861_uniwill_m31_modes), 6912 }, 6913 {0} /* end */ 6914 }; 6915 6916 static struct snd_kcontrol_new alc861_asus_mixer[] = { 6917 /* output mixer control */ 6918 HDA_CODEC_MUTE("Front Playback Switch", 0x03, 0x0, HDA_OUTPUT), 6919 HDA_CODEC_MUTE("Surround Playback Switch", 0x06, 0x0, HDA_OUTPUT), 6920 HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x05, 1, 0x0, HDA_OUTPUT), 6921 HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x05, 2, 0x0, HDA_OUTPUT), 6922 HDA_CODEC_MUTE("Side Playback Switch", 0x04, 0x0, HDA_OUTPUT), 6923 6924 /* Input mixer control */ 6925 HDA_CODEC_VOLUME("Input Playback Volume", 0x15, 0x0, HDA_OUTPUT), 6926 HDA_CODEC_MUTE("Input Playback Switch", 0x15, 0x0, HDA_OUTPUT), 6927 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), 6928 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), 6929 HDA_CODEC_VOLUME("Line Playback Volume", 0x15, 0x02, HDA_INPUT), 6930 HDA_CODEC_MUTE("Line Playback Switch", 0x15, 0x02, HDA_INPUT), 6931 HDA_CODEC_VOLUME("Mic Playback Volume", 0x15, 0x01, HDA_INPUT), 6932 HDA_CODEC_MUTE("Mic Playback Switch", 0x15, 0x01, HDA_INPUT), 6933 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x10, 0x01, HDA_OUTPUT), 6934 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x03, HDA_OUTPUT), /* was HDA_INPUT (why?) */ 6935 6936 /* Capture mixer control */ 6937 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 6938 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 6939 { 6940 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6941 .name = "Capture Source", 6942 .count = 1, 6943 .info = alc_mux_enum_info, 6944 .get = alc_mux_enum_get, 6945 .put = alc_mux_enum_put, 6946 }, 6947 { 6948 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 6949 .name = "Channel Mode", 6950 .info = alc_ch_mode_info, 6951 .get = alc_ch_mode_get, 6952 .put = alc_ch_mode_put, 6953 .private_value = ARRAY_SIZE(alc861_asus_modes), 6954 }, 6955 {0} 6956 }; 6957 6958 /* additional mixer */ 6959 static struct snd_kcontrol_new alc861_asus_laptop_mixer[] = { 6960 HDA_CODEC_VOLUME("CD Playback Volume", 0x15, 0x0, HDA_INPUT), 6961 HDA_CODEC_MUTE("CD Playback Switch", 0x15, 0x0, HDA_INPUT), 6962 HDA_CODEC_VOLUME("PC Beep Playback Volume", 0x23, 0x0, HDA_OUTPUT), 6963 HDA_CODEC_MUTE("PC Beep Playback Switch", 0x23, 0x0, HDA_OUTPUT), 6964 {0} 5863 6965 }; 5864 6966 … … 5867 6969 */ 5868 6970 static struct hda_verb alc861_base_init_verbs[] = { 5869 5870 5871 5872 5873 5874 5875 5876 5877 5878 5879 5880 5881 5882 5883 5884 5885 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01},5886 5887 5888 5889 5890 5891 5892 5893 5894 5895 5896 5897 5898 5899 5900 5901 5902 5903 5904 5905 5906 5907 5908 5909 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},5910 5911 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},5912 5913 5914 5915 5916 5917 5918 5919 5920 5921 5922 5923 5924 5925 5926 5927 5928 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},5929 5930 6971 /* 6972 * Unmute ADC0 and set the default input to mic-in 6973 */ 6974 /* port-A for surround (rear panel) */ 6975 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 6976 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x00 }, 6977 /* port-B for mic-in (rear panel) with vref */ 6978 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 6979 /* port-C for line-in (rear panel) */ 6980 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 6981 /* port-D for Front */ 6982 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 6983 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, 6984 /* port-E for HP out (front panel) */ 6985 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, 6986 /* route front PCM to HP */ 6987 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, 6988 /* port-F for mic-in (front panel) with vref */ 6989 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 6990 /* port-G for CLFE (rear panel) */ 6991 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 6992 { 0x1f, AC_VERB_SET_CONNECT_SEL, 0x00 }, 6993 /* port-H for side (rear panel) */ 6994 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 6995 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x00 }, 6996 /* CD-in */ 6997 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 6998 /* route front mic to ADC1*/ 6999 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 7000 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7001 7002 /* Unmute DAC0~3 & spdif out*/ 7003 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7004 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7005 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7006 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7008 7009 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 7010 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7011 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7012 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7013 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7014 7015 /* Unmute Stereo Mixer 15 */ 7016 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7018 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7019 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step 7020 7021 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7022 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7023 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7024 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7025 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7026 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7027 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7028 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7029 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) 7030 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7031 7032 {0} 5931 7033 }; 5932 7034 5933 7035 static struct hda_verb alc861_threestack_init_verbs[] = { 5934 /* 5935 * Unmute ADC0 and set the default input to mic-in 5936 */ 5937 /* port-A for surround (rear panel) */ 5938 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 5939 /* port-B for mic-in (rear panel) with vref */ 5940 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 5941 /* port-C for line-in (rear panel) */ 5942 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 5943 /* port-D for Front */ 5944 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 5945 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, 5946 /* port-E for HP out (front panel) */ 5947 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, 5948 /* route front PCM to HP */ 5949 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01 }, 5950 /* port-F for mic-in (front panel) with vref */ 5951 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 5952 /* port-G for CLFE (rear panel) */ 5953 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 5954 /* port-H for side (rear panel) */ 5955 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 5956 /* CD-in */ 5957 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 5958 /* route front mic to ADC1*/ 5959 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 5960 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5961 /* Unmute DAC0~3 & spdif out*/ 5962 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5963 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5964 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5965 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5966 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 5967 5968 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 5969 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5970 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5971 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5972 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5973 5974 /* Unmute Stereo Mixer 15 */ 5975 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5976 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5977 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5978 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step 5979 5980 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5981 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5982 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5983 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5984 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5985 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5986 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 5987 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 5988 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) 5989 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 5990 {0} 5991 }; 7036 /* 7037 * Unmute ADC0 and set the default input to mic-in 7038 */ 7039 /* port-A for surround (rear panel) */ 7040 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 7041 /* port-B for mic-in (rear panel) with vref */ 7042 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 7043 /* port-C for line-in (rear panel) */ 7044 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 7045 /* port-D for Front */ 7046 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 7047 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, 7048 /* port-E for HP out (front panel) */ 7049 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, 7050 /* route front PCM to HP */ 7051 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, 7052 /* port-F for mic-in (front panel) with vref */ 7053 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 7054 /* port-G for CLFE (rear panel) */ 7055 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 7056 /* port-H for side (rear panel) */ 7057 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 7058 /* CD-in */ 7059 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 7060 /* route front mic to ADC1*/ 7061 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 7062 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7063 /* Unmute DAC0~3 & spdif out*/ 7064 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7065 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7066 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7067 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7068 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7069 7070 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 7071 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7072 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7073 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7074 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7075 7076 /* Unmute Stereo Mixer 15 */ 7077 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7078 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7079 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7080 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step 7081 7082 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7083 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7084 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7085 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7086 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7087 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7088 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7089 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7090 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) 7091 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7092 {0} 7093 }; 7094 7095 static struct hda_verb alc861_uniwill_m31_init_verbs[] = { 7096 /* 7097 * Unmute ADC0 and set the default input to mic-in 7098 */ 7099 /* port-A for surround (rear panel) */ 7100 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 7101 /* port-B for mic-in (rear panel) with vref */ 7102 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 7103 /* port-C for line-in (rear panel) */ 7104 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 7105 /* port-D for Front */ 7106 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 7107 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, 7108 /* port-E for HP out (front panel) */ 7109 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, // this has to be set to VREF80 7110 /* route front PCM to HP */ 7111 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, 7112 /* port-F for mic-in (front panel) with vref */ 7113 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 7114 /* port-G for CLFE (rear panel) */ 7115 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 7116 /* port-H for side (rear panel) */ 7117 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 }, 7118 /* CD-in */ 7119 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 7120 /* route front mic to ADC1*/ 7121 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 7122 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7123 /* Unmute DAC0~3 & spdif out*/ 7124 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7125 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7126 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7127 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7128 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7129 7130 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 7131 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7132 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7133 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7134 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7135 7136 /* Unmute Stereo Mixer 15 */ 7137 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7138 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7139 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7140 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, //Output 0~12 step 7141 7142 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7143 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7144 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7145 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7146 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7147 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7148 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7149 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7150 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, // hp used DAC 3 (Front) 7151 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7152 {0} 7153 }; 7154 7155 static struct hda_verb alc861_asus_init_verbs[] = { 7156 /* 7157 * Unmute ADC0 and set the default input to mic-in 7158 */ 7159 /* port-A for surround (rear panel) | according to codec#0 this is the HP jack*/ 7160 { 0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0 }, /* was 0x00 */ 7161 /* route front PCM to HP */ 7162 { 0x0e, AC_VERB_SET_CONNECT_SEL, 0x01 }, 7163 /* port-B for mic-in (rear panel) with vref */ 7164 { 0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 7165 /* port-C for line-in (rear panel) */ 7166 { 0x0c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 7167 /* port-D for Front */ 7168 { 0x0b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 7169 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x00 }, 7170 /* port-E for HP out (front panel) */ 7171 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, /* this has to be set to VREF80 */ 7172 /* route front PCM to HP */ 7173 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, 7174 /* port-F for mic-in (front panel) with vref */ 7175 { 0x10, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24 }, 7176 /* port-G for CLFE (rear panel) */ 7177 { 0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 7178 /* port-H for side (rear panel) */ 7179 { 0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40 }, 7180 /* CD-in */ 7181 { 0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20 }, 7182 /* route front mic to ADC1*/ 7183 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 7184 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7185 /* Unmute DAC0~3 & spdif out*/ 7186 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7187 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7188 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7189 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7190 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7191 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 7192 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7193 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7194 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7195 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7196 7197 /* Unmute Stereo Mixer 15 */ 7198 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7199 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7200 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7201 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c }, /* Output 0~12 step */ 7202 7203 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7204 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7205 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7206 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7207 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7208 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7209 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7210 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7211 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, /* hp used DAC 3 (Front) */ 7212 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7213 {0} 7214 }; 7215 7216 /* additional init verbs for ASUS laptops */ 7217 static struct hda_verb alc861_asus_laptop_init_verbs[] = { 7218 { 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x45 }, /* HP-out */ 7219 { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2) }, /* mute line-in */ 7220 {0} 7221 }; 7222 5992 7223 /* 5993 7224 * generic initialization of ADC, input mixers and output mixers 5994 7225 */ 5995 7226 static struct hda_verb alc861_auto_init_verbs[] = { 5996 /* 5997 * Unmute ADC0 and set the default input to mic-in 5998 */ 5999 // {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 6000 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6001 6002 /* Unmute DAC0~3 & spdif out*/ 6003 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 6004 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 6005 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 6006 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 6007 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 6008 6009 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 6010 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6011 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6012 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6013 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6014 6015 /* Unmute Stereo Mixer 15 */ 6016 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6017 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6018 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 6019 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, 6020 6021 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6022 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6023 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6024 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6025 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6026 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6027 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 6028 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 6029 6030 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 6031 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 6032 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 6033 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 6034 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 6035 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 6036 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 6037 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 6038 6039 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, // set Mic 1 6040 6041 {0} 6042 }; 7227 /* 7228 * Unmute ADC0 and set the default input to mic-in 7229 */ 7230 // {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, 7231 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7232 7233 /* Unmute DAC0~3 & spdif out*/ 7234 {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7235 {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7236 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7237 {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7238 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7239 7240 /* Unmute Mixer 14 (mic) 1c (Line in)*/ 7241 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7242 {0x014, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7243 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7244 {0x01c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7245 7246 /* Unmute Stereo Mixer 15 */ 7247 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7248 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7249 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7250 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0xb00c}, 7251 7252 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7253 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7254 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7255 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7256 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7257 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7258 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 7259 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, 7260 7261 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7262 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 7263 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7264 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 7265 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, 7266 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, 7267 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, 7268 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, 7269 7270 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, // set Mic 1 7271 7272 {0} 7273 }; 7274 7275 static struct hda_verb alc861_toshiba_init_verbs[] = { 7276 {0x0f, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, 7277 7278 {0} 7279 }; 7280 7281 /* toggle speaker-output according to the hp-jack state */ 7282 static void alc861_toshiba_automute(struct hda_codec *codec) 7283 { 7284 unsigned int present; 7285 7286 present = snd_hda_codec_read(codec, 0x0f, 0, 7287 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 7288 snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, 7289 0x80, present ? 0x80 : 0); 7290 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, 7291 0x80, present ? 0x80 : 0); 7292 snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3, 7293 0x80, present ? 0 : 0x80); 7294 snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3, 7295 0x80, present ? 0 : 0x80); 7296 } 7297 7298 static void alc861_toshiba_unsol_event(struct hda_codec *codec, 7299 unsigned int res) 7300 { 7301 /* Looks like the unsol event is incompatible with the standard 7302 * definition. 6bit tag is placed at 26 bit! 7303 */ 7304 if ((res >> 26) == ALC880_HP_EVENT) 7305 alc861_toshiba_automute(codec); 7306 } 6043 7307 6044 7308 /* pcm configuration: identiacal with ALC880 */ … … 6052 7316 6053 7317 static struct hda_channel_mode alc861_8ch_modes[1] = { 6054 7318 { 8, NULL } 6055 7319 }; 6056 7320 6057 7321 static hda_nid_t alc861_dac_nids[4] = { 6058 6059 7322 /* front, surround, clfe, side */ 7323 0x03, 0x06, 0x05, 0x04 6060 7324 }; 6061 7325 6062 7326 static hda_nid_t alc660_dac_nids[3] = { 6063 6064 7327 /* front, clfe, surround */ 7328 0x03, 0x05, 0x06 6065 7329 }; 6066 7330 6067 7331 static hda_nid_t alc861_adc_nids[1] = { 6068 6069 7332 /* ADC0-2 */ 7333 0x08, 6070 7334 }; 6071 7335 6072 7336 static struct hda_input_mux alc861_capture_source = { 6073 6074 6075 6076 6077 6078 6079 6080 7337 .num_items = 5, 7338 .items = { 7339 { "Mic", 0x0 }, 7340 { "Front Mic", 0x3 }, 7341 { "Line", 0x1 }, 7342 { "CD", 0x4 }, 7343 { "Mixer", 0x5 }, 7344 }, 6081 7345 }; 6082 7346 … … 6084 7348 static int alc861_auto_fill_dac_nids(struct alc_spec *spec, const struct auto_pin_cfg *cfg) 6085 7349 { 6086 6087 6088 6089 6090 6091 6092 6093 6094 6095 6096 6097 6098 6099 7350 int i; 7351 hda_nid_t nid; 7352 7353 spec->multiout.dac_nids = spec->private_dac_nids; 7354 for (i = 0; i < cfg->line_outs; i++) { 7355 nid = cfg->line_out_pins[i]; 7356 if (nid) { 7357 if (i >= ARRAY_SIZE(alc861_dac_nids)) 7358 continue; 7359 spec->multiout.dac_nids[i] = alc861_dac_nids[i]; 7360 } 7361 } 7362 spec->multiout.num_dacs = cfg->line_outs; 7363 return 0; 6100 7364 } 6101 7365 6102 7366 /* add playback controls from the parsed DAC table */ 6103 7367 static int alc861_auto_create_multi_out_ctls(struct alc_spec *spec, 6104 6105 { 6106 6107 6108 6109 6110 6111 6112 6113 6114 6115 6116 6117 6118 6119 6120 6121 6122 6123 6124 6125 6126 6127 6128 6129 6130 6131 6132 6133 7368 const struct auto_pin_cfg *cfg) 7369 { 7370 char name[32]; 7371 static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; 7372 hda_nid_t nid; 7373 int i, idx, err; 7374 7375 for (i = 0; i < cfg->line_outs; i++) { 7376 nid = spec->multiout.dac_nids[i]; 7377 if (! nid) 7378 continue; 7379 if (nid == 0x05) { 7380 /* Center/LFE */ 7381 if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "Center Playback Switch", 7382 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) 7383 return err; 7384 if ((err = add_control(spec, ALC_CTL_BIND_MUTE, "LFE Playback Switch", 7385 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) 7386 return err; 7387 } else { 7388 for (idx = 0; idx < ARRAY_SIZE(alc861_dac_nids) - 1; idx++) 7389 if (nid == alc861_dac_nids[idx]) 7390 break; 7391 sprintf(name, "%s Playback Switch", chname[idx]); 7392 if ((err = add_control(spec, ALC_CTL_BIND_MUTE, name, 7393 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 7394 return err; 7395 } 7396 } 7397 return 0; 6134 7398 } 6135 7399 6136 7400 static int alc861_auto_create_hp_ctls(struct alc_spec *spec, hda_nid_t pin) 6137 7401 { 6138 6139 6140 6141 6142 6143 6144 6145 6146 6147 6148 6149 6150 6151 7402 int err; 7403 hda_nid_t nid; 7404 7405 if (! pin) 7406 return 0; 7407 7408 if ((pin >= 0x0b && pin <= 0x10) || pin == 0x1f || pin == 0x20) { 7409 nid = 0x03; 7410 if ((err = add_control(spec, ALC_CTL_WIDGET_MUTE, "Headphone Playback Switch", 7411 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 7412 return err; 7413 spec->multiout.hp_nid = nid; 7414 } 7415 return 0; 6152 7416 } 6153 7417 … … 6155 7419 static int alc861_auto_create_analog_input_ctls(struct alc_spec *spec, const struct auto_pin_cfg *cfg) 6156 7420 { 6157 6158 6159 6160 6161 6162 6163 6164 6165 6166 6167 6168 6169 6170 6171 6172 idx = 1; // Mic In 6173 6174 case 0x10: 6175 6176 idx = 1; // Mic In 6177 6178 6179 6180 6181 6182 6183 6184 6185 6186 6187 6188 6189 6190 6191 6192 6193 imux->num_items++; 6194 6195 7421 struct hda_input_mux *imux = &spec->private_imux; 7422 int i, err, idx, idx1; 7423 7424 for (i = 0; i < AUTO_PIN_LAST; i++) { 7425 switch(cfg->input_pins[i]) { 7426 case 0x0c: 7427 idx1 = 1; 7428 idx = 2; // Line In 7429 break; 7430 case 0x0f: 7431 idx1 = 2; 7432 idx = 2; // Line In 7433 break; 7434 case 0x0d: 7435 idx1 = 0; 7436 idx = 1; // Mic In 7437 break; 7438 case 0x10: 7439 idx1 = 3; 7440 idx = 1; // Mic In 7441 break; 7442 case 0x11: 7443 idx1 = 4; 7444 idx = 0; // CD 7445 break; 7446 default: 7447 continue; 7448 } 7449 7450 err = new_analog_input(spec, cfg->input_pins[i], 7451 auto_pin_cfg_labels[i], idx, 0x15); 7452 if (err < 0) 7453 return err; 7454 7455 imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; 7456 imux->items[imux->num_items].index = idx1; 7457 imux->num_items++; 7458 } 7459 return 0; 6196 7460 } 6197 7461 6198 7462 static struct snd_kcontrol_new alc861_capture_mixer[] = { 6199 6200 6201 6202 6203 6204 6205 6206 6207 6208 6209 6210 6211 6212 6213 6214 6215 7463 HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), 7464 HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), 7465 7466 { 7467 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 7468 /* The multiple "Capture Source" controls confuse alsamixer 7469 * So call somewhat different.. 7470 *FIXME: the controls appear in the "playback" view! 7471 */ 7472 /* .name = "Capture Source", */ 7473 .name = "Input Source", 7474 .count = 1, 7475 .info = alc_mux_enum_info, 7476 .get = alc_mux_enum_get, 7477 .put = alc_mux_enum_put, 7478 }, 7479 {0} /* end */ 6216 7480 }; 6217 7481 6218 7482 static void alc861_auto_set_output_and_unmute(struct hda_codec *codec, hda_nid_t nid, 6219 6220 { 6221 6222 6223 6224 7483 int pin_type, int dac_idx) 7484 { 7485 /* set as output */ 7486 7487 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_type); 7488 snd_hda_codec_write(codec, dac_idx, 0, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 6225 7489 6226 7490 } … … 6228 7492 static void alc861_auto_init_multi_out(struct hda_codec *codec) 6229 7493 { 6230 6231 6232 6233 6234 6235 6236 6237 7494 struct alc_spec *spec = codec->spec; 7495 int i; 7496 7497 for (i = 0; i < spec->autocfg.line_outs; i++) { 7498 hda_nid_t nid = spec->autocfg.line_out_pins[i]; 7499 if (nid) 7500 alc861_auto_set_output_and_unmute(codec, nid, PIN_OUT, spec->multiout.dac_nids[i]); 7501 } 6238 7502 } 6239 7503 6240 7504 static void alc861_auto_init_hp_out(struct hda_codec *codec) 6241 7505 { 6242 6243 6244 6245 pin = spec->autocfg.hp_pin;6246 6247 7506 struct alc_spec *spec = codec->spec; 7507 hda_nid_t pin; 7508 7509 pin = spec->autocfg.hp_pins[0]; 7510 if (pin) /* connect to front */ 7511 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, spec->multiout.dac_nids[0]); 6248 7512 } 6249 7513 6250 7514 static void alc861_auto_init_analog_input(struct hda_codec *codec) 6251 7515 { 6252 6253 6254 6255 6256 6257 6258 6259 6260 6261 7516 struct alc_spec *spec = codec->spec; 7517 int i; 7518 7519 for (i = 0; i < AUTO_PIN_LAST; i++) { 7520 hda_nid_t nid = spec->autocfg.input_pins[i]; 7521 if ((nid>=0x0c) && (nid <=0x11)) { 7522 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PIN_WIDGET_CONTROL, 7523 i <= AUTO_PIN_FRONT_MIC ? PIN_VREF80 : PIN_IN); 7524 } 7525 } 6262 7526 } 6263 7527 … … 6266 7530 static int alc861_parse_auto_config(struct hda_codec *codec) 6267 7531 { 6268 struct alc_spec *spec = codec->spec; 6269 int err; 6270 static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; 6271 6272 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 6273 alc861_ignore)) < 0) 6274 return err; 6275 if (! spec->autocfg.line_outs) 6276 return 0; /* can't find valid BIOS pin config */ 6277 6278 if ((err = alc861_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || 6279 (err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 6280 (err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pin)) < 0 || 6281 (err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 6282 return err; 6283 6284 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 6285 6286 if (spec->autocfg.dig_out_pin) 6287 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; 6288 6289 if (spec->kctl_alloc) 6290 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 6291 6292 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; 6293 6294 spec->input_mux = &spec->private_imux; 6295 6296 spec->adc_nids = alc861_adc_nids; 6297 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); 6298 spec->mixers[spec->num_mixers] = alc861_capture_mixer; 6299 spec->num_mixers++; 6300 6301 return 1; 7532 struct alc_spec *spec = codec->spec; 7533 int err; 7534 static hda_nid_t alc861_ignore[] = { 0x1d, 0 }; 7535 7536 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, 7537 alc861_ignore)) < 0) 7538 return err; 7539 if (! spec->autocfg.line_outs) 7540 return 0; /* can't find valid BIOS pin config */ 7541 7542 if ((err = alc861_auto_fill_dac_nids(spec, &spec->autocfg)) < 0 || 7543 (err = alc861_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || 7544 (err = alc861_auto_create_hp_ctls(spec, spec->autocfg.hp_pins[0])) < 0 || 7545 (err = alc861_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0) 7546 return err; 7547 7548 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 7549 7550 if (spec->autocfg.dig_out_pin) 7551 spec->multiout.dig_out_nid = ALC861_DIGOUT_NID; 7552 7553 if (spec->kctl_alloc) 7554 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 7555 7556 spec->init_verbs[spec->num_init_verbs++] = alc861_auto_init_verbs; 7557 7558 spec->num_mux_defs = 1; 7559 spec->input_mux = &spec->private_imux; 7560 7561 spec->adc_nids = alc861_adc_nids; 7562 spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids); 7563 spec->mixers[spec->num_mixers] = alc861_capture_mixer; 7564 spec->num_mixers++; 7565 7566 return 1; 6302 7567 } 6303 7568 … … 6305 7570 static void alc861_auto_init(struct hda_codec *codec) 6306 7571 { 6307 alc861_auto_init_multi_out(codec); 6308 alc861_auto_init_hp_out(codec); 6309 alc861_auto_init_analog_input(codec); 6310 7572 alc861_auto_init_multi_out(codec); 7573 alc861_auto_init_hp_out(codec); 7574 alc861_auto_init_analog_input(codec); 6311 7575 } 6312 7576 … … 6315 7579 * configuration and preset 6316 7580 */ 6317 static struct hda_board_config alc861_cfg_tbl[] = { 6318 { .modelname = "3stack", .config = ALC861_3ST }, 6319 { .pci_subvendor = 0x8086, .pci_subdevice = 0xd600, 6320 .config = ALC861_3ST }, 6321 { .pci_subvendor = 0x1043, .pci_subdevice = 0x81e7, 6322 .config = ALC660_3ST }, 6323 { .modelname = "3stack-dig", .config = ALC861_3ST_DIG }, 6324 { .modelname = "6stack-dig", .config = ALC861_6ST_DIG }, 6325 { .modelname = "auto", .config = ALC861_AUTO }, 6326 {0} 7581 static const char *alc861_models[ALC861_MODEL_LAST] = { 7582 [ALC861_3ST] = "3stack", 7583 [ALC660_3ST] = "3stack-660", 7584 [ALC861_3ST_DIG] = "3stack-dig", 7585 [ALC861_6ST_DIG] = "6stack-dig", 7586 [ALC861_UNIWILL_M31] = "uniwill-m31", 7587 [ALC861_TOSHIBA] = "toshiba", 7588 [ALC861_ASUS] = "asus", 7589 [ALC861_ASUS_LAPTOP] = "asus-laptop", 7590 [ALC861_AUTO] = "auto", 7591 }; 7592 7593 static struct snd_pci_quirk alc861_cfg_tbl[] = { 7594 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC861_3ST), 7595 SND_PCI_QUIRK(0x1043, 0x1335, "ASUS F2/3", ALC861_ASUS_LAPTOP), 7596 SND_PCI_QUIRK(0x1043, 0x1338, "ASUS F2/3", ALC861_ASUS_LAPTOP), 7597 SND_PCI_QUIRK(0x1043, 0x1393, "ASUS", ALC861_ASUS), 7598 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660_3ST), 7599 SND_PCI_QUIRK(0x1179, 0xff00, "Toshiba", ALC861_TOSHIBA), 7600 SND_PCI_QUIRK(0x1179, 0xff10, "Toshiba", ALC861_TOSHIBA), 7601 SND_PCI_QUIRK(0x1584, 0x9072, "Uniwill m31", ALC861_UNIWILL_M31), 7602 SND_PCI_QUIRK(0x8086, 0xd600, "Intel", ALC861_3ST), 7603 {0} 6327 7604 }; 6328 7605 6329 7606 static struct alc_config_preset alc861_presets[] = { 6330 [ALC861_3ST] = { 6331 .mixers = { alc861_3ST_mixer }, 6332 .init_verbs = { alc861_threestack_init_verbs }, 6333 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 6334 .dac_nids = alc861_dac_nids, 6335 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), 6336 .channel_mode = alc861_threestack_modes, 6337 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 6338 .adc_nids = alc861_adc_nids, 6339 .input_mux = &alc861_capture_source, 6340 }, 6341 [ALC861_3ST_DIG] = { 6342 .mixers = { alc861_base_mixer }, 6343 .init_verbs = { alc861_threestack_init_verbs }, 6344 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 6345 .dac_nids = alc861_dac_nids, 6346 .dig_out_nid = ALC861_DIGOUT_NID, 6347 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), 6348 .channel_mode = alc861_threestack_modes, 6349 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 6350 .adc_nids = alc861_adc_nids, 6351 .input_mux = &alc861_capture_source, 6352 }, 6353 [ALC861_6ST_DIG] = { 6354 .mixers = { alc861_base_mixer }, 6355 .init_verbs = { alc861_base_init_verbs }, 6356 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 6357 .dac_nids = alc861_dac_nids, 6358 .dig_out_nid = ALC861_DIGOUT_NID, 6359 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), 6360 .channel_mode = alc861_8ch_modes, 6361 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 6362 .adc_nids = alc861_adc_nids, 6363 .input_mux = &alc861_capture_source, 6364 }, 6365 [ALC660_3ST] = { 6366 .mixers = { alc861_3ST_mixer }, 6367 .init_verbs = { alc861_threestack_init_verbs }, 6368 .num_dacs = ARRAY_SIZE(alc660_dac_nids), 6369 .dac_nids = alc660_dac_nids, 6370 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), 6371 .channel_mode = alc861_threestack_modes, 6372 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 6373 .adc_nids = alc861_adc_nids, 6374 .input_mux = &alc861_capture_source, 6375 }, 7607 [ALC861_3ST] = { 7608 .mixers = { alc861_3ST_mixer }, 7609 .init_verbs = { alc861_threestack_init_verbs }, 7610 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 7611 .dac_nids = alc861_dac_nids, 7612 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), 7613 .channel_mode = alc861_threestack_modes, 7614 .need_dac_fix = 1, 7615 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 7616 .adc_nids = alc861_adc_nids, 7617 .input_mux = &alc861_capture_source, 7618 }, 7619 [ALC861_3ST_DIG] = { 7620 .mixers = { alc861_base_mixer }, 7621 .init_verbs = { alc861_threestack_init_verbs }, 7622 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 7623 .dac_nids = alc861_dac_nids, 7624 .dig_out_nid = ALC861_DIGOUT_NID, 7625 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), 7626 .channel_mode = alc861_threestack_modes, 7627 .need_dac_fix = 1, 7628 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 7629 .adc_nids = alc861_adc_nids, 7630 .input_mux = &alc861_capture_source, 7631 }, 7632 [ALC861_6ST_DIG] = { 7633 .mixers = { alc861_base_mixer }, 7634 .init_verbs = { alc861_base_init_verbs }, 7635 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 7636 .dac_nids = alc861_dac_nids, 7637 .dig_out_nid = ALC861_DIGOUT_NID, 7638 .num_channel_mode = ARRAY_SIZE(alc861_8ch_modes), 7639 .channel_mode = alc861_8ch_modes, 7640 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 7641 .adc_nids = alc861_adc_nids, 7642 .input_mux = &alc861_capture_source, 7643 }, 7644 [ALC660_3ST] = { 7645 .mixers = { alc861_3ST_mixer }, 7646 .init_verbs = { alc861_threestack_init_verbs }, 7647 .num_dacs = ARRAY_SIZE(alc660_dac_nids), 7648 .dac_nids = alc660_dac_nids, 7649 .num_channel_mode = ARRAY_SIZE(alc861_threestack_modes), 7650 .channel_mode = alc861_threestack_modes, 7651 .need_dac_fix = 1, 7652 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 7653 .adc_nids = alc861_adc_nids, 7654 .input_mux = &alc861_capture_source, 7655 }, 7656 [ALC861_UNIWILL_M31] = { 7657 .mixers = { alc861_uniwill_m31_mixer }, 7658 .init_verbs = { alc861_uniwill_m31_init_verbs }, 7659 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 7660 .dac_nids = alc861_dac_nids, 7661 .dig_out_nid = ALC861_DIGOUT_NID, 7662 .num_channel_mode = ARRAY_SIZE(alc861_uniwill_m31_modes), 7663 .channel_mode = alc861_uniwill_m31_modes, 7664 .need_dac_fix = 1, 7665 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 7666 .adc_nids = alc861_adc_nids, 7667 .input_mux = &alc861_capture_source, 7668 }, 7669 [ALC861_TOSHIBA] = { 7670 .mixers = { alc861_toshiba_mixer }, 7671 .init_verbs = { alc861_base_init_verbs, alc861_toshiba_init_verbs }, 7672 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 7673 .dac_nids = alc861_dac_nids, 7674 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7675 .channel_mode = alc883_3ST_2ch_modes, 7676 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 7677 .adc_nids = alc861_adc_nids, 7678 .input_mux = &alc861_capture_source, 7679 .unsol_event = alc861_toshiba_unsol_event, 7680 .init_hook = alc861_toshiba_automute, 7681 }, 7682 [ALC861_ASUS] = { 7683 .mixers = { alc861_asus_mixer }, 7684 .init_verbs = { alc861_asus_init_verbs }, 7685 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 7686 .dac_nids = alc861_dac_nids, 7687 .dig_out_nid = ALC861_DIGOUT_NID, 7688 .num_channel_mode = ARRAY_SIZE(alc861_asus_modes), 7689 .channel_mode = alc861_asus_modes, 7690 .need_dac_fix = 1, 7691 .hp_nid = 0x06, 7692 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 7693 .adc_nids = alc861_adc_nids, 7694 .input_mux = &alc861_capture_source, 7695 }, 7696 [ALC861_ASUS_LAPTOP] = { 7697 .mixers = { alc861_toshiba_mixer, alc861_asus_laptop_mixer }, 7698 .init_verbs = { alc861_asus_init_verbs, 7699 alc861_asus_laptop_init_verbs }, 7700 .num_dacs = ARRAY_SIZE(alc861_dac_nids), 7701 .dac_nids = alc861_dac_nids, 7702 .dig_out_nid = ALC861_DIGOUT_NID, 7703 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes), 7704 .channel_mode = alc883_3ST_2ch_modes, 7705 .need_dac_fix = 1, 7706 .num_adc_nids = ARRAY_SIZE(alc861_adc_nids), 7707 .adc_nids = alc861_adc_nids, 7708 .input_mux = &alc861_capture_source, 7709 }, 6376 7710 }; 6377 7711 … … 6379 7713 static int patch_alc861(struct hda_codec *codec) 6380 7714 { 6381 struct alc_spec *spec; 6382 int board_config; 6383 int err; 6384 6385 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 6386 if (spec == NULL) 6387 return -ENOMEM; 6388 6389 codec->spec = spec; 6390 6391 board_config = snd_hda_check_board_config(codec, alc861_cfg_tbl); 6392 if (board_config < 0 || board_config >= ALC861_MODEL_LAST) { 6393 printk(KERN_INFO "hda_codec: Unknown model for ALC861, trying auto-probe from BIOS...\n"); 6394 board_config = ALC861_AUTO; 6395 } 6396 6397 if (board_config == ALC861_AUTO) { 6398 /* automatic parse from the BIOS config */ 6399 err = alc861_parse_auto_config(codec); 6400 if (err < 0) { 6401 alc_free(codec); 6402 return err; 6403 } else if (! err) { 6404 printk(KERN_INFO "hda_codec: Cannot set up configuration from BIOS. Using base mode...\n"); 6405 board_config = ALC861_3ST_DIG; 6406 } 6407 } 6408 6409 if (board_config != ALC861_AUTO) 6410 setup_preset(spec, &alc861_presets[board_config]); 6411 6412 spec->stream_name_analog = "ALC861 Analog"; 6413 spec->stream_analog_playback = &alc861_pcm_analog_playback; 6414 spec->stream_analog_capture = &alc861_pcm_analog_capture; 6415 6416 spec->stream_name_digital = "ALC861 Digital"; 6417 spec->stream_digital_playback = &alc861_pcm_digital_playback; 6418 spec->stream_digital_capture = &alc861_pcm_digital_capture; 6419 6420 codec->patch_ops = alc_patch_ops; 6421 if (board_config == ALC861_AUTO) 6422 spec->init_hook = alc861_auto_init; 6423 6424 return 0; 7715 struct alc_spec *spec; 7716 int board_config; 7717 int err; 7718 7719 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 7720 if (spec == NULL) 7721 return -ENOMEM; 7722 7723 codec->spec = spec; 7724 7725 board_config = snd_hda_check_board_config(codec, ALC861_MODEL_LAST, 7726 alc861_models, 7727 alc861_cfg_tbl); 7728 7729 if (board_config < 0) { 7730 printk(KERN_INFO "hda_codec: Unknown model for ALC861, " 7731 "trying auto-probe from BIOS...\n"); 7732 board_config = ALC861_AUTO; 7733 } 7734 7735 if (board_config == ALC861_AUTO) { 7736 /* automatic parse from the BIOS config */ 7737 err = alc861_parse_auto_config(codec); 7738 if (err < 0) { 7739 alc_free(codec); 7740 return err; 7741 } else if (! err) { 7742 printk(KERN_INFO 7743 "hda_codec: Cannot set up configuration " 7744 "from BIOS. Using base mode...\n"); 7745 board_config = ALC861_3ST_DIG; 7746 } 7747 } 7748 7749 if (board_config != ALC861_AUTO) 7750 setup_preset(spec, &alc861_presets[board_config]); 7751 7752 spec->stream_name_analog = "ALC861 Analog"; 7753 spec->stream_analog_playback = &alc861_pcm_analog_playback; 7754 spec->stream_analog_capture = &alc861_pcm_analog_capture; 7755 7756 spec->stream_name_digital = "ALC861 Digital"; 7757 spec->stream_digital_playback = &alc861_pcm_digital_playback; 7758 spec->stream_digital_capture = &alc861_pcm_digital_capture; 7759 7760 codec->patch_ops = alc_patch_ops; 7761 if (board_config == ALC861_AUTO) 7762 spec->init_hook = alc861_auto_init; 7763 7764 return 0; 6425 7765 } 6426 7766 … … 6429 7769 */ 6430 7770 struct hda_codec_preset snd_hda_preset_realtek[] = { 6431 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, 6432 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, 6433 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 6434 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 6435 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, 6436 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 6437 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, 6438 { .id = 0x10ec0861, .rev = 0x100300, .name = "ALC861", 6439 .patch = patch_alc861 }, 6440 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 6441 .patch = patch_alc861 }, 6442 {0} /* terminator */ 6443 }; 7771 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, 7772 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, 7773 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 7774 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 }, 7775 { .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc883 }, 7776 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 7777 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, 7778 { .id = 0x10ec0861, .rev = 0x100300, .name = "ALC861", 7779 .patch = patch_alc861 }, 7780 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 7781 .patch = patch_alc861 }, 7782 { .id = 0x10ec0660, .name = "ALC660", .patch = patch_alc861 }, 7783 {0} /* terminator */ 7784 }; -
GPL/trunk/alsa-kernel/pci/hda/patch_sigmatel.c
r77 r86 37 37 #define NUM_CONTROL_ALLOC 32 38 38 #define STAC_HP_EVENT 0x37 39 #define STAC_UNSOL_ENABLE (AC_USRSP_EN | STAC_HP_EVENT) 40 41 #define STAC_REF 0 42 #define STAC_D945GTP3 1 43 #define STAC_D945GTP5 2 44 #define STAC_MACMINI 3 45 #define STAC_D965_2112 4 46 #define STAC_D965_284B 5 47 #define STAC_922X_MODELS 6 /* number of 922x models */ 39 40 #define PCI_VENDOR_ID_DELL 0x1028 41 42 enum { 43 STAC_REF, 44 STAC_9200_MODELS 45 }; 46 47 enum { 48 STAC_9205_REF, 49 STAC_9205_MODELS 50 }; 51 52 enum { 53 STAC_D945_REF, 54 STAC_D945GTP3, 55 STAC_D945GTP5, 56 STAC_MACMINI, 57 STAC_922X_MODELS 58 }; 59 60 enum { 61 STAC_D965_REF, 62 STAC_D965_3ST, 63 STAC_D965_5ST, 64 STAC_927X_MODELS 65 }; 48 66 49 67 struct sigmatel_spec { … … 54 72 unsigned int surr_switch: 1; 55 73 unsigned int line_switch: 1; 56 57 58 59 74 unsigned int mic_switch: 1; 75 unsigned int alt_switch: 1; 76 unsigned int hp_detect: 1; 77 unsigned int gpio_mute: 1; 60 78 61 79 /* playback */ 62 63 80 struct hda_multi_out multiout; 81 hda_nid_t dac_nids[5]; 64 82 65 83 /* capture */ … … 68 86 hda_nid_t *mux_nids; 69 87 unsigned int num_muxes; 88 hda_nid_t *dmic_nids; 89 unsigned int num_dmics; 90 hda_nid_t dmux_nid; 70 91 hda_nid_t dig_in_nid; 71 92 … … 74 95 unsigned int num_pins; 75 96 unsigned int *pin_configs; 97 unsigned int *bios_pin_configs; 76 98 77 99 /* codec specific stuff */ … … 80 102 81 103 /* capture source */ 82 struct hda_input_mux *input_mux; 83 unsigned int cur_mux[3]; 104 struct hda_input_mux *dinput_mux; 105 unsigned int cur_dmux; 106 struct hda_input_mux *input_mux; 107 unsigned int cur_mux[3]; 84 108 85 109 /* i/o switches */ … … 92 116 unsigned int num_kctl_alloc, num_kctl_used; 93 117 struct snd_kcontrol_new *kctl_alloc; 118 struct hda_input_mux private_dimux; 94 119 struct hda_input_mux private_imux; 95 120 }; … … 111 136 }; 112 137 113 static hda_nid_t stac9227_adc_nids[2] = {114 0x07, 0x08,115 };116 117 #if 0118 static hda_nid_t d965_2112_dac_nids[3] = {119 0x02, 0x03, 0x05,120 };121 #endif122 123 138 static hda_nid_t stac922x_mux_nids[2] = { 124 0x12, 0x13, 125 }; 126 127 static hda_nid_t stac9227_mux_nids[2] = { 128 0x15, 0x16, 139 0x12, 0x13, 129 140 }; 130 141 131 142 static hda_nid_t stac927x_adc_nids[3] = { 132 0x07, 0x08, 0x09143 0x07, 0x08, 0x09 133 144 }; 134 145 135 146 static hda_nid_t stac927x_mux_nids[3] = { 136 0x15, 0x16, 0x17 147 0x15, 0x16, 0x17 148 }; 149 150 static hda_nid_t stac9205_adc_nids[2] = { 151 0x12, 0x13 152 }; 153 154 static hda_nid_t stac9205_mux_nids[2] = { 155 0x19, 0x1a 156 }; 157 158 static hda_nid_t stac9205_dmic_nids[3] = { 159 0x17, 0x18, 0 137 160 }; 138 161 139 162 static hda_nid_t stac9200_pin_nids[8] = { 140 0x08, 0x09, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 163 0x08, 0x09, 0x0d, 0x0e, 164 0x0f, 0x10, 0x11, 0x12, 141 165 }; 142 166 … … 147 171 148 172 static hda_nid_t stac927x_pin_nids[14] = { 149 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 150 0x0f, 0x10, 0x11, 0x12, 0x13, 151 0x14, 0x21, 0x22, 0x23, 152 }; 173 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 174 0x0f, 0x10, 0x11, 0x12, 0x13, 175 0x14, 0x21, 0x22, 0x23, 176 }; 177 178 static hda_nid_t stac9205_pin_nids[12] = { 179 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 180 0x0f, 0x14, 0x16, 0x17, 0x18, 181 0x21, 0x22, 182 183 }; 184 185 static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, 186 struct snd_ctl_elem_info *uinfo) 187 { 188 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 189 struct sigmatel_spec *spec = codec->spec; 190 return snd_hda_input_mux_info(spec->dinput_mux, uinfo); 191 } 192 193 static int stac92xx_dmux_enum_get(struct snd_kcontrol *kcontrol, 194 struct snd_ctl_elem_value *ucontrol) 195 { 196 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 197 struct sigmatel_spec *spec = codec->spec; 198 199 ucontrol->value.enumerated.item[0] = spec->cur_dmux; 200 return 0; 201 } 202 203 static int stac92xx_dmux_enum_put(struct snd_kcontrol *kcontrol, 204 struct snd_ctl_elem_value *ucontrol) 205 { 206 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 207 struct sigmatel_spec *spec = codec->spec; 208 209 return snd_hda_input_mux_put(codec, spec->dinput_mux, ucontrol, 210 spec->dmux_nid, &spec->cur_dmux); 211 } 153 212 154 213 static int stac92xx_mux_enum_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) … … 186 245 187 246 static struct hda_verb stac922x_core_init[] = { 188 /* set master volume and direct control */ 189 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 190 {0} 191 }; 192 193 static struct hda_verb stac9227_core_init[] = { 194 /* set master volume and direct control */ 247 /* set master volume and direct control */ 195 248 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 249 {0} 250 }; 251 252 static struct hda_verb d965_core_init[] = { 253 /* set master volume and direct control */ 254 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 196 255 /* unmute node 0x1b */ 197 256 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 198 {0} 199 }; 200 201 static struct hda_verb d965_2112_core_init[] = { 202 /* set master volume and direct control */ 203 { 0x16, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 204 /* unmute node 0x1b */ 205 { 0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000}, 206 /* select node 0x03 as DAC */ 257 /* select node 0x03 as DAC */ 207 258 { 0x0b, AC_VERB_SET_CONNECT_SEL, 0x01}, 208 259 {0} … … 210 261 211 262 static struct hda_verb stac927x_core_init[] = { 212 /* set master volume and direct control */ 213 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 214 {0} 263 /* set master volume and direct control */ 264 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 265 {0} 266 }; 267 268 static struct hda_verb stac9205_core_init[] = { 269 /* set master volume and direct control */ 270 { 0x24, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 271 {0} 215 272 }; 216 273 … … 263 320 }; 264 321 265 static snd_kcontrol_new_t stac927x_mixer[] = { 266 { 267 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 268 .name = "Input Source", 269 .count = 1, 270 .info = stac92xx_mux_enum_info, 271 .get = stac92xx_mux_enum_get, 272 .put = stac92xx_mux_enum_put, 273 }, 274 HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT), 275 HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT), 276 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1b, 0x0, HDA_OUTPUT), 277 {0} /* end */ 322 static struct snd_kcontrol_new stac927x_mixer[] = { 323 { 324 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 325 .name = "Input Source", 326 .count = 1, 327 .info = stac92xx_mux_enum_info, 328 .get = stac92xx_mux_enum_get, 329 .put = stac92xx_mux_enum_put, 330 }, 331 HDA_CODEC_VOLUME("InMux Capture Volume", 0x15, 0x0, HDA_OUTPUT), 332 HDA_CODEC_VOLUME("InVol Capture Volume", 0x18, 0x0, HDA_INPUT), 333 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1b, 0x0, HDA_OUTPUT), 334 {0} /* end */ 335 }; 336 337 static struct snd_kcontrol_new stac9205_mixer[] = { 338 { 339 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 340 .name = "Digital Input Source", 341 .count = 1, 342 .info = stac92xx_dmux_enum_info, 343 .get = stac92xx_dmux_enum_get, 344 .put = stac92xx_dmux_enum_put, 345 }, 346 { 347 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 348 .name = "Input Source", 349 .count = 1, 350 .info = stac92xx_mux_enum_info, 351 .get = stac92xx_mux_enum_get, 352 .put = stac92xx_mux_enum_put, 353 }, 354 HDA_CODEC_VOLUME("InMux Capture Volume", 0x19, 0x0, HDA_OUTPUT), 355 HDA_CODEC_VOLUME("InVol Capture Volume", 0x1b, 0x0, HDA_INPUT), 356 HDA_CODEC_MUTE("ADCMux Capture Switch", 0x1d, 0x0, HDA_OUTPUT), 357 {0} /* end */ 278 358 }; 279 359 … … 304 384 return err; 305 385 } 306 return 0; 386 return 0; 307 387 } 308 388 … … 312 392 }; 313 393 314 static unsigned int *stac9200_brd_tbl[] = { 315 ref9200_pin_configs, 316 }; 317 318 static struct hda_board_config stac9200_cfg_tbl[] = { 319 { .modelname = "ref", 320 .pci_subvendor = PCI_VENDOR_ID_INTEL, 321 .pci_subdevice = 0x2668, /* DFI LanParty */ 322 .config = STAC_REF }, 394 static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { 395 [STAC_REF] = ref9200_pin_configs, 396 }; 397 398 static const char *stac9200_models[STAC_9200_MODELS] = { 399 [STAC_REF] = "ref", 400 }; 401 402 static struct snd_pci_quirk stac9200_cfg_tbl[] = { 403 /* SigmaTel reference board */ 404 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 405 "DFI LanParty", STAC_REF), 406 /* Dell laptops have BIOS problem */ 407 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01b5, 408 "Dell Inspiron 630m", STAC_REF), 409 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01c2, 410 "Dell Latitude D620", STAC_REF), 411 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x01cb, 412 "Dell Latitude 120L", STAC_REF), 323 413 {0} /* terminator */ 324 414 }; … … 331 421 332 422 static unsigned int d945gtp3_pin_configs[10] = { 333 334 335 423 0x0221401f, 0x01a19022, 0x01813021, 0x01014010, 424 0x40000100, 0x40000100, 0x40000100, 0x40000100, 425 0x02a19120, 0x40000100, 336 426 }; 337 427 338 428 static unsigned int d945gtp5_pin_configs[10] = { 339 0x0221401f, 0x01011012, 0x01813024, 0x01014010, 340 0x01a19021, 0x01016011, 0x01452130, 0x40000100, 341 0x02a19320, 0x40000100, 342 }; 343 344 static unsigned int d965_2112_pin_configs[10] = { 345 0x0221401f, 0x40000100, 0x40000100, 0x01014011, 346 0x01a19021, 0x01813024, 0x01452130, 0x40000100, 429 0x0221401f, 0x01011012, 0x01813024, 0x01014010, 430 0x01a19021, 0x01016011, 0x01452130, 0x40000100, 347 431 0x02a19320, 0x40000100, 348 432 }; 349 433 350 434 static unsigned int *stac922x_brd_tbl[STAC_922X_MODELS] = { 351 [STAC_ REF] =ref922x_pin_configs,435 [STAC_D945_REF] = ref922x_pin_configs, 352 436 [STAC_D945GTP3] = d945gtp3_pin_configs, 353 437 [STAC_D945GTP5] = d945gtp5_pin_configs, 354 [STAC_D965_2112] = d965_2112_pin_configs, 355 }; 356 357 static struct hda_board_config stac922x_cfg_tbl[] = { 358 { .modelname = "ref", 359 .pci_subvendor = PCI_VENDOR_ID_INTEL, 360 .pci_subdevice = 0x2668, /* DFI LanParty */ 361 .config = STAC_REF }, /* SigmaTel reference board */ 362 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 363 .pci_subdevice = 0x0101, 364 .config = STAC_D945GTP3 }, /* Intel D945GTP - 3 Stack */ 365 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 366 .pci_subdevice = 0x0202, 367 .config = STAC_D945GTP3 }, /* Intel D945GNT - 3 Stack, 9221 A1 */ 368 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 369 .pci_subdevice = 0x0b0b, 370 .config = STAC_D945GTP3 }, /* Intel D945PSN - 3 Stack, 9221 A1 */ 371 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 372 .pci_subdevice = 0x0404, 373 .config = STAC_D945GTP5 }, /* Intel D945GTP - 5 Stack */ 374 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 375 .pci_subdevice = 0x0303, 376 .config = STAC_D945GTP5 }, /* Intel D945GNT - 5 Stack */ 377 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 378 .pci_subdevice = 0x0013, 379 .config = STAC_D945GTP5 }, /* Intel D955XBK - 5 Stack */ 380 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 381 .pci_subdevice = 0x0417, 382 .config = STAC_D945GTP5 }, /* Intel D975XBK - 5 Stack */ 383 { .pci_subvendor = 0x8384, 384 .pci_subdevice = 0x7680, 385 .config = STAC_MACMINI }, /* Apple Mac Mini (early 2006) */ 386 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 387 .pci_subdevice = 0x2112, 388 .config = STAC_D965_2112 }, 389 { .pci_subvendor = PCI_VENDOR_ID_INTEL, 390 .pci_subdevice = 0x284b, 391 .config = STAC_D965_284B }, 438 [STAC_MACMINI] = d945gtp5_pin_configs, 439 }; 440 441 static const char *stac922x_models[STAC_922X_MODELS] = { 442 [STAC_D945_REF] = "ref", 443 [STAC_D945GTP5] = "5stack", 444 [STAC_D945GTP3] = "3stack", 445 [STAC_MACMINI] = "macmini", 446 }; 447 448 static struct snd_pci_quirk stac922x_cfg_tbl[] = { 449 /* SigmaTel reference board */ 450 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 451 "DFI LanParty", STAC_D945_REF), 452 /* Intel 945G based systems */ 453 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0101, 454 "Intel D945G", STAC_D945GTP3), 455 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0202, 456 "Intel D945G", STAC_D945GTP3), 457 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0606, 458 "Intel D945G", STAC_D945GTP3), 459 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0601, 460 "Intel D945G", STAC_D945GTP3), 461 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0111, 462 "Intel D945G", STAC_D945GTP3), 463 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1115, 464 "Intel D945G", STAC_D945GTP3), 465 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1116, 466 "Intel D945G", STAC_D945GTP3), 467 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1117, 468 "Intel D945G", STAC_D945GTP3), 469 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1118, 470 "Intel D945G", STAC_D945GTP3), 471 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x1119, 472 "Intel D945G", STAC_D945GTP3), 473 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x8826, 474 "Intel D945G", STAC_D945GTP3), 475 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5049, 476 "Intel D945G", STAC_D945GTP3), 477 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5055, 478 "Intel D945G", STAC_D945GTP3), 479 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x5048, 480 "Intel D945G", STAC_D945GTP3), 481 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0110, 482 "Intel D945G", STAC_D945GTP3), 483 /* Intel D945G 5-stack systems */ 484 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0404, 485 "Intel D945G", STAC_D945GTP5), 486 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0303, 487 "Intel D945G", STAC_D945GTP5), 488 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0013, 489 "Intel D945G", STAC_D945GTP5), 490 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0417, 491 "Intel D945G", STAC_D945GTP5), 492 /* Intel 945P based systems */ 493 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0b0b, 494 "Intel D945P", STAC_D945GTP3), 495 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0112, 496 "Intel D945P", STAC_D945GTP3), 497 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0d0d, 498 "Intel D945P", STAC_D945GTP3), 499 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0909, 500 "Intel D945P", STAC_D945GTP3), 501 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0505, 502 "Intel D945P", STAC_D945GTP3), 503 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x0707, 504 "Intel D945P", STAC_D945GTP5), 505 /* other systems */ 506 /* Apple Mac Mini (early 2006) */ 507 SND_PCI_QUIRK(0x8384, 0x7680, 508 "Mac Mini", STAC_MACMINI), 392 509 {0} /* terminator */ 393 510 }; 394 511 395 512 static unsigned int ref927x_pin_configs[14] = { 396 0x01813122, 0x01a19021, 0x01014010, 0x01016011, 397 0x01012012, 0x01011014, 0x40000100, 0x40000100, 398 0x40000100, 0x40000100, 0x40000100, 0x01441030, 399 0x01c41030, 0x40000100, 400 }; 401 402 static unsigned int *stac927x_brd_tbl[] = { 403 ref927x_pin_configs, 404 }; 405 406 static struct hda_board_config stac927x_cfg_tbl[] = { 407 { .modelname = "ref", 408 .pci_subvendor = PCI_VENDOR_ID_INTEL, 409 .pci_subdevice = 0x2668, /* DFI LanParty */ 410 .config = STAC_REF }, /* SigmaTel reference board */ 411 {0} /* terminator */ 412 }; 513 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, 514 0x01a19040, 0x01011012, 0x01016011, 0x0101201f, 515 0x183301f0, 0x18a001f0, 0x18a001f0, 0x01442070, 516 0x01c42190, 0x40000100, 517 }; 518 519 static unsigned int d965_3st_pin_configs[14] = { 520 0x0221401f, 0x02a19120, 0x40000100, 0x01014011, 521 0x01a19021, 0x01813024, 0x40000100, 0x40000100, 522 0x40000100, 0x40000100, 0x40000100, 0x40000100, 523 0x40000100, 0x40000100 524 }; 525 526 static unsigned int d965_5st_pin_configs[14] = { 527 0x02214020, 0x02a19080, 0x0181304e, 0x01014010, 528 0x01a19040, 0x01011012, 0x01016011, 0x40000100, 529 0x40000100, 0x40000100, 0x40000100, 0x01442070, 530 0x40000100, 0x40000100 531 }; 532 533 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { 534 [STAC_D965_REF] = ref927x_pin_configs, 535 [STAC_D965_3ST] = d965_3st_pin_configs, 536 [STAC_D965_5ST] = d965_5st_pin_configs, 537 }; 538 539 static const char *stac927x_models[STAC_927X_MODELS] = { 540 [STAC_D965_REF] = "ref", 541 [STAC_D965_3ST] = "3stack", 542 [STAC_D965_5ST] = "5stack", 543 }; 544 545 static struct snd_pci_quirk stac927x_cfg_tbl[] = { 546 /* SigmaTel reference board */ 547 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 548 "DFI LanParty", STAC_D965_REF), 549 /* Intel 946 based systems */ 550 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x3d01, "Intel D946", STAC_D965_3ST), 551 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0xa301, "Intel D946", STAC_D965_3ST), 552 /* 965 based 3 stack systems */ 553 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2116, "Intel D965", STAC_D965_3ST), 554 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2115, "Intel D965", STAC_D965_3ST), 555 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2114, "Intel D965", STAC_D965_3ST), 556 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2113, "Intel D965", STAC_D965_3ST), 557 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2112, "Intel D965", STAC_D965_3ST), 558 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2111, "Intel D965", STAC_D965_3ST), 559 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2110, "Intel D965", STAC_D965_3ST), 560 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2009, "Intel D965", STAC_D965_3ST), 561 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2008, "Intel D965", STAC_D965_3ST), 562 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2007, "Intel D965", STAC_D965_3ST), 563 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2006, "Intel D965", STAC_D965_3ST), 564 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2005, "Intel D965", STAC_D965_3ST), 565 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2004, "Intel D965", STAC_D965_3ST), 566 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2003, "Intel D965", STAC_D965_3ST), 567 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2002, "Intel D965", STAC_D965_3ST), 568 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2001, "Intel D965", STAC_D965_3ST), 569 /* 965 based 5 stack systems */ 570 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2301, "Intel D965", STAC_D965_5ST), 571 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2302, "Intel D965", STAC_D965_5ST), 572 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2303, "Intel D965", STAC_D965_5ST), 573 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2304, "Intel D965", STAC_D965_5ST), 574 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2305, "Intel D965", STAC_D965_5ST), 575 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2501, "Intel D965", STAC_D965_5ST), 576 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2502, "Intel D965", STAC_D965_5ST), 577 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2503, "Intel D965", STAC_D965_5ST), 578 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2504, "Intel D965", STAC_D965_5ST), 579 {0} /* terminator */ 580 }; 581 582 static unsigned int ref9205_pin_configs[12] = { 583 0x40000100, 0x40000100, 0x01016011, 0x01014010, 584 0x01813122, 0x01a19021, 0x40000100, 0x40000100, 585 0x90a000f0, 0x90a000f0, 0x01441030, 0x01c41030 586 }; 587 588 static unsigned int *stac9205_brd_tbl[STAC_9205_MODELS] = { 589 ref9205_pin_configs, 590 }; 591 592 static const char *stac9205_models[STAC_9205_MODELS] = { 593 [STAC_9205_REF] = "ref", 594 }; 595 596 static struct snd_pci_quirk stac9205_cfg_tbl[] = { 597 /* SigmaTel reference board */ 598 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 599 "DFI LanParty", STAC_9205_REF), 600 {0} /* terminator */ 601 }; 602 603 static int stac92xx_save_bios_config_regs(struct hda_codec *codec) 604 { 605 int i; 606 struct sigmatel_spec *spec = codec->spec; 607 608 if (! spec->bios_pin_configs) { 609 spec->bios_pin_configs = kcalloc(spec->num_pins, 610 sizeof(*spec->bios_pin_configs), GFP_KERNEL); 611 if (! spec->bios_pin_configs) 612 return -ENOMEM; 613 } 614 615 for (i = 0; i < spec->num_pins; i++) { 616 hda_nid_t nid = spec->pin_nids[i]; 617 unsigned int pin_cfg; 618 619 pin_cfg = snd_hda_codec_read(codec, nid, 0, 620 AC_VERB_GET_CONFIG_DEFAULT, 0x00); 621 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", 622 nid, pin_cfg); 623 spec->bios_pin_configs[i] = pin_cfg; 624 } 625 626 return 0; 627 } 413 628 414 629 static void stac92xx_set_config_regs(struct hda_codec *codec) … … 418 633 unsigned int pin_cfg; 419 634 420 for (i=0; i < spec->num_pins; i++) { 635 if (! spec->pin_nids || ! spec->pin_configs) 636 return; 637 638 for (i = 0; i < spec->num_pins; i++) { 421 639 snd_hda_codec_write(codec, spec->pin_nids[i], 0, 422 640 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0, … … 433 651 pin_cfg = snd_hda_codec_read(codec, spec->pin_nids[i], 0, 434 652 AC_VERB_GET_CONFIG_DEFAULT, 435 0x00); 653 0x00); 436 654 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n", spec->pin_nids[i], pin_cfg); 437 655 } … … 544 762 545 763 static struct hda_pcm_stream stac92xx_pcm_analog_alt_playback = { 546 547 548 549 550 551 552 553 554 764 .substreams = 1, 765 .channels_min = 2, 766 .channels_max = 2, 767 .nid = 0x06, /* NID to query formats and rates */ 768 .ops = { 769 .open = stac92xx_playback_pcm_open, 770 .prepare = stac92xx_playback_pcm_prepare, 771 .cleanup = stac92xx_playback_pcm_cleanup 772 }, 555 773 }; 556 774 … … 558 776 .substreams = 2, 559 777 .channels_min = 2, 560 561 778 .channels_max = 2, 779 /* NID is set in stac92xx_build_pcms */ 562 780 .ops = { 563 781 .prepare = stac92xx_capture_pcm_prepare, … … 577 795 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; 578 796 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; 579 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 580 581 if (spec->alt_switch) { 582 codec->num_pcms++; 583 info++; 584 info->name = "STAC92xx Analog Alt"; 585 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; 586 } 797 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 798 799 if (spec->alt_switch) { 800 codec->num_pcms++; 801 info++; 802 info->name = "STAC92xx Analog Alt"; 803 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_alt_playback; 804 } 805 587 806 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 588 807 codec->num_pcms++; … … 604 823 static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) 605 824 { 606 607 608 609 610 611 612 613 614 615 616 617 825 unsigned int pincap = snd_hda_param_read(codec, nid, 826 AC_PAR_PIN_CAP); 827 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; 828 if (pincap & AC_PINCAP_VREF_100) 829 return AC_PINCTL_VREF_100; 830 if (pincap & AC_PINCAP_VREF_80) 831 return AC_PINCTL_VREF_80; 832 if (pincap & AC_PINCAP_VREF_50) 833 return AC_PINCTL_VREF_50; 834 if (pincap & AC_PINCAP_VREF_GRD) 835 return AC_PINCTL_VREF_GRD; 836 return 0; 618 837 } 619 838 … … 654 873 655 874 if (val) 656 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); 657 else { 658 unsigned int pinctl = AC_PINCTL_IN_EN; 659 if (io_idx) /* set VREF for mic */ 660 pinctl |= stac92xx_get_vref(codec, nid); 661 stac92xx_auto_set_pinctl(codec, nid, pinctl); 662 } 663 875 stac92xx_auto_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); 876 else { 877 unsigned int pinctl = AC_PINCTL_IN_EN; 878 if (io_idx) /* set VREF for mic */ 879 pinctl |= stac92xx_get_vref(codec, nid); 880 stac92xx_auto_set_pinctl(codec, nid, pinctl); 881 } 664 882 return 1; 665 883 } … … 773 991 */ 774 992 /* fill in the dac_nids table from the parsed pin configuration */ 775 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, const struct auto_pin_cfg *cfg) 993 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, 994 const struct auto_pin_cfg *cfg) 776 995 { 777 996 struct sigmatel_spec *spec = codec->spec; … … 786 1005 } 787 1006 788 spec->multiout.num_dacs = cfg->line_outs; 789 1007 spec->multiout.num_dacs = cfg->line_outs; 1008 1009 return 0; 1010 } 1011 1012 /* create volume control/switch for the given prefx type */ 1013 static int create_controls(struct sigmatel_spec *spec, const char *pfx, hda_nid_t nid, int chs) 1014 { 1015 char name[32]; 1016 int err; 1017 1018 sprintf(name, "%s Playback Volume", pfx); 1019 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, 1020 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); 1021 if (err < 0) 1022 return err; 1023 sprintf(name, "%s Playback Switch", pfx); 1024 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, 1025 HDA_COMPOSE_AMP_VAL(nid, chs, 0, HDA_OUTPUT)); 1026 if (err < 0) 1027 return err; 790 1028 return 0; 791 1029 } 792 1030 793 1031 /* add playback controls from the parsed DAC table */ 794 static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec, const struct auto_pin_cfg *cfg) 795 { 796 char name[32]; 797 static const char *chname[4] = { "Front", "Surround", NULL /*CLFE*/, "Side" }; 1032 static int stac92xx_auto_create_multi_out_ctls(struct sigmatel_spec *spec, 1033 const struct auto_pin_cfg *cfg) 1034 { 1035 static const char *chname[4] = { 1036 "Front", "Surround", NULL /*CLFE*/, "Side" 1037 }; 798 1038 hda_nid_t nid; 799 1039 int i, err; … … 807 1047 if (i == 2) { 808 1048 /* Center/LFE */ 809 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "Center Playback Volume",810 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT)))< 0)1049 err = create_controls(spec, "Center", nid, 1); 1050 if (err < 0) 811 1051 return err; 812 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "LFE Playback Volume", 813 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) 814 return err; 815 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "Center Playback Switch", 816 HDA_COMPOSE_AMP_VAL(nid, 1, 0, HDA_OUTPUT))) < 0) 817 return err; 818 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "LFE Playback Switch", 819 HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT))) < 0) 1052 err = create_controls(spec, "LFE", nid, 2); 1053 if (err < 0) 820 1054 return err; 821 1055 } else { 822 sprintf(name, "%s Playback Volume", chname[i]); 823 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, name, 824 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 825 return err; 826 sprintf(name, "%s Playback Switch", chname[i]); 827 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, name, 828 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 1056 err = create_controls(spec, chname[i], nid, 3); 1057 if (err < 0) 829 1058 return err; 830 1059 } … … 842 1071 } 843 1072 844 /* add playback controls for HP output */ 845 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, struct auto_pin_cfg *cfg) 846 { 847 struct sigmatel_spec *spec = codec->spec; 848 hda_nid_t pin = cfg->hp_pin; 1073 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) 1074 { 1075 int i; 1076 1077 for (i = 0; i < spec->multiout.num_dacs; i++) { 1078 if (spec->multiout.dac_nids[i] == nid) 1079 return 1; 1080 } 1081 if (spec->multiout.hp_nid == nid) 1082 return 1; 1083 return 0; 1084 } 1085 1086 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) 1087 { 1088 if (!spec->multiout.hp_nid) 1089 spec->multiout.hp_nid = nid; 1090 else if (spec->multiout.num_dacs > 4) { 1091 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); 1092 return 1; 1093 } else { 1094 spec->multiout.dac_nids[spec->multiout.num_dacs] = nid; 1095 spec->multiout.num_dacs++; 1096 } 1097 return 0; 1098 } 1099 1100 /* add playback controls for Speaker and HP outputs */ 1101 static int stac92xx_auto_create_hp_ctls(struct hda_codec *codec, 1102 struct auto_pin_cfg *cfg) 1103 { 1104 struct sigmatel_spec *spec = codec->spec; 849 1105 hda_nid_t nid; 850 int i, err; 851 unsigned int wid_caps; 852 853 if (! pin) 854 return 0; 855 856 wid_caps = get_wcaps(codec, pin); 857 if (wid_caps & AC_WCAP_UNSOL_CAP) { 858 /* Enable unsolicited responses on the HP widget */ 859 snd_hda_codec_write(codec, pin, 0, 860 AC_VERB_SET_UNSOLICITED_ENABLE, 861 STAC_UNSOL_ENABLE); 862 spec->hp_detect = 1; 863 } 864 865 nid = snd_hda_codec_read(codec, pin, 0, AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 866 for (i = 0; i < cfg->line_outs; i++) { 867 if (! spec->multiout.dac_nids[i]) 1106 int i, old_num_dacs, err; 1107 1108 old_num_dacs = spec->multiout.num_dacs; 1109 for (i = 0; i < cfg->hp_outs; i++) { 1110 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); 1111 if (wid_caps & AC_WCAP_UNSOL_CAP) 1112 spec->hp_detect = 1; 1113 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, 1114 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 1115 if (check_in_dac_nids(spec, nid)) 1116 nid = 0; 1117 if (! nid) 868 1118 continue; 869 if (spec->multiout.dac_nids[i] == nid) 870 return 0; 871 } 872 873 spec->multiout.hp_nid = nid; 874 875 /* control HP volume/switch on the output mixer amp */ 876 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_VOL, "Headphone Playback Volume", 877 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 878 return err; 879 if ((err = stac92xx_add_control(spec, STAC_CTL_WIDGET_MUTE, "Headphone Playback Switch", 880 HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT))) < 0) 881 return err; 1119 add_spec_dacs(spec, nid); 1120 } 1121 for (i = 0; i < cfg->speaker_outs; i++) { 1122 nid = snd_hda_codec_read(codec, cfg->speaker_pins[0], 0, 1123 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 1124 if (check_in_dac_nids(spec, nid)) 1125 nid = 0; 1126 if (check_in_dac_nids(spec, nid)) 1127 nid = 0; 1128 if (! nid) 1129 continue; 1130 add_spec_dacs(spec, nid); 1131 } 1132 1133 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) { 1134 static const char *pfxs[] = { 1135 "Speaker", "External Speaker", "Speaker2", 1136 }; 1137 err = create_controls(spec, pfxs[i - old_num_dacs], 1138 spec->multiout.dac_nids[i], 3); 1139 if (err < 0) 1140 return err; 1141 } 1142 if (spec->multiout.hp_nid) { 1143 const char *pfx; 1144 if (old_num_dacs == spec->multiout.num_dacs) 1145 pfx = "Master"; 1146 else 1147 pfx = "Headphone"; 1148 err = create_controls(spec, pfx, spec->multiout.hp_nid, 3); 1149 if (err < 0) 1150 return err; 1151 } 1152 1153 return 0; 1154 } 1155 1156 /* labels for dmic mux inputs */ 1157 static const char *stac92xx_dmic_labels[5] = { 1158 "Analog Inputs", "Digital Mic 1", "Digital Mic 2", 1159 "Digital Mic 3", "Digital Mic 4" 1160 }; 1161 1162 /* create playback/capture controls for input pins on dmic capable codecs */ 1163 static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, 1164 const struct auto_pin_cfg *cfg) 1165 { 1166 struct sigmatel_spec *spec = codec->spec; 1167 struct hda_input_mux *dimux = &spec->private_dimux; 1168 hda_nid_t con_lst[HDA_MAX_NUM_INPUTS]; 1169 int i, j; 1170 1171 dimux->items[dimux->num_items].label = stac92xx_dmic_labels[0]; 1172 dimux->items[dimux->num_items].index = 0; 1173 dimux->num_items++; 1174 1175 for (i = 0; i < spec->num_dmics; i++) { 1176 int index; 1177 int num_cons; 1178 unsigned int def_conf; 1179 1180 def_conf = snd_hda_codec_read(codec, 1181 spec->dmic_nids[i], 1182 0, 1183 AC_VERB_GET_CONFIG_DEFAULT, 1184 0); 1185 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) 1186 continue; 1187 1188 num_cons = snd_hda_get_connections(codec, 1189 spec->dmux_nid, 1190 con_lst, 1191 HDA_MAX_NUM_INPUTS); 1192 for (j = 0; j < num_cons; j++) 1193 if (con_lst[j] == spec->dmic_nids[i]) { 1194 index = j; 1195 goto found; 1196 } 1197 continue; 1198 found: 1199 dimux->items[dimux->num_items].label = 1200 stac92xx_dmic_labels[dimux->num_items]; 1201 dimux->items[dimux->num_items].index = index; 1202 dimux->num_items++; 1203 } 882 1204 883 1205 return 0; … … 893 1215 894 1216 for (i = 0; i < AUTO_PIN_LAST; i++) { 895 int index = -1;896 if (cfg->input_pins[i]) { 897 imux->items[imux->num_items].label = auto_pin_cfg_labels[i];898 899 for (j=0; j<spec->num_muxes; j++) {900 int num_cons = snd_hda_get_connections(codec, spec->mux_nids[j], con_lst, HDA_MAX_NUM_INPUTS);901 for (k=0; k<num_cons; k++)902 if (con_lst[k] == cfg->input_pins[i]) {903 index = k;904 break;905 }906 if (index >= 0)907 break;908 }909 imux->items[imux->num_items].index = index;910 imux->num_items++;1217 int index; 1218 1219 if (!cfg->input_pins[i]) 1220 continue; 1221 index = -1; 1222 for (j = 0; j < spec->num_muxes; j++) { 1223 int num_cons; 1224 num_cons = snd_hda_get_connections(codec, 1225 spec->mux_nids[j], 1226 con_lst, 1227 HDA_MAX_NUM_INPUTS); 1228 for (k = 0; k < num_cons; k++) 1229 if (con_lst[k] == cfg->input_pins[i]) { 1230 index = k; 1231 goto found; 1232 } 911 1233 } 912 } 913 if (imux->num_items == 1) { 914 /* 915 * Set the current input for the muxes. 916 * The STAC9221 has two input muxes with identical source 917 * NID lists. Hopefully this won't get confused. 918 */ 919 for (i = 0; i < spec->num_muxes; i++) { 920 snd_hda_codec_write(codec, spec->mux_nids[i], 0, 921 AC_VERB_SET_CONNECT_SEL, 922 imux->items[0].index); 923 } 924 } 1234 continue; 1235 found: 1236 imux->items[imux->num_items].label = auto_pin_cfg_labels[i]; 1237 imux->items[imux->num_items].index = index; 1238 imux->num_items++; 1239 } 1240 1241 if (imux->num_items == 1) { 1242 /* 1243 * Set the current input for the muxes. 1244 * The STAC9221 has two input muxes with identical source 1245 * NID lists. Hopefully this won't get confused. 1246 */ 1247 for (i = 0; i < spec->num_muxes; i++) { 1248 snd_hda_codec_write(codec, spec->mux_nids[i], 0, 1249 AC_VERB_SET_CONNECT_SEL, 1250 imux->items[0].index); 1251 } 1252 } 925 1253 926 1254 return 0; … … 941 1269 { 942 1270 struct sigmatel_spec *spec = codec->spec; 943 hda_nid_t pin; 944 945 pin = spec->autocfg.hp_pin; 946 if (pin) /* connect to front */ 947 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); 1271 int i; 1272 1273 for (i = 0; i < spec->autocfg.hp_outs; i++) { 1274 hda_nid_t pin; 1275 pin = spec->autocfg.hp_pins[i]; 1276 if (pin) /* connect to front */ 1277 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN); 1278 } 1279 for (i = 0; i < spec->autocfg.speaker_outs; i++) { 1280 hda_nid_t pin; 1281 pin = spec->autocfg.speaker_pins[i]; 1282 if (pin) /* connect to front */ 1283 stac92xx_auto_set_pinctl(codec, pin, AC_PINCTL_OUT_EN); 1284 } 948 1285 } 949 1286 … … 953 1290 int err; 954 1291 955 if ((err = snd_hda_parse_pin_def_config(codec, &spec->autocfg, NULL)) < 0) 956 return err; 957 if (! spec->autocfg.line_outs) 958 return 0; /* can't find valid pin config */ 959 960 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) 961 return err; 962 963 if (spec->multiout.num_dacs == 0) 964 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) 965 return err; 1292 if ((err = snd_hda_parse_pin_def_config(codec, 1293 &spec->autocfg, 1294 spec->dmic_nids)) < 0) 1295 return err; 1296 if (! spec->autocfg.line_outs) 1297 return 0; /* can't find valid pin config */ 1298 1299 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) 1300 return err; 1301 if (spec->multiout.num_dacs == 0) 1302 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) 1303 return err; 966 1304 967 1305 if ((err = stac92xx_auto_create_multi_out_ctls(spec, &spec->autocfg)) < 0 || … … 970 1308 return err; 971 1309 1310 if (spec->num_dmics > 0) 1311 if ((err = stac92xx_auto_create_dmic_input_ctls(codec, 1312 &spec->autocfg)) < 0) 1313 return err; 1314 972 1315 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 973 1316 if (spec->multiout.max_channels > 2) 974 1317 spec->surr_switch = 1; 975 1318 976 977 978 979 1319 if (spec->autocfg.dig_out_pin) 1320 spec->multiout.dig_out_nid = dig_out; 1321 if (spec->autocfg.dig_in_pin) 1322 spec->dig_in_nid = dig_in; 980 1323 981 1324 if (spec->kctl_alloc) … … 983 1326 984 1327 spec->input_mux = &spec->private_imux; 1328 spec->dinput_mux = &spec->private_dimux; 985 1329 986 1330 return 1; … … 989 1333 /* add playback controls for HP output */ 990 1334 static int stac9200_auto_create_hp_ctls(struct hda_codec *codec, 991 struct auto_pin_cfg *cfg) 992 { 993 struct sigmatel_spec *spec = codec->spec; 994 hda_nid_t pin = cfg->hp_pin; 995 unsigned int wid_caps; 996 997 if (! pin) 998 return 0; 999 1000 wid_caps = get_wcaps(codec, pin); 1001 if (wid_caps & AC_WCAP_UNSOL_CAP) { 1002 /* Enable unsolicited responses on the HP widget */ 1003 snd_hda_codec_write(codec, pin, 0, 1004 AC_VERB_SET_UNSOLICITED_ENABLE, 1005 STAC_UNSOL_ENABLE); 1006 spec->hp_detect = 1; 1007 } 1008 1009 return 0; 1335 struct auto_pin_cfg *cfg) 1336 { 1337 struct sigmatel_spec *spec = codec->spec; 1338 hda_nid_t pin = cfg->hp_pins[0]; 1339 unsigned int wid_caps; 1340 1341 if (! pin) 1342 return 0; 1343 1344 wid_caps = get_wcaps(codec, pin); 1345 if (wid_caps & AC_WCAP_UNSOL_CAP) 1346 spec->hp_detect = 1; 1347 1348 return 0; 1349 } 1350 1351 /* add playback controls for LFE output */ 1352 static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, 1353 struct auto_pin_cfg *cfg) 1354 { 1355 struct sigmatel_spec *spec = codec->spec; 1356 int err; 1357 hda_nid_t lfe_pin = 0x0; 1358 int i; 1359 1360 /* 1361 * search speaker outs and line outs for a mono speaker pin 1362 * with an amp. If one is found, add LFE controls 1363 * for it. 1364 */ 1365 for (i = 0; i < spec->autocfg.speaker_outs && lfe_pin == 0x0; i++) { 1366 hda_nid_t pin = spec->autocfg.speaker_pins[i]; 1367 unsigned long wcaps = get_wcaps(codec, pin); 1368 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); 1369 if (wcaps == AC_WCAP_OUT_AMP) 1370 /* found a mono speaker with an amp, must be lfe */ 1371 lfe_pin = pin; 1372 } 1373 1374 /* if speaker_outs is 0, then speakers may be in line_outs */ 1375 if (lfe_pin == 0 && spec->autocfg.speaker_outs == 0) { 1376 for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { 1377 hda_nid_t pin = spec->autocfg.line_out_pins[i]; 1378 unsigned long cfg; 1379 cfg = snd_hda_codec_read(codec, pin, 0, 1380 AC_VERB_GET_CONFIG_DEFAULT, 1381 0x00); 1382 if (get_defcfg_device(cfg) == AC_JACK_SPEAKER) { 1383 unsigned long wcaps = get_wcaps(codec, pin); 1384 wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); 1385 if (wcaps == AC_WCAP_OUT_AMP) 1386 /* found a mono speaker with an amp, 1387 must be lfe */ 1388 lfe_pin = pin; 1389 } 1390 } 1391 } 1392 1393 if (lfe_pin) { 1394 err = create_controls(spec, "LFE", lfe_pin, 1); 1395 if (err < 0) 1396 return err; 1397 } 1398 1399 return 0; 1010 1400 } 1011 1401 … … 1021 1411 return err; 1022 1412 1023 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) 1024 return err; 1025 1026 if (spec->autocfg.dig_out_pin) 1027 spec->multiout.dig_out_nid = 0x05; 1028 if (spec->autocfg.dig_in_pin) 1029 spec->dig_in_nid = 0x04; 1413 if ((err = stac9200_auto_create_hp_ctls(codec, &spec->autocfg)) < 0) 1414 return err; 1415 1416 if ((err = stac9200_auto_create_lfe_ctls(codec, &spec->autocfg)) < 0) 1417 return err; 1418 1419 if (spec->autocfg.dig_out_pin) 1420 spec->multiout.dig_out_nid = 0x05; 1421 if (spec->autocfg.dig_in_pin) 1422 spec->dig_in_nid = 0x04; 1030 1423 1031 1424 if (spec->kctl_alloc) … … 1033 1426 1034 1427 spec->input_mux = &spec->private_imux; 1035 1036 return 1; 1428 spec->dinput_mux = &spec->private_dimux; 1429 1430 return 1; 1037 1431 } 1038 1432 … … 1076 1470 } 1077 1471 1472 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, 1473 unsigned int event) 1474 { 1475 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) 1476 snd_hda_codec_write(codec, nid, 0, 1477 AC_VERB_SET_UNSOLICITED_ENABLE, 1478 (AC_USRSP_EN | event)); 1479 } 1480 1078 1481 static int stac92xx_init(struct hda_codec *codec) 1079 1482 { 1080 struct sigmatel_spec *spec = codec->spec; 1081 struct auto_pin_cfg *cfg = &spec->autocfg; 1082 int i; 1083 1084 snd_hda_sequence_write(codec, spec->init); 1085 1086 /* set up pins */ 1087 if (spec->hp_detect) { 1088 /* fake event to set up pins */ 1089 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); 1090 } else { 1091 stac92xx_auto_init_multi_out(codec); 1092 stac92xx_auto_init_hp_out(codec); 1093 } 1094 for (i = 0; i < AUTO_PIN_LAST; i++) { 1095 hda_nid_t nid = cfg->input_pins[i]; 1096 if (nid) { 1097 unsigned int pinctl = AC_PINCTL_IN_EN; 1098 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) 1099 pinctl |= stac92xx_get_vref(codec, nid); 1100 stac92xx_auto_set_pinctl(codec, nid, pinctl); 1101 } 1102 } 1103 if (cfg->dig_out_pin) 1104 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, 1105 AC_PINCTL_OUT_EN); 1106 if (cfg->dig_in_pin) 1107 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, 1108 AC_PINCTL_IN_EN); 1109 if (spec->gpio_mute) { 1110 stac922x_gpio_mute(codec, 0, 0); 1111 stac922x_gpio_mute(codec, 1, 0); 1112 } 1113 1114 return 0; 1483 struct sigmatel_spec *spec = codec->spec; 1484 struct auto_pin_cfg *cfg = &spec->autocfg; 1485 int i; 1486 1487 snd_hda_sequence_write(codec, spec->init); 1488 1489 /* set up pins */ 1490 if (spec->hp_detect) { 1491 /* Enable unsolicited responses on the HP widget */ 1492 for (i = 0; i < cfg->hp_outs; i++) 1493 enable_pin_detect(codec, cfg->hp_pins[i], 1494 STAC_HP_EVENT); 1495 stac92xx_auto_init_hp_out(codec); 1496 /* fake event to set up pins */ 1497 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); 1498 } else { 1499 stac92xx_auto_init_multi_out(codec); 1500 stac92xx_auto_init_hp_out(codec); 1501 } 1502 for (i = 0; i < AUTO_PIN_LAST; i++) { 1503 hda_nid_t nid = cfg->input_pins[i]; 1504 if (nid) { 1505 unsigned int pinctl = AC_PINCTL_IN_EN; 1506 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) 1507 pinctl |= stac92xx_get_vref(codec, nid); 1508 stac92xx_auto_set_pinctl(codec, nid, pinctl); 1509 } 1510 } 1511 if (spec->num_dmics > 0) 1512 for (i = 0; i < spec->num_dmics; i++) 1513 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], 1514 AC_PINCTL_IN_EN); 1515 1516 if (cfg->dig_out_pin) 1517 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, 1518 AC_PINCTL_OUT_EN); 1519 if (cfg->dig_in_pin) 1520 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, 1521 AC_PINCTL_IN_EN); 1522 1523 if (spec->gpio_mute) { 1524 stac922x_gpio_mute(codec, 0, 0); 1525 stac922x_gpio_mute(codec, 1, 0); 1526 } 1527 1528 return 0; 1115 1529 } 1116 1530 … … 1129 1543 } 1130 1544 1545 if (spec->bios_pin_configs) 1546 kfree(spec->bios_pin_configs); 1547 1131 1548 kfree(spec); 1132 1549 } … … 1137 1554 unsigned int pin_ctl = snd_hda_codec_read(codec, nid, 1138 1555 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0x00); 1556 if (flag == AC_PINCTL_OUT_EN && (pin_ctl & AC_PINCTL_IN_EN)) 1557 return; 1139 1558 snd_hda_codec_write(codec, nid, 0, 1140 1559 AC_VERB_SET_PIN_WIDGET_CONTROL, … … 1152 1571 } 1153 1572 1154 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) 1573 static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) 1574 { 1575 if (!nid) 1576 return 0; 1577 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) 1578 & (1 << 31)) 1579 return 1; 1580 return 0; 1581 } 1582 1583 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) 1155 1584 { 1156 1585 struct sigmatel_spec *spec = codec->spec; … … 1158 1587 int i, presence; 1159 1588 1160 if ((res >> 26) != STAC_HP_EVENT) 1161 return; 1162 1163 presence = snd_hda_codec_read(codec, cfg->hp_pin, 0, 1164 AC_VERB_GET_PIN_SENSE, 0x00) >> 31; 1589 presence = 0; 1590 for (i = 0; i < cfg->hp_outs; i++) { 1591 presence = get_pin_presence(codec, cfg->hp_pins[i]); 1592 if (presence) 1593 break; 1594 } 1165 1595 1166 1596 if (presence) { … … 1169 1599 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], 1170 1600 AC_PINCTL_OUT_EN); 1171 stac92xx_set_pinctl(codec, cfg->hp_pin, AC_PINCTL_OUT_EN); 1601 for (i = 0; i < cfg->speaker_outs; i++) 1602 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], 1603 AC_PINCTL_OUT_EN); 1172 1604 } else { 1173 1605 /* enable lineouts, disable hp */ … … 1175 1607 stac92xx_set_pinctl(codec, cfg->line_out_pins[i], 1176 1608 AC_PINCTL_OUT_EN); 1177 stac92xx_reset_pinctl(codec, cfg->hp_pin, AC_PINCTL_OUT_EN); 1609 for (i = 0; i < cfg->speaker_outs; i++) 1610 stac92xx_set_pinctl(codec, cfg->speaker_pins[i], 1611 AC_PINCTL_OUT_EN); 1612 } 1613 } 1614 1615 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) 1616 { 1617 switch (res >> 26) { 1618 case STAC_HP_EVENT: 1619 stac92xx_hp_detect(codec, res); 1620 break; 1178 1621 } 1179 1622 } … … 1186 1629 1187 1630 stac92xx_init(codec); 1631 stac92xx_set_config_regs(codec); 1188 1632 for (i = 0; i < spec->num_mixers; i++) 1189 1633 snd_hda_resume_ctls(codec, spec->mixers[i]); … … 1218 1662 1219 1663 codec->spec = spec; 1220 spec->board_config = snd_hda_check_board_config(codec, stac9200_cfg_tbl); 1221 if (spec->board_config < 0) 1222 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); 1223 else { 1224 spec->num_pins = 8; 1225 spec->pin_nids = stac9200_pin_nids; 1664 spec->num_pins = 8; 1665 spec->pin_nids = stac9200_pin_nids; 1666 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, 1667 stac9200_models, 1668 stac9200_cfg_tbl); 1669 if (spec->board_config < 0) { 1670 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); 1671 err = stac92xx_save_bios_config_regs(codec); 1672 if (err < 0) { 1673 stac92xx_free(codec); 1674 return err; 1675 } 1676 spec->pin_configs = spec->bios_pin_configs; 1677 } else { 1226 1678 spec->pin_configs = stac9200_brd_tbl[spec->board_config]; 1227 1679 stac92xx_set_config_regs(codec); … … 1234 1686 spec->mux_nids = stac9200_mux_nids; 1235 1687 spec->num_muxes = 1; 1688 spec->num_dmics = 0; 1236 1689 1237 1690 spec->init = stac9200_core_init; … … 1259 1712 1260 1713 codec->spec = spec; 1261 spec->board_config = snd_hda_check_board_config(codec, stac922x_cfg_tbl); 1262 if (spec->board_config < 0) 1263 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, using BIOS defaults\n"); 1264 else if (stac922x_brd_tbl[spec->board_config] != NULL) { 1265 spec->num_pins = 10; 1266 spec->pin_nids = stac922x_pin_nids; 1714 spec->num_pins = 10; 1715 spec->pin_nids = stac922x_pin_nids; 1716 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, 1717 stac922x_models, 1718 stac922x_cfg_tbl); 1719 if (spec->board_config < 0) { 1720 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " 1721 "using BIOS defaults\n"); 1722 err = stac92xx_save_bios_config_regs(codec); 1723 if (err < 0) { 1724 stac92xx_free(codec); 1725 return err; 1726 } 1727 spec->pin_configs = spec->bios_pin_configs; 1728 } else if (stac922x_brd_tbl[spec->board_config] != NULL) { 1267 1729 spec->pin_configs = stac922x_brd_tbl[spec->board_config]; 1268 1730 stac92xx_set_config_regs(codec); … … 1272 1734 spec->mux_nids = stac922x_mux_nids; 1273 1735 spec->num_muxes = 2; 1736 spec->num_dmics = 0; 1274 1737 1275 1738 spec->init = stac922x_core_init; … … 1277 1740 1278 1741 spec->multiout.dac_nids = spec->dac_nids; 1279 1280 switch (spec->board_config) { 1281 case STAC_D965_2112: 1282 spec->adc_nids = stac9227_adc_nids; 1283 spec->mux_nids = stac9227_mux_nids; 1284 #if 0 1285 spec->multiout.dac_nids = d965_2112_dac_nids; 1286 spec->multiout.num_dacs = ARRAY_SIZE(d965_2112_dac_nids); 1287 #endif 1288 spec->init = d965_2112_core_init; 1742 1743 err = stac92xx_parse_auto_config(codec, 0x08, 0x09); 1744 if (err < 0) { 1745 stac92xx_free(codec); 1746 return err; 1747 } 1748 1749 if (spec->board_config == STAC_MACMINI) 1750 spec->gpio_mute = 1; 1751 1752 codec->patch_ops = stac92xx_patch_ops; 1753 1754 return 0; 1755 } 1756 1757 static int patch_stac927x(struct hda_codec *codec) 1758 { 1759 struct sigmatel_spec *spec; 1760 int err; 1761 1762 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1763 if (spec == NULL) 1764 return -ENOMEM; 1765 1766 codec->spec = spec; 1767 spec->num_pins = 14; 1768 spec->pin_nids = stac927x_pin_nids; 1769 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, 1770 stac927x_models, 1771 stac927x_cfg_tbl); 1772 if (spec->board_config < 0) { 1773 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n"); 1774 err = stac92xx_save_bios_config_regs(codec); 1775 if (err < 0) { 1776 stac92xx_free(codec); 1777 return err; 1778 } 1779 spec->pin_configs = spec->bios_pin_configs; 1780 } else if (stac927x_brd_tbl[spec->board_config] != NULL) { 1781 spec->pin_configs = stac927x_brd_tbl[spec->board_config]; 1782 stac92xx_set_config_regs(codec); 1783 } 1784 1785 switch (spec->board_config) { 1786 case STAC_D965_3ST: 1787 spec->adc_nids = stac927x_adc_nids; 1788 spec->mux_nids = stac927x_mux_nids; 1789 spec->num_muxes = 3; 1790 spec->num_dmics = 0; 1791 spec->init = d965_core_init; 1289 1792 spec->mixer = stac9227_mixer; 1290 1793 break; 1291 case STAC_D965_284B: 1292 spec->adc_nids = stac9227_adc_nids; 1293 spec->mux_nids = stac9227_mux_nids; 1294 spec->init = stac9227_core_init; 1794 case STAC_D965_5ST: 1795 spec->adc_nids = stac927x_adc_nids; 1796 spec->mux_nids = stac927x_mux_nids; 1797 spec->num_muxes = 3; 1798 spec->num_dmics = 0; 1799 spec->init = d965_core_init; 1295 1800 spec->mixer = stac9227_mixer; 1296 1801 break; 1297 } 1298 err = stac92xx_parse_auto_config(codec, 0x08, 0x09); 1299 if (err < 0) { 1300 stac92xx_free(codec); 1301 return err; 1302 } 1303 1304 if (spec->board_config == STAC_MACMINI) 1305 spec->gpio_mute = 1; 1306 codec->patch_ops = stac92xx_patch_ops; 1307 1308 return 0; 1309 } 1310 1311 static int patch_stac927x(struct hda_codec *codec) 1312 { 1313 struct sigmatel_spec *spec; 1314 int err; 1315 1316 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1317 if (spec == NULL) 1318 return -ENOMEM; 1319 1320 codec->spec = spec; 1321 spec->board_config = snd_hda_check_board_config(codec, stac927x_cfg_tbl); 1322 if (spec->board_config < 0) 1323 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC927x, using BIOS defaults\n"); 1324 else { 1325 spec->num_pins = 14; 1326 spec->pin_nids = stac927x_pin_nids; 1327 spec->pin_configs = stac927x_brd_tbl[spec->board_config]; 1328 stac92xx_set_config_regs(codec); 1329 } 1330 1331 spec->adc_nids = stac927x_adc_nids; 1332 spec->mux_nids = stac927x_mux_nids; 1333 spec->num_muxes = 3; 1334 1335 spec->init = stac927x_core_init; 1336 spec->mixer = stac927x_mixer; 1337 1338 spec->multiout.dac_nids = spec->dac_nids; 1339 1340 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); 1341 if (err < 0) { 1802 default: 1803 spec->adc_nids = stac927x_adc_nids; 1804 spec->mux_nids = stac927x_mux_nids; 1805 spec->num_muxes = 3; 1806 spec->num_dmics = 0; 1807 spec->init = stac927x_core_init; 1808 spec->mixer = stac927x_mixer; 1809 } 1810 1811 spec->multiout.dac_nids = spec->dac_nids; 1812 1813 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); 1814 if (err < 0) { 1342 1815 stac92xx_free(codec); 1343 1816 return err; … … 1349 1822 } 1350 1823 1824 static int patch_stac9205(struct hda_codec *codec) 1825 { 1826 struct sigmatel_spec *spec; 1827 int err; 1828 1829 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1830 if (spec == NULL) 1831 return -ENOMEM; 1832 1833 codec->spec = spec; 1834 spec->num_pins = 14; 1835 spec->pin_nids = stac9205_pin_nids; 1836 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, 1837 stac9205_models, 1838 stac9205_cfg_tbl); 1839 if (spec->board_config < 0) { 1840 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); 1841 err = stac92xx_save_bios_config_regs(codec); 1842 if (err < 0) { 1843 stac92xx_free(codec); 1844 return err; 1845 } 1846 spec->pin_configs = spec->bios_pin_configs; 1847 } else { 1848 spec->pin_configs = stac9205_brd_tbl[spec->board_config]; 1849 stac92xx_set_config_regs(codec); 1850 } 1851 1852 spec->adc_nids = stac9205_adc_nids; 1853 spec->mux_nids = stac9205_mux_nids; 1854 spec->num_muxes = 2; 1855 spec->dmic_nids = stac9205_dmic_nids; 1856 spec->num_dmics = 2; 1857 spec->dmux_nid = 0x1d; 1858 1859 spec->init = stac9205_core_init; 1860 spec->mixer = stac9205_mixer; 1861 1862 spec->multiout.dac_nids = spec->dac_nids; 1863 1864 err = stac92xx_parse_auto_config(codec, 0x1f, 0x20); 1865 if (err < 0) { 1866 stac92xx_free(codec); 1867 return err; 1868 } 1869 1870 codec->patch_ops = stac92xx_patch_ops; 1871 1872 return 0; 1873 } 1874 1351 1875 /* 1352 * STAC 7661(?)hack1876 * STAC9872 hack 1353 1877 */ 1354 1878 1355 /* static config for Sony VAIO FE550G */1879 /* static config for Sony VAIO FE550G and Sony VAIO AR */ 1356 1880 static hda_nid_t vaio_dacs[] = { 0x2 }; 1357 #define VAIO_HP_DAC 1881 #define VAIO_HP_DAC 0x5 1358 1882 static hda_nid_t vaio_adcs[] = { 0x8 /*,0x6*/ }; 1359 1883 static hda_nid_t vaio_mux_nids[] = { 0x15 }; 1360 1884 1361 1885 static struct hda_input_mux vaio_mux = { 1362 1363 1364 1365 1366 1367 1368 1886 .num_items = 2, 1887 .items = { 1888 /* { "HP", 0x0 }, */ 1889 { "Line", 0x1 }, 1890 { "Mic", 0x2 }, 1891 { "PCM", 0x3 }, 1892 } 1369 1893 }; 1370 1894 1371 1895 static struct hda_verb vaio_init[] = { 1372 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ 1373 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ 1374 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ 1375 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ 1376 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ 1377 {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */ 1378 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ 1379 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ 1380 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ 1381 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ 1382 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ 1383 {0} 1896 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ 1897 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ 1898 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ 1899 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ 1900 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ 1901 {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */ 1902 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ 1903 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ 1904 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ 1905 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ 1906 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ 1907 {0} 1908 }; 1909 1910 static struct hda_verb vaio_ar_init[] = { 1911 {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ 1912 {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ 1913 {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ 1914 {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ 1915 /* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */ 1916 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */ 1917 {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */ 1918 {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */ 1919 {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */ 1920 /* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */ 1921 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */ 1922 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */ 1923 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */ 1924 {0} 1384 1925 }; 1385 1926 1386 1927 /* bind volumes of both NID 0x02 and 0x05 */ 1387 1928 static int vaio_master_vol_put(struct snd_kcontrol *kcontrol, 1388 1389 { 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1929 struct snd_ctl_elem_value *ucontrol) 1930 { 1931 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1932 long *valp = ucontrol->value.integer.value; 1933 int change; 1934 1935 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, 1936 0x7f, valp[0] & 0x7f); 1937 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, 1938 0x7f, valp[1] & 0x7f); 1939 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, 1940 0x7f, valp[0] & 0x7f); 1941 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, 1942 0x7f, valp[1] & 0x7f); 1943 return change; 1403 1944 } 1404 1945 1405 1946 /* bind volumes of both NID 0x02 and 0x05 */ 1406 1947 static int vaio_master_sw_put(struct snd_kcontrol *kcontrol, 1407 1408 { 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1948 struct snd_ctl_elem_value *ucontrol) 1949 { 1950 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 1951 long *valp = ucontrol->value.integer.value; 1952 int change; 1953 1954 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, 1955 0x80, (valp[0] ? 0 : 0x80)); 1956 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, 1957 0x80, (valp[1] ? 0 : 0x80)); 1958 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, 1959 0x80, (valp[0] ? 0 : 0x80)); 1960 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, 1961 0x80, (valp[1] ? 0 : 0x80)); 1962 return change; 1422 1963 } 1423 1964 1424 1965 static struct snd_kcontrol_new vaio_mixer[] = { 1425 { 1426 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1427 .name = "Master Playback Volume", 1428 .info = snd_hda_mixer_amp_volume_info, 1429 .get = snd_hda_mixer_amp_volume_get, 1430 .put = vaio_master_vol_put, 1431 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 1432 }, 1433 { 1434 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1435 .name = "Master Playback Switch", 1436 .info = snd_hda_mixer_amp_switch_info, 1437 .get = snd_hda_mixer_amp_switch_get, 1438 .put = vaio_master_sw_put, 1439 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 1440 }, 1441 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ 1442 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), 1443 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), 1444 { 1445 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1446 .name = "Capture Source", 1447 .count = 1, 1448 .info = stac92xx_mux_enum_info, 1449 .get = stac92xx_mux_enum_get, 1450 .put = stac92xx_mux_enum_put, 1451 }, 1452 {0} 1453 }; 1454 1455 static struct hda_codec_ops stac7661_patch_ops = { 1456 .build_controls = stac92xx_build_controls, 1457 .build_pcms = stac92xx_build_pcms, 1458 .init = stac92xx_init, 1459 .free = stac92xx_free, 1966 { 1967 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1968 .name = "Master Playback Volume", 1969 .info = snd_hda_mixer_amp_volume_info, 1970 .get = snd_hda_mixer_amp_volume_get, 1971 .put = vaio_master_vol_put, 1972 .tlv = { .c = snd_hda_mixer_amp_tlv }, 1973 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 1974 }, 1975 { 1976 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1977 .name = "Master Playback Switch", 1978 .info = snd_hda_mixer_amp_switch_info, 1979 .get = snd_hda_mixer_amp_switch_get, 1980 .put = vaio_master_sw_put, 1981 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 1982 }, 1983 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ 1984 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), 1985 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), 1986 { 1987 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1988 .name = "Capture Source", 1989 .count = 1, 1990 .info = stac92xx_mux_enum_info, 1991 .get = stac92xx_mux_enum_get, 1992 .put = stac92xx_mux_enum_put, 1993 }, 1994 {0} 1995 }; 1996 1997 static struct snd_kcontrol_new vaio_ar_mixer[] = { 1998 { 1999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2000 .name = "Master Playback Volume", 2001 .info = snd_hda_mixer_amp_volume_info, 2002 .get = snd_hda_mixer_amp_volume_get, 2003 .put = vaio_master_vol_put, 2004 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 2005 }, 2006 { 2007 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2008 .name = "Master Playback Switch", 2009 .info = snd_hda_mixer_amp_switch_info, 2010 .get = snd_hda_mixer_amp_switch_get, 2011 .put = vaio_master_sw_put, 2012 .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 2013 }, 2014 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ 2015 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), 2016 HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT), 2017 /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT), 2018 HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/ 2019 { 2020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2021 .name = "Capture Source", 2022 .count = 1, 2023 .info = stac92xx_mux_enum_info, 2024 .get = stac92xx_mux_enum_get, 2025 .put = stac92xx_mux_enum_put, 2026 }, 2027 {0} 2028 }; 2029 2030 static struct hda_codec_ops stac9872_patch_ops = { 2031 .build_controls = stac92xx_build_controls, 2032 .build_pcms = stac92xx_build_pcms, 2033 .init = stac92xx_init, 2034 .free = stac92xx_free, 1460 2035 #ifdef CONFIG_PM 1461 2036 .resume = stac92xx_resume, 1462 2037 #endif 1463 2038 }; 1464 2039 1465 enum { STAC7661_VAIO }; 1466 1467 static struct hda_board_config stac7661_cfg_tbl[] = { 1468 { .modelname = "vaio", .config = STAC7661_VAIO }, 1469 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81e6, 1470 .config = STAC7661_VAIO }, 1471 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81ef, 1472 .config = STAC7661_VAIO }, 1473 {0} 1474 }; 1475 1476 static int patch_stac7661(struct hda_codec *codec) 1477 { 1478 struct sigmatel_spec *spec; 1479 int board_config; 1480 1481 board_config = snd_hda_check_board_config(codec, stac7661_cfg_tbl); 1482 if (board_config < 0) 1483 /* unknown config, let generic-parser do its job... */ 1484 return snd_hda_parse_generic_codec(codec); 1485 1486 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1487 if (spec == NULL) 1488 return -ENOMEM; 1489 1490 codec->spec = spec; 1491 switch (board_config) { 1492 case STAC7661_VAIO: 1493 spec->mixer = vaio_mixer; 1494 spec->init = vaio_init; 1495 spec->multiout.max_channels = 2; 1496 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); 1497 spec->multiout.dac_nids = vaio_dacs; 1498 spec->multiout.hp_nid = VAIO_HP_DAC; 1499 spec->num_adcs = ARRAY_SIZE(vaio_adcs); 1500 spec->adc_nids = vaio_adcs; 1501 spec->input_mux = &vaio_mux; 1502 spec->mux_nids = vaio_mux_nids; 1503 break; 1504 } 1505 1506 codec->patch_ops = stac7661_patch_ops; 1507 return 0; 1508 } 1509 1510 1511 /* 2040 enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ 2041 CXD9872RD_VAIO, 2042 /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ 2043 STAC9872AK_VAIO, 2044 /* Unknown. id=0x83847661 and subsys=0x104D1200. */ 2045 STAC9872K_VAIO, 2046 /* AR Series. id=0x83847664 and subsys=104D1300 */ 2047 CXD9872AKD_VAIO, 2048 STAC_9872_MODELS, 2049 }; 2050 2051 static const char *stac9872_models[STAC_9872_MODELS] = { 2052 [CXD9872RD_VAIO] = "vaio", 2053 [CXD9872AKD_VAIO] = "vaio-ar", 2054 }; 2055 2056 static struct snd_pci_quirk stac9872_cfg_tbl[] = { 2057 SND_PCI_QUIRK(0x104d, 0x81e6, "Sony VAIO F/S", CXD9872RD_VAIO), 2058 SND_PCI_QUIRK(0x104d, 0x81ef, "Sony VAIO F/S", CXD9872RD_VAIO), 2059 SND_PCI_QUIRK(0x104d, 0x81fd, "Sony VAIO AR", CXD9872AKD_VAIO), 2060 {0} 2061 }; 2062 2063 static int patch_stac9872(struct hda_codec *codec) 2064 { 2065 struct sigmatel_spec *spec; 2066 int board_config; 2067 2068 board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, 2069 stac9872_models, 2070 stac9872_cfg_tbl); 2071 if (board_config < 0) 2072 /* unknown config, let generic-parser do its job... */ 2073 return snd_hda_parse_generic_codec(codec); 2074 2075 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 2076 if (spec == NULL) 2077 return -ENOMEM; 2078 2079 codec->spec = spec; 2080 switch (board_config) { 2081 case CXD9872RD_VAIO: 2082 case STAC9872AK_VAIO: 2083 case STAC9872K_VAIO: 2084 spec->mixer = vaio_mixer; 2085 spec->init = vaio_init; 2086 spec->multiout.max_channels = 2; 2087 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); 2088 spec->multiout.dac_nids = vaio_dacs; 2089 spec->multiout.hp_nid = VAIO_HP_DAC; 2090 spec->num_adcs = ARRAY_SIZE(vaio_adcs); 2091 spec->adc_nids = vaio_adcs; 2092 spec->input_mux = &vaio_mux; 2093 spec->mux_nids = vaio_mux_nids; 2094 break; 2095 2096 case CXD9872AKD_VAIO: 2097 spec->mixer = vaio_ar_mixer; 2098 spec->init = vaio_ar_init; 2099 spec->multiout.max_channels = 2; 2100 spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs); 2101 spec->multiout.dac_nids = vaio_dacs; 2102 spec->multiout.hp_nid = VAIO_HP_DAC; 2103 spec->num_adcs = ARRAY_SIZE(vaio_adcs); 2104 spec->adc_nids = vaio_adcs; 2105 spec->input_mux = &vaio_mux; 2106 spec->mux_nids = vaio_mux_nids; 2107 break; 2108 } 2109 2110 codec->patch_ops = stac9872_patch_ops; 2111 return 0; 2112 } 2113 2114 2115 /* 1512 2116 * patch entries 1513 2117 */ … … 1515 2119 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, 1516 2120 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, 1517 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, 1518 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac922x }, 1519 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac922x }, 1520 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac922x }, 1521 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac922x }, 1522 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac922x }, 1523 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac922x }, 2121 { .id = 0x83847680, .name = "STAC9221 A1", .patch = patch_stac922x }, 1524 2122 { .id = 0x83847880, .name = "STAC9220 A2", .patch = patch_stac922x }, 1525 2123 { .id = 0x83847681, .name = "STAC9220D/9223D A2", .patch = patch_stac922x }, 1526 2124 { .id = 0x83847682, .name = "STAC9221 A2", .patch = patch_stac922x }, 1527 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, 1528 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, 1529 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, 1530 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, 1531 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, 1532 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, 1533 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, 1534 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, 1535 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, 1536 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, 1537 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, 1538 { .id = 0x83847661, .name = "STAC7661", .patch = patch_stac7661 }, 2125 { .id = 0x83847683, .name = "STAC9221D A2", .patch = patch_stac922x }, 2126 { .id = 0x83847618, .name = "STAC9227", .patch = patch_stac927x }, 2127 { .id = 0x83847619, .name = "STAC9227", .patch = patch_stac927x }, 2128 { .id = 0x83847616, .name = "STAC9228", .patch = patch_stac927x }, 2129 { .id = 0x83847617, .name = "STAC9228", .patch = patch_stac927x }, 2130 { .id = 0x83847614, .name = "STAC9229", .patch = patch_stac927x }, 2131 { .id = 0x83847615, .name = "STAC9229", .patch = patch_stac927x }, 2132 { .id = 0x83847620, .name = "STAC9274", .patch = patch_stac927x }, 2133 { .id = 0x83847621, .name = "STAC9274D", .patch = patch_stac927x }, 2134 { .id = 0x83847622, .name = "STAC9273X", .patch = patch_stac927x }, 2135 { .id = 0x83847623, .name = "STAC9273D", .patch = patch_stac927x }, 2136 { .id = 0x83847624, .name = "STAC9272X", .patch = patch_stac927x }, 2137 { .id = 0x83847625, .name = "STAC9272D", .patch = patch_stac927x }, 2138 { .id = 0x83847626, .name = "STAC9271X", .patch = patch_stac927x }, 2139 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x }, 2140 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x }, 2141 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x }, 2142 /* The following does not take into account .id=0x83847661 when subsys = 2143 * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are 2144 * currently not fully supported. 2145 */ 2146 { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 }, 2147 { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 }, 2148 { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 }, 2149 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 }, 2150 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 }, 2151 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 }, 2152 { .id = 0x838476a3, .name = "STAC9204D", .patch = patch_stac9205 }, 2153 { .id = 0x838476a4, .name = "STAC9255", .patch = patch_stac9205 }, 2154 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 }, 2155 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 }, 2156 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 }, 1539 2157 {0} /* terminator */ 1540 2158 }; -
GPL/trunk/alsa-kernel/pci/intel8x0.c
r77 r86 2294 2294 /* put logic to right state */ 2295 2295 /* first clear status bits */ 2296 #if 1 // noone do it. wtf? //vladest 06.10.2003 13:512297 2296 status = ICH_RCS | ICH_MCINT | ICH_POINT | ICH_PIINT; 2298 2297 if (chip->device_type == DEVICE_NFORCE) … … 2300 2299 cnt = igetdword(chip, ICHREG(GLOB_STA)); 2301 2300 iputdword(chip, ICHREG(GLOB_STA), cnt & status); 2302 #endif2303 // hmm. at least we should try2304 //iputdword(chip, ICHREG(GLOB_CNT), igetdword(chip, ICHREG(GLOB_CNT)) & ~ICH_AC97COLD);2305 2301 /* ACLink on, 2 channels */ 2306 2302 cnt = igetdword(chip, ICHREG(GLOB_CNT)); 2307 // added by vladest2308 2303 // cnt &= ~ICH_ACLINK; 2309 2304 cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK); 2310 #ifdef CONFIG_SND_AC97_POWER_SAVE 2305 #if 0 2306 //def CONFIG_SND_AC97_POWER_SAVE 2311 2307 /* do cold reset - the full ac97 powerdown may leave the controller 2312 2308 * in a warm state but actually it cannot communicate with the codec. … … 2319 2315 #else 2320 2316 cnt |= (cnt & ICH_AC97COLD) == 0 ? ICH_AC97COLD : ICH_AC97WARM; 2321 2322 // ??? 25.03.2004 by vladest cnt &= ~(ICH_ACLINK | ICH_PCM_246_MASK);2323 // FIXME!!! cmi drivers didnt uses ICH_PCM_246_MASK2324 2317 /* finish cold or do warm reset */ 2325 2318 #ifdef DEBUG … … 2327 2320 #endif 2328 2321 iputdword(chip, ICHREG(GLOB_CNT), cnt); 2329 //mdelay(500); //vladest 06.10.2003 15:082322 mdelay(500); //vladest 06.10.2003 15:08 2330 2323 end_time = (jiffies + (HZ / 4)) + 1; 2331 2324 i = 0;
Note:
See TracChangeset
for help on using the changeset viewer.