diff mbox series

[v1,2/4] dt-bindings: mfd: Document Infineon/Cypress CG7153AM MCU

Message ID 20250323071424.48779-3-clamor95@gmail.com (mailing list archive)
State Handled Elsewhere, archived
Headers show
Series power: supply: add support for Pegatron Chagall battery | expand

Commit Message

Svyatoslav Ryhel March 23, 2025, 7:14 a.m. UTC
Add binding for Cypress CG7153AM embedded controller. Pegatron implemented
a custom configuration of this MCU in their Chagall tablets, utilizing it
for battery monitoring.

Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
 .../bindings/mfd/cypress,cg7153am.yaml        | 55 +++++++++++++++++++
 1 file changed, 55 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml

Comments

Rob Herring (Arm) March 24, 2025, 4:52 p.m. UTC | #1
On Sun, Mar 23, 2025 at 09:14:22AM +0200, Svyatoslav Ryhel wrote:
> Add binding for Cypress CG7153AM embedded controller. Pegatron implemented
> a custom configuration of this MCU in their Chagall tablets, utilizing it
> for battery monitoring.
> 
> Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> ---
>  .../bindings/mfd/cypress,cg7153am.yaml        | 55 +++++++++++++++++++
>  1 file changed, 55 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> 
> diff --git a/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> new file mode 100644
> index 000000000000..f8469b5e3816
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> @@ -0,0 +1,55 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/mfd/cypress,cg7153am.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Infineon/Cypress Semicon CG7153AM Microcontroller
> +
> +maintainers:
> +  - Svyatoslav Ryhel <clamor95@gmail.com>
> +
> +description:
> +  The CG7153AM, an 8-bit programmable microcontroller from Infineon/Cypress
> +  Semiconductor, communicates over I2C and is implemented in devices like the
> +  Pegatron Chagall tablet for fuel gauge and battery control functions.
> +
> +$ref: /schemas/power/supply/power-supply.yaml
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - items:
> +          - enum:
> +              - pegatron,chagall-ec # Pegatron Chagall tablet device
> +          - const: cypress,cg7153am
> +      - items:
> +          const: cypress,cg7153am

Is this just some general purpose uC which could be used for anything 
and the interface exposed is Pegatron's invention. If so, then I'd drop 
the cypress,cg7153am compatible. What use would it be to software?

> +
> +  reg:
> +    maxItems: 1
> +
> +  monitored-battery: true
> +  power-supplies: true
> +
> +required:
> +  - compatible
> +  - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        embedded-controller@10 {
> +            compatible = "pegatron,chagall-ec", "cypress,cg7153am";
> +            reg = <0x10>;
> +
> +            monitored-battery = <&battery>;
> +            power-supplies = <&mains>;
> +        };
> +    };
> +...
> -- 
> 2.43.0
>
Svyatoslav Ryhel March 24, 2025, 5:05 p.m. UTC | #2
пн, 24 бер. 2025 р. о 18:52 Rob Herring <robh@kernel.org> пише:
>
> On Sun, Mar 23, 2025 at 09:14:22AM +0200, Svyatoslav Ryhel wrote:
> > Add binding for Cypress CG7153AM embedded controller. Pegatron implemented
> > a custom configuration of this MCU in their Chagall tablets, utilizing it
> > for battery monitoring.
> >
> > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > ---
> >  .../bindings/mfd/cypress,cg7153am.yaml        | 55 +++++++++++++++++++
> >  1 file changed, 55 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> > new file mode 100644
> > index 000000000000..f8469b5e3816
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> > @@ -0,0 +1,55 @@
> > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/mfd/cypress,cg7153am.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Infineon/Cypress Semicon CG7153AM Microcontroller
> > +
> > +maintainers:
> > +  - Svyatoslav Ryhel <clamor95@gmail.com>
> > +
> > +description:
> > +  The CG7153AM, an 8-bit programmable microcontroller from Infineon/Cypress
> > +  Semiconductor, communicates over I2C and is implemented in devices like the
> > +  Pegatron Chagall tablet for fuel gauge and battery control functions.
> > +
> > +$ref: /schemas/power/supply/power-supply.yaml
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - items:
> > +          - enum:
> > +              - pegatron,chagall-ec # Pegatron Chagall tablet device
> > +          - const: cypress,cg7153am
> > +      - items:
> > +          const: cypress,cg7153am
>
> Is this just some general purpose uC which could be used for anything
> and the interface exposed is Pegatron's invention. If so, then I'd drop
> the cypress,cg7153am compatible. What use would it be to software?
>

