diff options
author | Matthew Ranostay <mranostay@embeddedalley.com> | 2008-10-09 09:32:17 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2008-10-10 07:42:00 -0400 |
commit | 72474be62d6ec2e0337ff01ecbd737f9c5c242c7 (patch) | |
tree | 20c62ee1521b41674b6a59217cee94483a324fc2 /sound/pci | |
parent | b9aea7150a84d037b6ca3c2506b0058cee4eb1d2 (diff) |
ALSA: hda: VREF powerdown for headphones
Add support for powering down VREF on standard headphone insertion, also
powers up the VREF on a headset insertion.
Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 5c65f7d4606f..c461baa83c2a 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #define NUM_CONTROL_ALLOC 32 | 38 | #define NUM_CONTROL_ALLOC 32 |
39 | #define STAC_PWR_EVENT 0x20 | 39 | #define STAC_PWR_EVENT 0x20 |
40 | #define STAC_HP_EVENT 0x30 | 40 | #define STAC_HP_EVENT 0x30 |
41 | #define STAC_VREF_EVENT 0x40 | ||
41 | 42 | ||
42 | enum { | 43 | enum { |
43 | STAC_REF, | 44 | STAC_REF, |
@@ -3854,13 +3855,22 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) | |||
3854 | struct sigmatel_spec *spec = codec->spec; | 3855 | struct sigmatel_spec *spec = codec->spec; |
3855 | int idx = res >> 26 & 0x0f; | 3856 | int idx = res >> 26 & 0x0f; |
3856 | 3857 | ||
3857 | switch ((res >> 26) & 0x30) { | 3858 | switch ((res >> 26) & 0x70) { |
3858 | case STAC_HP_EVENT: | 3859 | case STAC_HP_EVENT: |
3859 | stac92xx_hp_detect(codec, res); | 3860 | stac92xx_hp_detect(codec, res); |
3860 | /* fallthru */ | 3861 | /* fallthru */ |
3861 | case STAC_PWR_EVENT: | 3862 | case STAC_PWR_EVENT: |
3862 | if (spec->num_pwrs > 0) | 3863 | if (spec->num_pwrs > 0) |
3863 | stac92xx_pin_sense(codec, idx); | 3864 | stac92xx_pin_sense(codec, idx); |
3865 | break; | ||
3866 | case STAC_VREF_EVENT: { | ||
3867 | int data = snd_hda_codec_read(codec, codec->afg, 0, | ||
3868 | AC_VERB_GET_GPIO_DATA, 0); | ||
3869 | /* toggle VREF state based on GPIOx status */ | ||
3870 | snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, | ||
3871 | !!(data & (1 << idx))); | ||
3872 | break; | ||
3873 | } | ||
3864 | } | 3874 | } |
3865 | } | 3875 | } |
3866 | 3876 | ||
@@ -4360,6 +4370,17 @@ again: | |||
4360 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; | 4370 | codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; |
4361 | break; | 4371 | break; |
4362 | case 0x111d7608: /* 5 Port with Analog Mixer */ | 4372 | case 0x111d7608: /* 5 Port with Analog Mixer */ |
4373 | switch (codec->subsystem_id) { | ||
4374 | case 0x103c361a: | ||
4375 | /* Enable VREF power saving on GPIO1 detect */ | ||
4376 | snd_hda_codec_write(codec, codec->afg, 0, | ||
4377 | AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); | ||
4378 | snd_hda_codec_write_cache(codec, codec->afg, 0, | ||
4379 | AC_VERB_SET_UNSOLICITED_ENABLE, | ||
4380 | (AC_USRSP_EN | STAC_VREF_EVENT | 0x01)); | ||
4381 | spec->gpio_mask |= 0x02; | ||
4382 | break; | ||
4383 | } | ||
4363 | if ((codec->revision_id & 0xf) == 0 || | 4384 | if ((codec->revision_id & 0xf) == 0 || |
4364 | (codec->revision_id & 0xf) == 1) { | 4385 | (codec->revision_id & 0xf) == 1) { |
4365 | #ifdef SND_HDA_NEEDS_RESUME | 4386 | #ifdef SND_HDA_NEEDS_RESUME |