ALSA: hda - Use is_jack_detectable() helper

Replaced the open-code with the new helper function.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2011-05-17 10:00:16 +02:00
Родитель 03697e2acc
Коммит 06dec2282b
2 изменённых файлов: 7 добавлений и 11 удалений

Просмотреть файл

@ -331,8 +331,8 @@ static int is_ext_mic(struct hda_codec *codec, unsigned int idx)
struct cs_spec *spec = codec->spec; struct cs_spec *spec = codec->spec;
struct auto_pin_cfg *cfg = &spec->autocfg; struct auto_pin_cfg *cfg = &spec->autocfg;
hda_nid_t pin = cfg->inputs[idx].pin; hda_nid_t pin = cfg->inputs[idx].pin;
unsigned int val = snd_hda_query_pin_caps(codec, pin); unsigned int val;
if (!(val & AC_PINCAP_PRES_DETECT)) if (!is_jack_detectable(codec, pin))
return 0; return 0;
val = snd_hda_codec_get_pincfg(codec, pin); val = snd_hda_codec_get_pincfg(codec, pin);
return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT); return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT);
@ -847,15 +847,14 @@ static void cs_automute(struct hda_codec *codec)
{ {
struct cs_spec *spec = codec->spec; struct cs_spec *spec = codec->spec;
struct auto_pin_cfg *cfg = &spec->autocfg; struct auto_pin_cfg *cfg = &spec->autocfg;
unsigned int caps, hp_present; unsigned int hp_present;
hda_nid_t nid; hda_nid_t nid;
int i; int i;
hp_present = 0; hp_present = 0;
for (i = 0; i < cfg->hp_outs; i++) { for (i = 0; i < cfg->hp_outs; i++) {
nid = cfg->hp_pins[i]; nid = cfg->hp_pins[i];
caps = snd_hda_query_pin_caps(codec, nid); if (!is_jack_detectable(codec, nid))
if (!(caps & AC_PINCAP_PRES_DETECT))
continue; continue;
hp_present = snd_hda_jack_detect(codec, nid); hp_present = snd_hda_jack_detect(codec, nid);
if (hp_present) if (hp_present)

Просмотреть файл

@ -1560,8 +1560,7 @@ static void alc_init_auto_hp(struct hda_codec *codec)
for (i = 0; i < cfg->hp_outs; i++) { for (i = 0; i < cfg->hp_outs; i++) {
hda_nid_t nid = cfg->hp_pins[i]; hda_nid_t nid = cfg->hp_pins[i];
if (!(snd_hda_query_pin_caps(codec, nid) & if (!is_jack_detectable(codec, nid))
AC_PINCAP_PRES_DETECT))
continue; continue;
snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
nid); nid);
@ -1576,8 +1575,7 @@ static void alc_init_auto_hp(struct hda_codec *codec)
cfg->line_out_pins[0] != cfg->speaker_pins[0]) { cfg->line_out_pins[0] != cfg->speaker_pins[0]) {
for (i = 0; i < cfg->line_outs; i++) { for (i = 0; i < cfg->line_outs; i++) {
hda_nid_t nid = cfg->line_out_pins[i]; hda_nid_t nid = cfg->line_out_pins[i];
if (!(snd_hda_query_pin_caps(codec, nid) & if (!is_jack_detectable(codec, nid))
AC_PINCAP_PRES_DETECT))
continue; continue;
snd_printdd("realtek: Enable Line-Out auto-muting " snd_printdd("realtek: Enable Line-Out auto-muting "
"on NID 0x%x\n", nid); "on NID 0x%x\n", nid);
@ -19596,8 +19594,7 @@ static void alc680_rec_autoswitch(struct hda_codec *codec)
for (i = 0; i < cfg->num_inputs; i++) { for (i = 0; i < cfg->num_inputs; i++) {
nid = cfg->inputs[i].pin; nid = cfg->inputs[i].pin;
if (!(snd_hda_query_pin_caps(codec, nid) & if (!is_jack_detectable(codec, nid))
AC_PINCAP_PRES_DETECT))
continue; continue;
if (snd_hda_jack_detect(codec, nid)) { if (snd_hda_jack_detect(codec, nid)) {
if (cfg->inputs[i].type < type_found) { if (cfg->inputs[i].type < type_found) {