All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iio: pressure: mpl115: fix temperature offset sign
@ 2016-01-20 16:07 Akinobu Mita
  2016-01-24 16:33 ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Akinobu Mita @ 2016-01-20 16:07 UTC (permalink / raw)
  To: linux-iio
  Cc: Akinobu Mita, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald

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@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-iio@vger.kernel.org
---
 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:
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: pressure: mpl115: fix temperature offset sign
  2016-01-20 16:07 [PATCH] iio: pressure: mpl115: fix temperature offset sign Akinobu Mita
@ 2016-01-24 16:33 ` Jonathan Cameron
  2016-01-26 12:33   ` Peter Meerwald-Stadler
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Cameron @ 2016-01-24 16:33 UTC (permalink / raw)
  To: Akinobu Mita, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald

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@gmail.com>
> Cc: Jonathan Cameron <jic23@kernel.org>
> Cc: Hartmut Knaack <knaack.h@gmx.de>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Cc: Peter Meerwald <pmeerw@pmeerw.net>
> Cc: linux-iio@vger.kernel.org
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:
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: pressure: mpl115: fix temperature offset sign
  2016-01-24 16:33 ` Jonathan Cameron
@ 2016-01-26 12:33   ` Peter Meerwald-Stadler
  2016-01-30 16:08     ` Jonathan Cameron
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Meerwald-Stadler @ 2016-01-26 12:33 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Akinobu Mita, linux-iio, Hartmut Knaack, Lars-Peter Clausen

On Sun, 24 Jan 2016, Jonathan Cameron wrote:

> 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.

Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
 
> > Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> > Cc: Jonathan Cameron <jic23@kernel.org>
> > Cc: Hartmut Knaack <knaack.h@gmx.de>
> > Cc: Lars-Peter Clausen <lars@metafoo.de>
> > Cc: Peter Meerwald <pmeerw@pmeerw.net>
> > Cc: linux-iio@vger.kernel.org
> 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@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

-- 

Peter Meerwald-Stadler
+43-664-2444418 (mobile)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: pressure: mpl115: fix temperature offset sign
  2016-01-26 12:33   ` Peter Meerwald-Stadler
@ 2016-01-30 16:08     ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2016-01-30 16:08 UTC (permalink / raw)
  To: Peter Meerwald-Stadler
  Cc: Akinobu Mita, linux-iio, Hartmut Knaack, Lars-Peter Clausen

On 26/01/16 12:33, Peter Meerwald-Stadler wrote:
> On Sun, 24 Jan 2016, Jonathan Cameron wrote:
> 
>> 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.
> 
> Acked-by: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Applied to the fixes-togreg branch and marked for stable.

Thanks,

Jonathan
>  
>>> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>>> Cc: Jonathan Cameron <jic23@kernel.org>
>>> Cc: Hartmut Knaack <knaack.h@gmx.de>
>>> Cc: Lars-Peter Clausen <lars@metafoo.de>
>>> Cc: Peter Meerwald <pmeerw@pmeerw.net>
>>> Cc: linux-iio@vger.kernel.org
>> 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@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:[~2016-01-30 16:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-20 16:07 [PATCH] iio: pressure: mpl115: fix temperature offset sign Akinobu Mita
2016-01-24 16:33 ` Jonathan Cameron
2016-01-26 12:33   ` Peter Meerwald-Stadler
2016-01-30 16:08     ` 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.