From: Thomas Antoine <t.antoine@uclouvain.be>
The max77759 is an IC used to manage the power supply of the battery and
the USB-C. Based on drivers from google, it contains at least a PMIC, a
fuel gauge, a TCPCI and a charger.
Use max77759-fg compatible to avoid conflict with drivers for other
functions.
The max77759 has no non-volatile memory so it doesn't require an address
and instead requires a value for the current sensing resistor.
Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
---
.../bindings/power/supply/maxim,max17201.yaml | 56 +++++++++++++++++-----
1 file changed, 43 insertions(+), 13 deletions(-)
diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml
index fe3dd9bd5585618e45220c51023391a5b21acfd2..7e95314508c27d0d90ea92f61bca6b4a2fe0e88e 100644
--- a/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml
+++ b/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml
@@ -9,31 +9,61 @@ title: Maxim MAX17201 fuel gauge
maintainers:
- Dimitri Fedrau <dima.fedrau@gmail.com>
-allOf:
- - $ref: power-supply.yaml#
-
properties:
compatible:
oneOf:
- const: maxim,max17201
+ - const: maxim,max77759-fg
- items:
- enum:
- maxim,max17205
- const: maxim,max17201
- reg:
- items:
- - description: ModelGauge m5 registers
- - description: Nonvolatile registers
-
- reg-names:
- items:
- - const: m5
- - const: nvmem
-
interrupts:
maxItems: 1
+allOf:
+ - $ref: power-supply.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - maxim,max17201
+ then:
+ properties:
+ reg:
+ items:
+ - description: ModelGauge m5 registers
+ - description: Nonvolatile registers
+ minItems: 1
+
+ reg-names:
+ items:
+ - const: m5
+ - const: nvmem
+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - maxim,max77759-fg
+ then:
+ properties:
+ reg:
+ items:
+ - description: ModelGauge m5 registers
+
+ reg-names:
+ items:
+ - const: m5
+
+ shunt-resistor-micro-ohms:
+ description: The value of current sense resistor.
+
+ required:
+ - shunt-resistor-micro-ohms
+
required:
- compatible
- reg
--
2.47.1
On 02/01/2025 12:15, Thomas Antoine via B4 Relay wrote: > From: Thomas Antoine <t.antoine@uclouvain.be> > > The max77759 is an IC used to manage the power supply of the battery and Still not the name I asked to use. > the USB-C. Based on drivers from google, it contains at least a PMIC, a > fuel gauge, a TCPCI and a charger. > > Use max77759-fg compatible to avoid conflict with drivers for other > functions. > > The max77759 has no non-volatile memory so it doesn't require an address > and instead requires a value for the current sensing resistor. > > Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be> > --- > .../bindings/power/supply/maxim,max17201.yaml | 56 +++++++++++++++++----- > 1 file changed, 43 insertions(+), 13 deletions(-) > > diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml > index fe3dd9bd5585618e45220c51023391a5b21acfd2..7e95314508c27d0d90ea92f61bca6b4a2fe0e88e 100644 > --- a/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml > +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17201.yaml > @@ -9,31 +9,61 @@ title: Maxim MAX17201 fuel gauge > maintainers: > - Dimitri Fedrau <dima.fedrau@gmail.com> > > -allOf: > - - $ref: power-supply.yaml# > - > properties: > compatible: > oneOf: > - const: maxim,max17201 > + - const: maxim,max77759-fg > - items: > - enum: > - maxim,max17205 > - const: maxim,max17201 > > - reg: > - items: > - - description: ModelGauge m5 registers > - - description: Nonvolatile registers Widest constraints always stay here. See: https://elixir.bootlin.com/linux/v6.11-rc6/source/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml#L127 I did not say to remove it. I asked you to add allOf section restricting it. > - > - reg-names: > - items: > - - const: m5 > - - const: nvmem > - > interrupts: > maxItems: 1 > > +allOf: This goes after required: block. See example-schema. > + - $ref: power-supply.yaml# > + - if: Best regards, Krzysztof
On 1/2/25 17:08, Krzysztof Kozlowski wrote: > On 02/01/2025 12:15, Thomas Antoine via B4 Relay wrote: >> From: Thomas Antoine <t.antoine@uclouvain.be> >> >> The max77759 is an IC used to manage the power supply of the battery and > > Still not the name I asked to use. Indeed, I missed that, I will fix this. [...] >> -allOf: >> - - $ref: power-supply.yaml# >> - >> properties: >> compatible: >> oneOf: >> - const: maxim,max17201 >> + - const: maxim,max77759-fg >> - items: >> - enum: >> - maxim,max17205 >> - const: maxim,max17201 >> >> - reg: >> - items: >> - - description: ModelGauge m5 registers >> - - description: Nonvolatile registers > > Widest constraints always stay here. > > See: > https://elixir.bootlin.com/linux/v6.11-rc6/source/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml#L127 > > I did not say to remove it. I asked you to add allOf section restricting it. Thanks for the example. I think I understand now. I will put the reg section back and use min/maxItems in the allOf:if: to set the number of reg/reg-names to 1 for the MAX77759. Do I keep shunt-resistor-micro-ohms as I did it here? I could move it in properties: and only make it required by the max77759 in the allOf:if:. However, I think this would make it seem as if the MAX17201 optionally accepts it when it would do nothing in practice so I'm not sure what is the best choice. >> - >> - reg-names: >> - items: >> - - const: m5 >> - - const: nvmem >> - >> interrupts: >> maxItems: 1 >> >> +allOf: > > This goes after required: block. See example-schema. > >> + - $ref: power-supply.yaml# >> + - if: > Best regards, > Krzysztof Will fix. Best regards, Thomas
On 03/01/2025 17:16, Thomas Antoine wrote: >>> - reg: >>> - items: >>> - - description: ModelGauge m5 registers >>> - - description: Nonvolatile registers >> >> Widest constraints always stay here. >> >> See: >> https://elixir.bootlin.com/linux/v6.11-rc6/source/Documentation/devicetree/bindings/ufs/qcom,ufs.yaml#L127 >> >> I did not say to remove it. I asked you to add allOf section restricting it. > > Thanks for the example. I think I understand now. I will put the reg section > back and use min/maxItems in the allOf:if: to set the number of reg/reg-names > to 1 for the MAX77759. > > Do I keep shunt-resistor-micro-ohms as I did it here? I could move it in Depends, where does it come from? What does the other referenced schema say? Best regards, Krzysztof
© 2016 - 2026 Red Hat, Inc.