diff mbox series

[v11,3/9] dt-bindings: power: supply: max17042: split on 2 files

Message ID 20241209-starqltechn_integration_upstream-v11-3-dc0598828e01@gmail.com (mailing list archive)
State Superseded
Headers show
Series Add support for Maxim Integrated MAX77705 PMIC | expand

Commit Message

Dzmitry Sankouski Dec. 9, 2024, 11:26 a.m. UTC
Move max17042 common binding part to separate file, to
reuse it for MFDs with platform driver version.

Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
---
 Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml      | 49 +------------------------------------------------
 MAINTAINERS                                                             |  2 +-
 3 files changed, 68 insertions(+), 49 deletions(-)

Comments

Rob Herring Dec. 9, 2024, 12:40 p.m. UTC | #1
On Mon, 09 Dec 2024 14:26:27 +0300, Dzmitry Sankouski wrote:
> Move max17042 common binding part to separate file, to
> reuse it for MFDs with platform driver version.
> 
> Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> ---
>  Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml      | 49 +------------------------------------------------
>  MAINTAINERS                                                             |  2 +-
>  3 files changed, 68 insertions(+), 49 deletions(-)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/power/supply/maxim,max17042.example.dtb: battery@36: 'reg' does not match any of the regexes: 'pinctrl-[0-9]+'
	from schema $id: http://devicetree.org/schemas/power/supply/maxim,max17042-base.yaml#

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20241209-starqltechn_integration_upstream-v11-3-dc0598828e01@gmail.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
Krzysztof Kozlowski Dec. 10, 2024, 7:38 a.m. UTC | #2
On Mon, Dec 09, 2024 at 02:26:27PM +0300, Dzmitry Sankouski wrote:
> Move max17042 common binding part to separate file, to
> reuse it for MFDs with platform driver version.
> 
> Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> ---
>  Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml      | 49 +------------------------------------------------
>  MAINTAINERS                                                             |  2 +-
>  3 files changed, 68 insertions(+), 49 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml
> new file mode 100644
> index 000000000000..1653f8ae11f7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml
> @@ -0,0 +1,66 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/supply/maxim,max17042-base.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Maxim 17042 fuel gauge series
> +
> +maintainers:
> +  - Sebastian Reichel <sre@kernel.org>
> +
> +allOf:
> +  - $ref: power-supply.yaml#
> +
> +properties:
> +  compatible:
> +    enum:
> +      - maxim,max17042
> +      - maxim,max17047
> +      - maxim,max17050
> +      - maxim,max17055
> +      - maxim,max77705-battery
> +      - maxim,max77849-battery

Shared schemas define only shared properties, not compatibles. But the
main problem is you did not answer nor resolve my previous concerns -
either this device has separate address and probably is a separate
device on the same or different bus.

Plus this was not tested and does not really work, but anyway let's
focus on my previous concerns first.

> +
> +  interrupts:
> +    maxItems: 1
> +    description: |
> +      The ALRT pin, an open-drain interrupt.

...

> +
> +additionalProperties: false
> +
> diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml
> index 14242de7fc08..b7fd714cc72e 100644
> --- a/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml
> @@ -10,60 +10,13 @@ maintainers:
>    - Sebastian Reichel <sre@kernel.org>
>  
>  allOf:
> -  - $ref: power-supply.yaml#
> +  - $ref: maxim,max17042-base.yaml#
>  
>  properties:
> -  compatible:
> -    enum:
> -      - maxim,max17042
> -      - maxim,max17047
> -      - maxim,max17050
> -      - maxim,max17055
> -      - maxim,max77705-battery
> -      - maxim,max77849-battery
> -

This does not make sense. Final device schema must come with compatibles.

Best regards,
Krzysztof
Dzmitry Sankouski Dec. 11, 2024, 2:59 p.m. UTC | #3
вт, 10 дек. 2024 г. в 10:38, Krzysztof Kozlowski <krzk@kernel.org>:
>
> On Mon, Dec 09, 2024 at 02:26:27PM +0300, Dzmitry Sankouski wrote:
> > Move max17042 common binding part to separate file, to
> > reuse it for MFDs with platform driver version.
> >
> > Signed-off-by: Dzmitry Sankouski <dsankouski@gmail.com>
> > ---
> >  Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml      | 49 +------------------------------------------------
> >  MAINTAINERS                                                             |  2 +-
> >  3 files changed, 68 insertions(+), 49 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml
> > new file mode 100644
> > index 000000000000..1653f8ae11f7
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml
> > @@ -0,0 +1,66 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/power/supply/maxim,max17042-base.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Maxim 17042 fuel gauge series
> > +
> > +maintainers:
> > +  - Sebastian Reichel <sre@kernel.org>
> > +
> > +allOf:
> > +  - $ref: power-supply.yaml#
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - maxim,max17042
> > +      - maxim,max17047
> > +      - maxim,max17050
> > +      - maxim,max17055
> > +      - maxim,max77705-battery
> > +      - maxim,max77849-battery
>
> Shared schemas define only shared properties, not compatibles. But the
> main problem is you did not answer nor resolve my previous concerns -
> either this device has separate address and probably is a separate
> device on the same or different bus.
>
> Plus this was not tested and does not really work, but anyway let's
> focus on my previous concerns first.
>

Ah, indeed, the device tree in this and previous patches doesn't
reflect hardware wiring.

