public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] Add driver for TI BQ25630 charger
@ 2026-02-27 15:35 Waqar Hameed
  2026-02-27 15:35 ` [RFC PATCH 1/2] dt-bindings: power: supply: Add " Waqar Hameed
  0 siblings, 1 reply; 6+ messages in thread
From: Waqar Hameed @ 2026-02-27 15:35 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: kernel, linux-kernel, linux-pm, devicetree

This patch series contains a fully working driver for the basic
functionality for the new TI BQ25630 charger (see datasheet [1]).
However, some functionality has no straightforward implementation. The
following features have therefore been left out and hopefully we can
have some design discussions to reach a clear resolution for the next
patch version (hence the RFC tag):

  1. The USB OTG functionality (i.e. power *out* from the device) would
     probably need a minor refactorization to use the MFD sub-system to
     also register a regulator driver. Looking at the bq257xx driver,
     this should be the preferred design?
     
  2. Other drivers add a custom `sysfs` attributes for BATFET control.
     See for example rt9471 and bq24190. Is this the preferred approach?
     Should we add a new power `sysfs` class ABI for this? (There is a
     TODO left in the code for this.)
     
     I reckon it is quite common to have BATFET control for chargers,
     i.e. being able to set them in "ship mode", "stand-by mode",
     "shutdown mode" or "idle mode" (example values taken from the
     `BATFET_CTRL` register field from datasheet [1])?
     
  3. This device has liquid detection and corrosion mitigation. I
     couldn't find any existing device driver with this kind of
     functionality. The datasheet [1] even mentions "patent pending",
     although it refers to the USB type-C Specification 2.3... :)
     
     When liquid is detected in the charging port, an interrupt is
     fired. Likewise, an interrupt can be fired when the port is dry
     enough (according to some configured threshold value). My initial
     thought was that maybe we can add "liquid detected" to the `health`
     `sysfs` ABI? However, the question still remains though how one
     should enable/disable and set threshold values for this (new power
     class `sysfs` ABI or a custom one only for this driver)?

[1] https://www.ti.com/lit/gpn/bq25630

Waqar Hameed (2):
  dt-bindings: power: supply: Add TI BQ25630 charger
  power: supply: Add driver for TI BQ25630 charger

 .../bindings/power/supply/bq25630.yaml        |   68 ++
 drivers/power/supply/Kconfig                  |    7 +
 drivers/power/supply/Makefile                 |    1 +
 drivers/power/supply/bq25630_charger.c        | 1074 +++++++++++++++++
 4 files changed, 1150 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq25630.yaml
 create mode 100644 drivers/power/supply/bq25630_charger.c


base-commit: f4d0ec0aa20d49f09dc01d82894ce80d72de0560
-- 
2.39.5


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [RFC PATCH 1/2] dt-bindings: power: supply: Add TI BQ25630 charger
  2026-02-27 15:35 [RFC PATCH 0/2] Add driver for TI BQ25630 charger Waqar Hameed
@ 2026-02-27 15:35 ` Waqar Hameed
  2026-02-27 17:31   ` Conor Dooley
  0 siblings, 1 reply; 6+ messages in thread
From: Waqar Hameed @ 2026-02-27 15:35 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: kernel, linux-pm, devicetree, linux-kernel

Add devicetree bindings for the TI BQ25630 battery charger. It's I2C
controlled and sends interrupts.

Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
---
 .../bindings/power/supply/bq25630.yaml        | 68 +++++++++++++++++++
 1 file changed, 68 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/bq25630.yaml

diff --git a/Documentation/devicetree/bindings/power/supply/bq25630.yaml b/Documentation/devicetree/bindings/power/supply/bq25630.yaml
new file mode 100644
index 0000000000000..57e4286dac7e9
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/supply/bq25630.yaml
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/bq25630.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TI BQ25630 battery charger
+
+maintainers:
+  - Waqar Hameed <waqar.hameed@axis.com>
+
+description: |
+  I2C controlled single cell Li-ion and Li-polymer 5A buck charger.
+  Datasheet: https://www.ti.com/lit/gpn/bq25630
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: ti,bq25630
+
+  reg:
+    const: 0x6b
+    description:
+      Device I2C address.
+
+  interrupts:
+    maxItems: 1
+    description: |
+      Device sends active low 256 µs pulse. Type should therefore be
+      IRQ_TYPE_EDGE_FALLING.
+
+  monitored-battery: true
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - monitored-battery
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    bat: battery {
+        compatible = "simple-battery";
+        voltage-min-design-microvolt = <1800000>;
+        constant-charge-current-max-microamp = <1344000>;
+        constant-charge-voltage-max-microvolt = <3700000>;
+        charge-term-current-microamp = <128000>;
+        precharge-current-microamp = <1000000>;
+    };
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        charger@6b {
+            compatible = "ti,bq25630";
+            reg = <0x6b>;
+            interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
+            monitored-battery = <&bat>;
+        };
+    };
+...
-- 
2.39.5


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH 1/2] dt-bindings: power: supply: Add TI BQ25630 charger
  2026-02-27 15:35 ` [RFC PATCH 1/2] dt-bindings: power: supply: Add " Waqar Hameed
