diff options
-rw-r--r-- | sound/pci/hda/hda_generic.c | 20 |
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, |