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

Takashi Iwai tiwai at suse.de
Wed Aug 22 17:19:11 CEST 2012


At Wed, 22 Aug 2012 14:58:19 +0000,
Lin, Mengdong wrote:
> 
> > -----Original Message-----
> > From: Takashi Iwai [mailto:tiwai at suse.de]
> > Sent: Wednesday, August 22, 2012 8:17 PM
> > 
> > You shouldn't move pm_runtime_get_noresume() / _put_no_idle() to
> > hda_codec.c, but these should be called only in hda_intel.c.
> > Basically there is no PCI-specific code in hda_codec.c and patch_*.c.
> > All PCI controller code should be in hda_intel.c.
> 
> Okay. I'll move pm_runtime_get_noresume() / _put_no_idle() back to azx_probe_continue() and azx_remove().
> 
> > (snip)
> > >  	else if (chip->running && power_save_controller &&
> > > -		 !bus->power_keep_link_on) {
> > > +		 !bus->power_keep_link_on)
> > >  		azx_stop_chip(chip);
> > >
> > > -		/* TODO: Suspend controller only if all codec support
> > > -		stop-clock in D3, for wakeup consideration */
> > > +	if (!bus->power_keep_link_on
> > > +		&& !codec->power_on && codec->d3_stop_clk_ok)
> > >  		pm_runtime_put_sync(&chip->pci->dev);
> > 
> > Also it should check power_save_controller, too.
> 
> I'll add check on power_save_controller.

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.)

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,

Takashi


More information about the Alsa-devel mailing list