aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_via.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_via.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_via.c')
-rw-r--r--sound/pci/hda/patch_via.c46
1 files changed, 15 insertions, 31 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 0c621d74b16..b70e26ad263 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -547,8 +547,7 @@ static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid,
547 unsigned no_presence = (def_conf & AC_DEFCFG_MISC) 547 unsigned no_presence = (def_conf & AC_DEFCFG_MISC)
548 >> AC_DEFCFG_MISC_SHIFT 548 >> AC_DEFCFG_MISC_SHIFT
549 & AC_DEFCFG_MISC_NO_PRESENCE; /* do not support pin sense */ 549 & AC_DEFCFG_MISC_NO_PRESENCE; /* do not support pin sense */
550 unsigned present = snd_hda_codec_read(codec, nid, 0, 550 unsigned present = snd_hda_jack_detect(codec, nid);
551 AC_VERB_GET_PIN_SENSE, 0) >> 31;
552 struct via_spec *spec = codec->spec; 551 struct via_spec *spec = codec->spec;
553 if ((spec->smart51_enabled && is_smart51_pins(spec, nid)) 552 if ((spec->smart51_enabled && is_smart51_pins(spec, nid))
554 || ((no_presence || present) 553 || ((no_presence || present)
@@ -786,14 +785,11 @@ static void set_jack_power_state(struct hda_codec *codec)
786 785
787 /* Mono out */ 786 /* Mono out */
788 /* SW4(28h)->MW1(29h)-> PW12 (2ah)*/ 787 /* SW4(28h)->MW1(29h)-> PW12 (2ah)*/
789 present = snd_hda_codec_read( 788 present = snd_hda_jack_detect(codec, 0x1c);
790 codec, 0x1c, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
791 if (present) 789 if (present)
792 mono_out = 0; 790 mono_out = 0;
793 else { 791 else {
794 present = snd_hda_codec_read( 792 present = snd_hda_jack_detect(codec, 0x1d);
795 codec, 0x1d, 0, AC_VERB_GET_PIN_SENSE, 0)
796 & 0x80000000;
797 if (!spec->hp_independent_mode && present) 793 if (!spec->hp_independent_mode && present)
798 mono_out = 0; 794 mono_out = 0;
799 else 795 else
@@ -872,8 +868,7 @@ static void set_jack_power_state(struct hda_codec *codec)
872 868
873 /* Class-D */ 869 /* Class-D */
874 /* PW0 (24h), MW0(18h), MUX0(34h) */ 870 /* PW0 (24h), MW0(18h), MUX0(34h) */
875 present = snd_hda_codec_read( 871 present = snd_hda_jack_detect(codec, 0x25);
876 codec, 0x25, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
877 parm = AC_PWRST_D3; 872 parm = AC_PWRST_D3;
878 set_pin_power_state(codec, 0x24, &parm); 873 set_pin_power_state(codec, 0x24, &parm);
879 if (present) { 874 if (present) {
@@ -894,8 +889,7 @@ static void set_jack_power_state(struct hda_codec *codec)
894 889
895 /* Mono Out */ 890 /* Mono Out */
896 /* PW15 (31h), MW8(17h), MUX8(3bh) */ 891 /* PW15 (31h), MW8(17h), MUX8(3bh) */
897 present = snd_hda_codec_read( 892 present = snd_hda_jack_detect(codec, 0x26);
898 codec, 0x26, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
899 parm = AC_PWRST_D3; 893 parm = AC_PWRST_D3;
900 set_pin_power_state(codec, 0x31, &parm); 894 set_pin_power_state(codec, 0x31, &parm);
901 if (present) { 895 if (present) {
@@ -973,8 +967,7 @@ static void set_jack_power_state(struct hda_codec *codec)
973 967
974 /* Internal Speaker */ 968 /* Internal Speaker */
975 /* PW0 (24h), MW0(14h), MUX0(34h) */ 969 /* PW0 (24h), MW0(14h), MUX0(34h) */
976 present = snd_hda_codec_read( 970 present = snd_hda_jack_detect(codec, 0x25);
977 codec, 0x25, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
978 parm = AC_PWRST_D3; 971 parm = AC_PWRST_D3;
979 set_pin_power_state(codec, 0x24, &parm); 972 set_pin_power_state(codec, 0x24, &parm);
980 if (present) { 973 if (present) {
@@ -994,8 +987,7 @@ static void set_jack_power_state(struct hda_codec *codec)
994 } 987 }
995 /* Mono Out */ 988 /* Mono Out */
996 /* PW13 (31h), MW13(1ch), MUX13(3ch), MW14(3eh) */ 989 /* PW13 (31h), MW13(1ch), MUX13(3ch), MW14(3eh) */
997 present = snd_hda_codec_read( 990 present = snd_hda_jack_detect(codec, 0x28);
998 codec, 0x28, 0, AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
999 parm = AC_PWRST_D3; 991 parm = AC_PWRST_D3;
1000 set_pin_power_state(codec, 0x31, &parm); 992 set_pin_power_state(codec, 0x31, &parm);
1001 if (present) { 993 if (present) {
@@ -1920,8 +1912,7 @@ static void via_hp_automute(struct hda_codec *codec)
1920 unsigned int present = 0; 1912 unsigned int present = 0;
1921 struct via_spec *spec = codec->spec; 1913 struct via_spec *spec = codec->spec;
1922 1914
1923 present = snd_hda_codec_read(codec, spec->autocfg.hp_pins[0], 0, 1915 present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
1924 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1925 1916
1926 if (!spec->hp_independent_mode) { 1917 if (!spec->hp_independent_mode) {
1927 struct snd_ctl_elem_id id; 1918 struct snd_ctl_elem_id id;
@@ -1947,9 +1938,8 @@ static void via_mono_automute(struct hda_codec *codec)
1947 if (spec->codec_type != VT1716S) 1938 if (spec->codec_type != VT1716S)
1948 return; 1939 return;
1949 1940
1950 lineout_present = snd_hda_codec_read( 1941 lineout_present = snd_hda_jack_detect(codec,
1951 codec, spec->autocfg.line_out_pins[0], 0, 1942 spec->autocfg.line_out_pins[0]);
1952 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1953 1943
1954 /* Mute Mono Out if Line Out is plugged */ 1944 /* Mute Mono Out if Line Out is plugged */
1955 if (lineout_present) { 1945 if (lineout_present) {
@@ -1958,9 +1948,7 @@ static void via_mono_automute(struct hda_codec *codec)
1958 return; 1948 return;
1959 } 1949 }
1960 1950
1961 hp_present = snd_hda_codec_read( 1951 hp_present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
1962 codec, spec->autocfg.hp_pins[0], 0,
1963 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1964 1952
1965 if (!spec->hp_independent_mode) 1953 if (!spec->hp_independent_mode)
1966 snd_hda_codec_amp_stereo( 1954 snd_hda_codec_amp_stereo(
@@ -2025,8 +2013,7 @@ static void via_speaker_automute(struct hda_codec *codec)
2025 if (spec->codec_type != VT2002P && spec->codec_type != VT1812) 2013 if (spec->codec_type != VT2002P && spec->codec_type != VT1812)
2026 return; 2014 return;
2027 2015
2028 hp_present = snd_hda_codec_read(codec, spec->autocfg.hp_pins[0], 0, 2016 hp_present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
2029 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2030 2017
2031 if (!spec->hp_independent_mode) { 2018 if (!spec->hp_independent_mode) {
2032 struct snd_ctl_elem_id id; 2019 struct snd_ctl_elem_id id;
@@ -2055,11 +2042,9 @@ static void via_hp_bind_automute(struct hda_codec *codec)
2055 if (!spec->autocfg.hp_pins[0] || !spec->autocfg.line_out_pins[0]) 2042 if (!spec->autocfg.hp_pins[0] || !spec->autocfg.line_out_pins[0])
2056 return; 2043 return;
2057 2044
2058 hp_present = snd_hda_codec_read(codec, spec->autocfg.hp_pins[0], 0, 2045 hp_present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
2059 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2060 2046
2061 present = snd_hda_codec_read(codec, spec->autocfg.line_out_pins[0], 0, 2047 present = snd_hda_jack_detect(codec, spec->autocfg.line_out_pins[0]);
2062 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
2063 2048
2064 if (!spec->hp_independent_mode) { 2049 if (!spec->hp_independent_mode) {
2065 /* Mute Line-Outs */ 2050 /* Mute Line-Outs */
@@ -2529,8 +2514,7 @@ static void vt1708_update_hp_jack_state(struct work_struct *work)
2529 return; 2514 return;
2530 /* if jack state toggled */ 2515 /* if jack state toggled */
2531 if (spec->vt1708_hp_present 2516 if (spec->vt1708_hp_present
2532 != (snd_hda_codec_read(spec->codec, spec->autocfg.hp_pins[0], 0, 2517 != snd_hda_jack_detect(spec->codec, spec->autocfg.hp_pins[0])) {
2533 AC_VERB_GET_PIN_SENSE, 0) >> 31)) {
2534 spec->vt1708_hp_present ^= 1; 2518 spec->vt1708_hp_present ^= 1;
2535 via_hp_automute(spec->codec); 2519 via_hp_automute(spec->codec);
2536 } 2520 }