diff options
author | Badhri Jagan Sridharan <badhri@google.com> | 2023-08-11 22:25:18 +0000 |
---|---|---|
committer | Zheng Pan <zhengpan@google.com> | 2023-08-15 03:32:17 +0000 |
commit | ad18801e339bec714e2c145c301c44180990efef (patch) | |
tree | c0e2e15a0111bb4af709ae1c0ee54a18fb6c385f | |
parent | 445d33b7bcc660af035a13fe37c7785cc238ab75 (diff) | |
download | gs-android-gs-shusky-5.15-android14-d1.tar.gz |
usb_psy: Fix CURRENT_MAX updatesandroid-14.0.0_r0.8android-gs-shusky-5.15-android14-d1
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 <badhri@google.com>
-rw-r--r-- | drivers/usb/typec/tcpm/google/usb_psy.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/usb/typec/tcpm/google/usb_psy.c b/drivers/usb/typec/tcpm/google/usb_psy.c index 9e6b3f3a2..acab2c947 100644 --- a/drivers/usb/typec/tcpm/google/usb_psy.c +++ b/drivers/usb/typec/tcpm/google/usb_psy.c @@ -389,8 +389,9 @@ static int usb_psy_data_get_prop(struct power_supply *psy, * 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 */ |