aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_conexant.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-11-18 02:00:14 -0500
committerTakashi Iwai <tiwai@suse.de>2009-11-18 02:00:14 -0500
commitd56757abc11a21996d9839c0d4e3b2c3666cd318 (patch)
tree831cc331f8901ed17c3294a31dc545d7954f1a2c /sound/pci/hda/patch_conexant.c
parent83d605fd63e704419ccb92d48b735c6890ce3d6a (diff)
ALSA: hda - Replace the rest of jack-detections with snd_hda_jack_detect()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_conexant.c')
-rw-r--r--sound/pci/hda/patch_conexant.c37
1 files changed, 11 insertions, 26 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 905859d4f4df..0b097fa5421f 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)
397 for (i = 0; i < spec->jacks.used; i++) { 397 for (i = 0; i < spec->jacks.used; i++) {
398 if (jacks->nid == nid) { 398 if (jacks->nid == nid) {
399 unsigned int present; 399 unsigned int present;
400 present = snd_hda_codec_read(codec, nid, 0, 400 present = snd_hda_jack_detect(codec, nid);
401 AC_VERB_GET_PIN_SENSE, 0) &
402 AC_PINSENSE_PRESENCE;
403 401
404 present = (present) ? jacks->type : 0 ; 402 present = (present) ? jacks->type : 0 ;
405 403
@@ -750,8 +748,7 @@ static void cxt5045_hp_automic(struct hda_codec *codec)
750 }; 748 };
751 unsigned int present; 749 unsigned int present;
752 750
753 present = snd_hda_codec_read(codec, 0x12, 0, 751 present = snd_hda_jack_detect(codec, 0x12);
754 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
755 if (present) 752 if (present)
756 snd_hda_sequence_write(codec, mic_jack_on); 753 snd_hda_sequence_write(codec, mic_jack_on);
757 else 754 else
@@ -765,8 +762,7 @@ static void cxt5045_hp_automute(struct hda_codec *codec)
765 struct conexant_spec *spec = codec->spec; 762 struct conexant_spec *spec = codec->spec;
766 unsigned int bits; 763 unsigned int bits;
767 764
768 spec->hp_present = snd_hda_codec_read(codec, 0x11, 0, 765 spec->hp_present = snd_hda_jack_detect(codec, 0x11);
769 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
770 766
771 bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; 767 bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0;
772 snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0, 768 snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0,
@@ -1243,8 +1239,7 @@ static void cxt5047_hp_automute(struct hda_codec *codec)
1243 struct conexant_spec *spec = codec->spec; 1239 struct conexant_spec *spec = codec->spec;
1244 unsigned int bits; 1240 unsigned int bits;
1245 1241
1246 spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, 1242 spec->hp_present = snd_hda_jack_detect(codec, 0x13);
1247 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1248 1243
1249 bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; 1244 bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0;
1250 /* See the note in cxt5047_hp_master_sw_put */ 1245 /* See the note in cxt5047_hp_master_sw_put */
@@ -1267,8 +1262,7 @@ static void cxt5047_hp_automic(struct hda_codec *codec)
1267 }; 1262 };
1268 unsigned int present; 1263 unsigned int present;
1269 1264
1270 present = snd_hda_codec_read(codec, 0x15, 0, 1265 present = snd_hda_jack_detect(codec, 0x15);
1271 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1272 if (present) 1266 if (present)
1273 snd_hda_sequence_write(codec, mic_jack_on); 1267 snd_hda_sequence_write(codec, mic_jack_on);
1274 else 1268 else
@@ -1621,9 +1615,7 @@ static void cxt5051_portb_automic(struct hda_codec *codec)
1621 1615
1622 if (spec->no_auto_mic) 1616 if (spec->no_auto_mic)
1623 return; 1617 return;
1624 present = snd_hda_codec_read(codec, 0x17, 0, 1618 present = snd_hda_jack_detect(codec, 0x17);
1625 AC_VERB_GET_PIN_SENSE, 0) &
1626 AC_PINSENSE_PRESENCE;
1627 snd_hda_codec_write(codec, 0x14, 0, 1619 snd_hda_codec_write(codec, 0x14, 0,
1628 AC_VERB_SET_CONNECT_SEL, 1620 AC_VERB_SET_CONNECT_SEL,
1629 present ? 0x01 : 0x00); 1621 present ? 0x01 : 0x00);
@@ -1638,9 +1630,7 @@ static void cxt5051_portc_automic(struct hda_codec *codec)
1638 1630
1639 if (spec->no_auto_mic) 1631 if (spec->no_auto_mic)
1640 return; 1632 return;
1641 present = snd_hda_codec_read(codec, 0x18, 0, 1633 present = snd_hda_jack_detect(codec, 0x18);
1642 AC_VERB_GET_PIN_SENSE, 0) &
1643 AC_PINSENSE_PRESENCE;
1644 if (present) 1634 if (present)
1645 spec->cur_adc_idx = 1; 1635 spec->cur_adc_idx = 1;
1646 else 1636 else
@@ -1661,9 +1651,7 @@ static void cxt5051_hp_automute(struct hda_codec *codec)
1661{ 1651{
1662 struct conexant_spec *spec = codec->spec; 1652 struct conexant_spec *spec = codec->spec;
1663 1653
1664 spec->hp_present = snd_hda_codec_read(codec, 0x16, 0, 1654 spec->hp_present = snd_hda_jack_detect(codec, 0x16);
1665 AC_VERB_GET_PIN_SENSE, 0) &
1666 AC_PINSENSE_PRESENCE;
1667 cxt5051_update_speaker(codec); 1655 cxt5051_update_speaker(codec);
1668} 1656}
1669 1657
@@ -2011,8 +1999,7 @@ static void cxt5066_automic(struct hda_codec *codec)
2011 }; 1999 };
2012 unsigned int present; 2000 unsigned int present;
2013 2001
2014 present = snd_hda_codec_read(codec, 0x1a, 0, 2002 present = snd_hda_jack_detect(codec, 0x1a);
2015 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2016 if (present) { 2003 if (present) {
2017 snd_printdd("CXT5066: external microphone detected\n"); 2004 snd_printdd("CXT5066: external microphone detected\n");
2018 snd_hda_sequence_write(codec, ext_mic_present); 2005 snd_hda_sequence_write(codec, ext_mic_present);
@@ -2029,12 +2016,10 @@ static void cxt5066_hp_automute(struct hda_codec *codec)
2029 unsigned int portA, portD; 2016 unsigned int portA, portD;
2030 2017
2031 /* Port A */ 2018 /* Port A */
2032 portA = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0) 2019 portA = snd_hda_jack_detect(codec, 0x19);
2033 & AC_PINSENSE_PRESENCE;
2034 2020
2035 /* Port D */ 2021 /* Port D */
2036 portD = (snd_hda_codec_read(codec, 0x1c, 0, AC_VERB_GET_PIN_SENSE, 0) 2022 portD = snd_hda_jack_detect(codec, 0x1c);
2037 & AC_PINSENSE_PRESENCE) << 1;
2038 2023
2039 spec->hp_present = !!(portA | portD); 2024 spec->hp_present = !!(portA | portD);
2040 snd_printdd("CXT5066: hp automute portA=%x portD=%x present=%d\n", 2025 snd_printdd("CXT5066: hp automute portA=%x portD=%x present=%d\n",