pm.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  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. };
  58. static int __init hp6x0_pm_init(void)
  59. {
  60. pm_set_ops(&hp6x0_pm_ops);
  61. return 0;
  62. }
  63. late_initcall(hp6x0_pm_init);