aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-05-17 04:00:16 -0400
committerTakashi Iwai <tiwai@suse.de>2011-05-17 04:00:16 -0400
commit06dec2282b1366136442950958b517db691533a1 (patch)
tree14f656f9d75a6d88746821a90950623a97a5ac2b /sound
parent03697e2acce9b8818cdb5fc0ebd5e5199dea1c32 (diff)
ALSA: hda - Use is_jack_detectable() helper
Replaced the open-code with the new helper function. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_cirrus.c9
-rw-r--r--sound/pci/hda/patch_realtek.c9
2 files changed, 7 insertions, 11 deletions
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 8b735052bc10..43fd403e9bd3 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -331,8 +331,8 @@ static int is_ext_mic(struct hda_codec *codec, unsigned int idx)
331 struct cs_spec *spec = codec->spec; 331 struct cs_spec *spec = codec->spec;
332 struct auto_pin_cfg *cfg = &spec->autocfg; 332 struct auto_pin_cfg *cfg = &spec->autocfg;
333 hda_nid_t pin = cfg->inputs[idx].pin; 333 hda_nid_t pin = cfg->inputs[idx].pin;
334 unsigned int val = snd_hda_query_pin_caps(codec, pin); 334 unsigned int val;
335 if (!(val & AC_PINCAP_PRES_DETECT)) 335 if (!is_jack_detectable(codec, pin))
336 return 0; 336 return 0;
337 val = snd_hda_codec_get_pincfg(codec, pin); 337 val = snd_hda_codec_get_pincfg(codec, pin);
338 return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT); 338 return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT);
@@ -847,15 +847,14 @@ static void cs_automute(struct hda_codec *codec)
847{ 847{
848 struct cs_spec *spec = codec->spec; 848 struct cs_spec *spec = codec->spec;
849 struct auto_pin_cfg *cfg = &spec->autocfg; 849 struct auto_pin_cfg *cfg = &spec->autocfg;
850 unsigned int caps, hp_present; 850 unsigned int hp_present;
851 hda_nid_t nid; 851 hda_nid_t nid;
852 int i; 852 int i;
853 853
854 hp_present = 0; 854 hp_present = 0;
855 for (i = 0; i < cfg->hp_outs; i++) { 855 for (i = 0; i < cfg->hp_outs; i++) {
856 nid = cfg->hp_pins[i]; 856 nid = cfg->hp_pins[i];
857 caps = snd_hda_query_pin_caps(codec, nid); 857 if (!is_jack_detectable(codec, nid))
858 if (!(caps & AC_PINCAP_PRES_DETECT))
859 continue; 858 continue;
860 hp_present = snd_hda_jack_detect(codec, nid); 859 hp_present = snd_hda_jack_detect(codec, nid);
861 if (hp_present) 860 if (hp_present)
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 4dd0cccc5a9e..473ddc72b5cd 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1560,8 +1560,7 @@ static void alc_init_auto_hp(struct hda_codec *codec)
1560 1560
1561 for (i = 0; i < cfg->hp_outs; i++) { 1561 for (i = 0; i < cfg->hp_outs; i++) {
1562 hda_nid_t nid = cfg->hp_pins[i]; 1562 hda_nid_t nid = cfg->hp_pins[i];
1563 if (!(snd_hda_query_pin_caps(codec, nid) & 1563 if (!is_jack_detectable(codec, nid))
1564 AC_PINCAP_PRES_DETECT))
1565 continue; 1564 continue;
1566 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", 1565 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
1567 nid); 1566 nid);
@@ -1576,8 +1575,7 @@ static void alc_init_auto_hp(struct hda_codec *codec)
1576 cfg->line_out_pins[0] != cfg->speaker_pins[0]) { 1575 cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
1577 for (i = 0; i < cfg->line_outs; i++) { 1576 for (i = 0; i < cfg->line_outs; i++) {
1578 hda_nid_t nid = cfg->line_out_pins[i]; 1577 hda_nid_t nid = cfg->line_out_pins[i];
1579 if (!(snd_hda_query_pin_caps(codec, nid) & 1578 if (!is_jack_detectable(codec, nid))
1580 AC_PINCAP_PRES_DETECT))
1581 continue; 1579 continue;
1582 snd_printdd("realtek: Enable Line-Out auto-muting " 1580 snd_printdd("realtek: Enable Line-Out auto-muting "
1583 "on NID 0x%x\n", nid); 1581 "on NID 0x%x\n", nid);
@@ -19596,8 +19594,7 @@ static void alc680_rec_autoswitch(struct hda_codec *codec)
19596 19594
19597 for (i = 0; i < cfg->num_inputs; i++) { 19595 for (i = 0; i < cfg->num_inputs; i++) {
19598 nid = cfg->inputs[i].pin; 19596 nid = cfg->inputs[i].pin;
19599 if (!(snd_hda_query_pin_caps(codec, nid) & 19597 if (!is_jack_detectable(codec, nid))
19600 AC_PINCAP_PRES_DETECT))
19601 continue; 19598 continue;
19602 if (snd_hda_jack_detect(codec, nid)) { 19599 if (snd_hda_jack_detect(codec, nid)) {
19603 if (cfg->inputs[i].type < type_found) { 19600 if (cfg->inputs[i].type < type_found) {