summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-07-02 17:23:59 +0800
committerChromeBot <chrome-bot@google.com>2013-07-08 17:57:15 -0700
commit46a2073437f9a150656d37e8bd9219b01b1b3ac1 (patch)
treedbde1bcea3a5c0d33efe40c2fa678a66b7d7cf5a
parent29a157e5276a4f0ed004aaab365ad9e32b68c250 (diff)
downloadchrome-ec-46a2073437f9a150656d37e8bd9219b01b1b3ac1.tar.gz
Remove fast PWM tweak mode
Fast mode was originally introduced to prevent the user seeing battery assist mode. Now that we don't report battery assist mode to the user, let's remove this mode to improve stability. BUG=None TEST=Charge with various chargers. See stable PWM duty cycles. BRANCH=Spring Change-Id: I4a2a66e03d50dea7a28fc826369dcf2b3452007a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60754 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/spring/usb_charging.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c
index b3496faf97..9faf422c56 100644
--- a/board/spring/usb_charging.c
+++ b/board/spring/usb_charging.c
@@ -68,7 +68,6 @@
#define PWM_CTRL_OC_RETRY 2
#define PWM_CTRL_STEP_DOWN 3
#define PWM_CTRL_STEP_UP 5
-#define PWM_CTRL_STEP_FAST_DOWN 15
#define PWM_CTRL_VBUS_HARD_LOW 4400
#define PWM_CTRL_VBUS_LOW 4500
#define PWM_CTRL_VBUS_HIGH 4700 /* Must be higher than 4.5V */
@@ -88,7 +87,6 @@ static int current_dev_type = TSU6721_TYPE_NONE;
static int nominal_pwm_duty;
static int current_pwm_duty;
static int user_pwm_duty = -1;
-static int pwm_fast_mode;
static int pending_tsu6721_reset;
static int pending_adc_watchdog_disable;
@@ -371,13 +369,7 @@ void board_pwm_init_limit(void)
*/
static int board_pwm_get_next_lower(void)
{
- int fast_next = current_pwm_duty - PWM_CTRL_STEP_FAST_DOWN;
-
if (current_limit_mode == LIMIT_AGGRESSIVE) {
- if (pwm_fast_mode &&
- fast_next > nominal_pwm_duty - PWM_CTRL_OC_MARGIN &&
- fast_next > over_current_pwm_duty)
- return MAX(fast_next, 0);
if (current_pwm_duty > nominal_pwm_duty -
PWM_CTRL_OC_MARGIN &&
current_pwm_duty > over_current_pwm_duty &&
@@ -438,7 +430,6 @@ static void board_pwm_tweak(void)
*/
if (board_pwm_check_vbus_low(vbus, current)) {
board_pwm_duty_cycle(current_pwm_duty + PWM_CTRL_STEP_UP);
- pwm_fast_mode = 0;
CPRINTF("[%T PWM duty up %d%%]\n", current_pwm_duty);
} else if (board_pwm_check_vbus_high(vbus)) {
next = board_pwm_get_next_lower();
@@ -466,7 +457,6 @@ void board_pwm_nominal_duty_cycle(int percent)
board_pwm_duty_cycle(new_percent);
nominal_pwm_duty = percent;
- pwm_fast_mode = 1;
}
void usb_charge_interrupt(enum gpio_signal signal)
@@ -577,11 +567,15 @@ static void usb_detect_overcurrent(int dev_type)
}
if (power_removed_type[idx] == dev_type) {
if (oc_detect_retry[idx] > 0) {
+ CPRINTF("[%T USB overcurrent: Retry (%d)]\n",
+ oc_detect_retry[idx]);
oc_detect_retry[idx]--;
return;
}
over_current_pwm_duty = power_removed_pwm_duty[idx] +
PWM_CTRL_OC_BACK_OFF;
+ CPRINTF("[%T USB overcurrent: Limited to %d%%]\n",
+ over_current_pwm_duty);
}
}
}