Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 0/2] power: supply: Correct AB8505 charger device tree
@ 2026-09-18 16:56 Linus Walleij
  2026-09-18 16:56 ` [PATCH v2 1/2] dt-bindings: power: supply: ab8500: Add AB8505 charger Linus Walleij
  2026-09-18 16:56 ` [PATCH v2 2/2] ARM: dts: ux500: Use AB8505 charger compatible Linus Walleij
  0 siblings, 2 replies; 7+ messages in thread
From: Linus Walleij @ 2026-09-18 16:56 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-pm, devicetree, Linus Walleij

AB8505 retains the USB charger from AB8500 but omits the separate main
charger block. Its charger node consequently has nine valid interrupts,
not the fourteen interrupts used by AB8500.

Adjust the binding to describe the variant-specific interrupt sets and
remove the five nonexistent main-charger interrupts from the AB8505
device tree. The binding update also limits the autopower_cfg description
to AB8500, since the corresponding AB8505 register bit is reserved.

Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
Changes in v2:
- Add an AB8505-specific compatible with the AB8500 fallback.
- Tie interrupt counts and names to the charger compatible.
- Use the new compatible in the AB8505 DTSI.
- Link to v1: https://lore.kernel.org/r/20260915-ab8500-charger-dt-v1-0-10b7b387e6a6@kernel.org

---
Linus Walleij (2):
      dt-bindings: power: supply: ab8500: Add AB8505 charger
      ARM: dts: ux500: Use AB8505 charger compatible

 .../power/supply/stericsson,ab8500-charger.yaml    | 70 ++++++++++++++++------
 arch/arm/boot/dts/st/ste-ab8505.dtsi               | 17 ++----
 2 files changed, 57 insertions(+), 30 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20260915-ab8500-charger-dt-99c2c4623a80

Best regards,
-- 
Linus Walleij <linusw@kernel.org>


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

* [PATCH v2 1/2] dt-bindings: power: supply: ab8500: Add AB8505 charger
  2026-09-18 16:56 [PATCH v2 0/2] power: supply: Correct AB8505 charger device tree Linus Walleij
@ 2026-09-18 16:56 ` Linus Walleij
  2026-09-18 17:08   ` sashiko-bot
  2026-09-20 18:14   ` Krzysztof Kozlowski
  2026-09-18 16:56 ` [PATCH v2 2/2] ARM: dts: ux500: Use AB8505 charger compatible Linus Walleij
  1 sibling, 2 replies; 7+ messages in thread
From: Linus Walleij @ 2026-09-18 16:56 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-pm, devicetree, Linus Walleij

AB8500 and AB8505 expose different charger interrupt sets. Add a unique
AB8505 charger compatible with the AB8500 compatible as its fallback.
Use the variant-specific string to require the fourteen main and USB
charger interrupts on AB8500 and the nine USB charger interrupts on
AB8505.

Also clarify that autopower_cfg describes the AB8500 facility, since the
corresponding AB8505 register bit is reserved.

Fixes: eb917497734c ("dt-bindings: power: supply: ab8500: Convert to DT schema format")
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
 .../power/supply/stericsson,ab8500-charger.yaml    | 70 ++++++++++++++++------
 1 file changed, 53 insertions(+), 17 deletions(-)

diff --git a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
index 4f19744844e9..73f5df2d7a36 100644
--- a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
+++ b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
@@ -12,10 +12,58 @@ maintainers:
 
 allOf:
   - $ref: power-supply.yaml#
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: stericsson,ab8505-charger
+    then:
+      properties:
+        interrupts:
+          minItems: 9
+          maxItems: 9
+
+        interrupt-names:
+          items:
+            - const: VBUS_DET_F
+            - const: VBUS_DET_R
+            - const: USB_LINK_STATUS
+            - const: USB_CH_TH_PROT_R
+            - const: USB_CH_TH_PROT_F
+            - const: USB_CHARGER_NOT_OKR
+            - const: VBUS_OVV
+            - const: CH_WD_EXP
+            - const: VBUS_CH_DROP_END
+    else:
+      properties:
+        interrupts:
+          minItems: 14
+          maxItems: 14
+
+        interrupt-names:
+          items:
+            - const: MAIN_CH_UNPLUG_DET
+            - const: MAIN_CHARGE_PLUG_DET
+            - const: MAIN_EXT_CH_NOT_OK
+            - const: MAIN_CH_TH_PROT_R
+            - const: MAIN_CH_TH_PROT_F
+            - const: VBUS_DET_F
+            - const: VBUS_DET_R
+            - const: USB_LINK_STATUS
+            - const: USB_CH_TH_PROT_R
+            - const: USB_CH_TH_PROT_F
+            - const: USB_CHARGER_NOT_OKR
+            - const: VBUS_OVV
+            - const: CH_WD_EXP
+            - const: VBUS_CH_DROP_END
 
 properties:
   compatible:
