Lines Matching refs:rtc
32 struct rtc_device *rtc = to_rtc_device(dev); in rtc_device_release() local
33 ida_simple_remove(&rtc_ida, rtc->id); in rtc_device_release()
34 kfree(rtc); in rtc_device_release()
53 struct rtc_device *rtc = to_rtc_device(dev); in rtc_suspend() local
61 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0) in rtc_suspend()
65 err = rtc_read_time(rtc, &tm); in rtc_suspend()
67 pr_debug("%s: fail to read rtc time\n", dev_name(&rtc->dev)); in rtc_suspend()
99 struct rtc_device *rtc = to_rtc_device(dev); in rtc_resume() local
109 if (strcmp(dev_name(&rtc->dev), CONFIG_RTC_HCTOSYS_DEVICE) != 0) in rtc_resume()
114 err = rtc_read_time(rtc, &tm); in rtc_resume()
116 pr_debug("%s: fail to read rtc time\n", dev_name(&rtc->dev)); in rtc_resume()
124 pr_debug("%s: time travel!\n", dev_name(&rtc->dev)); in rtc_resume()
167 struct rtc_device *rtc; in rtc_device_register() local
192 rtc = kzalloc(sizeof(struct rtc_device), GFP_KERNEL); in rtc_device_register()
193 if (rtc == NULL) { in rtc_device_register()
198 rtc->id = id; in rtc_device_register()
199 rtc->ops = ops; in rtc_device_register()
200 rtc->owner = owner; in rtc_device_register()
201 rtc->irq_freq = 1; in rtc_device_register()
202 rtc->max_user_freq = 64; in rtc_device_register()
203 rtc->dev.parent = dev; in rtc_device_register()
204 rtc->dev.class = rtc_class; in rtc_device_register()
205 rtc->dev.groups = rtc_get_dev_attribute_groups(); in rtc_device_register()
206 rtc->dev.release = rtc_device_release; in rtc_device_register()
208 mutex_init(&rtc->ops_lock); in rtc_device_register()
209 spin_lock_init(&rtc->irq_lock); in rtc_device_register()
210 spin_lock_init(&rtc->irq_task_lock); in rtc_device_register()
211 init_waitqueue_head(&rtc->irq_queue); in rtc_device_register()
214 timerqueue_init_head(&rtc->timerqueue); in rtc_device_register()
215 INIT_WORK(&rtc->irqwork, rtc_timer_do_work); in rtc_device_register()
217 rtc_timer_init(&rtc->aie_timer, rtc_aie_update_irq, (void *)rtc); in rtc_device_register()
219 rtc_timer_init(&rtc->uie_rtctimer, rtc_uie_update_irq, (void *)rtc); in rtc_device_register()
221 hrtimer_init(&rtc->pie_timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); in rtc_device_register()
222 rtc->pie_timer.function = rtc_pie_update_irq; in rtc_device_register()
223 rtc->pie_enabled = 0; in rtc_device_register()
225 strlcpy(rtc->name, name, RTC_DEVICE_NAME_SIZE); in rtc_device_register()
226 dev_set_name(&rtc->dev, "rtc%d", id); in rtc_device_register()
229 err = __rtc_read_alarm(rtc, &alrm); in rtc_device_register()
232 rtc_initialize_alarm(rtc, &alrm); in rtc_device_register()
234 rtc_dev_prepare(rtc); in rtc_device_register()
236 err = device_register(&rtc->dev); in rtc_device_register()
239 put_device(&rtc->dev); in rtc_device_register()
243 rtc_dev_add_device(rtc); in rtc_device_register()
244 rtc_proc_add_device(rtc); in rtc_device_register()
247 rtc->name, dev_name(&rtc->dev)); in rtc_device_register()
249 return rtc; in rtc_device_register()
267 void rtc_device_unregister(struct rtc_device *rtc) in rtc_device_unregister() argument
269 mutex_lock(&rtc->ops_lock); in rtc_device_unregister()
274 rtc_dev_del_device(rtc); in rtc_device_unregister()
275 rtc_proc_del_device(rtc); in rtc_device_unregister()
276 device_del(&rtc->dev); in rtc_device_unregister()
277 rtc->ops = NULL; in rtc_device_unregister()
278 mutex_unlock(&rtc->ops_lock); in rtc_device_unregister()
279 put_device(&rtc->dev); in rtc_device_unregister()
285 struct rtc_device *rtc = *(struct rtc_device **)res; in devm_rtc_device_release() local
287 rtc_device_unregister(rtc); in devm_rtc_device_release()
292 struct rtc **r = res; in devm_rtc_device_match()
316 struct rtc_device **ptr, *rtc; in devm_rtc_device_register() local
322 rtc = rtc_device_register(name, dev, ops, owner); in devm_rtc_device_register()
323 if (!IS_ERR(rtc)) { in devm_rtc_device_register()
324 *ptr = rtc; in devm_rtc_device_register()
330 return rtc; in devm_rtc_device_register()
343 void devm_rtc_device_unregister(struct device *dev, struct rtc_device *rtc) in devm_rtc_device_unregister() argument
348 devm_rtc_device_match, rtc); in devm_rtc_device_unregister()