dt-bindings: iio: adc: ti,ads1015: Add label property
Subsystems (2)
PATCH v2 1/2 dt-bindings: iio: adc: ti,ads1015: Add label property
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.
--- Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +6 -0
@@ -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"; }; }; };
Signature · 1 line
2.34.1
PATCH v2 2/2 iio: adc: ti-ads1015: Add support for label
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.
---
Changes in v2:
- Implement changes suggested by Andy Shevchenko.
- Link to v1: https://lore.kernel.org/all/[email protected]/
drivers/iio/adc/ti-ads1015.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
drivers/iio/adc/ti-ads1015.c +25 -0
@@ -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); +const char *name = data->channel_data[chan->address].label; + +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 +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,17 @@ 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; + }else { + data->channel_data[channel].label ="" ; + } + data->channel_data[channel].pga = pga; data->channel_data[channel].data_rate = data_rate;
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v2 2/2] iio: adc: ti-ads1015: Add support for label
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] The `ads1015_read_label()` function passes a potentially NULL pointer to `sysfs_emit()`, causing…
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The ads1015_read_label() function passes a potentially NULL pointer to sysfs_emit(), causing userspace to read "(null)\n" for unconfigured channels. --
commit 9084b6f4b1c391e596d3456f4a84598bb430a6e6
Author: Flaviu Nistor <[email protected]>
Subject: iio: adc: ti-ads1015: Add support for label
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.
Quoted 4 lines
drivers/iio/adc/ti-ads1015.c +0
-0
[ ... ]
drivers/iio/adc/ti-ads1015.c static int ads1015_read_raw(struct iio_dev *indio_dev, · line 596
Quoted 11 lines
drivers/iio/adc/ti-ads1015.c +7
-0@@ -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); +const char *name = data->channel_data[chan->address].label; + +return sysfs_emit (label,"%s\n" , name);
[Severity: Medium]
Will this return "(null)\n" to userspace for channels without a configured label?
If a channel is not explicitly defined in the firmware nodes, or if the driver falls back to the default configuration via ads1015_get_channels_config(), the label field will remain NULL. Passing a NULL pointer to sysfs_emit() results in an incorrect literal "(null)\n" output at the UAPI boundary.
Quoted 5 lines
drivers/iio/adc/ti-ads1015.c +2
-0+} +static int ads1015_write_raw (struct iio_dev *indio_dev,struct iio_chan_spec const *chan,int val,int val2,long mask)
[ ... ]
Quoted 5 lines
drivers/iio/adc/ti-ads1015.c +1
-0@@ -897,6 +911,17 @@ static int ads1015_client_get_channels_config(struct i2c_client *client) } } +if (fwnode_property_present (node,"label" )) {
drivers/iio/adc/ti-ads1015.c static int ads1015_client_get_channels_config(struct i2c_client *client) · line 924
Quoted 10 lines
drivers/iio/adc/ti-ads1015.c +10
-0+ 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; + }else { + data->channel_data[channel].label ="" ; + } +
[Severity: Medium]
Are there cases where some channels might be skipped in this loop?
Since this initialization is contained within the child node iteration loop, it only covers channels that are explicitly defined in the firmware nodes. Channels omitted from the device tree will remain zero-initialized, leaving their label field as NULL.
Quoted 3 lines
drivers/iio/adc/ti-ads1015.c +0
-0data->channel_data[channel].pga = pga; data->channel_data[channel].data_rate = data_rate;
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
David Lechner
reviewerRe: [PATCH v2 2/2] iio: adc: ti-ads1015: Add support for label
In reply to Flaviu NistorQuoted 70 lines · Flaviu Nistor
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 <[email protected]>---
Changes in v2:
- Implement changes suggested by Andy Shevchenko.
- Link to v1: https://lore.kernel.org/all/[email protected]/drivers/iio/adc/ti-ads1015.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)drivers/iio/adc/ti-ads1015.c +14
-0@@ -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); +const char *name = data->channel_data[chan->address].label; + +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 +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,17 @@ static int ads1015_client_get_channels_config(struct i2c_client *client) } }
drivers/iio/adc/ti-ads1015.c static int ads1015_client_get_channels_config(struct i2c_client *client) · line 922
Quoted 10 lines
drivers/iio/adc/ti-ads1015.c +9
-0+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; + }else { + data->channel_data[channel].label ="" ;
I think the normal way to do this is to return -EINVAL on channels with no label rather than an empty string.
Quoted 5 lines
drivers/iio/adc/ti-ads1015.c +2
-0+ } + data->channel_data[channel].pga = pga; data->channel_data[channel].data_rate = data_rate;
Re: [PATCH v2 2/2] iio: adc: ti-ads1015: Add support for label
Quoted 1 line · David Lechner
On 9/2/26 12:22 PM, Flaviu Nistor wrote:
...
Quoted 5 lines
drivers/iio/adc/ti-ads1015.c static int ads1015_client_get_channels_config(struct i2c_client *client) · line 918
Quoted 5 lines
drivers/iio/adc/ti-ads1015.c +5
-0+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;
return dev_err_probe(...);
Quoted 7 lines
drivers/iio/adc/ti-ads1015.c static int ads1015_client_get_channels_config(struct i2c_client *client) · line 922
Quoted 4 lines
drivers/iio/adc/ti-ads1015.c +4
-0+ } + data->channel_data[channel].label = label; + }else { + data->channel_data[channel].label ="" ;I think the normal way to do this is to return
-EINVALon channels with no label rather than an empty string.
In this case the whole dance with property_present is not required. (What you are saying sounds like label is mandatory property, but
how the old DT will work that have no such property?)
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ }
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/2] iio: adc: ti-ads1015: Add support for label
Quoted 22 lines · Andy Shevchenko
Quoted 1 line · David Lechner
On 9/2/26 12:22 PM, Flaviu Nistor wrote:
...
Quoted 5 lines
drivers/iio/adc/ti-ads1015.c static int ads1015_client_get_channels_config(struct i2c_client *client) · line 918
Quoted 5 lines
drivers/iio/adc/ti-ads1015.c +5
-0+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;return dev_err_probe(...);Quoted 7 lines
drivers/iio/adc/ti-ads1015.c static int ads1015_client_get_channels_config(struct i2c_client *client) · line 922
Quoted 4 lines
drivers/iio/adc/ti-ads1015.c +4
-0+ } + data->channel_data[channel].label = label; + }else { + data->channel_data[channel].label ="" ;I think the normal way to do this is to return
-EINVALon channels with no label rather than an empty string.
Quoted 4 lines
In this case the whole dance with
property_presentis not required. (What you are saying sounds like label is mandatory property, but how the old DT will work that have no such property?)
I also consider that since label is not a mandatory property it should not return -EINVAL just be simply not being used in the device tree for that channel. Since the iio core exposes in sysfs the in_volatagex_label for all channels, there are 3 situations:
1. The channel is defined in the dts and has the optional label property assigned, in which case a string is returned in the console in user space.
2. The channel is defined in the dts but has no optional label property defined in the dts, in which case it an empty string "" (a default) is returned.
3. The channel is not defined in the dts (in_voltagex_label is still visible in the sysfs), and reading the label will cause "(null)\n" to be printed in the console (as indicated also by Sashiko boot), since the default "" value is not assigned during device_for_each_child_node_scoped(). I think this is not an issue since is just the way sysfs_emit() handles an NULL string.
My initial version (v1) handeled all 3 cases, for case 2 and 3, an empty string "" was printed out.
What would you prefer? Any further suggestions?
Best regards,
Flaviu Nistor
Quoted 5 lines
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ }Signature · 2 lines
With Best Regards, Andy Shevchenko
David Lechner
reviewerRe: [PATCH v2 2/2] iio: adc: ti-ads1015: Add support for label
Quoted 43 lines · Flaviu Nistor
Quoted 22 lines · Andy Shevchenko
Quoted 1 line · David Lechner
On 9/2/26 12:22 PM, Flaviu Nistor wrote:
...
Quoted 5 lines
drivers/iio/adc/ti-ads1015.c static int ads1015_client_get_channels_config(struct i2c_client *client) · line 918
Quoted 5 lines
drivers/iio/adc/ti-ads1015.c +5
-0+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;return dev_err_probe(...);Quoted 7 lines
drivers/iio/adc/ti-ads1015.c static int ads1015_client_get_channels_config(struct i2c_client *client) · line 922
Quoted 4 lines
drivers/iio/adc/ti-ads1015.c +4
-0+ } + data->channel_data[channel].label = label; + }else { + data->channel_data[channel].label ="" ;I think the normal way to do this is to return
-EINVALon channels with no label rather than an empty string.Quoted 4 lines
In this case the whole dance with
property_presentis not required. (What you are saying sounds like label is mandatory property, but how the old DT will work that have no such property?)I also consider that since label is not a mandatory property it should not return
-EINVALjust be simply not being used in the device tree for that channel. Since the iio core exposes in sysfs thein_volatagex_labelfor all channels, there are 3 situations:
1. The channel is defined in the dts and has the optional label property assigned, in which case a string is returned in the console in user space.
2. The channel is defined in the dts but has no optional label property defined in the dts, in which case it an empty string "" (a default) is returned.
3. The channel is not defined in the dts (in_voltagex_labelis still visible in the sysfs), and reading the label will cause "(null)\n" to be printed in the console (as indicated also by Sashiko boot), since the default "" value is not assigned duringdevice_for_each_child_node_scoped(). I think this is not an issue since is just the waysysfs_emit()handles an NULL string.
Quoted 4 lines
My initial version (v1) handeled all 3 cases, for case 2 and 3, an empty string "" was printed out.
What would you prefer? Any further suggestions?
We should implement it like all of the other drivers that implement labels. I did not see any that have an empty string, so we should not do that. The sysfs attribute returns -EINVAL when read if there is not a label.
(I think my previous comment was ambiguous. I was not suggesting that we return -EINVAL from probe.)
Quoted 9 lines
Best regards,
Flaviu NistorQuoted 5 lines
Quoted 1 line
Quoted 1 line
(quoted diff) +1
-0+ }Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v2 2/2] iio: adc: ti-ads1015: Add support for label
In reply to Flaviu NistorQuoted 1 line · Flaviu Nistor
On Thu, Sep 3, 2026 at 9:18 AM, Andy Shevchenko wrote:
...
Quoted 8 lines
Since the iio core exposes in sysfs the
in_volatagex_labelfor all channels, there are 3 situations:3. The channel is not defined in the dts (
in_voltagex_labelis still visible in the sysfs), and reading the label will cause "(null)\n" to be printed in the console (as indicated also by Sashiko boot), since the default "" value is not assigned duringdevice_for_each_child_node_scoped(). I think this is not an issue since is just the waysysfs_emit()handles an NULL string.
Is this current state of affairs?
If so, the patch must not change that — it's an ABI now and (null) is valid response from the user space point of view.
Quoted 1 line
What would you prefer? Any further suggestions?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH v2 2/2] iio: adc: ti-ads1015: Add support for label
Quoted 14 lines · On Thu, 3 Sep 2026 22:03:55 +0300 Andy Shevchenko…
Quoted 1 line · Flaviu Nistor
On Thu, Sep 3, 2026 at 9:18 AM, Andy Shevchenko wrote:
...
Quoted 8 lines
Since the iio core exposes in sysfs the
in_volatagex_labelfor all channels, there are 3 situations:3. The channel is not defined in the dts (
in_voltagex_labelis still visible in the sysfs), and reading the label will cause "(null)\n" to be printed in the console (as indicated also by Sashiko boot), since the default "" value is not assigned duringdevice_for_each_child_node_scoped(). I think this is not an issue since is just the waysysfs_emit()handles an NULL string.
Quoted 7 lines
Is this current state of affairs?
If so, the patch must not change that — it's an ABI now and (null) is valid response from the user space point of view.
Quoted 1 line
What would you prefer? Any further suggestions?
Unfortunately we never defined what should happen this way explicitly. In practice assumption is that this is a corner case we probably won't see. People don't tend to want to label just one random pin, they tend to label the lot.
So go with whatever is most common in other drivers,
Jonathan
Re: [PATCH v2 2/2] iio: adc: ti-ads1015: Add support for label
Quoted 4 lines · Jonathan Cameron
Quoted 1 line · On Thu, 3 Sep 2026 22:03:55 +0300 Andy Shevchenko…
On Thu, Sep 03, 2026 at 06:16:27PM +0300, Flaviu Nistor wrote:
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
On Thu, Sep 3, 2026 at 9:18 AM, Andy Shevchenko wrote: =20
=20
...
=20Quoted 2 lines
Since the iio core exposes in sysfs the
in_volatagex_labelfor all channels, there are 3 situations: =20=20
Quoted 1 line
3. The channel is not defined in the dts (
in_voltagex_labelis still vi=
sible
Quoted 15 lines
Quoted 1 line
Quoted 1 line
in the sysfs), and reading the label will cause "(null)\n" to be printe=
d in
Quoted 1 line
Quoted 1 line
the console (as indicated also by Sashiko boot), since the default "" v=
alue
Quoted 1 line
Quoted 1 line
is not assigned during
device_for_each_child_node_scoped(). I think thi=s is
Quoted 1 line
Quoted 1 line
not an issue since is just the way
sysfs_emit()handles an NULL string.==20
Quoted 4 lines
=20
Is this current state of affairs?
=20
If so, the patch must not change that =E2=80=94 it's an ABI now and (null=) is valid
Quoted 2 lines
response from the user space point of view.
=20
Quoted 9 lines
Quoted 2 lines
Quoted 1 line
What would you prefer? Any further suggestions? =20
=20
Unfortunately we never defined what should happen this way explicitly. In practice assumption is that this is a corner case we probably won't see. People don't tend to want to label just one random pin, they tend to label the lot. =20
So go with whatever is most common in other drivers,
Hello, I took some time and went through all of the drivers that use read_label() to get the most common solution. Most of the drivers only use datasheet_name and only a few actually get the label (if present) from the device tree during probe. I now have the best solution (from my point of view), which covers all (3) cases. If the label string is present in the device tree it will be use and printed in the console in user space. If label not present or channel is not defined at all in the dts, the datasheet_name will be used similar to most drivers. I will send a v3.
PS: many thanks for everybody for pushing for a better solution.
Best regards,
Flaviu
Quoted 1 line
Jonathan
David Lechner
reviewerQuoted 14 lines · Flaviu Nistor
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.
Signed-off-by Flaviu Nistor <[email protected]>--- Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +0
-0
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml patternProperties: · line 73
Quoted 8 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +5
-0@@ -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". +
Apparently this chip has quite old dt-bindings. Normally, we would have included adc.yaml to get this and other channel properties.
And we would have used diff-channels and single-channel from that to describe which pins are associated with which channel rather than having a magic number for reg. And the ti,datarate looks suspicious as sampling frequency is usually we control at runtime.
Anyway, none of that is really relevant to this patch. We'll see what Jonathan says about using adc.yaml here vs. adding a label property.
Quoted 11 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +1
-0ti,gain: $ref: /schemas/types.yaml#/definitions/uint32 minimum: 0@@ -125,6 +130,7 @@ examples: reg = <4>; ti,gain = <3>; ti,datarate = <5>; + label = "CH3"; }; }; };
Quoted 27 lines · David Lechner
Quoted 14 lines · Flaviu Nistor
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.
Signed-off-by Flaviu Nistor <[email protected]>--- Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +0
-0Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml patternProperties: · line 73
Quoted 8 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +5
-0@@ -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". +Apparently this chip has quite old dt-bindings. Normally, we would have included
adc.yamlto get this and other channel properties.
Quoted 8 lines
And we would have used diff-channels and single-channel from that to describe which pins are associated with which channel rather than having a magic number for reg. And the ti,datarate looks suspicious as sampling frequency is usually we control at runtime.
Anyway, none of that is really relevant to this patch. We'll see what Jonathan says about using
adc.yamlhere vs. adding a label property.
Thanks for your feedback. I can also use:
$ref: adc.yaml
unevaluatedProperties: false
and move additionalProperties: false at the end of patternProperties block. Any other idea?
Best regards,
Flaviu Nistor
Quoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +1
-0ti,gain: $ref: /schemas/types.yaml#/definitions/uint32 minimum: 0@@ -125,6 +130,7 @@ examples: reg = <4>; ti,gain = <3>; ti,datarate = <5>; + label = "CH3"; }; }; };
David Lechner
reviewerQuoted 37 lines · Flaviu Nistor
Quoted 27 lines · David Lechner
Quoted 14 lines · Flaviu Nistor
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.
Signed-off-by Flaviu Nistor <[email protected]>--- Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +0
-0Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml patternProperties: · line 73
Quoted 8 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +5
-0@@ -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". +Apparently this chip has quite old dt-bindings. Normally, we would have included
adc.yamlto get this and other channel properties.Quoted 8 lines
And we would have used diff-channels and single-channel from that to describe which pins are associated with which channel rather than having a magic number for reg. And the ti,datarate looks suspicious as sampling frequency is usually we control at runtime.
Anyway, none of that is really relevant to this patch. We'll see what Jonathan says about using
adc.yamlhere vs. adding a label property.
Quoted 6 lines
Thanks for your feedback. I can also use:
$ref:
adc.yaml
unevaluatedProperties: falseand move additionalProperties: false at the end of patternProperties block.
It can't have both unevaluatedProperties and additionalProperties (hopefully the dt_binding_check would catch that).
Quoted 16 lines
Any other idea?
Best regards,
Flaviu NistorQuoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +1
-0ti,gain: $ref: /schemas/types.yaml#/definitions/uint32 minimum: 0@@ -125,6 +130,7 @@ examples: reg = <4>; ti,gain = <3>; ti,datarate = <5>; + label = "CH3"; }; }; };
Jonathan Cameron
maintainerQuoted 20 lines · On Thu, 3 Sep 2026 10:30:01 -0500 David Lechner <[email protected]> wrote:
Quoted 19 lines · Flaviu Nistor
Quoted 18 lines · David Lechner
Quoted 17 lines · Flaviu Nistor
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.
Signed-off-by Flaviu Nistor <[email protected]>--- Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +0
-0@@ -66,6 +66,11 @@ patternProperties: - minimum: 0 maximum: 7
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml patternProperties: · line 73
Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +5
-0+ label: + $ref: /schemas/types.yaml#/definitions/string + description: + A descriptive name for this channel, like "vcc_ram" or "CH3". +Apparently this chip has quite old dt-bindings. Normally, we would have included
adc.yamlto get this and other channel properties.
Quite a lot of bindings predate that generalization work :(
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
And we would have used diff-channels and single-channel from that to describe which pins are associated with which channel rather than having a magic number for reg. And the ti,datarate looks suspicious as sampling frequency is usually we control at runtime.
Anyway, none of that is really relevant to this patch. We'll see what Jonathan says about using
adc.yamlhere vs. adding a label property.
Given it's only a single property and label is pretty universal I'm fine with just adding it here without the reference to adc.yaml.
DT binding reviewers may disagree however!
J
Quoted 29 lines
Quoted 8 lines
Quoted 1 line
Thanks for your feedback. I can also use:
$ref:
adc.yaml
unevaluatedProperties: falseand move additionalProperties: false at the end of patternProperties block.
It can't have both unevaluatedProperties and additionalProperties (hopefully the
dt_binding_checkwould catch that).Quoted 16 lines
Any other idea?
Best regards,
Flaviu NistorQuoted 11 lines
Quoted 11 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +1
-0ti,gain: $ref: /schemas/types.yaml#/definitions/uint32 minimum: 0@@ -125,6 +130,7 @@ examples: reg = <4>; ti,gain = <3>; ti,datarate = <5>; + label = "CH3"; }; }; };
Quoted 40 lines · Jonathan Cameron
Quoted 20 lines · On Thu, 3 Sep 2026 10:30:01 -0500 David Lechner <[email protected]> wrote:
Quoted 19 lines · Flaviu Nistor
Quoted 18 lines · David Lechner
Quoted 17 lines · Flaviu Nistor
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.
Signed-off-by Flaviu Nistor <[email protected]>--- Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml | 6 ++++++ 1 file changed, 6 insertions(+)Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +0
-0@@ -66,6 +66,11 @@ patternProperties: - minimum: 0 maximum: 7Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml patternProperties: · line 73
Quoted 5 lines
Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml +5
-0+ label: + $ref: /schemas/types.yaml#/definitions/string + description: + A descriptive name for this channel, like "vcc_ram" or "CH3". +Apparently this chip has quite old dt-bindings. Normally, we would have included
adc.yamlto get this and other channel properties.Quite a lot of bindings predate that generalization work :(
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
And we would have used diff-channels and single-channel from that to describe which pins are associated with which channel rather than having a magic number for reg. And the ti,datarate looks suspicious as sampling frequency is usually we control at runtime.
Quoted 7 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Anyway, none of that is really relevant to this patch. We'll see what Jonathan says about using
adc.yamlhere vs. adding a label property.Given it's only a single property and label is pretty universal I'm fine with just adding it here without the reference to
adc.yaml.DT binding reviewers may disagree however!
Yeah, I see how adc.yaml could be used here, but then it should disallow "diff-channels" to be explicit, that old "reg" style is used, so maybye not worth the effort.
Best regards,
Krzysztof
Jonathan Cameron
maintainerQuoted 5 lines · On Wed, 2 Sep 2026 20:22:29 +0300 Flaviu Nistor <[email protected]>…
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.
Signed-off-by Flaviu Nistor <[email protected]>
Please always use a cover letter for multipatch series. Makes it easier to handle them with tooling and also provides a place for general comments etc.
Quoted 8 lines · Flaviu Nistor
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.
Signed-off-by Flaviu Nistor <[email protected]>--- Documentation/devicetree/bindings/iio/adc/ti,ads1015.yaml | 6 ++++++ 1 file changed, 6 insertions(+)
Best regards,
Krzysztof