diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-05-24 05:49:12 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-05-24 06:15:53 -0400 |
commit | e2df82ffb8f61efdefba2857da09306182e9c599 (patch) | |
tree | f5be8f1be3b92c4782281fa16fa85b50a6c58a43 /sound/pci | |
parent | 313d2c065253a7549f5e7f43409f1da455329acd (diff) |
ALSA: hda - Fix speaker auto-mute in Cxt auto-parser
Fix some logic failures in auto-mute handling in Conexant auto-parser.
Also, modify codes to be a bit more understandable.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_conexant.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index e8dc736b2fc4..24fa31e46608 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c | |||
@@ -3434,7 +3434,9 @@ static void cx_auto_parse_output(struct hda_codec *codec) | |||
3434 | break; | 3434 | break; |
3435 | } | 3435 | } |
3436 | } | 3436 | } |
3437 | if (spec->auto_mute && cfg->line_out_pins[0] && | 3437 | if (spec->auto_mute && |
3438 | cfg->line_out_pins[0] && | ||
3439 | cfg->line_out_type != AUTO_PIN_SPEAKER_OUT && | ||
3438 | cfg->line_out_pins[0] != cfg->hp_pins[0] && | 3440 | cfg->line_out_pins[0] != cfg->hp_pins[0] && |
3439 | cfg->line_out_pins[0] != cfg->speaker_pins[0]) { | 3441 | cfg->line_out_pins[0] != cfg->speaker_pins[0]) { |
3440 | for (i = 0; i < cfg->line_outs; i++) { | 3442 | for (i = 0; i < cfg->line_outs; i++) { |
@@ -3482,25 +3484,32 @@ static void cx_auto_update_speakers(struct hda_codec *codec) | |||
3482 | { | 3484 | { |
3483 | struct conexant_spec *spec = codec->spec; | 3485 | struct conexant_spec *spec = codec->spec; |
3484 | struct auto_pin_cfg *cfg = &spec->autocfg; | 3486 | struct auto_pin_cfg *cfg = &spec->autocfg; |
3485 | int on; | 3487 | int on = 1; |
3486 | 3488 | ||
3487 | if (!spec->auto_mute) | 3489 | /* turn on HP EAPD when HP jacks are present */ |
3488 | on = 0; | 3490 | if (spec->auto_mute) |
3489 | else | 3491 | on = spec->hp_present; |
3490 | on = spec->hp_present | spec->line_present; | ||
3491 | cx_auto_turn_eapd(codec, cfg->hp_outs, cfg->hp_pins, on); | 3492 | cx_auto_turn_eapd(codec, cfg->hp_outs, cfg->hp_pins, on); |
3492 | do_automute(codec, cfg->speaker_outs, cfg->speaker_pins, !on); | 3493 | /* mute speakers in auto-mode if HP or LO jacks are plugged */ |
3494 | if (spec->auto_mute) | ||
3495 | on = !(spec->hp_present || | ||
3496 | (spec->detect_line && spec->line_present)); | ||
3497 | do_automute(codec, cfg->speaker_outs, cfg->speaker_pins, on); | ||
3493 | 3498 | ||
3494 | /* toggle line-out mutes if needed, too */ | 3499 | /* toggle line-out mutes if needed, too */ |
3495 | /* if LO is a copy of either HP or Speaker, don't need to handle it */ | 3500 | /* if LO is a copy of either HP or Speaker, don't need to handle it */ |
3496 | if (cfg->line_out_pins[0] == cfg->hp_pins[0] || | 3501 | if (cfg->line_out_pins[0] == cfg->hp_pins[0] || |
3497 | cfg->line_out_pins[0] == cfg->speaker_pins[0]) | 3502 | cfg->line_out_pins[0] == cfg->speaker_pins[0]) |
3498 | return; | 3503 | return; |
3499 | if (!spec->automute_lines || !spec->auto_mute) | 3504 | if (spec->auto_mute) { |
3500 | on = 0; | 3505 | /* mute LO in auto-mode when HP jack is present */ |
3501 | else | 3506 | if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT || |
3502 | on = spec->hp_present; | 3507 | spec->automute_lines) |
3503 | do_automute(codec, cfg->line_outs, cfg->line_out_pins, !on); | 3508 | on = !spec->hp_present; |
3509 | else | ||
3510 | on = 1; | ||
3511 | } | ||
3512 | do_automute(codec, cfg->line_outs, cfg->line_out_pins, on); | ||
3504 | } | 3513 | } |
3505 | 3514 | ||
3506 | static void cx_auto_hp_automute(struct hda_codec *codec) | 3515 | static void cx_auto_hp_automute(struct hda_codec *codec) |