diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-12-05 07:09:27 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-12-05 07:09:27 -0500 |
commit | 12dde4c6d6e9092cf63094e84dc1fe4e505dd6d0 (patch) | |
tree | a4ff353b79e346d663be73200a00385591e46722 /sound/pci | |
parent | e6e3ea25b1679b55728a8a470a50a8fff61e8a45 (diff) |
ALSA: hda - Proper power-map toggling for input pins
The current code overrides the event type on input pins always to
PWR_EVENT. Although this still works (PWR_EVENT and INSERT_EVENT
are handled samely), it'd be better to avoid such overrides.
Also, currently the unsol events are registered even for fixed pins
which will never raise the pin-detection event.
This patch fixes both issues.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 08170dff75e0..4c851fd55565 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -3915,24 +3915,36 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3915 | } else { | 3915 | } else { |
3916 | stac92xx_auto_init_multi_out(codec); | 3916 | stac92xx_auto_init_multi_out(codec); |
3917 | stac92xx_auto_init_hp_out(codec); | 3917 | stac92xx_auto_init_hp_out(codec); |
3918 | for (i = 0; i < cfg->hp_outs; i++) | ||
3919 | stac_toggle_power_map(codec, cfg->hp_pins[i], 1); | ||
3918 | } | 3920 | } |
3919 | for (i = 0; i < AUTO_PIN_LAST; i++) { | 3921 | for (i = 0; i < AUTO_PIN_LAST; i++) { |
3920 | hda_nid_t nid = cfg->input_pins[i]; | 3922 | hda_nid_t nid = cfg->input_pins[i]; |
3921 | if (nid) { | 3923 | if (nid) { |
3922 | unsigned int pinctl; | 3924 | unsigned int pinctl, conf; |
3923 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { | 3925 | if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { |
3924 | /* for mic pins, force to initialize */ | 3926 | /* for mic pins, force to initialize */ |
3925 | pinctl = stac92xx_get_vref(codec, nid); | 3927 | pinctl = stac92xx_get_vref(codec, nid); |
3928 | pinctl |= AC_PINCTL_IN_EN; | ||
3929 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | ||
3926 | } else { | 3930 | } else { |
3927 | pinctl = snd_hda_codec_read(codec, nid, 0, | 3931 | pinctl = snd_hda_codec_read(codec, nid, 0, |
3928 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | 3932 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); |
3929 | /* if PINCTL already set then skip */ | 3933 | /* if PINCTL already set then skip */ |
3930 | if (pinctl & AC_PINCTL_IN_EN) | 3934 | if (!(pinctl & AC_PINCTL_IN_EN)) { |
3931 | continue; | 3935 | pinctl |= AC_PINCTL_IN_EN; |
3936 | stac92xx_auto_set_pinctl(codec, nid, | ||
3937 | pinctl); | ||
3938 | } | ||
3939 | } | ||
3940 | conf = snd_hda_codec_read(codec, nid, 0, | ||
3941 | AC_VERB_GET_CONFIG_DEFAULT, 0); | ||
3942 | if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { | ||
3943 | enable_pin_detect(codec, nid, | ||
3944 | STAC_INSERT_EVENT); | ||
3945 | stac_issue_unsol_event(codec, nid, | ||
3946 | STAC_INSERT_EVENT); | ||
3932 | } | 3947 | } |
3933 | pinctl |= AC_PINCTL_IN_EN; | ||
3934 | stac92xx_auto_set_pinctl(codec, nid, pinctl); | ||
3935 | enable_pin_detect(codec, nid, STAC_INSERT_EVENT); | ||
3936 | } | 3948 | } |
3937 | } | 3949 | } |
3938 | for (i = 0; i < spec->num_dmics; i++) | 3950 | for (i = 0; i < spec->num_dmics; i++) |
@@ -3969,8 +3981,10 @@ static int stac92xx_init(struct hda_codec *codec) | |||
3969 | stac_toggle_power_map(codec, nid, 1); | 3981 | stac_toggle_power_map(codec, nid, 1); |
3970 | continue; | 3982 | continue; |
3971 | } | 3983 | } |
3972 | enable_pin_detect(codec, nid, STAC_PWR_EVENT); | 3984 | if (!stac_get_event(codec, nid, STAC_INSERT_EVENT)) { |
3973 | stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); | 3985 | enable_pin_detect(codec, nid, STAC_PWR_EVENT); |
3986 | stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); | ||
3987 | } | ||
3974 | } | 3988 | } |
3975 | if (spec->dac_list) | 3989 | if (spec->dac_list) |
3976 | stac92xx_power_down(codec); | 3990 | stac92xx_power_down(codec); |