aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2013-11-18 05:51:47 -0500
committerTakashi Iwai <tiwai@suse.de>2013-11-18 07:08:47 -0500
commit2793769f4450d9e4845257c953ae278ecdff7d94 (patch)
treed1b37d68f5cd444aa33bfa1f421b439fdc71ebdb /sound/pci
parentabfe69dd2e313d0c8226ca4a12329e3d829cfd7c (diff)
ALSA: hda - Enable mute/mic-mute LEDs for more Thinkpads with Realtek codec
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 <alex.hung@canonical.com> Tested-by: Hui Wang <hui.wang@canonical.com> Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_realtek.c29
1 files changed, 26 insertions, 3 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 04d1e6be600e..05987ffb59d0 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -3652,9 +3652,29 @@ static void alc290_fixup_mono_speakers(struct hda_codec *codec,
3652#if IS_ENABLED(CONFIG_THINKPAD_ACPI) 3652#if IS_ENABLED(CONFIG_THINKPAD_ACPI)
3653 3653
3654#include <linux/thinkpad_acpi.h> 3654#include <linux/thinkpad_acpi.h>
3655#include <acpi/acpi.h>
3655 3656
3656static int (*led_set_func)(int, bool); 3657static int (*led_set_func)(int, bool);
3657 3658
3659static acpi_status acpi_check_cb(acpi_handle handle, u32 lvl, void *context,
3660 void **rv)
3661{
3662 bool *found = context;
3663 *found = true;
3664 return AE_OK;
3665}
3666
3667static bool is_thinkpad(struct hda_codec *codec)
3668{
3669 bool found = false;
3670 if (codec->subsystem_id >> 16 != 0x17aa)
3671 return false;
3672 if (ACPI_SUCCESS(acpi_get_devices("LEN0068", acpi_check_cb, &found, NULL)) && found)
3673 return true;
3674 found = false;
3675 return ACPI_SUCCESS(acpi_get_devices("IBM0068", acpi_check_cb, &found, NULL)) && found;
3676}
3677
3658static void update_tpacpi_mute_led(void *private_data, int enabled) 3678static void update_tpacpi_mute_led(void *private_data, int enabled)
3659{ 3679{
3660 if (led_set_func) 3680 if (led_set_func)
@@ -3680,6 +3700,8 @@ static void alc_fixup_thinkpad_acpi(struct hda_codec *codec,
3680 bool removefunc = false; 3700 bool removefunc = false;
3681 3701
3682 if (action == HDA_FIXUP_ACT_PROBE) { 3702 if (action == HDA_FIXUP_ACT_PROBE) {
3703 if (!is_thinkpad(codec))
3704 return;
3683 if (!led_set_func) 3705 if (!led_set_func)
3684 led_set_func = symbol_request(tpacpi_led_set); 3706 led_set_func = symbol_request(tpacpi_led_set);
3685 if (!led_set_func) { 3707 if (!led_set_func) {
@@ -4027,6 +4049,8 @@ static const struct hda_fixup alc269_fixups[] = {
4027 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = { 4049 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST] = {
4028 .type = HDA_FIXUP_FUNC, 4050 .type = HDA_FIXUP_FUNC,
4029 .v.func = alc269_fixup_limit_int_mic_boost, 4051 .v.func = alc269_fixup_limit_int_mic_boost,
4052 .chained = true,
4053 .chain_id = ALC269_FIXUP_THINKPAD_ACPI,
4030 }, 4054 },
4031 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = { 4055 [ALC269_FIXUP_LIMIT_INT_MIC_BOOST_MUTE_LED] = {
4032 .type = HDA_FIXUP_FUNC, 4056 .type = HDA_FIXUP_FUNC,
@@ -4070,8 +4094,6 @@ static const struct hda_fixup alc269_fixups[] = {
4070 [ALC269_FIXUP_THINKPAD_ACPI] = { 4094 [ALC269_FIXUP_THINKPAD_ACPI] = {
4071 .type = HDA_FIXUP_FUNC, 4095 .type = HDA_FIXUP_FUNC,
4072 .v.func = alc_fixup_thinkpad_acpi, 4096 .v.func = alc_fixup_thinkpad_acpi,
4073 .chained = true,
4074 .chain_id = ALC269_FIXUP_LIMIT_INT_MIC_BOOST
4075 }, 4097 },
4076 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = { 4098 [ALC255_FIXUP_DELL1_MIC_NO_PRESENCE] = {
4077 .type = HDA_FIXUP_PINS, 4099 .type = HDA_FIXUP_PINS,
@@ -4173,7 +4195,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4173 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK), 4195 SND_PCI_QUIRK(0x17aa, 0x2208, "Thinkpad T431s", ALC269_FIXUP_LENOVO_DOCK),
4174 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4196 SND_PCI_QUIRK(0x17aa, 0x220c, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4175 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4197 SND_PCI_QUIRK(0x17aa, 0x2212, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4176 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI), 4198 SND_PCI_QUIRK(0x17aa, 0x2214, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4177 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4199 SND_PCI_QUIRK(0x17aa, 0x2215, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4178 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4200 SND_PCI_QUIRK(0x17aa, 0x5013, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4179 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC), 4201 SND_PCI_QUIRK(0x17aa, 0x501a, "Thinkpad", ALC283_FIXUP_INT_MIC),
@@ -4181,6 +4203,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4181 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST), 4203 SND_PCI_QUIRK(0x17aa, 0x5109, "Thinkpad", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
4182 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K), 4204 SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_FIXUP_PCM_44K),
4183 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD), 4205 SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
4206 SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", ALC269_FIXUP_THINKPAD_ACPI),
4184 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */ 4207 SND_PCI_QUIRK(0x1b7d, 0xa831, "Ordissimo EVE2 ", ALC269VB_FIXUP_ORDISSIMO_EVE2), /* Also known as Malata PC-B1303 */
4185 4208
4186#if 0 4209#if 0