Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0cea0d0 authored by Matt Ranostay's avatar Matt Ranostay Committed by Takashi Iwai
Browse files

ALSA: hda: STAC_DELL_M6 EAPD



Add support for EAPD on system suspend and disabling EAPD on headphone jack
detection for STAC_DELL_M6 laptops.

Signed-off-by: default avatarMatthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 3ab90935
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -147,6 +147,7 @@ struct sigmatel_spec {
	unsigned int num_mixers;

	int board_config;
	unsigned int eapd_switch: 1;
	unsigned int surr_switch: 1;
	unsigned int line_switch: 1;
	unsigned int mic_switch: 1;
@@ -4001,7 +4002,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
		for (i = 0; i < cfg->speaker_outs; i++)
			stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
						AC_PINCTL_OUT_EN);
		if (spec->eapd_mask)
		if (spec->eapd_mask && spec->eapd_switch)
			stac_gpio_set(codec, spec->gpio_mask,
				spec->gpio_dir, spec->gpio_data &
				~spec->eapd_mask);
@@ -4016,7 +4017,7 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
		for (i = 0; i < cfg->speaker_outs; i++)
			stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
						AC_PINCTL_OUT_EN);
		if (spec->eapd_mask)
		if (spec->eapd_mask && spec->eapd_switch)
			stac_gpio_set(codec, spec->gpio_mask,
				spec->gpio_dir, spec->gpio_data |
				spec->eapd_mask);
@@ -4376,6 +4377,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
		spec->num_smuxes = 0;
		spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER];
		spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP];
		spec->eapd_switch = 0;
		spec->num_amps = 1;

		if (!spec->init)
@@ -4407,6 +4409,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
	default:
		spec->num_dmics = STAC92HD73XX_NUM_DMICS;
		spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
		spec->eapd_switch = 1;
	}
	if (spec->board_config > STAC_92HD73XX_REF) {
		/* GPIO0 High = Enable EAPD */
@@ -4552,7 +4555,13 @@ static int stac92hd71xx_resume(struct hda_codec *codec)

static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state)
{
	struct sigmatel_spec *spec = codec->spec;

	stac92hd71xx_set_power_state(codec, AC_PWRST_D3);
	if (spec->eapd_mask)
		stac_gpio_set(codec, spec->gpio_mask,
				spec->gpio_dir, spec->gpio_data &
				~spec->eapd_mask);
	return 0;
};

@@ -4942,6 +4951,7 @@ static int patch_stac927x(struct hda_codec *codec)
	spec->num_pwrs = 0;
	spec->aloopback_mask = 0x40;
	spec->aloopback_shift = 0;
	spec->eapd_switch = 1;

	err = stac92xx_parse_auto_config(codec, 0x1e, 0x20);
	if (!err) {
@@ -5022,6 +5032,7 @@ static int patch_stac9205(struct hda_codec *codec)

	spec->aloopback_mask = 0x40;
	spec->aloopback_shift = 0;
	spec->eapd_switch = 1;
	spec->multiout.dac_nids = spec->dac_nids;
	
	switch (spec->board_config){