* [PATCH 0/2] usb: misc: usb251xb: add DT battery charging configuration
@ 2026-11-03 18:55 Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 18:55 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Add a Device Tree property to configure battery charging on selected downstream
ports of Microchip USB251x hubs.
The first patch documents the battery-charging-enable property and adds an
example enabling charging on ports 1 and 2. The second parses the port list and
sets the corresponding hub configuration bits. Charging remains disabled on
all ports when the property is omitted.
Jhon Wilker Rodrigues Aquino (2):
dt-bindings: usb: microchip,usb251xb: add battery-charging-enable
property
usb: misc: usb251xb: configure battery charging from DT
Documentation/devicetree/bindings/usb/usb251xb.yaml | 7 +++++++
drivers/usb/misc/usb251xb.c | 5 ++++-
2 files changed, 11 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property
2026-11-03 18:55 [PATCH 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
@ 2026-11-03 18:55 ` Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2 siblings, 0 replies; 7+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 18:55 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Describe the battery-charging-enable property as a list of downstream ports in the USB251x device tree binding.
Add an example that enables charging on ports 1 and 2.
Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
---
Documentation/devicetree/bindings/usb/usb251xb.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/usb251xb.yaml b/Documentation/devicetree/bindings/usb/usb251xb.yaml
index 0329a6aaaa928..0eb3035553c37 100644
--- a/Documentation/devicetree/bindings/usb/usb251xb.yaml
+++ b/Documentation/devicetree/bindings/usb/usb251xb.yaml
@@ -230,6 +230,12 @@ properties:
Specifies the time it takes from the time the host initiates the
power-on sequence to a port until the port has adequate power.
+ battery-charging-enable:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description: |
+ Specifies the downstream ports which will have battery charging enabled.
+ Battery charging is disabled on all ports by default.
+
swap-dx-lanes:
$ref: /schemas/types.yaml#/definitions/uint32-array
description: |
@@ -264,6 +270,7 @@ examples:
manufacturer = "Foo";
product = "Foo-Bar";
serial = "1234567890A";
+ battery-charging-enable = <1 2>;
/* correct misplaced usb connectors on port 1,2 */
swap-dx-lanes = <1 2>;
};
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT
2026-11-03 18:55 [PATCH 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
@ 2026-11-03 18:55 ` Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2 siblings, 0 replies; 7+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 18:55 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Parse the battery-charging-enable port list from the device tree and set the corresponding bits in the hub configuration register.
Keep charging disabled by default when the property is omitted.
Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
---
drivers/usb/misc/usb251xb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index fb0693742f018..166eb541ef161 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -577,6 +577,10 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
(wchar_t *)hub->serial,
USB251XB_STRING_BUFSIZE);
+ hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
+ usb251xb_get_ports_field(hub, "battery-charging-enable", data->port_cnt,
+ true, &hub->bat_charge_en);
+
/*
* The datasheet documents the register as 'Port Swap' but in real the
* register controls the USB DP/DM signal swapping for each port.
@@ -588,7 +592,6 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
/* The following parameters are currently not exposed to devicetree, but
* may be as soon as needed.
*/
- hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
hub->boost_57 = USB251XB_DEF_BOOST_57;
hub->boost_14 = USB251XB_DEF_BOOST_14;
hub->port_map12 = USB251XB_DEF_PORT_MAP_12;
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration
2026-11-03 18:55 [PATCH 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
@ 2026-11-03 20:01 ` Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
2 siblings, 2 replies; 7+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 20:01 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Add a Device Tree property to configure battery charging on selected downstream
ports of Microchip USB251x hubs.
The first patch documents the battery-charging-enable property and adds an
example enabling charging on ports 1 and 2. The second parses the port list and
sets the corresponding hub configuration bits. Charging remains disabled on
all ports when the property is omitted.
Changes in v2:
- Only parse battery-charging-enable when the chip variant supports battery charging.
Jhon Wilker Rodrigues Aquino (2):
dt-bindings: usb: microchip,usb251xb: add battery-charging-enable
property
usb: misc: usb251xb: configure battery charging from DT
Documentation/devicetree/bindings/usb/usb251xb.yaml | 7 +++++++
drivers/usb/misc/usb251xb.c | 6 +++++-
2 files changed, 12 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
@ 2026-11-03 20:01 ` Jhon Wilker Rodrigues Aquino
2026-11-03 20:52 ` Krzysztof Kozlowski
2026-11-03 20:01 ` [PATCH v2 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
1 sibling, 1 reply; 7+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 20:01 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Describe the battery-charging-enable property as a list of downstream ports in the USB251x device tree binding.
Add an example that enables charging on ports 1 and 2.
Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
---
Documentation/devicetree/bindings/usb/usb251xb.yaml | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/Documentation/devicetree/bindings/usb/usb251xb.yaml b/Documentation/devicetree/bindings/usb/usb251xb.yaml
index 0329a6aaaa928..0eb3035553c37 100644
--- a/Documentation/devicetree/bindings/usb/usb251xb.yaml
+++ b/Documentation/devicetree/bindings/usb/usb251xb.yaml
@@ -230,6 +230,12 @@ properties:
Specifies the time it takes from the time the host initiates the
power-on sequence to a port until the port has adequate power.
+ battery-charging-enable:
+ $ref: /schemas/types.yaml#/definitions/uint32-array
+ description: |
+ Specifies the downstream ports which will have battery charging enabled.
+ Battery charging is disabled on all ports by default.
+
swap-dx-lanes:
$ref: /schemas/types.yaml#/definitions/uint32-array
description: |
@@ -264,6 +270,7 @@ examples:
manufacturer = "Foo";
product = "Foo-Bar";
serial = "1234567890A";
+ battery-charging-enable = <1 2>;
/* correct misplaced usb connectors on port 1,2 */
swap-dx-lanes = <1 2>;
};
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] usb: misc: usb251xb: configure battery charging from DT
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
@ 2026-11-03 20:01 ` Jhon Wilker Rodrigues Aquino
1 sibling, 0 replies; 7+ messages in thread
From: Jhon Wilker Rodrigues Aquino @ 2026-11-03 20:01 UTC (permalink / raw)
To: Richard Leitner, Greg Kroah-Hartman, Rob Herring,
Krzysztof Kozlowski, Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Parse the battery-charging-enable port list from the device tree and set the corresponding bits in the hub configuration register.
Keep charging disabled by default when the property is omitted.
Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
---
drivers/usb/misc/usb251xb.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/misc/usb251xb.c b/drivers/usb/misc/usb251xb.c
index fb0693742f018..7c0086a554cfe 100644
--- a/drivers/usb/misc/usb251xb.c
+++ b/drivers/usb/misc/usb251xb.c
@@ -577,6 +577,11 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
(wchar_t *)hub->serial,
USB251XB_STRING_BUFSIZE);
+ hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
+ if (data->bat_support)
+ usb251xb_get_ports_field(hub, "battery-charging-enable",
+ data->port_cnt, true, &hub->bat_charge_en);
+
/*
* The datasheet documents the register as 'Port Swap' but in real the
* register controls the USB DP/DM signal swapping for each port.
@@ -588,7 +593,6 @@ static int usb251xb_get_ofdata(struct usb251xb *hub,
/* The following parameters are currently not exposed to devicetree, but
* may be as soon as needed.
*/
- hub->bat_charge_en = USB251XB_DEF_BATTERY_CHARGING_ENABLE;
hub->boost_57 = USB251XB_DEF_BOOST_57;
hub->boost_14 = USB251XB_DEF_BOOST_14;
hub->port_map12 = USB251XB_DEF_PORT_MAP_12;
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property
2026-11-03 20:01 ` [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
@ 2026-11-03 20:52 ` Krzysztof Kozlowski
0 siblings, 0 replies; 7+ messages in thread
From: Krzysztof Kozlowski @ 2026-11-03 20:52 UTC (permalink / raw)
To: Jhon Wilker Rodrigues Aquino, Richard Leitner,
Greg Kroah-Hartman, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: linux-usb, devicetree, linux-kernel, Jhon Wilker Rodrigues Aquino
On 03/11/2026 21:01, Jhon Wilker Rodrigues Aquino wrote:
> From: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Do not attach (thread) your patchsets to some other threads (unrelated
or older versions). This buries them deep in the mailbox and might
interfere with applying entire sets. See also:
https://elixir.bootlin.com/linux/v6.16-rc2/source/Documentation/process/submitting-patches.rst#L830
>
> Describe the battery-charging-enable property as a list of downstream ports in the USB251x device tree binding.
Please wrap commit message according to Linux coding style / submission
process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597
Please run scripts/checkpatch.pl on the patches and fix reported
warnings. After that, run also 'scripts/checkpatch.pl --strict' on the
patches and (probably) fix more warnings. Some warnings can be ignored,
especially from --strict run, but the code here looks like it needs a
fix. Feel free to get in touch if the warning is not clear.
>
> Add an example that enables charging on ports 1 and 2.
>
> Signed-off-by: Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
> ---
> Documentation/devicetree/bindings/usb/usb251xb.yaml | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/usb/usb251xb.yaml b/Documentation/devicetree/bindings/usb/usb251xb.yaml
> index 0329a6aaaa928..0eb3035553c37 100644
> --- a/Documentation/devicetree/bindings/usb/usb251xb.yaml
> +++ b/Documentation/devicetree/bindings/usb/usb251xb.yaml
> @@ -230,6 +230,12 @@ properties:
> Specifies the time it takes from the time the host initiates the
> power-on sequence to a port until the port has adequate power.
>
> + battery-charging-enable:
Custom properties needs prefix, see writing bindings.
> + $ref: /schemas/types.yaml#/definitions/uint32-array
> + description: |
Do not need '|' unless you need to preserve formatting.
> + Specifies the downstream ports which will have battery charging enabled.
> + Battery charging is disabled on all ports by default.
Why wouldn't you enable charging on all ports? You have entire
description (and/or commit msg) to explain why you are doing this and
why this is exactly hardware property.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-03 20:53 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 18:55 [PATCH 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
2026-11-03 18:55 ` [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 0/2] usb: misc: usb251xb: add DT battery charging configuration Jhon Wilker Rodrigues Aquino
2026-11-03 20:01 ` [PATCH v2 1/2] dt-bindings: usb: microchip,usb251xb: add battery-charging-enable property Jhon Wilker Rodrigues Aquino
2026-11-03 20:52 ` Krzysztof Kozlowski
2026-11-03 20:01 ` [PATCH v2 2/2] usb: misc: usb251xb: configure battery charging from DT Jhon Wilker Rodrigues Aquino
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®