Re: [PATCH v2] RFC: iio: lsm6dsx: Support temperature channel on some devices

From: Andy Spencer
Date: Tue Sep 05 2023 - 12:23:22 EST


Hi Lorenzo,

Thanks for reviewing this!

Regarding the TODR and ODR_T_BATCH settings:

> > + [ST_LSM6DSX_ID_TEMP] = {
> > + /*
> > + * NOTE: this ODR will be capped and controllerd by the
> > + * gyro and accelerometer don't have any reg to configure
> > + * this ODR.
> > + */
> > + .odr_avl[0] = { 12500, 0x01 },
> > + .odr_avl[1] = { 26000, 0x02 },
> > + .odr_avl[2] = { 52000, 0x03 },
> > + .odr_len = 3,
>
> please consider we do not support low-power mode iirc (just
> high-performance - bit 4 in CTRL6_C (15h)), so even enabling accel
> sensor, the temp sensor will always runs at 52Hz. Here we should add
> just one entry, like:
>
> .odr_avl[0] = { 52000, 0x03 },
> .odr_len = 1,

I didn't see a way to configure the batch data rate in the IIO driver
aside from the "odr_avl" table.

It seemed useful to allow reading the gyro/accel at a high rate, such as
416 Hz, while still allowing the lower temperature sub-sampling rates of
1.6 and 12.5 Hz. My original intent in adding the lower ODR table
entries here was to reuse the sampling_frequency sysfs attr to
configure the batch data rate, since that seems to be what most people
would care about.

Alternately, we could add a separate "odr_batch_avl" table along with a
separate sysfs attr (e.g. "buffer_sampling_frequency"). That would be a
lot more work though, especially since the actual ODR for the temp
sensor won't be configurable anyway.

Note, I don't have any specific need for the lower rates, so if 52 Hz is
the only rate supported, that still "works for me".