summaryrefslogtreecommitdiff
path: root/board/eldrid
diff options
context:
space:
mode:
authorTerry Chen <terry_chen@wistron.corp-partner.google.com>2020-11-12 15:29:48 +0800
committerCommit Bot <commit-bot@chromium.org>2020-12-03 21:39:06 +0000
commit99dba155820737065fc83749bc0e15f79b785546 (patch)
tree268884fb397e2502d84c77fd9e1fb12fda351069 /board/eldrid
parent5103f885bb9d37d94073cd32aec8fcb7945f2f7e (diff)
downloadchrome-ec-99dba155820737065fc83749bc0e15f79b785546.tar.gz
eldrid: modify charger configuration
BUG=b:166728543 BRANCH=firmware-volteer-13521.B-master TEST=make buildall Signed-off-by: Terry Chen <terry_chen@wistron.corp-partner.google.com> Change-Id: I1a918326a625f294fe6cd9a2ec8e2c5b2af43569 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2534231 Tested-by: Scott Chao <scott_chao@wistron.corp-partner.google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'board/eldrid')
-rw-r--r--board/eldrid/board.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/board/eldrid/board.c b/board/eldrid/board.c
index 1ce028d96e..cf46f04edb 100644
--- a/board/eldrid/board.c
+++ b/board/eldrid/board.c
@@ -24,6 +24,7 @@
#include "fan_chip.h"
#include "gpio.h"
#include "hooks.h"
+#include "isl9241.h"
#include "keyboard_8042_sharedlib.h"
#include "keyboard_raw.h"
#include "lid_switch.h"
@@ -73,10 +74,58 @@ union volteer_cbi_fw_config fw_config_defaults = {
.usb_db = DB_USB3_ACTIVE,
};
+static void board_charger_config(void)
+{
+ /*
+ * b/166728543, we configured charger setting to throttle CPU
+ * when the system loading is at battery current limit.
+ */
+ int reg;
+
+ /*
+ * Set DCProchot# to 5120mA
+ */
+ isl9241_set_dc_prochot(CHARGER_SOLO, 5120);
+
+ /*
+ * Set Control1 bit<3> = 1, PSYS = 1
+ */
+ if (i2c_read16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS,
+ ISL9241_REG_CONTROL1, &reg) == EC_SUCCESS) {
+ reg |= ISL9241_CONTROL1_PSYS;
+ if (i2c_write16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS,
+ ISL9241_REG_CONTROL1, reg))
+ CPRINTS("Failed to set isl9241");
+ }
+
+ /*
+ * Set Control2 bit<10:9> = 00, PROCHOT# Debounce = 7us
+ */
+ if (i2c_read16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS,
+ ISL9241_REG_CONTROL2, &reg) == EC_SUCCESS) {
+ reg &= ~ISL9241_CONTROL2_PROCHOT_DEBOUNCE_MASK;
+ if (i2c_write16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS,
+ ISL9241_REG_CONTROL2, reg))
+ CPRINTS("Failed to set isl9241");
+ }
+
+ /*
+ * Set Control4 bit<11> = 1, PSYS Rsense Ratio = 1:1
+ */
+ if (i2c_read16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS,
+ ISL9241_REG_CONTROL4, &reg) == EC_SUCCESS) {
+ reg |= ISL9241_CONTROL4_PSYS_RSENSE_RATIO;
+ if (i2c_write16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS,
+ ISL9241_REG_CONTROL4, reg))
+ CPRINTS("Failed to set isl9241");
+ }
+}
+
static void board_init(void)
{
pwm_enable(PWM_CH_LED4_SIDESEL, 1);
pwm_set_duty(PWM_CH_LED4_SIDESEL, 100);
+ board_charger_config();
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -125,6 +174,15 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
/*
+ * b/166728543
+ * Set different AC_PROCHOT value when using different wattage ADT.
+ */
+ if (max_ma * charge_mv == PD_MAX_POWER_MW * 1000)
+ isl9241_set_ac_prochot(0, 3072);
+ else
+ isl9241_set_ac_prochot(0, 2816);
+
+ /*
* Follow OEM request to limit the input current to
* 90% negotiated limit when S0.
*/