Message ID | 20210312154357.1561730-9-sebastian.reichel@collabora.com |
---|---|
State | Accepted |
Commit | 464a74887167651c747b07cf087f39e5fdf9fc0c |
Headers | show |
Series | Convert power-supply DT bindings to YAML | expand |
On Fri, Mar 12, 2021 at 8:44 AM Sebastian Reichel <sebastian.reichel@collabora.com> wrote: > > Convert the binding to DT schema format. > > Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> > --- > .../bindings/power/supply/bq24735.yaml | 88 +++++++++++++++++++ > .../bindings/power/supply/ti,bq24735.txt | 39 -------- > 2 files changed, 88 insertions(+), 39 deletions(-) > create mode 100644 Documentation/devicetree/bindings/power/supply/bq24735.yaml > delete mode 100644 Documentation/devicetree/bindings/power/supply/ti,bq24735.txt > > diff --git a/Documentation/devicetree/bindings/power/supply/bq24735.yaml b/Documentation/devicetree/bindings/power/supply/bq24735.yaml > new file mode 100644 > index 000000000000..8a3a31ada128 > --- /dev/null > +++ b/Documentation/devicetree/bindings/power/supply/bq24735.yaml > @@ -0,0 +1,88 @@ > +# SPDX-License-Identifier: GPL-2.0 > +# Copyright (C) 2021 Sebastian Reichel > +%YAML 1.2 > +--- > +$id: "http://devicetree.org/schemas/power/supply/bq24735.yaml#" > +$schema: "http://devicetree.org/meta-schemas/core.yaml#" > + > +title: Binding for TI BQ24735 Li-Ion Battery Charger > + > +maintainers: > + - Sebastian Reichel <sre@kernel.org> > + > +allOf: > + - $ref: power-supply.yaml# > + > +properties: > + compatible: > + const: ti,bq24735 > + > + reg: > + maxItems: 1 > + > + interrupts: > + description: AC adapter plug event interrupt > + maxItems: 1 > + > + ti,ac-detect-gpios: > + maxItems: 1 > + description: | > + This GPIO is optionally used to read the AC adapter status. This is a Host GPIO > + that is configured as an input and connected to the ACOK pin on the bq24735. > + Note: for backwards compatibility reasons, the GPIO must be active on AC adapter > + absence despite ACOK being active (high) on AC adapter presence. > + > + ti,charge-current: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: | > + Used to control and set the charging current. > + This value must be between 128mA and 8.128A with a 64mA step resolution. > + The POR value is 0x0000h. This number is in mA (e.g. 8192). > + See spec for more information about the ChargeCurrent (0x14h) register. > + > + ti,charge-voltage: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: | > + Used to control and set the charging voltage. > + This value must be between 1.024V and 19.2V with a 16mV step resolution. > + The POR value is 0x0000h. This number is in mV (e.g. 19200). > + See spec for more information about the ChargeVoltage (0x15h) register. > + > + ti,input-current: > + $ref: /schemas/types.yaml#/definitions/uint32 > + description: | > + Used to control and set the charger input current. > + This value must be between 128mA and 8.064A with a 128mA step resolution. > + The POR value is 0x1000h. This number is in mA (e.g. 8064). > + See the spec for more information about the InputCurrent (0x3fh) register. > + > + ti,external-control: > + type: boolean > + description: | > + Indicates that the charger is configured externally and that the host should not > + attempt to enable/disable charging or set the charge voltage/current. > + > + poll-interval: > + description: | > + If 'interrupts' is not specified, poll AC adapter presence with this interval (milliseconds). Needs a type.
Hi, On Mon, Mar 15, 2021 at 12:24:09PM -0600, Rob Herring wrote: > On Fri, Mar 12, 2021 at 8:44 AM Sebastian Reichel > > + poll-interval: > > + description: | > > + If 'interrupts' is not specified, poll AC adapter presence with this interval (milliseconds). > > Needs a type. Ack. Just out of curiousity: Do you know why this was not pointed out by dt_binding_check? -- Sebastian
On Tue, Mar 16, 2021 at 10:22 AM Sebastian Reichel <sebastian.reichel@collabora.com> wrote: > > Hi, > > On Mon, Mar 15, 2021 at 12:24:09PM -0600, Rob Herring wrote: > > On Fri, Mar 12, 2021 at 8:44 AM Sebastian Reichel > > > + poll-interval: > > > + description: | > > > + If 'interrupts' is not specified, poll AC adapter presence with this interval (milliseconds). > > > > Needs a type. > > Ack. Just out of curiousity: Do you know why this was not pointed > out by dt_binding_check? There's not really any way we can because there's not a pattern to match on. So we'd have to do a specific meta-schema for 'poll-interval'. Though maybe we could restructure things to provide a meta-schema for anything that isn't a common, known property name or a vendor property. Rob
diff --git a/Documentation/devicetree/bindings/power/supply/bq24735.yaml b/Documentation/devicetree/bindings/power/supply/bq24735.yaml new file mode 100644 index 000000000000..8a3a31ada128 --- /dev/null +++ b/Documentation/devicetree/bindings/power/supply/bq24735.yaml @@ -0,0 +1,88 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2021 Sebastian Reichel +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/power/supply/bq24735.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: Binding for TI BQ24735 Li-Ion Battery Charger + +maintainers: + - Sebastian Reichel <sre@kernel.org> + +allOf: + - $ref: power-supply.yaml# + +properties: + compatible: + const: ti,bq24735 + + reg: + maxItems: 1 + + interrupts: + description: AC adapter plug event interrupt + maxItems: 1 + + ti,ac-detect-gpios: + maxItems: 1 + description: | + This GPIO is optionally used to read the AC adapter status. This is a Host GPIO + that is configured as an input and connected to the ACOK pin on the bq24735. + Note: for backwards compatibility reasons, the GPIO must be active on AC adapter + absence despite ACOK being active (high) on AC adapter presence. + + ti,charge-current: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Used to control and set the charging current. + This value must be between 128mA and 8.128A with a 64mA step resolution. + The POR value is 0x0000h. This number is in mA (e.g. 8192). + See spec for more information about the ChargeCurrent (0x14h) register. + + ti,charge-voltage: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Used to control and set the charging voltage. + This value must be between 1.024V and 19.2V with a 16mV step resolution. + The POR value is 0x0000h. This number is in mV (e.g. 19200). + See spec for more information about the ChargeVoltage (0x15h) register. + + ti,input-current: + $ref: /schemas/types.yaml#/definitions/uint32 + description: | + Used to control and set the charger input current. + This value must be between 128mA and 8.064A with a 128mA step resolution. + The POR value is 0x1000h. This number is in mA (e.g. 8064). + See the spec for more information about the InputCurrent (0x3fh) register. + + ti,external-control: + type: boolean + description: | + Indicates that the charger is configured externally and that the host should not + attempt to enable/disable charging or set the charge voltage/current. + + poll-interval: + description: | + If 'interrupts' is not specified, poll AC adapter presence with this interval (milliseconds). + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + charger@9 { + compatible = "ti,bq24735"; + reg = <0x9>; + ti,ac-detect-gpios = <&gpio 72 0x1>; + }; + }; diff --git a/Documentation/devicetree/bindings/power/supply/ti,bq24735.txt b/Documentation/devicetree/bindings/power/supply/ti,bq24735.txt deleted file mode 100644 index de45e1a2a4d9..000000000000 --- a/Documentation/devicetree/bindings/power/supply/ti,bq24735.txt +++ /dev/null @@ -1,39 +0,0 @@ -TI BQ24735 Charge Controller -~~~~~~~~~~ - -Required properties : - - compatible : "ti,bq24735" - -Optional properties : - - interrupts : Specify the interrupt to be used to trigger when the AC - adapter is either plugged in or removed. - - ti,ac-detect-gpios : This GPIO is optionally used to read the AC adapter - status. This is a Host GPIO that is configured as an input and connected - to the ACOK pin on the bq24735. Note: for backwards compatibility reasons, - the GPIO must be active on AC adapter absence despite ACOK being active - (high) on AC adapter presence. - - ti,charge-current : Used to control and set the charging current. This value - must be between 128mA and 8.128A with a 64mA step resolution. The POR value - is 0x0000h. This number is in mA (e.g. 8192), see spec for more information - about the ChargeCurrent (0x14h) register. - - ti,charge-voltage : Used to control and set the charging voltage. This value - must be between 1.024V and 19.2V with a 16mV step resolution. The POR value - is 0x0000h. This number is in mV (e.g. 19200), see spec for more information - about the ChargeVoltage (0x15h) register. - - ti,input-current : Used to control and set the charger input current. This - value must be between 128mA and 8.064A with a 128mA step resolution. The - POR value is 0x1000h. This number is in mA (e.g. 8064), see the spec for - more information about the InputCurrent (0x3fh) register. - - ti,external-control : Indicates that the charger is configured externally - and that the host should not attempt to enable/disable charging or set the - charge voltage/current. - - poll-interval : In case 'interrupts' is not specified, poll AC adapter - presence with this interval (milliseconds). - -Example: - - bq24735@9 { - compatible = "ti,bq24735"; - reg = <0x9>; - ti,ac-detect-gpios = <&gpio 72 0x1>; - }
Convert the binding to DT schema format. Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com> --- .../bindings/power/supply/bq24735.yaml | 88 +++++++++++++++++++ .../bindings/power/supply/ti,bq24735.txt | 39 -------- 2 files changed, 88 insertions(+), 39 deletions(-) create mode 100644 Documentation/devicetree/bindings/power/supply/bq24735.yaml delete mode 100644 Documentation/devicetree/bindings/power/supply/ti,bq24735.txt