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 1/6] iio: light: isl29125: Report the scale list via read_avail()
Date: Mon, 2 Nov 2026 16:46:55 +0900 [thread overview]
Message-ID: <20261102074700.63075-2-arka@arkamondal.net> (raw)
In-Reply-To: <20261102074700.63075-1-arka@arkamondal.net>
The intensity channels set IIO_CHAN_INFO_SCALE in
info_mask_shared_by_type, so userspace reads the scale from
in_intensity_scale. The values that attribute accepts are listed by a
custom attribute named scale_available. That name carries no channel
prefix, so it is registered at the device level and is never paired
with the channel. The core would have called it
in_intensity_scale_available, which is also the name
Documentation/ABI/testing/sysfs-bus-iio gives, so userspace does not
find the list where the ABI says it is.
Report the two values through read_avail() and drop the custom
attribute group. The values and the text they print do not change.
Fixes: 208335138001 ("iio: light: isl29125: Add scale_available information")
Signed-off-by: Arka Mondal <arka@arkamondal.net>
---
Notes:
Compile tested only; no relevant hardware available.
drivers/iio/light/isl29125.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c
index 9e0b7e6a3ecf..0efe0d72f9d6 100644
--- a/drivers/iio/light/isl29125.c
+++ b/drivers/iio/light/isl29125.c
@@ -58,6 +58,7 @@ struct isl29125_data {
.modified = 1, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
+ .info_mask_shared_by_type_available = BIT(IIO_CHAN_INFO_SCALE), \
.channel2 = IIO_MOD_LIGHT_##_color, \
.scan_index = _si, \
.scan_type = { \
@@ -198,21 +199,31 @@ static irqreturn_t isl29125_trigger_handler(int irq, void *p)
return IRQ_HANDLED;
}
-static IIO_CONST_ATTR(scale_available, "0.005722 0.152590");
-
-static struct attribute *isl29125_attributes[] = {
- &iio_const_attr_scale_available.dev_attr.attr,
- NULL
+static const int isl29125_scale_avail[] = {
+ 0, ISL29125_SENSING_RANGE_0,
+ 0, ISL29125_SENSING_RANGE_1,
};
-static const struct attribute_group isl29125_attribute_group = {
- .attrs = isl29125_attributes,
-};
+static int isl29125_read_avail(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ const int **vals, int *type, int *length,
+ long mask)
+{
+ switch (mask) {
+ case IIO_CHAN_INFO_SCALE:
+ *vals = isl29125_scale_avail;
+ *type = IIO_VAL_INT_PLUS_MICRO;
+ *length = ARRAY_SIZE(isl29125_scale_avail);
+ return IIO_AVAIL_LIST;
+ default:
+ return -EINVAL;
+ }
+}
static const struct iio_info isl29125_info = {
.read_raw = isl29125_read_raw,
.write_raw = isl29125_write_raw,
- .attrs = &isl29125_attribute_group,
+ .read_avail = isl29125_read_avail,
};
static int isl29125_buffer_postenable(struct iio_dev *indio_dev)
--
2.56.0
next prev parent 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 [PATCH 0/6] iio: Give the *_available attributes the names the core generates Arka Mondal
2026-11-02 7:46 ` Arka Mondal [this message]
2026-11-02 22:26 ` [PATCH 1/6] iio: light: isl29125: Report the scale list via read_avail() 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-2-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®