-    const: stericsson,ab8500-charger
+    oneOf:
+      - const: stericsson,ab8500-charger
+      - items:
+          - const: stericsson,ab8505-charger
+          - const: stericsson,ab8500-charger
 
   monitored-battery: true
 
@@ -28,27 +76,15 @@ properties:
 
   autopower_cfg:
     type: boolean
-    description: automatic poweron after powerloss
+    description: AB8500 automatic poweron after powerloss
 
   interrupts:
+    minItems: 9
     maxItems: 14
 
   interrupt-names:
-    items:
-      - const: MAIN_CH_UNPLUG_DET
-      - const: MAIN_CHARGE_PLUG_DET
-      - const: MAIN_EXT_CH_NOT_OK
-      - const: MAIN_CH_TH_PROT_R
-      - const: MAIN_CH_TH_PROT_F
-      - const: VBUS_DET_F
-      - const: VBUS_DET_R
-      - const: USB_LINK_STATUS
-      - const: USB_CH_TH_PROT_R
-      - const: USB_CH_TH_PROT_F
-      - const: USB_CHARGER_NOT_OKR
-      - const: VBUS_OVV
-      - const: CH_WD_EXP
-      - const: VBUS_CH_DROP_END
+    minItems: 9
+    maxItems: 14
 
   io-channels:
     minItems: 2

-- 
2.55.0


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

* [PATCH v2 2/2] ARM: dts: ux500: Use AB8505 charger compatible
  2026-09-18 16:56 [PATCH v2 0/2] power: supply: Correct AB8505 charger device tree Linus Walleij
  2026-09-18 16:56 ` [PATCH v2 1/2] dt-bindings: power: supply: ab8500: Add AB8505 charger Linus Walleij
@ 2026-09-18 16:56 ` Linus Walleij
  2026-09-18 17:07   ` sashiko-bot
  1 sibling, 1 reply; 7+ messages in thread
From: Linus Walleij @ 2026-09-18 16:56 UTC (permalink / raw)
  To: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-pm, devicetree, Linus Walleij

Identify the AB8505 charger using its variant-specific compatible and
retain the AB8500 compatible as a fallback for the existing driver. This
selects the AB8505 interrupt constraints from the binding.

The AB8505 interrupt table explicitly omits the five interrupt sources
belonging to the AB8500 main charger. Remove these nonexistent interrupts
from the AB8505 charger node, leaving its nine USB charger interrupts.

Fixes: bc324d447fba ("ARM: dts: ux500: Add interrupts to charger")
Assisted-by: LLM
Signed-off-by: Linus Walleij <linusw@kernel.org>
---
 arch/arm/boot/dts/st/ste-ab8505.dtsi | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/arch/arm/boot/dts/st/ste-ab8505.dtsi b/arch/arm/boot/dts/st/ste-ab8505.dtsi
index 131c82508e82..4c9a8418f225 100644
--- a/arch/arm/boot/dts/st/ste-ab8505.dtsi
+++ b/arch/arm/boot/dts/st/ste-ab8505.dtsi
@@ -137,13 +137,9 @@ ab8500_btemp {
 				};
 
 				ab8500_charger {
-					compatible = "stericsson,ab8500-charger";
-					interrupts = <10 IRQ_TYPE_LEVEL_HIGH>,
-						     <11 IRQ_TYPE_LEVEL_HIGH>,
-						     <0 IRQ_TYPE_LEVEL_HIGH>,
-						     <107 IRQ_TYPE_LEVEL_HIGH>,
-						     <106 IRQ_TYPE_LEVEL_HIGH>,
-						     <14 IRQ_TYPE_LEVEL_HIGH>,
+					compatible = "stericsson,ab8505-charger",
+						     "stericsson,ab8500-charger";
+					interrupts = <14 IRQ_TYPE_LEVEL_HIGH>,
 						     <15 IRQ_TYPE_LEVEL_HIGH>,
 						     <79 IRQ_TYPE_LEVEL_HIGH>,
 						     <105 IRQ_TYPE_LEVEL_HIGH>,
@@ -152,12 +148,7 @@ ab8500_charger {
 						     <22 IRQ_TYPE_LEVEL_HIGH>,
 						     <21 IRQ_TYPE_LEVEL_HIGH>,
 						     <16 IRQ_TYPE_LEVEL_HIGH>;
-					interrupt-names = "MAIN_CH_UNPLUG_DET",
-							  "MAIN_CHARGE_PLUG_DET",
-							  "MAIN_EXT_CH_NOT_OK",
-							  "MAIN_CH_TH_PROT_R",
-							  "MAIN_CH_TH_PROT_F",
-							  "VBUS_DET_F",
+					interrupt-names = "VBUS_DET_F",
 							  "VBUS_DET_R",
 							  "USB_LINK_STATUS",
 							  "USB_CH_TH_PROT_R",

-- 
2.55.0


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

* Re: [PATCH v2 2/2] ARM: dts: ux500: Use AB8505 charger compatible
  2026-09-18 16:56 ` [PATCH v2 2/2] ARM: dts: ux500: Use AB8505 charger compatible Linus Walleij
