1.1 --- a/pkg/devices/lib/rtc/src/x1600.cc Thu Nov 16 01:15:40 2023 +0100
1.2 +++ b/pkg/devices/lib/rtc/src/x1600.cc Thu Nov 16 17:48:32 2023 +0100
1.3 @@ -193,7 +193,21 @@
1.4 Rtc_x1600_chip::alarm_enable()
1.5 {
1.6 write_enable();
1.7 - _regs[Rtc_control] = _regs[Rtc_control] | Control_alarm_enable;
1.8 + _regs[Rtc_control] = (_regs[Rtc_control] & ~Control_alarm) | Control_alarm_enable;
1.9 +}
1.10 +
1.11 +void
1.12 +Rtc_x1600_chip::wakeup_alarm_disable()
1.13 +{
1.14 + write_enable();
1.15 + _regs[Hibernate_wakeup_control] = _regs[Hibernate_wakeup_control] & ~Rtc_alarm_wakeup_enable;
1.16 +}
1.17 +
1.18 +void
1.19 +Rtc_x1600_chip::wakeup_alarm_enable()
1.20 +{
1.21 + write_enable();
1.22 + _regs[Hibernate_wakeup_control] = _regs[Hibernate_wakeup_control] | Rtc_alarm_wakeup_enable;
1.23 }
1.24
1.25 uint32_t
1.26 @@ -240,6 +254,14 @@
1.27 }
1.28
1.29 void
1.30 +Rtc_x1600_chip::hibernate()
1.31 +{
1.32 + alarm_enable();
1.33 + wakeup_alarm_enable();
1.34 + power_down();
1.35 +}
1.36 +
1.37 +void
1.38 Rtc_x1600_chip::power_down()
1.39 {
1.40 write_enable();
1.41 @@ -301,6 +323,11 @@
1.42 static_cast<Rtc_x1600_chip *>(rtc)->set_regulator(base, adjustment);
1.43 }
1.44
1.45 +void x1600_rtc_hibernate(void *rtc)
1.46 +{
1.47 + static_cast<Rtc_x1600_chip *>(rtc)->hibernate();
1.48 +}
1.49 +
1.50 void x1600_rtc_power_down(void *rtc)
1.51 {
1.52 static_cast<Rtc_x1600_chip *>(rtc)->power_down();