Commit b593ce5d authored by George Stark's avatar George Stark Committed by Jonathan Cameron

iio: adc: meson: add channel labels

Add channel labels to provide human-readable names for the inputs.
Signed-off-by: default avatarGeorge Stark <GNStark@sberdevices.ru>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230714114010.293440-6-gnstark@sberdevices.ruSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent c38180bf
......@@ -1055,8 +1055,20 @@ static int meson_sar_adc_calib(struct iio_dev *indio_dev)
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 = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment