diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-08-22 18:31:43 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:59:25 -0400 |
commit | 0724ea2a85a804e151d960359b599ae8a7c1cad1 (patch) | |
tree | 4172262781ca6bc2dcf172bf392f867af78c1e39 /sound/pci/hda/patch_realtek.c | |
parent | 1fcaee6ee212fc214c1327d788afa10899c22e3a (diff) |
[ALSA] hda-codec - Fix mater mixer switch of ALC262 sony-amd model
Fixed the master mixer switch of ALC272 sony-amd model.
It used a simple bind-control, but it resulted in unexpected
unmute of speaker output. Now the control checks the HP jack
state apropriately, just like fujitsu model.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index db29ebea20b5..4cbd0e6e849d 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -7453,18 +7453,46 @@ static struct snd_kcontrol_new alc262_HP_BPC_WildWest_option_mixer[] = { | |||
7453 | { } /* end */ | 7453 | { } /* end */ |
7454 | }; | 7454 | }; |
7455 | 7455 | ||
7456 | static struct hda_bind_ctls alc262_sony_bind_sw = { | 7456 | /* bind hp and internal speaker mute (with plug check) */ |
7457 | .ops = &snd_hda_bind_sw, | 7457 | static int alc262_sony_master_sw_put(struct snd_kcontrol *kcontrol, |
7458 | .values = { | 7458 | struct snd_ctl_elem_value *ucontrol) |
7459 | HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | 7459 | { |
7460 | HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT), | 7460 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
7461 | 0, | 7461 | long *valp = ucontrol->value.integer.value; |
7462 | }, | 7462 | int change; |
7463 | }; | 7463 | |
7464 | /* change hp mute */ | ||
7465 | change = snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, | ||
7466 | HDA_AMP_MUTE, | ||
7467 | valp[0] ? 0 : HDA_AMP_MUTE); | ||
7468 | change |= snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, | ||
7469 | HDA_AMP_MUTE, | ||
7470 | valp[1] ? 0 : HDA_AMP_MUTE); | ||
7471 | if (change) { | ||
7472 | /* change speaker according to HP jack state */ | ||
7473 | struct alc_spec *spec = codec->spec; | ||
7474 | unsigned int mute; | ||
7475 | if (spec->jack_present) | ||
7476 | mute = HDA_AMP_MUTE; | ||
7477 | else | ||
7478 | mute = snd_hda_codec_amp_read(codec, 0x15, 0, | ||
7479 | HDA_OUTPUT, 0); | ||
7480 | snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, | ||
7481 | HDA_AMP_MUTE, mute); | ||
7482 | } | ||
7483 | return change; | ||
7484 | } | ||
7464 | 7485 | ||
7465 | static struct snd_kcontrol_new alc262_sony_mixer[] = { | 7486 | static struct snd_kcontrol_new alc262_sony_mixer[] = { |
7466 | HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), | 7487 | HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT), |
7467 | HDA_BIND_SW("Front Playback Switch", &alc262_sony_bind_sw), | 7488 | { |
7489 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | ||
7490 | .name = "Master Playback Switch", | ||
7491 | .info = snd_hda_mixer_amp_switch_info, | ||
7492 | .get = snd_hda_mixer_amp_switch_get, | ||
7493 | .put = alc262_sony_master_sw_put, | ||
7494 | .private_value = HDA_COMPOSE_AMP_VAL(0x15, 3, 0, HDA_OUTPUT), | ||
7495 | }, | ||
7468 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), | 7496 | HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT), |
7469 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), | 7497 | HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT), |
7470 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), | 7498 | HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), |