Skip to contentSkip to conversation

Add Richtek RT9759 smart cap divider charger support

PATCH Superseded cy_huang 1 participant 4 messages Oct 20, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

cy_huang

author
#0 lore raw

v2 cover Add Richtek RT9759 smart cap divider charger support

From: ChiYuan Huang <[email protected]>

This patch set is to add Richtek RT9759 smart cap divider charger.

The RT9759 is a high efficiency and high charge current charger. The efficiency is up to 97.8% when VBAT=4.2V, IBAT=2.5A, and the maximum charge current is up to 8A. The device integrates smart cap divider topology with a dual-phase charge pump core and 9 channel high speed ADCs to monitor the charging process.

Since v2:
- Add Reviewed-by tag for dt-binding patch
- Change ABI document date from Oct 2022 to Nov 2022 and KernelVersion from 6.1 to 6.2

ChiYuan Huang (3):
dt-bindings: power: supply: Add Richtek RT9759 smart cap divider
charger
power: supply: rt9471: Add Richtek RT9759 smart cap divider charger
Documentation: power: rt9759: Document exported sysfs entries

 Documentation/ABI/testing/sysfs-class-power-rt9759 |  37 ++
 .../bindings/power/supply/richtek,rt9759.yaml      |  61 ++
 drivers/power/supply/Kconfig                       |  15 +
 drivers/power/supply/Makefile                      |   1 +
 drivers/power/supply/rt9759.c                      | 611 +++++++++++++++++++++
 5 files changed, 725 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-power-rt9759
 create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt9759.yaml
 create mode 100644 drivers/power/supply/rt9759.c
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/3 dt-bindings: power: supply: Add Richtek RT9759 smart cap divider charger

From: ChiYuan Huang <[email protected]>

Add bindings for the Richtek RT9759 smart cap divider charger.

---
 .../bindings/power/supply/richtek,rt9759.yaml      | 61 ++++++++++++++++++++++
 1 file changed, 61 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt9759.yaml
Documentation/devicetree/bindings/power/supply/richtek,rt9759.yaml new file +61 -0
new file mode 100644
index 00000000..04fc6b0
@@ -0,0 +1,61 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/richtek,rt9759.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT9759 Smart Cap Divider Charger
+
+maintainers:
+  - ChiYuan Huang <[email protected]>
+
+description: |
+  The RT9759 is a high efficiency and high charge current charger.
+  The efficiency is up to 97.8% when VBAT = 4.2V, IBAT = 2.5A and the maximum
+  charge current is up to 8A. The device integrates smart cap divider topology
+  with dual phase charge pump core. The ADCs provide input and output voltage,
+  current and temperature information to monitor the whole charging process.
+
+  Datasheet is available at
+  https://www.richtek.com/assets/product_file/RT9759/DS9759-02.pdf
+
+properties:
+  compatible:
+    enum:
+      - richtek,rt9759
+
+  reg:
+    maxItems: 1
+
+  wakeup-source: true
+
+  interrupts:
+    maxItems: 1
+
+  shunt-resistor-micro-ohms:
+    description: Battery current sense resistor mounted.
+    default: 2000
+
+required:
+  - compatible
+  - reg
+  - wakeup-source
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@66 {
+        compatible = "richtek,rt9759";
+        reg = <0x66>;
+        wakeup-source;
+        interrupts-extended = <&gpio_intc 32 IRQ_TYPE_EDGE_FALLING>;
+        shunt-resistor-micro-ohms = <5000>;
+      };
+    };
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 2/3 power: supply: rt9471: Add Richtek RT9759 smart cap divider charger

In reply to cy_huang

From: ChiYuan Huang <[email protected]>

Add support for RT9759 smart cap divider charger.

The RT9759 is a high efficiency and high charge current charger. The maximum charge current is up to 8A. It integrates a dual-phase charge pump core with ADC monitoring.

