From 26c777c5e0b7533378641f2ab681ea3587bc69ce Mon Sep 17 00:00:00 2001 From: li feng Date: Tue, 10 Feb 2015 16:34:42 -0800 Subject: [PATCH] Strago: Enable and config charger BQ24770 BUG=None BRANCH=None TEST=Battery Charging was valitated. 1.Tested with a Dead Battery and saw it charging. 2.Battery Full charge condition was validated. Signed-off-by: li feng Change-Id: If81d700aff2b929f8f8fc183fea4bdece00c4a46 Signed-off-by: Divya Jyothi Reviewed-on: https://chromium-review.googlesource.com/265541 Tested-by: Kevin K Wong Reviewed-by: Shawn N Commit-Queue: Kevin K Wong --- board/strago/board.c | 6 ++++++ board/strago/board.h | 14 ++++++++++++++ board/strago/ec.tasklist | 11 ++++++----- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/board/strago/board.c b/board/strago/board.c index 586eac8552..06628fcae6 100644 --- a/board/strago/board.c +++ b/board/strago/board.c @@ -4,6 +4,7 @@ */ /* Strago board-specific configuration */ +#include "charger.h" #include "driver/temp_sensor/tmp432.h" #include "extpower.h" #include "gpio.h" @@ -64,3 +65,8 @@ struct ec_thermal_config thermal_params[] = { {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */ }; BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT); + +int board_discharge_on_ac(int enable) +{ + return charger_discharge_on_ac(enable); +} diff --git a/board/strago/board.h b/board/strago/board.h index 4a46c8745c..b8d4b8a132 100644 --- a/board/strago/board.h +++ b/board/strago/board.h @@ -34,6 +34,16 @@ #define CONFIG_TEMP_SENSOR #define CONFIG_TEMP_SENSOR_TMP432 +#define CONFIG_CHARGER +#define CONFIG_BATTERY_SMART +#define CONFIG_CHARGER_V2 +#define CONFIG_CHARGER_BQ24770 +#define CONFIG_CHARGER_ILIM_PIN_DISABLED +#define CONFIG_CHARGER_SENSE_RESISTOR 10 +#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10 +#define CONFIG_CHARGER_INPUT_CURRENT 2240 +#define CONFIG_CHARGER_DISCHARGE_ON_AC + #define CONFIG_I2C /* I2C ports */ @@ -77,6 +87,10 @@ enum temp_sensor_id { TEMP_SENSOR_COUNT }; + +/* Discharge battery when on AC power for factory test. */ +int board_discharge_on_ac(int enable); + #endif /* !__ASSEMBLER__ */ #endif /* __BOARD_H */ diff --git a/board/strago/ec.tasklist b/board/strago/ec.tasklist index bee345cf29..354d7e45fc 100644 --- a/board/strago/ec.tasklist +++ b/board/strago/ec.tasklist @@ -18,9 +18,10 @@ */ #define CONFIG_TASK_LIST \ TASK_ALWAYS(HOOKS, hook_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ - TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \ + TASK_ALWAYS(CHARGER, charger_task, NULL, TASK_STACK_SIZE) \ TASK_NOTEST(CHIPSET, chipset_task, NULL, TASK_STACK_SIZE) \ - TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) + TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \ + TASK_ALWAYS(HOSTCMD, host_command_task, NULL, TASK_STACK_SIZE) \ + TASK_ALWAYS(CONSOLE, console_task, NULL, TASK_STACK_SIZE) \ + TASK_ALWAYS(POWERBTN, power_button_task, NULL, TASK_STACK_SIZE) \ + TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE)