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