aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-03-07 12:32:59 -0500
committerTakashi Iwai <tiwai@suse.de>2013-03-07 12:32:59 -0500
commitf811c3cf8fae63ecc8a937ba7376490e2565f8f1 (patch)
tree2e1b91e0079b8f1b404260d2ea5cf51d513f6332
parent3f550e323242bea82d07dfd06e6ce3f723eef7bd (diff)
ALSA: hda - Consolidate add_in_jack_modes and add_out_jack_modes hints
There is no big merit to distinguish these two hints. Instead, just have a single flag, add_jack_modes, for creating the jack mode enum ctls for both I/O directions. The hint string parser code is left and translated as add_jack_modes just for keeping compatibility. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--Documentation/sound/alsa/HD-Audio.txt7
-rw-r--r--sound/pci/hda/hda_generic.c26
-rw-r--r--sound/pci/hda/hda_generic.h3
-rw-r--r--sound/pci/hda/patch_realtek.c3
4 files changed, 17 insertions, 22 deletions
diff --git a/Documentation/sound/alsa/HD-Audio.txt b/Documentation/sound/alsa/HD-Audio.txt
index 77e176a35ce1..c3c912d023cc 100644
--- a/Documentation/sound/alsa/HD-Audio.txt
+++ b/Documentation/sound/alsa/HD-Audio.txt
@@ -461,10 +461,9 @@ The generic parser supports the following hints:
461 the corresponding mixer control, if available 461 the corresponding mixer control, if available
462- add_stereo_mix_input (bool): add the stereo mix (analog-loopback 462- add_stereo_mix_input (bool): add the stereo mix (analog-loopback
463 mix) to the input mux if available 463 mix) to the input mux if available
464- add_out_jack_modes (bool): add "xxx Jack Mode" enum controls to each 464- add_jack_modes (bool): add "xxx Jack Mode" enum controls to each
465 output jack for allowing to change the headphone amp capability 465 I/O jack for allowing to change the headphone amp and mic bias VREF
466- add_in_jack_modes (bool): add "xxx Jack Mode" enum controls to each 466 capabilities
467 input jack for allowing to change the mic bias vref
468- power_down_unused (bool): power down the unused widgets 467- power_down_unused (bool): power down the unused widgets
469- add_hp_mic (bool): add the headphone to capture source if possible 468- add_hp_mic (bool): add the headphone to capture source if possible
470- hp_mic_detect (bool): enable/disable the hp/mic shared input for a 469- hp_mic_detect (bool): enable/disable the hp/mic shared input for a
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index cb40a0b7ce3e..c8791225b2ba 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -150,12 +150,16 @@ static void parse_user_hints(struct hda_codec *codec)
150 val = snd_hda_get_bool_hint(codec, "add_stereo_mix_input"); 150 val = snd_hda_get_bool_hint(codec, "add_stereo_mix_input");
151 if (val >= 0) 151 if (val >= 0)
152 spec->add_stereo_mix_input = !!val; 152 spec->add_stereo_mix_input = !!val;
153 /* the following two are just for compatibility */
153 val = snd_hda_get_bool_hint(codec, "add_out_jack_modes"); 154 val = snd_hda_get_bool_hint(codec, "add_out_jack_modes");
154 if (val >= 0) 155 if (val >= 0)
155 spec->add_out_jack_modes = !!val; 156 spec->add_jack_modes = !!val;
156 val = snd_hda_get_bool_hint(codec, "add_in_jack_modes"); 157 val = snd_hda_get_bool_hint(codec, "add_in_jack_modes");
157 if (val >= 0) 158 if (val >= 0)
158 spec->add_in_jack_modes = !!val; 159 spec->add_jack_modes = !!val;
160 val = snd_hda_get_bool_hint(codec, "add_jack_modes");
161 if (val >= 0)
162 spec->add_jack_modes = !!val;
159 val = snd_hda_get_bool_hint(codec, "power_down_unused"); 163 val = snd_hda_get_bool_hint(codec, "power_down_unused");
160 if (val >= 0) 164 if (val >= 0)
161 spec->power_down_unused = !!val; 165 spec->power_down_unused = !!val;
@@ -2373,7 +2377,7 @@ static void get_jack_mode_name(struct hda_codec *codec, hda_nid_t pin,
2373static int get_out_jack_num_items(struct hda_codec *codec, hda_nid_t pin) 2377static int get_out_jack_num_items(struct hda_codec *codec, hda_nid_t pin)
2374{ 2378{
2375 struct hda_gen_spec *spec = codec->spec; 2379 struct hda_gen_spec *spec = codec->spec;
2376 if (spec->add_out_jack_modes) { 2380 if (spec->add_jack_modes) {
2377 unsigned int pincap = snd_hda_query_pin_caps(codec, pin); 2381 unsigned int pincap = snd_hda_query_pin_caps(codec, pin);
2378 if ((pincap & AC_PINCAP_OUT) && (pincap & AC_PINCAP_HP_DRV)) 2382 if ((pincap & AC_PINCAP_OUT) && (pincap & AC_PINCAP_HP_DRV))
2379 return 2; 2383 return 2;
@@ -2520,7 +2524,7 @@ static int get_in_jack_num_items(struct hda_codec *codec, hda_nid_t pin)
2520{ 2524{
2521 struct hda_gen_spec *spec = codec->spec; 2525 struct hda_gen_spec *spec = codec->spec;
2522 int nitems = 0; 2526 int nitems = 0;
2523 if (spec->add_in_jack_modes) 2527 if (spec->add_jack_modes)
2524 nitems = hweight32(get_vref_caps(codec, pin)); 2528 nitems = hweight32(get_vref_caps(codec, pin));
2525 return nitems ? nitems : 1; 2529 return nitems ? nitems : 1;
2526} 2530}
@@ -2532,14 +2536,8 @@ static int create_in_jack_mode(struct hda_codec *codec, hda_nid_t pin)
2532 char name[44]; 2536 char name[44];
2533 unsigned int defcfg; 2537 unsigned int defcfg;
2534 2538
2535 if (pin == spec->hp_mic_pin) { 2539 if (pin == spec->hp_mic_pin)
2536 if (!spec->add_out_jack_modes) { 2540 return 0; /* already done in create_out_jack_mode() */
2537 int ret = create_hp_mic_jack_mode(codec, pin);
2538 if (ret < 0)
2539 return ret;
2540 }
2541 return 0;
2542 }
2543 2541
2544 /* no jack mode for fixed pins */ 2542 /* no jack mode for fixed pins */
2545 defcfg = snd_hda_codec_get_pincfg(codec, pin); 2543 defcfg = snd_hda_codec_get_pincfg(codec, pin);
@@ -2981,7 +2979,7 @@ static int create_input_ctls(struct hda_codec *codec)
2981 if (err < 0) 2979 if (err < 0)
2982 return err; 2980 return err;
2983 2981
2984 if (spec->add_in_jack_modes) { 2982 if (spec->add_jack_modes) {
2985 err = create_in_jack_mode(codec, pin); 2983 err = create_in_jack_mode(codec, pin);
2986 if (err < 0) 2984 if (err < 0)
2987 return err; 2985 return err;
@@ -4215,7 +4213,7 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
4215 if (err < 0) 4213 if (err < 0)
4216 return err; 4214 return err;
4217 4215
4218 if (spec->add_out_jack_modes) { 4216 if (spec->add_jack_modes) {
4219 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { 4217 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
4220 err = create_out_jack_modes(codec, cfg->line_outs, 4218 err = create_out_jack_modes(codec, cfg->line_outs,
4221 cfg->line_out_pins); 4219 cfg->line_out_pins);
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
index 7ee5b57946c9..984bf301ebbb 100644
--- a/sound/pci/hda/hda_generic.h
+++ b/sound/pci/hda/hda_generic.h
@@ -213,8 +213,7 @@ struct hda_gen_spec {
213 unsigned int indep_hp:1; /* independent HP supported */ 213 unsigned int indep_hp:1; /* independent HP supported */
214 unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */ 214 unsigned int prefer_hp_amp:1; /* enable HP amp for speaker if any */
215 unsigned int add_stereo_mix_input:1; /* add aamix as a capture src */ 215 unsigned int add_stereo_mix_input:1; /* add aamix as a capture src */
216 unsigned int add_out_jack_modes:1; /* add output jack mode enum ctls */ 216 unsigned int add_jack_modes:1; /* add i/o jack mode enum ctls */
217 unsigned int add_in_jack_modes:1; /* add input jack mode enum ctls */
218 unsigned int power_down_unused:1; /* power down unused widgets */ 217 unsigned int power_down_unused:1; /* power down unused widgets */
219 218
220 /* other internal flags */ 219 /* other internal flags */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 056990e5ffe9..f772585c89ba 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1526,8 +1526,7 @@ static void alc260_fixup_fsc_s7020_jwse(struct hda_codec *codec,
1526{ 1526{
1527 struct alc_spec *spec = codec->spec; 1527 struct alc_spec *spec = codec->spec;
1528 if (action == HDA_FIXUP_ACT_PRE_PROBE) { 1528 if (action == HDA_FIXUP_ACT_PRE_PROBE) {
1529 spec->gen.add_out_jack_modes = 1; 1529 spec->gen.add_jack_modes = 1;
1530 spec->gen.add_in_jack_modes = 1;
1531 spec->gen.hp_mic = 1; 1530 spec->gen.hp_mic = 1;
1532 } 1531 }
1533} 1532}