mirror of
https://github.com/torvalds/linux.git
synced 2026-06-07 22:14:04 +02:00
ALSA: hda: update the power_state during the direct-complete
commitb8b90c1760upstream. The patch_realtek.c needs to check if the power_state.event equals PM_EVENT_SUSPEND, after using the direct-complete, the suspend() and resume() will be skipped if the codec is already rt_suspended, in this case, the patch_realtek.c will always get PM_EVENT_ON even the system is really resumed from S3. We could set power_state to PMSG_SUSPEND in the prepare(), if other PM functions are called before complete(), those functions will override power_state; if no other PM functions are called before complete(), we could know the suspend() and resume() are skipped since only S3 pm functions could be skipped by direct-complete, in this case set power_state to PMSG_RESUME in the complete(). This could guarantee the first time of calling hda_codec_runtime_resume() after complete() has the correct power_state. Fixes:215a22ed31("ALSA: hda: Refactor codec PM to use direct-complete optimization") Cc: <stable@vger.kernel.org> Signed-off-by: Hui Wang <hui.wang@canonical.com> Link: https://lore.kernel.org/r/20210602145424.3132-1-hui.wang@canonical.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
cfbb57fcb1
commit
846848c052
|
|
@ -2973,6 +2973,7 @@ static int hda_codec_runtime_resume(struct device *dev)
|
||||||
#ifdef CONFIG_PM_SLEEP
|
#ifdef CONFIG_PM_SLEEP
|
||||||
static int hda_codec_pm_prepare(struct device *dev)
|
static int hda_codec_pm_prepare(struct device *dev)
|
||||||
{
|
{
|
||||||
|
dev->power.power_state = PMSG_SUSPEND;
|
||||||
return pm_runtime_suspended(dev);
|
return pm_runtime_suspended(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2980,6 +2981,10 @@ static void hda_codec_pm_complete(struct device *dev)
|
||||||
{
|
{
|
||||||
struct hda_codec *codec = dev_to_hda_codec(dev);
|
struct hda_codec *codec = dev_to_hda_codec(dev);
|
||||||
|
|
||||||
|
/* If no other pm-functions are called between prepare() and complete() */
|
||||||
|
if (dev->power.power_state.event == PM_EVENT_SUSPEND)
|
||||||
|
dev->power.power_state = PMSG_RESUME;
|
||||||
|
|
||||||
if (pm_runtime_suspended(dev) && (codec->jackpoll_interval ||
|
if (pm_runtime_suspended(dev) && (codec->jackpoll_interval ||
|
||||||
hda_codec_need_resume(codec) || codec->forced_resume))
|
hda_codec_need_resume(codec) || codec->forced_resume))
|
||||||
pm_request_resume(dev);
|
pm_request_resume(dev);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user