Add Richtek RT9471 3A battery charger support
Subsystems (2)
v2 cover Add Richtek RT9471 3A battery charger support
From: ChiYuan Huang <[email protected]>
This patch set is to add Richtek RT9471 charger support.
The RT9471/D is a highly-integrated 3A switch mode battery charge management and system power path management device for single cell Li-Ion and Li-polymer battery. The low impedance power path optimizes switch-mode operation efficiency, reduces battery charging time and extends battery life during discharging phase.
Since v2:
- Remove the properties for interrupt controller things in the binding documentation.
- Fix dtc error for typo, it's 'regulator-name', not 'regulator-compatible'.
- Add regulator min/max microamp to allow otg vbus current adjustable in example.
- Specify the active-level for charge-enable-gpios in binding example.
- Fix checkpatch error about 'foo * bar' to 'foo *bar' in psy_device_to_chip function.
- Specify the member name directly for the use of linear range.
ChiYuan Huang (2):
dt-bindings: power: supply: Add Richtek RT9471 battery charger
power: supply: rt9471: Add Richtek RT9471 charger driver
.../bindings/power/supply/richtek,rt9471.yaml | 73 ++ drivers/power/supply/Kconfig | 16 + drivers/power/supply/Makefile | 1 + drivers/power/supply/rt9471.c | 953 +++++++++++++++++++++ drivers/power/supply/rt9471.h | 76 ++ 5 files changed, 1119 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt9471.yaml create mode 100644 drivers/power/supply/rt9471.c create mode 100644 drivers/power/supply/rt9471.h
Signature · 1 line
2.7.4
PATCH v2 1/2 dt-bindings: power: supply: Add Richtek RT9471 battery charger
From: ChiYuan Huang <[email protected]>
Add bindings for the Richtek RT9471 I2C controlled battery charger.
---
Since v2
- Remove the properties for interrupt controller things in the binding documentation.
- Fix dtc error for typo, it's 'regulator-name', not 'regulator-compatible'.
- Add regulator min/max microamp to allow otg vbus current adjustable in example.
- Specify the active-level for charge-enable-gpios in binding example.
--- .../bindings/power/supply/richtek,rt9471.yaml | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt9471.yaml
Documentation/devicetree/bindings/power/supply/richtek,rt9471.yaml new file +73 -0
@@ -0,0 +1,73 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/supply/richtek,rt9471.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT9471 3A Single Cell Switching Battery charger + +maintainers: + - Alina Yu <[email protected]> + - ChiYuan Huang <[email protected]> + +description: | + RT9471 is a switch-mode single cell Li-Ion/Li-Polymer battery charger for + portable applications. It supports USB BC1.2 port detection, current and + voltage regulations in both charging and boost mode. + + Datasheet is available at + https://www.richtek.com/assets/product_file/RT9471=RT9471D/DS9471D-02.pdf + +properties: + compatible: + const: richtek,rt9471 + + reg: + maxItems: 1 + + charge-enable-gpios: + description: GPIO used to turn on and off charging. + maxItems: 1 + + wakeup-source: true + + interrupts: + maxItems: 1 + + usb-otg-vbus-regulator: + type: object + unevaluatedProperties: false + $ref: /schemas/regulator/regulator.yaml# + +required: + - compatible + - reg + - wakeup-source + - interrupts + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/gpio/gpio.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + charger@53 { + compatible = "richtek,rt9471"; + reg = <0x53>; + charge-enable-gpios = <&gpio26 1 GPIO_ACTIVE_LOW>; + wakeup-source; + interrupts-extended = <&gpio_intc 32 IRQ_TYPE_EDGE_FALLING>; + + usb-otg-vbus-regulator { + regulator-name = "usb-otg-vbus"; + regulator-min-microvolt = <4850000>; + regulator-max-microvolt = <5300000>; + regulator-min-microamp = <500000>; + regulator-max-microamp = <1200000>; + }; + }; + };
Signature · 1 line
2.7.4
Re: [PATCH v2 1/2] dt-bindings: power: supply: Add Richtek RT9471 battery charger
Quoted 55 lines · cy_huang
From: ChiYuan Huang <[email protected]>
Add bindings for the Richtek RT9471 I2C controlled battery charger.
Co-developed-by Alina Yu <[email protected]>Signed-off-by Alina Yu <[email protected]>Signed-off-by ChiYuan Huang <[email protected]>---
Since v2
- Remove the properties for interrupt controller things in the binding documentation.
- Fix dtc error for typo, it's 'regulator-name', not 'regulator-compatible'.
- Add regulator min/max microamp to allow otg vbus current adjustable in example.
- Specify the active-level for charge-enable-gpios in binding example.--- .../bindings/power/supply/richtek,rt9471.yaml | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt9471.yamlDocumentation/devicetree/bindings/power/supply/richtek,rt9471.yaml new file +30
-0@@ -0,0 +1,73 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/supply/richtek,rt9471.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT9471 3A Single Cell Switching Battery charger + +maintainers: + - Alina Yu <[email protected]> + - ChiYuan Huang <[email protected]> + +description: | + RT9471 is a switch-mode single cell Li-Ion/Li-Polymer battery charger for + portable applications. It supports USB BC1.2 port detection, current and + voltage regulations in both charging and boost mode. + + Datasheet is available at + https://www.richtek.com/assets/product_file/RT9471=RT9471D/DS9471D-02.pdf + +properties: + compatible: + const: richtek,rt9471 + + reg: + maxItems: 1 + + charge-enable-gpios: + description: GPIO used to turn on and off charging. + maxItems: 1
Documentation/devicetree/bindings/power/supply/richtek,rt9471.yaml line 40
Quoted 10 lines
Documentation/devicetree/bindings/power/supply/richtek,rt9471.yaml new file +10
-0+ + wakeup-source: true + + interrupts: + maxItems: 1 + + usb-otg-vbus-regulator: + type: object + unevaluatedProperties: false + $ref: /schemas/regulator/regulator.yaml#
ref goes before unevaluatedProperties (so one line up)
with above:
Best regards,
Krzysztof
PATCH v2 2/2 power: supply: rt9471: Add Richtek RT9471 charger driver
In reply to cy_huangFrom: ChiYuan Huang <[email protected]>
Add support for the RT9471 3A 1-Cell Li+ battery charger.
The RT9471 is a highly-integrated 3A switch mode battery charger with low impedance power path to better optimize the charging efficiency.
---
Since v2:
- Fix checkpatch error about 'foo * bar' to 'foo *bar' in psy_device_to_chip function.
- Specify the member name directly for the use of linear range.
--- drivers/power/supply/Kconfig | 16 + drivers/power/supply/Makefile | 1 + drivers/power/supply/rt9471.c | 953 ++++++++++++++++++++++++++++++++++++++++++ drivers/power/supply/rt9471.h | 76 ++++ 4 files changed, 1046 insertions(+) create mode 100644 drivers/power/supply/rt9471.c create mode 100644 drivers/power/supply/rt9471.h
drivers/power/supply/Kconfig +16 -0
@@ -772,6 +772,22 @@ config CHARGER_RT9455 help Say Y to enable support for Richtek RT9455 battery charger. +config CHARGER_RT9471 + tristate "Richtek RT9471 battery charger driver" + depends on I2C && GPIOLIB && REGULATOR + select REGMAP_I2C + select REGMAP_IRQ + select LINEAR_RANGES + help + This adds support for Richtek RT9471 battery charger. RT9471 is + highly-integrated switch mode battery charger which is system power + patch manageable device for single cell Li-Ion and Li-polymer battery. + It can support BC12 detection on DPDM, and current and voltage + regulation on both charging and boost mode. + + This driver can also be built as a module. If so, the module will be + called rt9471. + config CHARGER_CROS_USBPD tristate "ChromeOS EC based USBPD charger" depends on CROS_USBPD_NOTIFY
drivers/power/supply/Makefile +1 -0
@@ -57,6 +57,7 @@ obj-$(CONFIG_BATTERY_MAX1721X) += max1721x_battery.o obj-$(CONFIG_BATTERY_Z2) += z2_battery.o obj-$(CONFIG_BATTERY_RT5033) += rt5033_battery.o obj-$(CONFIG_CHARGER_RT9455) += rt9455_charger.o +obj-$(CONFIG_CHARGER_RT9471) += rt9471.o obj-$(CONFIG_BATTERY_S3C_ADC) += s3c_adc_battery.o obj-$(CONFIG_BATTERY_TWL4030_MADC) += twl4030_madc_battery.o obj-$(CONFIG_CHARGER_88PM860X) += 88pm860x_charger.o
drivers/power/supply/rt9471.c new file +953 -0
953 lines not on this page · raw message
drivers/power/supply/rt9471.h new file +76 -0
76 lines not on this page · raw message
Signature · 1 line
2.7.4