rtc: tw4030 add alarm/update interfaces
[safe/jmp/linux-2.6] / drivers / rtc / interface.c
index 43276f2..4348c4b 100644 (file)
@@ -50,10 +50,15 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm)
 
        if (!rtc->ops)
                err = -ENODEV;
-       else if (!rtc->ops->set_time)
-               err = -EINVAL;
-       else
+       else if (rtc->ops->set_time)
                err = rtc->ops->set_time(rtc->dev.parent, tm);
+       else if (rtc->ops->set_mmss) {
+               unsigned long secs;
+               err = rtc_tm_to_time(tm, &secs);
+               if (err == 0)
+                       err = rtc->ops->set_mmss(rtc->dev.parent, secs);
+       } else
+               err = -EINVAL;
 
        mutex_unlock(&rtc->ops_lock);
        return err;
@@ -504,9 +509,6 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
        if (rtc->ops->irq_set_freq == NULL)
                return -ENXIO;
 
-       if (!is_power_of_2(freq))
-               return -EINVAL;
-
        spin_lock_irqsave(&rtc->irq_task_lock, flags);
        if (rtc->irq_task != NULL && task == NULL)
                err = -EBUSY;