irq-pm.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* linux/arch/arm/plat-s5p/irq-pm.c
  2. *
  3. * Copyright (c) 2010 Samsung Electronics Co., Ltd.
  4. * http://www.samsung.com
  5. *
  6. * Based on arch/arm/plat-s3c24xx/irq-pm.c,
  7. * Copyright (c) 2003,2004 Simtec Electronics
  8. * Ben Dooks <ben@simtec.co.uk>
  9. * http://armlinux.simtec.co.uk/
  10. *
  11. * This program is free software; you can redistribute it and/or modify
  12. * it under the terms of the GNU General Public License version 2 as
  13. * published by the Free Software Foundation.
  14. */
  15. #include <linux/init.h>
  16. #include <linux/module.h>
  17. #include <linux/interrupt.h>
  18. #include <plat/cpu.h>
  19. #include <plat/irqs.h>
  20. #include <plat/pm.h>
  21. #include <mach/map.h>
  22. #include <mach/regs-gpio.h>
  23. #include <mach/regs-irq.h>
  24. /* state for IRQs over sleep */
  25. /* default is to allow for EINT0..EINT31, and IRQ_RTC_TIC, IRQ_RTC_ALARM,
  26. * as wakeup sources
  27. *
  28. * set bit to 1 in allow bitfield to enable the wakeup settings on it
  29. */
  30. unsigned long s3c_irqwake_intallow = 0x00000006L;
  31. unsigned long s3c_irqwake_eintallow = 0xffffffffL;
  32. int s3c_irq_wake(struct irq_data *data, unsigned int state)
  33. {
  34. unsigned long irqbit;
  35. switch (data->irq) {
  36. case IRQ_RTC_TIC:
  37. case IRQ_RTC_ALARM:
  38. irqbit = 1 << (data->irq + 1 - IRQ_RTC_ALARM);
  39. if (!state)
  40. s3c_irqwake_intmask |= irqbit;
  41. else
  42. s3c_irqwake_intmask &= ~irqbit;
  43. break;
  44. default:
  45. return -ENOENT;
  46. }
  47. return 0;
  48. }
  49. static struct sleep_save eint_save[] = {
  50. SAVE_ITEM(S5P_EINT_CON(0)),
  51. SAVE_ITEM(S5P_EINT_CON(1)),
  52. SAVE_ITEM(S5P_EINT_CON(2)),
  53. SAVE_ITEM(S5P_EINT_CON(3)),
  54. SAVE_ITEM(S5P_EINT_FLTCON(0)),
  55. SAVE_ITEM(S5P_EINT_FLTCON(1)),
  56. SAVE_ITEM(S5P_EINT_FLTCON(2)),
  57. SAVE_ITEM(S5P_EINT_FLTCON(3)),
  58. SAVE_ITEM(S5P_EINT_FLTCON(4)),
  59. SAVE_ITEM(S5P_EINT_FLTCON(5)),
  60. SAVE_ITEM(S5P_EINT_FLTCON(6)),
  61. SAVE_ITEM(S5P_EINT_FLTCON(7)),
  62. SAVE_ITEM(S5P_EINT_MASK(0)),
  63. SAVE_ITEM(S5P_EINT_MASK(1)),
  64. SAVE_ITEM(S5P_EINT_MASK(2)),
  65. SAVE_ITEM(S5P_EINT_MASK(3)),
  66. };
  67. int s3c24xx_irq_suspend(void)
  68. {
  69. s3c_pm_do_save(eint_save, ARRAY_SIZE(eint_save));
  70. return 0;
  71. }
  72. void s3c24xx_irq_resume(void)
  73. {
  74. s3c_pm_do_restore(eint_save, ARRAY_SIZE(eint_save));
  75. }