Yeah, Cypress made an MPU, Pegatron used it as a base to make a fuel gauge.

You propose smth like this?

      - items:
          - enum:
              - pegatron,chagall-ec # Pegatron Chagall tablet device
          - const: cypress,cg7153am

Without oneOf and second item or remove cypress,cg7153am entirely and
submit as pegatron,chagall-ec.yaml? Just to be clear.

I am fine with removing oneOf and items: const: cypress,cg7153am, but
I would like to preserve cypress,cg7153am as second compatible since
this is an actual MCU model.

Thanks.

> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  monitored-battery: true
> > +  power-supplies: true
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +unevaluatedProperties: false
> > +
> > +examples:
> > +  - |
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        embedded-controller@10 {
> > +            compatible = "pegatron,chagall-ec", "cypress,cg7153am";
> > +            reg = <0x10>;
> > +
> > +            monitored-battery = <&battery>;
> > +            power-supplies = <&mains>;
> > +        };
> > +    };
> > +...
> > --
> > 2.43.0
> >
Rob Herring (Arm) March 25, 2025, 2:59 a.m. UTC | #3
On Mon, Mar 24, 2025 at 12:06 PM Svyatoslav Ryhel <clamor95@gmail.com> wrote:
>
> пн, 24 бер. 2025 р. о 18:52 Rob Herring <robh@kernel.org> пише:
> >
> > On Sun, Mar 23, 2025 at 09:14:22AM +0200, Svyatoslav Ryhel wrote:
> > > Add binding for Cypress CG7153AM embedded controller. Pegatron implemented
> > > a custom configuration of this MCU in their Chagall tablets, utilizing it
> > > for battery monitoring.
> > >
> > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > ---
> > >  .../bindings/mfd/cypress,cg7153am.yaml        | 55 +++++++++++++++++++
> > >  1 file changed, 55 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> > > new file mode 100644
> > > index 000000000000..f8469b5e3816
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> > > @@ -0,0 +1,55 @@
> > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/mfd/cypress,cg7153am.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Infineon/Cypress Semicon CG7153AM Microcontroller
> > > +
> > > +maintainers:
> > > +  - Svyatoslav Ryhel <clamor95@gmail.com>
> > > +
> > > +description:
> > > +  The CG7153AM, an 8-bit programmable microcontroller from Infineon/Cypress
> > > +  Semiconductor, communicates over I2C and is implemented in devices like the
> > > +  Pegatron Chagall tablet for fuel gauge and battery control functions.
> > > +
> > > +$ref: /schemas/power/supply/power-supply.yaml
> > > +
> > > +properties:
> > > +  compatible:
> > > +    oneOf:
> > > +      - items:
> > > +          - enum:
> > > +              - pegatron,chagall-ec # Pegatron Chagall tablet device
> > > +          - const: cypress,cg7153am
> > > +      - items:
> > > +          const: cypress,cg7153am
> >
> > Is this just some general purpose uC which could be used for anything
> > and the interface exposed is Pegatron's invention. If so, then I'd drop
> > the cypress,cg7153am compatible. What use would it be to software?
> >
>
> Yeah, Cypress made an MPU, Pegatron used it as a base to make a fuel gauge.
>
> You propose smth like this?
>
>       - items:
>           - enum:
>               - pegatron,chagall-ec # Pegatron Chagall tablet device
>           - const: cypress,cg7153am
>
> Without oneOf and second item or remove cypress,cg7153am entirely and
> submit as pegatron,chagall-ec.yaml? Just to be clear.
>
> I am fine with removing oneOf and items: const: cypress,cg7153am, but
> I would like to preserve cypress,cg7153am as second compatible since
> this is an actual MCU model.

I would just drop the cypress compatible entirely. It needs to be
useful to a client (OS) in some way. If you said something like the
firmware downloading is defined by Cypress or some other feature, then
it would make sense. Otherwise, how this interface is implemented is
irrelevant. I can't think of any other embedded controller where we
have a compatible for the underlying MCU.

