From: Takashi Iwai Subject: Re: [PATCH] hda_codec: restore control element values during resume Date: Thu, 03 May 2007 12:38:04 +0200 Message-ID: References: <20070429161421.863777B409F@zog.reactivated.net> <4638B4CC.4060606@gentoo.org> 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 141AD2441E for ; Thu, 3 May 2007 12:38:05 +0200 (CEST) In-Reply-To: <4638B4CC.4060606@gentoo.org> 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: Daniel Drake Cc: alsa-devel@alsa-project.org List-Id: alsa-devel@alsa-project.org At Wed, 02 May 2007 11:57:00 -0400, Daniel Drake wrote: > > Takashi Iwai wrote: > > The controls should have been restored by snd_hda_resume_ctls() call > > in stac92xx_resume(), so basically your patch must be suprefluous. > > Could you check whether this gets called? > > I did see the snd_hda_resume_ctls() code but noted it was resuming from > snd_kcontrol_new structures rather than snd_kcontrol instances. I'm > still not sure what the difference is here, are they supposed to > 'mirror' each other? Not really. The snd_kcontrol_new struct is basically a template for creating a control element. The codec code uses this array to get the control elements. Tracking all kctls from the card instance is not suitable in this case because it contains really _all_ control elements. hda-intel driver may have multiple codecs, so you cannot check whether the element is what your codec created or not. Another way would be to keep a list of created kctls, but I chose a simpler way to use kcontrol_new because they are already there. > Anyway, it turns out that snd_hda_resume_ctls() doesn't get executed. > > stac92xx_resume() has this code: > > for (i = 0; i < spec->num_mixers; i++) > snd_hda_resume_ctls(codec, spec->mixers[i]); > > On my system, spec->num_mixers is 0. OK, it's a simple error. The resume callback should call snd_hda_resume_ctls() with spec->mixer argument. The other codec codes store this also onto spec->mixers[] array, so I overlooked. Now fixed on HG tree. thanks, Takashi