* [PATCH v4 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property
2026-09-08 19:20 [PATCH v4 0/2] iio: adc: ti-ads1015: Add support for label Flaviu Nistor
@ 2026-09-08 19:20 ` Flaviu Nistor
2026-09-08 19:20 ` [PATCH v4 2/2] iio: adc: ti-ads1015: Add support for label Flaviu Nistor
1 sibling, 0 replies; 5+ messages in thread
From: Flaviu Nistor @ 2026-09-08 19:20 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sa, Andy Shevchenko,
Krzysztof Kozlowski, Rob Herring, Conor Dooley, Daniel Baluta,
Antoniu Miclaus
Cc: Flaviu Nistor, devicetree, linux-kernel, linux-iio, Krzysztof Kozlowski
Add support for an optional label property per channel similar to other ADC
chips. This allows assigning distinct names for each channel which can
match the schematic signal name.
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com>
---
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml
index 718f633c6e04..777a75c21d7f 100644
--- a/Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml
+++ b/Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml
@@ -66,6 +66,11 @@ patternProperties:
- minimum: 0
maximum: 7
+ label:
+ $ref: /schemas/types.yaml#/definitions/string
+ description:
+ A descriptive name for this channel, like "vcc_ram" or "CH3".
+
ti,gain:
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
@@ -125,6 +130,7 @@ examples:
reg = <4>;
ti,gain = <3>;
ti,datarate = <5>;
+ label = "CH3";
};
};
};
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH v4 2/2] iio: adc: ti-ads1015: Add support for label
2026-09-08 19:20 [PATCH v4 0/2] iio: adc: ti-ads1015: Add support for label Flaviu Nistor
2026-09-08 19:20 ` [PATCH v4 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property Flaviu Nistor
@ 2026-09-08 19:20 ` Flaviu Nistor
2026-09-09 14:07 ` Andy Shevchenko
1 sibling, 1 reply; 5+ messages in thread
From: Flaviu Nistor @ 2026-09-08 19:20 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sa, Andy Shevchenko,
Krzysztof Kozlowski, Rob Herring, Conor Dooley, Daniel Baluta,
Antoniu Miclaus
Cc: Flaviu Nistor, devicetree, linux-kernel, linux-iio
Add support for label sysfs attribute similar to other ADC devices. This is
particularly useful because the label can match the schematic signal name,
identifying channel voltages easier if label is defined via device tree.
Signed-off-by: Flaviu Nistor <flaviu.nistor@gmail.com>
---
drivers/iio/adc/ti-ads1015.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/drivers/iio/adc/ti-ads1015.c b/drivers/iio/adc/ti-ads1015.c
index 0fbfa4e499aa..0f9244107c6d 100644
--- a/drivers/iio/adc/ti-ads1015.c
+++ b/drivers/iio/adc/ti-ads1015.c
@@ -233,6 +233,7 @@ static const struct iio_event_spec ads1015_events[] = {
struct ads1015_channel_data {
unsigned int pga;
unsigned int data_rate;
+ const char *label;
};
struct ads1015_thresh_data {
@@ -586,6 +587,15 @@ static int ads1015_read_raw(struct iio_dev *indio_dev,
}
}
+static int ads1015_read_label(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan, char *label)
+{
+ struct ads1015_data *data = iio_priv(indio_dev);
+
+ return sysfs_emit(label, "%s\n",
+ data->channel_data[chan->address].label);
+}
+
static int ads1015_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val,
int val2, long mask)
@@ -843,6 +853,7 @@ static const struct iio_buffer_setup_ops ads1015_buffer_setup_ops = {
static const struct iio_info ads1015_info = {
.read_avail = ads1015_read_avail,
.read_raw = ads1015_read_raw,
+ .read_label = ads1015_read_label,
.write_raw = ads1015_write_raw,
.read_event_value = ads1015_read_event,
.write_event_value = ads1015_write_event,
@@ -853,6 +864,7 @@ static const struct iio_info ads1015_info = {
static const struct iio_info tla2024_info = {
.read_avail = ads1015_read_avail,
.read_raw = ads1015_read_raw,
+ .read_label = ads1015_read_label,
.write_raw = ads1015_write_raw,
};
@@ -861,7 +873,9 @@ static int ads1015_client_get_channels_config(struct i2c_client *client)
struct iio_dev *indio_dev = i2c_get_clientdata(client);
struct ads1015_data *data = iio_priv(indio_dev);
struct device *dev = &client->dev;
+ const char *label;
int i = -1;
+ int ret;
device_for_each_child_node_scoped(dev, node) {
u32 pval;
@@ -897,6 +911,15 @@ static int ads1015_client_get_channels_config(struct i2c_client *client)
}
}
+ if (fwnode_property_present(node, "label")) {
+ ret = fwnode_property_read_string(node, "label", &label);
+ if (ret) {
+ dev_err(dev, "invalid label on %pfw\n", node);
+ return ret;
+ }
+ data->channel_data[channel].label = label;
+ }
+
data->channel_data[channel].pga = pga;
data->channel_data[channel].data_rate = data_rate;
@@ -985,6 +1008,13 @@ static int ads1015_probe(struct i2c_client *client)
/* we need to keep this ABI the same as used by hwmon ADS1015 driver */
ads1015_get_channels_config(client);
+ /* Channels without a label property fall back to the datasheet name */
+ for (i = 0; i < ADS1015_CHANNELS; i++) {
+ if (!data->channel_data[i].label)
+ data->channel_data[i].label =
+ indio_dev->channels[i].datasheet_name;
+ }
+
data->regmap = devm_regmap_init_i2c(client, chip->has_comparator ?
&ads1015_regmap_config :
&tla2024_regmap_config);
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread