OSDN Git Service

ASoC: cs42l42: Change jack_detect_mutex to a lock of all IRQ handling
authorRichard Fitzgerald <rf@opensource.cirrus.com>
Fri, 21 Jan 2022 12:04:11 +0000 (12:04 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 24 Jan 2022 13:31:34 +0000 (13:31 +0000)
commit5982b5a8ec7ddb076e774bdd0b17d74681ab0943
treead5cc3f806987c606fd66734da7f410116e10736
parent8d06f797f844d04a961f201f886f7f9985edc9bf
ASoC: cs42l42: Change jack_detect_mutex to a lock of all IRQ handling

Rename jack_detect_mutex to irq_lock and make it lock the entire IRQ
handling.

The jack_detect_mutex was introduced to synchronize registering an
ALSA jack handler, via cs42l42_set_jack(), with the jack state
processing in the IRQ handler, and was taken only around the
relevant part of the IRQ handling code.

System suspend will need to synchronize with the IRQ handler thread
so will need a similar mutex that surrounds all of the IRQ handling.
Repurposing the existing jack_detect_mutex is the simplest option.
It does no harm for a call to cs42l42_set_jack() to additionally
block the first few lines of IRQ handling, and the only interrupts
used by the driver are all for jack handling.

Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20220121120412.672284-3-rf@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs42l42.c
sound/soc/codecs/cs42l42.h