---
 drivers/power/supply/Kconfig  |  15 ++
 drivers/power/supply/Makefile |   1 +
 drivers/power/supply/rt9759.c | 611 ++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 627 insertions(+)
 create mode 100644 drivers/power/supply/rt9759.c
drivers/power/supply/Kconfig +15 -0
index 0bbfe6a..2f24f29 100644
@@ -785,6 +785,21 @@ config BATTERY_RT5033
 	  The fuelgauge calculates and determines the battery state of charge
 	  according to battery open circuit voltage.
 
+config CHARGER_RT9759
+	tristate "Richtek RT9759 smart cap divider charger driver"
+	depends on I2C
+	select REGMAP_I2C
+	select LINEAR_RANGES
+	help
+	  This adds support for Richtek RT9759 smart cap divider charger driver.
+	  It's a high efficiency and high charge current charger. the device
+	  integrates smart cap divider topology with 9-channel high speed
+	  ADCs that can provide input and output voltage, current and
+	  temperature monitoring.
+
+	  This driver can also be built as a module. If so, the module will be
+	  called rt9759.
+
 config CHARGER_RT9455
 	tristate "Richtek RT9455 battery charger driver"
 	depends on I2C
drivers/power/supply/Makefile +1 -0
index 0ee8653..b872c06 100644
@@ -56,6 +56,7 @@ obj-$(CONFIG_BATTERY_MAX17042)	+= max17042_battery.o
 obj-$(CONFIG_BATTERY_MAX1721X)	+= max1721x_battery.o
 obj-$(CONFIG_BATTERY_Z2)	+= z2_battery.o
 obj-$(CONFIG_BATTERY_RT5033)	+= rt5033_battery.o
+obj-$(CONFIG_CHARGER_RT9759)	+= rt9759.o
 obj-$(CONFIG_CHARGER_RT9455)	+= rt9455_charger.o
 obj-$(CONFIG_BATTERY_S3C_ADC)	+= s3c_adc_battery.o
 obj-$(CONFIG_BATTERY_TWL4030_MADC)	+= twl4030_madc_battery.o
drivers/power/supply/rt9759.c new file +611 -0

611 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 3/3 Documentation: power: rt9759: Document exported sysfs entries

In reply to cy_huang

From: ChiYuan Huang <[email protected]>

Document the settings exported by rt9759 charger driver through sysfs entries:

- watchdog_timer
- battery_voltage
- battery_current

---
Since v2:
- Change ABI document date from Oct 2022 to Nov 2022 and KernelVersion from 6.1 to 6.2

---
 Documentation/ABI/testing/sysfs-class-power-rt9759 | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-power-rt9759
Documentation/ABI/testing/sysfs-class-power-rt9759 new file +37 -0
new file mode 100644
index 00000000..8a7258f
@@ -0,0 +1,37 @@
+What:		/sys/class/power_supply/rt9759-*/watchdog_timer
+Date:		Nov 2022
+KernelVersion:	6.2
+Contact:	ChiYuan Huang <[email protected]>
+Description:
+		This entry shows and sets the watchdog timer when rt9759 charger
+		operates in charging mode. When the timer expires, the device
+		will disable the charging. To prevent the timer expires, any
+		host communication can make the timer restarted.
+
+		Access: Read, Write
+
+		Valid values:
+		- 500, 1000, 5000 or 30000 (milliseconds),
+		- 0: disabled
+
+What:		/sys/class/power_supply/rt9759-*/battery_voltage
+Date:		Nov 2022
+KernelVersion:	6.2
+Contact:	ChiYuan Huang <[email protected]>
+Description:
+		Reports the current BAT voltage.
+
+		Access: Read-Only
+
+		Valid values: Represented in microvolts
+
+What:		/sys/class/power_supply/rt9759-*/battery_current
+Date:		Nov 2022
+KernelVersion:	6.2
+Contact:	ChiYuan Huang <[email protected]>
+Description:
+		Reports the current BAT current.
+
+		Access: Read-Only
+
+		Valid values: Represented in microamps
Signature · 1 line
2.7.4