[alsa-devel] [PATCH v3 2/2] [ALSA] hda - suspend the controller only if all codecs support stop-clk in D3

Lin, Mengdong mengdong.lin at intel.com
Thu Aug 23 08:25:49 CEST 2012

> -----Original Message-----
> From: alsa-devel-bounces at alsa-project.org
> [mailto:alsa-devel-bounces at alsa-project.org] On Behalf Of Takashi Iwai
> Thinking on it again, maybe a cleaner option would be something like:
> static void azx_power_notify(struct hda_bus *bus) {
> 	struct azx *chip = bus->private_data;
> 	if (bus->power_keep_link_on || !codec->d3_stop_clk_ok)
> 		return;
> 	if (codec->power_on)
> 		pm_runtime_get_sync(&chip->pci->dev);
> 	else
>  		pm_runtime_put_sync(&chip->pci->dev);
> }
> Then in call azx_init_chip() and azx_stop_chip() in the runtime PM.
> (In the power-down case, it should check power_save_controller there.
>  Eventually we can deprecate this option later.)

This would be much cleaner and can avoid race among multiple codecs. I'll update code as you suggested and merge the two patches into one.
And I support deprecate power_save_controller, because it seems a duplicate of runtime PM on/off control.

> The azx_init_chip() and azx_stop_chip() calls were needed in
> azx_power_notify() because the PM resume didn't kick off the initialization
> immediately in the earlier version, but left uninitialized until the power-ON
> via power-save is triggered.
> This was changed because of some ugly bugs (e.g. inconsistent mute LED).
> Now the hardware is always initialized after PM resume.
> Thus, for powersave case, chip init/stop can be simply put in the runtime PM
> side, as far as I see.

Thanks for sharing the code history.

More information about the Alsa-devel mailing list