Commit d56757ab authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Replace the rest of jack-detections with snd_hda_jack_detect()

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 83d605fd
...@@ -720,10 +720,10 @@ static struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = { ...@@ -720,10 +720,10 @@ static struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = {
static void ad1986a_automic(struct hda_codec *codec) static void ad1986a_automic(struct hda_codec *codec)
{ {
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x1f, 0, AC_VERB_GET_PIN_SENSE, 0); present = snd_hda_jack_detect(codec, 0x1f);
/* 0 = 0x1f, 2 = 0x1d, 4 = mixed */ /* 0 = 0x1f, 2 = 0x1d, 4 = mixed */
snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_CONNECT_SEL, snd_hda_codec_write(codec, 0x0f, 0, AC_VERB_SET_CONNECT_SEL,
(present & AC_PINSENSE_PRESENCE) ? 0 : 2); present ? 0 : 2);
} }
#define AD1986A_MIC_EVENT 0x36 #define AD1986A_MIC_EVENT 0x36
...@@ -762,10 +762,8 @@ static void ad1986a_update_hp(struct hda_codec *codec) ...@@ -762,10 +762,8 @@ static void ad1986a_update_hp(struct hda_codec *codec)
static void ad1986a_hp_automute(struct hda_codec *codec) static void ad1986a_hp_automute(struct hda_codec *codec)
{ {
struct ad198x_spec *spec = codec->spec; struct ad198x_spec *spec = codec->spec;
unsigned int present;
present = snd_hda_codec_read(codec, 0x1a, 0, AC_VERB_GET_PIN_SENSE, 0); spec->jack_present = snd_hda_jack_detect(codec, 0x1a);
spec->jack_present = !!(present & 0x80000000);
if (spec->inv_jack_detect) if (spec->inv_jack_detect)
spec->jack_present = !spec->jack_present; spec->jack_present = !spec->jack_present;
ad1986a_update_hp(codec); ad1986a_update_hp(codec);
...@@ -1555,8 +1553,7 @@ static void ad1981_hp_automute(struct hda_codec *codec) ...@@ -1555,8 +1553,7 @@ static void ad1981_hp_automute(struct hda_codec *codec)
{ {
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x06, 0, present = snd_hda_jack_detect(codec, 0x06);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
snd_hda_codec_amp_stereo(codec, 0x05, HDA_OUTPUT, 0, snd_hda_codec_amp_stereo(codec, 0x05, HDA_OUTPUT, 0,
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
} }
...@@ -1576,8 +1573,7 @@ static void ad1981_hp_automic(struct hda_codec *codec) ...@@ -1576,8 +1573,7 @@ static void ad1981_hp_automic(struct hda_codec *codec)
}; };
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x08, 0, present = snd_hda_jack_detect(codec, 0x08);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
if (present) if (present)
snd_hda_sequence_write(codec, mic_jack_on); snd_hda_sequence_write(codec, mic_jack_on);
else else
...@@ -2532,7 +2528,7 @@ static void ad1988_laptop_unsol_event(struct hda_codec *codec, unsigned int res) ...@@ -2532,7 +2528,7 @@ static void ad1988_laptop_unsol_event(struct hda_codec *codec, unsigned int res)
{ {
if ((res >> 26) != AD1988_HP_EVENT) if ((res >> 26) != AD1988_HP_EVENT)
return; return;
if (snd_hda_codec_read(codec, 0x11, 0, AC_VERB_GET_PIN_SENSE, 0) & (1 << 31)) if (snd_hda_jack_detect(codec, 0x11))
snd_hda_sequence_write(codec, ad1988_laptop_hp_on); snd_hda_sequence_write(codec, ad1988_laptop_hp_on);
else else
snd_hda_sequence_write(codec, ad1988_laptop_hp_off); snd_hda_sequence_write(codec, ad1988_laptop_hp_off);
...@@ -3778,8 +3774,7 @@ static void ad1884a_hp_automute(struct hda_codec *codec) ...@@ -3778,8 +3774,7 @@ static void ad1884a_hp_automute(struct hda_codec *codec)
{ {
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x11, 0, present = snd_hda_jack_detect(codec, 0x11);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_EAPD_BTLENABLE, snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_EAPD_BTLENABLE,
...@@ -3791,8 +3786,7 @@ static void ad1884a_hp_automic(struct hda_codec *codec) ...@@ -3791,8 +3786,7 @@ static void ad1884a_hp_automic(struct hda_codec *codec)
{ {
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x14, 0, present = snd_hda_jack_detect(codec, 0x14);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
snd_hda_codec_write(codec, 0x0c, 0, AC_VERB_SET_CONNECT_SEL, snd_hda_codec_write(codec, 0x0c, 0, AC_VERB_SET_CONNECT_SEL,
present ? 0 : 1); present ? 0 : 1);
} }
...@@ -3827,13 +3821,9 @@ static void ad1884a_laptop_automute(struct hda_codec *codec) ...@@ -3827,13 +3821,9 @@ static void ad1884a_laptop_automute(struct hda_codec *codec)
{ {
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x11, 0, AC_VERB_GET_PIN_SENSE, 0); present = snd_hda_jack_detect(codec, 0x11);
present &= AC_PINSENSE_PRESENCE; if (!present)
if (!present) { present = snd_hda_jack_detect(codec, 0x12);
present = snd_hda_codec_read(codec, 0x12, 0,
AC_VERB_GET_PIN_SENSE, 0);
present &= AC_PINSENSE_PRESENCE;
}
snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0, snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_EAPD_BTLENABLE, snd_hda_codec_write(codec, 0x16, 0, AC_VERB_SET_EAPD_BTLENABLE,
...@@ -3845,11 +3835,9 @@ static void ad1884a_laptop_automic(struct hda_codec *codec) ...@@ -3845,11 +3835,9 @@ static void ad1884a_laptop_automic(struct hda_codec *codec)
{ {
unsigned int idx; unsigned int idx;
if (snd_hda_codec_read(codec, 0x14, 0, AC_VERB_GET_PIN_SENSE, 0) & if (snd_hda_jack_detect(codec, 0x14))
AC_PINSENSE_PRESENCE)
idx = 0; idx = 0;
else if (snd_hda_codec_read(codec, 0x1c, 0, AC_VERB_GET_PIN_SENSE, 0) & else if (snd_hda_jack_detect(codec, 0x1c))
AC_PINSENSE_PRESENCE)
idx = 4; idx = 4;
else else
idx = 1; idx = 1;
...@@ -4018,8 +4006,7 @@ static void ad1984a_thinkpad_automute(struct hda_codec *codec) ...@@ -4018,8 +4006,7 @@ static void ad1984a_thinkpad_automute(struct hda_codec *codec)
{ {
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x11, 0, AC_VERB_GET_PIN_SENSE, 0) present = snd_hda_jack_detect(codec, 0x11);
& AC_PINSENSE_PRESENCE;
snd_hda_codec_amp_stereo(codec, 0x12, HDA_OUTPUT, 0, snd_hda_codec_amp_stereo(codec, 0x12, HDA_OUTPUT, 0,
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
} }
...@@ -4127,14 +4114,12 @@ static struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = { ...@@ -4127,14 +4114,12 @@ static struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = {
/* switch to external mic if plugged */ /* switch to external mic if plugged */
static void ad1984a_touchsmart_automic(struct hda_codec *codec) static void ad1984a_touchsmart_automic(struct hda_codec *codec)
{ {
if (snd_hda_codec_read(codec, 0x1c, 0, if (snd_hda_jack_detect(codec, 0x1c))
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000) {
snd_hda_codec_write(codec, 0x0c, 0, snd_hda_codec_write(codec, 0x0c, 0,
AC_VERB_SET_CONNECT_SEL, 0x4); AC_VERB_SET_CONNECT_SEL, 0x4);
} else { else
snd_hda_codec_write(codec, 0x0c, 0, snd_hda_codec_write(codec, 0x0c, 0,
AC_VERB_SET_CONNECT_SEL, 0x5); AC_VERB_SET_CONNECT_SEL, 0x5);
}
} }
......
...@@ -397,9 +397,7 @@ static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid) ...@@ -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++) { for (i = 0; i < spec->jacks.used; i++) {
if (jacks->nid == nid) { if (jacks->nid == nid) {
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, nid, 0, present = snd_hda_jack_detect(codec, nid);
AC_VERB_GET_PIN_SENSE, 0) &
AC_PINSENSE_PRESENCE;
present = (present) ? jacks->type : 0 ; present = (present) ? jacks->type : 0 ;
...@@ -750,8 +748,7 @@ static void cxt5045_hp_automic(struct hda_codec *codec) ...@@ -750,8 +748,7 @@ static void cxt5045_hp_automic(struct hda_codec *codec)
}; };
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x12, 0, present = snd_hda_jack_detect(codec, 0x12);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
if (present) if (present)
snd_hda_sequence_write(codec, mic_jack_on); snd_hda_sequence_write(codec, mic_jack_on);
else else
...@@ -765,8 +762,7 @@ static void cxt5045_hp_automute(struct hda_codec *codec) ...@@ -765,8 +762,7 @@ static void cxt5045_hp_automute(struct hda_codec *codec)
struct conexant_spec *spec = codec->spec; struct conexant_spec *spec = codec->spec;
unsigned int bits; unsigned int bits;
spec->hp_present = snd_hda_codec_read(codec, 0x11, 0, spec->hp_present = snd_hda_jack_detect(codec, 0x11);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0;
snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0, snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0,
...@@ -1243,8 +1239,7 @@ static void cxt5047_hp_automute(struct hda_codec *codec) ...@@ -1243,8 +1239,7 @@ static void cxt5047_hp_automute(struct hda_codec *codec)
struct conexant_spec *spec = codec->spec; struct conexant_spec *spec = codec->spec;
unsigned int bits; unsigned int bits;
spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, spec->hp_present = snd_hda_jack_detect(codec, 0x13);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0; bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0;
/* See the note in cxt5047_hp_master_sw_put */ /* See the note in cxt5047_hp_master_sw_put */
...@@ -1267,8 +1262,7 @@ static void cxt5047_hp_automic(struct hda_codec *codec) ...@@ -1267,8 +1262,7 @@ static void cxt5047_hp_automic(struct hda_codec *codec)
}; };
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x15, 0, present = snd_hda_jack_detect(codec, 0x15);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
if (present) if (present)
snd_hda_sequence_write(codec, mic_jack_on); snd_hda_sequence_write(codec, mic_jack_on);
else else
...@@ -1621,9 +1615,7 @@ static void cxt5051_portb_automic(struct hda_codec *codec) ...@@ -1621,9 +1615,7 @@ static void cxt5051_portb_automic(struct hda_codec *codec)
if (spec->no_auto_mic) if (spec->no_auto_mic)
return; return;
present = snd_hda_codec_read(codec, 0x17, 0, present = snd_hda_jack_detect(codec, 0x17);
AC_VERB_GET_PIN_SENSE, 0) &
AC_PINSENSE_PRESENCE;
snd_hda_codec_write(codec, 0x14, 0, snd_hda_codec_write(codec, 0x14, 0,
AC_VERB_SET_CONNECT_SEL, AC_VERB_SET_CONNECT_SEL,
present ? 0x01 : 0x00); present ? 0x01 : 0x00);
...@@ -1638,9 +1630,7 @@ static void cxt5051_portc_automic(struct hda_codec *codec) ...@@ -1638,9 +1630,7 @@ static void cxt5051_portc_automic(struct hda_codec *codec)
if (spec->no_auto_mic) if (spec->no_auto_mic)
return; return;
present = snd_hda_codec_read(codec, 0x18, 0, present = snd_hda_jack_detect(codec, 0x18);
AC_VERB_GET_PIN_SENSE, 0) &
AC_PINSENSE_PRESENCE;
if (present) if (present)
spec->cur_adc_idx = 1; spec->cur_adc_idx = 1;
else else
...@@ -1661,9 +1651,7 @@ static void cxt5051_hp_automute(struct hda_codec *codec) ...@@ -1661,9 +1651,7 @@ static void cxt5051_hp_automute(struct hda_codec *codec)
{ {
struct conexant_spec *spec = codec->spec; struct conexant_spec *spec = codec->spec;
spec->hp_present = snd_hda_codec_read(codec, 0x16, 0, spec->hp_present = snd_hda_jack_detect(codec, 0x16);
AC_VERB_GET_PIN_SENSE, 0) &
AC_PINSENSE_PRESENCE;
cxt5051_update_speaker(codec); cxt5051_update_speaker(codec);
} }
...@@ -2011,8 +1999,7 @@ static void cxt5066_automic(struct hda_codec *codec) ...@@ -2011,8 +1999,7 @@ static void cxt5066_automic(struct hda_codec *codec)
}; };
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x1a, 0, present = snd_hda_jack_detect(codec, 0x1a);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
if (present) { if (present) {
snd_printdd("CXT5066: external microphone detected\n"); snd_printdd("CXT5066: external microphone detected\n");
snd_hda_sequence_write(codec, ext_mic_present); snd_hda_sequence_write(codec, ext_mic_present);
...@@ -2029,12 +2016,10 @@ static void cxt5066_hp_automute(struct hda_codec *codec) ...@@ -2029,12 +2016,10 @@ static void cxt5066_hp_automute(struct hda_codec *codec)
unsigned int portA, portD; unsigned int portA, portD;
/* Port A */ /* Port A */
portA = snd_hda_codec_read(codec, 0x19, 0, AC_VERB_GET_PIN_SENSE, 0) portA = snd_hda_jack_detect(codec, 0x19);
& AC_PINSENSE_PRESENCE;
/* Port D */ /* Port D */
portD = (snd_hda_codec_read(codec, 0x1c, 0, AC_VERB_GET_PIN_SENSE, 0) portD = snd_hda_jack_detect(codec, 0x1c);
& AC_PINSENSE_PRESENCE) << 1;
spec->hp_present = !!(portA | portD); spec->hp_present = !!(portA | portD);
snd_printdd("CXT5066: hp automute portA=%x portD=%x present=%d\n", snd_printdd("CXT5066: hp automute portA=%x portD=%x present=%d\n",
......
...@@ -8446,8 +8446,7 @@ static void alc883_clevo_m720_mic_automute(struct hda_codec *codec) ...@@ -8446,8 +8446,7 @@ static void alc883_clevo_m720_mic_automute(struct hda_codec *codec)
{ {
unsigned int present; unsigned int present;
present = snd_hda_codec_read(codec, 0x18, 0, present = snd_hda_jack_detect(codec, 0x18);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
} }
......
...@@ -4413,14 +4413,11 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid, ...@@ -4413,14 +4413,11 @@ static void stac92xx_reset_pinctl(struct hda_codec *codec, hda_nid_t nid,
pin_ctl & ~flag); pin_ctl & ~flag);
} }
static int get_pin_presence(struct hda_codec *codec, hda_nid_t nid) static inline int get_pin_presence(struct hda_codec *codec, hda_nid_t nid)
{ {
if (!nid) if (!nid)
return 0; return 0;
if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) return snd_hda_jack_detect(codec, nid);
& (1 << 31))
return 1;
return 0;
} }
static void stac92xx_line_out_detect(struct hda_codec *codec, static void stac92xx_line_out_detect(struct hda_codec *codec,
......
...@@ -547,8 +547,7 @@ static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid, ...@@ -547,8 +547,7 @@ static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid,
unsigned no_presence = (def_conf & AC_DEFCFG_MISC) unsigned no_presence = (def_conf & AC_DEFCFG_MISC)
>> AC_DEFCFG_MISC_SHIFT >> AC_DEFCFG_MISC_SHIFT
& AC_DEFCFG_MISC_NO_PRESENCE; /* do not support pin sense */ & AC_DEFCFG_MISC_NO_PRESENCE; /* do not support pin sense */
unsigned present = snd_hda_codec_read(codec, nid, 0, unsigned present = snd_hda_jack_detect(codec, nid);
AC_VERB_GET_PIN_SENSE, 0) >> 31;
struct via_spec *spec = codec->spec; struct via_spec *spec = codec->spec;
if ((spec->smart51_enabled && is_smart51_pins(spec, nid)) if ((spec->smart51_enabled && is_smart51_pins(spec, nid))
|| ((no_presence || present) || ((no_presence || present)
...@@ -786,14 +785,11 @@ static void set_jack_power_state(struct hda_codec *codec) ...@@ -786,14 +785,11 @@ static void set_jack_power_state(struct hda_codec *codec)
/* Mono out */ /* Mono out */
/* SW4(28h)->MW1(29h)-> PW12 (2ah)*/ /* SW4(28h)->MW1(29h)-> PW12 (2ah)*/
present = snd_hda_codec_read( present = snd_hda_jack_detect(codec, 0x1c);
codec, 0x1c, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
if (present) if (present)
mono_out = 0; mono_out = 0;
else { else {
present = snd_hda_codec_read( present = snd_hda_jack_detect(codec, 0x1d);
codec, 0x1d, 0, AC_VERB_GET_PIN_SENSE, 0)
& 0x80000000;
if (!spec->hp_independent_mode && present) if (!spec->hp_independent_mode && present)
mono_out = 0; mono_out = 0;
else else
...@@ -872,8 +868,7 @@ static void set_jack_power_state(struct hda_codec *codec) ...@@ -872,8 +868,7 @@ static void set_jack_power_state(struct hda_codec *codec)
/* Class-D */ /* Class-D */
/* PW0 (24h), MW0(18h), MUX0(34h) */ /* PW0 (24h), MW0(18h), MUX0(34h) */
present = snd_hda_codec_read( present = snd_hda_jack_detect(codec, 0x25);
codec, 0x25, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x24, &parm); set_pin_power_state(codec, 0x24, &parm);
if (present) { if (present) {
...@@ -894,8 +889,7 @@ static void set_jack_power_state(struct hda_codec *codec) ...@@ -894,8 +889,7 @@ static void set_jack_power_state(struct hda_codec *codec)
/* Mono Out */ /* Mono Out */
/* PW15 (31h), MW8(17h), MUX8(3bh) */ /* PW15 (31h), MW8(17h), MUX8(3bh) */
present = snd_hda_codec_read( present = snd_hda_jack_detect(codec, 0x26);
codec, 0x26, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x31, &parm); set_pin_power_state(codec, 0x31, &parm);
if (present) { if (present) {
...@@ -973,8 +967,7 @@ static void set_jack_power_state(struct hda_codec *codec) ...@@ -973,8 +967,7 @@ static void set_jack_power_state(struct hda_codec *codec)
/* Internal Speaker */ /* Internal Speaker */
/* PW0 (24h), MW0(14h), MUX0(34h) */ /* PW0 (24h), MW0(14h), MUX0(34h) */
present = snd_hda_codec_read( present = snd_hda_jack_detect(codec, 0x25);
codec, 0x25, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x24, &parm); set_pin_power_state(codec, 0x24, &parm);
if (present) { if (present) {
...@@ -994,8 +987,7 @@ static void set_jack_power_state(struct hda_codec *codec) ...@@ -994,8 +987,7 @@ static void set_jack_power_state(struct hda_codec *codec)
} }
/* Mono Out */ /* Mono Out */
/* PW13 (31h), MW13(1ch), MUX13(3ch), MW14(3eh) */ /* PW13 (31h), MW13(1ch), MUX13(3ch), MW14(3eh) */
present = snd_hda_codec_read( present = snd_hda_jack_detect(codec, 0x28);
codec, 0x28, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
parm = AC_PWRST_D3; parm = AC_PWRST_D3;
set_pin_power_state(codec, 0x31, &parm); set_pin_power_state(codec, 0x31, &parm);
if (present) { if (present) {
...@@ -1920,8 +1912,7 @@ static void via_hp_automute(struct hda_codec *codec) ...@@ -1920,8 +1912,7 @@ static void via_hp_automute(struct hda_codec *codec)
unsigned int present = 0; unsigned int present = 0;
struct via_spec *spec = codec->spec; struct via_spec *spec = codec->spec;
present = snd_hda_codec_read(codec, spec->autocfg.hp_pins[0], 0, present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
if (!spec->hp_independent_mode) { if (!spec->hp_independent_mode) {
struct snd_ctl_elem_id id; struct snd_ctl_elem_id id;
...@@ -1947,9 +1938,8 @@ static void via_mono_automute(struct hda_codec *codec) ...@@ -1947,9 +1938,8 @@ static void via_mono_automute(struct hda_codec *codec)
if (spec->codec_type != VT1716S) if (spec->codec_type != VT1716S)
return; return;
lineout_present = snd_hda_codec_read( lineout_present = snd_hda_jack_detect(codec,
codec, spec->autocfg.line_out_pins[0], 0, spec->autocfg.line_out_pins[0]);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
/* Mute Mono Out if Line Out is plugged */ /* Mute Mono Out if Line Out is plugged */
if (lineout_present) { if (lineout_present) {
...@@ -1958,9 +1948,7 @@ static void via_mono_automute(struct hda_codec *codec) ...@@ -1958,9 +1948,7 @@ static void via_mono_automute(struct hda_codec *codec)
return; return;
} }
hp_present = snd_hda_codec_read( hp_present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
codec, spec->autocfg.hp_pins[0], 0,
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
if (!spec->hp_independent_mode) if (!spec->hp_independent_mode)
snd_hda_codec_amp_stereo( snd_hda_codec_amp_stereo(
...@@ -2025,8 +2013,7 @@ static void via_speaker_automute(struct hda_codec *codec) ...@@ -2025,8 +2013,7 @@ static void via_speaker_automute(struct hda_codec *codec)
if (spec->codec_type != VT2002P && spec->codec_type != VT1812) if (spec->codec_type != VT2002P && spec->codec_type != VT1812)
return; return;
hp_present = snd_hda_codec_read(codec, spec->autocfg.hp_pins[0], 0, hp_present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
if (!spec->hp_independent_mode) { if (!spec->hp_independent_mode) {
struct snd_ctl_elem_id id; struct snd_ctl_elem_id id;
...@@ -2055,11 +2042,9 @@ static void via_hp_bind_automute(struct hda_codec *codec) ...@@ -2055,11 +2042,9 @@ static void via_hp_bind_automute(struct hda_codec *codec)
if (!spec->autocfg.hp_pins[0] || !spec->autocfg.line_out_pins[0]) if (!spec->autocfg.hp_pins[0] || !spec->autocfg.line_out_pins[0])
return; return;
hp_present = snd_hda_codec_read(codec, spec->autocfg.hp_pins[0], 0, hp_present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
present = snd_hda_codec_read(codec, spec->autocfg.line_out_pins[0], 0, present = snd_hda_jack_detect(codec, spec->autocfg.line_out_pins[0]);
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
if (!spec->hp_independent_mode) { if (!spec->hp_independent_mode) {
/* Mute Line-Outs */ /* Mute Line-Outs */
...@@ -2529,8 +2514,7 @@ static void vt1708_update_hp_jack_state(struct work_struct *work) ...@@ -2529,8 +2514,7 @@ static void vt1708_update_hp_jack_state(struct work_struct *work)
return; return;
/* if jack state toggled */ /* if jack state toggled */
if (spec->vt1708_hp_present if (spec->vt1708_hp_present
!= (snd_hda_codec_read(spec->codec, spec->autocfg.hp_pins[0], 0, != snd_hda_jack_detect(spec->codec, spec->autocfg.hp_pins[0])) {
AC_VERB_GET_PIN_SENSE, 0) >> 31)) {
spec->vt1708_hp_present ^= 1; spec->vt1708_hp_present ^= 1;
via_hp_automute(spec->codec); via_hp_automute(spec->codec);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment