1
0
mirror of https://github.com/CTCaer/hekate.git synced 2024-12-26 00:16:33 +00:00

util: Clear alarm wake flags also on power off even if rtc alram is off

This commit is contained in:
CTCaer 2021-01-11 23:24:29 +02:00
parent abcf7f6f57
commit 2370ca0a44

View File

@ -167,10 +167,10 @@ void power_set_state(power_state_t state)
default: default:
// Enable/Disable soft reset wake event. // Enable/Disable soft reset wake event.
reg = i2c_recv_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG2); reg = i2c_recv_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG2);
if (state == POWER_OFF_RESET) if (state == POWER_OFF_RESET) // Do not wake up after power off.
reg &= ~MAX77620_ONOFFCNFG2_SFT_RST_WK; // Do not wake up after power off. reg &= ~(MAX77620_ONOFFCNFG2_SFT_RST_WK | MAX77620_ONOFFCNFG2_WK_ALARM1 | MAX77620_ONOFFCNFG2_WK_ALARM2);
else // POWER_OFF_REBOOT. else // POWER_OFF_REBOOT. Wake up after power off.
reg |= MAX77620_ONOFFCNFG2_SFT_RST_WK; // Wake up after power off. reg |= MAX77620_ONOFFCNFG2_SFT_RST_WK;
i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG2, reg); i2c_send_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_ONOFFCNFG2, reg);
// Initiate power down sequence and generate a reset (regulators' state resets). // Initiate power down sequence and generate a reset (regulators' state resets).