Patchwork rtc-cmos: report wakeups from interrupt handler

login
register
mail settings
Submitter Daniel Drake
Date July 15, 2012, 9:08 p.m.
Message ID <20120715210854.E2DDC9D401E@zog.reactivated.net>
Download mbox | patch
Permalink /patch/171103/
State New
Headers show

Comments

Daniel Drake - July 15, 2012, 9:08 p.m.
From: Paul Fox <pgf@laptop.org>

When suspending the system with an important RTC wake alarm active,
it is possible that the RTC alarm will expire before the system has
gone to sleep (e.g. short alarm timer, or an unusually long suspend
routine).

If this happens, the RTC alarm should trigger a wakeup event, possibly
aborting system suspend. This condition can be detected in the form
of an RTC alarm interrupt.

Signed-off-by: Paul Fox <pgf@laptop.org>
Signed-off-by: Daniel Drake <dsd@laptop.org>
---
 drivers/rtc/rtc-cmos.c |    1 +
 1 file changed, 1 insertion(+)
Rafael J. Wysocki - July 17, 2012, 8:36 p.m.
On Sunday, July 15, 2012, Daniel Drake wrote:
> From: Paul Fox <pgf@laptop.org>
> 
> When suspending the system with an important RTC wake alarm active,
> it is possible that the RTC alarm will expire before the system has
> gone to sleep (e.g. short alarm timer, or an unusually long suspend
> routine).
> 
> If this happens, the RTC alarm should trigger a wakeup event, possibly
> aborting system suspend. This condition can be detected in the form
> of an RTC alarm interrupt.
> 
> Signed-off-by: Paul Fox <pgf@laptop.org>
> Signed-off-by: Daniel Drake <dsd@laptop.org>

Applied to the 'pm-drivers' branch of the linux-pm.git tree.

Thanks,
Rafael


> ---
>  drivers/rtc/rtc-cmos.c |    1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
> index 4267789..635fd4c 100644
> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
> @@ -568,6 +568,7 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
>  		hpet_mask_rtc_irq_bit(RTC_AIE);
>  
>  		CMOS_READ(RTC_INTR_FLAGS);
> +		pm_wakeup_event(cmos_rtc.dev, 0);
>  	}
>  	spin_unlock(&rtc_lock);
>  
>

Patch

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index 4267789..635fd4c 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -568,6 +568,7 @@  static irqreturn_t cmos_interrupt(int irq, void *p)
 		hpet_mask_rtc_irq_bit(RTC_AIE);
 
 		CMOS_READ(RTC_INTR_FLAGS);
+		pm_wakeup_event(cmos_rtc.dev, 0);
 	}
 	spin_unlock(&rtc_lock);