mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/6] iio: Give the *_available attributes the names the core generates
@ 2026-11-02  7:46 Arka Mondal
  2026-11-02  7:46 ` [PATCH 1/6] iio: light: isl29125: Report the scale list via read_avail() Arka Mondal
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Arka Mondal @ 2026-11-02  7:46 UTC (permalink / raw)
  To: Jonathan Cameron, Linus Walleij
  Cc: David Lechner, Nuno Sá,
	Andy Shevchenko, Peter Meerwald, Matt Ranostay, Robert Eshleman,
	Leonard Crestez, linux-iio, linux-kernel, Arka Mondal

An <attr>_available file takes its name from the attribute whose values
it lists. The core builds both names with __iio_chan_prefix_emit(),
called for the available attribute with the same shared_by
argument, so the prefix follows from where the value sits:
in_<type> plus any index or modifier for info_mask_separate,
in_<type> for info_mask_shared_by_type, and nothing at all for
info_mask_shared_by_all. The iio-channel-prefix KUnit suite covers each
of those cases.

Six drivers build their lists by hand with IIO_CONST_ATTR instead,
and ten of the eleven names they use have no prefix even though
none of those values is shared across all channels. Each of
the ten is a device level attribute paired with no channel, so
its list is reachable only under a name that does not describe
it. Documentation/ABI/testing/sysfs-bus-iio keeps bare names
for the shared-across-all case, sampling_frequency_available and
oversampling_ratio_available, and gives the prefixed form everywhere
else: in_accel_scale_available, in_illuminance_scale_available,
in_intensity_hardwaregain_available. Anything that looks for a list
beside the attribute it belongs to finds no such file.

These patches hand all eleven lists to read_avail() and delete the
custom attribute groups. The same was done for hts221 in
commit 003e99cf33e3 ("iio: humidity: hts221: report available values via read_avail()")
where "the incorrectly named in_humidity_oversampling_ratio_available
attribute is replaced by the standard
in_humidityrelative_oversampling_ratio_available name", so the shape is
not new. The names change as follows.

  isl29125   scale_available
             -> in_intensity_scale_available
  apds9960   proximity_scale_available
             -> in_proximity_scale_available
  apds9960   intensity_scale_available
             -> in_intensity_scale_available
  apds9960   integration_time_available
             -> in_intensity_integration_time_available
  max44009   illuminance_integration_time_available
             -> in_illuminance_integration_time_available
  max44000   illuminance_scale_available
             -> in_illuminance_scale_available
  max44000   illuminance_integration_time_available
             -> in_illuminance_integration_time_available
  hdc100x    temp_integration_time_available
             -> in_temp_integration_time_available
  hdc100x    humidityrelative_integration_time_available
             -> in_humidityrelative_integration_time_available
  hdc100x    out_current_heater_raw_available
             -> unchanged, this one was already right
  mpu3050    anglevel_scale_available
             -> in_anglvel_scale_available

Of the eleven lists, four print exactly the text they printed before and
six gain trailing decimals, because the core prints each value to the
full precision of its IIO_VAL_* type where the old strings were written
out by hand. apds9960's integration time, for one, becomes 0.028000
0.100000 0.200000 0.700000. The numbers are the same.

The eleventh is mpu3050, whose four values really do change. They were
computed against 2^16 while mpu3050_read_raw() divides by U16_MAX,
so the list never agreed with the channel: it offered 0.000122070
where in_anglvel_scale reports 0.000122072, and likewise for the other
three. Patch 6 builds the list from the same IIO_DEGREE_TO_RAD() terms
the read path uses, so the two cannot diverge again.

On who runs these parts: mpu3050 appears in eight in-tree device tree
files, covering Tegra 2 and 3 tablets, the APQ8060 Dragonboard and two
Ux500 phones, and hdc1080 in two, one of them an IBM BMC. apds9960,
max44000 and hdc100x also carry ACPI ids, so they turn up on x86
machines with no device tree at all. isl29125 and max44009 have no
in-tree user that I could find.

Compile tested only; I have none of this hardware. Patch 2 draws one
checkpatch spelling warning on a word inside its Fixes: subject. That
typo is in the 2015 commit being cited and has to stay, or the tag stops
matching the subject it names. I am happy to rebase on togreg or testing
if that is easier for you.

Arka Mondal (6):
  iio: light: isl29125: Report the scale list via read_avail()
  iio: light: apds9960: Report the available lists via read_avail()
  iio: light: max44009: Report the integration time via read_avail()
  iio: light: max44000: Report the available lists via read_avail()
  iio: humidity: hdc100x: Report the available lists via read_avail()
  iio: gyro: mpu3050: Fix the scale list and report it via read_avail()

 drivers/iio/gyro/mpu3050-core.c | 40 ++++++++++++---------
 drivers/iio/humidity/hdc100x.c  | 61 ++++++++++++++++++++++++---------
 drivers/iio/light/apds9960.c    | 56 ++++++++++++++++++++++--------
 drivers/iio/light/isl29125.c    | 29 +++++++++++-----
 drivers/iio/light/max44000.c    | 60 +++++++++++++++++++-------------
 drivers/iio/light/max44009.c    | 48 ++++++++++++++------------
 6 files changed, 193 insertions(+), 101 deletions(-)


base-commit: d135ab453a7400a34930bdda1ef4bdc8acfac80e
-- 
2.56.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-02 22:26 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-02  7:46 [PATCH 0/6] iio: Give the *_available attributes the names the core generates Arka Mondal
2026-11-02  7:46 ` [PATCH 1/6] iio: light: isl29125: Report the scale list via read_avail() Arka Mondal
2026-11-02 22:26   ` Jonathan Cameron
2026-11-02  7:46 ` [PATCH 2/6] iio: light: apds9960: Report the available lists " Arka Mondal
2026-11-02  7:46 ` [PATCH 3/6] iio: light: max44009: Report the integration time " Arka Mondal
2026-11-02  7:46 ` [PATCH 4/6] iio: light: max44000: Report the available lists " Arka Mondal
2026-11-02  7:46 ` [PATCH 5/6] iio: humidity: hdc100x: " Arka Mondal
2026-11-02  7:47 ` [PATCH 6/6] iio: gyro: mpu3050: Fix the scale list and report it " Arka Mondal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®