ASoC: nau8825: improve crosstalk measurement protection
authorJohn Hsu <KCHSU0@nuvoton.com>
Fri, 1 Dec 2017 02:01:37 +0000 (10:01 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 4 Dec 2017 18:14:49 +0000 (18:14 +0000)
commitfa25b4f59f1de9536104b632ec4c4c0b8f8e54ec
tree7eb80dc2d6d0c482c81110e548f7916189eaa09a
parent70424d8e6e15abd32e189130be220d0063e082bc
ASoC: nau8825: improve crosstalk measurement protection

The sequence of crosstalk measurement is not robust. The driver
add more protections to make it stronger. The improvements as follows:
(1)Give backup table the default value. The values are the same
with the default of hardware registers. The impact will decline
once restoring the backup table in the wrong way.
(2)Add xtalk_baktab_initialized flag. The flag can keep the
initiation status of backup table. It helps to backup and restore
the backup-table correctly.
(3)Add cancel parameter in the restore function. The volume ramping
should do in crosstalk DONE state only. Otherwise, the delay action
is not allowed because the restore may happen during the jack
eject interruption.
(4)Add xtalk_protect condition check before scheduling work in ISR.
It makes sure the semaphore hold during the crosstalk measurement.
The sequence is still under protection from playback interference.

Signed-off-by: John Hsu <KCHSU0@nuvoton.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/nau8825.c
sound/soc/codecs/nau8825.h