[PATCH] iio: core: Use datasheet name as fallback for label

From: Chen-Yu Tsai

Date: Mon Oct 27 2025 - 08:49:35 EST


Some IIO drivers do not provide labels or extended names for their
channels. However they may provide datasheet names. axp20x-adc is
one such example.

Use the datasheet name as a fallback for the channel label. This mainly
benefits iio-hwmon by letting the produced hwmon sensors have more
meaningful names rather than in_voltageX.

Signed-off-by: Chen-Yu Tsai <wens@xxxxxxxxxx>
---
drivers/iio/industrialio-core.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 88c3d585a1bd..d410ea2e7963 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -749,6 +749,9 @@ ssize_t do_iio_read_channel_label(struct iio_dev *indio_dev,
if (c->extend_name)
return sysfs_emit(buf, "%s\n", c->extend_name);

+ if (c->datasheet_name)
+ return sysfs_emit(buf, "%s\n", c->datasheet_name);
+
return -EINVAL;
}

--
2.47.3