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/config.h>
10 #include <linux/init.h>
11 #include <linux/suspend.h>
12 #include <linux/errno.h>
13 #include <linux/time.h>
15 #include <asm/hd64461.h>
16 #include <asm/hp6xx/hp6xx.h>
17 #include <asm/cpu/dac.h>
20 #define STBCR 0xffffff82
21 #define STBCR2 0xffffff88
23 static int hp6x0_pm_enter(suspend_state_t state
)
26 #ifdef CONFIG_HD64461_ENABLER
31 if (state
!= PM_SUSPEND_MEM
)
34 #ifdef CONFIG_HD64461_ENABLER
35 outb(0, HD64461_PCC1CSCIER
);
37 scr
= inb(HD64461_PCC1SCR
);
38 scr
|= HD64461_PCCSCR_VCC1
;
39 outb(scr
, HD64461_PCC1SCR
);
41 hd64461_stbcr
= inw(HD64461_STBCR
);
42 hd64461_stbcr
|= HD64461_STBCR_SPC1ST
;
43 outw(hd64461_stbcr
, HD64461_STBCR
);
46 ctrl_outb(0x1f, DACR
);
48 stbcr
= ctrl_inb(STBCR
);
49 ctrl_outb(0x01, STBCR
);
51 stbcr2
= ctrl_inb(STBCR2
);
52 ctrl_outb(0x7f , STBCR2
);
54 outw(0xf07f, HD64461_SCPUCR
);
58 outw(0, HD64461_SCPUCR
);
59 ctrl_outb(stbcr
, STBCR
);
60 ctrl_outb(stbcr2
, STBCR2
);
62 #ifdef CONFIG_HD64461_ENABLER
63 hd64461_stbcr
= inw(HD64461_STBCR
);
64 hd64461_stbcr
&= ~HD64461_STBCR_SPC1ST
;
65 outw(hd64461_stbcr
, HD64461_STBCR
);
67 outb(0x4c, HD64461_PCC1CSCIER
);
68 outb(0x00, HD64461_PCC1CSCR
);
75 * Set to PM_DISK_FIRMWARE so we can quickly veto suspend-to-disk.
77 static struct pm_ops hp6x0_pm_ops
= {
78 .pm_disk_mode
= PM_DISK_FIRMWARE
,
79 .enter
= hp6x0_pm_enter
,
82 static int __init
hp6x0_pm_init(void)
84 pm_set_ops(&hp6x0_pm_ops
);
88 late_initcall(hp6x0_pm_init
);