aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-05-08 08:31:55 -0400
committerTakashi Iwai <tiwai@suse.de>2009-05-08 09:49:41 -0400
commitb72519b518211ecb7c4c7b5e660ac6235ca7d1b7 (patch)
treedaf60ea6c87d8142091ac604ded3cd1cb544f1d0 /sound/pci/hda/patch_realtek.c
parent42171c17f267d7fdc5167ad7b6b5fb9edfd04186 (diff)
ALSA: hda - Clean up for ALC262 HP model auto-mute functions
Just clean up, no functional changes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c54
1 files changed, 19 insertions, 35 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 8b242c9da4dd..7c043b3b81a5 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -9589,14 +9589,7 @@ static void alc262_hp_wildwest_unsol_event(struct hda_codec *codec,
9589 alc262_hp_wildwest_automute(codec); 9589 alc262_hp_wildwest_automute(codec);
9590} 9590}
9591 9591
9592static int alc262_hp_master_sw_get(struct snd_kcontrol *kcontrol, 9592#define alc262_hp_master_sw_get alc260_hp_master_sw_get
9593 struct snd_ctl_elem_value *ucontrol)
9594{
9595 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
9596 struct alc_spec *spec = codec->spec;
9597 *ucontrol->value.integer.value = spec->master_sw;
9598 return 0;
9599}
9600 9593
9601static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol, 9594static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9602 struct snd_ctl_elem_value *ucontrol) 9595 struct snd_ctl_elem_value *ucontrol)
@@ -9612,14 +9605,17 @@ static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,
9612 return 1; 9605 return 1;
9613} 9606}
9614 9607
9608#define ALC262_HP_MASTER_SWITCH \
9609 { \
9610 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
9611 .name = "Master Playback Switch", \
9612 .info = snd_ctl_boolean_mono_info, \
9613 .get = alc262_hp_master_sw_get, \
9614 .put = alc262_hp_master_sw_put, \
9615 }
9616
9615static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = { 9617static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9616 { 9618 ALC262_HP_MASTER_SWITCH,
9617 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9618 .name = "Master Playback Switch",
9619 .info = snd_ctl_boolean_mono_info,
9620 .get = alc262_hp_master_sw_get,
9621 .put = alc262_hp_master_sw_put,
9622 },
9623 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9619 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9624 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), 9620 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT),
9625 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 9621 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
@@ -9643,13 +9639,7 @@ static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {
9643}; 9639};
9644 9640
9645static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = { 9641static struct snd_kcontrol_new alc262_HP_BPC_WildWest_mixer[] = {
9646 { 9642 ALC262_HP_MASTER_SWITCH,
9647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
9648 .name = "Master Playback Switch",
9649 .info = snd_ctl_boolean_mono_info,
9650 .get = alc262_hp_master_sw_get,
9651 .put = alc262_hp_master_sw_put,
9652 },
9653 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9643 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
9654 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT), 9644 HDA_CODEC_MUTE("Front Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
9655 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT), 9645 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -9676,17 +9666,14 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
9676}; 9666};
9677 9667
9678/* mute/unmute internal speaker according to the hp jack and mute state */ 9668/* mute/unmute internal speaker according to the hp jack and mute state */
9679static void alc262_hp_t5735_automute(struct hda_codec *codec, int force) 9669static void alc262_hp_t5735_automute(struct hda_codec *codec)
9680{ 9670{
9681 struct alc_spec *spec = codec->spec; 9671 struct alc_spec *spec = codec->spec;
9672 unsigned int present;
9682 9673
9683 if (force || !spec->sense_updated) { 9674 present = snd_hda_codec_read(codec, 0x15, 0,
9684 unsigned int present; 9675 AC_VERB_GET_PIN_SENSE, 0);
9685 present = snd_hda_codec_read(codec, 0x15, 0, 9676 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9686 AC_VERB_GET_PIN_SENSE, 0);
9687 spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
9688 spec->sense_updated = 1;
9689 }
9690 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE, 9677 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0, HDA_AMP_MUTE,
9691 spec->jack_present ? HDA_AMP_MUTE : 0); 9678 spec->jack_present ? HDA_AMP_MUTE : 0);
9692} 9679}
@@ -9696,13 +9683,10 @@ static void alc262_hp_t5735_unsol_event(struct hda_codec *codec,
9696{ 9683{
9697 if ((res >> 26) != ALC880_HP_EVENT) 9684 if ((res >> 26) != ALC880_HP_EVENT)
9698 return; 9685 return;
9699 alc262_hp_t5735_automute(codec, 1); 9686 alc262_hp_t5735_automute(codec);
9700} 9687}
9701 9688
9702static void alc262_hp_t5735_init_hook(struct hda_codec *codec) 9689#define alc262_hp_t5735_init_hook alc262_hp_t5735_automute
9703{
9704 alc262_hp_t5735_automute(codec, 1);
9705}
9706 9690
9707static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = { 9691static struct snd_kcontrol_new alc262_hp_t5735_mixer[] = {
9708 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 9692 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),