aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-03-07 12:40:58 -0500
committerTakashi Iwai <tiwai@suse.de>2013-03-07 12:43:27 -0500
commit8ba955cef30921417dffba901a8af5a2662a1dec (patch)
tree5a9120a3171086af5a7a39706b78e0a9b4c3a22d
parentf811c3cf8fae63ecc8a937ba7376490e2565f8f1 (diff)
ALSA: hda - Avoid automatic pin-ctl update for hp/mic when jack ctl exists
When the headphone mic jack enum control is created (via explicitly specification by user), it doesn't make much sense to change the I/O direction dynamically per capture source change, since the I/O direction is rather controlled over the enum ctl. This also reduces the implicit dependency between the capture source and the hp mic jack enum ctls, which might confuse a program accessing the whole control elements at once like alsactl. In addition, this patch introduces update_hp_automute_hook() function to call the proper hook function. It's just to remove the open codes in multiple places in hda_generic.c. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_generic.c45
-rw-r--r--sound/pci/hda/hda_generic.h1
2 files changed, 25 insertions, 21 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index c8791225b2ba..fb232c118e91 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -1890,6 +1890,17 @@ static int create_speaker_out_ctls(struct hda_codec *codec)
1890 * independent HP controls 1890 * independent HP controls
1891 */ 1891 */
1892 1892
1893/* update HP auto-mute state too */
1894static void update_hp_automute_hook(struct hda_codec *codec)
1895{
1896 struct hda_gen_spec *spec = codec->spec;
1897
1898 if (spec->hp_automute_hook)
1899 spec->hp_automute_hook(codec, NULL);
1900 else
1901 snd_hda_gen_hp_automute(codec, NULL);
1902}
1903
1893static int indep_hp_info(struct snd_kcontrol *kcontrol, 1904static int indep_hp_info(struct snd_kcontrol *kcontrol,
1894 struct snd_ctl_elem_info *uinfo) 1905 struct snd_ctl_elem_info *uinfo)
1895{ 1906{
@@ -1950,12 +1961,7 @@ static int indep_hp_put(struct snd_kcontrol *kcontrol,
1950 else 1961 else
1951 *dacp = spec->alt_dac_nid; 1962 *dacp = spec->alt_dac_nid;
1952 1963
1953 /* update HP auto-mute state too */ 1964 update_hp_automute_hook(codec);
1954 if (spec->hp_automute_hook)
1955 spec->hp_automute_hook(codec, NULL);
1956 else
1957 snd_hda_gen_hp_automute(codec, NULL);
1958
1959 ret = 1; 1965 ret = 1;
1960 } 1966 }
1961 unlock: 1967 unlock:
@@ -2237,17 +2243,14 @@ static void update_hp_mic(struct hda_codec *codec, int adc_mux, bool force)
2237 PIN_IN | (as_mic ? vref_val : 0)); 2243 PIN_IN | (as_mic ? vref_val : 0));
2238 } 2244 }
2239 2245
2240 if (as_mic) 2246 if (!spec->hp_mic_jack_modes) {
2241 val |= PIN_IN; 2247 if (as_mic)
2242 else 2248 val |= PIN_IN;
2243 val = PIN_HP; 2249 else
2244 set_pin_target(codec, pin, val, true); 2250 val = PIN_HP;
2245 2251 set_pin_target(codec, pin, val, true);
2246 /* update HP auto-mute state too */ 2252 update_hp_automute_hook(codec);
2247 if (spec->hp_automute_hook) 2253 }
2248 spec->hp_automute_hook(codec, NULL);
2249 else
2250 snd_hda_gen_hp_automute(codec, NULL);
2251} 2254}
2252 2255
2253/* create a shared input with the headphone out */ 2256/* create a shared input with the headphone out */
@@ -2654,6 +2657,8 @@ static int hp_mic_jack_mode_put(struct snd_kcontrol *kcontrol,
2654 val = snd_hda_get_default_vref(codec, nid); 2657 val = snd_hda_get_default_vref(codec, nid);
2655 } 2658 }
2656 snd_hda_set_pin_ctl_cache(codec, nid, val); 2659 snd_hda_set_pin_ctl_cache(codec, nid, val);
2660 update_hp_automute_hook(codec);
2661
2657 return 1; 2662 return 1;
2658} 2663}
2659 2664
@@ -2677,6 +2682,7 @@ static int create_hp_mic_jack_mode(struct hda_codec *codec, hda_nid_t pin)
2677 if (!knew) 2682 if (!knew)
2678 return -ENOMEM; 2683 return -ENOMEM;
2679 knew->private_value = pin; 2684 knew->private_value = pin;
2685 spec->hp_mic_jack_modes = 1;
2680 return 0; 2686 return 0;
2681} 2687}
2682 2688
@@ -3800,10 +3806,7 @@ static void update_automute_all(struct hda_codec *codec)
3800{ 3806{
3801 struct hda_gen_spec *spec = codec->spec; 3807 struct hda_gen_spec *spec = codec->spec;
3802 3808
3803 if (spec->hp_automute_hook) 3809 update_hp_automute_hook(codec);
3804 spec->hp_automute_hook(codec, NULL);
3805 else
3806 snd_hda_gen_hp_automute(codec, NULL);
3807 if (spec->line_automute_hook) 3810 if (spec->line_automute_hook)
3808 spec->line_automute_hook(codec, NULL); 3811 spec->line_automute_hook(codec, NULL);
3809 else 3812 else
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
index 984bf301ebbb..094e6af7a107 100644
--- a/sound/pci/hda/hda_generic.h
+++ b/sound/pci/hda/hda_generic.h
@@ -221,6 +221,7 @@ struct hda_gen_spec {
221 unsigned int dyn_adc_switch:1; /* switch ADCs (for ALC275) */ 221 unsigned int dyn_adc_switch:1; /* switch ADCs (for ALC275) */
222 unsigned int indep_hp_enabled:1; /* independent HP enabled */ 222 unsigned int indep_hp_enabled:1; /* independent HP enabled */
223 unsigned int have_aamix_ctl:1; 223 unsigned int have_aamix_ctl:1;
224 unsigned int hp_mic_jack_modes:1;
224 225
225 /* loopback mixing mode */ 226 /* loopback mixing mode */
226 bool aamix_mode; 227 bool aamix_mode;