From: Alexandru Tachici <[email protected]>
This aims to replace use of num property from dt nodes with
reg property both in dt bindings and driver and fix
dt bindings errors.
1. read from fwnode reg property instead of num property
2. replace num property with reg property and fix dt
bindings errors
Changelog v1 -> v2:
- replaced "oneOf:" with items for adi,range-microamp
- added reg allowed values to each channel
Alexandru Tachici (2):
iio: dac: ad5770r: read channel nr from reg
dt-bindings: iio: dac: AD5570R fix bindings errors
.../bindings/iio/dac/adi,ad5770r.yaml | 82 +++++++++----------
drivers/iio/dac/ad5770r.c | 2 +-
2 files changed, 40 insertions(+), 44 deletions(-)
--
2.20.1
From: Alexandru Tachici <[email protected]>
Replaced num property with reg property, fixed errors
reported by dt-binding-check.
Fixes: ea52c21268e6 ("iio: dac: ad5770r: Add AD5770R support")
Signed-off-by: Alexandru Tachici <[email protected]>
---
.../bindings/iio/dac/adi,ad5770r.yaml | 82 +++++++++----------
1 file changed, 39 insertions(+), 43 deletions(-)
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
index d9c25cf4b92f..87e9b2802013 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5770r.yaml
@@ -2,7 +2,7 @@
# Copyright 2020 Analog Devices Inc.
%YAML 1.2
---
-$id: http://devicetree.org/schemas/bindings/iio/dac/adi,ad5770r.yaml#
+$id: http://devicetree.org/schemas/iio/dac/adi,ad5770r.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Analog Devices AD5770R DAC device driver
@@ -49,83 +49,77 @@ properties:
asserted during driver probe.
maxItems: 1
- channel0:
+ channel@0:
description: Represents an external channel which are
connected to the DAC. Channel 0 can act both as a current
source and sink.
type: object
properties:
- num:
+ reg:
description: This represents the channel number.
- items:
- const: 0
+ const: 0
adi,range-microamp:
description: Output range of the channel.
oneOf:
- - $ref: /schemas/types.yaml#/definitions/int32-array
- items:
- - enum: [0 300000]
- - enum: [-60000 0]
- - enum: [-60000 300000]
+ - const: 0
+ - const: 300000
+ - items:
+ - const: -60000
+ - const: 0
+ - items:
+ - const: -60000
+ - const: 300000
- channel1:
+ channel@1:
description: Represents an external channel which are
connected to the DAC.
type: object
properties:
- num:
+ reg:
description: This represents the channel number.
- items:
- const: 1
+ const: 1
adi,range-microamp:
description: Output range of the channel.
- oneOf:
- - $ref: /schemas/types.yaml#/definitions/uint32-array
- - items:
- - enum: [0 140000]
- - enum: [0 250000]
+ items:
+ - const: 0
+ - enum: [ 140000, 250000 ]
- channel2:
+ channel@2:
description: Represents an external channel which are
connected to the DAC.
type: object
properties:
- num:
+ reg:
description: This represents the channel number.
- items:
- const: 2
+ const: 2
adi,range-microamp:
description: Output range of the channel.
- oneOf:
- - $ref: /schemas/types.yaml#/definitions/uint32-array
- - items:
- - enum: [0 140000]
- - enum: [0 250000]
+ items:
+ - const: 0
+ - enum: [ 55000, 150000 ]
patternProperties:
"^channel@([3-5])$":
type: object
description: Represents the external channels which are connected to the DAC.
properties:
- num:
+ reg:
description: This represents the channel number.
- items:
- minimum: 3
- maximum: 5
+ minimum: 3
+ maximum: 5
adi,range-microamp:
description: Output range of the channel.
- oneOf:
- - $ref: /schemas/types.yaml#/definitions/uint32-array
- - items:
- - enum: [0 45000]
- - enum: [0 100000]
+ items:
+ - const: 0
+ - enum: [ 45000, 100000 ]
required:
- reg
@@ -150,34 +144,36 @@ examples:
vref-supply = <&vref>;
adi,external-resistor;
reset-gpios = <&gpio 22 0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
channel@0 {
- num = <0>;
- adi,range-microamp = <(-60000) 300000>;
+ reg = <0>;
+ adi,range-microamp = <0 300000>;
};
channel@1 {
- num = <1>;
+ reg = <1>;
adi,range-microamp = <0 140000>;
};
channel@2 {
- num = <2>;
+ reg = <2>;
adi,range-microamp = <0 55000>;
};
channel@3 {
- num = <3>;
+ reg = <3>;
adi,range-microamp = <0 45000>;
};
channel@4 {
- num = <4>;
+ reg = <4>;
adi,range-microamp = <0 45000>;
};
channel@5 {
- num = <5>;
+ reg = <5>;
adi,range-microamp = <0 45000>;
};
};
--
2.20.1
From: Alexandru Tachici <[email protected]>
Read channel number from the reg property of each child
node.
Fixes: cbbb819837f6 ("iio: dac: ad5770r: Add AD5770R support")
Signed-off-by: Alexandru Tachici <[email protected]>
---
drivers/iio/dac/ad5770r.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ad5770r.c b/drivers/iio/dac/ad5770r.c
index a98ea76732e7..6302f11551d4 100644
--- a/drivers/iio/dac/ad5770r.c
+++ b/drivers/iio/dac/ad5770r.c
@@ -522,7 +522,7 @@ static int ad5770r_channel_config(struct ad5770r_state *st)
return -EINVAL;
device_for_each_child_node(&st->spi->dev, child) {
- ret = fwnode_property_read_u32(child, "num", &num);
+ ret = fwnode_property_read_u32(child, "reg", &num);
if (ret)
return ret;
if (num > AD5770R_MAX_CHANNELS)
--
2.20.1
On Thu, 16 Apr 2020 14:58:48 +0300, <[email protected]> wrote:
> From: Alexandru Tachici <[email protected]>
>
> Replaced num property with reg property, fixed errors
> reported by dt-binding-check.
>
> Fixes: ea52c21268e6 ("iio: dac: ad5770r: Add AD5770R support")
> Signed-off-by: Alexandru Tachici <[email protected]>
> ---
> .../bindings/iio/dac/adi,ad5770r.yaml | 82 +++++++++----------
> 1 file changed, 39 insertions(+), 43 deletions(-)
>
Applied, thanks.
Rob
On Thu, 16 Apr 2020 14:58:47 +0300
<[email protected]> wrote:
> From: Alexandru Tachici <[email protected]>
>
> Read channel number from the reg property of each child
> node.
>
> Fixes: cbbb819837f6 ("iio: dac: ad5770r: Add AD5770R support")
> Signed-off-by: Alexandru Tachici <[email protected]>
This one is awkwardly timed - I'll be doing a fixes pull request shortly
then advance my fixes branch to include the patch this fixes.
Please poke me if I look like I've forgotten it!
Now we are out of sync with the bindings but as long as we get the fix
in before the release that shouldn't really matter to anyone.
Thanks,
Jonathan
> ---
> drivers/iio/dac/ad5770r.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/dac/ad5770r.c b/drivers/iio/dac/ad5770r.c
> index a98ea76732e7..6302f11551d4 100644
> --- a/drivers/iio/dac/ad5770r.c
> +++ b/drivers/iio/dac/ad5770r.c
> @@ -522,7 +522,7 @@ static int ad5770r_channel_config(struct ad5770r_state *st)
> return -EINVAL;
>
> device_for_each_child_node(&st->spi->dev, child) {
> - ret = fwnode_property_read_u32(child, "num", &num);
> + ret = fwnode_property_read_u32(child, "reg", &num);
> if (ret)
> return ret;
> if (num > AD5770R_MAX_CHANNELS)