From: Takashi Iwai Subject: Re: Realtek model parser problem with the new jack detection Date: Thu, 19 Jan 2012 12:56:34 +0100 Message-ID: References: <4F16F330.1020109@canonical.com> <4F1800F0.4010600@canonical.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 21453103BE6 for ; Thu, 19 Jan 2012 12:56:37 +0100 (CET) In-Reply-To: <4F1800F0.4010600@canonical.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: David Henningsson Cc: ALSA Development Mailing List List-Id: alsa-devel@alsa-project.org At Thu, 19 Jan 2012 12:39:28 +0100, David Henningsson wrote: > > On 01/19/2012 12:17 PM, Takashi Iwai wrote: > > At Thu, 19 Jan 2012 11:35:23 +0100, > > Takashi Iwai wrote: > >> > >> At Wed, 18 Jan 2012 17:28:32 +0100, > >> David Henningsson wrote: > >>> > >>> Hi Takashi, > >>> > >>> I'm troubleshooting a problem with the Realtek quirk/model parsers. The > >>> problem is basically that add_jack_kctls call > >>> snd_hda_jack_detect_enable, which in turn overwrites the current unsol tag. > >>> > >>> E g, first the model parser sets a pin to AC_USRSP_EN | ALC_HP_EVENT, > >>> then comes snd_hda_jack_detect_enable and does AC_USRSP_EN | jack->tag. > >>> > >>> I'm not sure of the best way to resolve this; either keep the current > >>> tag (and mark all jacks as dirty on an unsol event), or read back the > >>> current tag and set it as jack->action (and then always use the jack > >>> table). What do you think? > >> > >> I think a safer way is to avoid calling snd_hda_jack_add_kctls() > >> for non-auto-parser, and let quirks use its own unsol_event handler > >> instead of alc_sku_unsol_event(). snd_hda_jack_detect() itself works > >> both with or without jack-kctls. > >> > >> I'll fix up the upstream tree. > > > > The patch below. > > Thanks for quick handling. This will mean no jack kctls for model > parsers, which is a bit sad, but hopefully its an incentive for people > to move to auto-parsers. > > One review comment below: > > > @@ -645,6 +638,19 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) > > snd_hda_jack_report_sync(codec); > > } > > > > +/* unsolicited event for HP jack sensing */ > > +static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) > > +{ > > + struct alc_spec *spec = codec->spec; > > + if (codec->vendor_id == 0x10ec0880) > > + res>>= 28; > > + else > > + res>>= 26; > > + if (spec->use_jack_tbl) > > + res = snd_hda_jack_get_action(codec, res); > > Can the check for spec->use_jack_tbl can be removed here? Hm, good point. Actually, the whole changes for creating own unsol_event() weren't necessary. OTOH, separating the handlers makes cleaner, i.e. eventually we can drop spec->use_jack_tbl field completely. Let's do it in another patch. thanks, Takashi