From patchwork Mon Dec 16 08:25:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 301533 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 9B5BF2C007B for ; Mon, 16 Dec 2013 19:26:37 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1VsTVZ-0001ac-N8; Mon, 16 Dec 2013 08:26:33 +0000 Received: from mail-pb0-f45.google.com ([209.85.160.45]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1VsTVG-0001VW-BJ for kernel-team@lists.ubuntu.com; Mon, 16 Dec 2013 08:26:14 +0000 Received: by mail-pb0-f45.google.com with SMTP id rp16so5175243pbb.4 for ; Mon, 16 Dec 2013 00:26:13 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=G86jRO/QNjV4fBoTbT7EhyQemfbU7hYBofDB3cIJot0=; b=GHpRhFehsD66NImxM1WDpb+8vhcEqGZojQ2criUhUyNVzXxsp1XuaZwlsfG1CTAK3R DC0X1+l3P6STAyGnYGhhy1bdp8PSFm/Niumb5piD/k8qvz4wT0vg7w7LSJhiwPgQvXf6 rBm3FvEGQk4U6WPVT2TIc7fdE29fKDI9mxr1EiBq8g2LiJx2KxGmEXwA1ixDL4vUp1Eh 9aDg4qDBU/SFw3OsRJZ0yBR/pFlIF7PfA4XsZpcmRXEatR7310M8Jv/VtD4ieAzkWWDO +Qi34L64rjkW6sA9olWRVIA60H7eZRYnIMf1JyN5ZUAtZHF+Yhv0DR7xF10ePiQacAik MI/A== X-Gm-Message-State: ALoCoQlzQoK8KvAJtCH0XdbwCId9//q2FFyhO50SRsHDYqZ/tNPvfH/GWiOXvDO9nsPfaMSpliDy X-Received: by 10.68.133.229 with SMTP id pf5mr18801936pbb.115.1387182373440; Mon, 16 Dec 2013 00:26:13 -0800 (PST) Received: from localhost.localdomain ([116.213.97.190]) by mx.google.com with ESMTPSA id xs1sm33421390pac.7.2013.12.16.00.26.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Dec 2013 00:26:13 -0800 (PST) From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [Saucy PATCH 5/8] ALSA: hda - Enable mute/mic-mute LEDs for more Thinkpads with Realtek codec Date: Mon, 16 Dec 2013 16:25:40 +0800 Message-Id: <1387182343-17346-5-git-send-email-hui.wang@canonical.com> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1387182343-17346-1-git-send-email-hui.wang@canonical.com> References: <1387182343-17346-1-git-send-email-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: David Henningsson BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1261296 We're using the ACPI interface to detect whether we're dealing with a Thinkpad or not. This way we're not loading the thinkpad_acpi module when we're not on a Thinkpad, but at the same time, we give the opportunity to check for, and potentially enable, both present and future Thinkpad with mute/micmute LEDs. At least those running the ALC269 family (269 to 299) of Realtek codecs. Cc: Alex Hung Tested-by: Hui Wang Signed-off-by: David Henningsson Signed-off-by: Takashi Iwai (back ported from commit 2793769f4450d9e4845257c953ae278ecdff7d94) Conflicts: sound/pci/hda/patch_realtek.c --- sound/pci/hda/patch_realtek.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d808536..d105eb6 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -3324,9 +3324,29 @@ static void alc290_fixup_mono_speakers(struct hda_codec *codec, #if IS_ENABLED(CONFIG_THINKPAD_ACPI) #include +#include static int (*led_set_func)(int, bool); +static acpi_status acpi_check_cb(acpi_handle handle, u32 lvl, void *context, + void **rv) +{ + bool *found = context; + *found = true; + return AE_OK; +} + +static bool is_thinkpad(struct hda_codec *codec) +{ + bool found = false; + if (codec->subsystem_id >> 16 != 0x17aa) + return false; + if (ACPI_SUCCESS(acpi_get_devices("LEN0068", acpi_check_cb, &found, NULL)) && found) + return true; + found = false; + return ACPI_SUCCESS(acpi_get_devices("IBM0068", acpi_check_cb, &found, NULL)) && found; +} + static void update_tpacpi_mute_led(void *private_data, int enabled) { if (led_set_func) @@ -3352,6 +3372,8 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec, bool removefunc = false; if (action == HDA_FIXUP_ACT_PROBE) { + if (!is_thinkpad(codec)) + return; if (!led_set_func) led_set_func = symbol_request(tpacpi_led_set); if (!led_set_func) { @@ -3686,6 +3708,8 @@ static const struct hda_fixup alc269_fixups[] = { [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = { .type = HDA_FIXUP_FUNC, .v.func = alc269_fixup_limit_int_mic_boost, + .chained = true, + .chain_id = ALC269_FIXUP_THINKPAD_ACPI, }, [ALC269VB_FIXUP_ORDISSIMO_EVE2] = { .type = HDA_FIXUP_PINS, @@ -3705,8 +3729,6 @@ static const struct hda_fixup alc269_fixups[] = { [ALC269_FIXUP_THINKPAD_ACPI] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_thinkpad_acpi, - .chained = true, - .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST }, }; @@ -3787,9 +3809,10 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { SND_PCI_QUIRK(0x17aa, 0x21fb, "Thinkpad T430s", ALC269_FIXUP_LENOVO_DOCK), SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), SND_PCI_QUIRK(0x17aa, 0x2203, "Thinkpad X230 Tablet", ALC269_FIXUP_LENOVO_DOCK), - SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI), + SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), + SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI), SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ #if 0