diff options
Diffstat (limited to 'drivers/rtc/rtc-cmos.c')
-rw-r--r-- | drivers/rtc/rtc-cmos.c | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c index e24ea82dc35b..5d760bb6c2cd 100644 --- a/drivers/rtc/rtc-cmos.c +++ b/drivers/rtc/rtc-cmos.c | |||
@@ -235,7 +235,7 @@ static int cmos_set_alarm(struct device *dev, struct rtc_wkalrm *t) | |||
235 | return 0; | 235 | return 0; |
236 | } | 236 | } |
237 | 237 | ||
238 | static int cmos_set_freq(struct device *dev, int freq) | 238 | static int cmos_irq_set_freq(struct device *dev, int freq) |
239 | { | 239 | { |
240 | struct cmos_rtc *cmos = dev_get_drvdata(dev); | 240 | struct cmos_rtc *cmos = dev_get_drvdata(dev); |
241 | int f; | 241 | int f; |
@@ -259,6 +259,34 @@ static int cmos_set_freq(struct device *dev, int freq) | |||
259 | return 0; | 259 | return 0; |
260 | } | 260 | } |
261 | 261 | ||
262 | static int cmos_irq_set_state(struct device *dev, int enabled) | ||
263 | { | ||
264 | struct cmos_rtc *cmos = dev_get_drvdata(dev); | ||
265 | unsigned char rtc_control, rtc_intr; | ||
266 | unsigned long flags; | ||
267 | |||
268 | if (!is_valid_irq(cmos->irq)) | ||
269 | return -ENXIO; | ||
270 | |||
271 | spin_lock_irqsave(&rtc_lock, flags); | ||
272 | rtc_control = CMOS_READ(RTC_CONTROL); | ||
273 | |||
274 | if (enabled) | ||
275 | rtc_control |= RTC_PIE; | ||
276 | else | ||
277 | rtc_control &= ~RTC_PIE; | ||
278 | |||
279 | CMOS_WRITE(rtc_control, RTC_CONTROL); | ||
280 | |||
281 | rtc_intr = CMOS_READ(RTC_INTR_FLAGS); | ||
282 | rtc_intr &= (rtc_control & RTC_IRQMASK) | RTC_IRQF; | ||
283 | if (is_intr(rtc_intr)) | ||
284 | rtc_update_irq(cmos->rtc, 1, rtc_intr); | ||
285 | |||
286 | spin_unlock_irqrestore(&rtc_lock, flags); | ||
287 | return 0; | ||
288 | } | ||
289 | |||
262 | #if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE) | 290 | #if defined(CONFIG_RTC_INTF_DEV) || defined(CONFIG_RTC_INTF_DEV_MODULE) |
263 | 291 | ||
264 | static int | 292 | static int |
@@ -360,7 +388,8 @@ static const struct rtc_class_ops cmos_rtc_ops = { | |||
360 | .read_alarm = cmos_read_alarm, | 388 | .read_alarm = cmos_read_alarm, |
361 | .set_alarm = cmos_set_alarm, | 389 | .set_alarm = cmos_set_alarm, |
362 | .proc = cmos_procfs, | 390 | .proc = cmos_procfs, |
363 | .irq_set_freq = cmos_set_freq, | 391 | .irq_set_freq = cmos_irq_set_freq, |
392 | .irq_set_state = cmos_irq_set_state, | ||
364 | }; | 393 | }; |
365 | 394 | ||
366 | /*----------------------------------------------------------------*/ | 395 | /*----------------------------------------------------------------*/ |