[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251027124210.788962-1-wens@kernel.org>
Date: Mon, 27 Oct 2025 20:42:09 +0800
From: Chen-Yu Tsai <wens@...nel.org>
To: Jonathan Cameron <jic23@...nel.org>,
David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>
Cc: Chen-Yu Tsai <wens@...nel.org>,
linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH] iio: core: Use datasheet name as fallback for label
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@...nel.org>
---
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
Powered by blists - more mailing lists