Skip to content

Commit 7e2ad8b

Browse files
mranostaygregkh
authored andcommitted
iio: proximity: as3935: recalibrate RCO after resume
commit 6272c0de13abf1480f701d38288f28a11b4301c4 upstream. 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: 24ddb0e ("iio: Add AS3935 lightning sensor support") Cc: George McCollister <george.mccollister@gmail.com> Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 0c96713 commit 7e2ad8b

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/iio/proximity/as3935.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,6 @@ static irqreturn_t as3935_interrupt_handler(int irq, void *private)
263263

264264
static void calibrate_as3935(struct as3935_state *st)
265265
{
266-
mutex_lock(&st->lock);
267-
268266
/* mask disturber interrupt bit */
269267
as3935_write(st, AS3935_INT, BIT(5));
270268

@@ -274,8 +272,6 @@ static void calibrate_as3935(struct as3935_state *st)
274272

275273
mdelay(2);
276274
as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV));
277-
278-
mutex_unlock(&st->lock);
279275
}
280276

281277
#ifdef CONFIG_PM_SLEEP
@@ -312,6 +308,8 @@ static int as3935_resume(struct device *dev)
312308
val &= ~AS3935_AFE_PWR_BIT;
313309
ret = as3935_write(st, AS3935_AFE_GAIN, val);
314310

311+
calibrate_as3935(st);
312+
315313
err_resume:
316314
mutex_unlock(&st->lock);
317315

0 commit comments

Comments
 (0)