2023-09-14 08:03:59

by Matyas, Daniel

[permalink] [raw]
Subject: [PATCH v3 2/5] dt-bindings: hwmon: Add possible new properties to max31827 bindings

These modify the corresponding bits in the configuration register.

adi,comp-int is a hardware property, because it affects the behavior
of the interrupt signal and whatever it is connected to.

adi,timeout-enable is a hardware property, because it affects i2c
bus operation.

Signed-off-by: Daniel Matyas <[email protected]>
---

v2 -> v3: Changed commit subject and message

v1 -> v2: Added adi,timeout-enable property to binding. Fixed
dt_binding_check errors.

.../bindings/hwmon/adi,max31827.yaml | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)

diff --git a/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
index 2dc8b07b4d3b..6bde71bdb8dd 100644
--- a/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
+++ b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
@@ -32,6 +32,37 @@ properties:
Must have values in the interval (1.6V; 3.6V) in order for the device to
function correctly.

+ adi,comp-int:
+ description:
+ If present interrupt mode is used. If not present comparator mode is used
+ (default).
+ type: boolean
+
+ adi,alrm-pol:
+ description:
+ Sets the alarms active state.
+ - 0 = active low
+ - 1 = active high
+ For max31827 and max31828 the default alarm polarity is low. For max31829
+ it is high.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [0, 1]
+
+ adi,flt-q:
+ description:
+ Select how many consecutive temperature faults must occur before
+ overtemperature or undertemperature faults are indicated in the
+ corresponding status bits.
+ For max31827 default fault queue is 1. For max31828 and max31829 it is 4.
+ $ref: /schemas/types.yaml#/definitions/uint32
+ enum: [1, 2, 4, 8]
+
+ adi,timeout-enable:
+ description:
+ Enables timeout. Bus timeout resets the I2C-compatible interface when SCL
+ is low for more than 30ms (nominal).
+ type: boolean
+
required:
- compatible
- reg
@@ -49,6 +80,10 @@ examples:
compatible = "adi,max31827";
reg = <0x42>;
vref-supply = <&reg_vdd>;
+ adi,comp-int;
+ adi,alrm-pol = <0>;
+ adi,flt-q = <1>;
+ adi,timeout-enable;
};
};
...
--
2.34.1


2023-09-14 14:45:26

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v3 2/5] dt-bindings: hwmon: Add possible new properties to max31827 bindings

On Thu, Sep 14, 2023 at 10:59:45AM +0300, Daniel Matyas wrote:
> These modify the corresponding bits in the configuration register.
>
> adi,comp-int is a hardware property, because it affects the behavior
> of the interrupt signal and whatever it is connected to.
>
> adi,timeout-enable is a hardware property, because it affects i2c
> bus operation.
>
> Signed-off-by: Daniel Matyas <[email protected]>
> ---
>
> v2 -> v3: Changed commit subject and message
>
> v1 -> v2: Added adi,timeout-enable property to binding. Fixed
> dt_binding_check errors.
>
> .../bindings/hwmon/adi,max31827.yaml | 35 +++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
> index 2dc8b07b4d3b..6bde71bdb8dd 100644
> --- a/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
> @@ -32,6 +32,37 @@ properties:
> Must have values in the interval (1.6V; 3.6V) in order for the device to
> function correctly.
>
> + adi,comp-int:
> + description:
> + If present interrupt mode is used. If not present comparator mode is used
> + (default).
> + type: boolean
> +
> + adi,alrm-pol:

Characters are not at a premium, is there a reason not to use the full
words? "flt-q" in particular would be quite cryptic if I saw it in a
dts.

> + description:
> + Sets the alarms active state.
> + - 0 = active low
> + - 1 = active high
> + For max31827 and max31828 the default alarm polarity is low. For max31829
> + it is high.

This constraint can be expressed in the binding, rather than in free
form text like done here. Ditto below.

Thanks,
Conor.

> + $ref: /schemas/types.yaml#/definitions/uint32
> + enum: [0, 1]
> +
> + adi,flt-q:
> + description:
> + Select how many consecutive temperature faults must occur before
> + overtemperature or undertemperature faults are indicated in the
> + corresponding status bits.
> + For max31827 default fault queue is 1. For max31828 and max31829 it is 4.
> + $ref: /schemas/types.yaml#/definitions/uint32
> + enum: [1, 2, 4, 8]
> +
> + adi,timeout-enable:
> + description:
> + Enables timeout. Bus timeout resets the I2C-compatible interface when SCL
> + is low for more than 30ms (nominal).
> + type: boolean
> +
> required:
> - compatible
> - reg
> @@ -49,6 +80,10 @@ examples:
> compatible = "adi,max31827";
> reg = <0x42>;
> vref-supply = <&reg_vdd>;
> + adi,comp-int;
> + adi,alrm-pol = <0>;
> + adi,flt-q = <1>;
> + adi,timeout-enable;
> };
> };
> ...
> --
> 2.34.1
>


