lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 14 Jun 2020 20:35:13 +0000
From:   Jean-Baptiste Maneyrol <JManeyrol@...ensense.com>
To:     Lars-Peter Clausen <lars@...afoo.de>,
        "jic23@...nel.org" <jic23@...nel.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "robh@...nel.org" <robh@...nel.org>,
        "mchehab+huawei@...nel.org" <mchehab+huawei@...nel.org>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>
CC:     "linux-iio@...r.kernel.org" <linux-iio@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 06/13] iio: imu: inv_icm42600: add temperature sensor
 support

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.

Thanks for the review,
JB

From: Lars-Peter Clausen <lars@...afoo.de>
Sent: Sunday, June 14, 2020 17:10
To: Jean-Baptiste Maneyrol <JManeyrol@...ensense.com>; jic23@...nel.org <jic23@...nel.org>; robh+dt@...nel.org <robh+dt@...nel.org>; robh@...nel.org <robh@...nel.org>; mchehab+huawei@...nel.org <mchehab+huawei@...nel.org>; davem@...emloft.net <davem@...emloft.net>; gregkh@...uxfoundation.org <gregkh@...uxfoundation.org>
Cc: linux-iio@...r.kernel.org <linux-iio@...r.kernel.org>; devicetree@...r.kernel.org <devicetree@...r.kernel.org>; linux-kernel@...r.kernel.org <linux-kernel@...r.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.

Powered by blists - more mailing lists