On 28/04/2021 10.01, Sean Nyekjaer wrote:
|static int fxls8962af_read_raw(struct iio_dev *indio_dev, + struct
iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ +
struct fxls8962af_data *data = iio_priv(indio_dev); + int ret; + +
switch (mask) { + case IIO_CHAN_INFO_RAW: + ret =
iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; + +
switch (chan->type) { + case IIO_TEMP: + ret =
fxls8962af_get_temp(data, val); + break; + case IIO_ACCEL: + ret =
fxls8962af_get_axis(data, chan, val); + break; + default: + ret =
-EINVAL; + } + + iio_device_release_direct_mode(indio_dev); + return ret;|
|Maybe I should remove iio_device_claim_direct_mode() and release(),
there is actually nothing in the datasheet that block us from reading
temp and raw
axis data with streaming enabled to the internal fifo.
We have a use-case for reading temperature data while streaming
accelerometer data.
Could I just check for ||iio_buffer_enabled||() and skip the drdy and
power_on/off in
||fxls8962af_get_temp() and ||fxls8962af_get_axis()||?
/Sean
|