wakeup-mask.c 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* arch/arm/plat-samsung/wakeup-mask.c
  2. *
  3. * Copyright 2010 Ben Dooks <ben-linux@fluff.org>
  4. *
  5. * Support for wakeup mask interrupts on newer SoCs
  6. *
  7. * This program is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU General Public License version 2 as
  9. * published by the Free Software Foundation.
  10. */
  11. #include <linux/kernel.h>
  12. #include <linux/spinlock.h>
  13. #include <linux/sysdev.h>
  14. #include <linux/types.h>
  15. #include <linux/irq.h>
  16. #include <linux/io.h>
  17. #include <plat/wakeup-mask.h>
  18. #include <plat/pm.h>
  19. void samsung_sync_wakemask(void __iomem *reg,
  20. struct samsung_wakeup_mask *mask, int nr_mask)
  21. {
  22. struct irq_data *data;
  23. u32 val;
  24. val = __raw_readl(reg);
  25. for (; nr_mask > 0; nr_mask--, mask++) {
  26. if (mask->irq == NO_WAKEUP_IRQ) {
  27. val |= mask->bit;
  28. continue;
  29. }
  30. data = irq_get_irq_data(mask->irq);
  31. /* bit of a liberty to read this directly from irq_data. */
  32. if (irqd_is_wakeup_set(data))
  33. val &= ~mask->bit;
  34. else
  35. val |= mask->bit;
  36. }
  37. printk(KERN_INFO "wakemask %08x => %08x\n", __raw_readl(reg), val);
  38. __raw_writel(val, reg);
  39. }