ASoC: nau8824: Fix semaphore is released unexpectedly
authorSJLIN0 <SJLIN0@nuvoton.com>
Thu, 15 Sep 2022 01:28:00 +0000 (09:28 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 19 Sep 2022 17:35:23 +0000 (18:35 +0100)
commit7042bde216ada135b2f88423ae714ab9a22e3a22
treee95b169369d21c6acd0ff935d0735ff1a6ae3c73
parent4a13c949501902d4e6b59cc693005f4ca352dc15
ASoC: nau8824: Fix semaphore is released unexpectedly

On resuming, we anticipate that the jack is detected before playback
or capture. Therefore, we use semaphore to control the jack detection
done without any bothering. During booting, the driver launches jack
detection and releases the semaphore. However, it doesn't perceive the
maniputation of semaphore is not like resuming procedure. This makes
the semaphore's count value become to 2. There is more than one thread
can enter into the critical section. This may get unexpected situation
and make some chaos.

Signed-off-by: SJLIN0 <SJLIN0@nuvoton.com>
Signed-off-by: Wallace Lin <savagecin@gmail.com>
Link: https://lore.kernel.org/r/20220915012800.825196-1-SJLIN0@nuvoton.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/nau8824.c
sound/soc/codecs/nau8824.h