diff options
author | George Stark <gnstark@sberdevices.ru> | 2023-07-14 14:37:52 +0300 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2023-07-20 21:21:31 +0300 |
commit | b593ce5db22483dd66405861ac3f782e5a7cd9f3 (patch) | |
tree | 0af7baf46ce7d13082645175f02d646478c701b7 /drivers/iio/adc/meson_saradc.c | |
parent | c38180bf3d1e2460e0674f8e58045f2e2fa74613 (diff) | |
download | linux-b593ce5db22483dd66405861ac3f782e5a7cd9f3.tar.xz |
iio: adc: meson: add channel labels
Add channel labels to provide human-readable names for the inputs.
Signed-off-by: George Stark <GNStark@sberdevices.ru>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230714114010.293440-6-gnstark@sberdevices.ru
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/adc/meson_saradc.c')
-rw-r--r-- | drivers/iio/adc/meson_saradc.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c index ea1f7374cf34..b8c01a81539b 100644 --- a/drivers/iio/adc/meson_saradc.c +++ b/drivers/iio/adc/meson_saradc.c @@ -1055,8 +1055,20 @@ out: return ret; } +static int read_label(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + char *label) +{ + if (chan->type == IIO_TEMP) + return sprintf(label, "temp-sensor\n"); + if (chan->type == IIO_VOLTAGE) + return sprintf(label, "channel-%d\n", chan->channel); + return 0; +} + static const struct iio_info meson_sar_adc_iio_info = { .read_raw = meson_sar_adc_iio_info_read_raw, + .read_label = read_label, }; static const struct meson_sar_adc_param meson_sar_adc_meson8_param = { |