diff options
author | Matt Ranostay <matt.ranostay@konsulko.com> | 2017-04-14 19:38:19 -0400 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2017-04-26 02:06:31 -0400 |
commit | 6272c0de13abf1480f701d38288f28a11b4301c4 (patch) | |
tree | 277d6a6717ed9c98674b4ef2e1a8f69b1a10e865 | |
parent | e44adf05b85e5a9d1d224f5ecde1c1c5e5371e36 (diff) |
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: 24ddb0e4bba4 ("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>
-rw-r--r-- | drivers/iio/proximity/as3935.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index ddf9bee89f77..d0f5e53aad59 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c | |||
@@ -269,8 +269,6 @@ static irqreturn_t as3935_interrupt_handler(int irq, void *private) | |||
269 | 269 | ||
270 | static void calibrate_as3935(struct as3935_state *st) | 270 | static void calibrate_as3935(struct as3935_state *st) |
271 | { | 271 | { |
272 | mutex_lock(&st->lock); | ||
273 | |||
274 | /* mask disturber interrupt bit */ | 272 | /* mask disturber interrupt bit */ |
275 | as3935_write(st, AS3935_INT, BIT(5)); | 273 | as3935_write(st, AS3935_INT, BIT(5)); |
276 | 274 | ||
@@ -280,8 +278,6 @@ static void calibrate_as3935(struct as3935_state *st) | |||
280 | 278 | ||
281 | mdelay(2); | 279 | mdelay(2); |
282 | as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV)); | 280 | as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV)); |
283 | |||
284 | mutex_unlock(&st->lock); | ||
285 | } | 281 | } |
286 | 282 | ||
287 | #ifdef CONFIG_PM_SLEEP | 283 | #ifdef CONFIG_PM_SLEEP |
@@ -318,6 +314,8 @@ static int as3935_resume(struct device *dev) | |||
318 | val &= ~AS3935_AFE_PWR_BIT; | 314 | val &= ~AS3935_AFE_PWR_BIT; |
319 | ret = as3935_write(st, AS3935_AFE_GAIN, val); | 315 | ret = as3935_write(st, AS3935_AFE_GAIN, val); |
320 | 316 | ||
317 | calibrate_as3935(st); | ||
318 | |||
321 | err_resume: | 319 | err_resume: |
322 | mutex_unlock(&st->lock); | 320 | mutex_unlock(&st->lock); |
323 | 321 | ||