aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-11-18 08:23:37 -0500
committerTakashi Iwai <tiwai@suse.de>2009-11-18 08:23:37 -0500
commit8af3aeb498197f6fdf5acc913ffe8a392cb921c9 (patch)
tree8e1de2a644a54ea973878bce071961f5bbb1f054 /sound
parentd56757abc11a21996d9839c0d4e3b2c3666cd318 (diff)
ALSA: hda - Fix detection of dual headphones
The dual-headphone mode with STAC/IDT codecs is useful only for machines that have two (or more) built-in headphones. But, some HP laptops give multiple headphone pin configs, one for the built-in and another for the separate (likely a docking station) one. This results in a missing speaker volume control. This patch adds more check for the dual-headphone mode to avoid this problem. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_sigmatel.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index d83649c25fb2..39001c47e627 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -3635,6 +3635,26 @@ static void stac92xx_auto_init_hp_out(struct hda_codec *codec)
3635 } 3635 }
3636} 3636}
3637 3637
3638static int is_dual_headphones(struct hda_codec *codec)
3639{
3640 struct sigmatel_spec *spec = codec->spec;
3641 int i, valid_hps;
3642
3643 if (spec->autocfg.line_out_type != AUTO_PIN_SPEAKER_OUT ||
3644 spec->autocfg.hp_outs <= 1)
3645 return 0;
3646 valid_hps = 0;
3647 for (i = 0; i < spec->autocfg.hp_outs; i++) {
3648 hda_nid_t nid = spec->autocfg.hp_pins[i];
3649 unsigned int cfg = snd_hda_codec_get_pincfg(codec, nid);
3650 if (get_defcfg_location(cfg) & AC_JACK_LOC_SEPARATE)
3651 continue;
3652 valid_hps++;
3653 }
3654 return (valid_hps > 1);
3655}
3656
3657
3638static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in) 3658static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out, hda_nid_t dig_in)
3639{ 3659{
3640 struct sigmatel_spec *spec = codec->spec; 3660 struct sigmatel_spec *spec = codec->spec;
@@ -3651,8 +3671,7 @@ static int stac92xx_parse_auto_config(struct hda_codec *codec, hda_nid_t dig_out
3651 /* If we have no real line-out pin and multiple hp-outs, HPs should 3671 /* If we have no real line-out pin and multiple hp-outs, HPs should
3652 * be set up as multi-channel outputs. 3672 * be set up as multi-channel outputs.
3653 */ 3673 */
3654 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT && 3674 if (is_dual_headphones(codec)) {
3655 spec->autocfg.hp_outs > 1) {
3656 /* Copy hp_outs to line_outs, backup line_outs in 3675 /* Copy hp_outs to line_outs, backup line_outs in
3657 * speaker_outs so that the following routines can handle 3676 * speaker_outs so that the following routines can handle
3658 * HP pins as primary outputs. 3677 * HP pins as primary outputs.