пн, 17 лют. 2025 р. о 16:24 Jonathan Cameron <jic23@xxxxxxxxxx> пише: > > > Hi, > > > > > +static int al3000a_read_raw(struct iio_dev *indio_dev, > > > > + struct iio_chan_spec const *chan, int *val, > > > > + int *val2, long mask) > > > > +{ > > > > + struct al3000a_data *data = iio_priv(indio_dev); > > > > + int ret, gain; > > > > + > > > > + switch (mask) { > > > > + case IIO_CHAN_INFO_RAW: > > > > + ret = regmap_read(data->regmap, AL3000A_REG_DATA, &gain); > > > > + if (ret < 0) > > > > + return ret; > > > > + > > > > + *val = lux_table[gain & AL3000A_GAIN_MASK]; > > > > > > I may have misinterpreted the other thread. IS this value in lux? > > > If it is make this channel IIO_CHAN_INFO_PROCESSED instead. > > > > > > > This is actually a really good hint, I will check if this works out > > and if yes, then definitely will use it. Thank you. > > From your other reply it seems we have no idea of the correct scaling. > If that is the case, then channel type should be IIO_INTENSITY as > I assume we also have no idea if the light sensitivity curve is > matched to that required for illuminance (which approximates the > sensitivity of the human eye). Various datasheets provide completely > garbage conversion formulas btw so even if we have data this can > be problematic. One recent sensor was using a green filter and > saying illuminance in lux was 1.2 * green which was assuming their > own definition of white light. > > Jonathan > Then why IIO_LIGHT exists at all? If you state that datasheets provide garbage formulas and sensors cannot be trusted and all is around human eye, then why IIO_LIGHT is still the case? I did not recall any drivers for human eyes (thank god). Please be more consistent. Thank you