@ 2026-02-27 17:31   ` Conor Dooley
  2026-03-02 13:44     ` Waqar Hameed
  0 siblings, 1 reply; 6+ messages in thread
From: Conor Dooley @ 2026-02-27 17:31 UTC (permalink / raw)
  To: Waqar Hameed
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	kernel, linux-pm, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2921 bytes --]

On Fri, Feb 27, 2026 at 04:35:33PM +0100, Waqar Hameed wrote:
> Add devicetree bindings for the TI BQ25630 battery charger. It's I2C
> controlled and sends interrupts.
> 
> Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
> ---
>  .../bindings/power/supply/bq25630.yaml        | 68 +++++++++++++++++++
>  1 file changed, 68 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power/supply/bq25630.yaml
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/bq25630.yaml b/Documentation/devicetree/bindings/power/supply/bq25630.yaml
> new file mode 100644
> index 0000000000000..57e4286dac7e9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/supply/bq25630.yaml

Filename is missing "ti," to match the compatible.

> @@ -0,0 +1,68 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/power/supply/bq25630.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TI BQ25630 battery charger
> +
> +maintainers:
> +  - Waqar Hameed <waqar.hameed@axis.com>
> +
> +description: |
> +  I2C controlled single cell Li-ion and Li-polymer 5A buck charger.
> +  Datasheet: https://www.ti.com/lit/gpn/bq25630
> +
> +allOf:
> +  - $ref: power-supply.yaml#
> +
> +properties:
> +  compatible:
> +    const: ti,bq25630
> +
> +  reg:
> +    const: 0x6b
> +    description:
> +      Device I2C address.
> +
> +  interrupts:
> +    maxItems: 1
> +    description: |
> +      Device sends active low 256 µs pulse. Type should therefore be
> +      IRQ_TYPE_EDGE_FALLING.
> +
> +  monitored-battery: true
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - monitored-battery
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/interrupt-controller/irq.h>
> +
> +    bat: battery {
> +        compatible = "simple-battery";
> +        voltage-min-design-microvolt = <1800000>;
> +        constant-charge-current-max-microamp = <1344000>;
> +        constant-charge-voltage-max-microvolt = <3700000>;
> +        charge-term-current-microamp = <128000>;
> +        precharge-current-microamp = <1000000>;
> +    };

This whole battery node can go, the tooling will falsify the phandle.

I wouldn't ack this anyway cos you're looking for RFC feedback, but the
binding looks pretty sane (although when it's simple enough it should!).
Marking it cr from a dt pov cos of the filename.
pw-bot: changes-requested

Cheers,
Conor.

> +
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        charger@6b {
> +            compatible = "ti,bq25630";
> +            reg = <0x6b>;
> +            interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
> +            monitored-battery = <&bat>;
> +        };
> +    };
> +...
> -- 
> 2.39.5
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH 1/2] dt-bindings: power: supply: Add TI BQ25630 charger
  2026-02-27 17:31   ` Conor Dooley
@ 2026-03-02 13:44     ` Waqar Hameed
  2026-03-02 17:47       ` Conor Dooley
  0 siblings, 1 reply; 6+ messages in thread
From: Waqar Hameed @ 2026-03-02 13:44 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	kernel, linux-pm, devicetree, linux-kernel

On Fri, Feb 27, 2026 at 17:31 +0000 Conor Dooley <conor@kernel.org> wrote:

> On Fri, Feb 27, 2026 at 04:35:33PM +0100, Waqar Hameed wrote:
>> Add devicetree bindings for the TI BQ25630 battery charger. It's I2C
>> controlled and sends interrupts.
>> 
>> Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
>> ---
>>  .../bindings/power/supply/bq25630.yaml        | 68 +++++++++++++++++++
>>  1 file changed, 68 insertions(+)
>>  create mode 100644 Documentation/devicetree/bindings/power/supply/bq25630.yaml
>> 
>> diff --git a/Documentation/devicetree/bindings/power/supply/bq25630.yaml b/Documentation/devicetree/bindings/power/supply/bq25630.yaml
>> new file mode 100644
>> index 0000000000000..57e4286dac7e9
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/power/supply/bq25630.yaml
>
> Filename is missing "ti," to match the compatible.

The majority of TI devices in this folder do not contain the `ti,`
prefix, so I just followed that. But I'll make sure to add it in the
next version then!

[...]

>> +examples:
>> +  - |
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +
>> +    bat: battery {
>> +        compatible = "simple-battery";
>> +        voltage-min-design-microvolt = <1800000>;
>> +        constant-charge-current-max-microamp = <1344000>;
>> +        constant-charge-voltage-max-microvolt = <3700000>;
>> +        charge-term-current-microamp = <128000>;
>> +        precharge-current-microamp = <1000000>;
>> +    };
>
> This whole battery node can go, 

Alright, will remove in the next version!

> the tooling will falsify the phandle.

I'm guessing you mean that when extracting the example, the insertion of
`/plugin/` to the `*.example.dts`-file will "falsify the phandle"?

There are some other examples in this folder that include this node. Not
sure if it's worth the churn to fix those as well to help the next
person?

[...]


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH 1/2] dt-bindings: power: supply: Add TI BQ25630 charger
  2026-03-02 13:44     ` Waqar Hameed