Attachments:
(No filename) (2.87 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-15 16:07:27

by Conor Dooley

[permalink] [raw]
Subject: Re: [PATCH v3 2/5] dt-bindings: hwmon: Add possible new properties to max31827 bindings

On Fri, Sep 15, 2023 at 03:31:13PM +0000, Matyas, Daniel wrote:
> > -----Original Message-----
> > From: Conor Dooley <[email protected]>
> > On Thu, Sep 14, 2023 at 10:59:45AM +0300, Daniel Matyas wrote:

> > > + adi,alrm-pol:
> >
> > Characters are not at a premium, is there a reason not to use the full
> > words? "flt-q" in particular would be quite cryptic if I saw it in a dts.
> >
> > > + description:
> > > + Sets the alarms active state.
> > > + - 0 = active low
> > > + - 1 = active high
> > > + For max31827 and max31828 the default alarm polarity is low. For
> > max31829
> > > + it is high.
> >
> > This constraint can be expressed in the binding, rather than in free form
> > text like done here. Ditto below.

> Ok, but how? The default values are different depending on the compatible string. I searched for similar examples, but I found nothing...
>
> Some bindings use 'default: ' to declare the default values, but this is the default for every chip.

Something like
allOf:
- if:
properties:
compatible:
contains:
const: adi,max31829
then:
properties:
adi,alrm-pol:
default: 1
else:
properties:
adi,alrm-pol:
default: 0

Cheers,
Conor.


Attachments:
(No filename) (1.31 kB)
signature.asc (235.00 B)
Download all attachments

2023-09-15 17:32:59

by Matyas, Daniel

[permalink] [raw]
Subject: RE: [PATCH v3 2/5] dt-bindings: hwmon: Add possible new properties to max31827 bindings



> -----Original Message-----
> From: Conor Dooley <[email protected]>
> Sent: Thursday, September 14, 2023 5:42 PM
> To: Matyas, Daniel <[email protected]>
> Cc: Jean Delvare <[email protected]>; Guenter Roeck <linux@roeck-
> us.net>; Rob Herring <[email protected]>; Krzysztof Kozlowski
> <[email protected]>; Conor Dooley
> <[email protected]>; Jonathan Corbet <[email protected]>; linux-
> [email protected]; [email protected]; linux-
> [email protected]; [email protected]
> Subject: Re: [PATCH v3 2/5] dt-bindings: hwmon: Add possible new
> properties to max31827 bindings
>
> [External]
>
> On Thu, Sep 14, 2023 at 10:59:45AM +0300, Daniel Matyas wrote:
> > These modify the corresponding bits in the configuration register.
> >
> > adi,comp-int is a hardware property, because it affects the behavior
> > of the interrupt signal and whatever it is connected to.
> >
> > adi,timeout-enable is a hardware property, because it affects i2c bus
> > operation.
> >
> > Signed-off-by: Daniel Matyas <[email protected]>
> > ---
> >
> > v2 -> v3: Changed commit subject and message
> >
> > v1 -> v2: Added adi,timeout-enable property to binding. Fixed
> > dt_binding_check errors.
> >
> > .../bindings/hwmon/adi,max31827.yaml | 35
> +++++++++++++++++++
> > 1 file changed, 35 insertions(+)
> >
> > diff --git
> a/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
> > b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
> > index 2dc8b07b4d3b..6bde71bdb8dd 100644
> > --- a/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
> > +++ b/Documentation/devicetree/bindings/hwmon/adi,max31827.yaml
> > @@ -32,6 +32,37 @@ properties:
> > Must have values in the interval (1.6V; 3.6V) in order for the device
> to
> > function correctly.
> >
> > + adi,comp-int:
> > + description:
> > + If present interrupt mode is used. If not present comparator mode
> is used
> > + (default).
> > + type: boolean
> > +
> > + adi,alrm-pol:
>
> Characters are not at a premium, is there a reason not to use the full
> words? "flt-q" in particular would be quite cryptic if I saw it in a dts.
>
> > + description:
> > + Sets the alarms active state.
> > + - 0 = active low
> > + - 1 = active high
> > + For max31827 and max31828 the default alarm polarity is low. For
> max31829
> > + it is high.
>
> This constraint can be expressed in the binding, rather than in free form
> text like done here. Ditto below.
>
> Thanks,
> Conor.
>

Ok, but how? The default values are different depending on the compatible string. I searched for similar examples, but I found nothing...

Some bindings use 'default: ' to declare the default values, but this is the default for every chip.

Kind regards,
Daniel

> > + $ref: /schemas/types.yaml#/definitions/uint32
> > + enum: [0, 1]
> > +
> > + adi,flt-q:
> > + description:
> > + Select how many consecutive temperature faults must occur before
> > + overtemperature or undertemperature faults are indicated in the
> > + corresponding status bits.
> > + For max31827 default fault queue is 1. For max31828 and
> max31829 it is 4.
> > + $ref: /schemas/types.yaml#/definitions/uint32
> > + enum: [1, 2, 4, 8]
> > +
> > + adi,timeout-enable:
> > + description:
> > + Enables timeout. Bus timeout resets the I2C-compatible interface
> when SCL
> > + is low for more than 30ms (nominal).
> > + type: boolean
> > +
> > required:
> > - compatible
> > - reg
> > @@ -49,6 +80,10 @@ examples:
> > compatible = "adi,max31827";
> > reg = <0x42>;
> > vref-supply = <&reg_vdd>;
> > + adi,comp-int;
> > + adi,alrm-pol = <0>;
> > + adi,flt-q = <1>;
> > + adi,timeout-enable;
> > };
> > };
> > ...
> > --
> > 2.34.1
> >