ASoC: wm8994: Simplify button detection code

Currently the WM8994 driver allows the WM8958 microphone detection code to
be replaced in its entirety, providing a default implementation. This
doesn't actually reflect the needs of users well. They generally wish to
replace only the accessory identification parts of the algorithm (eg,
using an external GPIO to provide the equivalent of the JACKDET support in
the WM1811A).

In preparation for supporting these users better refactor the existing code
so that we have separate identification and button detection callbacks,
selecting between them rather than using the mic_detecting flag in the
existing callback. This also simplifies the code by introducing a more
explicit state machine for the detecting and button states.

In anticipation of future refactoring the callback is left in the signature
for wm8958_mic_detect(), it will be removed at a later stage.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2 files changed