From: Takashi Iwai Subject: Re: Bug report - patch_realtek.c - Laptop HP COMPAQ B1900 Series Date: Thu, 16 Feb 2012 10:36:33 +0100 Message-ID: References: <4F35C191.9080401@gmail.com> <20120211020502.GA25041@marvin.atrad.com.au> <4F3B761D.4060306@gmail.com> <4F3B7B80.5030102@gmail.com> <4F3B7EC1.4000503@gmail.com> <4F3B83AF.3020301@gmail.com> <4F3BAFC8.4030903@gmail.com> <4F3BC507.2040001@gmail.com> <4F3C7AD6.9040001@gmail.com> 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 (cantor2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 906DA243FF for ; Thu, 16 Feb 2012 10:36:37 +0100 (CET) In-Reply-To: <4F3C7AD6.9040001@gmail.com> 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: "joey.jiaojg" Cc: Raymond Yau , pshou@realtek.com.tw, ALSA Development Mailing List , kailang@realtek.com.tw List-Id: alsa-devel@alsa-project.org At Thu, 16 Feb 2012 11:41:10 +0800, joey.jiaojg wrote: > > And now this code works: > /* toggle speaker-output according to the hp-jack state */ > static void alc260_b1900_automute(struct hda_codec *codec) > { > unsigned int present; > > present = snd_hda_jack_detect(codec, 0x0f); > if (present) { > snd_hda_codec_write_cache(codec, 0x01, 0, > AC_VERB_SET_GPIO_MASK, 0); > snd_hda_codec_write_cache(codec, 0x01, 0, > AC_VERB_SET_GPIO_DIRECTION, > 0); > snd_hda_codec_write_cache(codec, 0x01, 0, > AC_VERB_SET_GPIO_DATA, > 1); > } else { > snd_hda_codec_write_cache(codec, 0x01, 0, > AC_VERB_SET_GPIO_MASK, 1); > snd_hda_codec_write_cache(codec, 0x01, 0, > AC_VERB_SET_GPIO_DIRECTION, > 1); > snd_hda_codec_write_cache(codec, 0x01, 0, > AC_VERB_SET_GPIO_DATA, > 0); > } > } The GPIO_MASK and GPIO_DIRECTION need to be set only once in the init verbs, both to 1. Then you just need to flip GPIO_DATA between 0 and 1 in the unsol event handler. Takashi