[alsa-devel] power state in power save mode

Takashi Iwai tiwai at suse.de
Wed Apr 10 17:52:19 CEST 2019


On Wed, 10 Apr 2019 05:00:31 +0200,
Kailang wrote:
> 
> > -----Original Message-----
> > From: Takashi Iwai <tiwai at suse.de>
> > Sent: Tuesday, April 9, 2019 6:15 PM
> > To: Kailang <kailang at realtek.com>
> > Cc: (alsa-devel at alsa-project.org) <alsa-devel at alsa-project.org>
> > Subject: Re: power state in power save mode
> > 
> > On Tue, 09 Apr 2019 11:54:27 +0200,
> > Kailang wrote:
> > >
> > > Hi Takashi,
> > >
> > > https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit
> > > /?h=for-next&id=98081ca62cbac31fb0f7efaf90b2e7384ce22257
> > >
> > > Use upper patch to print power state in function alc256_init() and
> > alc256_shutup().
> > > But when kernel turn on power_save = 1. (echo 1 >
> > > /sys/module/snd_hda_intel/parameters/power_save)
> > >
> > > The print power state value always be 0x0.
> > 
> > That's expected, it means PM_EVENT_ON.
> > The power_state value is changed only during the suspend and resume.
> > Once after returning from resume, it's set to PM_EVENT_ON.
> 
> I also test suspend and resume. It also show 0x0.
> If it turn off power save, power state value will normally.

What exactly did you see?  I checked the value by simply printk and it
behaved as expected, both with and without power save.

> > 
> > > ( If it turn off power save, power state value will normally)
> > 
> > What does it mean exactly...?
> > 
> > Actually one missing piece is to set PMSG_ON at the device initialization.  A
> > patch like below.
> 
> Add this patch, the power state value will show on suspend and resume. Right?
> I will test it later.

This won't change anything about the suspend/resume behavior, but it's
just for some consistency in case the driver refers to the state
before entering the suspend/resume callback.


Takashi


> > 
> > 
> > thanks,
> > 
> > Takashi
> > 
> > --- a/sound/pci/hda/hda_codec.c
> > +++ b/sound/pci/hda/hda_codec.c
> > @@ -969,6 +969,7 @@ int snd_hda_codec_device_new(struct hda_bus *bus,
> > struct snd_card *card,
> > 
> >  	/* power-up all before initialization */
> >  	hda_set_power_state(codec, AC_PWRST_D0);
> > +	codec->core.dev.power.power_state = PMSG_ON;
> > 
> >  	snd_hda_codec_proc_new(codec);
> > 
> > 
> > ------Please consider the environment before printing this e-mail.
> 


More information about the Alsa-devel mailing list