linux/sound/soc
Pierre-Louis Bossart 4157343a6a ASoC: codecs: rt700/rt711/rt711-sdca: resume bus/codec in .set_jack_detect
[ Upstream commit 40737057b4 ]

The .set_jack_detect() codec component callback is invoked during card
registration, which happens when the machine driver is probed.

The issue is that this callback can race with the bus suspend/resume,
and IO timeouts can happen. This can be reproduced very easily if the
machine driver is 'blacklisted' and manually probed after the bus
suspends. The bus and codec need to be re-initialized using pm_runtime
helpers.

Previous contributions tried to make sure accesses to the bus during
the .set_jack_detect() component callback only happen when the bus is
active. This was done by changing the regcache status on a component
remove. This is however a layering violation, the regcache status
should only be modified on device probe, suspend and resume. The
component probe/remove should not modify how the device regcache is
handled. This solution also didn't handle all the possible race
conditions, and the RT700 headset codec was not handled.

This patch tries to resume the codec device before handling the jack
initializations. In case the codec has not yet been initialized,
pm_runtime may not be enabled yet, so we don't squelch the -EACCES
error code and only stop the jack information. When the codec reports
as attached, the jack initialization will proceed as usual.

BugLink: https://github.com/thesofproject/linux/issues/3643
Fixes: 7ad4d237e7 ('ASoC: rt711-sdca: Add RT711 SDCA vendor-specific driver')
Fixes: 899b12542b ('ASoC: rt711: add snd_soc_component remove callback')
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Link: https://lore.kernel.org/r/20220606203752.144159-8-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-07-12 16:35:12 +02:00
..
adi ASoC: axi-i2s: Use devm_platform_get_and_ioremap_resource() 2021-06-14 15:01:03 +01:00
amd ASoC: amd: vg: fix for pm resume callback sequence 2022-04-08 14:24:02 +02:00
atmel ASoC: atmel-classd: Remove endianness flag on class d component 2022-06-09 10:23:10 +02:00
au1x
bcm ASoC: Updates for v5.15 2021-08-30 14:57:03 +02:00
cirrus
codecs ASoC: codecs: rt700/rt711/rt711-sdca: resume bus/codec in .set_jack_detect 2022-07-12 16:35:12 +02:00
dwc ASoC: dwc-i2s: Handle errors for clk_enable 2022-04-08 14:23:19 +02:00
fsl ASoC: fsl_sai: Fix FSL_SAI_xDR/xFR definition 2022-06-14 18:36:09 +02:00
generic ASoC: simple-card-utils: Set sysclk on all components 2022-04-08 14:23:13 +02:00
hisilicon ASoC: hisilicon: Use devm_platform_get_and_ioremap_resource() 2021-06-15 16:39:49 +01:00
img ASoC: img-spdif-out: Use devm_platform_get_and_ioremap_resource() 2021-06-15 16:39:47 +01:00
intel ASoC: Intel: bytcr_rt5640: Add quirk for the HP Pro Tablet 408 2022-06-09 10:22:34 +02:00
jz4740 ASoC: jz4740-i2s: Use devm_platform_get_and_ioremap_resource() 2021-06-15 16:39:48 +01:00
kirkwood ASoC: kirkwood: Fix reference to PCM buffer address 2021-07-30 17:20:51 +01:00
mediatek ASoC: mediatek: Fix missing of_node_put in mt2701_wm8960_machine_probe 2022-06-09 10:22:45 +02:00
meson ASoC: meson: Fix event generation for AUI CODEC mux 2022-05-12 12:30:07 +02:00
mxs ASoC: mxs-saif: Fix refcount leak in mxs_saif_probe 2022-06-09 10:22:56 +02:00
pxa ALSA: pxa2xx: Use managed PCM buffer allocation 2021-08-04 08:08:21 +02:00
qcom ASoC: qcom: Actually clear DMA interrupt register for HDMI 2022-02-23 12:03:15 +01:00
rockchip ASoC: rockchip: i2s: Fix missing clk_disable_unprepare() in rockchip_i2s_probe 2022-04-08 14:23:21 +02:00
samsung ASoC: samsung: Fix refcount leak in aries_audio_probe 2022-06-09 10:22:57 +02:00
sh ASoC: sh: rz-ssi: Release the DMA channels in rz_ssi_probe() error path 2022-06-09 10:23:08 +02:00
sof ASoC: SOF: Fix NULL pointer exception in sof_pci_probe callback 2022-05-18 10:26:52 +02:00
spear ASoC: spear: spdif_out: Use devm_platform_get_and_ioremap_resource() 2021-06-17 13:47:06 +01:00
sprd ASoC: sprd: Use managed buffer allocation 2021-08-04 08:10:27 +02:00
sti ASoC: sti: Fix deadlock via snd_pcm_stop_xrun() call 2022-03-28 09:58:43 +02:00
stm ASoC: stm32: i2s: fix 32 bits channel length without mclk 2021-12-01 09:04:47 +01:00
sunxi ASoC: sunxi: sun4i-spdif: Use devm_platform_get_and_ioremap_resource() 2021-06-21 13:04:18 +01:00
tegra ASoC: tegra: Restore headphones jack name on Nyan Big 2021-12-29 12:28:52 +01:00
ti ASoC: ti: j721e-evm: Fix refcount leak in j721e_soc_probe_* 2022-06-09 10:22:59 +02:00
uniphier ASoC: uniphier: drop selecting non-existing SND_SOC_UNIPHIER_AIO_DMA 2022-01-27 11:04:06 +01:00
ux500 ASoC: ux500: mop500: align function prototype 2021-03-31 18:03:28 +01:00
xilinx ASoC: xilinx: xlnx_formatter_pcm: Handle sysclk setting 2022-04-08 14:23:13 +02:00
xtensa
Kconfig ASoC: topology: Select SND_DYNAMIC_MINORS 2021-07-27 13:13:04 +01:00
Makefile ASoC: topology: adhere to KUNIT formatting standard 2021-04-14 15:26:24 +01:00
soc-ac97.c ASoC: soc-ac97: cleanup cppcheck warning 2021-08-16 13:29:36 +01:00
soc-acpi.c ASoC: soc-acpi: remove useless initialization 2021-04-19 14:03:29 +01:00
soc-card.c
soc-component.c ASoC: soc-component: cleanup cppcheck warning at snd_soc_pcm_component_pm_runtime_get() 2021-08-16 13:29:35 +01:00
soc-compress.c ASoC: soc-compress: Change the check for codec_dai 2022-04-08 14:24:13 +02:00
soc-core.c ASoC: soc-core: skip zero num_dai component in searching dai name 2022-04-08 14:24:01 +02:00
soc-dai.c ASoC: soc-dai: cleanup cppcheck warning at snd_soc_pcm_dai_new() 2021-08-16 13:29:32 +01:00
soc-dapm.c ASoC: dapm: Don't fold register value changes into notifications 2022-06-09 10:22:35 +02:00
soc-devres.c
soc-generic-dmaengine-pcm.c ASoC: dmaengine: Restore NULL prepare_slave_config() callback 2022-05-12 12:30:11 +02:00
soc-jack.c ASoC: soc-jack: cleanup cppcheck warning for CONFIG_GPIOLIB 2021-08-16 13:29:34 +01:00
soc-link.c
soc-ops.c ASoC: ops: Validate input values in snd_soc_put_volsw_range() 2022-05-18 10:26:52 +02:00
soc-pcm.c ASoC: Revert PCM trigger changes 2021-08-30 12:15:15 +01:00
soc-topology-test.c
soc-topology.c ASoC: topology: Correct error handling in soc_tplg_dapm_widget_create() 2022-04-27 14:38:51 +02:00
soc-utils.c ASoC: soc-core: add snd_soc_runtime_get_dai_fmt() 2021-06-07 15:55:12 +01:00