From: Venkat Yadlapati via B4 Relay <devnull+venkat.yadlapati.yahoo.com@kernel.org>
To: Sebastian Reichel <sre@kernel.org>
Cc: linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
linux-kernel@vger.kernel.org, Joonhoe Kim <26rote@gmail.com>,
phone-devel@vger.kernel.org,
Venkat Yadlapati <venkat.yadlapati@yahoo.com>
Subject: [PATCH v2 2/2] power: supply: qcom_battmgr: Don't limit the input current of chargers
Date: Mon, 23 Nov 2026 00:50:16 +0530 [thread overview]
Message-ID: <20261123-vantage-battmgr-v2-2-03a419078d0a@yahoo.com> (raw)
In-Reply-To: <20261123-vantage-battmgr-v2-0-03a419078d0a@yahoo.com>
From: Venkat Yadlapati <venkat.yadlapati@yahoo.com>
The input current limit of the USB power supply is meant for the current
a USB host grants, e.g. after enumeration. Like the downstream driver,
only apply it to SDP, CDP and USB PD ports, so that a dedicated charger
is never throttled to what a USB controller reports.
Signed-off-by: Venkat Yadlapati <venkat.yadlapati@yahoo.com>
---
drivers/power/supply/qcom_battmgr.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/power/supply/qcom_battmgr.c b/drivers/power/supply/qcom_battmgr.c
index fde9704d0acd..db117cb64a17 100644
--- a/drivers/power/supply/qcom_battmgr.c
+++ b/drivers/power/supply/qcom_battmgr.c
@@ -1152,6 +1152,24 @@ static int qcom_battmgr_usb_set_icl(struct qcom_battmgr *battmgr, u32 icl)
{
int ret;
+ ret = qcom_battmgr_usb_sm8350_update(battmgr, POWER_SUPPLY_PROP_USB_TYPE);
+ if (ret)
+ return ret;
+
+ /*
+ * The limit is meant for the current a USB host grants, e.g. after
+ * enumeration, like the downstream driver don't let it throttle
+ * dedicated chargers.
+ */
+ switch (battmgr->usb.usb_type) {
+ case POWER_SUPPLY_USB_TYPE_SDP:
+ case POWER_SUPPLY_USB_TYPE_CDP:
+ case POWER_SUPPLY_USB_TYPE_PD:
+ break;
+ default:
+ return -EINVAL;
+ }
+
mutex_lock(&battmgr->lock);
ret = qcom_battmgr_request_property(battmgr, BATTMGR_USB_PROPERTY_SET,
USB_INPUT_CURR_LIMIT, icl);
--
2.56.1
prev parent reply other threads:[~2026-11-22 19:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 19:20 [PATCH v2 0/2] power: supply: qcom_battmgr: Apply the USB host current limit early Venkat Yadlapati via B4 Relay
2026-11-22 19:20 ` [PATCH v2 1/2] power: supply: qcom_battmgr: Apply a USB input current limit set early Venkat Yadlapati via B4 Relay
2026-11-22 19:20 ` Venkat Yadlapati via B4 Relay [this message]
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=20261123-vantage-battmgr-v2-2-03a419078d0a@yahoo.com \
--to=devnull+venkat.yadlapati.yahoo.com@kernel.org \
--cc=26rote@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=phone-devel@vger.kernel.org \
--cc=sre@kernel.org \
--cc=venkat.yadlapati@yahoo.com \
/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®