aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_codec.c16
-rw-r--r--sound/pci/hda/hda_generic.c2
-rw-r--r--sound/pci/hda/hda_local.h1
-rw-r--r--sound/pci/hda/patch_realtek.c6
-rw-r--r--sound/pci/hda/patch_sigmatel.c7
5 files changed, 24 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 1b5575ecb0a4..0f70d2d102e0 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1052,6 +1052,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream);
1052 1052
1053/* FIXME: more better hash key? */ 1053/* FIXME: more better hash key? */
1054#define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) 1054#define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24))
1055#define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24))
1055#define INFO_AMP_CAPS (1<<0) 1056#define INFO_AMP_CAPS (1<<0)
1056#define INFO_AMP_VOL(ch) (1 << (1 + (ch))) 1057#define INFO_AMP_VOL(ch) (1 << (1 + (ch)))
1057 1058
@@ -1142,6 +1143,21 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
1142} 1143}
1143EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps); 1144EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps);
1144 1145
1146u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid)
1147{
1148 struct hda_amp_info *info;
1149
1150 info = get_alloc_amp_hash(codec, HDA_HASH_PINCAP_KEY(nid));
1151 if (!info)
1152 return 0;
1153 if (!info->head.val) {
1154 info->amp_caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
1155 info->head.val |= INFO_AMP_CAPS;
1156 }
1157 return info->amp_caps;
1158}
1159EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps);
1160
1145/* 1161/*
1146 * read the current volume to info 1162 * read the current volume to info
1147 * if the cache exists, read the cache value. 1163 * if the cache exists, read the cache value.
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 2c81a683e8f8..1d5797a96682 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -144,7 +144,7 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid
144 node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 144 node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
145 145
146 if (node->type == AC_WID_PIN) { 146 if (node->type == AC_WID_PIN) {
147 node->pin_caps = snd_hda_param_read(codec, node->nid, AC_PAR_PIN_CAP); 147 node->pin_caps = snd_hda_query_pin_caps(codec, node->nid);
148 node->pin_ctl = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 148 node->pin_ctl = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
149 node->def_cfg = snd_hda_codec_get_pincfg(codec, node->nid); 149 node->def_cfg = snd_hda_codec_get_pincfg(codec, node->nid);
150 } 150 }
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 27428c718fd7..83349013b4df 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -411,6 +411,7 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
411u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); 411u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
412int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, 412int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
413 unsigned int caps); 413 unsigned int caps);
414u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid);
414 415
415int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl); 416int snd_hda_ctl_add(struct hda_codec *codec, struct snd_kcontrol *kctl);
416void snd_hda_ctls_clear(struct hda_codec *codec); 417void snd_hda_ctls_clear(struct hda_codec *codec);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 965a531d2fba..bf7e64e2c468 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -770,7 +770,7 @@ static void alc_set_input_pin(struct hda_codec *codec, hda_nid_t nid,
770 770
771 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) { 771 if (auto_pin_type <= AUTO_PIN_FRONT_MIC) {
772 unsigned int pincap; 772 unsigned int pincap;
773 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 773 pincap = snd_hda_query_pin_caps(codec, nid);
774 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; 774 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
775 if (pincap & AC_PINCAP_VREF_80) 775 if (pincap & AC_PINCAP_VREF_80)
776 val = PIN_VREF80; 776 val = PIN_VREF80;
@@ -16746,13 +16746,13 @@ static int alc662_input_pin_idx(struct hda_codec *codec, hda_nid_t nid,
16746 16746
16747static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid) 16747static int alc662_is_input_pin(struct hda_codec *codec, hda_nid_t nid)
16748{ 16748{
16749 unsigned int pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 16749 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16750 return (pincap & AC_PINCAP_IN) != 0; 16750 return (pincap & AC_PINCAP_IN) != 0;
16751} 16751}
16752 16752
16753static int alc662_is_output_pin(struct hda_codec *codec, hda_nid_t nid) 16753static int alc662_is_output_pin(struct hda_codec *codec, hda_nid_t nid)
16754{ 16754{
16755 unsigned int pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 16755 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
16756 return (pincap & AC_PINCAP_OUT) != 0; 16756 return (pincap & AC_PINCAP_OUT) != 0;
16757} 16757}
16758 16758
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 4da72403fc87..b1c180a9e9be 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2537,8 +2537,7 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
2537 2537
2538static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid) 2538static unsigned int stac92xx_get_vref(struct hda_codec *codec, hda_nid_t nid)
2539{ 2539{
2540 unsigned int pincap = snd_hda_param_read(codec, nid, 2540 unsigned int pincap = snd_hda_query_pin_caps(codec, nid);
2541 AC_PAR_PIN_CAP);
2542 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT; 2541 pincap = (pincap & AC_PINCAP_VREF) >> AC_PINCAP_VREF_SHIFT;
2543 if (pincap & AC_PINCAP_VREF_100) 2542 if (pincap & AC_PINCAP_VREF_100)
2544 return AC_PINCTL_VREF_100; 2543 return AC_PINCTL_VREF_100;
@@ -2799,7 +2798,7 @@ static hda_nid_t check_line_out_switch(struct hda_codec *codec)
2799 if (cfg->line_out_type != AUTO_PIN_LINE_OUT) 2798 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)
2800 return 0; 2799 return 0;
2801 nid = cfg->input_pins[AUTO_PIN_LINE]; 2800 nid = cfg->input_pins[AUTO_PIN_LINE];
2802 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 2801 pincap = snd_hda_query_pin_caps(codec, nid);
2803 if (pincap & AC_PINCAP_OUT) 2802 if (pincap & AC_PINCAP_OUT)
2804 return nid; 2803 return nid;
2805 return 0; 2804 return 0;
@@ -2822,7 +2821,7 @@ static hda_nid_t check_mic_out_switch(struct hda_codec *codec)
2822 /* some laptops have an internal analog microphone 2821 /* some laptops have an internal analog microphone
2823 * which can't be used as a output */ 2822 * which can't be used as a output */
2824 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { 2823 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
2825 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 2824 pincap = snd_hda_query_pin_caps(codec, nid);
2826 if (pincap & AC_PINCAP_OUT) 2825 if (pincap & AC_PINCAP_OUT)
2827 return nid; 2826 return nid;
2828 } 2827 }