Re: [PATCH 4/6] iio: light: max44000: Report the available lists via read_avail()
From: Jonathan Cameron
Date: Sat Nov 07 2026 - 20:12:38 EST
On Mon, 2 Nov 2026 16:46:58 +0900
Arka Mondal <arka@xxxxxxxxxxxxxx> wrote:
> The light channel keeps IIO_CHAN_INFO_SCALE and IIO_CHAN_INFO_INT_TIME
> in info_mask_shared_by_type, so userspace sees in_illuminance_scale
> and in_illuminance_integration_time. Two custom attributes list the
> values those accept, but they are named illuminance_scale_available and
> illuminance_integration_time_available, without the in_ prefix the core
> gives the attribute a list belongs to. Both land at the device level,
> paired with nothing, so userspace that asks for either prefixed name
> finds no such file.
>
> Report both lists through read_avail() and delete the two attributes
> along with the strings they printed.
>
> Each list uses the format the write path accepts, which
> max44000_write_raw_get_fmt() gives as IIO_VAL_INT_PLUS_MICRO for
> scale and IIO_VAL_INT_PLUS_NANO for integration time. The scale
> is read back as IIO_VAL_FRACTIONAL_LOG2, the same number written
> another way. max44000_write_raw() still rounds a request against
> the ulux table with find_closest() and against the ns table with
> find_closest_descending(), so both tables stay and the lists are
> separate arrays of value pairs.
>
> No value changes, but the core prints each one to the full precision
> of its format. The scale now reads 0.031250 0.125000 0.500000 4.000000
> where it read 0.03125 0.125 0.5 4, and the integration time reads
> 0.100000000 0.025000000 0.006250000 0.001562500 where it read 0.100
> 0.025 0.00625 0.0015625.
>
> Fixes: d5d8f49b6345 ("max44000: Expose ambient sensor scaling")
> Signed-off-by: Arka Mondal <arka@xxxxxxxxxxxxxx>
Applied this one to the testing branch of iio.git.
Thanks,
Jonathan