lkml.org 
[lkml]   [2020]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v3 06/13] iio: imu: inv_icm42600: add temperature sensor support
Date
Hi Jonathan,

no problem, I can rework temperature to have the same raw output for both cases (with just decreased resolution for the FIFO case).

v4 series is coming soon with the fix.

Thanks,
JB

From: Jonathan Cameron <jic23@kernel.org>
Sent: Saturday, June 20, 2020 17:57
To: Jean-Baptiste Maneyrol <JManeyrol@invensense.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>; robh+dt@kernel.org <robh+dt@kernel.org>; robh@kernel.org <robh@kernel.org>; mchehab+huawei@kernel.org <mchehab+huawei@kernel.org>; davem@davemloft.net <davem@davemloft.net>; gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>; linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; devicetree@vger.kernel.org <devicetree@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 06/13] iio: imu: inv_icm42600: add temperature sensor support
 
 CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.

On Sun, 14 Jun 2020 20:35:13 +0000
Jean-Baptiste Maneyrol <JManeyrol@invensense.com> wrote:

> Hello Lars,
>
> for the temperature data, the problem is that temperature in the FIFO (used in buffer) is not in the same format than when reading the register.
>
> Reading the temperature register return a full precision value on 16 bits. I am using a PROCESSED attribute for it.
> Temperature data in buffer (coming from the FIFO) is on 8 bits in lower precision. It is reported as raw data, thus the need of the offset and scale values.
>
> So offset and scale values are only for transforming the temperature data from the buffer, and direct read is a full precision already processed in m°C.

That is a problem.  We have no means of describing it in IIO.

If the channel is processed via sysfs the assumption would normally
be that it is processed in the buffer as well. We don't really
have any means of describing the two separately.

In cases where we've seen this before the way around it was to
change the data in the fifo so that the scaling was the same as the
sysfs channel (usually it's just a bit of padding).

Can we do that here?  Looks like the ratio is 1:64 so should
be possible.



>
> Thanks for the review,
> JB
>
> From: Lars-Peter Clausen <lars@metafoo.de>
> Sent: Sunday, June 14, 2020 17:10
> To: Jean-Baptiste Maneyrol <JManeyrol@invensense.com>; jic23@kernel.org <jic23@kernel.org>; robh+dt@kernel.org <robh+dt@kernel.org>; robh@kernel.org <robh@kernel.org>; mchehab+huawei@kernel.org <mchehab+huawei@kernel.org>; davem@davemloft.net <davem@davemloft.net>; gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
> Cc: linux-iio@vger.kernel.org <linux-iio@vger.kernel.org>; devicetree@vger.kernel.org <devicetree@vger.kernel.org>; linux-kernel@vger.kernel.org <linux-kernel@vger.kernel.org>
> Subject: Re: [PATCH v3 06/13] iio: imu: inv_icm42600: add temperature sensor support
>  
>  CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.
>
> On 6/8/20 10:42 PM, Jean-Baptiste Maneyrol wrote:
> > +     case IIO_CHAN_INFO_PROCESSED:
> > +             ret = iio_device_claim_direct_mode(indio_dev);
> > +             if (ret)
> > +                     return ret;
> > +             ret = inv_icm42600_temp_read(st, &temp);
> > +             iio_device_release_direct_mode(indio_dev);
> > +             if (ret)
> > +                     return ret;
> > +             *val = temp;
> > +             return IIO_VAL_INT;
> > +     case IIO_CHAN_INFO_SCALE:
> > +             *val = 483;
> > +             *val2 = 91787;
> > +             return IIO_VAL_INT_PLUS_MICRO;
> > +     case IIO_CHAN_INFO_OFFSET:
> > +             *val = 25000;
> > +             return IIO_VAL_INT; 
>
> If the data is returned processed there is no need to specify scale and
> offset.
>
> But since the transformation to turn the data into standard units is a
> simple linear transform the preferred way to handle this is to return
> RAW data and specify scale and offset.

\
 
 \ /
  Last update: 2020-06-22 11:22    [W:0.306 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site