pm.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * hp6x0 Power Management Routines
  3. *
  4. * Copyright (c) 2006 Andriy Skulysh <askulsyh@gmail.com>
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License.
  8. */
  9. #include <linux/init.h>
  10. #include <linux/suspend.h>
  11. #include <linux/errno.h>
  12. #include <linux/time.h>
  13. #include <asm/io.h>
  14. #include <asm/hd64461.h>
  15. #include <asm/hp6xx.h>
  16. #include <asm/cpu/dac.h>
  17. #include <asm/pm.h>
  18. #define STBCR 0xffffff82
  19. #define STBCR2 0xffffff88
  20. static int hp6x0_pm_enter(suspend_state_t state)
  21. {
  22. u8 stbcr, stbcr2;
  23. #ifdef CONFIG_HD64461_ENABLER
  24. u8 scr;
  25. u16 hd64461_stbcr;
  26. #endif
  27. #ifdef CONFIG_HD64461_ENABLER
  28. outb(0, HD64461_PCC1CSCIER);
  29. scr = inb(HD64461_PCC1SCR);
  30. scr |= HD64461_PCCSCR_VCC1;
  31. outb(scr, HD64461_PCC1SCR);
  32. hd64461_stbcr = inw(HD64461_STBCR);
  33. hd64461_stbcr |= HD64461_STBCR_SPC1ST;
  34. outw(hd64461_stbcr, HD64461_STBCR);
  35. #endif
  36. ctrl_outb(0x1f, DACR);
  37. stbcr = ctrl_inb(STBCR);
  38. ctrl_outb(0x01, STBCR);
  39. stbcr2 = ctrl_inb(STBCR2);
  40. ctrl_outb(0x7f , STBCR2);
  41. outw(0xf07f, HD64461_SCPUCR);
  42. pm_enter();
  43. outw(0, HD64461_SCPUCR);
  44. ctrl_outb(stbcr, STBCR);
  45. ctrl_outb(stbcr2, STBCR2);
  46. #ifdef CONFIG_HD64461_ENABLER
  47. hd64461_stbcr = inw(HD64461_STBCR);
  48. hd64461_stbcr &= ~HD64461_STBCR_SPC1ST;
  49. outw(hd64461_stbcr, HD64461_STBCR);
  50. outb(0x4c, HD64461_PCC1CSCIER);
  51. outb(0x00, HD64461_PCC1CSCR);
  52. #endif
  53. return 0;
  54. }
  55. static struct pm_ops hp6x0_pm_ops = {
  56. .enter = hp6x0_pm_enter,
  57. .valid = pm_valid_only_mem,
  58. };
  59. static int __init hp6x0_pm_init(void)
  60. {
  61. pm_set_ops(&hp6x0_pm_ops);
  62. return 0;
  63. }
  64. late_initcall(hp6x0_pm_init);