@ 2026-03-02 17:47       ` Conor Dooley
  2026-03-04 16:16         ` Waqar Hameed
  0 siblings, 1 reply; 6+ messages in thread
From: Conor Dooley @ 2026-03-02 17:47 UTC (permalink / raw)
  To: Waqar Hameed
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	kernel, linux-pm, devicetree, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2310 bytes --]

On Mon, Mar 02, 2026 at 02:44:19PM +0100, Waqar Hameed wrote:
> On Fri, Feb 27, 2026 at 17:31 +0000 Conor Dooley <conor@kernel.org> wrote:
> 
> > On Fri, Feb 27, 2026 at 04:35:33PM +0100, Waqar Hameed wrote:
> >> Add devicetree bindings for the TI BQ25630 battery charger. It's I2C
> >> controlled and sends interrupts.
> >> 
> >> Signed-off-by: Waqar Hameed <waqar.hameed@axis.com>
> >> ---
> >>  .../bindings/power/supply/bq25630.yaml        | 68 +++++++++++++++++++
> >>  1 file changed, 68 insertions(+)
> >>  create mode 100644 Documentation/devicetree/bindings/power/supply/bq25630.yaml
> >> 
> >> diff --git a/Documentation/devicetree/bindings/power/supply/bq25630.yaml b/Documentation/devicetree/bindings/power/supply/bq25630.yaml
> >> new file mode 100644
> >> index 0000000000000..57e4286dac7e9
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/power/supply/bq25630.yaml
> >
> > Filename is missing "ti," to match the compatible.
> 
> The majority of TI devices in this folder do not contain the `ti,`
> prefix, so I just followed that. But I'll make sure to add it in the
> next version then!
> 
> [...]
> 
> >> +examples:
> >> +  - |
> >> +    #include <dt-bindings/interrupt-controller/irq.h>
> >> +
> >> +    bat: battery {
> >> +        compatible = "simple-battery";
> >> +        voltage-min-design-microvolt = <1800000>;
> >> +        constant-charge-current-max-microamp = <1344000>;
> >> +        constant-charge-voltage-max-microvolt = <3700000>;
> >> +        charge-term-current-microamp = <128000>;
> >> +        precharge-current-microamp = <1000000>;
> >> +    };
> >
> > This whole battery node can go, 
> 
> Alright, will remove in the next version!
> 
> > the tooling will falsify the phandle.
> 
> I'm guessing you mean that when extracting the example, the insertion of
> `/plugin/` to the `*.example.dts`-file will "falsify the phandle"?

I'll be honest, I don't know exactly what the mechanism is that fakes
the phandles, but it means that any sort of generic device doesn't need
to be included in the example.

> There are some other examples in this folder that include this node. Not
> sure if it's worth the churn to fix those as well to help the next
> person?

Probably isn't worth the churn /shrug

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [RFC PATCH 1/2] dt-bindings: power: supply: Add TI BQ25630 charger
  2026-03-02 17:47       ` Conor Dooley
@ 2026-03-04 16:16         ` Waqar Hameed
  0 siblings, 0 replies; 6+ messages in thread
From: Waqar Hameed @ 2026-03-04 16:16 UTC (permalink / raw)
  To: Conor Dooley
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	kernel, linux-pm, devicetree, linux-kernel

On Mon, Mar 02, 2026 at 17:47 +0000 Conor Dooley <conor@kernel.org> wrote:

> On Mon, Mar 02, 2026 at 02:44:19PM +0100, Waqar Hameed wrote:

[...]

>> I'm guessing you mean that when extracting the example, the insertion of
>> `/plugin/` to the `*.example.dts`-file will "falsify the phandle"?
>
> I'll be honest, I don't know exactly what the mechanism is that fakes
> the phandles, but it means that any sort of generic device doesn't need
> to be included in the example.

Haha alright. I appreciate the honesty :)

I'll stick to my explanation for now then, since it makes sense for me
at least (someone otherwise please correct me).

>
>> There are some other examples in this folder that include this node. Not
>> sure if it's worth the churn to fix those as well to help the next
>> person?
>
> Probably isn't worth the churn /shrug

Alright, let's leave it then.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-03-04 16:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-27 15:35 [RFC PATCH 0/2] Add driver for TI BQ25630 charger Waqar Hameed
2026-02-27 15:35 ` [RFC PATCH 1/2] dt-bindings: power: supply: Add " Waqar Hameed
2026-02-27 17:31   ` Conor Dooley
2026-03-02 13:44     ` Waqar Hameed
2026-03-02 17:47       ` Conor Dooley
2026-03-04 16:16         ` Waqar Hameed

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox