Skip to contentSkip to conversation

reenable rtc alarm interrupt in acpi_power_off

PATCH New Dirk Meul 1 participant 1 message Nov 10, 2003 ACPI

lore
Share & tools
lore

Dirk Meul

author
#0 lore raw

PATCH 1/1 reenable rtc alarm interrupt in acpi_power_off

Hello!

I need attached patch for powering on my computer by the RTC alarm clock. The lines are copied from drivers/acpi/sleep/proc.c. With this patch i'm able to set the wakeup time with /proc/acpi/alarm. Without this patch this will only work for S1, so it maybe that i will need a similar patch for S3.

Regards,

Signature · 4 lines
                           /"\
Dirk Meul                  \ /    ASCII Ribbon Campaign
[email protected]    X     Against HTML Mail
                           / \
drivers/acpi/sleep/poweroff.c +13 -0
@@ -9,12 +9,25 @@
 #include <linux/init.h>
 #include <acpi/acpi_bus.h>
 
+#ifdef CONFIG_X86
+#include <linux/mc146818rtc.h>
+#endif
+
 static void
 acpi_power_off (void)
 {
+	unsigned char rtc_control = 0;
+	
 	printk("%s called\n",__FUNCTION__);
 	acpi_enter_sleep_state_prep(ACPI_STATE_S5);
 	ACPI_DISABLE_IRQS();
+	/* enable the rtc alarm interrupt */
+	rtc_control = CMOS_READ(RTC_CONTROL);
+	if (!(rtc_control & RTC_AIE)) {
+		rtc_control |= RTC_AIE;
+		CMOS_WRITE(rtc_control,RTC_CONTROL);
+		CMOS_READ(RTC_INTR_FLAGS);
+	}
 	acpi_enter_sleep_state(ACPI_STATE_S5);
 }