mb/google/bluey: Configure sink sensor for DAM port
Enable/disable the sink sensor for DAM port during power on/off. BUG=b:491325845 TEST=Verify the configuration on power on/off on Google/Quartz. Change-Id: Ib00e1cc1c86bafb19cde24c7faa624d3e6d00db8 Signed-off-by: Kapil Porwal <kapilporwal@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/91890 Reviewed-by: Subrata Banik <subratabanik@google.com> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
63fc231480
commit
f45d6e696a
3 changed files with 21 additions and 0 deletions
|
|
@ -62,6 +62,7 @@ bool is_off_mode(void);
|
|||
void configure_parallel_charging(void);
|
||||
void configure_parallel_charging_late(void);
|
||||
void configure_debug_access_port(void);
|
||||
void configure_dam_on_system_state_change(bool poweron);
|
||||
void enable_slow_battery_charging(void);
|
||||
void disable_slow_battery_charging(void);
|
||||
void launch_charger_applet(void);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,10 @@
|
|||
#define SCHG_TYPE_C_SUSPEND_LEGACY_CHARGERS 0x2B90
|
||||
#define SMB1_SCHG_TYPE_C_SUSPEND_LEGACY_CHARGERS \
|
||||
((SMB1_SLAVE_ID << 16) | SCHG_TYPE_C_SUSPEND_LEGACY_CHARGERS)
|
||||
#define SCHG_TYPE_C_TYPE_C_CRUDE_SENSOR_CFG 0x2B4E
|
||||
#define SMB1_SCHG_TYPE_C_TYPE_C_CRUDE_SENSOR_CFG \
|
||||
((SMB1_SLAVE_ID << 16) | SCHG_TYPE_C_TYPE_C_CRUDE_SENSOR_CFG)
|
||||
|
||||
#define SCHG_CHGR_CHARGING_FCC 0x260A
|
||||
#define SMB1_CHGR_CHARGING_FCC ((SMB1_SLAVE_ID << 16) | SCHG_CHGR_CHARGING_FCC)
|
||||
#define SMB2_CHGR_CHARGING_FCC ((SMB2_SLAVE_ID << 16) | SCHG_CHGR_CHARGING_FCC)
|
||||
|
|
@ -64,6 +68,16 @@ enum charging_status {
|
|||
CHRG_ENABLE,
|
||||
};
|
||||
|
||||
void configure_dam_on_system_state_change(bool poweron)
|
||||
{
|
||||
uint8_t value = (uint8_t)spmi_read8(SMB1_SCHG_TYPE_C_TYPE_C_CRUDE_SENSOR_CFG);
|
||||
if (poweron)
|
||||
value |= BIT(0);
|
||||
else
|
||||
value &= ~BIT(0);
|
||||
spmi_write8(SMB1_SCHG_TYPE_C_TYPE_C_CRUDE_SENSOR_CFG, value);
|
||||
}
|
||||
|
||||
static int get_battery_icurr_ma(void)
|
||||
{
|
||||
/* Read battery i-current value */
|
||||
|
|
@ -170,6 +184,7 @@ void launch_charger_applet(void)
|
|||
if (detect_ac_unplug_event())
|
||||
indicate_charging_status();
|
||||
google_chromeec_offmode_heartbeat();
|
||||
configure_dam_on_system_state_change(false);
|
||||
google_chromeec_ap_poweroff();
|
||||
}
|
||||
mdelay(200);
|
||||
|
|
@ -188,6 +203,7 @@ void launch_charger_applet(void)
|
|||
if (detect_ac_unplug_event())
|
||||
indicate_charging_status();
|
||||
google_chromeec_offmode_heartbeat();
|
||||
configure_dam_on_system_state_change(false);
|
||||
google_chromeec_ap_poweroff();
|
||||
}
|
||||
|
||||
|
|
@ -210,6 +226,7 @@ void launch_charger_applet(void)
|
|||
if (has_crossed_threshold) {
|
||||
printk(BIOS_INFO, "Issuing power-off due to temperature trip.\n");
|
||||
google_chromeec_offmode_heartbeat();
|
||||
configure_dam_on_system_state_change(false);
|
||||
google_chromeec_ap_poweroff();
|
||||
}
|
||||
} while (true);
|
||||
|
|
@ -237,6 +254,8 @@ void configure_parallel_charging(void)
|
|||
*/
|
||||
void configure_debug_access_port(void)
|
||||
{
|
||||
configure_dam_on_system_state_change(true);
|
||||
|
||||
if (!CONFIG(HAVE_DEBUG_ACCESS_PORT_SOURCE_SINK))
|
||||
return;
|
||||
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ static void trigger_critical_battery_shutdown(void)
|
|||
|
||||
platform_handle_emergency_low_battery();
|
||||
|
||||
configure_dam_on_system_state_change(false);
|
||||
google_chromeec_ap_poweroff();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue