Skip to contentSkip to conversation

Add Richtek RT9756 Smart-Cap dividor charger

PATCH Superseded [email protected] 2 participants 9 messages Jul 29, 2025 – Jul 30, 2025

Subsystems (2)

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Add Richtek RT9756 Smart-Cap dividor charger

From: ChiYuan Huang <[email protected]>

This patch series adds support for RT9756 charger.

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

 .../ABI/testing/sysfs-class-power-rt9756      |  52 +
 .../bindings/power/supply/richtek,rt9756.yaml |  70 ++
 drivers/power/supply/Kconfig                  |  15 +
 drivers/power/supply/Makefile                 |   1 +
 drivers/power/supply/rt9756.c                 | 932 ++++++++++++++++++
 5 files changed, 1070 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-power-rt9756
 create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml
 create mode 100644 drivers/power/supply/rt9756.c

base-commit: 038d61fd642278bab63ee8ef722c50d10ab01e8f

Signature · 1 line
2.34.1
#1 lore raw

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

From: ChiYuan Huang <[email protected]>

Add the document for Richtek RT9756 smart cap divider charger.

---
 .../bindings/power/supply/richtek,rt9756.yaml | 70 +++++++++++++++++++
 1 file changed, 70 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml
Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml new file +70 -0
new file mode 100644
index 000000000000..e81668b43fba
@@ -0,0 +1,70 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/richtek,rt9756.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Richtek RT9756 Smart Cap Divider Charger
+
+maintainers:
+  - ChiYuan Huang <[email protected]>
+
+description: |
+  The RT9756/RT9757 is a high efficiency and high charge current charger.
+
+  The efficiency is up to 98.2% when VBAT = 4V, IBAT = 2A in DIV2 mode and 99.1%
+  when VBAT=4V, IBAT=1A in bypass mode. The maximum charger current is up to 8A
+  in DIV2 mode and 5A in bypass mode. The device integrates smart cap divider
+  topology, direct charging mode, external over-voltage protection control, an
+  input reverse blocking NFET and 2-way regulation, a dual phase charge pump
+  core, 8-Channel high speed ADCs and USB BC 1.2 detection.
+
+  RT9770 is almost the same with RT9756/57, only BC 1.2 detection function is
+  removed to shrink the die size.
+
+properties:
+  compatible:
+    oneOf:
+      - enum:
+          - richtek,rt9756
+          - richtek,rt9770
+      - items:
+          - enum:
+              - richtek,rt9757
+          - const: richtek,rt9756
+
+  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@6f {
+        compatible = "richtek,rt9756";
+        reg = <0x6f>;
+        wakeup-source;
+        interrupts-extended = <&gpio_intc 32 IRQ_TYPE_EDGE_FALLING>;
+        shunt-resistor-micro-ohms = <5000>;
+      };
+    };
Signature · 1 line
2.34.1
#2 lore raw

Re: [PATCH 1/3] dt-bindings: power: supply: Add Richtek RT9756 smart cap divider charger

Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml line 51

Quoted 9 lines · On 29/07/2025 06:21, [email protected] wrote:
Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml new file +9 -0
+
+  shunt-resistor-micro-ohms:
+    description: Battery current sense resistor mounted.
+    default: 2000
+
+required:
+  - compatible
+  - reg
+  - wakeup-source

