diff options
-rw-r--r-- | board/spring/usb_charging.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/board/spring/usb_charging.c b/board/spring/usb_charging.c index 89232a6421..a0c54517b9 100644 --- a/board/spring/usb_charging.c +++ b/board/spring/usb_charging.c @@ -245,12 +245,12 @@ static int board_apple_charger_current(void) return apple_charger_type[type]; } -static int dcp_current_limit(void) +static int hard_current_limit(int limit) { if (current_limit_mode == LIMIT_AGGRESSIVE) - return I_LIMIT_1500MA - PWM_CTRL_OC_MARGIN; + return limit - PWM_CTRL_OC_MARGIN; else - return I_LIMIT_1500MA; + return limit; } static int video_dev_type(int device_type) @@ -349,10 +349,12 @@ static void board_power_tweak(void) /* Check video power input change */ if (current_dev_type & TSU6721_TYPE_JIG_UART_ON) { - if (get_video_power() && vbus > 4000) + if (get_video_power() && vbus > 4000) { set_video_power(0); - else if (!get_video_power() && vbus <= 4000) + } else if (!get_video_power() && vbus <= 4000) { + board_pwm_duty_cycle(100); set_video_power(1); + } } if (battery_current(¤t)) @@ -560,7 +562,9 @@ static void usb_update_ilim(int dev_type) else if (dev_type & TSU6721_TYPE_CDP) current_limit = I_LIMIT_1500MA; else if (dev_type & TSU6721_TYPE_DCP) - current_limit = dcp_current_limit(); + current_limit = hard_current_limit(I_LIMIT_1500MA); + else if (dev_type & TSU6721_TYPE_JIG_UART_ON) + current_limit = hard_current_limit(I_LIMIT_2000MA); board_pwm_nominal_duty_cycle(current_limit); } else { |