[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZfrDFl-rmts9tPjk@smile.fi.intel.com>
Date: Wed, 20 Mar 2024 13:05:58 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Vasileios Amoiridis <vassilisamir@...il.com>
Cc: jic23@...nel.org, lars@...afoo.de, ang.iglesiasg@...il.com,
mazziesaccount@...il.com, ak@...klinger.de,
petre.rodan@...dimension.ro, phil@...pberrypi.com, 579lpy@...il.com,
linus.walleij@...aro.org, semen.protsenko@...aro.org,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [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
Powered by blists - more mailing lists