From: Takashi Iwai <tiwai@suse.de>
To: Kai-Heng Feng <kai.heng.feng@canonical.com>
Cc: tiwai@suse.com, "Jaroslav Kysela" <perex@perex.cz>,
"Pierre-Louis Bossart" <pierre-louis.bossart@linux.intel.com>,
"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
"Mark Brown" <broonie@kernel.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Michał Mirosław" <mirq-linux@rere.qmqm.pl>,
alsa-devel@alsa-project.org (moderated list:SOUND),
linux-kernel@vger.kernel.org (open list)
Subject: Re: [PATCH] ALSA: hda: Resume codec for system suspend if LED is controlled by codec
Date: Sat, 26 Dec 2020 08:46:41 +0100 [thread overview]
Message-ID: <s5hft3tf1r2.wl-tiwai@suse.de> (raw)
In-Reply-To: <20201225164727.103280-1-kai.heng.feng@canonical.com>
On Fri, 25 Dec 2020 17:47:23 +0100,
Kai-Heng Feng wrote:
>
> Laptop with codec controlled LEDs takes a very long time to suspend
> after commit 215a22ed31a1 ("ALSA: hda: Refactor codec PM to use
> direct-complete optimization"):
> [ 90.065964] PM: suspend entry (s2idle)
> [ 90.067337] Filesystems sync: 0.001 seconds
> [ 90.185758] Freezing user space processes ... (elapsed 0.002 seconds) done.
> [ 90.188713] OOM killer disabled.
> [ 90.188714] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
> [ 90.190024] printk: Suspending console(s) (use no_console_suspend to debug)
> [ 90.904912] intel_pch_thermal 0000:00:12.0: CPU-PCH is cool [49C], continue to suspend
> [ 321.262505] snd_hda_codec_realtek ehdaudio0D0: Unable to sync register 0x2b8000. -5
> [ 328.426919] snd_hda_codec_realtek ehdaudio0D0: Unable to sync register 0x2b8000. -5
> [ 329.490933] ACPI: EC: interrupt blocked
>
> That commit keeps codec suspended during the system suspend. This
> doesn't play well with codec controlled mute and micmute LEDs, because
> LED core will use codec registers to turn off those LEDs.
>
> Currently, all users of create_mute_led_cdev() use codec to control
> LED, so unconditionally runtime resume those codecs before system
> suspend to solve the problem.
>
> Fixes: 215a22ed31a1 ("ALSA: hda: Refactor codec PM to use direct-complete optimization")
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
A puzzling point is that it's applied only to the cases with the led
cdev. Or does it basically apply for the ASoC controller?
That is, if you run with legacy HDA (snd-intel-dspcfg.dsp_driver=1),
does the issue appear as well on those machines?
thanks,
Takashi
> ---
> include/sound/hda_codec.h | 1 +
> sound/pci/hda/hda_codec.c | 7 +++++++
> sound/pci/hda/hda_generic.c | 1 +
> 3 files changed, 9 insertions(+)
>
> diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h
> index 2e8d51937acd..b01d76abe008 100644
> --- a/include/sound/hda_codec.h
> +++ b/include/sound/hda_codec.h
> @@ -255,6 +255,7 @@ struct hda_codec {
> unsigned int relaxed_resume:1; /* don't resume forcibly for jack */
> unsigned int forced_resume:1; /* forced resume for jack */
> unsigned int mst_no_extra_pcms:1; /* no backup PCMs for DP-MST */
> + unsigned int resume_for_sleep:1; /* runtime resume for system sleep */
>
> #ifdef CONFIG_PM
> unsigned long power_on_acct;
> diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
> index 687216e74526..b890d9b4339e 100644
> --- a/sound/pci/hda/hda_codec.c
> +++ b/sound/pci/hda/hda_codec.c
> @@ -2983,6 +2983,13 @@ static int hda_codec_runtime_resume(struct device *dev)
> #ifdef CONFIG_PM_SLEEP
> static int hda_codec_pm_prepare(struct device *dev)
> {
> + struct hda_codec *codec = dev_to_hda_codec(dev);
> +
> + if (codec->resume_for_sleep) {
> + pm_runtime_resume(dev);
> + return 0;
> + }
> +
> return pm_runtime_suspended(dev);
> }
>
> diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
> index 8060cc86dfea..6d259d5bb5bb 100644
> --- a/sound/pci/hda/hda_generic.c
> +++ b/sound/pci/hda/hda_generic.c
> @@ -3913,6 +3913,7 @@ static int create_mute_led_cdev(struct hda_codec *codec,
> cdev->brightness_set_blocking = callback;
> cdev->brightness = ledtrig_audio_get(micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE);
> cdev->flags = LED_CORE_SUSPENDRESUME;
> + codec->resume_for_sleep = 1;
>
> return devm_led_classdev_register(&codec->core.dev, cdev);
> }
> --
> 2.29.2
>
next prev parent reply other threads:[~2020-12-26 7:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-25 16:47 Kai-Heng Feng
2020-12-26 7:46 ` Takashi Iwai [this message]
2020-12-28 17:13 ` 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=s5hft3tf1r2.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=kai.heng.feng@canonical.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mirq-linux@rere.qmqm.pl \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=rdunlap@infradead.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®