ASoC: nau8825: fix bug in playback when suspend
authorJohn Hsu <KCHSU0@nuvoton.com>
Thu, 4 Aug 2016 08:52:06 +0000 (16:52 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 4 Aug 2016 20:58:57 +0000 (21:58 +0100)
commitca6ac305f017472a172e53345264abdb495eba46
tree70d78f47b9fd6d8cd1fc717070e41b6bc1cbbd35
parente7ca8fcd15049b1e48ae2ef1434a68a51ef0ead5
ASoC: nau8825: fix bug in playback when suspend

In chromium, the following steps will make codec function fail.
\1. plug in headphones, Play music
\2. run "powerd_dbus_suspend"
\3. resume from S3
After resume, the jack detection will restart and make configuration
for the headset. Meanwhile, the playback prepares and starts to work.
The two sequences will conflict and make wrong register configuration.

Originally, the driver adds protection for the case when it finds
the playback is active. But the "powerd_dbus_suspend" command will
close the pcm stream before suspend. Therefore, the driver can't
detect the playback after resume, and the protection not works.
For the issue, the driver raises protection every time after resume.
The protection will release after jack detection and configuration
completes, and then the playback just will goes on.

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