lkml.org 
[lkml]   [2024]   [Mar]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 4/6] iio: pressure: Add SCALE and RAW values for channels
On Tue, Mar 19, 2024 at 01:29:23AM +0100, Vasileios Amoiridis wrote:
> Add extra IIO_CHAN_INFO_SCALE and IIO_CHAN_INFO_RAW in order to be
> able to calculate the processed value with standard userspace IIO
> tools. Can be used for triggered buffers as well.
>
> Even though it is not a good design choice to have SCALE, RAW and
> PROCESSED together, the PROCESSED channel is kept for ABI compatibility.

..

> + case IIO_CHAN_INFO_RAW:
> + switch (chan->type) {
> + case IIO_HUMIDITYRELATIVE:
> + ret = data->chip_info->read_humid(data, &chan_value);
> + if (ret)
> + return ret;
> +
> + *val = chan_value;
> + return IIO_VAL_INT;
> + case IIO_PRESSURE:
> + ret = data->chip_info->read_press(data, &chan_value);
> + if (ret)
> + return ret;
> +
> + *val = chan_value;
> + return IIO_VAL_INT;
> + case IIO_TEMP:
> + ret = data->chip_info->read_press(data, &chan_value);
> + if (ret)
> + return ret;
> +
> + *val = chan_value;
> + return IIO_VAL_INT;
> + default:
> + return -EINVAL;
> + }

> + return 0;

Dead code.

> + case IIO_CHAN_INFO_SCALE:
> + switch (chan->type) {
> + case IIO_HUMIDITYRELATIVE:
> + *val = data->chip_info->humid_coeffs[0];
> + *val2 = data->chip_info->humid_coeffs[1];
> + return data->chip_info->humid_coeffs_type;
> + case IIO_PRESSURE:
> + *val = data->chip_info->press_coeffs[0];
> + *val2 = data->chip_info->press_coeffs[1];
> + return data->chip_info->press_coeffs_type;
> + case IIO_TEMP:
> + *val = data->chip_info->temp_coeffs[0];
> + *val2 = data->chip_info->temp_coeffs[1];
> + return data->chip_info->temp_coeffs_type;
> + default:
> + return -EINVAL;
> + }

> + return 0;

Ditto.

--
With Best Regards,
Andy Shevchenko



\
 
 \ /
  Last update: 2024-05-27 15:55    [W:0.236 / U:0.112 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site