From: Takashi Iwai Subject: Re: [ALC262_FUJITSU patch_realtek.c] Use jack sense for both headphone outputs Date: Mon, 19 May 2008 12:23:49 +0200 Message-ID: References: <1211155219.4974.10.camel@localhost> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 8D151245AA for ; Mon, 19 May 2008 12:23:50 +0200 (CEST) In-Reply-To: <1211155219.4974.10.camel@localhost> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Tony Vroon Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org 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