aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2006-01-11 12:15:43 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-22 10:24:05 -0500
commit128a46a55da81e563116e99e08e295fda41a145b (patch)
tree5c2505e9d74b3315a8e91f8c4ce6aa33aaf3d9eb /sound/pci/ac97
parentb14e77e613a104c78ab455c0109b566dab430de6 (diff)
[ALSA] ac97 - Suppress jack sense controls for Thinkpads
Modules: AC97 Codec Added a blacklist to suppress to create jack sense controls. These controls must be always off on some devices (e.g. Thinkpad). Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ac97')
-rw-r--r--sound/pci/ac97/ac97_patch.c49
1 files changed, 37 insertions, 12 deletions
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 4aa5fdc5688e..bccce44421ec 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}