2020-08-23 14:11:41

by Dmitry Osipenko

[permalink] [raw]
Subject: [PATCH v1 5/6] dt-bindings: mfd: ene-kb3930: Document power-supplies and monitored-battery properties

Battery could be connected to the controller and in this case controller
will provide a battery-monitor function.

The power-supplies phandle property is needed in order to describe the
power supply which is used for charging of the battery, this allows to
determine whither battery is charging or discharging, depending on the
supply state.

The monitored-battery phandle provides information about the battery cell
characteristics.

Signed-off-by: Dmitry Osipenko <[email protected]>
---
.../devicetree/bindings/mfd/ene-kb3930.yaml | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/Documentation/devicetree/bindings/mfd/ene-kb3930.yaml b/Documentation/devicetree/bindings/mfd/ene-kb3930.yaml
index 5a1c4a959d9c..435728054f3a 100644
--- a/Documentation/devicetree/bindings/mfd/ene-kb3930.yaml
+++ b/Documentation/devicetree/bindings/mfd/ene-kb3930.yaml
@@ -29,6 +29,8 @@ properties:
description: GPIO used with the shutdown protocol on Ariel
maxItems: 2

+ monitored-battery: true
+ power-supplies: true
system-power-controller: true

required:
@@ -41,6 +43,19 @@ examples:
- |
#include <dt-bindings/gpio/gpio.h>

+ battery: battery-cell {
+ compatible = "simple-battery";
+ charge-full-design-microamp-hours = <3260000>;
+ energy-full-design-microwatt-hours = <24000000>;
+ operating-range-celsius = <0 40>;
+ };
+
+ mains: ac-adapter {
+ compatible = "gpio-charger";
+ charger-type = "mains";
+ gpios = <&gpio 125 GPIO_ACTIVE_LOW>;
+ };
+
i2c {
#address-cells = <1>;
#size-cells = <0>;
@@ -52,6 +67,9 @@ examples:

off-gpios = <&gpio 126 GPIO_ACTIVE_HIGH>,
<&gpio 127 GPIO_ACTIVE_HIGH>;
+
+ monitored-battery = <&battery>;
+ power-supplies = <&mains>;
};
};

--
2.27.0


2020-08-23 18:26:25

by Lubomir Rintel

[permalink] [raw]
Subject: Re: [PATCH v1 5/6] dt-bindings: mfd: ene-kb3930: Document power-supplies and monitored-battery properties

Hi,

On Sun, Aug 23, 2020 at 05:08:45PM +0300, Dmitry Osipenko wrote:
> Battery could be connected to the controller and in this case controller
> will provide a battery-monitor function.
>
> The power-supplies phandle property is needed in order to describe the
> power supply which is used for charging of the battery, this allows to
> determine whither battery is charging or discharging, depending on the
> supply state.
>
> The monitored-battery phandle provides information about the battery cell
> characteristics.

I believe it would be better if you created a new binding document
instead of reusing this one -- the hardware part iseems to be a
different one and the firmware it runs seems to be behaving totally
differently than the usual ENE firmware [1].

[1] This eneec.c seems to be coming from ENE, so I'm assuming it's a
good enough description of how their firmware behaves:
https://git.kernel.org/pub/scm/linux/kernel/git/lkundrak/linux-mmp3-dell-ariel.git/tree/drivers/input/serio/eneec.c

Cheers
Lubo

> Signed-off-by: Dmitry Osipenko <[email protected]>
> ---
> .../devicetree/bindings/mfd/ene-kb3930.yaml | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mfd/ene-kb3930.yaml b/Documentation/devicetree/bindings/mfd/ene-kb3930.yaml
> index 5a1c4a959d9c..435728054f3a 100644
> --- a/Documentation/devicetree/bindings/mfd/ene-kb3930.yaml
> +++ b/Documentation/devicetree/bindings/mfd/ene-kb3930.yaml
> @@ -29,6 +29,8 @@ properties:
> description: GPIO used with the shutdown protocol on Ariel
> maxItems: 2
>
> + monitored-battery: true
> + power-supplies: true
> system-power-controller: true
>
> required:
> @@ -41,6 +43,19 @@ examples:
> - |
> #include <dt-bindings/gpio/gpio.h>
>
> + battery: battery-cell {
> + compatible = "simple-battery";
> + charge-full-design-microamp-hours = <3260000>;
> + energy-full-design-microwatt-hours = <24000000>;
> + operating-range-celsius = <0 40>;
> + };
> +
> + mains: ac-adapter {
> + compatible = "gpio-charger";
> + charger-type = "mains";
> + gpios = <&gpio 125 GPIO_ACTIVE_LOW>;
> + };
> +
> i2c {
> #address-cells = <1>;
> #size-cells = <0>;
> @@ -52,6 +67,9 @@ examples:
>
> off-gpios = <&gpio 126 GPIO_ACTIVE_HIGH>,
> <&gpio 127 GPIO_ACTIVE_HIGH>;
> +
> + monitored-battery = <&battery>;
> + power-supplies = <&mains>;
> };
> };
>
> --
> 2.27.0
>