iio: adc: qcom-spmi-vadc: Propagate fw node label to userspace
authorMarijn Suijten <marijn.suijten@somainline.org>
Mon, 1 May 2023 23:17:37 +0000 (01:17 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 13 May 2023 17:28:10 +0000 (18:28 +0100)
commit3d0b126029d92b659afd8ffa8ee4fe751ff3996c
treedd98462e91db911c4e1b8e77ca5870f6e2850c83
parentac0abf75e1a94425f1cd503e1a895e003e2f40d6
iio: adc: qcom-spmi-vadc: Propagate fw node label to userspace

Set the read_label() callback to return a friendly name provided in DT
(firmware), in order to make in_{therm,voltage}X_label attributes show
up in sysfs for userspace to consume a channel name.  This is
particularly useful for custom thermistors being attached to otherwise
generically named GPIOs, where the name is known by the board DT.

If the channel name isn't set in DT, use the datasheet_name hardcoded in
the driver instead.

Note that this doesn't fall back to fwnode_get_name() as that provides
suboptimally readable names, with an @xx address suffix from board DT.

Signed-off-by: Marijn Suijten <marijn.suijten@somainline.org>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Link: https://lore.kernel.org/r/20230502-iio-adc-propagate-fw-node-label-v3-5-6be5db6e6b5a@somainline.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/adc/qcom-spmi-vadc.c