|
@@ -92,10 +92,10 @@ static void rtc_uie_timer(unsigned long data)
|
|
spin_unlock_irqrestore(&rtc->irq_lock, flags);
|
|
spin_unlock_irqrestore(&rtc->irq_lock, flags);
|
|
}
|
|
}
|
|
|
|
|
|
-static void clear_uie(struct rtc_device *rtc)
|
|
|
|
|
|
+static int clear_uie(struct rtc_device *rtc)
|
|
{
|
|
{
|
|
spin_lock_irq(&rtc->irq_lock);
|
|
spin_lock_irq(&rtc->irq_lock);
|
|
- if (rtc->irq_active) {
|
|
|
|
|
|
+ if (rtc->uie_irq_active) {
|
|
rtc->stop_uie_polling = 1;
|
|
rtc->stop_uie_polling = 1;
|
|
if (rtc->uie_timer_active) {
|
|
if (rtc->uie_timer_active) {
|
|
spin_unlock_irq(&rtc->irq_lock);
|
|
spin_unlock_irq(&rtc->irq_lock);
|
|
@@ -108,9 +108,10 @@ static void clear_uie(struct rtc_device *rtc)
|
|
flush_scheduled_work();
|
|
flush_scheduled_work();
|
|
spin_lock_irq(&rtc->irq_lock);
|
|
spin_lock_irq(&rtc->irq_lock);
|
|
}
|
|
}
|
|
- rtc->irq_active = 0;
|
|
|
|
|
|
+ rtc->uie_irq_active = 0;
|
|
}
|
|
}
|
|
spin_unlock_irq(&rtc->irq_lock);
|
|
spin_unlock_irq(&rtc->irq_lock);
|
|
|
|
+ return 0;
|
|
}
|
|
}
|
|
|
|
|
|
static int set_uie(struct rtc_device *rtc)
|
|
static int set_uie(struct rtc_device *rtc)
|
|
@@ -122,8 +123,8 @@ static int set_uie(struct rtc_device *rtc)
|
|
if (err)
|
|
if (err)
|
|
return err;
|
|
return err;
|
|
spin_lock_irq(&rtc->irq_lock);
|
|
spin_lock_irq(&rtc->irq_lock);
|
|
- if (!rtc->irq_active) {
|
|
|
|
- rtc->irq_active = 1;
|
|
|
|
|
|
+ if (!rtc->uie_irq_active) {
|
|
|
|
+ rtc->uie_irq_active = 1;
|
|
rtc->stop_uie_polling = 0;
|
|
rtc->stop_uie_polling = 0;
|
|
rtc->oldsecs = tm.tm_sec;
|
|
rtc->oldsecs = tm.tm_sec;
|
|
rtc->uie_task_active = 1;
|
|
rtc->uie_task_active = 1;
|
|
@@ -134,6 +135,16 @@ static int set_uie(struct rtc_device *rtc)
|
|
spin_unlock_irq(&rtc->irq_lock);
|
|
spin_unlock_irq(&rtc->irq_lock);
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc, unsigned int enabled)
|
|
|
|
+{
|
|
|
|
+ if (enabled)
|
|
|
|
+ return set_uie(rtc);
|
|
|
|
+ else
|
|
|
|
+ return clear_uie(rtc);
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL(rtc_dev_update_irq_enable_emul);
|
|
|
|
+
|
|
#endif /* CONFIG_RTC_INTF_DEV_UIE_EMUL */
|
|
#endif /* CONFIG_RTC_INTF_DEV_UIE_EMUL */
|
|
|
|
|
|
static ssize_t
|
|
static ssize_t
|
|
@@ -357,6 +368,22 @@ static long rtc_dev_ioctl(struct file *file,
|
|
err = rtc_irq_set_state(rtc, NULL, 0);
|
|
err = rtc_irq_set_state(rtc, NULL, 0);
|
|
break;
|
|
break;
|
|
|
|
|
|
|
|
+ case RTC_AIE_ON:
|
|
|
|
+ mutex_unlock(&rtc->ops_lock);
|
|
|
|
+ return rtc_alarm_irq_enable(rtc, 1);
|
|
|
|
+
|
|
|
|
+ case RTC_AIE_OFF:
|
|
|
|
+ mutex_unlock(&rtc->ops_lock);
|
|
|
|
+ return rtc_alarm_irq_enable(rtc, 0);
|
|
|
|
+
|
|
|
|
+ case RTC_UIE_ON:
|
|
|
|
+ mutex_unlock(&rtc->ops_lock);
|
|
|
|
+ return rtc_update_irq_enable(rtc, 1);
|
|
|
|
+
|
|
|
|
+ case RTC_UIE_OFF:
|
|
|
|
+ mutex_unlock(&rtc->ops_lock);
|
|
|
|
+ return rtc_update_irq_enable(rtc, 0);
|
|
|
|
+
|
|
case RTC_IRQP_SET:
|
|
case RTC_IRQP_SET:
|
|
err = rtc_irq_set_freq(rtc, NULL, arg);
|
|
err = rtc_irq_set_freq(rtc, NULL, arg);
|
|
break;
|
|
break;
|
|
@@ -401,17 +428,6 @@ static long rtc_dev_ioctl(struct file *file,
|
|
err = -EFAULT;
|
|
err = -EFAULT;
|
|
return err;
|
|
return err;
|
|
|
|
|
|
-#ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL
|
|
|
|
- case RTC_UIE_OFF:
|
|
|
|
- mutex_unlock(&rtc->ops_lock);
|
|
|
|
- clear_uie(rtc);
|
|
|
|
- return 0;
|
|
|
|
-
|
|
|
|
- case RTC_UIE_ON:
|
|
|
|
- mutex_unlock(&rtc->ops_lock);
|
|
|
|
- err = set_uie(rtc);
|
|
|
|
- return err;
|
|
|
|
-#endif
|
|
|
|
default:
|
|
default:
|
|
err = -ENOTTY;
|
|
err = -ENOTTY;
|
|
break;
|
|
break;
|
|
@@ -440,7 +456,10 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
|
|
* Leave the alarm alone; it may be set to trigger a system wakeup
|
|
* Leave the alarm alone; it may be set to trigger a system wakeup
|
|
* later, or be used by kernel code, and is a one-shot event anyway.
|
|
* later, or be used by kernel code, and is a one-shot event anyway.
|
|
*/
|
|
*/
|
|
|
|
+
|
|
|
|
+ /* Keep ioctl until all drivers are converted */
|
|
rtc_dev_ioctl(file, RTC_UIE_OFF, 0);
|
|
rtc_dev_ioctl(file, RTC_UIE_OFF, 0);
|
|
|
|
+ rtc_update_irq_enable(rtc, 0);
|
|
rtc_irq_set_state(rtc, NULL, 0);
|
|
rtc_irq_set_state(rtc, NULL, 0);
|
|
|
|
|
|
if (rtc->ops->release)
|
|
if (rtc->ops->release)
|