From: Arka Mondal <arka@arkamondal.net>
To: Jonathan Cameron <jic23@kernel.org>, Linus Walleij <linusw@kernel.org>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Peter Meerwald" <pmeerw@pmeerw.net>,
"Matt Ranostay" <mranostay@gmail.com>,
"Robert Eshleman" <bobbyeshleman@gmail.com>,
"Leonard Crestez" <cdleonard@gmail.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Arka Mondal" <arka@arkamondal.net>
Subject: [PATCH 0/6] iio: Give the *_available attributes the names the core generates
Date: Mon, 2 Nov 2026 16:46:54 +0900 [thread overview]
Message-ID: <20261102074700.63075-1-arka@arkamondal.net> (raw)
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
next reply other threads:[~2026-11-02 7:47 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 7:46 Arka Mondal [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261102074700.63075-1-arka@arkamondal.net \
--to=arka@arkamondal.net \
--cc=andy@kernel.org \
--cc=bobbyeshleman@gmail.com \
--cc=cdleonard@gmail.com \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mranostay@gmail.com \
--cc=nuno.sa@analog.com \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®