Commit 6272c0de authored by Matt Ranostay's avatar Matt Ranostay Committed by Jonathan Cameron

iio: proximity: as3935: recalibrate RCO after resume

According to the datasheet the RCO must be recalibrated
on every power-on-reset. Also remove mutex locking in the
calibration function since callers other than the probe
function (which doesn't need it) will have a lock.

Fixes: 24ddb0e4 ("iio: Add AS3935 lightning sensor support")
Cc: George McCollister <george.mccollister@gmail.com>
Signed-off-by: default avatarMatt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent e44adf05
...@@ -269,8 +269,6 @@ static irqreturn_t as3935_interrupt_handler(int irq, void *private) ...@@ -269,8 +269,6 @@ static irqreturn_t as3935_interrupt_handler(int irq, void *private)
static void calibrate_as3935(struct as3935_state *st) static void calibrate_as3935(struct as3935_state *st)
{ {
mutex_lock(&st->lock);
/* mask disturber interrupt bit */ /* mask disturber interrupt bit */
as3935_write(st, AS3935_INT, BIT(5)); as3935_write(st, AS3935_INT, BIT(5));
...@@ -280,8 +278,6 @@ static void calibrate_as3935(struct as3935_state *st) ...@@ -280,8 +278,6 @@ static void calibrate_as3935(struct as3935_state *st)
mdelay(2); mdelay(2);
as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV)); as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV));
mutex_unlock(&st->lock);
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
...@@ -318,6 +314,8 @@ static int as3935_resume(struct device *dev) ...@@ -318,6 +314,8 @@ static int as3935_resume(struct device *dev)
val &= ~AS3935_AFE_PWR_BIT; val &= ~AS3935_AFE_PWR_BIT;
ret = as3935_write(st, AS3935_AFE_GAIN, val); ret = as3935_write(st, AS3935_AFE_GAIN, val);
calibrate_as3935(st);
err_resume: err_resume:
mutex_unlock(&st->lock); mutex_unlock(&st->lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment