diff options
author | Takashi Iwai <tiwai@suse.de> | 2008-12-05 06:54:56 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2008-12-05 06:54:56 -0500 |
commit | e6e3ea25b1679b55728a8a470a50a8fff61e8a45 (patch) | |
tree | c7febce816f15ad049cb25e0cc92692065b807e3 /sound/pci/hda/patch_sigmatel.c | |
parent | 4151d154efc2eb1e48b0950e93660691426dd23f (diff) |
ALSA: hda - Fix pin-detection in patch_sigmatel.c
The pin-detection function used in patch_sigmatel.c shouldn't be specific
to HP pin because it's used for input pins in general, too.
This patch fixes the detection function, removes the HP check from it
and moves to stac92xx_hp_detect().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index f98c7e997877..08170dff75e0 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -4061,20 +4061,13 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, | |||
4061 | pin_ctl & ~flag); | 4061 | pin_ctl & ~flag); |
4062 | } | 4062 | } |
4063 | 4063 | ||
4064 | static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid) | 4064 | static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) |
4065 | { | 4065 | { |
4066 | if (!nid) | 4066 | if (!nid) |
4067 | return 0; | 4067 | return 0; |
4068 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) | 4068 | if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) |
4069 | & (1 << 31)) { | 4069 | & (1 << 31)) |
4070 | unsigned int pinctl; | 4070 | return 1; |
4071 | pinctl = snd_hda_codec_read(codec, nid, 0, | ||
4072 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
4073 | if (pinctl & AC_PINCTL_IN_EN) | ||
4074 | return 0; /* mic- or line-input */ | ||
4075 | else | ||
4076 | return 1; /* HP-output */ | ||
4077 | } | ||
4078 | return 0; | 4071 | return 0; |
4079 | } | 4072 | } |
4080 | 4073 | ||
@@ -4114,7 +4107,14 @@ static void stac92xx_hp_detect(struct hda_codec *codec) | |||
4114 | break; | 4107 | break; |
4115 | if (no_hp_sensing(spec, i)) | 4108 | if (no_hp_sensing(spec, i)) |
4116 | continue; | 4109 | continue; |
4117 | presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); | 4110 | presence = get_pin_presence(codec, cfg->hp_pins[i]); |
4111 | if (presence) { | ||
4112 | unsigned int pinctl; | ||
4113 | pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, | ||
4114 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
4115 | if (pinctl & AC_PINCTL_IN_EN) | ||
4116 | presence = 0; /* mic- or line-input */ | ||
4117 | } | ||
4118 | } | 4118 | } |
4119 | 4119 | ||
4120 | if (presence) { | 4120 | if (presence) { |
@@ -4191,7 +4191,7 @@ static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, | |||
4191 | 4191 | ||
4192 | static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) | 4192 | static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid) |
4193 | { | 4193 | { |
4194 | stac_toggle_power_map(codec, nid, get_hp_pin_presence(codec, nid)); | 4194 | stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid)); |
4195 | } | 4195 | } |
4196 | 4196 | ||
4197 | static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid) | 4197 | static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid) |
@@ -4213,7 +4213,7 @@ static void stac92xx_report_jack(struct hda_codec *codec, hda_nid_t nid) | |||
4213 | type = (pin_ctl & AC_PINCTL_HP_EN) | 4213 | type = (pin_ctl & AC_PINCTL_HP_EN) |
4214 | ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT; | 4214 | ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT; |
4215 | snd_jack_report(jacks->jack, | 4215 | snd_jack_report(jacks->jack, |
4216 | get_hp_pin_presence(codec, nid) | 4216 | get_pin_presence(codec, nid) |
4217 | ? type : 0); | 4217 | ? type : 0); |
4218 | } | 4218 | } |
4219 | jacks++; | 4219 | jacks++; |
@@ -5349,7 +5349,7 @@ static int stac9872_vaio_init(struct hda_codec *codec) | |||
5349 | 5349 | ||
5350 | static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res) | 5350 | static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res) |
5351 | { | 5351 | { |
5352 | if (get_hp_pin_presence(codec, 0x0a)) { | 5352 | if (get_pin_presence(codec, 0x0a)) { |
5353 | stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); | 5353 | stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); |
5354 | stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); | 5354 | stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); |
5355 | } else { | 5355 | } else { |