summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcloud_lin <cloud_lin@compal.com>2014-03-10 17:23:41 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-18 11:24:20 +0000
commit24417669a626fcda285c79aa8fa54268683d695a (patch)
tree6439653deaa92f176d2be79e9b53772d17478397
parent8dc20291b2b77cf534d1d84ea94adcb941422074 (diff)
downloadchrome-ec-24417669a626fcda285c79aa8fa54268683d695a.tar.gz
Big: Add ectool discharge command.
BRANCH=big BUG=None TEST=Run ectool chargecontrol command with each option (normal, idle, discharge) on Big. Verifiy battery is discharging in discharge mode via EC console 'battery' command. Signed-off-by: Cloud Lin <Cloud_Lin@compal.com> Change-Id: Iab150c36df64016d06831a6a6c620742738ae2af Reviewed-on: https://chromium-review.googlesource.com/189450 Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org> Tested-by: Lin Cloud <cloud_lin@compal.com> Commit-Queue: Lin Cloud <cloud_lin@compal.com>
-rw-r--r--board/big/board.c9
-rw-r--r--board/big/board.h4
-rw-r--r--driver/charger/bq24725.c17
3 files changed, 30 insertions, 0 deletions
diff --git a/board/big/board.c b/board/big/board.c
index 815f543dfb..aae31dd5cb 100644
--- a/board/big/board.c
+++ b/board/big/board.c
@@ -22,6 +22,7 @@
#include "task.h"
#include "util.h"
#include "timer.h"
+#include "charger.h"
#define GPIO_KB_INPUT (GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH)
#define GPIO_KB_OUTPUT GPIO_ODR_HIGH
@@ -117,3 +118,11 @@ const struct pwm_t pwm_channels[] = {
PWM_CONFIG_ACTIVE_LOW, GPIO_LED_POWER_L},
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+
+/**
+ * Discharge battery when on AC power for factory test.
+ */
+int board_discharge_on_ac(int enable)
+{
+ return charger_discharge_on_ac(enable);
+}
diff --git a/board/big/board.h b/board/big/board.h
index f671702f3f..8ff78d957c 100644
--- a/board/big/board.h
+++ b/board/big/board.h
@@ -24,6 +24,7 @@
#define CONFIG_POWER_BUTTON
#define CONFIG_VBOOT_HASH
#define CONFIG_LED_COMMON
+#define CONFIG_CHARGER_DISCHARGE_ON_AC
#ifndef __ASSEMBLER__
@@ -115,6 +116,9 @@ enum pwm_channel {
#define CONFIG_CHARGER_INPUT_CURRENT 4032 /* mA, based on Link HW design */
#define CONFIG_CHARGER_CURRENT_LIMIT 3000 /* PL102 inductor 3.0A(3.8A) */
+/* Discharge battery when on AC power for factory test. */
+int board_discharge_on_ac(int enable);
+
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */
diff --git a/driver/charger/bq24725.c b/driver/charger/bq24725.c
index 2265a294b7..be6f223df2 100644
--- a/driver/charger/bq24725.c
+++ b/driver/charger/bq24725.c
@@ -164,3 +164,20 @@ int charger_post_init(void)
/* Set charger input current limit */
return charger_set_input_current(CONFIG_CHARGER_INPUT_CURRENT);
}
+
+int charger_discharge_on_ac(int enable)
+{
+ int rv;
+ int option;
+
+ rv = charger_get_option(&option);
+ if (rv)
+ return rv;
+
+ if (enable)
+ rv = charger_set_option(option | OPTION_LEARN_ENABLE);
+ else
+ rv = charger_set_option(option & ~OPTION_LEARN_ENABLE);
+
+ return rv;
+}