mb/google/bluey: Use SOC PMIC API to detect off-mode charging event
Refactor the is_off_mode() detection API on the Bluey mainboard to call the newly introduced SOC-specific PMIC function, is_pon_on_ac(). This change delegates the complex Power-On (PON) log parsing and PMIC register checking to the SOC layer, simplifying the mainboard code base. The board layer now contains only the high-level policy wrapper for detecting cable-power-on events. This improves modularity and ensures the board code relies on the correct hardware abstraction. Key changes: - Implement is_off_mode() as a simple wrapper around is_pon_on_ac() (from the SOC PMIC library). - Include soc/pmic.h to access the SOC's PMIC APIs. - Expose is_off_mode() in board.h. BUG=b:439819922 TEST=Verify boot mode on Google/Quenbi. Change-Id: Ibc13c3ad96846cf5b3fb9bcf461e3f338ac9b8bd Signed-off-by: Kapil Porwal <kapilporwal@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/89122 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com>
This commit is contained in:
parent
201ebd48ee
commit
d6132c4c03
2 changed files with 19 additions and 0 deletions
|
|
@ -41,6 +41,7 @@
|
|||
#endif
|
||||
|
||||
void setup_chromeos_gpios(void);
|
||||
bool is_off_mode(void);
|
||||
void enable_slow_battery_charging(void);
|
||||
void disable_slow_battery_charging(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#include "board.h"
|
||||
#include <soc/pmic.h>
|
||||
#include <soc/qcom_spmi.h>
|
||||
#include <types.h>
|
||||
|
||||
#define SMB1_SLAVE_ID 0x07
|
||||
#define SMB2_SLAVE_ID 0x0A
|
||||
|
|
@ -41,3 +43,19 @@ void disable_slow_battery_charging(void)
|
|||
spmi_write8(SMB1_CHGR_CHRG_EN_CMD, CHRG_DISABLE);
|
||||
spmi_write8(SMB2_CHGR_CHRG_EN_CMD, CHRG_DISABLE);
|
||||
}
|
||||
|
||||
/*
|
||||
* is_off_mode - Check if the system is booting due to an off-mode power event.
|
||||
*
|
||||
* This function provides the board-level policy wrapper for detecting if the
|
||||
* system power-on was triggered by an external charging event (e.g., cable
|
||||
* insertion). This is typically used to enter LB_BOOT_MODE_OFFMODE_CHARGING.
|
||||
*
|
||||
* @return true if the system was triggered by a specific off-mode reason
|
||||
* (e.g., charging cable insertion).
|
||||
* @return false otherwise.
|
||||
*/
|
||||
bool is_off_mode(void)
|
||||
{
|
||||
return is_pon_on_ac();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue