mb/google/bluey: Add disable slow charging support

This commit adds a new function, disable_slow_battery_charging, to
disable charging on the Bluey mainboard. This function writes a disable
command to the SMBUS chargers, turning off the charging process.

Additionally, this patch makes the following changes to support this
new functionality:
 - The charging.c file is now compiled in both the romstage and
   ramstage phases.
 - The new disable_slow_battery_charging function is declared in
   board.h.
 - A new charging_status enum is introduced to clearly define the
   charging states.

These changes ensure that the system can now properly control charging,
allowing it to be disabled when necessary.

BUG=b:439819922
TEST=Able to build and boot google/quenbi.

Change-Id: Ic0c59e0509889e6d166becf76279718b853021cc
Signed-off-by: Subrata Banik <subratabanik@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/89022
Reviewed-by: Kapil Porwal <kapilporwal@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Subrata Banik 2025-09-03 11:06:38 +05:30
commit 6e61ea65a8
3 changed files with 18 additions and 1 deletions

View file

@ -12,4 +12,6 @@ romstage-y += romstage.c
romstage-y += charging.c
ramstage-y += charging.c
ramstage-y += mainboard.c

View file

@ -39,5 +39,6 @@
void setup_chromeos_gpios(void);
void enable_slow_battery_charging(void);
void disable_slow_battery_charging(void);
#endif /* MAINBOARD_GOOGLE_BLUEY_BOARD_H */

View file

@ -13,7 +13,11 @@
#define SMB2_CHGR_CHRG_EN_CMD ((SMB2_SLAVE_ID << 16) | SCHG_CHGR_CHARGING_ENABLE_CMD)
#define FCC_1A_STEP_50MA 0x14
#define CHRG_ENABLE 0x01
enum charging_status {
CHRG_DISABLE,
CHRG_ENABLE,
};
/*
* Enable charging w/ 1A Icurrent supply at max.
@ -27,3 +31,13 @@ void enable_slow_battery_charging(void)
spmi_write8(SMB1_CHGR_CHRG_EN_CMD, CHRG_ENABLE);
spmi_write8(SMB2_CHGR_CHRG_EN_CMD, CHRG_ENABLE);
}
/*
* Disable charging.
*/
void disable_slow_battery_charging(void)
{
printk(BIOS_INFO, "Disable slow charge support\n");
spmi_write8(SMB1_CHGR_CHRG_EN_CMD, CHRG_DISABLE);
spmi_write8(SMB2_CHGR_CHRG_EN_CMD, CHRG_DISABLE);
}