power: supply: twl6030/32 charger
Subsystems (3)
v2 cover power: supply: twl6030/32 charger
Add basic support for the charger in the TWL6030/32. Supported is the USB path. AC path is not handled yet, also there is no entry yet in /sys/class/power_supply with type battery yet.
Without this series, devices will happily drain battery when running on mainline.
Changes in v2:
- s/bci/charger in mfd schema
- additionalProperties for charger node
- extended example in mfd schema
- no quotes for compatibles in charger schema
- no example in charger schema
- interrupt description in charger schema
- replace device_is_compatible by driver data
- clang compile fix
- removed alias
- style fixes
Andreas Kemnade (3):
dt-bindings: power: supply: Add TI TWL603X charger
dt-bindings: mfd: twl: add charger node also for TWL603x
power: supply: initial support for TWL6030/32
.../devicetree/bindings/mfd/ti,twl.yaml | 22 + .../power/supply/ti,twl6030-charger.yaml | 48 ++ drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/twl6030_charger.c | 580 ++++++++++++++++++ 5 files changed, 661 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/ti,twl6030-charger.yaml create mode 100644 drivers/power/supply/twl6030_charger.c
Signature · 1 line
2.39.2
PATCH v2 1/3 dt-bindings: power: supply: Add TI TWL603X charger
Use a fallback compatible since for especially for generic defensive setup of parameters, both 6030 and 6032 are the same and U-Boot actually uses a generic 6030/32 function to enable the charger.
--- .../power/supply/ti,twl6030-charger.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/ti,twl6030-charger.yaml
Documentation/devicetree/bindings/power/supply/ti,twl6030-charger.yaml new file +48 -0
@@ -0,0 +1,48 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/supply/ti,twl6030-charger.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: TWL6030/32 BCI (Battery Charger Interface) + +description: + The battery charger needs to be configured to do any charging besides of + precharging. The GPADC in the PMIC has to be used to get the related + voltages. + +maintainers: + - Andreas Kemnade <[email protected]> + +allOf: + - $ref: power-supply.yaml# + +properties: + compatible: + oneOf: + - const: ti,twl6030-charger + - items: + - const: ti,twl6032-charger + - const: ti,twl6030-charger + + interrupts: + items: + - description: Charger Control Interrupt + - description: Charger Fault Interrupt + + io-channels: + items: + - description: VBUS Voltage Channel + + io-channel-names: + items: + - const: vusb + + monitored-battery: true + +required: + - compatible + - interrupts + - monitored-battery + +additionalProperties: false
Signature · 1 line
2.39.2
Re: [PATCH v2 1/3] dt-bindings: power: supply: Add TI TWL603X charger
Quoted 10 lines · Andreas Kemnade
Use a fallback compatible since for especially for generic defensive setup of parameters, both 6030 and 6032 are the same and U-Boot actually uses a generic 6030/32 function to enable the charger.
Signed-off-by Andreas Kemnade <[email protected]>--- .../power/supply/ti,twl6030-charger.yaml | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/ti,twl6030-charger.yaml
Best regards,
Krzysztof
PATCH v2 2/3 dt-bindings: mfd: twl: add charger node also for TWL603x
In reply to Andreas KemnadeAlso the TWL603X devices have a charger, so allow to specify it here.
--- .../devicetree/bindings/mfd/ti,twl.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)
Documentation/devicetree/bindings/mfd/ti,twl.yaml +22 -0
@@ -105,6 +105,12 @@ allOf: regulator-initial-mode: false properties: + charger: + type: object + additionalProperties: true + properties: + compatible: + const: ti,twl6030-charger gpadc: type: object properties:
@@ -136,6 +142,14 @@ allOf: regulator-initial-mode: false properties: + charger: + type: object + additionalProperties: true + properties: + compatible: + items: + - const: ti,twl6032-charger + - const: ti,twl6030-charger gpadc: type: object properties:
@@ -222,6 +236,14 @@ examples: interrupt-controller; #interrupt-cells = <1>; + charger { + compatible = "ti,twl6030-charger"; + interrupts = <2>, <5>; + io-channels = <&gpadc 10>; + io-channel-names = "vusb"; + monitored-battery = <&bat>; + }; + gpadc { compatible = "ti,twl6030-gpadc"; interrupts = <6>;
Signature · 1 line
2.39.2
Re: [PATCH v2 2/3] dt-bindings: mfd: twl: add charger node also for TWL603x
Quoted 12 lines · Andreas Kemnade
Also the TWL603X devices have a charger, so allow to specify it here.
Signed-off-by Andreas Kemnade <[email protected]>--- .../devicetree/bindings/mfd/ti,twl.yaml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+)Documentation/devicetree/bindings/mfd/ti,twl.yaml +0
-0
Documentation/devicetree/bindings/mfd/ti,twl.yaml allOf: · line 108
Quoted 4 lines
Documentation/devicetree/bindings/mfd/ti,twl.yaml +1
-0@@ -105,6 +105,12 @@ allOf: regulator-initial-mode: false properties: + charger:
Properties should be defined in top-level, mot in allOf. You can disallow them for certain variants.
Best regards,
Krzysztof
PATCH v2 3/3 power: supply: initial support for TWL6030/32
In reply to Andreas KemnadeAdd a driver for the charger in the TWL6030/32. For now it does not report much in sysfs but parameters are set up for USB, charging is enabled with the specified parameters. It stops charging when full and also restarts charging.
This prevents ending up in a system setup where you run out of battery although a charger is plugged in after precharge completed.
Battery voltage behavior was checked via the GPADC.
--- drivers/power/supply/Kconfig | 10 + drivers/power/supply/Makefile | 1 + drivers/power/supply/twl6030_charger.c | 580 +++++++++++++++++++++++++ 3 files changed, 591 insertions(+) create mode 100644 drivers/power/supply/twl6030_charger.c
drivers/power/supply/Kconfig +10 -0
@@ -493,6 +493,16 @@ config CHARGER_TWL4030 help Say Y here to enable support for TWL4030 Battery Charge Interface. +config CHARGER_TWL6030 + tristate "OMAP TWL6030 BCI charger driver" + depends on IIO && TWL4030_CORE + help + Say Y here to enable support for TWL6030/6032 Battery Charge + Interface. + + This driver can be build as a module. If so, the module will be + called twl6030_charger. + config CHARGER_LP8727 tristate "TI/National Semiconductor LP8727 charger driver" depends on I2C
drivers/power/supply/Makefile +1 -0
@@ -69,6 +69,7 @@ obj-$(CONFIG_CHARGER_CPCAP) += cpcap-charger.o obj-$(CONFIG_CHARGER_ISP1704) += isp1704_charger.o obj-$(CONFIG_CHARGER_MAX8903) += max8903_charger.o obj-$(CONFIG_CHARGER_TWL4030) += twl4030_charger.o +obj-$(CONFIG_CHARGER_TWL6030) += twl6030_charger.o obj-$(CONFIG_CHARGER_LP8727) += lp8727_charger.o obj-$(CONFIG_CHARGER_LP8788) += lp8788-charger.o obj-$(CONFIG_CHARGER_GPIO) += gpio-charger.o
drivers/power/supply/twl6030_charger.c new file +580 -0
580 lines not on this page · raw message
Signature · 1 line
2.39.2