diff options
author | Donggeun Kim <dg77.kim@samsung.com> | 2011-09-14 19:22:19 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-09-14 21:09:38 -0400 |
commit | 88cee8fd77af28d414b983798dd30c8950c71e31 (patch) | |
tree | dd22f35e13c9305d5ecda7297f69eb8b68ffaf61 /drivers/rtc | |
parent | 7a5caabd090b8f7d782c40fc1c048d798f2b6fd7 (diff) |
drivers/rtc/rtc-s3c.c: fix no occurrence of alarm interrupt
The driver does not generate an alarm interrupt even though a time for
an alarm is set.
This results from disabling rtc_clk after setting the alarm time.
To generate an alarm interrupt the driver should maintain its enabled
state for rtc_clk the until alarm interrupt occurs. This patch permits
generation of an alarm interrupt.
[akpm@linux-foundation.org: make s3c_rtc_alarm_clk_lock local to s3c_rtc_alarm_clk_enable()]
Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-s3c.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-s3c.c b/drivers/rtc/rtc-s3c.c index 4e7c04e773e0..7639ab906f02 100644 --- a/drivers/rtc/rtc-s3c.c +++ b/drivers/rtc/rtc-s3c.c | |||
@@ -51,6 +51,27 @@ static enum s3c_cpu_type s3c_rtc_cpu_type; | |||
51 | 51 | ||
52 | static DEFINE_SPINLOCK(s3c_rtc_pie_lock); | 52 | static DEFINE_SPINLOCK(s3c_rtc_pie_lock); |
53 | 53 | ||
54 | static void s3c_rtc_alarm_clk_enable(bool enable) | ||
55 | { | ||
56 | static DEFINE_SPINLOCK(s3c_rtc_alarm_clk_lock); | ||
57 | static bool alarm_clk_enabled; | ||
58 | unsigned long irq_flags; | ||
59 | |||
60 | spin_lock_irqsave(&s3c_rtc_alarm_clk_lock, irq_flags); | ||
61 | if (enable) { | ||
62 | if (!alarm_clk_enabled) { | ||
63 | clk_enable(rtc_clk); | ||
64 | alarm_clk_enabled = true; | ||
65 | } | ||
66 | } else { | ||
67 | if (alarm_clk_enabled) { | ||
68 | clk_disable(rtc_clk); | ||
69 | alarm_clk_enabled = false; | ||
70 | } | ||
71 | } | ||
72 | spin_unlock_irqrestore(&s3c_rtc_alarm_clk_lock, irq_flags); | ||
73 | } | ||
74 | |||
54 | /* IRQ Handlers */ | 75 | /* IRQ Handlers */ |
55 | 76 | ||
56 | static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) | 77 | static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) |
@@ -64,6 +85,9 @@ static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) | |||
64 | writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP); | 85 | writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP); |
65 | 86 | ||
66 | clk_disable(rtc_clk); | 87 | clk_disable(rtc_clk); |
88 | |||
89 | s3c_rtc_alarm_clk_enable(false); | ||
90 | |||
67 | return IRQ_HANDLED; | 91 | return IRQ_HANDLED; |
68 | } | 92 | } |
69 | 93 | ||
@@ -97,6 +121,8 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled) | |||
97 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); | 121 | writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); |
98 | clk_disable(rtc_clk); | 122 | clk_disable(rtc_clk); |
99 | 123 | ||
124 | s3c_rtc_alarm_clk_enable(enabled); | ||
125 | |||
100 | return 0; | 126 | return 0; |
101 | } | 127 | } |
102 | 128 | ||