On 20/01/16 16:07, Akinobu Mita wrote: > 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. > > Signed-off-by: Akinobu Mita <akinobu.mita@xxxxxxxxx> > Cc: Jonathan Cameron <jic23@xxxxxxxxxx> > Cc: Hartmut Knaack <knaack.h@xxxxxx> > Cc: Lars-Peter Clausen <lars@xxxxxxxxxx> > Cc: Peter Meerwald <pmeerw@xxxxxxxxxx> > Cc: linux-iio@xxxxxxxxxxxxxxx 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 > --- > drivers/iio/pressure/mpl115.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iio/pressure/mpl115.c b/drivers/iio/pressure/mpl115.c > index 138344c..73f2f0c 100644 > --- a/drivers/iio/pressure/mpl115.c > +++ b/drivers/iio/pressure/mpl115.c > @@ -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 majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html