Skip to contentSkip to conversation

don't reset alarm interrupt on RTC

PATCH In review Tim Hockin 2 participants 3 messages Oct 31, 2001 Char and misc drivers

lore
Share & tools
lore

Tim Hockin

author
#0 lore raw

PATCH 1/1 don't reset alarm interrupt on RTC

All,

Attached is a 1-liner to not clear the Alarm-Int-Enable bit automatically on the RTC device. This makes wake-on-alarm possible.

Please let me know if there is a problem with it. This is against 2.4.13 for inclusion in 2.4.14.

Tim

Signature · 4 lines
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
[email protected]
drivers/char/rtc.c +1 -1
diff -ruN dist-2.4.13+patches/drivers/char/rtc.c linux-2.4/drivers/char/rtc.c
@@ -560,7 +560,7 @@
 	spin_lock_irq(&rtc_lock);
 	tmp = CMOS_READ(RTC_CONTROL);
 	tmp &=  ~RTC_PIE;
-	tmp &=  ~RTC_AIE;
+	//tmp &=  ~RTC_AIE;
 	tmp &=  ~RTC_UIE;
 	CMOS_WRITE(tmp, RTC_CONTROL);
 	CMOS_READ(RTC_INTR_FLAGS);
#1 lore raw
Quoted 10 lines · Tim Hockin

All,

Attached is a 1-liner to not clear the Alarm-Int-Enable bit automatically on the RTC device. This makes wake-on-alarm possible.

Please let me know if there is a problem with it. This is against 2.4.13 for inclusion in 2.4.14.

Tim

diff -ruN dist-2.4.13+patches/drivers/char/rtc.c
linux-2.4/drivers/char/rtc.c

drivers/char/rtc.c Mon Oct 29 11:07:42 2001 renamed from drivers/char/rtc.c Mon Oct 1 16:43:52 2001 +1 -1
@@ -560,7 +560,7 @@
        spin_lock_irq(&rtc_lock);
        tmp = CMOS_READ(RTC_CONTROL);
        tmp &=  ~RTC_PIE;
-       tmp &=  ~RTC_AIE;
+       //tmp &=  ~RTC_AIE;
        tmp &=  ~RTC_UIE;
        CMOS_WRITE(tmp, RTC_CONTROL);
        CMOS_READ(RTC_INTR_FLAGS);

Why would you want to unconditionally enable this interrupt?

And how do you set the alarm time?

I implmemented Wake-on-alarm for the ACPI suspend case. The way I did it was to implement a procfs handler that set the alarm time and enabled the interrupt. I fantasized about porting it to the RTC procfs handler, but I never got around to it. The ACPI list archives should have more info/clues about it..

But, I don't think this should be enabled by default.

-pat

author
#2 lore raw
Quoted 7 lines · Patrick Mochel
drivers/char/rtc.c Mon Oct 29 11:07:42 2001 renamed from drivers/char/rtc.c Mon Oct 1 16:43:52 2001 +1 -1
-       tmp &=  ~RTC_AIE;
+       //tmp &=  ~RTC_AIE;
        tmp &=  ~RTC_UIE;
        CMOS_WRITE(tmp, RTC_CONTROL);
        CMOS_READ(RTC_INTR_FLAGS);

Why would you want to unconditionally enable this interrupt?

We don't unconditionally set it, we just leave it enabled (the code was uncoditionally UNsetting it). There are ioctl()s to set/unset PIE, AIE, UIE.

Quoted 1 line

And how do you set the alarm time?

ioctl(fd, RTC_ALM_SET);

Quoted 1 line

But, I don't think this should be enabled by default.

if anything, our patch is not correct ENOUGH. none of AIE, PIE, or UIE, should be molested by rtc_release().

Signature · 4 lines
Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances
[email protected]