MAX77705 fuel gauge has a separate i2c address, i.e. I may move it out of the
MAX77705 MFD node. However, the device on that address has additional features,
like measuring system and input current, which is out of fuel gauge
responsibility.

So I guess I should create another MFD for fuel gauge, i. e. max77705 example
would look like:

...
  pmic@66 {
    compatible = "maxim,max77705";
...
  };

  meter@36 {
    compatible = "maxim,max77705-meter";

    // max17042 fuel gauge driver in platform mode
    fuel-gauge {
      power-supplies = <&max77705_charger>;
      maxim,rsns-microohm = <5000>;
      interrupt-parent = <&pm8998_gpios>;
      interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
    };
  };
Krzysztof Kozlowski Dec. 18, 2024, 7:56 a.m. UTC | #4
On 11/12/2024 15:59, Dzmitry Sankouski wrote:
> Ah, indeed, the device tree in this and previous patches doesn't
> reflect hardware wiring.
> 
> MAX77705 fuel gauge has a separate i2c address, i.e. I may move it out of the
> MAX77705 MFD node. However, the device on that address has additional features,
> like measuring system and input current, which is out of fuel gauge
> responsibility.

This is fuel gauge job.

> 
> So I guess I should create another MFD for fuel gauge, i. e. max77705 example
> would look like:
> 
> ...
>   pmic@66 {
>     compatible = "maxim,max77705";
> ...
>   };
> 
>   meter@36 {
>     compatible = "maxim,max77705-meter";
> 
No resources here, so not a MFD. This is one device.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml
new file mode 100644
index 000000000000..1653f8ae11f7
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/maxim,max17042-base.yaml
@@ -0,0 +1,66 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/maxim,max17042-base.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Maxim 17042 fuel gauge series
+
+maintainers:
+  - Sebastian Reichel <sre@kernel.org>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    enum:
+      - maxim,max17042
+      - maxim,max17047
+      - maxim,max17050
+      - maxim,max17055
+      - maxim,max77705-battery
+      - maxim,max77849-battery
+
+  interrupts:
+    maxItems: 1
+    description: |
+      The ALRT pin, an open-drain interrupt.
+
+  maxim,rsns-microohm:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Resistance of rsns resistor in micro Ohms (datasheet-recommended value is 10000).
+      Defining this property enables current-sense functionality.
+
+  maxim,cold-temp:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Temperature threshold to report battery as cold (in tenths of degree Celsius).
+      Default is not to report cold events.
+
+  maxim,over-heat-temp:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Temperature threshold to report battery as over heated (in tenths of degree Celsius).
+      Default is not to report over heating events.
+
+  maxim,dead-volt:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Voltage threshold to report battery as dead (in mV).
+      Default is not to report dead battery events.
+
+  maxim,over-volt:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      Voltage threshold to report battery as over voltage (in mV).
+      Default is not to report over-voltage events.
+
+  power-supplies: true
+
+required:
+  - compatible
+
+additionalProperties: false
+
diff --git a/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml
index 14242de7fc08..b7fd714cc72e 100644
--- a/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml
+++ b/Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml
@@ -10,60 +10,13 @@  maintainers:
   - Sebastian Reichel <sre@kernel.org>
 
 allOf:
-  - $ref: power-supply.yaml#
+  - $ref: maxim,max17042-base.yaml#
 
 properties:
-  compatible:
-    enum:
-      - maxim,max17042
-      - maxim,max17047
-      - maxim,max17050
-      - maxim,max17055
-      - maxim,max77705-battery
-      - maxim,max77849-battery
-
   reg:
     maxItems: 1
 
-  interrupts:
-    maxItems: 1
-    description: |
-      The ALRT pin, an open-drain interrupt.
-
-  maxim,rsns-microohm:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description: |
-      Resistance of rsns resistor in micro Ohms (datasheet-recommended value is 10000).
-      Defining this property enables current-sense functionality.
-
-  maxim,cold-temp:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description: |
-      Temperature threshold to report battery as cold (in tenths of degree Celsius).
-      Default is not to report cold events.
-
-  maxim,over-heat-temp:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description: |
-      Temperature threshold to report battery as over heated (in tenths of degree Celsius).
-      Default is not to report over heating events.
-
-  maxim,dead-volt:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description: |
-      Voltage threshold to report battery as dead (in mV).
-      Default is not to report dead battery events.
-
-  maxim,over-volt:
-    $ref: /schemas/types.yaml#/definitions/uint32
-    description: |
-      Voltage threshold to report battery as over voltage (in mV).
-      Default is not to report over-voltage events.
-
-  power-supplies: true
-
 required:
-  - compatible
   - reg
 
 additionalProperties: false
diff --git a/MAINTAINERS b/MAINTAINERS
index 7700208f6ccf..cd5532afbfe4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -14157,7 +14157,7 @@  R:	Sebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
 R:	Purism Kernel Team <kernel@puri.sm>
 L:	linux-pm@vger.kernel.org
 S:	Maintained
-F:	Documentation/devicetree/bindings/power/supply/maxim,max17042.yaml
+F:	Documentation/devicetree/bindings/power/supply/maxim,max17042*.yaml
 F:	drivers/power/supply/max17042_battery.c
 
 MAXIM MAX20086 CAMERA POWER PROTECTOR DRIVER