* [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property
@ 2026-09-07 15:23 Flaviu Nistor
2026-09-07 15:23 ` [PATCH v3 2/2] iio: adc: ti-ads1015: Add support for label Flaviu Nistor
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Flaviu Nistor @ 2026-09-07 15:23 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] 7+ messages in thread
* [PATCH v3 2/2] iio: adc: ti-ads1015: Add support for label
2026-09-07 15:23 [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property Flaviu Nistor
@ 2026-09-07 15:23 ` Flaviu Nistor
2026-09-08 10:31 ` Andy Shevchenko
2026-09-08 4:41 ` [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property Andy Shevchenko
2026-09-08 4:42 ` Andy Shevchenko
2 siblings, 1 reply; 7+ messages in thread
From: Flaviu Nistor @ 2026-09-07 15:23 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>
---
Changes in v3:
- Return datasheet_name of the channel in user space if label is not present in dts.
- Link to v2: https://lore.kernel.org/all/20260902172230.5234-2-flaviu.nistor@gmail.com/
Changes in v2:
- Implement changes suggested by Andy Shevchenko.
- Link to v1: https://lore.kernel.org/all/20260901184302.8127-2-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..7ad03fa2253d 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,22 @@ 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);
+ const char *name = data->channel_data[chan->address].label;
+
+ /*
+ * Avoid printing "(null)" in the console in case label property
+ * is missing for the channel, or channel is not defined.
+ */
+ if (!name)
+ name = chan->datasheet_name;
+
+ return sysfs_emit(label, "%s\n", name);
+}
+
static int ads1015_write_raw(struct iio_dev *indio_dev,
struct iio_chan_spec const *chan, int val,
int val2, long mask)
@@ -843,6 +860,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 +871,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 +880,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 +918,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;
--
2.34.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property
2026-09-07 15:23 [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property Flaviu Nistor
2026-09-07 15:23 ` [PATCH v3 2/2] iio: adc: ti-ads1015: Add support for label Flaviu Nistor
@ 2026-09-08 4:41 ` Andy Shevchenko
2026-09-08 16:28 ` Flaviu Nistor
2026-09-08 4:42 ` Andy Shevchenko
2 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-09-08 4:41 UTC (permalink / raw)
To: Flaviu Nistor
Cc: Jonathan Cameron, David Lechner, Nuno Sa, Andy Shevchenko,
Krzysztof Kozlowski, Rob Herring, Conor Dooley, Daniel Baluta,
Antoniu Miclaus, devicetree, linux-kernel, linux-iio,
Krzysztof Kozlowski
On Mon, Sep 07, 2026 at 06:23:03PM +0300, Flaviu Nistor wrote:
> 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.
You missed a cover letter.
Try next time
`git format-patch --cover-letter ...`
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property
2026-09-07 15:23 [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property Flaviu Nistor
2026-09-07 15:23 ` [PATCH v3 2/2] iio: adc: ti-ads1015: Add support for label Flaviu Nistor
2026-09-08 4:41 ` [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property Andy Shevchenko
@ 2026-09-08 4:42 ` Andy Shevchenko
2 siblings, 0 replies; 7+ messages in thread
From: Andy Shevchenko @ 2026-09-08 4:42 UTC (permalink / raw)
To: Flaviu Nistor
Cc: Jonathan Cameron, David Lechner, Nuno Sa, Andy Shevchenko,
Krzysztof Kozlowski, Rob Herring, Conor Dooley, Daniel Baluta,
Antoniu Miclaus, devicetree, linux-kernel, linux-iio,
Krzysztof Kozlowski
On Mon, Sep 07, 2026 at 06:23:03PM +0300, Flaviu Nistor wrote:
> Add support for an optional label property per channel similar to other adc
ADC
> chips. This allows assigning distinct names for each channel which can
> match the schematic signal name.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/2] iio: adc: ti-ads1015: Add support for label
2026-09-07 15:23 ` [PATCH v3 2/2] iio: adc: ti-ads1015: Add support for label Flaviu Nistor
@ 2026-09-08 10:31 ` Andy Shevchenko
2026-09-08 16:29 ` Flaviu Nistor
0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2026-09-08 10:31 UTC (permalink / raw)
To: Flaviu Nistor
Cc: Jonathan Cameron, David Lechner, Nuno Sa, Andy Shevchenko,
Krzysztof Kozlowski, Rob Herring, Conor Dooley, Daniel Baluta,
Antoniu Miclaus, devicetree, linux-kernel, linux-iio
On Mon, Sep 07, 2026 at 06:23:04PM +0300, Flaviu Nistor wrote:
> 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.
...
> +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);
> + const char *name = data->channel_data[chan->address].label;
> +
> + /*
> + * Avoid printing "(null)" in the console in case label property
> + * is missing for the channel, or channel is not defined.
> + */
> + if (!name)
> + name = chan->datasheet_name;
Is the datasheet_name static? Can this rather be made only once
at the probe time?
> + return sysfs_emit(label, "%s\n", name);
> +}
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property
2026-09-08 4:41 ` [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property Andy Shevchenko
@ 2026-09-08 16:28 ` Flaviu Nistor
0 siblings, 0 replies; 7+ messages in thread
From: Flaviu Nistor @ 2026-09-08 16:28 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Nuno Sa, Krzysztof Kozlowski,
Rob Herring, Conor Dooley, Daniel Baluta, Antoniu Miclaus,
Flaviu Nistor, devicetree, linux-kernel, linux-iio
On Tue, Sep 8, 2026 at 7:41 AM, Andy Shevchenko wrote:
>On Mon, Sep 07, 2026 at 06:23:03PM +0300, Flaviu Nistor wrote:
>> 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.
>
>You missed a cover letter.
>Try next time
>
> `git format-patch --cover-letter ...`
>
I will keep this in mind for future patch series.
Thanks,
Flaviu
>--
>With Best Regards,
>Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/2] iio: adc: ti-ads1015: Add support for label
2026-09-08 10:31 ` Andy Shevchenko
@ 2026-09-08 16:29 ` Flaviu Nistor
0 siblings, 0 replies; 7+ messages in thread
From: Flaviu Nistor @ 2026-09-08 16:29 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Nuno Sa, Krzysztof Kozlowski,
Rob Herring, Conor Dooley, Daniel Baluta, Antoniu Miclaus,
Flaviu Nistor, devicetree, linux-kernel, linux-iio
On Tue, Sep 8, 2026 at 1:31 PM, Andy Shevchenko wrote:
>On Mon, Sep 07, 2026 at 06:23:04PM +0300, Flaviu Nistor wrote:
>> 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.
>...
>
>> +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);
>> + const char *name = data->channel_data[chan->address].label;
>> +
>> + /*
>> + * Avoid printing "(null)" in the console in case label property
>> + * is missing for the channel, or channel is not defined.
>> + */
>> + if (!name)
>> + name = chan->datasheet_name;
>
>Is the datasheet_name static? Can this rather be made only once
>at the probe time?
>
Good point. Yes it is static, so indeed I can move it to the probe function.
Will send out a v4.
Best Regards,
Flaviu
>> + return sysfs_emit(label, "%s\n", name);
>> +}
>
>--
>With Best Regards,
>Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-09-08 16:29 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-07 15:23 [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property Flaviu Nistor
2026-09-07 15:23 ` [PATCH v3 2/2] iio: adc: ti-ads1015: Add support for label Flaviu Nistor
2026-09-08 10:31 ` Andy Shevchenko
2026-09-08 16:29 ` Flaviu Nistor
2026-09-08 4:41 ` [PATCH v3 1/2] dt-bindings: iio: adc: ti,ads1015: Add label property Andy Shevchenko
2026-09-08 16:28 ` Flaviu Nistor
2026-09-08 4:42 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®