aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97/ac97_patch.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ac97/ac97_patch.c')
-rw-r--r--sound/pci/ac97/ac97_patch.c53
1 files changed, 39 insertions, 14 deletions
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 4aa5fdc5688e..a444a78c7c94 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1621,8 +1621,27 @@ static const struct snd_kcontrol_new snd_ac97_ad1981x_jack_sense[] = {
1621 AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0), 1621 AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0),
1622}; 1622};
1623 1623
1624/* black list to avoid HP/Line jack-sense controls
1625 * (SS vendor << 16 | device)
1626 */
1627static unsigned int ad1981_jacks_blacklist[] = {
1628 0x10140554, /* Thinkpad T42p/R50p */
1629 0 /* end */
1630};
1631
1632static int check_list(struct snd_ac97 *ac97, const unsigned int *list)
1633{
1634 u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device;
1635 for (; *list; list++)
1636 if (*list == subid)
1637 return 1;
1638 return 0;
1639}
1640
1624static int patch_ad1981a_specific(struct snd_ac97 * ac97) 1641static int patch_ad1981a_specific(struct snd_ac97 * ac97)
1625{ 1642{
1643 if (check_list(ac97, ad1981_jacks_blacklist))
1644 return 0;
1626 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense, 1645 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,
1627 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); 1646 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));
1628} 1647}
@@ -1635,22 +1654,26 @@ static struct snd_ac97_build_ops patch_ad1981a_build_ops = {
1635#endif 1654#endif
1636}; 1655};
1637 1656
1657/* white list to enable HP jack-sense bits
1658 * (SS vendor << 16 | device)
1659 */
1660static unsigned int ad1981_jacks_whitelist[] = {
1661 0x0e11005a, /* HP nc4000/4010 */
1662 0x103c0890, /* HP nc6000 */
1663 0x103c0938, /* HP nc4220 */
1664 0x103c099c, /* HP nx6110 */
1665 0x103c0944, /* HP nc6220 */
1666 0x103c0934, /* HP nc8220 */
1667 0x103c006d, /* HP nx9105 */
1668 0x17340088, /* FSC Scenic-W */
1669 0 /* end */
1670};
1671
1638static void check_ad1981_hp_jack_sense(struct snd_ac97 *ac97) 1672static void check_ad1981_hp_jack_sense(struct snd_ac97 *ac97)
1639{ 1673{
1640 u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device; 1674 if (check_list(ac97, ad1981_jacks_whitelist))
1641 switch (subid) {
1642 case 0x0e11005a: /* HP nc4000/4010 */
1643 case 0x103c0890: /* HP nc6000 */
1644 case 0x103c0938: /* HP nc4220 */
1645 case 0x103c099c: /* HP nx6110 */
1646 case 0x103c0944: /* HP nc6220 */
1647 case 0x103c0934: /* HP nc8220 */
1648 case 0x103c006d: /* HP nx9105 */
1649 case 0x17340088: /* FSC Scenic-W */
1650 /* enable headphone jack sense */ 1675 /* enable headphone jack sense */
1651 snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11); 1676 snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11);
1652 break;
1653 }
1654} 1677}
1655 1678
1656int patch_ad1981a(struct snd_ac97 *ac97) 1679int patch_ad1981a(struct snd_ac97 *ac97)
@@ -1672,6 +1695,8 @@ static int patch_ad1981b_specific(struct snd_ac97 *ac97)
1672 1695
1673 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0) 1696 if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)
1674 return err; 1697 return err;
1698 if (check_list(ac97, ad1981_jacks_blacklist))
1699 return 0;
1675 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense, 1700 return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,
1676 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); 1701 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));
1677} 1702}
@@ -2210,9 +2235,9 @@ static void alc850_update_jacks(struct snd_ac97 *ac97)
2210 /* Vref disable (bit12), 1kOhm (bit13) */ 2235 /* Vref disable (bit12), 1kOhm (bit13) */
2211 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<12)|(1<<13), 2236 snd_ac97_update_bits(ac97, AC97_ALC850_MISC1, (1<<12)|(1<<13),
2212 shared ? (1<<12) : (1<<13)); 2237 shared ? (1<<12) : (1<<13));
2213 /* MIC-IN = 1, CENTER-LFE = 2 */ 2238 /* MIC-IN = 1, CENTER-LFE = 5 */
2214 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4, 2239 snd_ac97_update_bits(ac97, AC97_ALC850_JACK_SELECT, 7 << 4,
2215 shared ? (2<<4) : (1<<4)); 2240 shared ? (5<<4) : (1<<4));
2216} 2241}
2217 2242
2218static const struct snd_kcontrol_new snd_ac97_controls_alc850[] = { 2243static const struct snd_kcontrol_new snd_ac97_controls_alc850[] = {