aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-11-26 02:33:45 -0500
committerTakashi Iwai <tiwai@suse.de>2013-11-27 08:55:40 -0500
commitced4cefc75fdb8be95eaee325ad0f6b2fc0a484b (patch)
tree5f0744473d4d1011ef208c0a56fe43579ad0a15c /sound/pci
parenta93455e1c301ce2a4cae11682359fd2067a8fd30 (diff)
ALSA: hda - Create Headhpone Mic Jack Mode when really needed
When a headphone jack is configurable as input, the generic parser tries to make it retaskable as Headphone Mic. The switching can be done smoothly if Capture Source control exists (i.e. there is another input source). Or when user explicitly enables the creation of jack mode controls, "Headhpone Mic Jack Mode" will be created accordingly. However, if the headphone mic is the only input source, we have to create "Headphone Mic Jack Mode" control because there is no capture source selection. Otherwise, the generic parser assumes that the input is constantly enabled, thus the headphone is permanently set as input. This situation happens on the old MacBook Airs where no input is supported properly, for example. This patch fixes the problem: now "Headphone Mic Jack Mode" is created when such an input selection isn't possible. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=65681 Cc: <stable@vger.kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_generic.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 3067ed4fe3b2..3bd89ab0d9af 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -2506,12 +2506,8 @@ static int create_out_jack_modes(struct hda_codec *codec, int num_pins,
2506 2506
2507 for (i = 0; i < num_pins; i++) { 2507 for (i = 0; i < num_pins; i++) {
2508 hda_nid_t pin = pins[i]; 2508 hda_nid_t pin = pins[i];
2509 if (pin == spec->hp_mic_pin) { 2509 if (pin == spec->hp_mic_pin)
2510 int ret = create_hp_mic_jack_mode(codec, pin);
2511 if (ret < 0)
2512 return ret;
2513 continue; 2510 continue;
2514 }
2515 if (get_out_jack_num_items(codec, pin) > 1) { 2511 if (get_out_jack_num_items(codec, pin) > 1) {
2516 struct snd_kcontrol_new *knew; 2512 struct snd_kcontrol_new *knew;
2517 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN]; 2513 char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
@@ -2784,9 +2780,6 @@ static int create_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t pin)
2784 struct hda_gen_spec *spec = codec->spec; 2780 struct hda_gen_spec *spec = codec->spec;
2785 struct snd_kcontrol_new *knew; 2781 struct snd_kcontrol_new *knew;
2786 2782
2787 if (get_out_jack_num_items(codec, pin) <= 1 &&
2788 get_in_jack_num_items(codec, pin) <= 1)
2789 return 0; /* no need */
2790 knew = snd_hda_gen_add_kctl(spec, "Headphone Mic Jack Mode", 2783 knew = snd_hda_gen_add_kctl(spec, "Headphone Mic Jack Mode",
2791 &hp_mic_jack_mode_enum); 2784 &hp_mic_jack_mode_enum);
2792 if (!knew) 2785 if (!knew)
@@ -4383,6 +4376,17 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
4383 if (err < 0) 4376 if (err < 0)
4384 return err; 4377 return err;
4385 4378
4379 /* create "Headphone Mic Jack Mode" if no input selection is
4380 * available (or user specifies add_jack_modes hint)
4381 */
4382 if (spec->hp_mic_pin &&
4383 (spec->auto_mic || spec->input_mux.num_items == 1 ||
4384 spec->add_jack_modes)) {
4385 err = create_hp_mic_jack_mode(codec, spec->hp_mic_pin);
4386 if (err < 0)
4387 return err;
4388 }
4389
4386 if (spec->add_jack_modes) { 4390 if (spec->add_jack_modes) {
4387 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { 4391 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
4388 err = create_out_jack_modes(codec, cfg->line_outs, 4392 err = create_out_jack_modes(codec, cfg->line_outs,