1
0
Fork 0
mirror of https://github.com/CTCaer/hekate.git synced 2024-11-10 04:21:45 +00:00

hekate: clear rtc interrupt and stop alarm

Stopping rtc alarm is now done in the function that actually checks it, in order to avoid power offs from HOS if it's fired and user wants to continue booting.

Additionally, clear the interrupt which is the actual thing that is checked by HOS.
This commit is contained in:
CTCaer 2023-03-31 09:15:56 +03:00
parent 8528e6a08a
commit 3c3fcb29f9

View file

@ -87,6 +87,14 @@ void check_power_off_from_hos()
{ {
// Power off on alarm wakeup from HOS shutdown. For modchips/dongles. // Power off on alarm wakeup from HOS shutdown. For modchips/dongles.
u8 hos_wakeup = i2c_recv_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_IRQTOP); u8 hos_wakeup = i2c_recv_byte(I2C_5, MAX77620_I2C_ADDR, MAX77620_REG_IRQTOP);
// Clear RTC interrupts.
(void)i2c_recv_byte(I2C_5, MAX77620_RTC_I2C_ADDR, MAX77620_RTC_RTCINT_REG);
// Stop the alarm, in case we injected and powered off too fast.
max77620_rtc_stop_alarm();
// Handle RTC wake up.
if (hos_wakeup & MAX77620_IRQ_TOP_RTC_MASK) if (hos_wakeup & MAX77620_IRQ_TOP_RTC_MASK)
{ {
if (h_cfg.autohosoff == 1) if (h_cfg.autohosoff == 1)