summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadhri Jagan Sridharan <badhri@google.com>2023-08-11 22:25:18 +0000
committerZheng Pan <zhengpan@google.com>2023-08-15 03:32:17 +0000
commitad18801e339bec714e2c145c301c44180990efef (patch)
treec0e2e15a0111bb4af709ae1c0ee54a18fb6c385f
parent445d33b7bcc660af035a13fe37c7785cc238ab75 (diff)
downloadgs-android-gs-shusky-5.15-android14-d1.tar.gz
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.c5
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 */