]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
ASoC: rt5682: do not block workqueue if card is unbound
authorKai Vehmanen <kai.vehmanen@linux.intel.com>
Mon, 7 Feb 2022 15:30:00 +0000 (17:30 +0200)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 13:17:21 +0000 (15:17 +0200)
commit728b7dadbc90597443a280d17f066d2ce3e37069
tree8261b7e85acb61dc81e34ff31c2f000d1283bb39
parentffb2d48a2d9aa965cdc078810eba35c9f5d624d7
ASoC: rt5682: do not block workqueue if card is unbound

BugLink: https://bugs.launchpad.net/bugs/1969239
[ Upstream commit 4c33de0673ced9c7c37b3bbd9bfe0fda72340b2a ]

The current rt5682_jack_detect_handler() assumes the component
and card will always show up and implements an infinite usleep
loop waiting for them to show up.

This does not hold true if a codec interrupt (or other
event) occurs when the card is unbound. The codec driver's
remove  or shutdown functions cannot cancel the workqueue due
to the wait loop. As a result, code can either end up blocking
the workqueue, or hit a kernel oops when the card is freed.

Fix the issue by rescheduling the jack detect handler in
case the card is not ready. In case card never shows up,
the shutdown/remove/suspend calls can now cancel the detect
task.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20220207153000.3452802-3-kai.vehmanen@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
sound/soc/codecs/rt5682.c