|
@@ -213,12 +213,24 @@ static int mask_rtc_irq_bit(unsigned char bit)
|
|
|
|
|
|
static int twl_rtc_alarm_irq_enable(struct device *dev, unsigned enabled)
|
|
|
{
|
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
|
+ int irq = platform_get_irq(pdev, 0);
|
|
|
+ static bool twl_rtc_wake_enabled;
|
|
|
int ret;
|
|
|
|
|
|
- if (enabled)
|
|
|
+ if (enabled) {
|
|
|
ret = set_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
|
|
|
- else
|
|
|
+ if (device_can_wakeup(dev) && !twl_rtc_wake_enabled) {
|
|
|
+ enable_irq_wake(irq);
|
|
|
+ twl_rtc_wake_enabled = true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
ret = mask_rtc_irq_bit(BIT_RTC_INTERRUPTS_REG_IT_ALARM_M);
|
|
|
+ if (twl_rtc_wake_enabled) {
|
|
|
+ disable_irq_wake(irq);
|
|
|
+ twl_rtc_wake_enabled = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
return ret;
|
|
|
}
|