From d56757abc11a21996d9839c0d4e3b2c3666cd318 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 18 Nov 2009 08:00:14 +0100 Subject: ALSA: hda - Replace the rest of jack-detections with snd_hda_jack_detect() Signed-off-by: Takashi Iwai --- sound/pci/hda/patch_conexant.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'sound/pci/hda/patch_conexant.c') diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c index 905859d4f4d..0b097fa5421 100644 --- a/sound/pci/hda/patch_conexant.c +++ b/sound/pci/hda/patch_conexant.c @@ -397,9 +397,7 @@ static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) for (i = 0; i < spec->jacks.used; i++) { if (jacks->nid == nid) { unsigned int present; - present = snd_hda_codec_read(codec, nid, 0, - AC_VERB_GET_PIN_SENSE, 0) & - AC_PINSENSE_PRESENCE; + present = snd_hda_jack_detect(codec, nid); present = (present) ? jacks->type : 0 ; @@ -750,8 +748,7 @@ static void cxt5045_hp_automic(struct hda_codec *codec) }; unsigned int present; - present = snd_hda_codec_read(codec, 0x12, 0, - AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + present = snd_hda_jack_detect(codec, 0x12); if (present) snd_hda_sequence_write(codec, mic_jack_on); else @@ -765,8 +762,7 @@ static void cxt5045_hp_automute(struct hda_codec *codec) struct conexant_spec *spec = codec->spec; unsigned int bits; - spec->hp_present = snd_hda_codec_read(codec, 0x11, 0, - AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + spec->hp_present = snd_hda_jack_detect(codec, 0x11); bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0, @@ -1243,8 +1239,7 @@ static void cxt5047_hp_automute(struct hda_codec *codec) struct conexant_spec *spec = codec->spec; unsigned int bits; - spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, - AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + spec->hp_present = snd_hda_jack_detect(codec, 0x13); bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; /* See the note in cxt5047_hp_master_sw_put */ @@ -1267,8 +1262,7 @@ static void cxt5047_hp_automic(struct hda_codec *codec) }; unsigned int present; - present = snd_hda_codec_read(codec, 0x15, 0, - AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + present = snd_hda_jack_detect(codec, 0x15); if (present) snd_hda_sequence_write(codec, mic_jack_on); else @@ -1621,9 +1615,7 @@ static void cxt5051_portb_automic(struct hda_codec *codec) if (spec->no_auto_mic) return; - present = snd_hda_codec_read(codec, 0x17, 0, - AC_VERB_GET_PIN_SENSE, 0) & - AC_PINSENSE_PRESENCE; + present = snd_hda_jack_detect(codec, 0x17); snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_CONNECT_SEL, present ? 0x01 : 0x00); @@ -1638,9 +1630,7 @@ static void cxt5051_portc_automic(struct hda_codec *codec) if (spec->no_auto_mic) return; - present = snd_hda_codec_read(codec, 0x18, 0, - AC_VERB_GET_PIN_SENSE, 0) & - AC_PINSENSE_PRESENCE; + present = snd_hda_jack_detect(codec, 0x18); if (present) spec->cur_adc_idx = 1; else @@ -1661,9 +1651,7 @@ static void cxt5051_hp_automute(struct hda_codec *codec) { struct conexant_spec *spec = codec->spec; - spec->hp_present = snd_hda_codec_read(codec, 0x16, 0, - AC_VERB_GET_PIN_SENSE, 0) & - AC_PINSENSE_PRESENCE; + spec->hp_present = snd_hda_jack_detect(codec, 0x16); cxt5051_update_speaker(codec); } @@ -2011,8 +1999,7 @@ static void cxt5066_automic(struct hda_codec *codec) }; unsigned int present; - present = snd_hda_codec_read(codec, 0x1a, 0, - AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; + present = snd_hda_jack_detect(codec, 0x1a); if (present) { snd_printdd("CXT5066: external microphone detected\n"); snd_hda_sequence_write(codec, ext_mic_present); @@ -2029,12 +2016,10 @@ static void cxt5066_hp_automute(struct hda_codec *codec) unsigned int portA, portD; /* Port A */ - portA = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0) - & AC_PINSENSE_PRESENCE; + portA = snd_hda_jack_detect(codec, 0x19); /* Port D */ - portD = (snd_hda_codec_read(codec, 0x1c, 0, AC_VERB_GET_PIN_SENSE, 0) - & AC_PINSENSE_PRESENCE) << 1; + portD = snd_hda_jack_detect(codec, 0x1c); spec->hp_present = !!(portA | portD); snd_printdd("CXT5066: hp automute portA=%x portD=%x present=%d\n", -- cgit v1.2.3