diff options
author | Vic Yang <victoryang@chromium.org> | 2013-08-27 15:37:30 +0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-08-28 01:16:46 +0000 |
commit | 07428351b6df572456a8896222c6d011a7450af5 (patch) | |
tree | 6cc653dddb6dae1cecb047c82c41d50e6a6cb6bd /common | |
parent | 9ab0d4f521082473cf8b9869c9232c724806c845 (diff) | |
download | chrome-ec-07428351b6df572456a8896222c6d011a7450af5.tar.gz |
Remove normal mode in USB extpower module
We are now only using aggressive mode. Let's remove normal mode to
simplify the code.
BUG=None
TEST=Build and boot Spring. Check charging works.
BRANCH=None
Change-Id: I2ffa94c14666d35e718101c666af05be7291b775
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/67029
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/extpower_usb.c | 55 |
1 files changed, 8 insertions, 47 deletions
diff --git a/common/extpower_usb.c b/common/extpower_usb.c index 465c8ee651..28db352327 100644 --- a/common/extpower_usb.c +++ b/common/extpower_usb.c @@ -107,11 +107,6 @@ static int pending_video_power_off; static int restore_id_mux; static enum { - LIMIT_NORMAL, - LIMIT_AGGRESSIVE, -} current_limit_mode = LIMIT_AGGRESSIVE; - -static enum { ADC_WATCH_NONE, ADC_WATCH_TOAD, ADC_WATCH_USB, @@ -240,15 +235,12 @@ static int apple_charger_current(void) static int hard_current_limit(int limit) { /* - * In aggressive mode, the PWM duty cycle goes lower than the nominal + * The PWM duty cycle goes lower than the nominal * cycle for PWM_CTRL_OC_MARGIN. Therefore, increase duty cycle by * PWM_CTRL_OC_MARGIN avoids going over the hard limit. * (Note that lower PWM cycle translates to higher current) */ - if (current_limit_mode == LIMIT_AGGRESSIVE) - return MIN(limit + PWM_CTRL_OC_MARGIN, 100); - else - return limit; + return MIN(limit + PWM_CTRL_OC_MARGIN, 100); } static int video_dev_type(int device_type) @@ -324,19 +316,12 @@ static void set_pwm_duty_cycle(int percent) */ static int pwm_get_next_lower(void) { - if (current_limit_mode == LIMIT_AGGRESSIVE) { - if (current_pwm_duty > nominal_pwm_duty - - PWM_CTRL_OC_MARGIN && - current_pwm_duty > over_current_pwm_duty && - current_pwm_duty > 0) - return MAX(current_pwm_duty - PWM_CTRL_STEP_DOWN, 0); - return -1; - } else { - if (current_pwm_duty > nominal_pwm_duty && current_pwm_duty > 0) - return MAX(current_pwm_duty - PWM_CTRL_STEP_DOWN, 0); - else - return -1; - } + if (current_pwm_duty > nominal_pwm_duty - + PWM_CTRL_OC_MARGIN && + current_pwm_duty > over_current_pwm_duty && + current_pwm_duty > 0) + return MAX(current_pwm_duty - PWM_CTRL_STEP_DOWN, 0); + return -1; } static int pwm_check_vbus_low(int vbus, int battery_current) @@ -923,30 +908,6 @@ static int command_batdebug(int argc, char **argv) DECLARE_CONSOLE_COMMAND(batdebug, command_batdebug, NULL, NULL, NULL); -static int command_current_limit_mode(int argc, char **argv) -{ - if (1 == argc) { - if (current_limit_mode == LIMIT_NORMAL) - ccprintf("Normal mode\n"); - else - ccprintf("Aggressive mode\n"); - return EC_SUCCESS; - } else if (2 == argc) { - if (!strcasecmp(argv[1], "normal")) - current_limit_mode = LIMIT_NORMAL; - else if (!strcasecmp(argv[1], "aggressive")) - current_limit_mode = LIMIT_AGGRESSIVE; - else - return EC_ERROR_INVAL; - return EC_SUCCESS; - } - return EC_ERROR_INVAL; -} -DECLARE_CONSOLE_COMMAND(limitmode, command_current_limit_mode, - "[normal | aggressive]", - "Set current limit mode", - NULL); - /*****************************************************************************/ /* Host commands */ |