summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@chromium.org>2013-05-08 00:43:22 +0800
committerChromeBot <chrome-bot@google.com>2013-05-08 17:56:08 -0700
commit9d38b1b392b34f17b807c66e7b1a86605ccbf501 (patch)
treefd9ae7d4343777bca7ed548c5ce17677f98b2361
parent0c32432fb2ebbdcf718ca7957633bb52c934a134 (diff)
downloadchrome-ec-9d38b1b392b34f17b807c66e7b1a86605ccbf501.tar.gz
spring: Hard-limit DCP current at 1.5A
The spec suggests we cannot reliably go over 1.5A and gracefully recover. Let's avoid going over that limit. BUG=chrome-os-partner:19267 TEST=Build spring BRANCH=spring Original-Change-Id: I07411ff3ce4107e0289c5af5365ef5a23fd23e4e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/50321 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit b1b91c82b6b110f6325c82d42a1f9673b0653ea4) Change-Id: Ic01052f0b178e2e8403ee482e91d2853da88797f Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/50543 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/spring/usb_charging.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c
index a46c753347..4c72866cc2 100644
--- a/board/spring/usb_charging.c
+++ b/board/spring/usb_charging.c
@@ -244,6 +244,14 @@ static int board_apple_charger_current(void)
return apple_charger_type[type];
}
+static int dcp_current_limit(void)
+{
+ if (current_limit_mode == LIMIT_AGGRESSIVE)
+ return I_LIMIT_1500MA - PWM_CTRL_OC_MARGIN;
+ else
+ return I_LIMIT_1500MA;
+}
+
static int board_probe_video(int device_type)
{
tsu6721_disable_interrupts();
@@ -523,11 +531,12 @@ static void usb_update_ilim(int dev_type)
int current_limit = I_LIMIT_500MA;
if (dev_type & TSU6721_TYPE_CHG12)
current_limit = I_LIMIT_3000MA;
- else if (dev_type & TSU6721_TYPE_APPLE_CHG) {
+ else if (dev_type & TSU6721_TYPE_APPLE_CHG)
current_limit = board_apple_charger_current();
- } else if ((dev_type & TSU6721_TYPE_CDP) ||
- (dev_type & TSU6721_TYPE_DCP))
+ else if (dev_type & TSU6721_TYPE_CDP)
current_limit = I_LIMIT_1500MA;
+ else if (dev_type & TSU6721_TYPE_DCP)
+ current_limit = dcp_current_limit();
board_pwm_nominal_duty_cycle(current_limit);
} else {