Re: [PATCH 2/2] iio: light: ltr390: Add conditional data freshness check with sysfs control
From: Jonathan Cameron
Date: Mon Jul 28 2025 - 09:47:20 EST
On Mon, 28 Jul 2025 01:42:19 +0530
Akshay Jindal <akshayaj.lkd@xxxxxxxxx> wrote:
> On Fri, Jul 25, 2025 at 12:24 AM Akshay Jindal <akshayaj.lkd@xxxxxxxxx> wrote:
> >
> > I agree that this will break the user behaviour.
> > Before dumping this off, I wanted to explore an idea.
> > What if this remains disabled by default, i.e. data->data_fresh_check_en = 0;
> > So this way the regular sensor read_data calls will not break, and
> > based on demand,
> > the application can configure the driver to check for data freshness,
> > by toggling the sysfs attribute to 1.
> > i.e. echo 1 | sudo tee /sys/bus/iio/devices/iio\:device0/data_fresh_check_enable
> >
> Hi,
> Is there any feedback on this?
It's a fairly esoteric interface in general. I'm not yet convinced there
is a reason to have such an indicator at all. Key here is that custom ABI
is (more or less) unused ABI that bit rots.
So I think there are three possible paths forwards
- Harden whatever algorithm you are feeding this data to so that it doesn't
matter if you get occasional duplicate data. i.e. make it a userspace problem.
- Handle the complexity of a buffered interface with freshness guarantee.
Basically that means polling for new data - typically checking at double
the expected sampling frequency and only pushing to the buffers if the
data is fresh.
- Propose generic support for such an indicator and show that it is useful
for a couple of devices and how we'd retrofit into existing drivers
cleanly.
Jonathan
>
> Thanks,
> Akshay.