Rob
Svyatoslav Ryhel March 25, 2025, 6:57 a.m. UTC | #4
вт, 25 бер. 2025 р. о 05:00 Rob Herring <robh@kernel.org> пише:
>
> On Mon, Mar 24, 2025 at 12:06 PM Svyatoslav Ryhel <clamor95@gmail.com> wrote:
> >
> > пн, 24 бер. 2025 р. о 18:52 Rob Herring <robh@kernel.org> пише:
> > >
> > > On Sun, Mar 23, 2025 at 09:14:22AM +0200, Svyatoslav Ryhel wrote:
> > > > Add binding for Cypress CG7153AM embedded controller. Pegatron implemented
> > > > a custom configuration of this MCU in their Chagall tablets, utilizing it
> > > > for battery monitoring.
> > > >
> > > > Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
> > > > ---
> > > >  .../bindings/mfd/cypress,cg7153am.yaml        | 55 +++++++++++++++++++
> > > >  1 file changed, 55 insertions(+)
> > > >  create mode 100644 Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> > > >
> > > > diff --git a/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> > > > new file mode 100644
> > > > index 000000000000..f8469b5e3816
> > > > --- /dev/null
> > > > +++ b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
> > > > @@ -0,0 +1,55 @@
> > > > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> > > > +%YAML 1.2
> > > > +---
> > > > +$id: http://devicetree.org/schemas/mfd/cypress,cg7153am.yaml#
> > > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > > +
> > > > +title: Infineon/Cypress Semicon CG7153AM Microcontroller
> > > > +
> > > > +maintainers:
> > > > +  - Svyatoslav Ryhel <clamor95@gmail.com>
> > > > +
> > > > +description:
> > > > +  The CG7153AM, an 8-bit programmable microcontroller from Infineon/Cypress
> > > > +  Semiconductor, communicates over I2C and is implemented in devices like the
> > > > +  Pegatron Chagall tablet for fuel gauge and battery control functions.
> > > > +
> > > > +$ref: /schemas/power/supply/power-supply.yaml
> > > > +
> > > > +properties:
> > > > +  compatible:
> > > > +    oneOf:
> > > > +      - items:
> > > > +          - enum:
> > > > +              - pegatron,chagall-ec # Pegatron Chagall tablet device
> > > > +          - const: cypress,cg7153am
> > > > +      - items:
> > > > +          const: cypress,cg7153am
> > >
> > > Is this just some general purpose uC which could be used for anything
> > > and the interface exposed is Pegatron's invention. If so, then I'd drop
> > > the cypress,cg7153am compatible. What use would it be to software?
> > >
> >
> > Yeah, Cypress made an MPU, Pegatron used it as a base to make a fuel gauge.
> >
> > You propose smth like this?
> >
> >       - items:
> >           - enum:
> >               - pegatron,chagall-ec # Pegatron Chagall tablet device
> >           - const: cypress,cg7153am
> >
> > Without oneOf and second item or remove cypress,cg7153am entirely and
> > submit as pegatron,chagall-ec.yaml? Just to be clear.
> >
> > I am fine with removing oneOf and items: const: cypress,cg7153am, but
> > I would like to preserve cypress,cg7153am as second compatible since
> > this is an actual MCU model.
>
> I would just drop the cypress compatible entirely. It needs to be
> useful to a client (OS) in some way. If you said something like the
> firmware downloading is defined by Cypress or some other feature, then
> it would make sense. Otherwise, how this interface is implemented is
> irrelevant. I can't think of any other embedded controller where we
> have a compatible for the underlying MCU.
>

So I will move this schema to power supplies and name it
pegratron,chagall-ec.yaml along with suggested changes in the
compatible and descriptions.

> Rob
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
new file mode 100644
index 000000000000..f8469b5e3816
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/cypress,cg7153am.yaml
@@ -0,0 +1,55 @@ 
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/cypress,cg7153am.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Infineon/Cypress Semicon CG7153AM Microcontroller
+
+maintainers:
+  - Svyatoslav Ryhel <clamor95@gmail.com>
+
+description:
+  The CG7153AM, an 8-bit programmable microcontroller from Infineon/Cypress
+  Semiconductor, communicates over I2C and is implemented in devices like the
+  Pegatron Chagall tablet for fuel gauge and battery control functions.
+
+$ref: /schemas/power/supply/power-supply.yaml
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - pegatron,chagall-ec # Pegatron Chagall tablet device
+          - const: cypress,cg7153am
+      - items:
+          const: cypress,cg7153am
+
+  reg:
+    maxItems: 1
+
+  monitored-battery: true
+  power-supplies: true
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        embedded-controller@10 {
+            compatible = "pegatron,chagall-ec", "cypress,cg7153am";
+            reg = <0x10>;
+
+            monitored-battery = <&battery>;
+            power-supplies = <&mains>;
+        };
+    };
+...