Why do you require this? I cannot find any use of it, so maybe I missed some change in Linux code (and that's second question like that for Richtek, so refer to your other patchsets for contexr).

Review

Quoted 2 lines
(quoted diff) +2 -0
+  - interrupts
+

Missing ref to power supply.

Review

Quoted 2 lines
(quoted diff) +2 -0
+additionalProperties: false
+

unevaluated instead

Best regards,
Krzysztof

#3 lore raw

Re: [PATCH 1/3] dt-bindings: power: supply: Add Richtek RT9756 smart cap divider charger

Quoted 15 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml line 51

Quoted 9 lines · On 29/07/2025 06:21, [email protected] wrote:
Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml new file +9 -0
+
+  shunt-resistor-micro-ohms:
+    description: Battery current sense resistor mounted.
+    default: 2000
+
+required:
+  - compatible
+  - reg
+  - wakeup-source

Why do you require this? I cannot find any use of it, so maybe I missed some change in Linux code (and that's second question like that for Richtek, so refer to your other patchsets for contexr).

This will mark the interrupt as wakeup capable.
https://elixir.bootlin.com/linux/v6.16/source/drivers/i2c/i2c-core-of.c#L57
https://elixir.bootlin.com/linux/v6.16/source/drivers/i2c/i2c-core-base.c#L547

Quoted 8 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+  - interrupts
+

Missing ref to power supply.

Review

Quoted 2 lines
(quoted diff) +2 -0
+additionalProperties: false
+

Ack, will add the below lines to the document for next revision.

allOf:
- $ref: power-supply.yaml#

Quoted 2 lines

unevaluated instead

Ack.

Thx.

#4 lore raw

Re: [PATCH 1/3] dt-bindings: power: supply: Add Richtek RT9756 smart cap divider charger

Quoted 17 lines · ChiYuan Huang
Quoted 15 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml line 51

Quoted 9 lines · On 29/07/2025 06:21, [email protected] wrote:
Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml new file +9 -0
+
+  shunt-resistor-micro-ohms:
+    description: Battery current sense resistor mounted.
+    default: 2000
+
+required:
+  - compatible
+  - reg
+  - wakeup-source

Why do you require this? I cannot find any use of it, so maybe I missed some change in Linux code (and that's second question like that for Richtek, so refer to your other patchsets for contexr).

Quoted 3 lines

This will mark the interrupt as wakeup capable.
https://elixir.bootlin.com/linux/v6.16/source/drivers/i2c/i2c-core-of.c#L57
https://elixir.bootlin.com/linux/v6.16/source/drivers/i2c/i2c-core-base.c#L547

OK, but this does not explain why this is required. Why it is impossible to make board which uses this PMIC and wires the interrupt in a way it is not waking up the system?

To my limited knowledge this should be possible, but what do I know about hardware...

Best regards,
Krzysztof

#5 lore raw

Re: [PATCH 1/3] dt-bindings: power: supply: Add Richtek RT9756 smart cap divider charger

Quoted 22 lines · Krzysztof Kozlowski
Quoted 17 lines · ChiYuan Huang
Quoted 15 lines · Krzysztof Kozlowski

Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml line 51

Quoted 9 lines · On 29/07/2025 06:21, [email protected] wrote:
Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml new file +9 -0
+
+  shunt-resistor-micro-ohms:
+    description: Battery current sense resistor mounted.
+    default: 2000
+
+required:
+  - compatible
+  - reg
+  - wakeup-source

Why do you require this? I cannot find any use of it, so maybe I missed some change in Linux code (and that's second question like that for Richtek, so refer to your other patchsets for contexr).

Quoted 3 lines

This will mark the interrupt as wakeup capable.
https://elixir.bootlin.com/linux/v6.16/source/drivers/i2c/i2c-core-of.c#L57
https://elixir.bootlin.com/linux/v6.16/source/drivers/i2c/i2c-core-base.c#L547

Quoted 6 lines

OK, but this does not explain why this is required. Why it is impossible to make board which uses this PMIC and wires the interrupt in a way it is not waking up the system?

To my limited knowledge this should be possible, but what do I know about hardware...

Another question is still valid, although you provided more context - if the device is ALWAYS waking up, this is implied by compatible and you do not need this property at all.

That would be the first usage of I2C client wakeup flag in drivers, but maybe that is how it should be done? You can consult I2C folks on IRC.

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH 1/3] dt-bindings: power: supply: Add Richtek RT9756 smart cap divider charger

Quoted 30 lines · Krzysztof Kozlowski
Quoted 22 lines · ChiYuan Huang
Quoted 17 lines · Krzysztof Kozlowski
Quoted 6 lines · On 29/07/2025 06:21, [email protected] wrote:
Quoted 5 lines
Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml new file +5 -0
+
+  shunt-resistor-micro-ohms:
+    description: Battery current sense resistor mounted.
+    default: 2000
+
Quoted 9 lines

Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml line 51

Quoted 4 lines
Documentation/devicetree/bindings/power/supply/richtek,rt9756.yaml new file +4 -0
+required:
+  - compatible
+  - reg
+  - wakeup-source

Why do you require this? I cannot find any use of it, so maybe I missed some change in Linux code (and that's second question like that for Richtek, so refer to your other patchsets for contexr).

Quoted 3 lines

This will mark the interrupt as wakeup capable.
https://elixir.bootlin.com/linux/v6.16/source/drivers/i2c/i2c-core-of.c#L57
https://elixir.bootlin.com/linux/v6.16/source/drivers/i2c/i2c-core-base.c#L547

Quoted 6 lines

OK, but this does not explain why this is required. Why it is impossible to make board which uses this PMIC and wires the interrupt in a way it is not waking up the system?

To my limited knowledge this should be possible, but what do I know about hardware...

Quoted 6 lines

Another question is still valid, although you provided more context - if the device is ALWAYS waking up, this is implied by compatible and you do not need this property at all.

That would be the first usage of I2C client wakeup flag in drivers, but maybe that is how it should be done? You can consult I2C folks on IRC.

Yap, like as your saying. If not declared 'wakeup-source', it only means if the system supports sleep state, this interrupt won't on-time notify any event. Actually, not affect its normal functionality.

If your question is should the property 'wakeup-source' be declared as required, then the answer should be 'No'.

When system supports suspend, to declare this property is just a suggestion.

In next revision, I'll remove 'wakeup-source' from the required property list.

All questions are clarified.

Thx.

#7 lore raw

PATCH 2/3 power: supply: rt9756: Add Richtek RT9756 smart cap divider charger

In reply to [email protected]

From: ChiYuan Huang <[email protected]>

Add support for RT9756 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/rt9756.c | 932 ++++++++++++++++++++++++++++++++++
 3 files changed, 948 insertions(+)
 create mode 100644 drivers/power/supply/rt9756.c
drivers/power/supply/Kconfig +15 -0
index 79ddb006e2da..aff192474140 100644
@@ -909,6 +909,21 @@ config CHARGER_RT9471
 	  This driver can also be built as a module. If so, the module will be
 	  called rt9471.
 
+config CHARGER_RT9756
+	tristate "Richtek RT9756 smart cap divider charger driver"
+	depends on I2C
+	select REGMAP_I2C
+	select LINEAR_RANGES
+	help
+	  This adds support for Richtek RT9756 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 rt9756.
+
 config CHARGER_CROS_USBPD
 	tristate "ChromeOS EC based USBPD charger"
 	depends on CROS_USBPD_NOTIFY
drivers/power/supply/Makefile +1 -0
index 4f5f8e3507f8..a529f217f0ad 100644
@@ -62,6 +62,7 @@ obj-$(CONFIG_CHARGER_RT5033)	+= rt5033_charger.o
 obj-$(CONFIG_CHARGER_RT9455)	+= rt9455_charger.o
 obj-$(CONFIG_CHARGER_RT9467)	+= rt9467-charger.o
 obj-$(CONFIG_CHARGER_RT9471)	+= rt9471.o
+obj-$(CONFIG_CHARGER_RT9756)	+= rt9756.o
 obj-$(CONFIG_BATTERY_TWL4030_MADC)	+= twl4030_madc_battery.o
 obj-$(CONFIG_CHARGER_88PM860X)	+= 88pm860x_charger.o
 obj-$(CONFIG_BATTERY_RX51)	+= rx51_battery.o
drivers/power/supply/rt9756.c new file +932 -0

932 lines not on this page · raw message

Signature · 1 line
2.34.1
#8 lore raw

PATCH 3/3 Documentation: power: rt9756: Document exported sysfs entries

In reply to [email protected]

From: ChiYuan Huang <[email protected]>

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

- watchdog_timer
- battery_voltage
- battery_current
- operation_mode

---
 .../ABI/testing/sysfs-class-power-rt9756      | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/ABI/testing/sysfs-class-power-rt9756
Documentation/ABI/testing/sysfs-class-power-rt9756 new file +52 -0
new file mode 100644
index 000000000000..2d0f7ef1b855
@@ -0,0 +1,52 @@
+What:		/sys/class/power_supply/rt9756-*/watchdog_timer
+Date:		Aug 2025
+KernelVersion:	6.17
+Contact:	ChiYuan Huang <[email protected]>
+Description:
+		This entry shows and sets the watchdog timer when rt9756 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, 30000, 40000, 80000, 128000 or 255000 (milliseconds),
+		- 0: disabled
+
+What:		/sys/class/power_supply/rt9756-*/battery_voltage
+Date:		Aug 2025
+KernelVersion:	6.17
+Contact:	ChiYuan Huang <[email protected]>
+Description:
+		Reports the current BAT voltage.
+
+		Access: Read-Only
+
+		Valid values: Represented in microvolts
+
+What:		/sys/class/power_supply/rt9756-*/battery_current
+Date:		Aug 2025
+KernelVersion:	6.17
+Contact:	ChiYuan Huang <[email protected]>
+Description:
+		Reports the current BAT current.
+
+		Access: Read-Only
+
+		Valid values: Represented in microamps
+
+What:		/sys/class/power_supply/rt9756-*/operation_mode
+Date:		Aug 2025
+KernelVersion:	6.17
+Contact:	ChiYuan Huang <[email protected]>
+Description:
+		This entry shows and set the operation mode when rt9756 charger
+		operates in charging phase. If 'bypass' mode is used, internal
+		path will connect vbus directly to vbat. Else, default 'div2'
+		mode for the switch-cap charging.
+
+		Access: Read, Write
+
+		Valid values:
+		- 'bypass' or 'div2'
Signature · 1 line
2.34.1