mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-16 16:14:25 -04:00
exo/mariko fatal: perform display init, reboot on power button press
This commit is contained in:
parent
45830472c1
commit
8ba1cdeef2
9 changed files with 1510 additions and 13 deletions
|
@ -176,8 +176,40 @@ namespace ams::pmic {
|
|||
i2c::SendByte(i2c::Port_5, I2cAddressMax77620Pmic, Max77620RegisterOnOffCnfg1, MAX77620_ONOFFCNFG1_PWR_OFF);
|
||||
}
|
||||
|
||||
void ShutdownSystem(bool reboot) {
|
||||
/* Get value, set or clear software reset mask. */
|
||||
u8 on_off_2_val = i2c::QueryByte(i2c::Port_5, I2cAddressMax77620Pmic, MAX77620_REG_ONOFFCNFG2);
|
||||
if (reboot) {
|
||||
on_off_2_val |= MAX77620_ONOFFCNFG2_SFT_RST_WK;
|
||||
} else {
|
||||
on_off_2_val &= ~(MAX77620_ONOFFCNFG2_SFT_RST_WK);
|
||||
}
|
||||
i2c::SendByte(i2c::Port_5, I2cAddressMax77620Pmic, MAX77620_REG_ONOFFCNFG2, on_off_2_val);
|
||||
|
||||
/* Get value, set software reset mask. */
|
||||
u8 on_off_1_val = i2c::QueryByte(i2c::Port_5, I2cAddressMax77620Pmic, MAX77620_REG_ONOFFCNFG1);
|
||||
on_off_1_val |= MAX77620_ONOFFCNFG1_SFT_RST;
|
||||
|
||||
/* NOTE: Here, userland finalizes the battery on non-Calcio. */
|
||||
if (fuse::GetHardwareType() != fuse::HardwareType_Calcio) {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
/* Actually write the value to trigger shutdown/reset. */
|
||||
i2c::SendByte(i2c::Port_5, I2cAddressMax77620Pmic, MAX77620_REG_ONOFFCNFG1, on_off_1_val);
|
||||
|
||||
/* Allow up to 5 seconds for shutdown/reboot to take place. */
|
||||
util::WaitMicroSeconds(5'000'000ul);
|
||||
|
||||
AMS_ABORT("Shutdown failed");
|
||||
}
|
||||
|
||||
bool IsAcOk() {
|
||||
return (GetPmicOnOffStat() & (1 << 1)) != 0;
|
||||
}
|
||||
|
||||
bool IsPowerButtonPressed() {
|
||||
return (GetPmicOnOffStat() & (1 << 2)) != 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue