On Sun, 5 Mar 2023 14:22:51 +0200
Matti Vaittinen <mazziesaccount@xxxxxxxxx> wrote:
On 3/4/23 22:17, Jonathan Cameron wrote:
On Thu, 2 Mar 2023 12:58:59 +0200
Matti Vaittinen <mazziesaccount@xxxxxxxxx> wrote:
+static const struct iio_chan_spec bu27034_channels[] = {
+ {
+ .type = IIO_LIGHT,
+ .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
+ BIT(IIO_CHAN_INFO_SCALE),
What is this scale for?
The scale is to inform users that we return data using milli lux.
Given the channel is computed from various different inputs, is there a
clear definition of how it is scaled? What does a write to it mean?
Nothing. writing anything else but milli lux scale fails with -EINVAL.
I guess I am doing something in an unusual way here :) Do you have a
suggestion for me?
Return data in lux?
Or return it as INFO_RAW - thus making it clear
that the reading is not in expected units and a conversion must be
applied by userspace. SCALE is not applied to PROCESSED by userspace.
In the rare case where you do get SCALE and PROCESSED it's there to allow
for changes in the underlying signal measurement that are eaten up in the
computation needed to get to PROCESSED - that is they have no visible
affect (beyond range changes etc).