Add Richtek RT9467 5A Battery Charger support
Subsystems (2)
v2 cover Add Richtek RT9467 5A Battery Charger support
From: ChiaEn Wu <[email protected]>
This patch set is to add Richtek RT9467 5A Battery Charger support.
RT9467 is a switch-mode single cell Li-Ion/Li-Polymer battery charger for portable applications.
It integrates a synchronous PWM controller, power MOSFETs, input current sensing and regulation, high-accuracy voltage regulation, and charge termination. The charge current is regulated through integrated sensing resistors.
The RT9467 also features USB On-The-Go (OTG) support. It also integrates D+/D- pin for USB host/charging port detection.
This charger driver is based on a 'linear_ranger' queued patch which adds 'LINEAR_RANGE_IDX' macro for declaring the linear_range struct simply.
https://lore.kernel.org/all/[email protected]/
Thank you,
ChiaEn Wu
---
Change in v2:
- In Patch 1/3 (dt-bindings: RT9467 Charger DTS)
- Revise the definition of 'enable-gpios'
- Revise the node name to generic name in the example ('rt9467@5b' --> 'charger@5b')
- Revise the example usage of 'charge-enable-gpios' with GPIO flags
- In Patch 2/3 (power: supply: RT9467 Charger Driver)
- Add missing header file <linux/bitfied.h>
- Add new header files <linux/sysfs.h> and <linux/kstrtox.h> for adding 'sysoff' sysfs feature
- Add assign 'rt9467_sysfs_groups' to '.attr_grp' of psy config
- Remove unused varible 'rt9467_port_stat_names[]'
- In Patch 3/3 (ABI Documentation for RT9467 sysfs attribute)
- New file since v2 patchset
ChiaEn Wu (3):
dt-bindings: power: supply: Add Richtek RT9467 battery charger
power: supply: rt9467: Add Richtek RT9467 charger driver
Documentation: power: rt9467: Document exported sysfs entries
Documentation/ABI/testing/sysfs-class-power-rt9467 | 19 + .../power/supply/richtek,rt9467-charger.yaml | 82 ++ drivers/power/supply/Kconfig | 19 + drivers/power/supply/Makefile | 1 + drivers/power/supply/rt9467-charger.c | 1282 ++++++++++++++++++++ 5 files changed, 1403 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-power-rt9467 create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt9467-charger.yaml create mode 100644 drivers/power/supply/rt9467-charger.c
Signature · 1 line
2.7.4
PATCH v2 1/3 dt-bindings: power: supply: Add Richtek RT9467 battery charger
From: ChiaEn Wu <[email protected]>
Add bindings for the Richtek RT9467 battery charger.
---
v2
- Revise the definition of 'enable-gpios'
- Revise the node name to generic name in the example ('rt9467@5b' --> 'charger@5b')
- Revise the example usage of 'charge-enable-gpios' with GPIO flags
--- .../power/supply/richtek,rt9467-charger.yaml | 82 ++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt9467-charger.yaml
Documentation/devicetree/bindings/power/supply/richtek,rt9467-charger.yaml new file +82 -0
@@ -0,0 +1,82 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/power/supply/richtek,rt9467-charger.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Richtek RT9467 Switching Battery Charger with Power Path Management + +maintainers: + - ChiYuan Huang <[email protected]> + - ChiaEn Wu <[email protected]> + +description: | + RT9467 is a switch-mode single cell Li-Ion/Li-Polymer battery charger for + portable applications. It integrates a synchronous PWM controller, power + MOSFETs, input current sensing and regulation, high-accuracy voltage + regulation, and charge termination. The charge current is regulated through + integrated sensing resistors. + + The RT9467 also features USB On-The-Go (OTG) support. It also integrates + D+/D- pin for USB host/charging port detection. + + Datasheet is available at + https://www.richtek.com/assets/product_file/RT9467/DS9467-01.pdf + +properties: + compatible: + const: richtek,rt9467-charger + + reg: + maxItems: 1 + + wakeup-source: true + + interrupts: + maxItems: 1 + + charge-enable-gpios: + description: GPIO is used to turn on and off charging. + maxItems: 1 + + usb-otg-vbus-regulator: + type: object + description: OTG boost regulator. + unevaluatedProperties: false + $ref: /schemas/regulator/regulator.yaml# + + properties: + enable-gpios: true + +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@5b { + compatible = "richtek,rt9467-charger"; + reg = <0x5b>; + wakeup-source; + interrupts-extended = <&gpio_intc 32 IRQ_TYPE_LEVEL_LOW>; + charge-enable-gpios = <&gpio26 1 GPIO_ACTIVE_LOW>; + + rt9467_otg_vbus: usb-otg-vbus-regulator { + regulator-name = "rt9467-usb-otg-vbus"; + regulator-min-microvolt = <4425000>; + regulator-max-microvolt = <5825000>; + regulator-min-microamp = <500000>; + regulator-max-microamp = <3000000>; + }; + }; + };
Signature · 1 line
2.7.4
Re: [PATCH v2 1/3] dt-bindings: power: supply: Add Richtek RT9467 battery charger
Quoted 8 lines · ChiaEn Wu
From: ChiaEn Wu <[email protected]>
Add bindings for the Richtek RT9467 battery charger.
Co-developed-by ChiYuan Huang <[email protected]>Signed-off-by ChiYuan Huang <[email protected]>Signed-off-by ChiaEn Wu <[email protected]>---
Best regards,
Krzysztof
PATCH v2 2/3 power: supply: rt9467: Add Richtek RT9467 charger driver
In reply to ChiaEn WuFrom: ChiaEn Wu <[email protected]>
RT9467 is a switch-mode single cell Li-Ion/Li-Polymer battery charger for portable applications.
It integrates a synchronous PWM controller, power MOSFETs, input current sensing and regulation, high-accuracy voltage regulation, and charge termination. The charge current is regulated through integrated sensing resistors.
The RT9467 also features USB On-The-Go (OTG) support. It also integrates D+/D- pin for USB host/charging port detection.
---
v2
- Add missing header file <linux/bitfied.h>
- Add new header files <linux/sysfs.h> and <linux/kstrtox.h> for adding 'sysoff' sysfs feature
- Add assign 'rt9467_sysfs_groups' to '.attr_grp' of psy config
- Remove unused varible 'rt9467_port_stat_names[]'
--- drivers/power/supply/Kconfig | 19 + drivers/power/supply/Makefile | 1 + drivers/power/supply/rt9467-charger.c | 1282 +++++++++++++++++++++++++++++++++ 3 files changed, 1302 insertions(+) create mode 100644 drivers/power/supply/rt9467-charger.c
drivers/power/supply/Kconfig +19 -0
@@ -772,6 +772,25 @@ config CHARGER_RT9455 help Say Y to enable support for Richtek RT9455 battery charger. +config CHARGER_RT9467 + tristate "Richtek RT9467 Battery Charger Driver" + depends on I2C && GPIOLIB && REGULATOR + select REGMAP_I2C + select REGMAP_IRQ + select LINEAR_RANGES + help + Say Y here to enable RT9467 Battery Charger. + RT9467 is a switch-mode single cell Li-Ion/Li-Polymer battery charger + for portable applications. It integrates a synchronous PWM controller, + power MOSFETs, input current sensing and regulation, high-accuracy + voltage regulation, and charge termination. The charge current is + regulated through integrated sensing resistors. It also features + USB On-The-Go (OTG) support and integrates D+/D- pin for USB + host/charging port detection. + + This driver can also be built as a module. If so, the module + will be called "rt9467-charger". + 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_RT9467) += rt9467-charger.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/rt9467-charger.c new file +1282 -0
1,282 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 3/3 Documentation: power: rt9467: Document exported sysfs entries
In reply to ChiaEn WuFrom: ChiaEn Wu <[email protected]>
Document the settings exported by rt9467 charger driver through sysfs entries:
- sysoff_enable
--- Documentation/ABI/testing/sysfs-class-power-rt9467 | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-power-rt9467
Documentation/ABI/testing/sysfs-class-power-rt9467 new file +19 -0
@@ -0,0 +1,19 @@ +What: /sys/class/power_supply/rt9467-*/sysoff_enable +Date: Oct 2022 +KernelVersion: 6.0 +Contact: ChiaEn Wu <[email protected]> +Description: + This entry allows enabling the sysoff mode of rt9467 charger + devices. + If enabled and the input is removed, the internal battery FET + is turned off to reduce the leakage from the BAT pin. See + device datasheet for details. It's commonly used when the + product enter shipping stage. After entering shipping mode, + only 'VBUS' or 'Power key" pressed can make it leave this mode. + 'Disable' also can help to leave it, but it's more like to + abort the action before the device really enter shipping mode. + + Access: Read, Write + Valid values: + - 1: enabled + - 0: disabled
Signature · 1 line
2.7.4