Commit 88cee8fd authored by Donggeun Kim's avatar Donggeun Kim Committed by Linus Torvalds

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: default avatarDonggeun Kim <dg77.kim@samsung.com>
Signed-off-by: default avatarMyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 7a5caabd
...@@ -51,6 +51,27 @@ static enum s3c_cpu_type s3c_rtc_cpu_type; ...@@ -51,6 +51,27 @@ static enum s3c_cpu_type s3c_rtc_cpu_type;
static DEFINE_SPINLOCK(s3c_rtc_pie_lock); static DEFINE_SPINLOCK(s3c_rtc_pie_lock);
static void s3c_rtc_alarm_clk_enable(bool enable)
{
static DEFINE_SPINLOCK(s3c_rtc_alarm_clk_lock);
static bool alarm_clk_enabled;
unsigned long irq_flags;
spin_lock_irqsave(&s3c_rtc_alarm_clk_lock, irq_flags);
if (enable) {
if (!alarm_clk_enabled) {
clk_enable(rtc_clk);
alarm_clk_enabled = true;
}
} else {
if (alarm_clk_enabled) {
clk_disable(rtc_clk);
alarm_clk_enabled = false;
}
}
spin_unlock_irqrestore(&s3c_rtc_alarm_clk_lock, irq_flags);
}
/* IRQ Handlers */ /* IRQ Handlers */
static irqreturn_t s3c_rtc_alarmirq(int irq, void *id) 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,6 +85,9 @@ static irqreturn_t s3c_rtc_alarmirq(int irq, void *id)
writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP); writeb(S3C2410_INTP_ALM, s3c_rtc_base + S3C2410_INTP);
clk_disable(rtc_clk); clk_disable(rtc_clk);
s3c_rtc_alarm_clk_enable(false);
return IRQ_HANDLED; return IRQ_HANDLED;
} }
...@@ -97,6 +121,8 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled) ...@@ -97,6 +121,8 @@ static int s3c_rtc_setaie(struct device *dev, unsigned int enabled)
writeb(tmp, s3c_rtc_base + S3C2410_RTCALM); writeb(tmp, s3c_rtc_base + S3C2410_RTCALM);
clk_disable(rtc_clk); clk_disable(rtc_clk);
s3c_rtc_alarm_clk_enable(enabled);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment