linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Don't disable hpet emulation on suspend
@ 2013-04-10  0:36 Derek Basehore
  2013-04-10 23:58 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Derek Basehore @ 2013-04-10  0:36 UTC (permalink / raw)
  To: rtc-linux; +Cc: Alessandro Zummo, linux-kernel, Derek Basehore

There's a bug where rtc alarms are ignored after the rtc cmos suspends but
before the system finishes suspend. Since hpet emulation is disabled and it
still handles the interrupts, a wake event is never registered which is done
from the rtc layer. This reverts an earlier commit which disables hpet
emulation. To fix the problem mentioned in that commit, the hpet_rtc_timer_init
function is called directly on resume.

This reverts commit d1b2efa83fbf7b33919238fa29ef6ab935820103.

Signed-off-by: Derek Basehore <dbasehore@chromium.org>
---
 drivers/rtc/rtc-cmos.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index af97c94..cc5bea9 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -804,9 +804,8 @@ static int cmos_suspend(struct device *dev)
 			mask = RTC_IRQMASK;
 		tmp &= ~mask;
 		CMOS_WRITE(tmp, RTC_CONTROL);
+		hpet_mask_rtc_irq_bit(mask);
 
-		/* shut down hpet emulation - we don't need it for alarm */
-		hpet_mask_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE);
 		cmos_checkintr(cmos, tmp);
 	}
 	spin_unlock_irq(&rtc_lock);
@@ -870,6 +869,7 @@ static int cmos_resume(struct device *dev)
 			rtc_update_irq(cmos->rtc, 1, mask);
 			tmp &= ~RTC_AIE;
 			hpet_mask_rtc_irq_bit(RTC_AIE);
+			hpet_rtc_timer_init();
 		} while (mask & RTC_AIE);
 		spin_unlock_irq(&rtc_lock);
 	}
-- 
1.8.1.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Don't disable hpet emulation on suspend
  2013-04-10  0:36 [PATCH] Don't disable hpet emulation on suspend Derek Basehore
@ 2013-04-10 23:58 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2013-04-10 23:58 UTC (permalink / raw)
  To: Derek Basehore; +Cc: rtc-linux, Alessandro Zummo, linux-kernel, Maxim Levitsky

On Tue,  9 Apr 2013 17:36:13 -0700 Derek Basehore <dbasehore@chromium.org> wrote:

> There's a bug where rtc alarms are ignored after the rtc cmos suspends but
> before the system finishes suspend. Since hpet emulation is disabled and it
> still handles the interrupts, a wake event is never registered which is done
> from the rtc layer. This reverts an earlier commit which disables hpet
> emulation. To fix the problem mentioned in that commit, the hpet_rtc_timer_init
> function is called directly on resume.
> 
> This reverts commit d1b2efa83fbf7b33919238fa29ef6ab935820103.
> 
> ...
>
> --- a/drivers/rtc/rtc-cmos.c
> +++ b/drivers/rtc/rtc-cmos.c
> @@ -804,9 +804,8 @@ static int cmos_suspend(struct device *dev)
>  			mask = RTC_IRQMASK;
>  		tmp &= ~mask;
>  		CMOS_WRITE(tmp, RTC_CONTROL);
> +		hpet_mask_rtc_irq_bit(mask);
>  
> -		/* shut down hpet emulation - we don't need it for alarm */
> -		hpet_mask_rtc_irq_bit(RTC_PIE|RTC_AIE|RTC_UIE);
>  		cmos_checkintr(cmos, tmp);
>  	}
>  	spin_unlock_irq(&rtc_lock);
> @@ -870,6 +869,7 @@ static int cmos_resume(struct device *dev)
>  			rtc_update_irq(cmos->rtc, 1, mask);
>  			tmp &= ~RTC_AIE;
>  			hpet_mask_rtc_irq_bit(RTC_AIE);
> +			hpet_rtc_timer_init();
>  		} while (mask & RTC_AIE);
>  		spin_unlock_irq(&rtc_lock);
>  	}

huh, so it's been broken for three years.

This calls hpet_rtc_timer_init() under spin_lock_irq() which is OK with
the current implementation.  And things should be OK when
CONFIG_HPET_EMULATE_RTC=n.

Maxim, can you please review/test/etc?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-10 23:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-10  0:36 [PATCH] Don't disable hpet emulation on suspend Derek Basehore
2013-04-10 23:58 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).