[alsa-devel] [RFC PATCH] ALSA: hda - add support for runtime power management
Takashi Iwai
tiwai at suse.de
Fri Aug 17 11:52:31 CEST 2012
At Fri, 17 Aug 2012 17:30:14 +0800,
mengdong.lin at intel.com wrote:
>
> From: Mengdong Lin <mengdong.lin at intel.com>
>
> This patch is a basic idea about adding runtime PM support to HD audio.
>
> Support for runtime PM is based on current HDA power saving implementation.
> When both power saving and runtime PM are enabled, and if all codecs are
> suspended (in D3), the HDA controller can also be suspended to a low power
> state by decreasing the power usage counter and triggering PCI device
> runtime suspend. And the user IO operation can resume the controller back
> to D0.
>
> The user can enable runtime PM on HDA controller on platfroms that can
> provide acceptable latency on transition from D3 to D0. If the runtime PM
> is disabled, power saving just works as without runtime PM before. And
> if power saving is disabled, the power usage counter will never be 0 so
> the HDA controller will not be suspended.
>
> I've verified this patch on a platfrom on which the HD-A controller can enter
> D3hot when suspended. And I plan to allow the controller to suspened only
> if all codecs support "stop-clock" in D3, for wakeup request.
>
> Is this idea doable? Any comments are welcome.
I thought we stopped the controller at power save, but this was
removed by some reason at some time ago. Basically the patch below
should do almost equivalently. It doesn't free/reacquire irq, which
I'm not quite sure whether mandatory for power-saving.
Takashi
---
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 933c2a1..d3c01b1 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2402,11 +2402,14 @@ static void azx_power_notify(struct hda_bus *bus)
break;
}
}
- if (power_on)
+ if (power_on) {
+ pci_set_power_state(chip->pci, PCI_D0);
azx_init_chip(chip, 1);
- else if (chip->running && power_save_controller &&
- !bus->power_keep_link_on)
+ } else if (chip->running && power_save_controller &&
+ !bus->power_keep_link_on) {
azx_stop_chip(chip);
+ pci_set_power_state(chip->pci, PCI_D3hot);
+ }
}
#endif /* CONFIG_SND_HDA_POWER_SAVE */
More information about the Alsa-devel
mailing list