Re: [PATCH 2/2] power: supply: qcom_battmgr: Don't limit the input current of chargers

From: Venkat Yadlapati

Date: Tue Dec 01 2026 - 11:09:28 EST


On 12/1/26 4:39 PM, Konrad Dybcio wrote:
> On 11/15/26 9:20 PM, Venkat Yadlapati via B4 Relay wrote:
>> + 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;
>
> msm-5.10 doesn't allow SDP here. What's your downstream tree?

The Motorola kernel for the Signature (SM8845):

https://github.com/MotorolaMobilityLLC/kernel-msm/blob/MMI-A171WVH.21-16-16/drivers/power/supply/qti_battery_charger.c

Its usb_psy_set_icl() reads USB_ADAP_TYPE and allows SDP, PD and CDP:

/* Allow this only for SDP, CDP or USB_PD and not for other charger types */
switch (pst->prop[USB_ADAP_TYPE]) {
case POWER_SUPPLY_USB_TYPE_SDP:
case POWER_SUPPLY_USB_TYPE_PD:
case POWER_SUPPLY_USB_TYPE_CDP:
break;

SDP is also the case this series is about: the phone connected to a
computer, where dwc3 reports 500 mA (USB 2.0) or 900 mA (USB 3.x)
after enumeration and the firmware otherwise stays at 100 mA.

> It also has a provision to reset this limit whenever the psy
> type changes

Right. As far as I can see, the reset there only clears the cached
value (bcdev->usb_icl_ua), in usb_psy_set_icl() for other types and in
the notification handler when the type stops being SDP/CDP/PD. That
cache is only used to re-apply the last limit after the firmware
restarts. Nothing is written to the firmware when the type changes.

v2 keeps no cached value once the service is up, so the reset has
nothing to clear yet. If v3 goes with the late registration you
suggested on 1/2, it keeps no cache at all. Re-applying the limit
after a firmware restart, the way downstream does, would need the
cache, and then the reset on a type change as well. Do you want that
in this series, or as a separate change?

Thanks,
Venkat