summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2013-11-12 13:33:15 -0800
committerVincent Palatin <vpalatin@chromium.org>2013-11-13 02:51:13 +0000
commitf559be562aabdefa6c8e04f6403d921acf101eb2 (patch)
tree1d1cc2bb8e816cd9d9f4a0f7164f79d6c363a114
parenta21e89e0934132164a567f64eb8ff468765b86d5 (diff)
downloadchrome-ec-f559be562aabdefa6c8e04f6403d921acf101eb2.tar.gz
spring: return the right current value in GPIO mode
When reading back the ILIM setting from the host side, if we are not using the PWM module and the ILIM pin is in GPIO mode, returns the actual limit (0A for GPIO=1, 3A for GPIO=0) rather than the PWM duty cycle which is not used in that case. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=spring BUG=none TEST=on Spring, try "ectool powerinfo" in PWM mode and GPIO mode. Change-Id: I7dd46239f642522812ffcab1d6796e97b44b9ec7 Reviewed-on: https://chromium-review.googlesource.com/176558 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r--board/spring/usb_charging.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c
index f4c1add354..bf91e257a5 100644
--- a/board/spring/usb_charging.c
+++ b/board/spring/usb_charging.c
@@ -1026,7 +1026,15 @@ int board_get_usb_dev_type(void)
int board_get_usb_current_limit(void)
{
/* Approximate value by PWM duty cycle */
- return PWM_MAPPING_A + PWM_MAPPING_B * current_pwm_duty;
+ switch (current_ilim_config) {
+ case ILIM_CONFIG_MANUAL_OFF:
+ return 3000;
+ case ILIM_CONFIG_MANUAL_ON:
+ return 0;
+ case ILIM_CONFIG_PWM:
+ default:
+ return PWM_MAPPING_A + PWM_MAPPING_B * current_pwm_duty;
+ }
}
int board_get_ac(void)