aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-10-31 10:49:32 -0400
committerJaroslav Kysela <perex@perex.cz>2008-01-31 11:29:15 -0500
commitf889fa91ad47e6fcb530abf1184ca9f1473d3c72 (patch)
treef62d92483d59dfe0924070b9ce6637f7f9144152
parent69b1f1e8337fc94a7ea0730588960e82676dc2dc (diff)
[ALSA] hda-codec - Improve the auto-configuration
Some small improvements on autocfg stuff: - sort HP pins by sequence number, too - move sole mic pin to AUTO_PIN_MIC instead of AUTO_PIN_FRONT_MIC - ditto for line-in pin Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--sound/pci/hda/hda_codec.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index dacabe52a41c..39240e0ea568 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2608,11 +2608,13 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
2608 short seq, assoc_line_out, assoc_speaker; 2608 short seq, assoc_line_out, assoc_speaker;
2609 short sequences_line_out[ARRAY_SIZE(cfg->line_out_pins)]; 2609 short sequences_line_out[ARRAY_SIZE(cfg->line_out_pins)];
2610 short sequences_speaker[ARRAY_SIZE(cfg->speaker_pins)]; 2610 short sequences_speaker[ARRAY_SIZE(cfg->speaker_pins)];
2611 short sequences_hp[ARRAY_SIZE(cfg->hp_pins)];
2611 2612
2612 memset(cfg, 0, sizeof(*cfg)); 2613 memset(cfg, 0, sizeof(*cfg));
2613 2614
2614 memset(sequences_line_out, 0, sizeof(sequences_line_out)); 2615 memset(sequences_line_out, 0, sizeof(sequences_line_out));
2615 memset(sequences_speaker, 0, sizeof(sequences_speaker)); 2616 memset(sequences_speaker, 0, sizeof(sequences_speaker));
2617 memset(sequences_hp, 0, sizeof(sequences_hp));
2616 assoc_line_out = assoc_speaker = 0; 2618 assoc_line_out = assoc_speaker = 0;
2617 2619
2618 nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid_start); 2620 nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid_start);
@@ -2667,9 +2669,12 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
2667 cfg->speaker_outs++; 2669 cfg->speaker_outs++;
2668 break; 2670 break;
2669 case AC_JACK_HP_OUT: 2671 case AC_JACK_HP_OUT:
2672 seq = get_defcfg_sequence(def_conf);
2673 assoc = get_defcfg_association(def_conf);
2670 if (cfg->hp_outs >= ARRAY_SIZE(cfg->hp_pins)) 2674 if (cfg->hp_outs >= ARRAY_SIZE(cfg->hp_pins))
2671 continue; 2675 continue;
2672 cfg->hp_pins[cfg->hp_outs] = nid; 2676 cfg->hp_pins[cfg->hp_outs] = nid;
2677 sequences_hp[cfg->hp_outs] = (assoc << 4) | seq;
2673 cfg->hp_outs++; 2678 cfg->hp_outs++;
2674 break; 2679 break;
2675 case AC_JACK_MIC_IN: { 2680 case AC_JACK_MIC_IN: {
@@ -2713,7 +2718,24 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec,
2713 cfg->line_outs); 2718 cfg->line_outs);
2714 sort_pins_by_sequence(cfg->speaker_pins, sequences_speaker, 2719 sort_pins_by_sequence(cfg->speaker_pins, sequences_speaker,
2715 cfg->speaker_outs); 2720 cfg->speaker_outs);
2721 sort_pins_by_sequence(cfg->hp_pins, sequences_hp,
2722 cfg->hp_outs);
2716 2723
2724 /* if we have only one mic, make it AUTO_PIN_MIC */
2725 if (!cfg->input_pins[AUTO_PIN_MIC] &&
2726 cfg->input_pins[AUTO_PIN_FRONT_MIC]) {
2727 cfg->input_pins[AUTO_PIN_MIC] =
2728 cfg->input_pins[AUTO_PIN_FRONT_MIC];
2729 cfg->input_pins[AUTO_PIN_FRONT_MIC] = 0;
2730 }
2731 /* ditto for line-in */
2732 if (!cfg->input_pins[AUTO_PIN_LINE] &&
2733 cfg->input_pins[AUTO_PIN_FRONT_LINE]) {
2734 cfg->input_pins[AUTO_PIN_LINE] =
2735 cfg->input_pins[AUTO_PIN_FRONT_LINE];
2736 cfg->input_pins[AUTO_PIN_FRONT_LINE] = 0;
2737 }
2738
2717 /* 2739 /*
2718 * FIX-UP: if no line-outs are detected, try to use speaker or HP pin 2740 * FIX-UP: if no line-outs are detected, try to use speaker or HP pin
2719 * as a primary output 2741 * as a primary output