iio: pressure: mpl115: fix temperature offset sign
PATCH 1/1 iio: pressure: mpl115: fix temperature offset sign
According to the datasheet, the resolusion of temperature sensor is -5.35 counts/C. Temperature ADC is 472 counts at 25C.
(https://www.sparkfun.com/datasheets/Sensors/Pressure/MPL115A1.pdf
NOTE: This is older revision, but this information is removed from the latest datasheet from nxp somehow)
Temp [C] = (Tadc - 472) / -5.35 + 25
= (Tadc - 605.750000) * -0.186915888
So the correct offset is -605.750000.
--- drivers/iio/pressure/mpl115.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/pressure/mpl115.c +1 -1
@@ -118,7 +118,7 @@ static int mpl115_read_raw(struct iio_dev *indio_dev, *val = ret >>6 ;return IIO_VAL_INT ;case IIO_CHAN_INFO_OFFSET : - *val =605 ; + *val =-605 ; *val2 =750000 ;return IIO_VAL_INT_PLUS_MICRO ;case IIO_CHAN_INFO_SCALE :
Signature · 1 line
2.5.0
Jonathan Cameron
maintainerQuoted 9 lines · Akinobu Mita
According to the datasheet, the resolusion of temperature sensor is -5.35 counts/C. Temperature ADC is 472 counts at 25C.
(https://www.sparkfun.com/datasheets/Sensors/Pressure/MPL115A1.pdf
NOTE: This is older revision, but this information is removed from the latest datasheet from nxp somehow)Temp [C] = (Tadc - 472) / -5.35 + 25
= (Tadc - 605.750000) * -0.186915888
Quoted 8 lines
So the correct offset is -605.750000.
Signed-off-by Akinobu Mita <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Hartmut Knaack <[email protected]>Cc Lars-Peter Clausen <[email protected]>Cc Peter Meerwald <[email protected]>
Peter,
I'd like your Ack on this given it is your driver. That way I can be lazy and not cross check the datasheet myself.
Jonathan
Quoted 18 lines
--- drivers/iio/pressure/mpl115.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/pressure/mpl115.c +1
-1@@ -118,7 +118,7 @@ static int mpl115_read_raw(struct iio_dev *indio_dev, *val = ret >>6 ;return IIO_VAL_INT ;case IIO_CHAN_INFO_OFFSET : - *val =605 ; + *val =-605 ; *val2 =750000 ;return IIO_VAL_INT_PLUS_MICRO ;case IIO_CHAN_INFO_SCALE :
Peter Meerwald-Stadler
Acked-byQuoted 11 lines · Jonathan Cameron
Quoted 10 lines · Akinobu Mita
According to the datasheet, the resolusion of temperature sensor is -5.35 counts/C. Temperature ADC is 472 counts at 25C.
(https://www.sparkfun.com/datasheets/Sensors/Pressure/MPL115A1.pdf
NOTE: This is older revision, but this information is removed from the latest datasheet from nxp somehow)Temp [C] = (Tadc - 472) / -5.35 + 25
= (Tadc - 605.750000) * -0.186915888So the correct offset is -605.750000.
Quoted 36 lines
Quoted 6 lines
Signed-off-by Akinobu Mita <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Hartmut Knaack <[email protected]>Cc Lars-Peter Clausen <[email protected]>Cc Peter Meerwald <[email protected]>Peter,
I'd like your Ack on this given it is your driver. That way I can be lazy and not cross check the datasheet myself.
Jonathan
Quoted 10 lines
--- drivers/iio/pressure/mpl115.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/pressure/mpl115.c +0
-0drivers/iio/pressure/mpl115.c static int mpl115_read_raw(struct iio_dev *indio_dev, · line 124
Quoted 8 lines
drivers/iio/pressure/mpl115.c +1
-1@@ -118,7 +118,7 @@ static int mpl115_read_raw(struct iio_dev *indio_dev, *val = ret >>6 ;return IIO_VAL_INT ;case IIO_CHAN_INFO_OFFSET : - *val =605 ; + *val =-605 ; *val2 =750000 ;return IIO_VAL_INT_PLUS_MICRO ;case IIO_CHAN_INFO_SCALE :--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Peter Meerwald-Stadler +43-664-2444418 (mobile)
Quoted 9 lines · Peter Meerwald-Stadler
Quoted 7 lines · Jonathan Cameron
Quoted 6 lines · Akinobu Mita
According to the datasheet, the resolusion of temperature sensor is -5.35 counts/C. Temperature ADC is 472 counts at 25C.
(https://www.sparkfun.com/datasheets/Sensors/Pressure/MPL115A1.pdf
NOTE: This is older revision, but this information is removed from the latest datasheet from nxp somehow)
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Temp [C] = (Tadc - 472) / -5.35 + 25
= (Tadc - 605.750000) * -0.186915888So the correct offset is -605.750000.
Applied to the fixes-togreg branch and marked for stable.
Thanks,
Jonathan
Quoted 38 lines
Quoted 37 lines
Quoted 7 lines
Signed-off-by Akinobu Mita <[email protected]>Cc Jonathan Cameron <[email protected]>Cc Hartmut Knaack <[email protected]>Cc Lars-Peter Clausen <[email protected]>Cc Peter Meerwald <[email protected]>Peter,
I'd like your Ack on this given it is your driver. That way I can be lazy and not cross check the datasheet myself.
Jonathan
Quoted 10 lines
--- drivers/iio/pressure/mpl115.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/pressure/mpl115.c +0
-0drivers/iio/pressure/mpl115.c static int mpl115_read_raw(struct iio_dev *indio_dev, · line 124
Quoted 8 lines
drivers/iio/pressure/mpl115.c +1
-1@@ -118,7 +118,7 @@ static int mpl115_read_raw(struct iio_dev *indio_dev, *val = ret >>6 ;return IIO_VAL_INT ;case IIO_CHAN_INFO_OFFSET : - *val =605 ; + *val =-605 ; *val2 =750000 ;return IIO_VAL_INT_PLUS_MICRO ;case IIO_CHAN_INFO_SCALE :--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html