@@ -399,6 +399,9 @@ DECLARE_HOOK(HOOK_INIT, vci_init, HOOK_PRIO_FIRST);
399
399
static void board_power_off_deferred (void )
400
400
{
401
401
int i ;
402
+ /* Turn off BGATE and NGATE for power saving */
403
+ charger_psys_enable (0 );
404
+ charge_gate_onoff (0 );
402
405
403
406
/* Disable interrupts */
404
407
interrupt_disable ();
@@ -535,7 +538,7 @@ void charge_gate_onoff(uint8_t enable)
535
538
}
536
539
537
540
538
- void charge_psys_onoff (uint8_t enable )
541
+ void charger_psys_enable (uint8_t enable )
539
542
{
540
543
int control1 = 0x0000 ;
541
544
int control4 = 0x0000 ;
@@ -576,44 +579,6 @@ void charge_psys_onoff(uint8_t enable)
576
579
}
577
580
}
578
581
579
-
580
- /*
581
- * Charger Low Power Mode Process
582
- * modern standby should not turn off Bfet and Nfet
583
- * DC only at S5 need enable
584
- * AC+DC at S5 & Fully charge need enable
585
- * AC+DC at Modern standby & Fully charge need enable
586
- * AC only need disable
587
- */
588
- void charger_low_power_update (void )
589
- {
590
- static int ac_state ;
591
- static int dc_state ;
592
- int batt_status ;
593
-
594
- ac_state = extpower_is_present ();
595
- dc_state = battery_is_present ();
596
- battery_status (& batt_status );
597
-
598
- if (dc_state && !ac_state &&
599
- chipset_in_state (CHIPSET_STATE_ANY_OFF )) {
600
- charge_gate_onoff (0 );
601
- charge_psys_onoff (0 );
602
- } else if (ac_state && dc_state &&
603
- batt_status & STATUS_FULLY_CHARGED ) {
604
- if (chipset_in_state (CHIPSET_STATE_ANY_OFF )) {
605
- charge_gate_onoff (0 );
606
- charge_psys_onoff (0 );
607
- } else if (chipset_in_state (CHIPSET_STATE_STANDBY ))
608
- charge_psys_onoff (0 );
609
- } else if (ac_state && !dc_state ) {
610
- charge_gate_onoff (1 );
611
- charge_psys_onoff (1 );
612
- }
613
- }
614
- DECLARE_HOOK (HOOK_AC_CHANGE , charger_low_power_update , HOOK_PRIO_DEFAULT );
615
- DECLARE_HOOK (HOOK_BATTERY_SOC_CHANGE , charger_low_power_update , HOOK_PRIO_DEFAULT );
616
-
617
582
/* Initialize board. */
618
583
static void board_init (void )
619
584
{
@@ -647,8 +612,7 @@ static void board_chipset_startup(void)
647
612
if (version > 6 )
648
613
gpio_set_level (GPIO_EN_INVPWR , 1 );
649
614
650
- charge_gate_onoff (1 );
651
- charge_psys_onoff (1 );
615
+ charger_psys_enable (1 );
652
616
}
653
617
DECLARE_HOOK (HOOK_CHIPSET_STARTUP ,
654
618
board_chipset_startup ,
@@ -667,11 +631,7 @@ static void board_chipset_shutdown(void)
667
631
lpc_set_host_event_mask (LPC_HOST_EVENT_SCI , 0 );
668
632
#endif
669
633
670
- /* avoid AC mode enable charger LPM when charging*/
671
- if (!extpower_is_present () || (batt_status & STATUS_FULLY_CHARGED )) {
672
- charge_gate_onoff (0 );
673
- charge_psys_onoff (0 );
674
- }
634
+ charger_psys_enable (0 );
675
635
}
676
636
DECLARE_HOOK (HOOK_CHIPSET_SHUTDOWN ,
677
637
board_chipset_shutdown ,
@@ -684,7 +644,7 @@ static void board_chipset_resume(void)
684
644
/*gpio_set_level(GPIO_ENABLE_BACKLIGHT, 1);*/
685
645
gpio_set_level (GPIO_EC_MUTE_L , 1 );
686
646
gpio_set_level (GPIO_CAM_EN , 1 );
687
- charge_psys_onoff (1 );
647
+ charger_psys_enable (1 );
688
648
}
689
649
DECLARE_HOOK (HOOK_CHIPSET_RESUME , board_chipset_resume ,
690
650
MOTION_SENSE_HOOK_PRIO - 1 );
@@ -698,7 +658,7 @@ static void board_chipset_suspend(void)
698
658
gpio_set_level (GPIO_EC_MUTE_L , 0 );
699
659
gpio_set_level (GPIO_CAM_EN , 0 );
700
660
}
701
- charge_psys_onoff (0 );
661
+ charger_psys_enable (0 );
702
662
}
703
663
DECLARE_HOOK (HOOK_CHIPSET_SUSPEND ,
704
664
board_chipset_suspend ,
@@ -885,6 +845,9 @@ static void charger_chips_init(void)
885
845
886
846
val = ISL9241_CONTROL1_PROCHOT_REF_6800 | ISL9241_CONTROL1_SWITCH_FREQ ;
887
847
848
+ /* make sure battery FET is enabled on EC on */
849
+ val &= ~ISL9241_CONTROL1_BGATE ;
850
+
888
851
if (i2c_write16 (I2C_PORT_CHARGER , ISL9241_ADDR_FLAGS ,
889
852
ISL9241_REG_CONTROL1 , val ))
890
853
goto init_fail ;
0 commit comments