int s3c_irqext_wake(struct irq_data *data, unsigned int state) { unsigned long bit = 1L << IRQ_EINT_BIT(data->irq); if (!(s3c_irqwake_eintallow & bit)) return -ENOENT; printk(KERN_INFO "wake %s for irq %d\n", state ? "enabled" : "disabled", data->irq); if (!state) s3c_irqwake_eintmask |= bit; else s3c_irqwake_eintmask &= ~bit; return 0; }
/** * charger_check_wake_irq() - Check if the given irq caused the wakeup * @wake_irq to check * @return true if that irq (and only that irq) caused the most recent wakeup * false otherwise (not that irq, or multiple irqs) */ static bool charger_check_wake_irq(int wake_irq) { unsigned long bit = IRQ_EINT_BIT(wake_irq); bool s3c_rtc_wakeup; uint value = 0; uint mask; int i; /* Check which of the enabled wakeup souces are active */ for (i = 0, mask = 1; i < 32; i++, mask <<= 1) { int gpio; if (!(s3c_irqwake_eintmask & mask)) { gpio = eint_to_gpio(i); if (!gpio_get_value(gpio)) value |= mask; } } s3c_rtc_wakeup = s3c_wksrc_rtc_alarm(); pr_debug("%s: s3c_rtc_wakeup=%d, eint=%#x\n", __func__, s3c_rtc_wakeup, value); /* * If we are looking for the exynos rtc and it is the only wakeup * cause source, then we have a match */ if (wake_irq == EXYNOS5_IRQ_RTC_ALARM) { if (s3c_rtc_wakeup && !value) return true; /* * We also have a match if the exynos rtc did not cause the wakeup * and the select eint did */ } else if (!s3c_rtc_wakeup && value == (1U << bit)) { return true; } return false; }