2 * hp6x0 Power Management Routines
4 * Copyright (c) 2006 Andriy Skulysh <askulsyh@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License.
9 #include <linux/init.h>
10 #include <linux/suspend.h>
11 #include <linux/errno.h>
12 #include <linux/time.h>
14 #include <asm/hd64461.h>
15 #include <asm/hp6xx.h>
16 #include <asm/cpu/dac.h>
19 #define STBCR 0xffffff82
20 #define STBCR2 0xffffff88
22 static int hp6x0_pm_enter(suspend_state_t state
)
25 #ifdef CONFIG_HD64461_ENABLER
30 if (state
!= PM_SUSPEND_MEM
)
33 #ifdef CONFIG_HD64461_ENABLER
34 outb(0, HD64461_PCC1CSCIER
);
36 scr
= inb(HD64461_PCC1SCR
);
37 scr
|= HD64461_PCCSCR_VCC1
;
38 outb(scr
, HD64461_PCC1SCR
);
40 hd64461_stbcr
= inw(HD64461_STBCR
);
41 hd64461_stbcr
|= HD64461_STBCR_SPC1ST
;
42 outw(hd64461_stbcr
, HD64461_STBCR
);
45 ctrl_outb(0x1f, DACR
);
47 stbcr
= ctrl_inb(STBCR
);
48 ctrl_outb(0x01, STBCR
);
50 stbcr2
= ctrl_inb(STBCR2
);
51 ctrl_outb(0x7f , STBCR2
);
53 outw(0xf07f, HD64461_SCPUCR
);
57 outw(0, HD64461_SCPUCR
);
58 ctrl_outb(stbcr
, STBCR
);
59 ctrl_outb(stbcr2
, STBCR2
);
61 #ifdef CONFIG_HD64461_ENABLER
62 hd64461_stbcr
= inw(HD64461_STBCR
);
63 hd64461_stbcr
&= ~HD64461_STBCR_SPC1ST
;
64 outw(hd64461_stbcr
, HD64461_STBCR
);
66 outb(0x4c, HD64461_PCC1CSCIER
);
67 outb(0x00, HD64461_PCC1CSCR
);
74 * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk.
76 static struct pm_ops hp6x0_pm_ops
= {
77 .pm_disk_mode
= PM_DISK_FIRMWARE
,
78 .enter
= hp6x0_pm_enter
,
81 static int __init
hp6x0_pm_init(void)
83 pm_set_ops(&hp6x0_pm_ops
);
87 late_initcall(hp6x0_pm_init
);