logo       

[PATCH] [UBUNTU:sound] Add Jack Sense blacklist for ThinkPads: msg#00025

Subject: [PATCH] [UBUNTU:sound] Add Jack Sense blacklist for ThinkPads
UpstreamStatus: Added in upstream pci/ac97/ac97_patch.c r1.104

Certain devices must not have jack sense controls created (ThinkPad
models, mostly). Takashi Iwai added a blacklist to suppress creation of
such controls on ThinkPad models T42p/R50p. I've extended the blacklist
to cover the ThinkPad X41-2527.

Signed-off-by: Daniel T Chen <crimsun@xxxxxxxxxx>

---

 sound/pci/ac97/ac97_patch.c |   50 +++++++++++++++++++++++++++++++++----------
 1 files changed, 38 insertions(+), 12 deletions(-)

a70e814a5b1633cc50cab48147719d7fb7a72f89
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index db75e2c..f4eb78c 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1621,8 +1621,28 @@ static const snd_kcontrol_new_t snd_ac97
        AC97_SINGLE("Line Jack Sense", AC97_AD_JACK_SPDIF, 12, 1, 0),
 };
 
+/* black list to avoid HP/Line jack-sense controls
+ * (SS vendor << 16 | device)
+ */
+static unsigned int ad1981_jacks_blacklist[] = {
+       0x10140554, /* Thinkpad T42p/R50p */
+       0x10140581, /* Thinkpad X41-2527 */
+       0 /* end */
+};
+
+static int check_list(ac97_t * ac97, const unsigned int * list)
+{
+       u32 subid = ((u32)ac97->subsystem_vendor << 16) | 
ac97->subsystem_device;
+       for (; *list; list++)
+               if (*list == subid)
+                       return 1;
+       return 0;
+}
+
 static int patch_ad1981a_specific(ac97_t * ac97)
 {
+       if (check_list(ac97, ad1981_jacks_blacklist))
+               return 0;
        return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,
                                    ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));
 }
@@ -1635,22 +1655,26 @@ static struct snd_ac97_build_ops patch_a
 #endif
 };
 
+/* white list to enable HP jack-sense bits
+ * (SS vendor << 16 | device)
+ */
+static unsigned int ad1981_jacks_whitelist[] = {
+       0x0e11005a, /* HP nc4000/4010 */
+       0x103c0890, /* HP nc6000 */
+       0x103c0938, /* HP nc4220 */
+       0x103c099c, /* HP nx6110 */
+       0x103c0944, /* HP nc6220 */
+       0x103c0934, /* HP nc8220 */
+       0x103c006d, /* HP nx9105 */
+       0x17340088, /* FSC Scenic-W */
+       0 /* end */
+};
+
 static void check_ad1981_hp_jack_sense(ac97_t *ac97)
 {
-       u32 subid = ((u32)ac97->subsystem_vendor << 16) | 
ac97->subsystem_device;
-       switch (subid) {
-       case 0x0e11005a: /* HP nc4000/4010 */
-       case 0x103c0938: /* HP nc4220 */
-       case 0x103c0890: /* HP nc6000 */
-       case 0x103c099c: /* HP nx6110 */
-       case 0x103c0944: /* HP nc6220 */
-       case 0x103c0934: /* HP nc8220 */
-       case 0x103c006d: /* HP nx9105 */
-       case 0x17340088: /* FSC Scenic-W */
+       if (check_list(ac97, ad1981_jacks_whitelist))
                /* enable headphone jack sense */
                snd_ac97_update_bits(ac97, AC97_AD_JACK_SPDIF, 1<<11, 1<<11);
-               break;
-       }
 }
 
 int patch_ad1981a(ac97_t *ac97)
@@ -1672,6 +1696,8 @@ static int patch_ad1981b_specific(ac97_t
 
        if ((err = patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1)) < 0)
                return err;
+       if (check_list(ac97, ad1981_jacks_blacklist))
+               return 0;
        return patch_build_controls(ac97, snd_ac97_ad1981x_jack_sense,
                                    ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));
 }
-- 
1.1.3

-- 
Daniel T. Chen            crimsun@xxxxxxxxxx
GPG key:   www.sh.nu/~crimsun/pubkey.gpg.asc

Attachment: pgpvzBqLJazG8.pgp
Description: PGP signature


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
audio.irate.dev...    yellowdog.gener...    ietf.ips/2002-0...    xfree86.fonts/2...    busybox/2003-07...    emacs.jdee/2004...    linux.mandrake....    hardware.microc...    user-groups.lin...    science.analysi...    version-control...    db.filemaker.de...    cluster.openmos...    mail.eyebrowse....    text.xml.xerces...    kde.devel.kwrit...    finance.moneyda...    gcc.regression/...    network.routing...    os.freebsd.deve...    recreation.radi...    qnx.openqnx.dev...    python.xml/2002...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe