All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: tiwai@suse.com, perex@perex.cz, hui.wang@canonical.com,
	kai.vehmanen@linux.intel.com, alsa-devel@alsa-project.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 3/4] ALSA: hda: Separate runtime and system suspend
Date: Tue, 27 Oct 2020 08:46:05 +0100	[thread overview]
Message-ID: <s5hlffs2jsy.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201027054001.1800-4-kai.heng.feng@canonical.com>

On Tue, 27 Oct 2020 06:40:00 +0100,
Kai-Heng Feng wrote:
> @@ -1002,7 +1001,8 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt)
>  	azx_init_pci(chip);
>  	hda_intel_init_chip(chip, true);
>  
> -	if (from_rt) {
> +	/* Avoid codec resume if runtime resume is for system suspend */
> +	if (from_rt && !chip->prepared) {

The check of chip->prepared is superfluous here.  Its check should be
applied rather at setting WAKEEN, namely...

> @@ -1103,10 +1115,8 @@ static int azx_runtime_suspend(struct device *dev)
>  	chip = card->private_data;
>  
>  	/* enable controller wake up event */
> -	if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) {
> -		azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
> -			   STATESTS_INT_MASK);
> -	}
> +	azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
> +		   STATESTS_INT_MASK);

... here we should have the check of chip->prepared, and set WAKEEN
only when it's false.  Otherwise WAKEEN is set up for the system
suspend, and it might lead to spurious wakeups.  (IOW, checking the
flag at resume doesn't help for preventing the spurious wakeup :)


thanks,

Takashi

WARNING: multiple messages have this Message-ID (diff)
From: Takashi Iwai <tiwai@suse.de>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: alsa-devel@alsa-project.org, kai.vehmanen@linux.intel.com,
	linux-kernel@vger.kernel.org, tiwai@suse.com,
	hui.wang@canonical.com
Subject: Re: [PATCH v2 3/4] ALSA: hda: Separate runtime and system suspend
Date: Tue, 27 Oct 2020 08:46:05 +0100	[thread overview]
Message-ID: <s5hlffs2jsy.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201027054001.1800-4-kai.heng.feng@canonical.com>

On Tue, 27 Oct 2020 06:40:00 +0100,
Kai-Heng Feng wrote:
> @@ -1002,7 +1001,8 @@ static void __azx_runtime_resume(struct azx *chip, bool from_rt)
>  	azx_init_pci(chip);
>  	hda_intel_init_chip(chip, true);
>  
> -	if (from_rt) {
> +	/* Avoid codec resume if runtime resume is for system suspend */
> +	if (from_rt && !chip->prepared) {

The check of chip->prepared is superfluous here.  Its check should be
applied rather at setting WAKEEN, namely...

> @@ -1103,10 +1115,8 @@ static int azx_runtime_suspend(struct device *dev)
>  	chip = card->private_data;
>  
>  	/* enable controller wake up event */
> -	if (snd_power_get_state(card) == SNDRV_CTL_POWER_D0) {
> -		azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
> -			   STATESTS_INT_MASK);
> -	}
> +	azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) |
> +		   STATESTS_INT_MASK);

... here we should have the check of chip->prepared, and set WAKEEN
only when it's false.  Otherwise WAKEEN is set up for the system
suspend, and it might lead to spurious wakeups.  (IOW, checking the
flag at resume doesn't help for preventing the spurious wakeup :)


thanks,

Takashi

  reply	other threads:[~2020-10-27  7:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-27  5:39 [PATCH v2 0/4] HDA controller and PM cleanups Kai-Heng Feng
2020-10-27  5:39 ` Kai-Heng Feng
2020-10-27  5:39 ` [PATCH v2 1/4] ALSA: hda: Refactor codec PM to use direct-complete optimization Kai-Heng Feng
2020-10-27  5:39   ` Kai-Heng Feng
2020-10-27  5:39 ` [PATCH v2 2/4] ALSA: hda: Stop mangling PCI IRQ Kai-Heng Feng
2020-10-27  5:39   ` Kai-Heng Feng
2020-10-27  7:36   ` Takashi Iwai
2020-10-27  7:36     ` Takashi Iwai
2020-10-27  7:42     ` Kai-Heng Feng
2020-10-27  7:42       ` Kai-Heng Feng
2020-10-27  5:40 ` [PATCH v2 3/4] ALSA: hda: Separate runtime and system suspend Kai-Heng Feng
2020-10-27  5:40   ` Kai-Heng Feng
2020-10-27  7:46   ` Takashi Iwai [this message]
2020-10-27  7:46     ` Takashi Iwai
2020-10-27  8:12     ` Takashi Iwai
2020-10-27  8:12       ` Takashi Iwai
2020-10-27  8:15       ` Takashi Iwai
2020-10-27  8:15         ` Takashi Iwai
2020-10-27  8:24         ` Kai-Heng Feng
2020-10-27  8:24           ` Kai-Heng Feng
2020-10-27 11:38   ` Kai Vehmanen
2020-10-27 11:38     ` Kai Vehmanen
2020-10-27 12:04     ` Kai-Heng Feng
2020-10-27 12:04       ` Kai-Heng Feng
2020-10-27  5:40 ` [PATCH v2 4/4] ALSA: hda: Reinstate runtime_allow() for all hda controllers Kai-Heng Feng
2020-10-27  5:40   ` Kai-Heng Feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hlffs2jsy.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=hui.wang@canonical.com \
    --cc=kai.heng.feng@canonical.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.