diff options
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
| -rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 710 | 
1 files changed, 665 insertions, 45 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index fba0cef1c47..3744ea4e843 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c @@ -83,6 +83,7 @@ enum {  	STAC_DELL_M6_BOTH,  	STAC_DELL_EQ,  	STAC_ALIENWARE_M17X, +	STAC_92HD89XX_HP_FRONT_JACK,  	STAC_92HD73XX_MODELS  }; @@ -97,9 +98,11 @@ enum {  	STAC_92HD83XXX_HP_LED,  	STAC_92HD83XXX_HP_INV_LED,  	STAC_92HD83XXX_HP_MIC_LED, +	STAC_HP_LED_GPIO10,  	STAC_92HD83XXX_HEADSET_JACK,  	STAC_92HD83XXX_HP,  	STAC_HP_ENVY_BASS, +	STAC_HP_BNB13_EQ,  	STAC_92HD83XXX_MODELS  }; @@ -119,6 +122,12 @@ enum {  };  enum { +	STAC_92HD95_HP_LED, +	STAC_92HD95_HP_BASS, +	STAC_92HD95_MODELS +}; + +enum {  	STAC_925x_REF,  	STAC_M1,  	STAC_M1_2, @@ -193,7 +202,7 @@ struct sigmatel_spec {  	int default_polarity;  	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 */  	unsigned int stream_delay; @@ -293,7 +302,7 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,  {  	unsigned int gpiostate, gpiomask, gpiodir; -	snd_printdd("%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data); +	codec_dbg(codec, "%s msk %x dir %x gpio %x\n", __func__, mask, dir_mask, data);  	gpiostate = snd_hda_codec_read(codec, codec->afg, 0,  				       AC_VERB_GET_GPIO_DATA, 0); @@ -323,19 +332,26 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,  /* hook for controlling mic-mute LED GPIO */  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; -	bool mute; +	unsigned int mask; +	bool cur_mute, prev_mute; -	if (!ucontrol) +	if (!kcontrol || !ucontrol)  		return; -	mute = !(ucontrol->value.integer.value[0] || -		 ucontrol->value.integer.value[1]); -	if (spec->mic_mute_led_on != mute) { -		spec->mic_mute_led_on = mute; -		if (mute) +	mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); +	prev_mute = !spec->mic_enabled; +	if (ucontrol->value.integer.value[0] || +	    ucontrol->value.integer.value[1]) +		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;  		else  			spec->gpio_data &= ~spec->mic_mute_led_gpio; @@ -349,7 +365,7 @@ static int stac_vrefout_set(struct hda_codec *codec,  {  	int error, pinctl; -	snd_printdd("%s, nid %x ctl %x\n", __func__, nid, new_vref); +	codec_dbg(codec, "%s, nid %x ctl %x\n", __func__, nid, new_vref);  	pinctl = snd_hda_codec_read(codec, nid, 0,  				AC_VERB_GET_PIN_WIDGET_CONTROL, 0); @@ -367,6 +383,17 @@ static int stac_vrefout_set(struct hda_codec *codec,  	return 1;  } +/* prevent codec AFG to D3 state when vref-out pin is used for mute LED */ +/* this hook is set in stac_setup_gpio() */ +static unsigned int stac_vref_led_power_filter(struct hda_codec *codec, +					       hda_nid_t nid, +					       unsigned int power_state) +{ +	if (nid == codec->afg && power_state == AC_PWRST_D3) +		return AC_PWRST_D1; +	return snd_hda_gen_path_power_filter(codec, nid, power_state); +} +  /* update mute-LED accoring to the master switch */  static void stac_update_led_status(struct hda_codec *codec, int enabled)  { @@ -774,7 +801,7 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)  	}  	while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) { -		if (sscanf(dev->name, "HP_Mute_LED_%d_%x", +		if (sscanf(dev->name, "HP_Mute_LED_%u_%x",  			   &spec->gpio_led_polarity,  			   &spec->gpio_led) == 2) {  			unsigned int max_gpio; @@ -787,7 +814,7 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)  				spec->vref_mute_led_nid = spec->gpio_led;  			return 1;  		} -		if (sscanf(dev->name, "HP_Mute_LED_%d", +		if (sscanf(dev->name, "HP_Mute_LED_%u",  			   &spec->gpio_led_polarity) == 1) {  			set_hp_led_gpio(codec);  			return 1; @@ -1776,6 +1803,12 @@ static const struct hda_pintbl intel_dg45id_pin_configs[] = {  	{}  }; +static const struct hda_pintbl stac92hd89xx_hp_front_jack_pin_configs[] = { +	{ 0x0a, 0x02214030 }, +	{ 0x0b, 0x02A19010 }, +	{} +}; +  static void stac92hd73xx_fixup_ref(struct hda_codec *codec,  				   const struct hda_fixup *fix, int action)  { @@ -1894,6 +1927,10 @@ static const struct hda_fixup stac92hd73xx_fixups[] = {  	[STAC_92HD73XX_NO_JD] = {  		.type = HDA_FIXUP_FUNC,  		.v.func = stac92hd73xx_fixup_no_jd, +	}, +	[STAC_92HD89XX_HP_FRONT_JACK] = { +		.type = HDA_FIXUP_PINS, +		.v.pins = stac92hd89xx_hp_front_jack_pin_configs,  	}  }; @@ -1954,6 +1991,8 @@ static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {  		      "Alienware M17x", STAC_ALIENWARE_M17X),  	SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490,  		      "Alienware M17x R3", STAC_DELL_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2b17, +				"unknown HP", STAC_92HD89XX_HP_FRONT_JACK),  	{} /* terminator */  }; @@ -2053,9 +2092,12 @@ static void stac92hd83xxx_fixup_hp(struct hda_codec *codec,  	}  	if (find_mute_led_cfg(codec, spec->default_polarity)) -		snd_printd("mute LED gpio %d polarity %d\n", +		codec_dbg(codec, "mute LED gpio %d polarity %d\n",  				spec->gpio_led,  				spec->gpio_led_polarity); + +	/* allow auto-switching of dock line-in */ +	spec->gen.line_in_auto_switch = true;  }  static void stac92hd83xxx_fixup_hp_zephyr(struct hda_codec *codec, @@ -2091,8 +2133,22 @@ static void stac92hd83xxx_fixup_hp_mic_led(struct hda_codec *codec,  {  	struct sigmatel_spec *spec = codec->spec; -	if (action == HDA_FIXUP_ACT_PRE_PROBE) +	if (action == HDA_FIXUP_ACT_PRE_PROBE) {  		spec->mic_mute_led_gpio = 0x08; /* GPIO3 */ +		/* resetting controller clears GPIO, so we need to keep on */ +		codec->bus->power_keep_link_on = 1; +	} +} + +static void stac92hd83xxx_fixup_hp_led_gpio10(struct hda_codec *codec, +				   const struct hda_fixup *fix, int action) +{ +	struct sigmatel_spec *spec = codec->spec; + +	if (action == HDA_FIXUP_ACT_PRE_PROBE) { +		spec->gpio_led = 0x10; /* GPIO4 */ +		spec->default_polarity = 0; +	}  }  static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec, @@ -2104,6 +2160,434 @@ static void stac92hd83xxx_fixup_headset_jack(struct hda_codec *codec,  		spec->headset_jack = 1;  } +static const struct hda_verb hp_bnb13_eq_verbs[] = { +	/* 44.1KHz base */ +	{ 0x22, 0x7A6, 0x3E }, +	{ 0x22, 0x7A7, 0x68 }, +	{ 0x22, 0x7A8, 0x17 }, +	{ 0x22, 0x7A9, 0x3E }, +	{ 0x22, 0x7AA, 0x68 }, +	{ 0x22, 0x7AB, 0x17 }, +	{ 0x22, 0x7AC, 0x00 }, +	{ 0x22, 0x7AD, 0x80 }, +	{ 0x22, 0x7A6, 0x83 }, +	{ 0x22, 0x7A7, 0x2F }, +	{ 0x22, 0x7A8, 0xD1 }, +	{ 0x22, 0x7A9, 0x83 }, +	{ 0x22, 0x7AA, 0x2F }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22, 0x7A8, 0x00 }, +	{ 0x22, 0x7A9, 0x40 }, +	{ 0x22, 0x7AA, 0x00 }, +	{ 0x22, 0x7AB, 0x00 }, +	{ 0x22, 0x7AC, 0x33 }, +	{ 0x22, 0x7AD, 0x80 }, +	/* common */ +	{ 0x22, 0x782, 0xC1 }, +	{ 0x22, 0x771, 0x2C }, +	{ 0x22, 0x772, 0x2C }, +	{ 0x22, 0x788, 0x04 }, +	{ 0x01, 0x7B0, 0x08 }, +	{} +}; +  static const struct hda_fixup stac92hd83xxx_fixups[] = {  	[STAC_92HD83XXX_REF] = {  		.type = HDA_FIXUP_PINS, @@ -2161,6 +2645,12 @@ static const struct hda_fixup stac92hd83xxx_fixups[] = {  		.chained = true,  		.chain_id = STAC_92HD83XXX_HP,  	}, +	[STAC_HP_LED_GPIO10] = { +		.type = HDA_FIXUP_FUNC, +		.v.func = stac92hd83xxx_fixup_hp_led_gpio10, +		.chained = true, +		.chain_id = STAC_92HD83XXX_HP, +	},  	[STAC_92HD83XXX_HEADSET_JACK] = {  		.type = HDA_FIXUP_FUNC,  		.v.func = stac92hd83xxx_fixup_headset_jack, @@ -2172,6 +2662,12 @@ static const struct hda_fixup stac92hd83xxx_fixups[] = {  			{}  		},  	}, +	[STAC_HP_BNB13_EQ] = { +		.type = HDA_FIXUP_VERBS, +		.v.verbs = hp_bnb13_eq_verbs, +		.chained = true, +		.chain_id = STAC_92HD83XXX_HP_MIC_LED, +	},  };  static const struct hda_model_fixup stac92hd83xxx_models[] = { @@ -2187,6 +2683,7 @@ static const struct hda_model_fixup stac92hd83xxx_models[] = {  	{ .id = STAC_92HD83XXX_HP_MIC_LED, .name = "hp-mic-led" },  	{ .id = STAC_92HD83XXX_HEADSET_JACK, .name = "headset-jack" },  	{ .id = STAC_HP_ENVY_BASS, .name = "hp-envy-bass" }, +	{ .id = STAC_HP_BNB13_EQ, .name = "hp-bnb13-eq" },  	{}  }; @@ -2232,8 +2729,104 @@ static const struct snd_pci_quirk stac92hd83xxx_fixup_tbl[] = {  			  "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1888,  			  "HP Envy Spectre", STAC_HP_ENVY_BASS), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1899, +			  "HP Folio 13", STAC_HP_LED_GPIO10),  	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18df, -			  "HP Folio", STAC_92HD83XXX_HP_MIC_LED), +			  "HP Folio", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x18F8, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1909, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x190A, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1940, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1941, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1942, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1943, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1944, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1945, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1946, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1948, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1949, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194A, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194B, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194C, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194E, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x194F, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1950, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1951, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195A, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195B, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x195C, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1991, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2103, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2104, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2105, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2106, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2107, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2108, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2109, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210A, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x210B, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211C, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211D, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211E, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x211F, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2120, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2121, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2122, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2123, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213E, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x213F, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x2140, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B2, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B3, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B5, +			  "HP bNB13", STAC_HP_BNB13_EQ), +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x21B6, +			  "HP bNB13", STAC_HP_BNB13_EQ),  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x1900,  			  "HP", STAC_92HD83XXX_HP_MIC_LED),  	SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x2000, @@ -2493,7 +3086,7 @@ static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,  	}  	if (find_mute_led_cfg(codec, 1)) -		snd_printd("mute LED gpio %d polarity %d\n", +		codec_dbg(codec, "mute LED gpio %d polarity %d\n",  				spec->gpio_led,  				spec->gpio_led_polarity); @@ -3541,6 +4134,48 @@ static const struct snd_pci_quirk stac9205_fixup_tbl[] = {  	{} /* terminator */  }; +static void stac92hd95_fixup_hp_led(struct hda_codec *codec, +				    const struct hda_fixup *fix, int action) +{ +	struct sigmatel_spec *spec = codec->spec; + +	if (action != HDA_FIXUP_ACT_PRE_PROBE) +		return; + +	if (find_mute_led_cfg(codec, spec->default_polarity)) +		codec_dbg(codec, "mute LED gpio %d polarity %d\n", +				spec->gpio_led, +				spec->gpio_led_polarity); +} + +static const struct hda_fixup stac92hd95_fixups[] = { +	[STAC_92HD95_HP_LED] = { +		.type = HDA_FIXUP_FUNC, +		.v.func = stac92hd95_fixup_hp_led, +	}, +	[STAC_92HD95_HP_BASS] = { +		.type = HDA_FIXUP_VERBS, +		.v.verbs = (const struct hda_verb[]) { +			{0x1a, 0x795, 0x00}, /* HPF to 100Hz */ +			{} +		}, +		.chained = true, +		.chain_id = STAC_92HD95_HP_LED, +	}, +}; + +static const struct snd_pci_quirk stac92hd95_fixup_tbl[] = { +	SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1911, "HP Spectre 13", STAC_92HD95_HP_BASS), +	{} /* terminator */ +}; + +static const struct hda_model_fixup stac92hd95_models[] = { +	{ .id = STAC_92HD95_HP_LED, .name = "hp-led" }, +	{ .id = STAC_92HD95_HP_BASS, .name = "hp-bass" }, +	{} +}; + +  static int stac_parse_auto_config(struct hda_codec *codec)  {  	struct sigmatel_spec *spec = codec->spec; @@ -3727,30 +4362,8 @@ static int stac_suspend(struct hda_codec *codec)  	stac_shutup(codec);  	return 0;  } - -static void stac_set_power_state(struct hda_codec *codec, hda_nid_t fg, -				 unsigned int power_state) -{ -	unsigned int afg_power_state = power_state; -	struct sigmatel_spec *spec = codec->spec; - -	if (power_state == AC_PWRST_D3) { -		if (spec->vref_mute_led_nid) { -			/* with vref-out pin used for mute led control -			 * codec AFG is prevented from D3 state -			 */ -			afg_power_state = AC_PWRST_D1; -		} -		/* this delay seems necessary to avoid click noise at power-down */ -		msleep(100); -	} -	snd_hda_codec_read(codec, fg, 0, AC_VERB_SET_POWER_STATE, -			afg_power_state); -	snd_hda_codec_set_power_to_all(codec, fg, power_state); -}  #else  #define stac_suspend		NULL -#define stac_set_power_state	NULL  #endif /* CONFIG_PM */  static const struct hda_codec_ops stac_patch_ops = { @@ -3860,8 +4473,8 @@ static int patch_stac92hd73xx(struct hda_codec *codec)  	num_dacs = snd_hda_get_num_conns(codec, 0x0a) - 1;  	if (num_dacs < 3 || num_dacs > 5) { -		printk(KERN_WARNING "hda_codec: Could not determine " -		       "number of channels defaulting to DAC count\n"); +		codec_warn(codec, +			   "Could not determine number of channels defaulting to DAC count\n");  		num_dacs = 5;  	} @@ -3933,15 +4546,14 @@ static void stac_setup_gpio(struct hda_codec *codec)  			spec->gpio_dir |= spec->gpio_led;  			spec->gpio_data |= spec->gpio_led;  		} else { -			codec->patch_ops.set_power_state = -					stac_set_power_state; +			codec->power_filter = stac_vref_led_power_filter;  		}  	}  	if (spec->mic_mute_led_gpio) {  		spec->gpio_mask |= 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->gen.cap_sync_hook = stac_capture_led_hook; @@ -4016,10 +4628,16 @@ static int patch_stac92hd95(struct hda_codec *codec)  	spec->gen.beep_nid = 0x19; /* digital beep */  	spec->pwr_nids = stac92hd95_pwr_nids;  	spec->num_pwrs = ARRAY_SIZE(stac92hd95_pwr_nids); -	spec->default_polarity = -1; /* no default cfg */ +	spec->default_polarity = 0;  	codec->patch_ops = stac_patch_ops; +	snd_hda_pick_fixup(codec, stac92hd95_models, stac92hd95_fixup_tbl, +			   stac92hd95_fixups); +	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE); + +	stac_setup_gpio(codec); +  	err = stac_parse_auto_config(codec);  	if (err < 0) {  		stac_free(codec); @@ -4028,6 +4646,8 @@ static int patch_stac92hd95(struct hda_codec *codec)  	codec->proc_widget_hook = stac92hd_proc_hook; +	snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE); +  	return 0;  }  | 
