From patchwork Mon Dec 16 08:25:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 301535 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 D84E82C00A6 for ; Mon, 16 Dec 2013 19:26:45 +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 1VsTVi-0001dM-3P; Mon, 16 Dec 2013 08:26:42 +0000 Received: from mail-pa0-f49.google.com ([209.85.220.49]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1VsTVJ-0001WQ-UH for kernel-team@lists.ubuntu.com; Mon, 16 Dec 2013 08:26:18 +0000 Received: by mail-pa0-f49.google.com with SMTP id kx10so2624429pab.22 for ; Mon, 16 Dec 2013 00:26:17 -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=kzXSqOLF69wbg6qXK2tTpbwwxlkXZVx8eBle0tGoi2s=; b=RztCIicpt9jpBw+VyCVT0HeMfwLRQZzN0sx8HD3qZOjQzzEIdYqusAu8NCvuolAGSA f4ADd5IckWQIA0VX8UgYUvHWyBamDEiSoK6d9DczdYG4lFH6lLL6SI9ImCD5ndF1z9zm fo8IKkhKQT+r8iWUKDul/zrGBepGz8rNLLnGP/8KOG+9lfgVH6phpzFLmK2HZZRgo7Cc Isz+a7MY/WoMGrQSIOIBJN1VN+c3/JBk8ndseA/hofvypi7Hwhxf9Uz+9TgOG/vUk528 WOzF33fk0GDgmv1i31ZlzZeMtWWhx7wY5PGoQB3uR037K5Du+ypxul/hTH6Kh9OhNWPV Q8kg== X-Gm-Message-State: ALoCoQmuNu/acuDuHsKWawJXlMpAJFWqBkfdsDQngyp8j+HRhlgiIBR3mSLQzL2p5GuKATr7btYU X-Received: by 10.68.17.7 with SMTP id k7mr18474176pbd.119.1387182377004; Mon, 16 Dec 2013 00:26:17 -0800 (PST) Received: from localhost.localdomain ([116.213.97.190]) by mx.google.com with ESMTPSA id xs1sm33421390pac.7.2013.12.16.00.26.15 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 16 Dec 2013 00:26:16 -0800 (PST) From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [Saucy PATCH 7/8] ALSA: hda - Enable mute/mic-mute LEDs for more Thinkpads with Conexant codec Date: Mon, 16 Dec 2013 16:25:42 +0800 Message-Id: <1387182343-17346-7-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: Hui Wang BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1261296 Most Thinkpad Edge series laptops use conexant codec, so far although the codecs have different minor Vendor Id and minor Subsystem Id, they all belong to the cxt5066 family, this change can make the mute/mic-mute LEDs support more generic among cxt_5066 family. This design refers to the similar solution for the realtek codec ALC269 family in the patch_realtek.c. Cc: Alex Hung Signed-off-by: Hui Wang Acked-by: David Henningsson Signed-off-by: Takashi Iwai (cherry-picked from commit 2fd3f170e5ba04acc60ee94b2c76ee166727c734) --- sound/pci/hda/patch_conexant.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 811085c..4d103c3 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -3237,9 +3237,29 @@ enum { #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) { struct hda_codec *codec = private_data; @@ -3272,6 +3292,8 @@ static void cxt_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) { @@ -3420,6 +3442,7 @@ static const struct snd_pci_quirk cxt5066_fixups[] = { SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), + SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI), SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004), SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205), {}