* [PATCH] iio: pressure: bmp280: fix bmp580 temp read
@ 2024-06-02 20:12 Adam Rizkalla
2024-06-04 19:01 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: Adam Rizkalla @ 2024-06-02 20:12 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Vasileios Amoiridis, linux-iio, Adam Rizkalla
Fix overflow when storing bmp580 temperature reading and preserve sign.
This patch re-applies the fix in [1] after the merge conflict resolution
mentioned in [2].
[1] https://lore.kernel.org/all/Zin2udkXRD0+GrML@adam-asahi.lan/
[2] https://lore.kernel.org/linux-kernel/20240531140621.264f0848@canb.auug.org.au/
Signed-off-by: Adam Rizkalla <ajarizzo@gmail.com>
---
drivers/iio/pressure/bmp280-core.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
index 95c88b0e1c49..3a003843c79c 100644
--- a/drivers/iio/pressure/bmp280-core.c
+++ b/drivers/iio/pressure/bmp280-core.c
@@ -1752,6 +1752,8 @@ static int bmp580_read_temp(struct bmp280_data *data, s32 *raw_temp)
dev_err(data->dev, "reading temperature skipped\n");
return -EIO;
}
+ *raw_temp = sign_extend32(*raw_temp, 23);
+ *raw_temp = ((s64)*raw_temp * 1000) / (1 << 16);
return 0;
}
@@ -2154,7 +2156,7 @@ static irqreturn_t bmp580_buffer_handler(int irq, void *p)
static const int bmp580_oversampling_avail[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
static const u8 bmp580_chip_ids[] = { BMP580_CHIP_ID, BMP580_CHIP_ID_ALT };
-static const int bmp580_temp_coeffs[] = { 1000, 16 };
+static const int bmp580_temp_coeffs[] = { 1, 0 };
static const int bmp580_press_coeffs[] = { 1, 64000};
const struct bmp280_chip_info bmp580_chip_info = {
@@ -2184,7 +2186,7 @@ const struct bmp280_chip_info bmp580_chip_info = {
.iir_filter_coeff_default = 2,
.temp_coeffs = bmp580_temp_coeffs,
- .temp_coeffs_type = IIO_VAL_FRACTIONAL_LOG2,
+ .temp_coeffs_type = IIO_VAL_INT,
.press_coeffs = bmp580_press_coeffs,
.press_coeffs_type = IIO_VAL_FRACTIONAL,
--
2.40.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: pressure: bmp280: fix bmp580 temp read
2024-06-02 20:12 [PATCH] iio: pressure: bmp280: fix bmp580 temp read Adam Rizkalla
@ 2024-06-04 19:01 ` Jonathan Cameron
2024-06-04 19:19 ` Vasileios Amoiridis
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2024-06-04 19:01 UTC (permalink / raw)
To: Adam Rizkalla; +Cc: Vasileios Amoiridis, linux-iio
On Sun, 2 Jun 2024 15:12:01 -0500
Adam Rizkalla <ajarizzo@gmail.com> wrote:
> Fix overflow when storing bmp580 temperature reading and preserve sign.
>
> This patch re-applies the fix in [1] after the merge conflict resolution
> mentioned in [2].
>
> [1] https://lore.kernel.org/all/Zin2udkXRD0+GrML@adam-asahi.lan/
> [2] https://lore.kernel.org/linux-kernel/20240531140621.264f0848@canb.auug.org.au/
>
> Signed-off-by: Adam Rizkalla <ajarizzo@gmail.com>
Thanks! I was just about to email about this fix currently being lost in
linux-next.
Rather than dance around this, I'm going to pull the later part of Vasielios'
series off the togreg tree for now then reapply later once I have the fix
in my upstream.
It's a shame that we need to do the maths in driver to keep within range.
Maybe we can be cheeky and avoid doing the division?
I believe the IIO core formatting code should be fine with that as it
already casts up to 64 bits to do the maths.
(s64)*raw_temp * 250);
bmp580_temp_coeffs = {1, 18}
Anyhow, I've dropped (for now) the following patches from my togreg tree
iio: pressure: bmp280: Generalize read_{temp,press,humid}() functions
iio: pressure: bmp280: Add SCALE, RAW values in channels and refactorize them
iio: pressure: bmp280: Add triggered buffer support
Jonathan
> ---
> drivers/iio/pressure/bmp280-core.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> index 95c88b0e1c49..3a003843c79c 100644
> --- a/drivers/iio/pressure/bmp280-core.c
> +++ b/drivers/iio/pressure/bmp280-core.c
> @@ -1752,6 +1752,8 @@ static int bmp580_read_temp(struct bmp280_data *data, s32 *raw_temp)
> dev_err(data->dev, "reading temperature skipped\n");
> return -EIO;
> }
> + *raw_temp = sign_extend32(*raw_temp, 23);
> + *raw_temp = ((s64)*raw_temp * 1000) / (1 << 16);
>
> return 0;
> }
> @@ -2154,7 +2156,7 @@ static irqreturn_t bmp580_buffer_handler(int irq, void *p)
>
> static const int bmp580_oversampling_avail[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
> static const u8 bmp580_chip_ids[] = { BMP580_CHIP_ID, BMP580_CHIP_ID_ALT };
> -static const int bmp580_temp_coeffs[] = { 1000, 16 };
> +static const int bmp580_temp_coeffs[] = { 1, 0 };
> static const int bmp580_press_coeffs[] = { 1, 64000};
>
> const struct bmp280_chip_info bmp580_chip_info = {
> @@ -2184,7 +2186,7 @@ const struct bmp280_chip_info bmp580_chip_info = {
> .iir_filter_coeff_default = 2,
>
> .temp_coeffs = bmp580_temp_coeffs,
> - .temp_coeffs_type = IIO_VAL_FRACTIONAL_LOG2,
> + .temp_coeffs_type = IIO_VAL_INT,
> .press_coeffs = bmp580_press_coeffs,
> .press_coeffs_type = IIO_VAL_FRACTIONAL,
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: pressure: bmp280: fix bmp580 temp read
2024-06-04 19:01 ` Jonathan Cameron
@ 2024-06-04 19:19 ` Vasileios Amoiridis
2024-06-17 19:57 ` Jonathan Cameron
0 siblings, 1 reply; 6+ messages in thread
From: Vasileios Amoiridis @ 2024-06-04 19:19 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Adam Rizkalla, Vasileios Amoiridis, linux-iio
On Tue, Jun 04, 2024 at 08:01:07PM +0100, Jonathan Cameron wrote:
> On Sun, 2 Jun 2024 15:12:01 -0500
> Adam Rizkalla <ajarizzo@gmail.com> wrote:
>
> > Fix overflow when storing bmp580 temperature reading and preserve sign.
> >
> > This patch re-applies the fix in [1] after the merge conflict resolution
> > mentioned in [2].
> >
> > [1] https://lore.kernel.org/all/Zin2udkXRD0+GrML@adam-asahi.lan/
> > [2] https://lore.kernel.org/linux-kernel/20240531140621.264f0848@canb.auug.org.au/
> >
> > Signed-off-by: Adam Rizkalla <ajarizzo@gmail.com>
>
> Thanks! I was just about to email about this fix currently being lost in
> linux-next.
>
> Rather than dance around this, I'm going to pull the later part of Vasielios'
> series off the togreg tree for now then reapply later once I have the fix
> in my upstream.
>
> It's a shame that we need to do the maths in driver to keep within range.
> Maybe we can be cheeky and avoid doing the division?
> I believe the IIO core formatting code should be fine with that as it
> already casts up to 64 bits to do the maths.
>
> (s64)*raw_temp * 250);
>
> bmp580_temp_coeffs = {1, 18}
>
> Anyhow, I've dropped (for now) the following patches from my togreg tree
> iio: pressure: bmp280: Generalize read_{temp,press,humid}() functions
> iio: pressure: bmp280: Add SCALE, RAW values in channels and refactorize them
> iio: pressure: bmp280: Add triggered buffer support
>
> Jonathan
>
Hi Jonathan, Adam,
I had mentioned it here [1], when I applied v7 of the patches that this would
happen. No worries though, I already have the new version of these 3 patches
that include Adam's fix, so when we have it upstream I can resubmit them
(no need to keep a note Jonathan, I have it) and I think we will be fine!
Cheers,
Vasilis
[1]: https://lore.kernel.org/linux-iio/20240512230524.53990-1-vassilisamir@gmail.com/T/#t
> > ---
> > drivers/iio/pressure/bmp280-core.c | 6 ++++--
> > 1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> > index 95c88b0e1c49..3a003843c79c 100644
> > --- a/drivers/iio/pressure/bmp280-core.c
> > +++ b/drivers/iio/pressure/bmp280-core.c
> > @@ -1752,6 +1752,8 @@ static int bmp580_read_temp(struct bmp280_data *data, s32 *raw_temp)
> > dev_err(data->dev, "reading temperature skipped\n");
> > return -EIO;
> > }
> > + *raw_temp = sign_extend32(*raw_temp, 23);
> > + *raw_temp = ((s64)*raw_temp * 1000) / (1 << 16);
> >
> > return 0;
> > }
> > @@ -2154,7 +2156,7 @@ static irqreturn_t bmp580_buffer_handler(int irq, void *p)
> >
> > static const int bmp580_oversampling_avail[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
> > static const u8 bmp580_chip_ids[] = { BMP580_CHIP_ID, BMP580_CHIP_ID_ALT };
> > -static const int bmp580_temp_coeffs[] = { 1000, 16 };
> > +static const int bmp580_temp_coeffs[] = { 1, 0 };
> > static const int bmp580_press_coeffs[] = { 1, 64000};
> >
> > const struct bmp280_chip_info bmp580_chip_info = {
> > @@ -2184,7 +2186,7 @@ const struct bmp280_chip_info bmp580_chip_info = {
> > .iir_filter_coeff_default = 2,
> >
> > .temp_coeffs = bmp580_temp_coeffs,
> > - .temp_coeffs_type = IIO_VAL_FRACTIONAL_LOG2,
> > + .temp_coeffs_type = IIO_VAL_INT,
> > .press_coeffs = bmp580_press_coeffs,
> > .press_coeffs_type = IIO_VAL_FRACTIONAL,
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: pressure: bmp280: fix bmp580 temp read
2024-06-04 19:19 ` Vasileios Amoiridis
@ 2024-06-17 19:57 ` Jonathan Cameron
2024-06-17 20:30 ` Vasileios Amoiridis
0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2024-06-17 19:57 UTC (permalink / raw)
To: Vasileios Amoiridis; +Cc: Adam Rizkalla, linux-iio
On Tue, 4 Jun 2024 21:19:04 +0200
Vasileios Amoiridis <vassilisamir@gmail.com> wrote:
> On Tue, Jun 04, 2024 at 08:01:07PM +0100, Jonathan Cameron wrote:
> > On Sun, 2 Jun 2024 15:12:01 -0500
> > Adam Rizkalla <ajarizzo@gmail.com> wrote:
> >
> > > Fix overflow when storing bmp580 temperature reading and preserve sign.
> > >
> > > This patch re-applies the fix in [1] after the merge conflict resolution
> > > mentioned in [2].
> > >
> > > [1] https://lore.kernel.org/all/Zin2udkXRD0+GrML@adam-asahi.lan/
> > > [2] https://lore.kernel.org/linux-kernel/20240531140621.264f0848@canb.auug.org.au/
> > >
> > > Signed-off-by: Adam Rizkalla <ajarizzo@gmail.com>
> >
> > Thanks! I was just about to email about this fix currently being lost in
> > linux-next.
> >
> > Rather than dance around this, I'm going to pull the later part of Vasielios'
> > series off the togreg tree for now then reapply later once I have the fix
> > in my upstream.
> >
> > It's a shame that we need to do the maths in driver to keep within range.
> > Maybe we can be cheeky and avoid doing the division?
> > I believe the IIO core formatting code should be fine with that as it
> > already casts up to 64 bits to do the maths.
> >
> > (s64)*raw_temp * 250);
> >
> > bmp580_temp_coeffs = {1, 18}
> >
> > Anyhow, I've dropped (for now) the following patches from my togreg tree
> > iio: pressure: bmp280: Generalize read_{temp,press,humid}() functions
> > iio: pressure: bmp280: Add SCALE, RAW values in channels and refactorize them
> > iio: pressure: bmp280: Add triggered buffer support
> >
> > Jonathan
> >
>
> Hi Jonathan, Adam,
>
> I had mentioned it here [1], when I applied v7 of the patches that this would
> happen. No worries though, I already have the new version of these 3 patches
> that include Adam's fix, so when we have it upstream I can resubmit them
> (no need to keep a note Jonathan, I have it) and I think we will be fine!
Excellent. The fix is no in the upstream of my togreg branch.
I've only pushed it out as testing for now, but if you send a version based
on my testing branch or 20460472952 (currently char-misc-next head) that would be great.
Thanks,
Jonathan
>
> Cheers,
> Vasilis
>
> [1]: https://lore.kernel.org/linux-iio/20240512230524.53990-1-vassilisamir@gmail.com/T/#t
>
> > > ---
> > > drivers/iio/pressure/bmp280-core.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> > > index 95c88b0e1c49..3a003843c79c 100644
> > > --- a/drivers/iio/pressure/bmp280-core.c
> > > +++ b/drivers/iio/pressure/bmp280-core.c
> > > @@ -1752,6 +1752,8 @@ static int bmp580_read_temp(struct bmp280_data *data, s32 *raw_temp)
> > > dev_err(data->dev, "reading temperature skipped\n");
> > > return -EIO;
> > > }
> > > + *raw_temp = sign_extend32(*raw_temp, 23);
> > > + *raw_temp = ((s64)*raw_temp * 1000) / (1 << 16);
> > >
> > > return 0;
> > > }
> > > @@ -2154,7 +2156,7 @@ static irqreturn_t bmp580_buffer_handler(int irq, void *p)
> > >
> > > static const int bmp580_oversampling_avail[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
> > > static const u8 bmp580_chip_ids[] = { BMP580_CHIP_ID, BMP580_CHIP_ID_ALT };
> > > -static const int bmp580_temp_coeffs[] = { 1000, 16 };
> > > +static const int bmp580_temp_coeffs[] = { 1, 0 };
> > > static const int bmp580_press_coeffs[] = { 1, 64000};
> > >
> > > const struct bmp280_chip_info bmp580_chip_info = {
> > > @@ -2184,7 +2186,7 @@ const struct bmp280_chip_info bmp580_chip_info = {
> > > .iir_filter_coeff_default = 2,
> > >
> > > .temp_coeffs = bmp580_temp_coeffs,
> > > - .temp_coeffs_type = IIO_VAL_FRACTIONAL_LOG2,
> > > + .temp_coeffs_type = IIO_VAL_INT,
> > > .press_coeffs = bmp580_press_coeffs,
> > > .press_coeffs_type = IIO_VAL_FRACTIONAL,
> > >
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: pressure: bmp280: fix bmp580 temp read
2024-06-17 19:57 ` Jonathan Cameron
@ 2024-06-17 20:30 ` Vasileios Amoiridis
2024-06-17 23:23 ` Vasileios Amoiridis
0 siblings, 1 reply; 6+ messages in thread
From: Vasileios Amoiridis @ 2024-06-17 20:30 UTC (permalink / raw)
To: Jonathan Cameron; +Cc: Vasileios Amoiridis, Adam Rizkalla, linux-iio
On Mon, Jun 17, 2024 at 08:57:26PM +0100, Jonathan Cameron wrote:
> On Tue, 4 Jun 2024 21:19:04 +0200
> Vasileios Amoiridis <vassilisamir@gmail.com> wrote:
>
> > On Tue, Jun 04, 2024 at 08:01:07PM +0100, Jonathan Cameron wrote:
> > > On Sun, 2 Jun 2024 15:12:01 -0500
> > > Adam Rizkalla <ajarizzo@gmail.com> wrote:
> > >
> > > > Fix overflow when storing bmp580 temperature reading and preserve sign.
> > > >
> > > > This patch re-applies the fix in [1] after the merge conflict resolution
> > > > mentioned in [2].
> > > >
> > > > [1] https://lore.kernel.org/all/Zin2udkXRD0+GrML@adam-asahi.lan/
> > > > [2] https://lore.kernel.org/linux-kernel/20240531140621.264f0848@canb.auug.org.au/
> > > >
> > > > Signed-off-by: Adam Rizkalla <ajarizzo@gmail.com>
> > >
> > > Thanks! I was just about to email about this fix currently being lost in
> > > linux-next.
> > >
> > > Rather than dance around this, I'm going to pull the later part of Vasielios'
> > > series off the togreg tree for now then reapply later once I have the fix
> > > in my upstream.
> > >
> > > It's a shame that we need to do the maths in driver to keep within range.
> > > Maybe we can be cheeky and avoid doing the division?
> > > I believe the IIO core formatting code should be fine with that as it
> > > already casts up to 64 bits to do the maths.
> > >
> > > (s64)*raw_temp * 250);
> > >
> > > bmp580_temp_coeffs = {1, 18}
> > >
> > > Anyhow, I've dropped (for now) the following patches from my togreg tree
> > > iio: pressure: bmp280: Generalize read_{temp,press,humid}() functions
> > > iio: pressure: bmp280: Add SCALE, RAW values in channels and refactorize them
> > > iio: pressure: bmp280: Add triggered buffer support
> > >
> > > Jonathan
> > >
> >
> > Hi Jonathan, Adam,
> >
> > I had mentioned it here [1], when I applied v7 of the patches that this would
> > happen. No worries though, I already have the new version of these 3 patches
> > that include Adam's fix, so when we have it upstream I can resubmit them
> > (no need to keep a note Jonathan, I have it) and I think we will be fine!
>
> Excellent. The fix is no in the upstream of my togreg branch.
>
> I've only pushed it out as testing for now, but if you send a version based
> on my testing branch or 20460472952 (currently char-misc-next head) that would be great.
>
> Thanks,
>
> Jonathan
>
Hi Jonathan,
Thank for letting me know, I can send it by tomorrow.
Cheers,
Vasilis
> >
> > Cheers,
> > Vasilis
> >
> > [1]: https://lore.kernel.org/linux-iio/20240512230524.53990-1-vassilisamir@gmail.com/T/#t
> >
> > > > ---
> > > > drivers/iio/pressure/bmp280-core.c | 6 ++++--
> > > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> > > > index 95c88b0e1c49..3a003843c79c 100644
> > > > --- a/drivers/iio/pressure/bmp280-core.c
> > > > +++ b/drivers/iio/pressure/bmp280-core.c
> > > > @@ -1752,6 +1752,8 @@ static int bmp580_read_temp(struct bmp280_data *data, s32 *raw_temp)
> > > > dev_err(data->dev, "reading temperature skipped\n");
> > > > return -EIO;
> > > > }
> > > > + *raw_temp = sign_extend32(*raw_temp, 23);
> > > > + *raw_temp = ((s64)*raw_temp * 1000) / (1 << 16);
> > > >
> > > > return 0;
> > > > }
> > > > @@ -2154,7 +2156,7 @@ static irqreturn_t bmp580_buffer_handler(int irq, void *p)
> > > >
> > > > static const int bmp580_oversampling_avail[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
> > > > static const u8 bmp580_chip_ids[] = { BMP580_CHIP_ID, BMP580_CHIP_ID_ALT };
> > > > -static const int bmp580_temp_coeffs[] = { 1000, 16 };
> > > > +static const int bmp580_temp_coeffs[] = { 1, 0 };
> > > > static const int bmp580_press_coeffs[] = { 1, 64000};
> > > >
> > > > const struct bmp280_chip_info bmp580_chip_info = {
> > > > @@ -2184,7 +2186,7 @@ const struct bmp280_chip_info bmp580_chip_info = {
> > > > .iir_filter_coeff_default = 2,
> > > >
> > > > .temp_coeffs = bmp580_temp_coeffs,
> > > > - .temp_coeffs_type = IIO_VAL_FRACTIONAL_LOG2,
> > > > + .temp_coeffs_type = IIO_VAL_INT,
> > > > .press_coeffs = bmp580_press_coeffs,
> > > > .press_coeffs_type = IIO_VAL_FRACTIONAL,
> > > >
> > >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] iio: pressure: bmp280: fix bmp580 temp read
2024-06-17 20:30 ` Vasileios Amoiridis
@ 2024-06-17 23:23 ` Vasileios Amoiridis
0 siblings, 0 replies; 6+ messages in thread
From: Vasileios Amoiridis @ 2024-06-17 23:23 UTC (permalink / raw)
To: Vasileios Amoiridis; +Cc: Jonathan Cameron, Adam Rizkalla, linux-iio
On Mon, Jun 17, 2024 at 10:30:34PM +0200, Vasileios Amoiridis wrote:
> On Mon, Jun 17, 2024 at 08:57:26PM +0100, Jonathan Cameron wrote:
> > On Tue, 4 Jun 2024 21:19:04 +0200
> > Vasileios Amoiridis <vassilisamir@gmail.com> wrote:
> >
> > > On Tue, Jun 04, 2024 at 08:01:07PM +0100, Jonathan Cameron wrote:
> > > > On Sun, 2 Jun 2024 15:12:01 -0500
> > > > Adam Rizkalla <ajarizzo@gmail.com> wrote:
> > > >
> > > > > Fix overflow when storing bmp580 temperature reading and preserve sign.
> > > > >
> > > > > This patch re-applies the fix in [1] after the merge conflict resolution
> > > > > mentioned in [2].
> > > > >
> > > > > [1] https://lore.kernel.org/all/Zin2udkXRD0+GrML@adam-asahi.lan/
> > > > > [2] https://lore.kernel.org/linux-kernel/20240531140621.264f0848@canb.auug.org.au/
> > > > >
> > > > > Signed-off-by: Adam Rizkalla <ajarizzo@gmail.com>
> > > >
> > > > Thanks! I was just about to email about this fix currently being lost in
> > > > linux-next.
> > > >
> > > > Rather than dance around this, I'm going to pull the later part of Vasielios'
> > > > series off the togreg tree for now then reapply later once I have the fix
> > > > in my upstream.
> > > >
> > > > It's a shame that we need to do the maths in driver to keep within range.
> > > > Maybe we can be cheeky and avoid doing the division?
> > > > I believe the IIO core formatting code should be fine with that as it
> > > > already casts up to 64 bits to do the maths.
> > > >
> > > > (s64)*raw_temp * 250);
> > > >
> > > > bmp580_temp_coeffs = {1, 18}
> > > >
> > > > Anyhow, I've dropped (for now) the following patches from my togreg tree
> > > > iio: pressure: bmp280: Generalize read_{temp,press,humid}() functions
> > > > iio: pressure: bmp280: Add SCALE, RAW values in channels and refactorize them
> > > > iio: pressure: bmp280: Add triggered buffer support
> > > >
> > > > Jonathan
> > > >
> > >
> > > Hi Jonathan, Adam,
> > >
> > > I had mentioned it here [1], when I applied v7 of the patches that this would
> > > happen. No worries though, I already have the new version of these 3 patches
> > > that include Adam's fix, so when we have it upstream I can resubmit them
> > > (no need to keep a note Jonathan, I have it) and I think we will be fine!
> >
> > Excellent. The fix is no in the upstream of my togreg branch.
> >
> > I've only pushed it out as testing for now, but if you send a version based
> > on my testing branch or 20460472952 (currently char-misc-next head) that would be great.
> >
> > Thanks,
> >
> > Jonathan
> >
>
> Hi Jonathan,
>
> Thank for letting me know, I can send it by tomorrow.
>
> Cheers,
> Vasilis
>
Hi Jonathan,
Applied already, you can take the patch whenever you want,
thanks for the help and the heads up!
Cheers,
Vasilis
> > >
> > > Cheers,
> > > Vasilis
> > >
> > > [1]: https://lore.kernel.org/linux-iio/20240512230524.53990-1-vassilisamir@gmail.com/T/#t
> > >
> > > > > ---
> > > > > drivers/iio/pressure/bmp280-core.c | 6 ++++--
> > > > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > > > >
> > > > > diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c
> > > > > index 95c88b0e1c49..3a003843c79c 100644
> > > > > --- a/drivers/iio/pressure/bmp280-core.c
> > > > > +++ b/drivers/iio/pressure/bmp280-core.c
> > > > > @@ -1752,6 +1752,8 @@ static int bmp580_read_temp(struct bmp280_data *data, s32 *raw_temp)
> > > > > dev_err(data->dev, "reading temperature skipped\n");
> > > > > return -EIO;
> > > > > }
> > > > > + *raw_temp = sign_extend32(*raw_temp, 23);
> > > > > + *raw_temp = ((s64)*raw_temp * 1000) / (1 << 16);
> > > > >
> > > > > return 0;
> > > > > }
> > > > > @@ -2154,7 +2156,7 @@ static irqreturn_t bmp580_buffer_handler(int irq, void *p)
> > > > >
> > > > > static const int bmp580_oversampling_avail[] = { 1, 2, 4, 8, 16, 32, 64, 128 };
> > > > > static const u8 bmp580_chip_ids[] = { BMP580_CHIP_ID, BMP580_CHIP_ID_ALT };
> > > > > -static const int bmp580_temp_coeffs[] = { 1000, 16 };
> > > > > +static const int bmp580_temp_coeffs[] = { 1, 0 };
> > > > > static const int bmp580_press_coeffs[] = { 1, 64000};
> > > > >
> > > > > const struct bmp280_chip_info bmp580_chip_info = {
> > > > > @@ -2184,7 +2186,7 @@ const struct bmp280_chip_info bmp580_chip_info = {
> > > > > .iir_filter_coeff_default = 2,
> > > > >
> > > > > .temp_coeffs = bmp580_temp_coeffs,
> > > > > - .temp_coeffs_type = IIO_VAL_FRACTIONAL_LOG2,
> > > > > + .temp_coeffs_type = IIO_VAL_INT,
> > > > > .press_coeffs = bmp580_press_coeffs,
> > > > > .press_coeffs_type = IIO_VAL_FRACTIONAL,
> > > > >
> > > >
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-06-17 23:23 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-02 20:12 [PATCH] iio: pressure: bmp280: fix bmp580 temp read Adam Rizkalla
2024-06-04 19:01 ` Jonathan Cameron
2024-06-04 19:19 ` Vasileios Amoiridis
2024-06-17 19:57 ` Jonathan Cameron
2024-06-17 20:30 ` Vasileios Amoiridis
2024-06-17 23:23 ` Vasileios Amoiridis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox