aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-01-19 09:53:43 -0500
committerTakashi Iwai <tiwai@suse.de>2010-01-19 09:53:43 -0500
commit9e4c84967ef027fe50a03cf48dd6da9519c8e60c (patch)
tree21d6b8168670f22521f3bb703e3b9d1932566c1c /sound/pci
parentd2f2fcd2541bae004db7f4798ffd9d2cb75ae817 (diff)
parent3fb4a508b8e7957aa899f32cd6d9d462e102c7ca (diff)
Merge branch 'fix/hda' into topic/hda
Conflicts: sound/pci/hda/patch_realtek.c
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/ac97/ac97_codec.c10
-rw-r--r--sound/pci/ac97/ac97_id.h2
-rw-r--r--sound/pci/ac97/ac97_patch.c1
-rw-r--r--sound/pci/atiixp.c1
-rw-r--r--sound/pci/hda/hda_beep.c16
-rw-r--r--sound/pci/hda/hda_codec.c10
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/patch_analog.c16
-rw-r--r--sound/pci/hda/patch_realtek.c133
-rw-r--r--sound/pci/hda/patch_sigmatel.c79
-rw-r--r--sound/pci/riptide/riptide.c2
11 files changed, 208 insertions, 63 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index c11920623009..a7630e9edf8a 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -83,6 +83,7 @@ static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = {
83{ 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL }, 83{ 0x4e534300, 0xffffff00, "National Semiconductor", NULL, NULL },
84{ 0x50534300, 0xffffff00, "Philips", NULL, NULL }, 84{ 0x50534300, 0xffffff00, "Philips", NULL, NULL },
85{ 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL }, 85{ 0x53494c00, 0xffffff00, "Silicon Laboratory", NULL, NULL },
86{ 0x53544d00, 0xffffff00, "STMicroelectronics", NULL, NULL },
86{ 0x54524100, 0xffffff00, "TriTech", NULL, NULL }, 87{ 0x54524100, 0xffffff00, "TriTech", NULL, NULL },
87{ 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL }, 88{ 0x54584e00, 0xffffff00, "Texas Instruments", NULL, NULL },
88{ 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL }, 89{ 0x56494100, 0xffffff00, "VIA Technologies", NULL, NULL },
@@ -161,6 +162,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
161{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix 162{ 0x4e534350, 0xffffffff, "LM4550", patch_lm4550, NULL }, // volume wrap fix
162{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL }, 163{ 0x50534304, 0xffffffff, "UCB1400", patch_ucb1400, NULL },
163{ 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH }, 164{ 0x53494c20, 0xffffffe0, "Si3036,8", mpatch_si3036, mpatch_si3036, AC97_MODEM_PATCH },
165{ 0x53544d02, 0xffffffff, "ST7597", NULL, NULL },
164{ 0x54524102, 0xffffffff, "TR28022", NULL, NULL }, 166{ 0x54524102, 0xffffffff, "TR28022", NULL, NULL },
165{ 0x54524103, 0xffffffff, "TR28023", NULL, NULL }, 167{ 0x54524103, 0xffffffff, "TR28023", NULL, NULL },
166{ 0x54524106, 0xffffffff, "TR28026", NULL, NULL }, 168{ 0x54524106, 0xffffffff, "TR28026", NULL, NULL },
@@ -213,6 +215,14 @@ static int snd_ac97_valid_reg(struct snd_ac97 *ac97, unsigned short reg)
213{ 215{
214 /* filter some registers for buggy codecs */ 216 /* filter some registers for buggy codecs */
215 switch (ac97->id) { 217 switch (ac97->id) {
218 case AC97_ID_ST_AC97_ID4:
219 if (reg == 0x08)
220 return 0;
221 /* fall through */
222 case AC97_ID_ST7597:
223 if (reg == 0x22 || reg == 0x7a)
224 return 1;
225 /* fall through */
216 case AC97_ID_AK4540: 226 case AC97_ID_AK4540:
217 case AC97_ID_AK4542: 227 case AC97_ID_AK4542:
218 if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c) 228 if (reg <= 0x1c || reg == 0x20 || reg == 0x26 || reg >= 0x7c)
diff --git a/sound/pci/ac97/ac97_id.h b/sound/pci/ac97/ac97_id.h
index c129492c82b3..d603147c4a96 100644
--- a/sound/pci/ac97/ac97_id.h
+++ b/sound/pci/ac97/ac97_id.h
@@ -62,3 +62,5 @@
62#define AC97_ID_CM9761_78 0x434d4978 62#define AC97_ID_CM9761_78 0x434d4978
63#define AC97_ID_CM9761_82 0x434d4982 63#define AC97_ID_CM9761_82 0x434d4982
64#define AC97_ID_CM9761_83 0x434d4983 64#define AC97_ID_CM9761_83 0x434d4983
65#define AC97_ID_ST7597 0x53544d02
66#define AC97_ID_ST_AC97_ID4 0x53544d04
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index e288a5595f34..1caf5e3c1f6a 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1855,6 +1855,7 @@ static unsigned int ad1981_jacks_blacklist[] = {
1855 0x10140554, /* Thinkpad T42p/R50p */ 1855 0x10140554, /* Thinkpad T42p/R50p */
1856 0x10140567, /* Thinkpad T43p 2668-G7U */ 1856 0x10140567, /* Thinkpad T43p 2668-G7U */
1857 0x10140581, /* Thinkpad X41-2527 */ 1857 0x10140581, /* Thinkpad X41-2527 */
1858 0x10280160, /* Dell Dimension 2400 */
1858 0x104380b0, /* Asus A7V8X-MX */ 1859 0x104380b0, /* Asus A7V8X-MX */
1859 0x11790241, /* Toshiba Satellite A-15 S127 */ 1860 0x11790241, /* Toshiba Satellite A-15 S127 */
1860 0x144dc01a, /* Samsung NP-X20C004/SEG */ 1861 0x144dc01a, /* Samsung NP-X20C004/SEG */
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index d6752dff2a44..42b4fbbd8e2b 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -297,6 +297,7 @@ static struct pci_device_id snd_atiixp_ids[] = {
297MODULE_DEVICE_TABLE(pci, snd_atiixp_ids); 297MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
298 298
299static struct snd_pci_quirk atiixp_quirks[] __devinitdata = { 299static struct snd_pci_quirk atiixp_quirks[] __devinitdata = {
300 SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0),
300 SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0), 301 SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0),
301 { } /* terminator */ 302 { } /* terminator */
302}; 303};
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 5fe34a8d8c81..e4581a42ace5 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -42,7 +42,7 @@ static void snd_hda_generate_beep(struct work_struct *work)
42 return; 42 return;
43 43
44 /* generate tone */ 44 /* generate tone */
45 snd_hda_codec_write_cache(codec, beep->nid, 0, 45 snd_hda_codec_write(codec, beep->nid, 0,
46 AC_VERB_SET_BEEP_CONTROL, beep->tone); 46 AC_VERB_SET_BEEP_CONTROL, beep->tone);
47} 47}
48 48
@@ -119,7 +119,7 @@ static void snd_hda_do_detach(struct hda_beep *beep)
119 beep->dev = NULL; 119 beep->dev = NULL;
120 cancel_work_sync(&beep->beep_work); 120 cancel_work_sync(&beep->beep_work);
121 /* turn off beep for sure */ 121 /* turn off beep for sure */
122 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 122 snd_hda_codec_write(beep->codec, beep->nid, 0,
123 AC_VERB_SET_BEEP_CONTROL, 0); 123 AC_VERB_SET_BEEP_CONTROL, 0);
124} 124}
125 125
@@ -192,7 +192,7 @@ int snd_hda_enable_beep_device(struct hda_codec *codec, int enable)
192 beep->enabled = enable; 192 beep->enabled = enable;
193 if (!enable) { 193 if (!enable) {
194 /* turn off beep */ 194 /* turn off beep */
195 snd_hda_codec_write_cache(beep->codec, beep->nid, 0, 195 snd_hda_codec_write(beep->codec, beep->nid, 0,
196 AC_VERB_SET_BEEP_CONTROL, 0); 196 AC_VERB_SET_BEEP_CONTROL, 0);
197 } 197 }
198 if (beep->mode == HDA_BEEP_MODE_SWREG) { 198 if (beep->mode == HDA_BEEP_MODE_SWREG) {
@@ -239,8 +239,12 @@ int snd_hda_attach_beep_device(struct hda_codec *codec, int nid)
239 mutex_init(&beep->mutex); 239 mutex_init(&beep->mutex);
240 240
241 if (beep->mode == HDA_BEEP_MODE_ON) { 241 if (beep->mode == HDA_BEEP_MODE_ON) {
242 beep->enabled = 1; 242 int err = snd_hda_do_attach(beep);
243 snd_hda_do_register(&beep->register_work); 243 if (err < 0) {
244 kfree(beep);
245 codec->beep = NULL;
246 return err;
247 }
244 } 248 }
245 249
246 return 0; 250 return 0;
@@ -253,7 +257,7 @@ void snd_hda_detach_beep_device(struct hda_codec *codec)
253 if (beep) { 257 if (beep) {
254 cancel_work_sync(&beep->register_work); 258 cancel_work_sync(&beep->register_work);
255 cancel_delayed_work(&beep->unregister_work); 259 cancel_delayed_work(&beep->unregister_work);
256 if (beep->enabled) 260 if (beep->dev)
257 snd_hda_do_detach(beep); 261 snd_hda_do_detach(beep);
258 codec->beep = NULL; 262 codec->beep = NULL;
259 kfree(beep); 263 kfree(beep);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index d02ea8926e7e..26ceace88c96 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1351,11 +1351,13 @@ EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps);
1351 */ 1351 */
1352u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid) 1352u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
1353{ 1353{
1354 u32 pincap = snd_hda_query_pin_caps(codec, nid); 1354 u32 pincap;
1355
1356 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1357 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1358 1355
1356 if (!codec->no_trigger_sense) {
1357 pincap = snd_hda_query_pin_caps(codec, nid);
1358 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1359 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
1360 }
1359 return snd_hda_codec_read(codec, nid, 0, 1361 return snd_hda_codec_read(codec, nid, 0,
1360 AC_VERB_GET_PIN_SENSE, 0); 1362 AC_VERB_GET_PIN_SENSE, 0);
1361} 1363}
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 11c4aa8ee996..0c8f05cc56be 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -818,6 +818,7 @@ struct hda_codec {
818 unsigned int pin_amp_workaround:1; /* pin out-amp takes index 818 unsigned int pin_amp_workaround:1; /* pin out-amp takes index
819 * (e.g. Conexant codecs) 819 * (e.g. Conexant codecs)
820 */ 820 */
821 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
821#ifdef CONFIG_SND_HDA_POWER_SAVE 822#ifdef CONFIG_SND_HDA_POWER_SAVE
822 unsigned int power_on :1; /* current (global) power-state */ 823 unsigned int power_on :1; /* current (global) power-state */
823 unsigned int power_transition :1; /* power-state in transition */ 824 unsigned int power_transition :1; /* power-state in transition */
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index cecd3c108990..21011b5199de 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1276,6 +1276,8 @@ static int patch_ad1986a(struct hda_codec *codec)
1276 */ 1276 */
1277 spec->multiout.no_share_stream = 1; 1277 spec->multiout.no_share_stream = 1;
1278 1278
1279 codec->no_trigger_sense = 1;
1280
1279 return 0; 1281 return 0;
1280} 1282}
1281 1283
@@ -1461,6 +1463,8 @@ static int patch_ad1983(struct hda_codec *codec)
1461 1463
1462 codec->patch_ops = ad198x_patch_ops; 1464 codec->patch_ops = ad198x_patch_ops;
1463 1465
1466 codec->no_trigger_sense = 1;
1467
1464 return 0; 1468 return 0;
1465} 1469}
1466 1470
@@ -1904,6 +1908,9 @@ static int patch_ad1981(struct hda_codec *codec)
1904 codec->patch_ops.unsol_event = ad1981_hp_unsol_event; 1908 codec->patch_ops.unsol_event = ad1981_hp_unsol_event;
1905 break; 1909 break;
1906 } 1910 }
1911
1912 codec->no_trigger_sense = 1;
1913
1907 return 0; 1914 return 0;
1908} 1915}
1909 1916
@@ -3211,6 +3218,8 @@ static int patch_ad1988(struct hda_codec *codec)
3211#endif 3218#endif
3212 spec->vmaster_nid = 0x04; 3219 spec->vmaster_nid = 0x04;
3213 3220
3221 codec->no_trigger_sense = 1;
3222
3214 return 0; 3223 return 0;
3215} 3224}
3216 3225
@@ -3423,6 +3432,8 @@ static int patch_ad1884(struct hda_codec *codec)
3423 3432
3424 codec->patch_ops = ad198x_patch_ops; 3433 codec->patch_ops = ad198x_patch_ops;
3425 3434
3435 codec->no_trigger_sense = 1;
3436
3426 return 0; 3437 return 0;
3427} 3438}
3428 3439
@@ -4383,6 +4394,8 @@ static int patch_ad1884a(struct hda_codec *codec)
4383 break; 4394 break;
4384 } 4395 }
4385 4396
4397 codec->no_trigger_sense = 1;
4398
4386 return 0; 4399 return 0;
4387} 4400}
4388 4401
@@ -4719,6 +4732,9 @@ static int patch_ad1882(struct hda_codec *codec)
4719 spec->mixers[2] = ad1882_6stack_mixers; 4732 spec->mixers[2] = ad1882_6stack_mixers;
4720 break; 4733 break;
4721 } 4734 }
4735
4736 codec->no_trigger_sense = 1;
4737
4722 return 0; 4738 return 0;
4723} 4739}
4724 4740
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 141ff446104a..c53faa959390 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1097,6 +1097,16 @@ static void alc889_coef_init(struct hda_codec *codec)
1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010); 1097 snd_hda_codec_write(codec, 0x20, 0, AC_VERB_SET_PROC_COEF, tmp|0x2010);
1098} 1098}
1099 1099
1100/* turn on/off EAPD control (only if available) */
1101static void set_eapd(struct hda_codec *codec, hda_nid_t nid, int on)
1102{
1103 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1104 return;
1105 if (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)
1106 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_EAPD_BTLENABLE,
1107 on ? 2 : 0);
1108}
1109
1100static void alc_auto_init_amp(struct hda_codec *codec, int type) 1110static void alc_auto_init_amp(struct hda_codec *codec, int type)
1101{ 1111{
1102 unsigned int tmp; 1112 unsigned int tmp;
@@ -1114,25 +1124,22 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
1114 case ALC_INIT_DEFAULT: 1124 case ALC_INIT_DEFAULT:
1115 switch (codec->vendor_id) { 1125 switch (codec->vendor_id) {
1116 case 0x10ec0260: 1126 case 0x10ec0260:
1117 snd_hda_codec_write(codec, 0x0f, 0, 1127 set_eapd(codec, 0x0f, 1);
1118 AC_VERB_SET_EAPD_BTLENABLE, 2); 1128 set_eapd(codec, 0x10, 1);
1119 snd_hda_codec_write(codec, 0x10, 0,
1120 AC_VERB_SET_EAPD_BTLENABLE, 2);
1121 break; 1129 break;
1122 case 0x10ec0262: 1130 case 0x10ec0262:
1123 case 0x10ec0267: 1131 case 0x10ec0267:
1124 case 0x10ec0268: 1132 case 0x10ec0268:
1125 case 0x10ec0269: 1133 case 0x10ec0269:
1134 case 0x10ec0270:
1126 case 0x10ec0272: 1135 case 0x10ec0272:
1127 case 0x10ec0660: 1136 case 0x10ec0660:
1128 case 0x10ec0662: 1137 case 0x10ec0662:
1129 case 0x10ec0663: 1138 case 0x10ec0663:
1130 case 0x10ec0862: 1139 case 0x10ec0862:
1131 case 0x10ec0889: 1140 case 0x10ec0889:
1132 snd_hda_codec_write(codec, 0x14, 0, 1141 set_eapd(codec, 0x14, 1);
1133 AC_VERB_SET_EAPD_BTLENABLE, 2); 1142 set_eapd(codec, 0x15, 1);
1134 snd_hda_codec_write(codec, 0x15, 0,
1135 AC_VERB_SET_EAPD_BTLENABLE, 2);
1136 break; 1143 break;
1137 } 1144 }
1138 switch (codec->vendor_id) { 1145 switch (codec->vendor_id) {
@@ -1234,6 +1241,8 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1234 return; /* invalid entry */ 1241 return; /* invalid entry */
1235 } 1242 }
1236 } 1243 }
1244 if (!ext || !fixed)
1245 return;
1237 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP)) 1246 if (!(get_wcaps(codec, ext) & AC_WCAP_UNSOL_CAP))
1238 return; /* no unsol support */ 1247 return; /* no unsol support */
1239 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n", 1248 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x\n",
@@ -3720,25 +3729,22 @@ static void alc_power_eapd(struct hda_codec *codec)
3720 /* We currently only handle front, HP */ 3729 /* We currently only handle front, HP */
3721 switch (codec->vendor_id) { 3730 switch (codec->vendor_id) {
3722 case 0x10ec0260: 3731 case 0x10ec0260:
3723 snd_hda_codec_write(codec, 0x0f, 0, 3732 set_eapd(codec, 0x0f, 0);
3724 AC_VERB_SET_EAPD_BTLENABLE, 0x00); 3733 set_eapd(codec, 0x10, 0);
3725 snd_hda_codec_write(codec, 0x10, 0,
3726 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3727 break; 3734 break;
3728 case 0x10ec0262: 3735 case 0x10ec0262:
3729 case 0x10ec0267: 3736 case 0x10ec0267:
3730 case 0x10ec0268: 3737 case 0x10ec0268:
3731 case 0x10ec0269: 3738 case 0x10ec0269:
3739 case 0x10ec0270:
3732 case 0x10ec0272: 3740 case 0x10ec0272:
3733 case 0x10ec0660: 3741 case 0x10ec0660:
3734 case 0x10ec0662: 3742 case 0x10ec0662:
3735 case 0x10ec0663: 3743 case 0x10ec0663:
3736 case 0x10ec0862: 3744 case 0x10ec0862:
3737 case 0x10ec0889: 3745 case 0x10ec0889:
3738 snd_hda_codec_write(codec, 0x14, 0, 3746 set_eapd(codec, 0x14, 0);
3739 AC_VERB_SET_EAPD_BTLENABLE, 0x00); 3747 set_eapd(codec, 0x15, 0);
3740 snd_hda_codec_write(codec, 0x15, 0,
3741 AC_VERB_SET_EAPD_BTLENABLE, 0x00);
3742 break; 3748 break;
3743 } 3749 }
3744} 3750}
@@ -4917,6 +4923,49 @@ static void fixup_automic_adc(struct hda_codec *codec)
4917 spec->auto_mic = 0; /* disable auto-mic to be sure */ 4923 spec->auto_mic = 0; /* disable auto-mic to be sure */
4918} 4924}
4919 4925
4926/* choose the ADC/MUX containing the input pin and initialize the setup */
4927static void fixup_single_adc(struct hda_codec *codec)
4928{
4929 struct alc_spec *spec = codec->spec;
4930 hda_nid_t pin;
4931 int i;
4932
4933 /* search for the input pin; there must be only one */
4934 for (i = 0; i < AUTO_PIN_LAST; i++) {
4935 if (spec->autocfg.input_pins[i]) {
4936 pin = spec->autocfg.input_pins[i];
4937 break;
4938 }
4939 }
4940 if (!pin)
4941 return;
4942
4943 /* set the default connection to that pin */
4944 for (i = 0; i < spec->num_adc_nids; i++) {
4945 hda_nid_t cap = spec->capsrc_nids ?
4946 spec->capsrc_nids[i] : spec->adc_nids[i];
4947 int idx;
4948
4949 idx = get_connection_index(codec, cap, pin);
4950 if (idx < 0)
4951 continue;
4952 /* use only this ADC */
4953 if (spec->capsrc_nids)
4954 spec->capsrc_nids += i;
4955 spec->adc_nids += i;
4956 spec->num_adc_nids = 1;
4957 /* select or unmute this route */
4958 if (get_wcaps_type(get_wcaps(codec, cap)) == AC_WID_AUD_MIX) {
4959 snd_hda_codec_amp_stereo(codec, cap, HDA_INPUT, idx,
4960 HDA_AMP_MUTE, 0);
4961 } else {
4962 snd_hda_codec_write_cache(codec, cap, 0,
4963 AC_VERB_SET_CONNECT_SEL, idx);
4964 }
4965 return;
4966 }
4967}
4968
4920static void set_capture_mixer(struct hda_codec *codec) 4969static void set_capture_mixer(struct hda_codec *codec)
4921{ 4970{
4922 struct alc_spec *spec = codec->spec; 4971 struct alc_spec *spec = codec->spec;
@@ -4929,14 +4978,15 @@ static void set_capture_mixer(struct hda_codec *codec)
4929 alc_capture_mixer3 }, 4978 alc_capture_mixer3 },
4930 }; 4979 };
4931 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) { 4980 if (spec->num_adc_nids > 0 && spec->num_adc_nids <= 3) {
4932 int mux; 4981 int mux = 0;
4933 if (spec->auto_mic) { 4982 if (spec->auto_mic)
4934 mux = 0;
4935 fixup_automic_adc(codec); 4983 fixup_automic_adc(codec);
4936 } else if (spec->input_mux && spec->input_mux->num_items > 1) 4984 else if (spec->input_mux) {
4937 mux = 1; 4985 if (spec->input_mux->num_items > 1)
4938 else 4986 mux = 1;
4939 mux = 0; 4987 else if (spec->input_mux->num_items == 1)
4988 fixup_single_adc(codec);
4989 }
4940 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1]; 4990 spec->cap_mixer = caps[mux][spec->num_adc_nids - 1];
4941 } 4991 }
4942} 4992}
@@ -7201,8 +7251,8 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {
7201 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), 7251 HDA_BIND_MUTE ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT),
7202 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), 7252 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT),
7203 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), 7253 HDA_BIND_MUTE ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT),
7204 HDA_CODEC_VOLUME("HP Playback Volume", 0x0f, 0x00, HDA_OUTPUT), 7254 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT),
7205 HDA_BIND_MUTE ("HP Playback Switch", 0x0f, 0x02, HDA_INPUT), 7255 HDA_BIND_MUTE ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT),
7206 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT), 7256 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
7207 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT), 7257 HDA_CODEC_MUTE ("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
7208 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 7258 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
@@ -7603,6 +7653,7 @@ static struct hda_verb alc885_mb5_init_verbs[] = {
7603 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, 7653 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
7604 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, 7654 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
7605 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, 7655 {0x14, AC_VERB_SET_CONNECT_SEL, 0x03},
7656 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
7606 /* Front Mic pin: input vref at 80% */ 7657 /* Front Mic pin: input vref at 80% */
7607 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, 7658 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
7608 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 7659 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
@@ -7787,6 +7838,27 @@ static void alc885_mbp3_setup(struct hda_codec *codec)
7787 spec->autocfg.speaker_pins[0] = 0x14; 7838 spec->autocfg.speaker_pins[0] = 0x14;
7788} 7839}
7789 7840
7841static void alc885_mb5_automute(struct hda_codec *codec)
7842{
7843 unsigned int present;
7844
7845 present = snd_hda_codec_read(codec, 0x14, 0,
7846 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
7847 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
7848 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7849 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
7850 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
7851
7852}
7853
7854static void alc885_mb5_unsol_event(struct hda_codec *codec,
7855 unsigned int res)
7856{
7857 /* Headphone insertion or removal. */
7858 if ((res >> 26) == ALC880_HP_EVENT)
7859 alc885_mb5_automute(codec);
7860}
7861
7790static void alc885_imac91_automute(struct hda_codec *codec) 7862static void alc885_imac91_automute(struct hda_codec *codec)
7791{ 7863{
7792 unsigned int present; 7864 unsigned int present;
@@ -9233,6 +9305,8 @@ static struct alc_config_preset alc882_presets[] = {
9233 .input_mux = &mb5_capture_source, 9305 .input_mux = &mb5_capture_source,
9234 .dig_out_nid = ALC882_DIGOUT_NID, 9306 .dig_out_nid = ALC882_DIGOUT_NID,
9235 .dig_in_nid = ALC882_DIGIN_NID, 9307 .dig_in_nid = ALC882_DIGIN_NID,
9308 .unsol_event = alc885_mb5_unsol_event,
9309 .init_hook = alc885_mb5_automute,
9236 }, 9310 },
9237 [ALC885_MACPRO] = { 9311 [ALC885_MACPRO] = {
9238 .mixers = { alc882_macpro_mixer }, 9312 .mixers = { alc882_macpro_mixer },
@@ -11310,7 +11384,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
11310} 11384}
11311 11385
11312#define alc262_auto_create_input_ctls \ 11386#define alc262_auto_create_input_ctls \
11313 alc880_auto_create_input_ctls 11387 alc882_auto_create_input_ctls
11314 11388
11315/* 11389/*
11316 * generic initialization of ADC, input mixers and output mixers 11390 * generic initialization of ADC, input mixers and output mixers
@@ -12605,6 +12679,7 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,
12605 dac = 0x02; 12679 dac = 0x02;
12606 break; 12680 break;
12607 case 0x15: 12681 case 0x15:
12682 case 0x21:
12608 dac = 0x03; 12683 dac = 0x03;
12609 break; 12684 break;
12610 default: 12685 default:
@@ -14991,6 +15066,8 @@ static int patch_alc861(struct hda_codec *codec)
14991 spec->stream_digital_playback = &alc861_pcm_digital_playback; 15066 spec->stream_digital_playback = &alc861_pcm_digital_playback;
14992 spec->stream_digital_capture = &alc861_pcm_digital_capture; 15067 spec->stream_digital_capture = &alc861_pcm_digital_capture;
14993 15068
15069 if (!spec->cap_mixer)
15070 set_capture_mixer(codec);
14994 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); 15071 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
14995 15072
14996 spec->vmaster_nid = 0x03; 15073 spec->vmaster_nid = 0x03;
@@ -15633,7 +15710,7 @@ static struct alc_config_preset alc861vd_presets[] = {
15633static int alc861vd_auto_create_input_ctls(struct hda_codec *codec, 15710static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,
15634 const struct auto_pin_cfg *cfg) 15711 const struct auto_pin_cfg *cfg)
15635{ 15712{
15636 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0); 15713 return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0);
15637} 15714}
15638 15715
15639 15716
@@ -17391,7 +17468,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
17391 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS), 17468 SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
17392 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K", 17469 SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
17393 ALC662_3ST_6ch_DIG), 17470 ALC662_3ST_6ch_DIG),
17394 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC663_ASUS_MODE4), 17471 SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB20x", ALC662_AUTO),
17395 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10), 17472 SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
17396 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L", 17473 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
17397 ALC662_3ST_6ch_DIG), 17474 ALC662_3ST_6ch_DIG),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index e28c810bc00c..dbffb5b5c69d 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -4460,14 +4460,7 @@ static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
4460{ 4460{
4461 if (!nid) 4461 if (!nid)
4462 return 0; 4462 return 0;
4463 /* NOTE: we can't use snd_hda_jack_detect() here because STAC/IDT 4463 return snd_hda_jack_detect(codec, nid);
4464 * codecs behave wrongly when SET_PIN_SENSE is triggered, although
4465 * the pincap gives TRIG_REQ bit.
4466 */
4467 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0) &
4468 AC_PINSENSE_PRESENCE)
4469 return 1;
4470 return 0;
4471} 4464}
4472 4465
4473static void stac92xx_line_out_detect(struct hda_codec *codec, 4466static void stac92xx_line_out_detect(struct hda_codec *codec,
@@ -4744,6 +4737,26 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4744 } 4737 }
4745} 4738}
4746 4739
4740static int hp_blike_system(u32 subsystem_id);
4741
4742static void set_hp_led_gpio(struct hda_codec *codec)
4743{
4744 struct sigmatel_spec *spec = codec->spec;
4745 switch (codec->vendor_id) {
4746 case 0x111d7608:
4747 /* GPIO 0 */
4748 spec->gpio_led = 0x01;
4749 break;
4750 case 0x111d7600:
4751 case 0x111d7601:
4752 case 0x111d7602:
4753 case 0x111d7603:
4754 /* GPIO 3 */
4755 spec->gpio_led = 0x08;
4756 break;
4757 }
4758}
4759
4747/* 4760/*
4748 * This method searches for the mute LED GPIO configuration 4761 * This method searches for the mute LED GPIO configuration
4749 * provided as OEM string in SMBIOS. The format of that string 4762 * provided as OEM string in SMBIOS. The format of that string
@@ -4755,6 +4768,14 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4755 * 4768 *
4756 * So, HP B-series like systems may have HP_Mute_LED_0 (current models) 4769 * So, HP B-series like systems may have HP_Mute_LED_0 (current models)
4757 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings 4770 * or HP_Mute_LED_0_3 (future models) OEM SMBIOS strings
4771 *
4772 *
4773 * The dv-series laptops don't seem to have the HP_Mute_LED* strings in
4774 * SMBIOS - at least the ones I have seen do not have them - which include
4775 * my own system (HP Pavilion dv6-1110ax) and my cousin's
4776 * HP Pavilion dv9500t CTO.
4777 * Need more information on whether it is true across the entire series.
4778 * -- kunal
4758 */ 4779 */
4759static int find_mute_led_gpio(struct hda_codec *codec) 4780static int find_mute_led_gpio(struct hda_codec *codec)
4760{ 4781{
@@ -4765,28 +4786,27 @@ static int find_mute_led_gpio(struct hda_codec *codec)
4765 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, 4786 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
4766 NULL, dev))) { 4787 NULL, dev))) {
4767 if (sscanf(dev->name, "HP_Mute_LED_%d_%d", 4788 if (sscanf(dev->name, "HP_Mute_LED_%d_%d",
4768 &spec->gpio_led_polarity, 4789 &spec->gpio_led_polarity,
4769 &spec->gpio_led) == 2) { 4790 &spec->gpio_led) == 2) {
4770 spec->gpio_led = 1 << spec->gpio_led; 4791 spec->gpio_led = 1 << spec->gpio_led;
4771 return 1; 4792 return 1;
4772 } 4793 }
4773 if (sscanf(dev->name, "HP_Mute_LED_%d", 4794 if (sscanf(dev->name, "HP_Mute_LED_%d",
4774 &spec->gpio_led_polarity) == 1) { 4795 &spec->gpio_led_polarity) == 1) {
4775 switch (codec->vendor_id) { 4796 set_hp_led_gpio(codec);
4776 case 0x111d7608: 4797 return 1;
4777 /* GPIO 0 */
4778 spec->gpio_led = 0x01;
4779 return 1;
4780 case 0x111d7600:
4781 case 0x111d7601:
4782 case 0x111d7602:
4783 case 0x111d7603:
4784 /* GPIO 3 */
4785 spec->gpio_led = 0x08;
4786 return 1;
4787 }
4788 } 4798 }
4789 } 4799 }
4800
4801 /*
4802 * Fallback case - if we don't find the DMI strings,
4803 * we statically set the GPIO - if not a B-series system.
4804 */
4805 if (!hp_blike_system(codec->subsystem_id)) {
4806 set_hp_led_gpio(codec);
4807 spec->gpio_led_polarity = 1;
4808 return 1;
4809 }
4790 } 4810 }
4791 return 0; 4811 return 0;
4792} 4812}
@@ -4969,6 +4989,7 @@ static int patch_stac9200(struct hda_codec *codec)
4969 if (spec == NULL) 4989 if (spec == NULL)
4970 return -ENOMEM; 4990 return -ENOMEM;
4971 4991
4992 codec->no_trigger_sense = 1;
4972 codec->spec = spec; 4993 codec->spec = spec;
4973 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids); 4994 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
4974 spec->pin_nids = stac9200_pin_nids; 4995 spec->pin_nids = stac9200_pin_nids;
@@ -5031,6 +5052,7 @@ static int patch_stac925x(struct hda_codec *codec)
5031 if (spec == NULL) 5052 if (spec == NULL)
5032 return -ENOMEM; 5053 return -ENOMEM;
5033 5054
5055 codec->no_trigger_sense = 1;
5034 codec->spec = spec; 5056 codec->spec = spec;
5035 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 5057 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5036 spec->pin_nids = stac925x_pin_nids; 5058 spec->pin_nids = stac925x_pin_nids;
@@ -5115,6 +5137,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5115 if (spec == NULL) 5137 if (spec == NULL)
5116 return -ENOMEM; 5138 return -ENOMEM;
5117 5139
5140 codec->no_trigger_sense = 1;
5118 codec->spec = spec; 5141 codec->spec = spec;
5119 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5142 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5120 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids); 5143 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
@@ -5262,6 +5285,7 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5262 if (spec == NULL) 5285 if (spec == NULL)
5263 return -ENOMEM; 5286 return -ENOMEM;
5264 5287
5288 codec->no_trigger_sense = 1;
5265 codec->spec = spec; 5289 codec->spec = spec;
5266 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5290 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5267 spec->digbeep_nid = 0x21; 5291 spec->digbeep_nid = 0x21;
@@ -5473,6 +5497,7 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5473 if (spec == NULL) 5497 if (spec == NULL)
5474 return -ENOMEM; 5498 return -ENOMEM;
5475 5499
5500 codec->no_trigger_sense = 1;
5476 codec->spec = spec; 5501 codec->spec = spec;
5477 codec->patch_ops = stac92xx_patch_ops; 5502 codec->patch_ops = stac92xx_patch_ops;
5478 spec->num_pins = STAC92HD71BXX_NUM_PINS; 5503 spec->num_pins = STAC92HD71BXX_NUM_PINS;
@@ -5605,6 +5630,8 @@ again:
5605 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 5630 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
5606 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); 5631 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e);
5607 5632
5633 snd_printdd("Found board config: %d\n", spec->board_config);
5634
5608 switch (spec->board_config) { 5635 switch (spec->board_config) {
5609 case STAC_HP_M4: 5636 case STAC_HP_M4:
5610 /* enable internal microphone */ 5637 /* enable internal microphone */
@@ -5725,6 +5752,7 @@ static int patch_stac922x(struct hda_codec *codec)
5725 if (spec == NULL) 5752 if (spec == NULL)
5726 return -ENOMEM; 5753 return -ENOMEM;
5727 5754
5755 codec->no_trigger_sense = 1;
5728 codec->spec = spec; 5756 codec->spec = spec;
5729 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids); 5757 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
5730 spec->pin_nids = stac922x_pin_nids; 5758 spec->pin_nids = stac922x_pin_nids;
@@ -5828,6 +5856,7 @@ static int patch_stac927x(struct hda_codec *codec)
5828 if (spec == NULL) 5856 if (spec == NULL)
5829 return -ENOMEM; 5857 return -ENOMEM;
5830 5858
5859 codec->no_trigger_sense = 1;
5831 codec->spec = spec; 5860 codec->spec = spec;
5832 codec->slave_dig_outs = stac927x_slave_dig_outs; 5861 codec->slave_dig_outs = stac927x_slave_dig_outs;
5833 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids); 5862 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
@@ -5962,6 +5991,7 @@ static int patch_stac9205(struct hda_codec *codec)
5962 if (spec == NULL) 5991 if (spec == NULL)
5963 return -ENOMEM; 5992 return -ENOMEM;
5964 5993
5994 codec->no_trigger_sense = 1;
5965 codec->spec = spec; 5995 codec->spec = spec;
5966 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids); 5996 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
5967 spec->pin_nids = stac9205_pin_nids; 5997 spec->pin_nids = stac9205_pin_nids;
@@ -6117,6 +6147,7 @@ static int patch_stac9872(struct hda_codec *codec)
6117 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6147 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
6118 if (spec == NULL) 6148 if (spec == NULL)
6119 return -ENOMEM; 6149 return -ENOMEM;
6150 codec->no_trigger_sense = 1;
6120 codec->spec = spec; 6151 codec->spec = spec;
6121 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids); 6152 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6122 spec->pin_nids = stac9872_pin_nids; 6153 spec->pin_nids = stac9872_pin_nids;
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index b5ca02e2038c..e66ef2b69b5d 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1058,7 +1058,7 @@ setsamplerate(struct cmdif *cif, unsigned char *intdec, unsigned int rate)
1058 rptr.retwords[2] != M && 1058 rptr.retwords[2] != M &&
1059 rptr.retwords[3] != N && 1059 rptr.retwords[3] != N &&
1060 i++ < MAX_WRITE_RETRY); 1060 i++ < MAX_WRITE_RETRY);
1061 if (i == MAX_WRITE_RETRY) { 1061 if (i > MAX_WRITE_RETRY) {
1062 snd_printdd("sent samplerate %d: %d failed\n", 1062 snd_printdd("sent samplerate %d: %d failed\n",
1063 *intdec, rate); 1063 *intdec, rate);
1064 return -EIO; 1064 return -EIO;