diff options
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 6998cf29b9bc..3bc29c9b2529 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -83,6 +83,7 @@ enum { | |||
83 | STAC_DELL_M6_BOTH, | 83 | STAC_DELL_M6_BOTH, |
84 | STAC_DELL_EQ, | 84 | STAC_DELL_EQ, |
85 | STAC_ALIENWARE_M17X, | 85 | STAC_ALIENWARE_M17X, |
86 | STAC_92HD89XX_HP_FRONT_JACK, | ||
86 | STAC_92HD73XX_MODELS | 87 | STAC_92HD73XX_MODELS |
87 | }; | 88 | }; |
88 | 89 | ||
@@ -97,6 +98,7 @@ enum { | |||
97 | STAC_92HD83XXX_HP_LED, | 98 | STAC_92HD83XXX_HP_LED, |
98 | STAC_92HD83XXX_HP_INV_LED, | 99 | STAC_92HD83XXX_HP_INV_LED, |
99 | STAC_92HD83XXX_HP_MIC_LED, | 100 | STAC_92HD83XXX_HP_MIC_LED, |
101 | STAC_HP_LED_GPIO10, | ||
100 | STAC_92HD83XXX_HEADSET_JACK, | 102 | STAC_92HD83XXX_HEADSET_JACK, |
101 | STAC_92HD83XXX_HP, | 103 | STAC_92HD83XXX_HP, |
102 | STAC_HP_ENVY_BASS, | 104 | STAC_HP_ENVY_BASS, |
@@ -194,7 +196,7 @@ struct sigmatel_spec { | |||
194 | int default_polarity; | 196 | int default_polarity; |
195 | 197 | ||
196 | unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */ | 198 | unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */ |
197 | bool mic_mute_led_on; /* current mic mute state */ | 199 | unsigned int mic_enabled; /* current mic mute state (bitmask) */ |
198 | 200 | ||
199 | /* stream */ | 201 | /* stream */ |
200 | unsigned int stream_delay; | 202 | unsigned int stream_delay; |
@@ -324,19 +326,26 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, | |||
324 | 326 | ||
325 | /* hook for controlling mic-mute LED GPIO */ | 327 | /* hook for controlling mic-mute LED GPIO */ |
326 | static void stac_capture_led_hook(struct hda_codec *codec, | 328 | static void stac_capture_led_hook(struct hda_codec *codec, |
327 | struct snd_ctl_elem_value *ucontrol) | 329 | struct snd_kcontrol *kcontrol, |
330 | struct snd_ctl_elem_value *ucontrol) | ||
328 | { | 331 | { |
329 | struct sigmatel_spec *spec = codec->spec; | 332 | struct sigmatel_spec *spec = codec->spec; |
330 | bool mute; | 333 | unsigned int mask; |
334 | bool cur_mute, prev_mute; | ||
331 | 335 | ||
332 | if (!ucontrol) | 336 | if (!kcontrol || !ucontrol) |
333 | return; | 337 | return; |
334 | 338 | ||
335 | mute = !(ucontrol->value.integer.value[0] || | 339 | mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); |
336 | ucontrol->value.integer.value[1]); | 340 | prev_mute = !spec->mic_enabled; |
337 | if (spec->mic_mute_led_on != mute) { | 341 | if (ucontrol->value.integer.value[0] || |
338 | spec->mic_mute_led_on = mute; | 342 | ucontrol->value.integer.value[1]) |
339 | if (mute) | 343 | spec->mic_enabled |= mask; |
344 | else | ||
345 | spec->mic_enabled &= ~mask; | ||
346 | cur_mute = !spec->mic_enabled; | ||
347 | if (cur_mute != prev_mute) { | ||
348 | if (cur_mute) | ||
340 | spec->gpio_data |= spec->mic_mute_led_gpio; | 349 | spec->gpio_data |= spec->mic_mute_led_gpio; |
341 | else | 350 | else |
342 | spec->gpio_data &= ~spec->mic_mute_led_gpio; | 351 | spec->gpio_data &= ~spec->mic_mute_led_gpio; |
@@ -1788,6 +1797,12 @@ static const struct hda_pintbl intel_dg45id_pin_configs[] = { | |||
1788 | {} | 1797 | {} |
1789 | }; | 1798 | }; |
1790 | 1799 | ||
1800 | static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = { | ||
1801 | { 0x0a, 0x02214030 }, | ||
1802 | { 0x0b, 0x02A19010 }, | ||
1803 | {} | ||
1804 | }; | ||
1805 | |||
1791 | static void stac92hd73xx_fixup_ref(struct hda_codec *codec, | 1806 | static void stac92hd73xx_fixup_ref(struct hda_codec *codec, |
1792 | const struct hda_fixup *fix, int action) | 1807 | const struct hda_fixup *fix, int action) |
1793 | { | 1808 | { |
@@ -1906,6 +1921,10 @@ static const struct hda_fixup stac92hd73xx_fixups[] = { | |||
1906 | [STAC_92HD73XX_NO_JD] = { | 1921 | [STAC_92HD73XX_NO_JD] = { |
1907 | .type = HDA_FIXUP_FUNC, | 1922 | .type = HDA_FIXUP_FUNC, |
1908 | .v.func = stac92hd73xx_fixup_no_jd, | 1923 | .v.func = stac92hd73xx_fixup_no_jd, |
1924 | }, | ||
1925 | [STAC_92HD89XX_HP_FRONT_JACK] = { | ||
1926 | .type = HDA_FIXUP_PINS, | ||
1927 | .v.pins = stac92hd89xx_hp_front_jack_pin_configs, | ||
1909 | } | 1928 | } |
1910 | }; | 1929 | }; |
1911 | 1930 | ||
@@ -1966,6 +1985,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = { | |||
1966 | "Alienware M17x", STAC_ALIENWARE_M17X), | 1985 | "Alienware M17x", STAC_ALIENWARE_M17X), |
1967 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, | 1986 | SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, |
1968 | "Alienware M17x R3", STAC_DELL_EQ), | 1987 | "Alienware M17x R3", STAC_DELL_EQ), |
1988 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, | ||
1989 | "unknown HP", STAC_92HD89XX_HP_FRONT_JACK), | ||
1969 | {} /* terminator */ | 1990 | {} /* terminator */ |
1970 | }; | 1991 | }; |
1971 | 1992 | ||
@@ -2110,6 +2131,17 @@ static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec, | |||
2110 | } | 2131 | } |
2111 | } | 2132 | } |
2112 | 2133 | ||
2134 | static void stac92hd83xxx_fixup_hp_led_gpio10(struct hda_codec *codec, | ||
2135 | const struct hda_fixup *fix, int action) | ||
2136 | { | ||
2137 | struct sigmatel_spec *spec = codec->spec; | ||
2138 | |||
2139 | if (action == HDA_FIXUP_ACT_PRE_PROBE) { | ||
2140 | spec->gpio_led = 0x10; /* GPIO4 */ | ||
2141 | spec->default_polarity = 0; | ||
2142 | } | ||
2143 | } | ||
2144 | |||
2113 | static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec, | 2145 | static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec, |
2114 | const struct hda_fixup *fix, int action) | 2146 | const struct hda_fixup *fix, int action) |
2115 | { | 2147 | { |
@@ -2604,6 +2636,12 @@ static const struct hda_fixup stac92hd83xxx_fixups[] = { | |||
2604 | .chained = true, | 2636 | .chained = true, |
2605 | .chain_id = STAC_92HD83XXX_HP, | 2637 | .chain_id = STAC_92HD83XXX_HP, |
2606 | }, | 2638 | }, |
2639 | [STAC_HP_LED_GPIO10] = { | ||
2640 | .type = HDA_FIXUP_FUNC, | ||
2641 | .v.func = stac92hd83xxx_fixup_hp_led_gpio10, | ||
2642 | .chained = true, | ||
2643 | .chain_id = STAC_92HD83XXX_HP, | ||
2644 | }, | ||
2607 | [STAC_92HD83XXX_HEADSET_JACK] = { | 2645 | [STAC_92HD83XXX_HEADSET_JACK] = { |
2608 | .type = HDA_FIXUP_FUNC, | 2646 | .type = HDA_FIXUP_FUNC, |
2609 | .v.func = stac92hd83xxx_fixup_headset_jack, | 2647 | .v.func = stac92hd83xxx_fixup_headset_jack, |
@@ -2682,6 +2720,8 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = { | |||
2682 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), | 2720 | "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), |
2683 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888, | 2721 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888, |
2684 | "HP Envy Spectre", STAC_HP_ENVY_BASS), | 2722 | "HP Envy Spectre", STAC_HP_ENVY_BASS), |
2723 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1899, | ||
2724 | "HP Folio 13", STAC_HP_LED_GPIO10), | ||
2685 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df, | 2725 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df, |
2686 | "HP Folio", STAC_HP_BNB13_EQ), | 2726 | "HP Folio", STAC_HP_BNB13_EQ), |
2687 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8, | 2727 | SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8, |
@@ -4462,7 +4502,7 @@ static void stac_setup_gpio(struct hda_codec *codec) | |||
4462 | if (spec->mic_mute_led_gpio) { | 4502 | if (spec->mic_mute_led_gpio) { |
4463 | spec->gpio_mask |= spec->mic_mute_led_gpio; | 4503 | spec->gpio_mask |= spec->mic_mute_led_gpio; |
4464 | spec->gpio_dir |= spec->mic_mute_led_gpio; | 4504 | spec->gpio_dir |= spec->mic_mute_led_gpio; |
4465 | spec->mic_mute_led_on = true; | 4505 | spec->mic_enabled = 0; |
4466 | spec->gpio_data |= spec->mic_mute_led_gpio; | 4506 | spec->gpio_data |= spec->mic_mute_led_gpio; |
4467 | 4507 | ||
4468 | spec->gen.cap_sync_hook = stac_capture_led_hook; | 4508 | spec->gen.cap_sync_hook = stac_capture_led_hook; |