aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-07-26 05:49:22 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:58:01 -0400
commit5b31954e4b364f811450311e3b31d3512e575f63 (patch)
tree063e5493ec0309c6686c7c3f809cac52038f908c
parentb87c464ea2c27005f592aaf351af40989f90f574 (diff)
[ALSA] hda-codec - Fix the initial mixer state of ALC262 sony-assamd model
Many of ALC262 codes don't call the automute function at the beginning, which may keep the silence until the HP jack is replugged. Now proper init_hook is added. Also, sony-assamd model doesn't handle the widget 0x14 properly, thus calling automute isn't enough. Now Front switch handles both widgets. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r--sound/pci/hda/patch_realtek.c66
1 files changed, 41 insertions, 25 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 7e6cc01b521a..d839d567f8e4 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -7140,9 +7140,28 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = {
7140 { } /* end */ 7140 { } /* end */
7141}; 7141};
7142 7142
7143static int alc262_sony_sw_put(struct snd_kcontrol *kcontrol,
7144 struct snd_ctl_elem_value *ucontrol)
7145{
7146 unsigned long private_save = kcontrol->private_value;
7147 int change;
7148 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT);
7149 change = snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
7150 kcontrol->private_value = private_save;
7151 change |= snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
7152 return change;
7153}
7154
7143static struct snd_kcontrol_new alc262_sony_mixer[] = { 7155static struct snd_kcontrol_new alc262_sony_mixer[] = {
7144 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 7156 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
7145 HDA_CODEC_MUTE("Front Playback Switch", 0x15, 0x0, HDA_OUTPUT), 7157 {
7158 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
7159 .name = "Front Playback Switch",
7160 .info = snd_hda_mixer_amp_switch_info,
7161 .get = snd_hda_mixer_amp_switch_get,
7162 .put = alc262_sony_sw_put,
7163 .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT),
7164 },
7146 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), 7165 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
7147 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), 7166 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
7148 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), 7167 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
@@ -7269,20 +7288,17 @@ static struct hda_verb alc262_sony_unsol_verbs[] = {
7269}; 7288};
7270 7289
7271/* mute/unmute internal speaker according to the hp jack and mute state */ 7290/* mute/unmute internal speaker according to the hp jack and mute state */
7272static void alc262_hippo_automute(struct hda_codec *codec, int force) 7291static void alc262_hippo_automute(struct hda_codec *codec)
7273{ 7292{
7274 struct alc_spec *spec = codec->spec; 7293 struct alc_spec *spec = codec->spec;
7275 unsigned int mute; 7294 unsigned int mute;
7295 unsigned int present;
7276 7296
7277 if (force || !spec->sense_updated) { 7297 /* need to execute and sync at first */
7278 unsigned int present; 7298 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
7279 /* need to execute and sync at first */ 7299 present = snd_hda_codec_read(codec, 0x15, 0,
7280 snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); 7300 AC_VERB_GET_PIN_SENSE, 0);
7281 present = snd_hda_codec_read(codec, 0x15, 0, 7301 spec->jack_present = (present & 0x80000000) != 0;
7282 AC_VERB_GET_PIN_SENSE, 0);
7283 spec->jack_present = (present & 0x80000000) != 0;
7284 spec->sense_updated = 1;
7285 }
7286 if (spec->jack_present) { 7302 if (spec->jack_present) {
7287 /* mute internal speaker */ 7303 /* mute internal speaker */
7288 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7304 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
@@ -7306,24 +7322,19 @@ static void alc262_hippo_unsol_event(struct hda_codec *codec,
7306{ 7322{
7307 if ((res >> 26) != ALC880_HP_EVENT) 7323 if ((res >> 26) != ALC880_HP_EVENT)
7308 return; 7324 return;
7309 alc262_hippo_automute(codec, 1); 7325 alc262_hippo_automute(codec);
7310} 7326}
7311 7327
7312static void alc262_hippo1_automute(struct hda_codec *codec, int force) 7328static void alc262_hippo1_automute(struct hda_codec *codec)
7313{ 7329{
7314 struct alc_spec *spec = codec->spec;
7315 unsigned int mute; 7330 unsigned int mute;
7331 unsigned int present;
7316 7332
7317 if (force || !spec->sense_updated) { 7333 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0);
7318 unsigned int present; 7334 present = snd_hda_codec_read(codec, 0x1b, 0,
7319 /* need to execute and sync at first */ 7335 AC_VERB_GET_PIN_SENSE, 0);
7320 snd_hda_codec_read(codec, 0x1b, 0, AC_VERB_SET_PIN_SENSE, 0); 7336 present = (present & 0x80000000) != 0;
7321 present = snd_hda_codec_read(codec, 0x1b, 0, 7337 if (present) {
7322 AC_VERB_GET_PIN_SENSE, 0);
7323 spec->jack_present = (present & 0x80000000) != 0;
7324 spec->sense_updated = 1;
7325 }
7326 if (spec->jack_present) {
7327 /* mute internal speaker */ 7338 /* mute internal speaker */
7328 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7339 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7329 0x80, 0x80); 7340 0x80, 0x80);
@@ -7346,7 +7357,7 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
7346{ 7357{
7347 if ((res >> 26) != ALC880_HP_EVENT) 7358 if ((res >> 26) != ALC880_HP_EVENT)
7348 return; 7359 return;
7349 alc262_hippo1_automute(codec, 1); 7360 alc262_hippo1_automute(codec);
7350} 7361}
7351 7362
7352/* 7363/*
@@ -7923,6 +7934,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
7923 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), 7934 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
7924 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), 7935 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
7925 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), 7936 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
7937 SND_PCI_QUIRK(0x104d, 0x820f, "Sony ASSAMD", ALC262_SONY_ASSAMD),
7926 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), 7938 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD),
7927 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), 7939 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD),
7928 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD), 7940 SND_PCI_QUIRK(0x104d, 0x1f00, "Sony ASSAMD", ALC262_SONY_ASSAMD),
@@ -7951,6 +7963,7 @@ static struct alc_config_preset alc262_presets[] = {
7951 .channel_mode = alc262_modes, 7963 .channel_mode = alc262_modes,
7952 .input_mux = &alc262_capture_source, 7964 .input_mux = &alc262_capture_source,
7953 .unsol_event = alc262_hippo_unsol_event, 7965 .unsol_event = alc262_hippo_unsol_event,
7966 .init_hook = alc262_hippo_automute,
7954 }, 7967 },
7955 [ALC262_HIPPO_1] = { 7968 [ALC262_HIPPO_1] = {
7956 .mixers = { alc262_hippo1_mixer }, 7969 .mixers = { alc262_hippo1_mixer },
@@ -7963,6 +7976,7 @@ static struct alc_config_preset alc262_presets[] = {
7963 .channel_mode = alc262_modes, 7976 .channel_mode = alc262_modes,
7964 .input_mux = &alc262_capture_source, 7977 .input_mux = &alc262_capture_source,
7965 .unsol_event = alc262_hippo1_unsol_event, 7978 .unsol_event = alc262_hippo1_unsol_event,
7979 .init_hook = alc262_hippo1_automute,
7966 }, 7980 },
7967 [ALC262_FUJITSU] = { 7981 [ALC262_FUJITSU] = {
7968 .mixers = { alc262_fujitsu_mixer }, 7982 .mixers = { alc262_fujitsu_mixer },
@@ -8027,6 +8041,7 @@ static struct alc_config_preset alc262_presets[] = {
8027 .channel_mode = alc262_modes, 8041 .channel_mode = alc262_modes,
8028 .input_mux = &alc262_capture_source, 8042 .input_mux = &alc262_capture_source,
8029 .unsol_event = alc262_hippo_unsol_event, 8043 .unsol_event = alc262_hippo_unsol_event,
8044 .init_hook = alc262_hippo_automute,
8030 }, 8045 },
8031 [ALC262_BENQ_T31] = { 8046 [ALC262_BENQ_T31] = {
8032 .mixers = { alc262_benq_t31_mixer }, 8047 .mixers = { alc262_benq_t31_mixer },
@@ -8038,6 +8053,7 @@ static struct alc_config_preset alc262_presets[] = {
8038 .channel_mode = alc262_modes, 8053 .channel_mode = alc262_modes,
8039 .input_mux = &alc262_capture_source, 8054 .input_mux = &alc262_capture_source,
8040 .unsol_event = alc262_hippo_unsol_event, 8055 .unsol_event = alc262_hippo_unsol_event,
8056 .init_hook = alc262_hippo_automute,
8041 }, 8057 },
8042}; 8058};
8043 8059