diff options
Diffstat (limited to 'drivers/rtc')
-rw-r--r-- | drivers/rtc/rtc-wm8350.c | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/drivers/rtc/rtc-wm8350.c b/drivers/rtc/rtc-wm8350.c index 5c5e3aa91385..616630d1e317 100644 --- a/drivers/rtc/rtc-wm8350.c +++ b/drivers/rtc/rtc-wm8350.c | |||
@@ -236,6 +236,17 @@ static int wm8350_rtc_start_alarm(struct wm8350 *wm8350) | |||
236 | return 0; | 236 | return 0; |
237 | } | 237 | } |
238 | 238 | ||
239 | static int wm8350_rtc_alarm_irq_enable(struct device *dev, | ||
240 | unsigned int enabled) | ||
241 | { | ||
242 | struct wm8350 *wm8350 = dev_get_drvdata(dev); | ||
243 | |||
244 | if (enabled) | ||
245 | return wm8350_rtc_start_alarm(wm8350); | ||
246 | else | ||
247 | return wm8350_rtc_stop_alarm(wm8350); | ||
248 | } | ||
249 | |||
239 | static int wm8350_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | 250 | static int wm8350_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) |
240 | { | 251 | { |
241 | struct wm8350 *wm8350 = dev_get_drvdata(dev); | 252 | struct wm8350 *wm8350 = dev_get_drvdata(dev); |
@@ -291,30 +302,15 @@ static int wm8350_rtc_setalarm(struct device *dev, struct rtc_wkalrm *alrm) | |||
291 | return ret; | 302 | return ret; |
292 | } | 303 | } |
293 | 304 | ||
294 | /* | 305 | static int wm8350_rtc_update_irq_enable(struct device *dev, |
295 | * Handle commands from user-space | 306 | unsigned int enabled) |
296 | */ | ||
297 | static int wm8350_rtc_ioctl(struct device *dev, unsigned int cmd, | ||
298 | unsigned long arg) | ||
299 | { | 307 | { |
300 | struct wm8350 *wm8350 = dev_get_drvdata(dev); | 308 | struct wm8350 *wm8350 = dev_get_drvdata(dev); |
301 | 309 | ||
302 | switch (cmd) { | 310 | if (enabled) |
303 | case RTC_AIE_OFF: | ||
304 | return wm8350_rtc_stop_alarm(wm8350); | ||
305 | case RTC_AIE_ON: | ||
306 | return wm8350_rtc_start_alarm(wm8350); | ||
307 | |||
308 | case RTC_UIE_OFF: | ||
309 | wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC); | ||
310 | break; | ||
311 | case RTC_UIE_ON: | ||
312 | wm8350_unmask_irq(wm8350, WM8350_IRQ_RTC_SEC); | 311 | wm8350_unmask_irq(wm8350, WM8350_IRQ_RTC_SEC); |
313 | break; | 312 | else |
314 | 313 | wm8350_mask_irq(wm8350, WM8350_IRQ_RTC_SEC); | |
315 | default: | ||
316 | return -ENOIOCTLCMD; | ||
317 | } | ||
318 | 314 | ||
319 | return 0; | 315 | return 0; |
320 | } | 316 | } |
@@ -345,11 +341,12 @@ static void wm8350_rtc_update_handler(struct wm8350 *wm8350, int irq, | |||
345 | } | 341 | } |
346 | 342 | ||
347 | static const struct rtc_class_ops wm8350_rtc_ops = { | 343 | static const struct rtc_class_ops wm8350_rtc_ops = { |
348 | .ioctl = wm8350_rtc_ioctl, | ||
349 | .read_time = wm8350_rtc_readtime, | 344 | .read_time = wm8350_rtc_readtime, |
350 | .set_time = wm8350_rtc_settime, | 345 | .set_time = wm8350_rtc_settime, |
351 | .read_alarm = wm8350_rtc_readalarm, | 346 | .read_alarm = wm8350_rtc_readalarm, |
352 | .set_alarm = wm8350_rtc_setalarm, | 347 | .set_alarm = wm8350_rtc_setalarm, |
348 | .alarm_irq_enable = wm8350_rtc_alarm_irq_enable, | ||
349 | .update_irq_enable = wm8350_rtc_update_irq_enable, | ||
353 | }; | 350 | }; |
354 | 351 | ||
355 | #ifdef CONFIG_PM | 352 | #ifdef CONFIG_PM |