* [PATCH] IIO: BME280: Updates to Humidity readings need ctrl_reg write!
@ 2017-08-28 23:21 Colin Parker
2017-09-03 16:34 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Colin Parker @ 2017-08-28 23:21 UTC (permalink / raw)
To: linux-iio; +Cc: jic23, ak, foeparker.colin, Colin Parker
From: Colin Parker <colin.parker@aclima.io>
The ctrl_reg register needs to be written after any write to
the humidity registers. The value written to the ctrl_reg register
does not necessarily need to change, but a write operation must
occur.
The regmap_update_bits functions will not write to a register
if the register value matches the value to be written. This saves
unnecessary bus operations. The change in this patch forces a bus
write during the chip_config operation by switching to
regmap_write_bits.
This will fix issues where the Humidity Sensor Oversampling bits
are not updated after initialization.
Signed-off-by: Colin Parker <colin.parker@aclima.io>
---
drivers/iio/pressure/bmp280-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index 0d2ea3e..8f26428 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -573,7 +573,7 @@ static int bmp280_chip_config(struct bmp280_data *data)
u8 osrs = BMP280_OSRS_TEMP_X(data->oversampling_temp + 1) |
BMP280_OSRS_PRESS_X(data->oversampling_press + 1);
- ret = regmap_update_bits(data->regmap, BMP280_REG_CTRL_MEAS,
+ ret = regmap_write_bits(data->regmap, BMP280_REG_CTRL_MEAS,
BMP280_OSRS_TEMP_MASK |
BMP280_OSRS_PRESS_MASK |
BMP280_MODE_MASK,
--
2.1.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] IIO: BME280: Updates to Humidity readings need ctrl_reg write!
2017-08-28 23:21 [PATCH] IIO: BME280: Updates to Humidity readings need ctrl_reg write! Colin Parker
@ 2017-09-03 16:34 ` Jonathan Cameron
2017-09-04 17:20 ` Andreas Klinger
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2017-09-03 16:34 UTC (permalink / raw)
To: Colin Parker; +Cc: linux-iio, ak, foeparker.colin, Colin Parker
On Mon, 28 Aug 2017 16:21:39 -0700
Colin Parker <colin.foeparker@aclima.io> wrote:
> From: Colin Parker <colin.parker@aclima.io>
>
> The ctrl_reg register needs to be written after any write to
> the humidity registers. The value written to the ctrl_reg register
> does not necessarily need to change, but a write operation must
> occur.
That's nasty.
>
> The regmap_update_bits functions will not write to a register
> if the register value matches the value to be written. This saves
> unnecessary bus operations. The change in this patch forces a bus
> write during the chip_config operation by switching to
> regmap_write_bits.
>
> This will fix issues where the Humidity Sensor Oversampling bits
> are not updated after initialization.
>
> Signed-off-by: Colin Parker <colin.parker@aclima.io>
I'd just like to leave a little more time for Andreas to respond to
this before I apply it.
Give me a bump if it looks like I have forgotten about it after next
weekend.
Thanks,
Jonathan
> ---
> drivers/iio/pressure/bmp280-core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> index 0d2ea3e..8f26428 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -573,7 +573,7 @@ static int bmp280_chip_config(struct bmp280_data *data)
> u8 osrs = BMP280_OSRS_TEMP_X(data->oversampling_temp + 1) |
> BMP280_OSRS_PRESS_X(data->oversampling_press + 1);
>
> - ret = regmap_update_bits(data->regmap, BMP280_REG_CTRL_MEAS,
> + ret = regmap_write_bits(data->regmap, BMP280_REG_CTRL_MEAS,
> BMP280_OSRS_TEMP_MASK |
> BMP280_OSRS_PRESS_MASK |
> BMP280_MODE_MASK,
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] IIO: BME280: Updates to Humidity readings need ctrl_reg write!
2017-09-03 16:34 ` Jonathan Cameron
@ 2017-09-04 17:20 ` Andreas Klinger
2017-09-10 13:48 ` Jonathan Cameron
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Klinger @ 2017-09-04 17:20 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Colin Parker, linux-iio, foeparker.colin, Colin Parker
Jonathan Cameron <jic23@kernel.org> schrieb am Sun, 03. Sep 17:34:
> On Mon, 28 Aug 2017 16:21:39 -0700
> Colin Parker <colin.foeparker@aclima.io> wrote:
>
> > From: Colin Parker <colin.parker@aclima.io>
> >
> > The ctrl_reg register needs to be written after any write to
> > the humidity registers. The value written to the ctrl_reg register
> > does not necessarily need to change, but a write operation must
> > occur.
>
> That's nasty.
>
> >
> > The regmap_update_bits functions will not write to a register
> > if the register value matches the value to be written. This saves
> > unnecessary bus operations. The change in this patch forces a bus
> > write during the chip_config operation by switching to
> > regmap_write_bits.
> >
> > This will fix issues where the Humidity Sensor Oversampling bits
> > are not updated after initialization.
> >
> > Signed-off-by: Colin Parker <colin.parker@aclima.io>
Acked-by: Andreas Klinger <ak@it-klinger.de>
>
> I'd just like to leave a little more time for Andreas to respond to
> this before I apply it.
>
> Give me a bump if it looks like I have forgotten about it after next
> weekend.
>
> Thanks,
>
> Jonathan
>
> > ---
> > drivers/iio/pressure/bmp280-core.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> > index 0d2ea3e..8f26428 100644
> > --- a/drivers/iio/pressure/bmp280-core.c
> > +++ b/drivers/iio/pressure/bmp280-core.c
> > @@ -573,7 +573,7 @@ static int bmp280_chip_config(struct bmp280_data *data)
> > u8 osrs = BMP280_OSRS_TEMP_X(data->oversampling_temp + 1) |
> > BMP280_OSRS_PRESS_X(data->oversampling_press + 1);
> >
> > - ret = regmap_update_bits(data->regmap, BMP280_REG_CTRL_MEAS,
> > + ret = regmap_write_bits(data->regmap, BMP280_REG_CTRL_MEAS,
> > BMP280_OSRS_TEMP_MASK |
> > BMP280_OSRS_PRESS_MASK |
> > BMP280_MODE_MASK,
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] IIO: BME280: Updates to Humidity readings need ctrl_reg write!
2017-09-04 17:20 ` Andreas Klinger
@ 2017-09-10 13:48 ` Jonathan Cameron
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2017-09-10 13:48 UTC (permalink / raw)
To: Andreas Klinger; +Cc: Colin Parker, linux-iio, foeparker.colin, Colin Parker
On Mon, 4 Sep 2017 19:20:51 +0200
Andreas Klinger <ak@it-klinger.de> wrote:
> Jonathan Cameron <jic23@kernel.org> schrieb am Sun, 03. Sep 17:34:
> > On Mon, 28 Aug 2017 16:21:39 -0700
> > Colin Parker <colin.foeparker@aclima.io> wrote:
> >
> > > From: Colin Parker <colin.parker@aclima.io>
> > >
> > > The ctrl_reg register needs to be written after any write to
> > > the humidity registers. The value written to the ctrl_reg register
> > > does not necessarily need to change, but a write operation must
> > > occur.
> >
> > That's nasty.
> >
> > >
> > > The regmap_update_bits functions will not write to a register
> > > if the register value matches the value to be written. This saves
> > > unnecessary bus operations. The change in this patch forces a bus
> > > write during the chip_config operation by switching to
> > > regmap_write_bits.
> > >
> > > This will fix issues where the Humidity Sensor Oversampling bits
> > > are not updated after initialization.
> > >
> > > Signed-off-by: Colin Parker <colin.parker@aclima.io>
>
> Acked-by: Andreas Klinger <ak@it-klinger.de>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,
Jonathan
>
> >
> > I'd just like to leave a little more time for Andreas to respond to
> > this before I apply it.
> >
> > Give me a bump if it looks like I have forgotten about it after next
> > weekend.
> >
> > Thanks,
> >
> > Jonathan
> >
> > > ---
> > > drivers/iio/pressure/bmp280-core.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> > > index 0d2ea3e..8f26428 100644
> > > --- a/drivers/iio/pressure/bmp280-core.c
> > > +++ b/drivers/iio/pressure/bmp280-core.c
> > > @@ -573,7 +573,7 @@ static int bmp280_chip_config(struct bmp280_data *data)
> > > u8 osrs = BMP280_OSRS_TEMP_X(data->oversampling_temp + 1) |
> > > BMP280_OSRS_PRESS_X(data->oversampling_press + 1);
> > >
> > > - ret = regmap_update_bits(data->regmap, BMP280_REG_CTRL_MEAS,
> > > + ret = regmap_write_bits(data->regmap, BMP280_REG_CTRL_MEAS,
> > > BMP280_OSRS_TEMP_MASK |
> > > BMP280_OSRS_PRESS_MASK |
> > > BMP280_MODE_MASK,
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-10 13:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-28 23:21 [PATCH] IIO: BME280: Updates to Humidity readings need ctrl_reg write! Colin Parker
2017-09-03 16:34 ` Jonathan Cameron
2017-09-04 17:20 ` Andreas Klinger
2017-09-10 13:48 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).