diff options
Diffstat (limited to 'drivers/rtc/class.c')
-rw-r--r-- | drivers/rtc/class.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c index e6539cbabb3..09b4437b3e6 100644 --- a/drivers/rtc/class.c +++ b/drivers/rtc/class.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/kdev_t.h> | 16 | #include <linux/kdev_t.h> |
17 | #include <linux/idr.h> | 17 | #include <linux/idr.h> |
18 | #include <linux/slab.h> | 18 | #include <linux/slab.h> |
19 | #include <linux/workqueue.h> | ||
19 | 20 | ||
20 | #include "rtc-core.h" | 21 | #include "rtc-core.h" |
21 | 22 | ||
@@ -116,6 +117,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
116 | struct module *owner) | 117 | struct module *owner) |
117 | { | 118 | { |
118 | struct rtc_device *rtc; | 119 | struct rtc_device *rtc; |
120 | struct rtc_wkalrm alrm; | ||
119 | int id, err; | 121 | int id, err; |
120 | 122 | ||
121 | if (idr_pre_get(&rtc_idr, GFP_KERNEL) == 0) { | 123 | if (idr_pre_get(&rtc_idr, GFP_KERNEL) == 0) { |
@@ -142,6 +144,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
142 | rtc->id = id; | 144 | rtc->id = id; |
143 | rtc->ops = ops; | 145 | rtc->ops = ops; |
144 | rtc->owner = owner; | 146 | rtc->owner = owner; |
147 | rtc->irq_freq = 1; | ||
145 | rtc->max_user_freq = 64; | 148 | rtc->max_user_freq = 64; |
146 | rtc->dev.parent = dev; | 149 | rtc->dev.parent = dev; |
147 | rtc->dev.class = rtc_class; | 150 | rtc->dev.class = rtc_class; |
@@ -152,6 +155,24 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev, | |||
152 | spin_lock_init(&rtc->irq_task_lock); | 155 | spin_lock_init(&rtc->irq_task_lock); |
153 | init_waitqueue_head(&rtc->irq_queue); | 156 | init_waitqueue_head(&rtc->irq_queue); |
154 | 157 | ||
158 | /* Init timerqueue */ | ||
159 | timerqueue_init_head(&rtc->timerqueue); | ||
160 | INIT_WORK(&rtc->irqwork, rtc_timer_do_work); | ||
161 | /* Init aie timer */ | ||
162 | rtc_timer_init(&rtc->aie_timer, rtc_aie_update_irq, (void *)rtc); | ||
163 | /* Init uie timer */ | ||
164 | rtc_timer_init(&rtc->uie_rtctimer, rtc_uie_update_irq, (void *)rtc); | ||
165 | /* Init pie timer */ | ||
166 | hrtimer_init(&rtc->pie_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); | ||
167 | rtc->pie_timer.function = rtc_pie_update_irq; | ||
168 | rtc->pie_enabled = 0; | ||
169 | |||
170 | /* Check to see if there is an ALARM already set in hw */ | ||
171 | err = __rtc_read_alarm(rtc, &alrm); | ||
172 | |||
173 | if (!err && !rtc_valid_tm(&alrm.time)) | ||
174 | rtc_set_alarm(rtc, &alrm); | ||
175 | |||
155 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); | 176 | strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); |
156 | dev_set_name(&rtc->dev, "rtc%d", id); | 177 | dev_set_name(&rtc->dev, "rtc%d", id); |
157 | 178 | ||