irq-pm.c 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 <linux/sysdev.h>
  19. #include <plat/cpu.h>
  20. #include <plat/irqs.h>
  21. #include <plat/pm.h>
  22. #include <mach/map.h>
  23. #include <mach/regs-gpio.h>
  24. #include <mach/regs-irq.h>
  25. /* state for IRQs over sleep */
  26. /* default is to allow for EINT0..EINT31, and IRQ_RTC_TIC, IRQ_RTC_ALARM,
  27. * as wakeup sources
  28. *
  29. * set bit to 1 in allow bitfield to enable the wakeup settings on it
  30. */
  31. unsigned long s3c_irqwake_intallow = 0x00000006L;
  32. unsigned long s3c_irqwake_eintallow = 0xffffffffL;
  33. int s3c_irq_wake(struct irq_data *data, unsigned int state)
  34. {
  35. unsigned long irqbit;
  36. switch (data->irq) {
  37. case IRQ_RTC_TIC:
  38. case IRQ_RTC_ALARM:
  39. irqbit = 1 << (data->irq + 1 - IRQ_RTC_ALARM);
  40. if (!state)
  41. s3c_irqwake_intmask |= irqbit;
  42. else
  43. s3c_irqwake_intmask &= ~irqbit;
  44. break;
  45. default:
  46. return -ENOENT;
  47. }
  48. return 0;
  49. }
  50. static struct sleep_save eint_save[] = {
  51. SAVE_ITEM(S5P_EINT_CON(0)),
  52. SAVE_ITEM(S5P_EINT_CON(1)),
  53. SAVE_ITEM(S5P_EINT_CON(2)),
  54. SAVE_ITEM(S5P_EINT_CON(3)),
  55. SAVE_ITEM(S5P_EINT_FLTCON(0)),
  56. SAVE_ITEM(S5P_EINT_FLTCON(1)),
  57. SAVE_ITEM(S5P_EINT_FLTCON(2)),
  58. SAVE_ITEM(S5P_EINT_FLTCON(3)),
  59. SAVE_ITEM(S5P_EINT_FLTCON(4)),
  60. SAVE_ITEM(S5P_EINT_FLTCON(5)),
  61. SAVE_ITEM(S5P_EINT_FLTCON(6)),
  62. SAVE_ITEM(S5P_EINT_FLTCON(7)),
  63. SAVE_ITEM(S5P_EINT_MASK(0)),
  64. SAVE_ITEM(S5P_EINT_MASK(1)),
  65. SAVE_ITEM(S5P_EINT_MASK(2)),
  66. SAVE_ITEM(S5P_EINT_MASK(3)),
  67. };
  68. int s3c24xx_irq_suspend(struct sys_device *dev, pm_message_t state)
  69. {
  70. s3c_pm_do_save(eint_save, ARRAY_SIZE(eint_save));
  71. return 0;
  72. }
  73. int s3c24xx_irq_resume(struct sys_device *dev)
  74. {
  75. s3c_pm_do_restore(eint_save, ARRAY_SIZE(eint_save));
  76. return 0;
  77. }