mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
8dc20291b2
commit
24417669a6
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user