linux-stable/sound/soc
Kai-Heng Feng 9e9ae646eb ASoC: SOF: Intel: hda: Avoid checking jack on system suspend
commit ef4d764c99 upstream.

System takes a very long time to suspend after commit 215a22ed31
("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 the codec suspended during the system suspend. However,
mute/micmute LED will clear codec's direct-complete flag by
dpm_clear_superiors_direct_complete().

This doesn't play well with SOF driver. When its runtime resume is
called for system suspend, hda_codec_jack_check() schedules
jackpoll_work which uses snd_hdac_is_power_on() to check whether codec
is suspended. Because the direct-complete path isn't taken,
pm_runtime_disable() isn't called so snd_hdac_is_power_on() returns
false and jackpoll continues to run, and snd_hda_power_up_pm() cannot
power up an already suspended codec in multiple attempts, causes the
long delay on system suspend:

if (dev->power.direct_complete) {
	if (pm_runtime_status_suspended(dev)) {
		pm_runtime_disable(dev);
		if (pm_runtime_status_suspended(dev)) {
			pm_dev_dbg(dev, state, "direct-complete ");
			goto Complete;
		}

		pm_runtime_enable(dev);
	}
	dev->power.direct_complete = false;
}

When direct-complete path is taken, snd_hdac_is_power_on() returns true
and hda_jackpoll_work() is skipped by accident. So this is still not
correct.

If we were to use snd_hdac_is_power_on() in system PM path,
pm_runtime_status_suspended() should be used instead of
pm_runtime_suspended(), otherwise pm_runtime_{enable,disable}() may
change the outcome of snd_hdac_is_power_on().

Because devices suspend in reverse order (i.e. child first), it doesn't
make much sense to resume an already suspended codec from audio
controller. So avoid the issue by making sure jackpoll isn't used in
system PM process.

Fixes: 215a22ed31 ("ALSA: hda: Refactor codec PM to use direct-complete optimization")
Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20210112181128.1229827-3-kai.heng.feng@canonical.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-01-27 11:55:28 +01:00
..
adi
amd ASoC: AMD Renoir - add DMI entry for Lenovo ThinkPad X395 2021-01-19 18:27:17 +01:00
atmel ASoC: atmel: mchp-spdifrx needs COMMON_CLK 2020-12-30 11:53:36 +01:00
au1x ASoC: au1x: use asoc_substream_to_rtd() 2020-07-23 19:07:36 +01:00
bcm ASoC: bcm2835: Silence clk_get() error on -EPROBE_DEFER 2020-07-28 17:04:07 +01:00
cirrus ASoC: cirrus: use asoc_substream_to_rtd() 2020-07-23 19:07:28 +01:00
codecs ASoC: rt711: mutex between calibration and power state changes 2021-01-27 11:54:56 +01:00
dwc ASoC: dwc: use asoc_substream_to_rtd() 2020-07-23 19:07:34 +01:00
fsl Merge remote-tracking branch 'asoc/for-5.10' into asoc-next 2020-10-09 15:42:31 +01:00
generic ASoC: simple-card: Use snd_soc_of_parse_aux_devs() 2020-08-18 14:52:39 +01:00
hisilicon treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
img ASoC: img-parallel-out: Fix a reference count leak 2020-06-15 20:58:35 +01:00
intel ASoC: Intel: haswell: Add missing pm_ops 2021-01-27 11:54:56 +01:00
jz4740 ASoC: jz4740-i2s: add missed checks for clk_get() 2020-12-30 11:53:35 +01:00
kirkwood ASoC: kirkwood: use asoc_substream_to_rtd() 2020-07-23 19:07:41 +01:00
mediatek Linux 5.10-rc1 2020-10-28 21:36:35 +00:00
meson ASoC: meson: axg-tdmin: fix axg skew offset 2021-01-19 18:27:29 +01:00
mxs ASoC: mxs: use asoc_substream_to_rtd() 2020-07-23 19:07:43 +01:00
pxa treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
qcom ASoC: qcom: fix QDSP6 dependencies, attempt #3 2020-12-30 11:53:36 +01:00
rockchip Linux 5.9-rc5 2020-10-06 16:19:24 +01:00
samsung Linux 5.9-rc5 2020-10-06 16:19:24 +01:00
sh ASoC: sh: Replace tasklet with work 2020-09-09 15:42:09 +01:00
sirf
sof ASoC: SOF: Intel: hda: Avoid checking jack on system suspend 2021-01-27 11:55:28 +01:00
spear ASoC: spear: merge .digital_mute() into .mute_stream() 2020-07-16 23:06:08 +01:00
sprd ASoC: various vendors: delete repeated words in comments 2020-08-18 14:52:32 +01:00
sti ASoC: sti: uniperif: fix 'defined by not used' warning 2020-07-10 15:13:44 +01:00
stm ASoC: stm32: dfsdm: change rate limits 2020-10-08 20:44:40 +01:00
sunxi ASoC: sun4i-i2s: Fix lrck_period computation for I2S justified mode 2020-12-30 11:53:00 +01:00
tegra ASoC: tegra: trimslice.c: use devm_snd_soc_register_card() 2020-10-01 20:28:17 +01:00
ti ASoC: ti: davinci-mcasp: Use &pdev->dev for early dev_warn 2020-10-08 21:16:52 +01:00
txx9 ASoC: txx9: Replace tasklet with work 2020-09-09 15:42:10 +01:00
uniphier ASoC: uniphier: use asoc_substream_to_rtd() 2020-07-23 19:07:43 +01:00
ux500 ASoC: ux500: use asoc_substream_to_rtd() 2020-07-23 19:07:20 +01:00
xilinx sound: remove duplicate "the the" phrase in Kconfig text 2020-08-18 14:52:43 +01:00
xtensa ASoC: xtensa: use asoc_substream_to_rtd() 2020-07-23 19:07:42 +01:00
zte treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
Kconfig treewide: replace '---help---' in Kconfig files with 'help' 2020-06-14 01:57:21 +09:00
Makefile ASoC: soc-component: merge soc-io.c into soc-component.c 2020-06-15 18:21:26 +01:00
soc-ac97.c ASoC: soc-ac97: fix kernel-doc 2020-07-03 17:33:46 +01:00
soc-acpi.c
soc-card.c
soc-component.c ASoC: soc-component: add mark for snd_soc_pcm_component_pm_runtime_get/put() 2020-09-28 17:01:44 +01:00
soc-compress.c ASoC: soc-component: add mark for snd_soc_pcm_component_pm_runtime_get/put() 2020-09-28 17:01:44 +01:00
soc-core.c ALSA: fix kernel-doc markups 2020-10-26 15:26:31 +01:00
soc-dai.c ASoC: soc-dai: add mark for snd_soc_dai_startup/shutdown() 2020-09-28 17:01:42 +01:00
soc-dapm.c ASoC: dapm: remove widget from dirty list on free 2021-01-19 18:27:17 +01:00
soc-devres.c ASoC: core: Remove only the registered component in devm functions 2020-07-07 11:55:46 +01:00
soc-generic-dmaengine-pcm.c ASoC: dmaengine: Document support for TX only or RX only streams 2020-10-09 15:11:20 +01:00
soc-jack.c
soc-link.c ASoC: soc-link: add mark for snd_soc_link_startup/shutdown() 2020-09-28 17:01:43 +01:00
soc-ops.c ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32() 2020-06-22 15:13:36 +01:00
soc-pcm.c ASoC: pcm: DRAIN support reactivation 2020-12-30 11:53:02 +01:00
soc-topology.c Merge remote-tracking branch 'asoc/for-5.9' into asoc-linus 2020-10-09 15:42:29 +01:00
soc-utils.c ASoC: soc-xxx: add asoc_substream_to_rtd() 2020-07-23 19:07:19 +01:00