[alsa-devel] [ALC262_FUJITSU patch_realtek.c] Use jack sense for both headphone outputs
Takashi Iwai
tiwai at suse.de
Mon May 19 12:23:49 CEST 2008
At Mon, 19 May 2008 01:00:19 +0100,
Tony Vroon wrote:
>
> --- sound/pci/hda/patch_realtek.c.orig 2008-05-17 15:07:35.000000000 +0100
> +++ sound/pci/hda/patch_realtek.c 2008-05-19 00:43:35.000000000 +0100
> @@ -8757,7 +8757,7 @@
> },
> };
>
> -/* mute/unmute internal speaker according to the hp jack and mute state */
> +/* mute/unmute internal speaker according to the hp jacks and mute state */
> static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
> {
> struct alc_spec *spec = codec->spec;
> @@ -8765,13 +8765,28 @@
>
> if (force || !spec->sense_updated) {
> unsigned int present_int_hp, present_dock_hp;
> - /* need to execute and sync at first */
> + /* sense laptop headphone jack, enable amp if required */
> snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
> present_int_hp = snd_hda_codec_read(codec, 0x14, 0,
> AC_VERB_GET_PIN_SENSE, 0);
> + if ((present_int_hp & 0x80000000) != 0)
> + snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
> + HDA_AMP_MUTE, 0);
> + else
> + snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
> + HDA_AMP_MUTE, HDA_AMP_MUTE);
> +
> + /* sense dock headphone jack, enable amp if required */
> snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0);
> present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0,
> AC_VERB_GET_PIN_SENSE, 0);
> + if ((present_dock_hp & 0x80000000) != 0)
> + snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
> + HDA_AMP_MUTE, 0);
> + else
> + snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
> + HDA_AMP_MUTE, HDA_AMP_MUTE);
> +
> spec->jack_present = (present_int_hp & 0x80000000) != 0;
> spec->jack_present |= (present_dock_hp & 0x80000000) != 0;
> spec->sense_updated = 1;
I get a compile warning, "unused variable mute". Could you fix it?
> @@ -8781,10 +8796,9 @@
> snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
> HDA_AMP_MUTE, HDA_AMP_MUTE);
> } else {
> - /* unmute internal speaker if necessary */
> - mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
Any reason to remove this?
Otherwise the internal speaker won't react together with the Master volume.
Maybe a cleaner fix is to remove the bind_sw and bind_vol hacks and
use vmaster instead.
thanks,
Takashi
More information about the Alsa-devel
mailing list