aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-08-10 11:11:07 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:58:43 -0400
commit47fd830acf0b6b5bc75db55d0f2cc64f59a23b5f (patch)
tree920b7e2cdce7120ff96417d74b911c3d5b95c21b /sound/pci/hda/patch_realtek.c
parent82beb8fd365afe3891b277c46425083f13e23c56 (diff)
[ALSA] hda-codec - add snd_hda_codec_stereo() function
Added snd_hda_codec_amp_stereo() function that changes both of stereo channels with the same mask and value bits. It simplifies most of amp-handling codes. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c325
1 files changed, 118 insertions, 207 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 63011133e3fb..29119fd4017d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -457,23 +457,15 @@ static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
457 * this turns out to be necessary in the future. 457 * this turns out to be necessary in the future.
458 */ 458 */
459 if (val <= 2) { 459 if (val <= 2) {
460 snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0, 460 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
461 0x80, 0x80); 461 HDA_AMP_MUTE, HDA_AMP_MUTE);
462 snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0, 462 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
463 0x80, 0x80); 463 HDA_AMP_MUTE, 0);
464 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 0,
465 0x80, 0x00);
466 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 0,
467 0x80, 0x00);
468 } else { 464 } else {
469 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 0, 465 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
470 0x80, 0x80); 466 HDA_AMP_MUTE, HDA_AMP_MUTE);
471 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 0, 467 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
472 0x80, 0x80); 468 HDA_AMP_MUTE, 0);
473 snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0,
474 0x80, 0x00);
475 snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0,
476 0x80, 0x00);
477 } 469 }
478 } 470 }
479 return change; 471 return change;
@@ -1559,15 +1551,11 @@ static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1559 1551
1560 present = snd_hda_codec_read(codec, 0x14, 0, 1552 present = snd_hda_codec_read(codec, 0x14, 0,
1561 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1553 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1562 bits = present ? 0x80 : 0; 1554 bits = present ? HDA_AMP_MUTE : 0;
1563 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 1555 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1564 0x80, bits); 1556 HDA_AMP_MUTE, bits);
1565 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 1557 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1566 0x80, bits); 1558 HDA_AMP_MUTE, bits);
1567 snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0,
1568 0x80, bits);
1569 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0,
1570 0x80, bits);
1571} 1559}
1572 1560
1573/* auto-toggle front mic */ 1561/* auto-toggle front mic */
@@ -1578,11 +1566,8 @@ static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1578 1566
1579 present = snd_hda_codec_read(codec, 0x18, 0, 1567 present = snd_hda_codec_read(codec, 0x18, 0,
1580 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1568 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1581 bits = present ? 0x80 : 0; 1569 bits = present ? HDA_AMP_MUTE : 0;
1582 snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, 1570 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1583 0x80, bits);
1584 snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1,
1585 0x80, bits);
1586} 1571}
1587 1572
1588static void alc880_uniwill_automute(struct hda_codec *codec) 1573static void alc880_uniwill_automute(struct hda_codec *codec)
@@ -1614,11 +1599,8 @@ static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1614 1599
1615 present = snd_hda_codec_read(codec, 0x14, 0, 1600 present = snd_hda_codec_read(codec, 0x14, 0,
1616 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1601 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1617 bits = present ? 0x80 : 0; 1602 bits = present ? HDA_AMP_MUTE : 0;
1618 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, 1603 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1619 0x80, bits);
1620 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0,
1621 0x80, bits);
1622} 1604}
1623 1605
1624static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) 1606static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
@@ -1626,19 +1608,14 @@ static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1626 unsigned int present; 1608 unsigned int present;
1627 1609
1628 present = snd_hda_codec_read(codec, 0x21, 0, 1610 present = snd_hda_codec_read(codec, 0x21, 0,
1629 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; 1611 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1630 1612 present &= HDA_AMP_VOLMASK;
1631 snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, 1613 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1632 0x7f, present); 1614 HDA_AMP_VOLMASK, present);
1633 snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, 1615 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1634 0x7f, present); 1616 HDA_AMP_VOLMASK, present);
1635
1636 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0,
1637 0x7f, present);
1638 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0,
1639 0x7f, present);
1640
1641} 1617}
1618
1642static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, 1619static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1643 unsigned int res) 1620 unsigned int res)
1644{ 1621{
@@ -1891,11 +1868,9 @@ static void alc880_lg_automute(struct hda_codec *codec)
1891 1868
1892 present = snd_hda_codec_read(codec, 0x1b, 0, 1869 present = snd_hda_codec_read(codec, 0x1b, 0,
1893 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1870 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1894 bits = present ? 0x80 : 0; 1871 bits = present ? HDA_AMP_MUTE : 0;
1895 snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, 1872 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
1896 0x80, bits); 1873 HDA_AMP_MUTE, bits);
1897 snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0,
1898 0x80, bits);
1899} 1874}
1900 1875
1901static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) 1876static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
@@ -1990,11 +1965,9 @@ static void alc880_lg_lw_automute(struct hda_codec *codec)
1990 1965
1991 present = snd_hda_codec_read(codec, 0x1b, 0, 1966 present = snd_hda_codec_read(codec, 0x1b, 0,
1992 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1967 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1993 bits = present ? 0x80 : 0; 1968 bits = present ? HDA_AMP_MUTE : 0;
1994 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 1969 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1995 0x80, bits); 1970 HDA_AMP_MUTE, bits);
1996 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
1997 0x80, bits);
1998} 1971}
1999 1972
2000static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) 1973static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
@@ -2363,11 +2336,10 @@ static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2363 snd_hda_codec_write_cache(codec, nid, 0, 2336 snd_hda_codec_write_cache(codec, nid, 0,
2364 AC_VERB_SET_PIN_WIDGET_CONTROL, 2337 AC_VERB_SET_PIN_WIDGET_CONTROL,
2365 new_ctl); 2338 new_ctl);
2366 val = ucontrol->value.enumerated.item[0] >= 3 ? 0x80 : 0x00; 2339 val = ucontrol->value.enumerated.item[0] >= 3 ?
2367 snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0, 2340 HDA_AMP_MUTE : 0;
2368 0x80, val); 2341 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2369 snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0, 2342 HDA_AMP_MUTE, val);
2370 0x80, val);
2371 return 1; 2343 return 1;
2372 } 2344 }
2373 return 0; 2345 return 0;
@@ -4791,13 +4763,10 @@ static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
4791 if (*cur_val == idx) 4763 if (*cur_val == idx)
4792 return 0; 4764 return 0;
4793 for (i = 0; i < imux->num_items; i++) { 4765 for (i = 0; i < imux->num_items; i++) {
4794 unsigned int v = (i == idx) ? 0x00 : 0x80; 4766 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
4795 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 4767 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
4796 imux->items[i].index,
4797 0x80, v);
4798 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT,
4799 imux->items[i].index, 4768 imux->items[i].index,
4800 0x80, v); 4769 HDA_AMP_MUTE, v);
4801 } 4770 }
4802 *cur_val = idx; 4771 *cur_val = idx;
4803 return 1; 4772 return 1;
@@ -5134,14 +5103,10 @@ static void alc885_imac24_automute(struct hda_codec *codec)
5134 5103
5135 present = snd_hda_codec_read(codec, 0x14, 0, 5104 present = snd_hda_codec_read(codec, 0x14, 0,
5136 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 5105 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5137 snd_hda_codec_amp_update(codec, 0x18, 0, HDA_OUTPUT, 0, 5106 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5138 0x80, present ? 0x80 : 0); 5107 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5139 snd_hda_codec_amp_update(codec, 0x18, 1, HDA_OUTPUT, 0, 5108 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5140 0x80, present ? 0x80 : 0); 5109 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5141 snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_OUTPUT, 0,
5142 0x80, present ? 0x80 : 0);
5143 snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_OUTPUT, 0,
5144 0x80, present ? 0x80 : 0);
5145} 5110}
5146 5111
5147/* Processes unsolicited events. */ 5112/* Processes unsolicited events. */
@@ -5178,10 +5143,8 @@ static void alc882_targa_automute(struct hda_codec *codec)
5178 5143
5179 present = snd_hda_codec_read(codec, 0x14, 0, 5144 present = snd_hda_codec_read(codec, 0x14, 0,
5180 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 5145 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5181 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, 5146 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5182 0x80, present ? 0x80 : 0); 5147 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5183 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
5184 0x80, present ? 0x80 : 0);
5185 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, 5148 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5186 present ? 1 : 3); 5149 present ? 1 : 3);
5187} 5150}
@@ -5776,13 +5739,10 @@ static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
5776 if (*cur_val == idx) 5739 if (*cur_val == idx)
5777 return 0; 5740 return 0;
5778 for (i = 0; i < imux->num_items; i++) { 5741 for (i = 0; i < imux->num_items; i++) {
5779 unsigned int v = (i == idx) ? 0x00 : 0x80; 5742 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5780 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 5743 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5781 imux->items[i].index, 5744 imux->items[i].index,
5782 0x80, v); 5745 HDA_AMP_MUTE, v);
5783 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT,
5784 imux->items[i].index,
5785 0x80, v);
5786 } 5746 }
5787 *cur_val = idx; 5747 *cur_val = idx;
5788 return 1; 5748 return 1;
@@ -6421,15 +6381,10 @@ static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
6421 6381
6422 present = snd_hda_codec_read(codec, 0x1b, 0, 6382 present = snd_hda_codec_read(codec, 0x1b, 0,
6423 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6383 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6424 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 6384 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6425 0x80, present ? 0x80 : 0); 6385 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6426 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 6386 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6427 0x80, present ? 0x80 : 0); 6387 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6428 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6429 0x80, present ? 0x80 : 0);
6430 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6431 0x80, present ? 0x80 : 0);
6432
6433} 6388}
6434 6389
6435/* toggle RCA according to the front-jack state */ 6390/* toggle RCA according to the front-jack state */
@@ -6439,12 +6394,10 @@ static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
6439 6394
6440 present = snd_hda_codec_read(codec, 0x14, 0, 6395 present = snd_hda_codec_read(codec, 0x14, 0,
6441 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6396 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6442 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6397 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6443 0x80, present ? 0x80 : 0); 6398 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6444 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6445 0x80, present ? 0x80 : 0);
6446
6447} 6399}
6400
6448static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, 6401static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
6449 unsigned int res) 6402 unsigned int res)
6450{ 6403{
@@ -6483,10 +6436,8 @@ static void alc883_medion_md2_automute(struct hda_codec *codec)
6483 6436
6484 present = snd_hda_codec_read(codec, 0x14, 0, 6437 present = snd_hda_codec_read(codec, 0x14, 0,
6485 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6438 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6486 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6439 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6487 0x80, present ? 0x80 : 0); 6440 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6488 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6489 0x80, present ? 0x80 : 0);
6490} 6441}
6491 6442
6492static void alc883_medion_md2_unsol_event(struct hda_codec *codec, 6443static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
@@ -6504,11 +6455,9 @@ static void alc883_tagra_automute(struct hda_codec *codec)
6504 6455
6505 present = snd_hda_codec_read(codec, 0x14, 0, 6456 present = snd_hda_codec_read(codec, 0x14, 0,
6506 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6457 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6507 bits = present ? 0x80 : 0; 6458 bits = present ? HDA_AMP_MUTE : 0;
6508 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, 6459 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6509 0x80, bits); 6460 HDA_AMP_MUTE, bits);
6510 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
6511 0x80, bits);
6512 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, 6461 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6513 present ? 1 : 3); 6462 present ? 1 : 3);
6514} 6463}
@@ -6526,11 +6475,9 @@ static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
6526 6475
6527 present = snd_hda_codec_read(codec, 0x14, 0, 6476 present = snd_hda_codec_read(codec, 0x14, 0,
6528 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6477 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6529 bits = present ? 0x80 : 0; 6478 bits = present ? HDA_AMP_MUTE : 0;
6530 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6479 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6531 0x80, bits); 6480 HDA_AMP_MUTE, bits);
6532 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6533 0x80, bits);
6534} 6481}
6535 6482
6536static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) 6483static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
@@ -6540,15 +6487,11 @@ static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
6540 6487
6541 present = snd_hda_codec_read(codec, 0x1b, 0, 6488 present = snd_hda_codec_read(codec, 0x1b, 0,
6542 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6489 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6543 bits = present ? 0x80 : 0; 6490 bits = present ? HDA_AMP_MUTE : 0;
6544 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6491 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6545 0x80, bits); 6492 HDA_AMP_MUTE, bits);
6546 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 6493 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6547 0x80, bits); 6494 HDA_AMP_MUTE, bits);
6548 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
6549 0x80, bits);
6550 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
6551 0x80, bits);
6552} 6495}
6553 6496
6554static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, 6497static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
@@ -7347,18 +7290,13 @@ static void alc262_hippo_automute(struct hda_codec *codec)
7347 spec->jack_present = (present & 0x80000000) != 0; 7290 spec->jack_present = (present & 0x80000000) != 0;
7348 if (spec->jack_present) { 7291 if (spec->jack_present) {
7349 /* mute internal speaker */ 7292 /* mute internal speaker */
7350 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7293 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7351 0x80, 0x80); 7294 HDA_AMP_MUTE, HDA_AMP_MUTE);
7352 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7353 0x80, 0x80);
7354 } else { 7295 } else {
7355 /* unmute internal speaker if necessary */ 7296 /* unmute internal speaker if necessary */
7356 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); 7297 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
7357 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7298 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7358 0x80, mute & 0x80); 7299 HDA_AMP_MUTE, mute);
7359 mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0);
7360 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7361 0x80, mute & 0x80);
7362 } 7300 }
7363} 7301}
7364 7302
@@ -7382,18 +7320,13 @@ static void alc262_hippo1_automute(struct hda_codec *codec)
7382 present = (present & 0x80000000) != 0; 7320 present = (present & 0x80000000) != 0;
7383 if (present) { 7321 if (present) {
7384 /* mute internal speaker */ 7322 /* mute internal speaker */
7385 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7323 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7386 0x80, 0x80); 7324 HDA_AMP_MUTE, HDA_AMP_MUTE);
7387 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7388 0x80, 0x80);
7389 } else { 7325 } else {
7390 /* unmute internal speaker if necessary */ 7326 /* unmute internal speaker if necessary */
7391 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); 7327 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
7392 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7328 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7393 0x80, mute & 0x80); 7329 HDA_AMP_MUTE, mute);
7394 mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0);
7395 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7396 0x80, mute & 0x80);
7397 } 7330 }
7398} 7331}
7399 7332
@@ -7455,18 +7388,13 @@ static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
7455 } 7388 }
7456 if (spec->jack_present) { 7389 if (spec->jack_present) {
7457 /* mute internal speaker */ 7390 /* mute internal speaker */
7458 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 7391 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7459 0x80, 0x80); 7392 HDA_AMP_MUTE, HDA_AMP_MUTE);
7460 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7461 0x80, 0x80);
7462 } else { 7393 } else {
7463 /* unmute internal speaker if necessary */ 7394 /* unmute internal speaker if necessary */
7464 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); 7395 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
7465 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 7396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7466 0x80, mute & 0x80); 7397 HDA_AMP_MUTE, mute);
7467 mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0);
7468 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7469 0x80, mute & 0x80);
7470 } 7398 }
7471} 7399}
7472 7400
@@ -7488,13 +7416,13 @@ static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol,
7488 int change; 7416 int change;
7489 7417
7490 change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, 7418 change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0,
7491 0x7f, valp[0] & 0x7f); 7419 HDA_AMP_VOLMASK, valp[0]);
7492 change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, 7420 change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0,
7493 0x7f, valp[1] & 0x7f); 7421 HDA_AMP_VOLMASK, valp[1]);
7494 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, 7422 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0,
7495 0x7f, valp[0] & 0x7f); 7423 HDA_AMP_VOLMASK, valp[0]);
7496 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, 7424 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0,
7497 0x7f, valp[1] & 0x7f); 7425 HDA_AMP_VOLMASK, valp[1]);
7498 return change; 7426 return change;
7499} 7427}
7500 7428
@@ -7507,9 +7435,11 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
7507 int change; 7435 int change;
7508 7436
7509 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7437 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7510 0x80, valp[0] ? 0 : 0x80); 7438 HDA_AMP_MUTE,
7439 valp[0] ? 0 : HDA_AMP_MUTE);
7511 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 7440 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7512 0x80, valp[1] ? 0 : 0x80); 7441 HDA_AMP_MUTE,
7442 valp[1] ? 0 : HDA_AMP_MUTE);
7513 if (change) 7443 if (change)
7514 alc262_fujitsu_automute(codec, 0); 7444 alc262_fujitsu_automute(codec, 0);
7515 return change; 7445 return change;
@@ -8331,11 +8261,10 @@ static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
8331 if (*cur_val == idx) 8261 if (*cur_val == idx)
8332 return 0; 8262 return 0;
8333 for (i = 0; i < imux->num_items; i++) { 8263 for (i = 0; i < imux->num_items; i++) {
8334 unsigned int v = (i == idx) ? 0x00 : 0x80; 8264 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
8335 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 8265 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
8336 imux->items[i].index, 0x80, v); 8266 imux->items[i].index,
8337 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 8267 HDA_AMP_MUTE, v);
8338 imux->items[i].index, 0x80, v);
8339 snd_hda_codec_write_cache(codec, nid, 0, 8268 snd_hda_codec_write_cache(codec, nid, 0,
8340 AC_VERB_SET_CONNECT_SEL, 8269 AC_VERB_SET_CONNECT_SEL,
8341 idx ); 8270 idx );
@@ -9328,14 +9257,10 @@ static void alc861_toshiba_automute(struct hda_codec *codec)
9328 9257
9329 present = snd_hda_codec_read(codec, 0x0f, 0, 9258 present = snd_hda_codec_read(codec, 0x0f, 0,
9330 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 9259 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9331 snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, 9260 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
9332 0x80, present ? 0x80 : 0); 9261 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9333 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, 9262 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
9334 0x80, present ? 0x80 : 0); 9263 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
9335 snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3,
9336 0x80, present ? 0 : 0x80);
9337 snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3,
9338 0x80, present ? 0 : 0x80);
9339} 9264}
9340 9265
9341static void alc861_toshiba_unsol_event(struct hda_codec *codec, 9266static void alc861_toshiba_unsol_event(struct hda_codec *codec,
@@ -9922,11 +9847,10 @@ static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
9922 if (*cur_val == idx) 9847 if (*cur_val == idx)
9923 return 0; 9848 return 0;
9924 for (i = 0; i < imux->num_items; i++) { 9849 for (i = 0; i < imux->num_items; i++) {
9925 unsigned int v = (i == idx) ? 0x00 : 0x80; 9850 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
9926 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 9851 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
9927 imux->items[i].index, 0x80, v); 9852 imux->items[i].index,
9928 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 9853 HDA_AMP_MUTE, v);
9929 imux->items[i].index, 0x80, v);
9930 } 9854 }
9931 *cur_val = idx; 9855 *cur_val = idx;
9932 return 1; 9856 return 1;
@@ -10261,11 +10185,9 @@ static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
10261 10185
10262 present = snd_hda_codec_read(codec, 0x1b, 0, 10186 present = snd_hda_codec_read(codec, 0x1b, 0,
10263 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 10187 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10264 bits = present ? 0x80 : 0; 10188 bits = present ? HDA_AMP_MUTE : 0;
10265 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 10189 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10266 0x80, bits); 10190 HDA_AMP_MUTE, bits);
10267 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10268 0x80, bits);
10269} 10191}
10270 10192
10271static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) 10193static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
@@ -10275,11 +10197,9 @@ static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
10275 10197
10276 present = snd_hda_codec_read(codec, 0x18, 0, 10198 present = snd_hda_codec_read(codec, 0x18, 0,
10277 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 10199 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10278 bits = present ? 0x80 : 0; 10200 bits = present ? HDA_AMP_MUTE : 0;
10279 snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, 10201 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
10280 0x80, bits); 10202 HDA_AMP_MUTE, bits);
10281 snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1,
10282 0x80, bits);
10283} 10203}
10284 10204
10285static void alc861vd_lenovo_automute(struct hda_codec *codec) 10205static void alc861vd_lenovo_automute(struct hda_codec *codec)
@@ -10353,10 +10273,8 @@ static void alc861vd_dallas_automute(struct hda_codec *codec)
10353 10273
10354 present = snd_hda_codec_read(codec, 0x15, 0, 10274 present = snd_hda_codec_read(codec, 0x15, 0,
10355 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 10275 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10356 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 10276 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10357 0x80, present ? 0x80 : 0); 10277 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10358 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10359 0x80, present ? 0x80 : 0);
10360} 10278}
10361 10279
10362static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) 10280static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
@@ -10855,11 +10773,10 @@ static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
10855 if (*cur_val == idx) 10773 if (*cur_val == idx)
10856 return 0; 10774 return 0;
10857 for (i = 0; i < imux->num_items; i++) { 10775 for (i = 0; i < imux->num_items; i++) {
10858 unsigned int v = (i == idx) ? 0x00 : 0x80; 10776 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
10859 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 10777 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
10860 imux->items[i].index, 0x80, v); 10778 imux->items[i].index,
10861 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 10779 HDA_AMP_MUTE, v);
10862 imux->items[i].index, 0x80, v);
10863 } 10780 }
10864 *cur_val = idx; 10781 *cur_val = idx;
10865 return 1; 10782 return 1;
@@ -11204,11 +11121,9 @@ static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
11204 11121
11205 present = snd_hda_codec_read(codec, 0x14, 0, 11122 present = snd_hda_codec_read(codec, 0x14, 0,
11206 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 11123 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11207 bits = present ? 0x80 : 0; 11124 bits = present ? HDA_AMP_MUTE : 0;
11208 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 11125 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11209 0x80, bits); 11126 HDA_AMP_MUTE, bits);
11210 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
11211 0x80, bits);
11212} 11127}
11213 11128
11214static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) 11129static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
@@ -11218,15 +11133,11 @@ static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
11218 11133
11219 present = snd_hda_codec_read(codec, 0x1b, 0, 11134 present = snd_hda_codec_read(codec, 0x1b, 0,
11220 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 11135 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11221 bits = present ? 0x80 : 0; 11136 bits = present ? HDA_AMP_MUTE : 0;
11222 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 11137 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11223 0x80, bits); 11138 HDA_AMP_MUTE, bits);
11224 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 11139 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11225 0x80, bits); 11140 HDA_AMP_MUTE, bits);
11226 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11227 0x80, bits);
11228 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11229 0x80, bits);
11230} 11141}
11231 11142
11232static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, 11143static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,