Commit c4d14893 authored by Takashi Iwai's avatar Takashi Iwai

Merge branch 'for-linus' into for-next

parents a8dca460 ef8e39b5
...@@ -932,7 +932,7 @@ int snd_hda_bus_new(struct snd_card *card, ...@@ -932,7 +932,7 @@ int snd_hda_bus_new(struct snd_card *card,
} }
EXPORT_SYMBOL_GPL(snd_hda_bus_new); EXPORT_SYMBOL_GPL(snd_hda_bus_new);
#ifdef CONFIG_SND_HDA_GENERIC #if IS_ENABLED(CONFIG_SND_HDA_GENERIC)
#define is_generic_config(codec) \ #define is_generic_config(codec) \
(codec->modelname && !strcmp(codec->modelname, "generic")) (codec->modelname && !strcmp(codec->modelname, "generic"))
#else #else
...@@ -1339,23 +1339,15 @@ get_hda_cvt_setup(struct hda_codec *codec, hda_nid_t nid) ...@@ -1339,23 +1339,15 @@ get_hda_cvt_setup(struct hda_codec *codec, hda_nid_t nid)
/* /*
* Dynamic symbol binding for the codec parsers * Dynamic symbol binding for the codec parsers
*/ */
#ifdef MODULE
#define load_parser_sym(sym) ((int (*)(struct hda_codec *))symbol_request(sym))
#define unload_parser_addr(addr) symbol_put_addr(addr)
#else
#define load_parser_sym(sym) (sym)
#define unload_parser_addr(addr) do {} while (0)
#endif
#define load_parser(codec, sym) \ #define load_parser(codec, sym) \
((codec)->parser = load_parser_sym(sym)) ((codec)->parser = (int (*)(struct hda_codec *))symbol_request(sym))
static void unload_parser(struct hda_codec *codec) static void unload_parser(struct hda_codec *codec)
{ {
if (codec->parser) { if (codec->parser)
unload_parser_addr(codec->parser); symbol_put_addr(codec->parser);
codec->parser = NULL; codec->parser = NULL;
}
} }
/* /*
...@@ -1570,7 +1562,7 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec) ...@@ -1570,7 +1562,7 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec)
EXPORT_SYMBOL_GPL(snd_hda_codec_update_widgets); EXPORT_SYMBOL_GPL(snd_hda_codec_update_widgets);
#ifdef CONFIG_SND_HDA_CODEC_HDMI #if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI)
/* if all audio out widgets are digital, let's assume the codec as a HDMI/DP */ /* if all audio out widgets are digital, let's assume the codec as a HDMI/DP */
static bool is_likely_hdmi_codec(struct hda_codec *codec) static bool is_likely_hdmi_codec(struct hda_codec *codec)
{ {
...@@ -1620,12 +1612,20 @@ int snd_hda_codec_configure(struct hda_codec *codec) ...@@ -1620,12 +1612,20 @@ int snd_hda_codec_configure(struct hda_codec *codec)
patch = codec->preset->patch; patch = codec->preset->patch;
if (!patch) { if (!patch) {
unload_parser(codec); /* to be sure */ unload_parser(codec); /* to be sure */
if (is_likely_hdmi_codec(codec)) if (is_likely_hdmi_codec(codec)) {
#if IS_MODULE(CONFIG_SND_HDA_CODEC_HDMI)
patch = load_parser(codec, snd_hda_parse_hdmi_codec); patch = load_parser(codec, snd_hda_parse_hdmi_codec);
#ifdef CONFIG_SND_HDA_GENERIC #elif IS_BUILTIN(CONFIG_SND_HDA_CODEC_HDMI)
if (!patch) patch = snd_hda_parse_hdmi_codec;
#endif
}
if (!patch) {
#if IS_MODULE(CONFIG_SND_HDA_GENERIC)
patch = load_parser(codec, snd_hda_parse_generic_codec); patch = load_parser(codec, snd_hda_parse_generic_codec);
#elif IS_BUILTIN(CONFIG_SND_HDA_GENERIC)
patch = snd_hda_parse_generic_codec;
#endif #endif
}
if (!patch) { if (!patch) {
printk(KERN_ERR "hda-codec: No codec parser is available\n"); printk(KERN_ERR "hda-codec: No codec parser is available\n");
return -ENODEV; return -ENODEV;
......
...@@ -3268,7 +3268,7 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol, ...@@ -3268,7 +3268,7 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol,
mutex_unlock(&codec->control_mutex); mutex_unlock(&codec->control_mutex);
snd_hda_codec_flush_cache(codec); /* flush the updates */ snd_hda_codec_flush_cache(codec); /* flush the updates */
if (err >= 0 && spec->cap_sync_hook) if (err >= 0 && spec->cap_sync_hook)
spec->cap_sync_hook(codec, ucontrol); spec->cap_sync_hook(codec, kcontrol, ucontrol);
return err; return err;
} }
...@@ -3389,7 +3389,7 @@ static int cap_single_sw_put(struct snd_kcontrol *kcontrol, ...@@ -3389,7 +3389,7 @@ static int cap_single_sw_put(struct snd_kcontrol *kcontrol,
return ret; return ret;
if (spec->cap_sync_hook) if (spec->cap_sync_hook)
spec->cap_sync_hook(codec, ucontrol); spec->cap_sync_hook(codec, kcontrol, ucontrol);
return ret; return ret;
} }
...@@ -3794,7 +3794,7 @@ static int mux_select(struct hda_codec *codec, unsigned int adc_idx, ...@@ -3794,7 +3794,7 @@ static int mux_select(struct hda_codec *codec, unsigned int adc_idx,
return 0; return 0;
snd_hda_activate_path(codec, path, true, false); snd_hda_activate_path(codec, path, true, false);
if (spec->cap_sync_hook) if (spec->cap_sync_hook)
spec->cap_sync_hook(codec, NULL); spec->cap_sync_hook(codec, NULL, NULL);
path_power_down_sync(codec, old_path); path_power_down_sync(codec, old_path);
return 1; return 1;
} }
...@@ -5269,7 +5269,7 @@ static void init_input_src(struct hda_codec *codec) ...@@ -5269,7 +5269,7 @@ static void init_input_src(struct hda_codec *codec)
} }
if (spec->cap_sync_hook) if (spec->cap_sync_hook)
spec->cap_sync_hook(codec, NULL); spec->cap_sync_hook(codec, NULL, NULL);
} }
/* set right pin controls for digital I/O */ /* set right pin controls for digital I/O */
......
...@@ -274,6 +274,7 @@ struct hda_gen_spec { ...@@ -274,6 +274,7 @@ struct hda_gen_spec {
void (*init_hook)(struct hda_codec *codec); void (*init_hook)(struct hda_codec *codec);
void (*automute_hook)(struct hda_codec *codec); void (*automute_hook)(struct hda_codec *codec);
void (*cap_sync_hook)(struct hda_codec *codec, void (*cap_sync_hook)(struct hda_codec *codec,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol); struct snd_ctl_elem_value *ucontrol);
/* PCM hooks */ /* PCM hooks */
......
...@@ -198,7 +198,7 @@ MODULE_DESCRIPTION("Intel HDA driver"); ...@@ -198,7 +198,7 @@ MODULE_DESCRIPTION("Intel HDA driver");
#endif #endif
#if defined(CONFIG_PM) && defined(CONFIG_VGA_SWITCHEROO) #if defined(CONFIG_PM) && defined(CONFIG_VGA_SWITCHEROO)
#ifdef CONFIG_SND_HDA_CODEC_HDMI #if IS_ENABLED(CONFIG_SND_HDA_CODEC_HDMI)
#define SUPPORT_VGA_SWITCHEROO #define SUPPORT_VGA_SWITCHEROO
#endif #endif
#endif #endif
......
...@@ -244,6 +244,19 @@ static void ad_fixup_inv_jack_detect(struct hda_codec *codec, ...@@ -244,6 +244,19 @@ static void ad_fixup_inv_jack_detect(struct hda_codec *codec,
} }
} }
/* Toshiba Satellite L40 implements EAPD in a standard way unlike others */
static void ad1986a_fixup_eapd(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
struct ad198x_spec *spec = codec->spec;
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
codec->inv_eapd = 0;
spec->gen.keep_eapd_on = 1;
spec->eapd_nid = 0x1b;
}
}
enum { enum {
AD1986A_FIXUP_INV_JACK_DETECT, AD1986A_FIXUP_INV_JACK_DETECT,
AD1986A_FIXUP_ULTRA, AD1986A_FIXUP_ULTRA,
...@@ -251,6 +264,7 @@ enum { ...@@ -251,6 +264,7 @@ enum {
AD1986A_FIXUP_3STACK, AD1986A_FIXUP_3STACK,
AD1986A_FIXUP_LAPTOP, AD1986A_FIXUP_LAPTOP,
AD1986A_FIXUP_LAPTOP_IMIC, AD1986A_FIXUP_LAPTOP_IMIC,
AD1986A_FIXUP_EAPD,
}; };
static const struct hda_fixup ad1986a_fixups[] = { static const struct hda_fixup ad1986a_fixups[] = {
...@@ -311,6 +325,10 @@ static const struct hda_fixup ad1986a_fixups[] = { ...@@ -311,6 +325,10 @@ static const struct hda_fixup ad1986a_fixups[] = {
.chained_before = 1, .chained_before = 1,
.chain_id = AD1986A_FIXUP_LAPTOP, .chain_id = AD1986A_FIXUP_LAPTOP,
}, },
[AD1986A_FIXUP_EAPD] = {
.type = HDA_FIXUP_FUNC,
.v.func = ad1986a_fixup_eapd,
},
}; };
static const struct snd_pci_quirk ad1986a_fixup_tbl[] = { static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
...@@ -318,6 +336,7 @@ static const struct snd_pci_quirk ad1986a_fixup_tbl[] = { ...@@ -318,6 +336,7 @@ static const struct snd_pci_quirk ad1986a_fixup_tbl[] = {
SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK), SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8100, "ASUS P5", AD1986A_FIXUP_3STACK),
SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK), SND_PCI_QUIRK_MASK(0x1043, 0xff00, 0x8200, "ASUS M2", AD1986A_FIXUP_3STACK),
SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK), SND_PCI_QUIRK(0x10de, 0xcb84, "ASUS A8N-VM", AD1986A_FIXUP_3STACK),
SND_PCI_QUIRK(0x1179, 0xff40, "Toshiba Satellite L40", AD1986A_FIXUP_EAPD),
SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_FIXUP_LAPTOP), SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_FIXUP_LAPTOP),
SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_FIXUP_SAMSUNG), SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc000, "Samsung", AD1986A_FIXUP_SAMSUNG),
SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_FIXUP_ULTRA), SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_FIXUP_ULTRA),
...@@ -472,6 +491,8 @@ static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec) ...@@ -472,6 +491,8 @@ static int ad1983_add_spdif_mux_ctl(struct hda_codec *codec)
static int patch_ad1983(struct hda_codec *codec) static int patch_ad1983(struct hda_codec *codec)
{ {
struct ad198x_spec *spec; struct ad198x_spec *spec;
static hda_nid_t conn_0c[] = { 0x08 };
static hda_nid_t conn_0d[] = { 0x09 };
int err; int err;
err = alloc_ad_spec(codec); err = alloc_ad_spec(codec);
...@@ -479,8 +500,14 @@ static int patch_ad1983(struct hda_codec *codec) ...@@ -479,8 +500,14 @@ static int patch_ad1983(struct hda_codec *codec)
return err; return err;
spec = codec->spec; spec = codec->spec;
spec->gen.mixer_nid = 0x0e;
spec->gen.beep_nid = 0x10; spec->gen.beep_nid = 0x10;
set_beep_amp(spec, 0x10, 0, HDA_OUTPUT); set_beep_amp(spec, 0x10, 0, HDA_OUTPUT);
/* limit the loopback routes not to confuse the parser */
snd_hda_override_conn_list(codec, 0x0c, ARRAY_SIZE(conn_0c), conn_0c);
snd_hda_override_conn_list(codec, 0x0d, ARRAY_SIZE(conn_0d), conn_0d);
err = ad198x_parse_auto_config(codec, false); err = ad198x_parse_auto_config(codec, false);
if (err < 0) if (err < 0)
goto error; goto error;
......
...@@ -2883,7 +2883,8 @@ static void cxt_update_headset_mode(struct hda_codec *codec) ...@@ -2883,7 +2883,8 @@ static void cxt_update_headset_mode(struct hda_codec *codec)
} }
static void cxt_update_headset_mode_hook(struct hda_codec *codec, static void cxt_update_headset_mode_hook(struct hda_codec *codec,
struct snd_ctl_elem_value *ucontrol) struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
cxt_update_headset_mode(codec); cxt_update_headset_mode(codec);
} }
......
...@@ -708,7 +708,8 @@ static void alc_inv_dmic_sync(struct hda_codec *codec, bool force) ...@@ -708,7 +708,8 @@ static void alc_inv_dmic_sync(struct hda_codec *codec, bool force)
} }
static void alc_inv_dmic_hook(struct hda_codec *codec, static void alc_inv_dmic_hook(struct hda_codec *codec,
struct snd_ctl_elem_value *ucontrol) struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
alc_inv_dmic_sync(codec, false); alc_inv_dmic_sync(codec, false);
} }
...@@ -1817,6 +1818,7 @@ enum { ...@@ -1817,6 +1818,7 @@ enum {
ALC889_FIXUP_IMAC91_VREF, ALC889_FIXUP_IMAC91_VREF,
ALC889_FIXUP_MBA11_VREF, ALC889_FIXUP_MBA11_VREF,
ALC889_FIXUP_MBA21_VREF, ALC889_FIXUP_MBA21_VREF,
ALC889_FIXUP_MP11_VREF,
ALC882_FIXUP_INV_DMIC, ALC882_FIXUP_INV_DMIC,
ALC882_FIXUP_NO_PRIMARY_HP, ALC882_FIXUP_NO_PRIMARY_HP,
ALC887_FIXUP_ASUS_BASS, ALC887_FIXUP_ASUS_BASS,
...@@ -2186,6 +2188,12 @@ static const struct hda_fixup alc882_fixups[] = { ...@@ -2186,6 +2188,12 @@ static const struct hda_fixup alc882_fixups[] = {
.chained = true, .chained = true,
.chain_id = ALC889_FIXUP_MBP_VREF, .chain_id = ALC889_FIXUP_MBP_VREF,
}, },
[ALC889_FIXUP_MP11_VREF] = {
.type = HDA_FIXUP_FUNC,
.v.func = alc889_fixup_mba11_vref,
.chained = true,
.chain_id = ALC885_FIXUP_MACPRO_GPIO,
},
[ALC882_FIXUP_INV_DMIC] = { [ALC882_FIXUP_INV_DMIC] = {
.type = HDA_FIXUP_FUNC, .type = HDA_FIXUP_FUNC,
.v.func = alc_fixup_inv_dmic_0x12, .v.func = alc_fixup_inv_dmic_0x12,
...@@ -2249,7 +2257,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { ...@@ -2249,7 +2257,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF), SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC889_FIXUP_MBP_VREF),
SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF), SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC889_FIXUP_MBP_VREF),
SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF), SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC889_FIXUP_MBP_VREF),
SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO), SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC889_FIXUP_MP11_VREF),
SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO), SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO), SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF), SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC889_FIXUP_MBP_VREF),
...@@ -3207,7 +3215,8 @@ static void alc269_fixup_hp_gpio_mute_hook(void *private_data, int enabled) ...@@ -3207,7 +3215,8 @@ static void alc269_fixup_hp_gpio_mute_hook(void *private_data, int enabled)
/* turn on/off mic-mute LED per capture hook */ /* turn on/off mic-mute LED per capture hook */
static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec *codec, static void alc269_fixup_hp_gpio_mic_mute_hook(struct hda_codec *codec,
struct snd_ctl_elem_value *ucontrol) struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
unsigned int oldval = spec->gpio_led; unsigned int oldval = spec->gpio_led;
...@@ -3517,7 +3526,8 @@ static void alc_update_headset_mode(struct hda_codec *codec) ...@@ -3517,7 +3526,8 @@ static void alc_update_headset_mode(struct hda_codec *codec)
} }
static void alc_update_headset_mode_hook(struct hda_codec *codec, static void alc_update_headset_mode_hook(struct hda_codec *codec,
struct snd_ctl_elem_value *ucontrol) struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
alc_update_headset_mode(codec); alc_update_headset_mode(codec);
} }
...@@ -4318,6 +4328,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = { ...@@ -4318,6 +4328,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC), SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005", ALC269_FIXUP_STEREO_DMIC),
SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101), SND_PCI_QUIRK(0x1043, 0x8516, "ASUS X101CH", ALC269_FIXUP_ASUS_X101),
SND_PCI_QUIRK(0x104d, 0x90b5, "Sony VAIO Pro 11", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x104d, 0x90b6, "Sony VAIO Pro 13", ALC286_FIXUP_SONY_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2), SND_PCI_QUIRK(0x104d, 0x9073, "Sony VAIO", ALC275_FIXUP_SONY_VAIO_GPIO2),
SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), SND_PCI_QUIRK(0x104d, 0x907b, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
...@@ -4423,6 +4434,9 @@ static void alc269_fill_coef(struct hda_codec *codec) ...@@ -4423,6 +4434,9 @@ static void alc269_fill_coef(struct hda_codec *codec)
if (spec->codec_variant != ALC269_TYPE_ALC269VB) if (spec->codec_variant != ALC269_TYPE_ALC269VB)
return; return;
/* ALC271X doesn't seem to support these COEFs (bko#52181) */
if (!strcmp(codec->chip_name, "ALC271X"))
return;
if ((alc_get_coef0(codec) & 0x00ff) < 0x015) { if ((alc_get_coef0(codec) & 0x00ff) < 0x015) {
alc_write_coef_idx(codec, 0xf, 0x960b); alc_write_coef_idx(codec, 0xf, 0x960b);
...@@ -5142,6 +5156,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = { ...@@ -5142,6 +5156,7 @@ static const struct snd_pci_quirk alc662_fixup_tbl[] = {
SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE), SND_PCI_QUIRK(0x1025, 0x038b, "Acer Aspire 8943G", ALC662_FIXUP_ASPIRE),
SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x05d8, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x05db, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x060a, "Dell XPS 13", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x0623, "Dell", ALC668_FIXUP_AUTO_MUTE), SND_PCI_QUIRK(0x1028, 0x0623, "Dell", ALC668_FIXUP_AUTO_MUTE),
SND_PCI_QUIRK(0x1028, 0x0624, "Dell", ALC668_FIXUP_AUTO_MUTE), SND_PCI_QUIRK(0x1028, 0x0624, "Dell", ALC668_FIXUP_AUTO_MUTE),
SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE), SND_PCI_QUIRK(0x1028, 0x0625, "Dell", ALC668_FIXUP_DELL_MIC_NO_PRESENCE),
......
...@@ -194,7 +194,7 @@ struct sigmatel_spec { ...@@ -194,7 +194,7 @@ struct sigmatel_spec {
int default_polarity; int default_polarity;
unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */ unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */
bool mic_mute_led_on; /* current mic mute state */ unsigned int mic_enabled; /* current mic mute state (bitmask) */
/* stream */ /* stream */
unsigned int stream_delay; unsigned int stream_delay;
...@@ -324,19 +324,26 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, ...@@ -324,19 +324,26 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
/* hook for controlling mic-mute LED GPIO */ /* hook for controlling mic-mute LED GPIO */
static void stac_capture_led_hook(struct hda_codec *codec, static void stac_capture_led_hook(struct hda_codec *codec,
struct snd_ctl_elem_value *ucontrol) struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{ {
struct sigmatel_spec *spec = codec->spec; struct sigmatel_spec *spec = codec->spec;
bool mute; unsigned int mask;
bool cur_mute, prev_mute;
if (!ucontrol) if (!kcontrol || !ucontrol)
return; return;
mute = !(ucontrol->value.integer.value[0] || mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
ucontrol->value.integer.value[1]); prev_mute = !spec->mic_enabled;
if (spec->mic_mute_led_on != mute) { if (ucontrol->value.integer.value[0] ||
spec->mic_mute_led_on = mute; ucontrol->value.integer.value[1])
if (mute) spec->mic_enabled |= mask;
else
spec->mic_enabled &= ~mask;
cur_mute = !spec->mic_enabled;
if (cur_mute != prev_mute) {
if (cur_mute)
spec->gpio_data |= spec->mic_mute_led_gpio; spec->gpio_data |= spec->mic_mute_led_gpio;
else else
spec->gpio_data &= ~spec->mic_mute_led_gpio; spec->gpio_data &= ~spec->mic_mute_led_gpio;
...@@ -4462,7 +4469,7 @@ static void stac_setup_gpio(struct hda_codec *codec) ...@@ -4462,7 +4469,7 @@ static void stac_setup_gpio(struct hda_codec *codec)
if (spec->mic_mute_led_gpio) { if (spec->mic_mute_led_gpio) {
spec->gpio_mask |= spec->mic_mute_led_gpio; spec->gpio_mask |= spec->mic_mute_led_gpio;
spec->gpio_dir |= spec->mic_mute_led_gpio; spec->gpio_dir |= spec->mic_mute_led_gpio;
spec->mic_mute_led_on = true; spec->mic_enabled = 0;
spec->gpio_data |= spec->mic_mute_led_gpio; spec->gpio_data |= spec->mic_mute_led_gpio;
spec->gen.cap_sync_hook = stac_capture_led_hook; spec->gen.cap_sync_hook = stac_capture_led_hook;
......
...@@ -39,6 +39,7 @@ static void update_tpacpi_mute_led(void *private_data, int enabled) ...@@ -39,6 +39,7 @@ static void update_tpacpi_mute_led(void *private_data, int enabled)
} }
static void update_tpacpi_micmute_led(struct hda_codec *codec, static void update_tpacpi_micmute_led(struct hda_codec *codec,
struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
if (!ucontrol || !led_set_func) if (!ucontrol || !led_set_func)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment