From b1b91c82b6b110f6325c82d42a1f9673b0653ea4 Mon Sep 17 00:00:00 2001 From: Vic Yang Date: Wed, 8 May 2013 00:43:22 +0800 Subject: [PATCH] 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 Change-Id: I07411ff3ce4107e0289c5af5365ef5a23fd23e4e Signed-off-by: Vic Yang Reviewed-on: https://gerrit.chromium.org/gerrit/50321 Reviewed-by: Vincent Palatin --- common/extpower_usb.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/common/extpower_usb.c b/common/extpower_usb.c index d64417d6dd..de09d61abe 100644 --- a/common/extpower_usb.c +++ b/common/extpower_usb.c @@ -257,6 +257,14 @@ static int 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 probe_video(int device_type) { tsu6721_disable_interrupts(); @@ -475,11 +483,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 = 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(); pwm_nominal_duty_cycle(current_limit); } else {