@@ -496,6 +496,56 @@ static void check_chassis_open(int init)
496
496
}
497
497
}
498
498
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
+
499
549
/* Initialize board. */
500
550
static void board_init (void )
501
551
{
@@ -529,6 +579,7 @@ static void board_chipset_startup(void)
529
579
if (version > 6 )
530
580
gpio_set_level (GPIO_EN_INVPWR , 1 );
531
581
582
+ charge_psys_onoff (1 );
532
583
}
533
584
DECLARE_HOOK (HOOK_CHIPSET_STARTUP ,
534
585
board_chipset_startup ,
@@ -547,6 +598,7 @@ static void board_chipset_shutdown(void)
547
598
if (version > 6 )
548
599
gpio_set_level (GPIO_EN_INVPWR , 0 );
549
600
601
+ charge_psys_onoff (0 );
550
602
}
551
603
DECLARE_HOOK (HOOK_CHIPSET_SHUTDOWN ,
552
604
board_chipset_shutdown ,
@@ -783,7 +835,7 @@ void charger_update(void)
783
835
CPRINTS ("update charger!!" );
784
836
785
837
val = ISL9241_CONTROL1_PROCHOT_REF_6800 |
786
- ISL9241_CONTROL1_SWITCH_FREQ | ISL9241_CONTROL1_PSYS ;
838
+ ISL9241_CONTROL1_SWITCH_FREQ ;
787
839
788
840
if (i2c_write16 (I2C_PORT_CHARGER , ISL9241_ADDR_FLAGS ,
789
841
ISL9241_REG_CONTROL1 , val )) {
0 commit comments