diff options
author | Ryan Zhang <Ryan.Zhang@quanta.corp-partner.google.com> | 2017-06-30 17:00:03 +0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2017-07-12 01:33:07 +0000 |
commit | 2c652fb0cc5e21b8f40aea29da4dc344862ae626 (patch) | |
tree | b91b6ef7ca4f8df60ac4dd2617df7d996d837cff | |
parent | 71bdb186ee78c476e170889836a477da664c5763 (diff) | |
download | chrome-ec-2c652fb0cc5e21b8f40aea29da4dc344862ae626.tar.gz |
Lili: some 15W TypeC adapters will cause CPU throttled
We get adapter type: CHARGE_SUPPLIER_TYPEC and set input current limit to
3000mA and PROCHOT_AC is 3072mA by default. However these two limitation
values are so close that ISL9237 will trigger prochot and cause CPU throttled.
BUG=b:62291338
BRANCH=glados-7820.B
TEST=CPU throttling was release after 0x47 is set to 3200
Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Change-Id: I792dc1c1bc45d7c6cd82957cec1c2772341b76dd
Reviewed-on: https://chromium-review.googlesource.com/557742
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
-rw-r--r-- | driver/charger/isl9237.c | 16 | ||||
-rw-r--r-- | driver/charger/isl9237.h | 6 |
2 files changed, 22 insertions, 0 deletions
diff --git a/driver/charger/isl9237.c b/driver/charger/isl9237.c index 1ca8ea37fb..4ff0aaf337 100644 --- a/driver/charger/isl9237.c +++ b/driver/charger/isl9237.c @@ -71,6 +71,16 @@ static int isl9237_set_voltage(uint16_t voltage) return raw_write16(ISL9237_REG_SYS_VOLTAGE_MAX, voltage); } +static int get_prochot_ac_limit(void) +{ + int new_limit = AC_CURRENT_TO_REG(PD_MAX_CURRENT_MA * + ISL9237_PROCHOT_AC_TOLERANCE) + + ISL9237_PROCHOT_AC_STEP; + + /* round new value by minimum step */ + return new_limit - (new_limit % ISL9237_PROCHOT_AC_STEP); +} + /* chip specific interfaces */ int charger_set_input_current(int input_current) @@ -277,6 +287,12 @@ int charger_post_init(void) return rv; /* + * Set new threshold due to tolerance of isl9237. + */ + rv = raw_write16(ISL9237_REG_PROCHOT_AC, get_prochot_ac_limit()); + if (rv) + return rv; + /* * Set Battery Discharging current Prochot# threshold to maximum value * so Prochot# assertion is effectively disabled. */ diff --git a/driver/charger/isl9237.h b/driver/charger/isl9237.h index 27a3bab377..5a8b51f926 100644 --- a/driver/charger/isl9237.h +++ b/driver/charger/isl9237.h @@ -77,6 +77,12 @@ #define ISL9237_PROCHOT_AC_REG_MAX 6400 #define ISL9237_PROCHOT_DC_REG_MAX 12800 +/* AC PROCHOT minimum value for each step */ +#define ISL9237_PROCHOT_AC_STEP 128 + +/* ISL9237 has -3% ~ 3% tolerance by itself */ +#define ISL9237_PROCHOT_AC_TOLERANCE 1.05 + /* Control0: adapter voltage regulation reference */ #define ISL9237_C0_VREG_REF_3900 0 #define ISL9237_C0_VREG_REF_4200 1 |