summaryrefslogtreecommitdiff
path: root/packages/linux/linux-openmoko-2.6.28/0003-consider-alrm-enable-in-pcf50633_rtc_set_alarm.patch
blob: 48cf384c674426a0d5283444c4122f76ddb2221c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From 72669a7c7637dba5f4f2ae4a8301cf9560f0a807 Mon Sep 17 00:00:00 2001
From: Werner Almesberger <werner@openmoko.org>
Date: Fri, 30 Jan 2009 08:07:27 +0000
Subject: [PATCH 3/8] consider alrm->enable in pcf50633_rtc_set_alarm

Backported to .28, original message below:

Hi Balaji,

Mickey mentioned to me that he had trouble with the RTC wakeup interrupt.
I had a quick look at the problem and it seems that alrm->enable doesn't
get propagated when setting the alarm time with RTC_WKALM_SET.

Does something like my patch below look right ? We also don't handle
alrm->pending, but I'm not sure if we have to.

I tested this only very lightly since my current andy-tracking crashes
in soc_suspend. If nobody else beats me to it, I'll have a look at it
tomorrow.

- Werner

---------------------------------- cut here -----------------------------------

According to Documentation/rtc.txt, RTC_WKALM_SET sets the alarm time
and enables/disables the alarm. We implement RTC_WKALM_SET through
pcf50633_rtc_set_alarm. The enabling/disabling part was missing.

Signed-off-by: Werner Almesberger <werner@openmoko.org>
Reported-by: Michael 'Mickey' Lauer <mickey@openmoko.org>
---
 drivers/rtc/rtc-pcf50633.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/rtc/rtc-pcf50633.c b/drivers/rtc/rtc-pcf50633.c
index e1576d2..ddd6f89 100644
--- a/drivers/rtc/rtc-pcf50633.c
+++ b/drivers/rtc/rtc-pcf50633.c
@@ -221,8 +221,9 @@ static int pcf50633_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
 	if (ret)
 		dev_err(dev, "Failed to write alarm time  %d\n", ret);
 
-	if (!alarm_masked)
+	if (!alarm_masked || alrm->enabled)
 		pcf50633_irq_unmask(pcf, PCF50633_IRQ_ALARM);
+	pcf->rtc.alarm_enabled = alrm->enabled;
 
 	return 0;
 }
-- 
1.5.2.2