usb_psy: Fix CURRENT_MAX updates Report the max of actual current limit and DCP current limit to allow reporting actual values when PD charger is connected. PD negotiation might complete before BC1.2 and it makes sense to report the actual negotiated value in this case once the negotiation completes. Bug: 294875522 Test: dumpsys battery reports 9V/2A for the 18W charger Change-Id: I3f2aef252ac2538a5513a0dec5d291af68d061e7 Signed-off-by: Badhri Jagan Sridharan <[email protected]>
diff --git a/drivers/usb/typec/tcpm/google/usb_psy.c b/drivers/usb/typec/tcpm/google/usb_psy.c index 9e6b3f3..acab2c9 100644 --- a/drivers/usb/typec/tcpm/google/usb_psy.c +++ b/drivers/usb/typec/tcpm/google/usb_psy.c
@@ -389,8 +389,9 @@ * Report the voted value to reflect TA capability when * expedite_connect_status isn't set. */ - val->intval = usb->expedite_connect_status ? CDP_DCP_ICL_UA : - usb->current_max_cache; + val->intval = usb->expedite_connect_status ? + max(CDP_DCP_ICL_UA, usb->current_max_cache) : + usb->current_max_cache; break; case POWER_SUPPLY_PROP_VOLTAGE_MAX: /* Report in uv */