• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/src/linux/linux-2.6/drivers/rtc/

Lines Matching defs:rtc

14 #include <linux/rtc.h>
16 int rtc_read_time(struct rtc_device *rtc, struct rtc_time *tm)
20 err = mutex_lock_interruptible(&rtc->ops_lock);
24 if (!rtc->ops)
26 else if (!rtc->ops->read_time)
30 err = rtc->ops->read_time(rtc->dev.parent, tm);
33 mutex_unlock(&rtc->ops_lock);
38 int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
46 err = mutex_lock_interruptible(&rtc->ops_lock);
50 if (!rtc->ops)
52 else if (!rtc->ops->set_time)
55 err = rtc->ops->set_time(rtc->dev.parent, tm);
57 mutex_unlock(&rtc->ops_lock);
62 int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs)
66 err = mutex_lock_interruptible(&rtc->ops_lock);
70 if (!rtc->ops)
72 else if (rtc->ops->set_mmss)
73 err = rtc->ops->set_mmss(rtc->dev.parent, secs);
74 else if (rtc->ops->read_time && rtc->ops->set_time) {
77 err = rtc->ops->read_time(rtc->dev.parent, &old);
89 err = rtc->ops->set_time(rtc->dev.parent,
96 mutex_unlock(&rtc->ops_lock);
102 int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
106 err = mutex_lock_interruptible(&rtc->ops_lock);
110 if (rtc->ops == NULL)
112 else if (!rtc->ops->read_alarm)
116 err = rtc->ops->read_alarm(rtc->dev.parent, alarm);
119 mutex_unlock(&rtc->ops_lock);
124 int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
132 err = mutex_lock_interruptible(&rtc->ops_lock);
136 if (!rtc->ops)
138 else if (!rtc->ops->set_alarm)
141 err = rtc->ops->set_alarm(rtc->dev.parent, alarm);
143 mutex_unlock(&rtc->ops_lock);
150 * @rtc: the rtc device
155 void rtc_update_irq(struct rtc_device *rtc,
158 spin_lock(&rtc->irq_lock);
159 rtc->irq_data = (rtc->irq_data + (num << 8)) | events;
160 spin_unlock(&rtc->irq_lock);
162 spin_lock(&rtc->irq_task_lock);
163 if (rtc->irq_task)
164 rtc->irq_task->func(rtc->irq_task->private_data);
165 spin_unlock(&rtc->irq_task_lock);
167 wake_up_interruptible(&rtc->irq_queue);
168 kill_fasync(&rtc->async_queue, SIGIO, POLL_IN);
175 struct rtc_device *rtc = NULL;
182 rtc = to_rtc_device(dev);
187 if (rtc) {
188 if (!try_module_get(rtc->owner)) {
190 rtc = NULL;
195 return rtc;
199 void rtc_class_close(struct rtc_device *rtc)
201 module_put(rtc->owner);
202 put_device(&rtc->dev);
206 int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task)
213 spin_lock_irq(&rtc->irq_task_lock);
214 if (rtc->irq_task == NULL) {
215 rtc->irq_task = task;
218 spin_unlock_irq(&rtc->irq_task_lock);
224 void rtc_irq_unregister(struct rtc_device *rtc, struct rtc_task *task)
227 spin_lock_irq(&rtc->irq_task_lock);
228 if (rtc->irq_task == task)
229 rtc->irq_task = NULL;
230 spin_unlock_irq(&rtc->irq_task_lock);
234 int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled)
239 if (rtc->ops->irq_set_state == NULL)
242 spin_lock_irqsave(&rtc->irq_task_lock, flags);
243 if (rtc->irq_task != task)
245 spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
248 err = rtc->ops->irq_set_state(rtc->dev.parent, enabled);
254 int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
259 if (rtc->ops->irq_set_freq == NULL)
262 spin_lock_irqsave(&rtc->irq_task_lock, flags);
263 if (rtc->irq_task != task)
265 spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
268 err = rtc->ops->irq_set_freq(rtc->dev.parent, freq);
270 rtc->irq_freq = freq;