@@ -496,6 +496,56 @@ static void check_chassis_open(int init)
496496 }
497497}
498498
499+ void charge_psys_onoff (uint8_t enable )
500+ {
501+ int control0 = 0x0000 ;
502+ int control1 = 0x0000 ;
503+ int control4 = 0x0000 ;
504+ int data = 0x0000 ;
505+
506+ if (i2c_read16 (I2C_PORT_CHARGER , ISL9241_ADDR_FLAGS ,
507+ ISL9241_REG_CONTROL1 , & control1 )) {
508+ CPRINTS ("read charger control1 fail" );
509+ }
510+
511+ if (enable ) {
512+ control0 &= ~ISL9241_CONTROL0_NGATE ;
513+ control1 &= ~(ISL9241_CONTROL1_IMON | ISL9241_CONTROL1_BGATE );
514+ control1 |= ISL9241_CONTROL1_PSYS ;
515+ control4 &= ~ISL9241_CONTROL4_GP_COMPARATOR ;
516+ data = 0x0B00 ;
517+ CPRINTS ("Power saving disable" );
518+ } else {
519+ control0 |= ISL9241_CONTROL0_NGATE ;
520+ control1 |= (ISL9241_CONTROL1_IMON | ISL9241_CONTROL1_BGATE );
521+ control1 &= ~ISL9241_CONTROL1_PSYS ;
522+ control4 |= ISL9241_CONTROL4_GP_COMPARATOR ;
523+ data = 0x0000 ;
524+ CPRINTS ("Power saving enable" );
525+ }
526+
527+
528+ if (i2c_write16 (I2C_PORT_CHARGER , ISL9241_ADDR_FLAGS ,
529+ ISL9241_REG_ACOK_REFERENCE , data )) {
530+ CPRINTS ("Update charger ACOK reference fail" );
531+ }
532+
533+ if (i2c_write16 (I2C_PORT_CHARGER , ISL9241_ADDR_FLAGS ,
534+ ISL9241_REG_CONTROL0 , control0 )) {
535+ CPRINTS ("Update charger control0 fail" );
536+ }
537+
538+ if (i2c_write16 (I2C_PORT_CHARGER , ISL9241_ADDR_FLAGS ,
539+ ISL9241_REG_CONTROL1 , control1 )) {
540+ CPRINTS ("Update charger control1 fail" );
541+ }
542+
543+ if (i2c_write16 (I2C_PORT_CHARGER , ISL9241_ADDR_FLAGS ,
544+ ISL9241_REG_CONTROL4 , control4 )) {
545+ CPRINTS ("Update charger control4 fail" );
546+ }
547+ }
548+
499549/* Initialize board. */
500550static void board_init (void )
501551{
@@ -529,6 +579,7 @@ static void board_chipset_startup(void)
529579 if (version > 6 )
530580 gpio_set_level (GPIO_EN_INVPWR , 1 );
531581
582+ charge_psys_onoff (1 );
532583}
533584DECLARE_HOOK (HOOK_CHIPSET_STARTUP ,
534585 board_chipset_startup ,
@@ -547,6 +598,7 @@ static void board_chipset_shutdown(void)
547598 if (version > 6 )
548599 gpio_set_level (GPIO_EN_INVPWR , 0 );
549600
601+ charge_psys_onoff (0 );
550602}
551603DECLARE_HOOK (HOOK_CHIPSET_SHUTDOWN ,
552604 board_chipset_shutdown ,
@@ -783,7 +835,7 @@ void charger_update(void)
783835 CPRINTS ("update charger!!" );
784836
785837 val = ISL9241_CONTROL1_PROCHOT_REF_6800 |
786- ISL9241_CONTROL1_SWITCH_FREQ | ISL9241_CONTROL1_PSYS ;
838+ ISL9241_CONTROL1_SWITCH_FREQ ;
787839
788840 if (i2c_write16 (I2C_PORT_CHARGER , ISL9241_ADDR_FLAGS ,
789841 ISL9241_REG_CONTROL1 , val )) {
0 commit comments