From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Sebastian Reichel <sre@kernel.org>, Rob Herring <robh+dt@kernel.org>
Cc: linux-pm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel@collabora.com,
Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: [PATCHv1 2/2] dt-bindings: power: supply: gpio-charger: convert to yaml
Date: Wed, 13 May 2020 13:56:01 +0200 [thread overview]
Message-ID: <20200513115601.360642-2-sebastian.reichel@collabora.com> (raw)
In-Reply-To: <20200513115601.360642-1-sebastian.reichel@collabora.com>
Convert the gpio-charger bindings from text format to
new YAML based representation.
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
.../bindings/power/supply/gpio-charger.txt | 38 ----------
.../bindings/power/supply/gpio-charger.yaml | 75 +++++++++++++++++++
2 files changed, 75 insertions(+), 38 deletions(-)
delete mode 100644 Documentation/devicetree/bindings/power/supply/gpio-charger.txt
create mode 100644 Documentation/devicetree/bindings/power/supply/gpio-charger.yaml
diff --git a/Documentation/devicetree/bindings/power/supply/gpio-charger.txt b/Documentation/devicetree/bindings/power/supply/gpio-charger.txt
deleted file mode 100644
index dbfd29029f69..000000000000
--- a/Documentation/devicetree/bindings/power/supply/gpio-charger.txt
+++ /dev/null
@@ -1,38 +0,0 @@
-gpio-charger
-
-Required properties :
- - compatible : "gpio-charger"
- - charger-type : power supply type, one of
- unknown
- battery
- ups
- mains
- usb-sdp (USB standard downstream port)
- usb-dcp (USB dedicated charging port)
- usb-cdp (USB charging downstream port)
- usb-aca (USB accessory charger adapter)
-
-Optional properties:
- - gpios : GPIO indicating the charger presence.
- See GPIO binding in bindings/gpio/gpio.txt .
- - charge-status-gpios: GPIO indicating whether a battery is charging.
- - charge-current-limit-gpios: Output GPIOs specifiers for limiting the charge current
- - charge-current-limit-mapping: List of touples with current in uA and a GPIO bitmap (in this order).
- The GPIOs are encoded in the same order as specified in charge-current-limit-gpios.
- The touples must be provided in descending order of the current limit.
-
-Example:
-
- usb_charger: charger {
- compatible = "gpio-charger";
- charger-type = "usb-sdp";
- gpios = <&gpd 28 GPIO_ACTIVE_LOW>;
- charge-status-gpios = <&gpc 27 GPIO_ACTIVE_LOW>;
-
- charge-current-limit-gpios = <&gpioA 11 GPIO_ACTIVE_HIGH>, <&gpioA 12 GPIO_ACTIVE_HIGH>;
- charge-current-limit-mapping = <2500000 0x00>, <700000 0x01>, <0 0x02>;
- };
-
- battery {
- power-supplies = <&usb_charger>;
- };
diff --git a/Documentation/devicetree/bindings/power/supply/gpio-charger.yaml b/Documentation/devicetree/bindings/power/supply/gpio-charger.yaml
new file mode 100644
index 000000000000..14fb3e54f861
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/gpio-charger.yaml
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/gpio-charger.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: simple battery chargers only communicating through GPIOs
+
+maintainers:
+ - Sebastian Reichel <sre@kernel.org>
+
+description: |
+ This binding is for all chargers, which are working more
+ or less autonomously, only providing some status GPIOs
+ and possibly some GPIOs for limited control over the
+ charging process.
+
+properties:
+ compatible:
+ const: gpio-charger
+
+ charger-type:
+ oneOf:
+ - const: unknown
+ - const: battery
+ - const: ups
+ - const: mains
+ - const: usb-sdp # USB standard downstream port
+ - const: usb-dcp # USB dedicated charging port
+ - const: usb-cdp # USB charging downstream port
+ - const: usb-aca # USB accessory charger adapter
+
+ gpios:
+ maxItems: 1
+ description: GPIO indicating the charger presence
+
+ charge-status-gpios:
+ maxItems: 1
+ description: GPIO indicating the charging status
+
+ charge-current-limit-gpios:
+ minItems: 1
+ maxItems: 32
+ description: GPIOs used for current limiting
+
+ charge-current-limit-mapping:
+ description: List of touples with current in uA and a GPIO bitmap (in
+ this order). The GPIOs are encoded in the same order as specified in
+ charge-current-limit-gpios. The touples must be provided in descending
+ order of the current limit.
+ $ref: "/meta-schemas/cell.yaml#array"
+
+required:
+ - compatible
+additionalProperties: false
+
+dependencies:
+ charge-current-limit-gpios: [ charge-current-limit-mapping ]
+ charge-current-limit-mapping: [ charge-current-limit-gpios ]
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ charger {
+ compatible = "gpio-charger";
+ charger-type = "usb-sdp";
+
+ gpios = <&gpd 28 GPIO_ACTIVE_LOW>;
+ charge-status-gpios = <&gpc 27 GPIO_ACTIVE_LOW>;
+
+ charge-current-limit-gpios = <&gpioA 11 GPIO_ACTIVE_HIGH>,
+ <&gpioA 12 GPIO_ACTIVE_HIGH>;
+ charge-current-limit-mapping = <2500000 0x00>, <700000 0x01>, <0 0x02>;
+ };
--
2.26.2
next prev parent reply other threads:[~2020-05-13 11:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 11:56 [PATCHv1 1/2] power: supply: gpio-charger: add charge-current-limit feature Sebastian Reichel
2020-05-13 11:56 ` Sebastian Reichel [this message]
2020-05-28 2:06 ` [PATCHv1 2/2] dt-bindings: power: supply: gpio-charger: convert to yaml Rob Herring
2020-05-15 13:24 ` [PATCHv1 1/2] power: supply: gpio-charger: add charge-current-limit feature Emil Velikov
2020-05-28 1:56 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200513115601.360642-2-sebastian.reichel@collabora.com \
--to=sebastian.reichel@collabora.com \
--cc=devicetree@vger.kernel.org \
--cc=kernel@collabora.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).