ASoC: tas5805m: rework to avoid scheduling while atomic.
authorDaniel Beer <daniel.beer@igorinstitute.com>
Thu, 27 Oct 2022 08:28:31 +0000 (21:28 +1300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Feb 2023 18:11:49 +0000 (19:11 +0100)
commit3e984873e4ac2bcec2749a3d92506ba2a3f0ac95
tree6109393c7e30470acae15b10913bdb9043a956fb
parent0f3d5c12b612b0220f8d90982207bf1996e0f493
ASoC: tas5805m: rework to avoid scheduling while atomic.

[ Upstream commit 147323792693bf013f60dca160be1d32bd4d180a ]

There's some setup we need to do in order to get the DSP initialized,
and this can't be done until a bit-clock is ready. In an earlier version
of this driver, this work was done in a DAPM callback.

The DAPM callback doesn't guarantee that the bit-clock is running, so
the work was moved instead to the trigger callback. Unfortunately this
callback runs in atomic context, and the setup code needs to do I2C
transactions.

Here we use a work_struct to kick off the setup in a thread instead.

Fixes: ec45268467f4 ("ASoC: add support for TAS5805M digital amplifier")
Signed-off-by: Daniel Beer <daniel.beer@igorinstitute.com>
Link: https://lore.kernel.org/r/85d8ba405cb009a7a3249b556dc8f3bdb1754fdf.1675497326.git.daniel.beer@igorinstitute.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
sound/soc/codecs/tas5805m.c