* [PATCH] iio: proximity: as3935: recalibrate RCO after resume
@ 2017-04-14 23:38 Matt Ranostay
2017-04-26 6:06 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Matt Ranostay @ 2017-04-14 23:38 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, Matt Ranostay, George McCollister
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>
---
drivers/iio/proximity/as3935.c | 6 ++----
1 file 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)
static void calibrate_as3935(struct as3935_state *st)
{
- mutex_lock(&st->lock);
-
/* mask disturber interrupt bit */
as3935_write(st, AS3935_INT, BIT(5));
@@ -280,8 +278,6 @@ static void calibrate_as3935(struct as3935_state *st)
mdelay(2);
as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV));
-
- mutex_unlock(&st->lock);
}
#ifdef CONFIG_PM_SLEEP
@@ -318,6 +314,8 @@ static int as3935_resume(struct device *dev)
val &= ~AS3935_AFE_PWR_BIT;
ret = as3935_write(st, AS3935_AFE_GAIN, val);
+ calibrate_as3935(st);
+
err_resume:
mutex_unlock(&st->lock);
--
2.11.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: proximity: as3935: recalibrate RCO after resume
2017-04-14 23:38 [PATCH] iio: proximity: as3935: recalibrate RCO after resume Matt Ranostay
@ 2017-04-26 6:06 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2017-04-26 6:06 UTC (permalink / raw)
To: Matt Ranostay, linux-iio; +Cc: George McCollister
On 15/04/17 00:38, Matt Ranostay wrote:
> 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>
Applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
> ---
> drivers/iio/proximity/as3935.c | 6 ++----
> 1 file 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)
>
> static void calibrate_as3935(struct as3935_state *st)
> {
> - mutex_lock(&st->lock);
> -
> /* mask disturber interrupt bit */
> as3935_write(st, AS3935_INT, BIT(5));
>
> @@ -280,8 +278,6 @@ static void calibrate_as3935(struct as3935_state *st)
>
> mdelay(2);
> as3935_write(st, AS3935_TUNE_CAP, (st->tune_cap / TUNE_CAP_DIV));
> -
> - mutex_unlock(&st->lock);
> }
>
> #ifdef CONFIG_PM_SLEEP
> @@ -318,6 +314,8 @@ static int as3935_resume(struct device *dev)
> val &= ~AS3935_AFE_PWR_BIT;
> ret = as3935_write(st, AS3935_AFE_GAIN, val);
>
> + calibrate_as3935(st);
> +
> err_resume:
> mutex_unlock(&st->lock);
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-04-26 6:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-14 23:38 [PATCH] iio: proximity: as3935: recalibrate RCO after resume Matt Ranostay
2017-04-26 6:06 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.