@ 2026-09-18 17:07   ` sashiko-bot
  2026-09-20 22:49     ` Linus Walleij
  0 siblings, 1 reply; 7+ messages in thread
From: sashiko-bot @ 2026-09-18 17:07 UTC (permalink / raw)
  To: Linus Walleij; +Cc: robh, conor+dt, devicetree

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] driver: ab8500_charger probe fails due to missing interrupts
--

commit 2f9148d4b2214ca2ec295f5eefd937097f9378a9
Author: Linus Walleij <linusw@kernel.org>

ARM: dts: ux500: Use AB8505 charger compatible

This commit identifies the AB8505 charger using its variant-specific
compatible while retaining the AB8500 compatible as a fallback. It
removes five main charger interrupt sources that are non-existent on the
AB8505 from the device tree node.

> diff --git a/arch/arm/boot/dts/st/ste-ab8505.dtsi b/arch/arm/boot/dts/st/ste-ab8505.dtsi
> index 131c82508e820..4c9a8418f225a 100644
> --- a/arch/arm/boot/dts/st/ste-ab8505.dtsi
> +++ b/arch/arm/boot/dts/st/ste-ab8505.dtsi
> @@ -137,13 +137,9 @@ ab8500_btemp {
>  				};
>  
>  				ab8500_charger {
> -					compatible = "stericsson,ab8500-charger";
> -					interrupts = <10 IRQ_TYPE_LEVEL_HIGH>,
> -						     <11 IRQ_TYPE_LEVEL_HIGH>,
> -						     <0 IRQ_TYPE_LEVEL_HIGH>,
> -						     <107 IRQ_TYPE_LEVEL_HIGH>,
> -						     <106 IRQ_TYPE_LEVEL_HIGH>,
> -						     <14 IRQ_TYPE_LEVEL_HIGH>,
> +					compatible = "stericsson,ab8505-charger",
> +						     "stericsson,ab8500-charger";
> +					interrupts = <14 IRQ_TYPE_LEVEL_HIGH>,
>  						     <15 IRQ_TYPE_LEVEL_HIGH>,
>  						     <79 IRQ_TYPE_LEVEL_HIGH>,
>  						     <105 IRQ_TYPE_LEVEL_HIGH>,
> @@ -152,12 +148,7 @@ ab8500_charger {
>  						     <22 IRQ_TYPE_LEVEL_HIGH>,
>  						     <21 IRQ_TYPE_LEVEL_HIGH>,
>  						     <16 IRQ_TYPE_LEVEL_HIGH>;
> -					interrupt-names = "MAIN_CH_UNPLUG_DET",
> -							  "MAIN_CHARGE_PLUG_DET",
> -							  "MAIN_EXT_CH_NOT_OK",
> -							  "MAIN_CH_TH_PROT_R",
> -							  "MAIN_CH_TH_PROT_F",
> -							  "VBUS_DET_F",
> +					interrupt-names = "VBUS_DET_F",
>  							  "VBUS_DET_R",
>  							  "USB_LINK_STATUS",
>  							  "USB_CH_TH_PROT_R",

[Severity: High]
Will this cause the ab8500_charger driver probe to fail on AB8505 platforms?

The device tree node relies on the "stericsson,ab8500-charger" fallback
compatible, but removes several interrupts. When the driver probes, it
unconditionally searches for all 14 interrupts defined in ab8500_charger_irq:

drivers/power/supply/ab8500_charger.c:ab8500_charger_probe() {
	...
	/* Request interrupts */
	for (i = 0; i < ARRAY_SIZE(ab8500_charger_irq); i++) {
		irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name);
		if (irq < 0)
			return irq;
	...
}

Because interrupts like "MAIN_CH_UNPLUG_DET" are now missing from the device
tree, platform_get_irq_byname() will return a negative error code. This
triggers the if (irq < 0) check and immediately aborts the probe, leaving
the system without USB charger support.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260918-ab8500-charger-dt-v2-0-5f17c332a2a7@kernel.org?part=2

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

* Re: [PATCH v2 1/2] dt-bindings: power: supply: ab8500: Add AB8505 charger
  2026-09-18 16:56 ` [PATCH v2 1/2] dt-bindings: power: supply: ab8500: Add AB8505 charger Linus Walleij
@ 2026-09-18 17:08   ` sashiko-bot
  2026-09-20 18:14   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-09-18 17:08 UTC (permalink / raw)
  To: Linus Walleij; +Cc: devicetree, robh, conor+dt

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] power: supply: ab8500: driver probe fails on AB8505 due to 9-interrupt schema constraint
- [Medium] dt-bindings: power: supply: ab8500: missing io-channels variant constraints
- [Medium] dt-bindings: power: supply: ab8500: autopower_cfg missing variant restriction
--

commit 1fff99ca786343bf578c093a179ec7f5838e1bb0
Author: Linus Walleij <linusw@kernel.org>

dt-bindings: power: supply: ab8500: Add AB8505 charger

AB8500 and AB8505 expose different charger interrupt sets. Add a unique
AB8505 charger compatible with the AB8500 compatible as its fallback.
Use the variant-specific string to require the fourteen main and USB
charger interrupts on AB8500 and the nine USB charger interrupts on
AB8505.

> diff --git a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
> index 4f19744844e9c..73f5df2d7a36b 100644
> --- a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
> @@ -12,10 +12,58 @@ maintainers:
>  
>  allOf:
>    - $ref: power-supply.yaml#
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: stericsson,ab8505-charger
> +    then:
> +      properties:

[Severity: Medium]
Should there be an io-channels variant constraint for AB8505 here?

A device tree could specify the stericsson,ab8500-charger compatible but only
provide 2 IO channels (vbus_v and usb_charger_c).

This would pass the global schema check since io-channels allows between 2 and
4, but the driver strictly requires 4 channels (including main_charger_v) for
AB8500 hardware:

drivers/power/supply/ab8500_charger.c:ab8500_charger_probe() {
	if (!is_ab8505(di->parent)) {
		di->adc_main_charger_v = devm_iio_channel_get(dev, "main_charger_v");
		if (IS_ERR(di->adc_main_charger_v)) {
            ...
}

Should the schema enforce minItems: 4 for AB8500 and maxItems: 2 for AB8505
within these new variant conditional blocks to prevent invalid configurations
from passing schema validation but failing during probe?


[Severity: Medium]
Does the autopower_cfg property need to be restricted to false in this AB8505
conditional block?

If a device tree for an AB8505 system incorrectly includes this property, the
schema allows it because it's defined globally but not restricted here.

The driver would then read it and later call
ab8500_enable_disable_sw_fallback(), writing to bit 0 of register 0x03
(AB8500_SW_CONTROL_FALLBACK).

Since the commit message explicitly states this bit is reserved on AB8505,
could writing to it cause undefined behavior?

> +        interrupts:
> +          minItems: 9
> +          maxItems: 9

[Severity: High]
Does this break the probe of the ab8500-charger driver on AB8505 hardware?

A device tree for an AB8505 system conforming to this newly introduced schema
would provide only 9 USB charger interrupts.

During driver probe, the driver unconditionally iterates over its hardcoded
ab8500_charger_irq array of 14 interrupts:

drivers/power/supply/ab8500_charger.c:ab8500_charger_probe() {
	for (i = 0; i < ARRAY_SIZE(ab8500_charger_irq); i++) {
		irq = platform_get_irq_byname(pdev, ab8500_charger_irq[i].name);
		if (irq < 0)
			return irq;
    ...
}

When it calls platform_get_irq_byname() for the missing main charger
interrupts, won't it receive an error code (e.g., -ENXIO) and immediately
return it, aborting the probe?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260918-ab8500-charger-dt-v2-0-5f17c332a2a7@kernel.org?part=1

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

* Re: [PATCH v2 1/2] dt-bindings: power: supply: ab8500: Add AB8505 charger
  2026-09-18 16:56 ` [PATCH v2 1/2] dt-bindings: power: supply: ab8500: Add AB8505 charger Linus Walleij
  2026-09-18 17:08   ` sashiko-bot
@ 2026-09-20 18:14   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2026-09-20 18:14 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Sebastian Reichel, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	linux-pm, devicetree

On Fri, Sep 18, 2026 at 06:56:51PM +0200, Linus Walleij wrote:
> AB8500 and AB8505 expose different charger interrupt sets. Add a unique
> AB8505 charger compatible with the AB8500 compatible as its fallback.
> Use the variant-specific string to require the fourteen main and USB
> charger interrupts on AB8500 and the nine USB charger interrupts on
> AB8505.
> 
> Also clarify that autopower_cfg describes the AB8500 facility, since the
> corresponding AB8505 register bit is reserved.
> 
> Fixes: eb917497734c ("dt-bindings: power: supply: ab8500: Convert to DT schema format")
> Assisted-by: LLM
> Signed-off-by: Linus Walleij <linusw@kernel.org>
> ---
>  .../power/supply/stericsson,ab8500-charger.yaml    | 70 ++++++++++++++++------
>  1 file changed, 53 insertions(+), 17 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
> index 4f19744844e9..73f5df2d7a36 100644
> --- a/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/stericsson,ab8500-charger.yaml
> @@ -12,10 +12,58 @@ maintainers:
>  
>  allOf:
>    - $ref: power-supply.yaml#

Please move the allOf after the "required:" block. The constraints
shouldn't not be before the actual top-level properties for readability.


With this:

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>

Best regards,
Krzysztof


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

* Re: [PATCH v2 2/2] ARM: dts: ux500: Use AB8505 charger compatible
  2026-09-18 17:07   ` sashiko-bot
@ 2026-09-20 22:49     ` Linus Walleij
  0 siblings, 0 replies; 7+ messages in thread
From: Linus Walleij @ 2026-09-20 22:49 UTC (permalink / raw)
  To: sashiko-reviews; +Cc: robh, conor+dt, devicetree

Hi Sashiko,

On Fri, Sep 18, 2026 at 7:07 PM <sashiko-bot@kernel.org> wrote:

> [Severity: High]
> Will this cause the ab8500_charger driver probe to fail on AB8505 platforms?
>
> The device tree node relies on the "stericsson,ab8500-charger" fallback
> compatible, but removes several interrupts. When the driver probes, it
> unconditionally searches for all 14 interrupts defined in ab8500_charger_irq:

This is fixed in an orthogonal patch series. No worry.

Yours,
Linus Walleij

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

end of thread, other threads:[~2026-09-20 22:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-18 16:56 [PATCH v2 0/2] power: supply: Correct AB8505 charger device tree Linus Walleij
2026-09-18 16:56 ` [PATCH v2 1/2] dt-bindings: power: supply: ab8500: Add AB8505 charger Linus Walleij
2026-09-18 17:08   ` sashiko-bot
2026-09-20 18:14   ` Krzysztof Kozlowski
2026-09-18 16:56 ` [PATCH v2 2/2] ARM: dts: ux500: Use AB8505 charger compatible Linus Walleij
2026-09-18 17:07   ` sashiko-bot
2026-09-20 22:49     ` Linus Walleij

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