mfd: da9052: Fix manual ADC read after timed out read
authorSebastian Reichel <sebastian.reichel@collabora.co.uk>
Fri, 30 Jun 2017 14:35:03 +0000 (16:35 +0200)
committerLee Jones <lee.jones@linaro.org>
Tue, 5 Sep 2017 07:46:00 +0000 (08:46 +0100)
It is possible that under heavy system load, the counter in the completion
struct, used for waiting for end of AD conversion, gets incremented twice.
To make sure the driver recovers from this situation, the completion struct
should be reinitialized.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
drivers/mfd/da9052-core.c

index a23a3a1..433add4 100644 (file)
@@ -387,6 +387,8 @@ int da9052_adc_manual_read(struct da9052 *da9052, unsigned char channel)
 
        mutex_lock(&da9052->auxadc_lock);
 
+       reinit_completion(&da9052->done);
+
        /* Channel gets activated on enabling the Conversion bit */
        mux_sel = chan_mux[channel] | DA9052_ADC_MAN_MAN_CONV;