File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -771,6 +771,8 @@ int poweron_reason_powerbtn(void);
771
771
772
772
void spi_mux_control (int enable );
773
773
774
+ enum battery_present board_batt_is_present (void );
775
+
774
776
#ifdef CONFIG_LOW_POWER_IDLE
775
777
void board_prepare_for_deep_sleep (void );
776
778
void board_resume_from_deep_sleep (void );
Original file line number Diff line number Diff line change @@ -1487,9 +1487,20 @@ int board_set_active_charge_port(int charge_port)
1487
1487
int mask ;
1488
1488
int i ;
1489
1489
int disable_lockout ;
1490
+ int force_reduce ;
1491
+ int current ;
1492
+
1493
+ /* if battery is present, set the current limit 500 mA*/
1490
1494
1491
1495
if (prev_charge_port != -1 && prev_charge_port != charge_port ) {
1492
1496
update_soc_power_limit (false, true);
1497
+
1498
+ /* force to reduce the input current limit when battery is connected */
1499
+ if (board_batt_is_present () == BP_YES ) {
1500
+ force_reduce = 1 ;
1501
+ charge_set_input_current_limit (0 , pd_port_states [charge_port ].voltage );
1502
+ }
1503
+
1493
1504
gpio_set_level (GPIO_TYPEC0_VBUS_ON_EC , 0 );
1494
1505
gpio_set_level (GPIO_TYPEC1_VBUS_ON_EC , 0 );
1495
1506
gpio_set_level (GPIO_TYPEC2_VBUS_ON_EC , 0 );
@@ -1511,6 +1522,13 @@ int board_set_active_charge_port(int charge_port)
1511
1522
gpio_set_level (GPIO_TYPEC2_VBUS_ON_EC , 1 );
1512
1523
gpio_set_level (GPIO_TYPEC3_VBUS_ON_EC , 1 );
1513
1524
}
1525
+
1526
+ /* Switch port complete. set the current limit to charge_ma*0.95 */
1527
+ if (force_reduce ) {
1528
+ current = pd_port_states [charge_port ].current * 95 / 100 ;
1529
+ charge_set_input_current_limit (current , pd_port_states [charge_port ].voltage );
1530
+ }
1531
+
1514
1532
for (i = 0 ; i < PD_CHIP_COUNT ; i ++ )
1515
1533
cypd_write_reg8 (i , CYP5225_USER_DISABLE_LOCKOUT , disable_lockout );
1516
1534
You can’t perform that action at this time.
0 commit comments