From: Takashi Iwai Subject: Re: [RFC PATCH 1/1] ALSA: hda - add a timer to find and suspend idle codecs Date: Tue, 14 Aug 2012 17:19:13 +0200 Message-ID: References: <1344967003-5470-1-git-send-email-mengdong.lin@intel.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 875A7265EB8 for ; Tue, 14 Aug 2012 16:49:28 +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: "Lin, Mengdong" Cc: "alsa-devel@alsa-project.org" List-Id: alsa-devel@alsa-project.org At Tue, 14 Aug 2012 16:42:11 +0200, Takashi Iwai wrote: > > At Tue, 14 Aug 2012 14:35:56 +0000, > Lin, Mengdong wrote: > > > > > Is watching the codec power up/down the only purpose? > > > If so, the time for codec power on/off can be already checked in > > > /sys/class/sound/hwC*D*/power_{on|off}_acct files. > > > These are used by powertop, for example. > > > > Hi Takashi, > > > > My purpose is to enable runtime power management on HD audio. And I hope to base runtime PM on current power saving implementation. > > > > The basic idea is: > > For the HD-A controller, runtime PM can be enabled on platforms than can provide acceptable latency on transition from D3 to D0. > > When both power saving and runtime PM are enabled by the user, and if all codec are suspended (in D3), the HD-A controller can also enter low-power state by triggering system runtime suspend. And on user operations or HW wakeup event, HD-A controller will be resumed before codecs. > > > > In my test, I found the issue described in my patch. Such idle but unsuspended codecs prevent the controller from entering D3 at runtime. So I need a > > method to detect such idle codecs and suspend them. Even if runtime PM is not enabled, I hope this method can improve current power saving. > > Ah I see. In that case, the better approach is reimplement the > power_save set ops to trigger the power-save evaluation. > As already others mentioned, it's bad to use a timer for such a > purpose. You know exactly when it must be checked. It's the time > when power_save option is changed. I revived my early hack and adapted it to the latest HD-audio code. I'm going to send patches. They are found in sound-unstable git tree topic/hda-power-sync branch, too. git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-unstable.git Takashi