From: Takashi Iwai Subject: Re: Possible fix for snd-hda-intel model=no-jd failing since ~linux-3.9-rc1 Date: Thu, 11 Sep 2014 12:55:33 +0200 Message-ID: References: <1410421639.47518.YahooMailNeo@web160601.mail.bf1.yahoo.com> <5411663E.8070106@canonical.com> <54116E91.6010705@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 D3518265895 for ; Thu, 11 Sep 2014 12:55:33 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: David Henningsson Cc: Adam Richter , "alsa-devel@alsa-project.org" List-Id: alsa-devel@alsa-project.org At Thu, 11 Sep 2014 12:07:43 +0200, Takashi Iwai wrote: > > Looking at the alsa-info.sh output, the problem is that IDT codec > parser creates jack detection for the power-control before the generic > parser. There is also a wrong logic in stac_init_power_map()... > > An untested fix is below. BTW, a part of the messes is the restriction of hda_jack stuff: currently it supports only one callback per jack. If we can add multiple callbacks and actions to a jack, the code in patch_sigmatel.c would be come much easier. But this is a step after fixing the bug quickly. Takashi > > > Takashi > > -- > diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c > index f26ec04a29b5..526b5d39a2cb 100644 > --- a/sound/pci/hda/patch_sigmatel.c > +++ b/sound/pci/hda/patch_sigmatel.c > @@ -565,8 +565,8 @@ static void stac_init_power_map(struct hda_codec *codec) > if (snd_hda_jack_tbl_get(codec, nid)) > continue; > if (def_conf == AC_JACK_PORT_COMPLEX && > - !(spec->vref_mute_led_nid == nid || > - is_jack_detectable(codec, nid))) { > + spec->vref_mute_led_nid != nid && > + is_jack_detectable(codec, nid)) { > snd_hda_jack_detect_enable_callback(codec, nid, > STAC_PWR_EVENT, > jack_update_power); > @@ -4272,11 +4272,17 @@ static int stac_parse_auto_config(struct hda_codec *codec) > return err; > } > > - stac_init_power_map(codec); > - > return 0; > } > > +static int stac_build_controls(struct hda_codec *codec) > +{ > + int err = snd_hda_gen_build_controls(codec); > + if (err < 0) > + return err; > + stac_init_power_map(codec); > + return 0; > +} > > static int stac_init(struct hda_codec *codec) > { > @@ -4388,7 +4394,7 @@ static int stac_suspend(struct hda_codec *codec) > #endif /* CONFIG_PM */ > > static const struct hda_codec_ops stac_patch_ops = { > - .build_controls = snd_hda_gen_build_controls, > + .build_controls = stac_build_controls, > .build_pcms = snd_hda_gen_build_pcms, > .init = stac_init, > .free = stac_free,