From: Jhon Wilker Rodrigues Aquino <jhonwilker0112@gmail.com>
To: Richard Leitner <richard.leitner@linux.dev>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Jhon Wilker Rodrigues Aquino <jhon.aquino@autotrac.com.br>
Subject: [PATCH 2/2] usb: misc: usb251xb: configure battery charging from DT
Date: Tue, 3 Nov 2026 15:55:14 -0300 [thread overview]
Message-ID: <20261103185514.72144-3-jhonwilker0112@gmail.com> (raw)
In-Reply-To: <20261103185514.72144-1-jhonwilker0112@gmail.com>
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
next prev parent reply other threads:[~2026-11-03 18:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261103185514.72144-3-jhonwilker0112@gmail.com \
--to=jhonwilker0112@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jhon.aquino@autotrac.com.br \
--cc=krzk+dt@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=richard.leitner@linux.dev \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®