Re: Reply to [RFC PATCH v2 0/1] Adding support for IIO SCMI based sensors

Jonathan Cameron
2021-01-09T19:02:22Z

On Wed, 6 Jan 2021 21:23:53 +0000
Jyoti Bhayana <jbhayana@google.com> wrote:

> Hi Jonathan,
>
> Instead of adding IIO_VAL_INT_H32_L32, I am thinking of adding IIO_VAL_FRACTIONAL_LONG
> or IIO_VAL_FRACTIONAL_64 as the scale/exponent used for min/max range can be different
> than the one used in resolution according to specification.

That's somewhat 'odd'. Given min/max are inherently values the sensor is supposed to
be able to return why give them different resolutions? Can you point me at a specific
section of the spec? The axis_min_range_low etc fields don't seem to have units specified
but I assumed they were in sensor units and so same scale factors?

>
> I am planning to use read_avail for IIO_CHAN_INFO_PROCESSED using IIO_AVAIL_RANGE
> and this new IIO_VAL_FRACTIONAL_64 for min range,max range and resolution.
> Instead of two values used in IIO_VAL_FRACTIONAL, IIO_VAL_FRACTIONAL_64 will use 4 values
> val_high,val_low,and val2_high and val2_low.

I'm not keen on the changing that internal kernel interface unless we absolutely
have to. read_avail() is called from consumer drivers and they won't know anything
about this new variant.

>
> Let me know if that is an acceptable solution.

Hmm. It isn't a standard use of the ABI given the value in the buffer is (I assume)
raw (needs scale applied). However, it isn't excluded by the ABI docs. Whether
a standard userspace is going to expect it is not clear to me.

I don't want to end up in a position where we end up with available being generally
added for processed when what most people care about is what the value range they
might get from a polled read is (rather than via a buffer).

So I'm not that keen on this solution but if we can find a way to avoid it.

Jonathan

>
>
> Thanks,
> Jyoti
>