diff options
Diffstat (limited to 'drivers/rtc')
| -rw-r--r-- | drivers/rtc/rtc-imxdi.c | 1 | ||||
| -rw-r--r-- | drivers/rtc/rtc-s3c.c | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/drivers/rtc/rtc-imxdi.c b/drivers/rtc/rtc-imxdi.c index 2dd3c0163272..d93a9608b1f0 100644 --- a/drivers/rtc/rtc-imxdi.c +++ b/drivers/rtc/rtc-imxdi.c | |||
| @@ -35,6 +35,7 @@ | |||
| 35 | #include <linux/module.h> | 35 | #include <linux/module.h> |
| 36 | #include <linux/platform_device.h> | 36 | #include <linux/platform_device.h> |
| 37 | #include <linux/rtc.h> | 37 | #include <linux/rtc.h> |
| 38 | #include <linux/sched.h> | ||
| 38 | #include <linux/workqueue.h> | 39 | #include <linux/workqueue.h> |
| 39 | 40 | ||
| 40 | /* DryIce Register Definitions */ | 41 | /* DryIce Register Definitions */ |
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 | ||
