2 /* $OpenBSD: pxa2x0_apm.h,v 1.7 2005/04/13 05:40:07 uwe Exp $ */
5 * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de>
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #ifndef _PXA2X0_APM_H_
21 #define _PXA2X0_APM_H_
23 #include <sys/event.h>
25 #include <machine/bus.h>
26 #include <machine/apmvar.h>
28 struct pxa2x0_apm_softc
{
30 struct proc
*sc_thread
;
34 int sc_wakeon
; /* enabled wakeup sources */
36 bus_space_tag_t sc_iot
;
37 bus_space_handle_t sc_pm_ioh
;
38 bus_space_handle_t sc_memctl_ioh
;
39 int (*sc_get_event
)(struct pxa2x0_apm_softc
*, u_int
*);
40 void (*sc_power_info
)(struct pxa2x0_apm_softc
*,
41 struct apm_power_info
*);
42 void (*sc_suspend
)(struct pxa2x0_apm_softc
*);
43 int (*sc_resume
)(struct pxa2x0_apm_softc
*);
46 void pxa2x0_apm_attach_sub(struct pxa2x0_apm_softc
*);
47 void pxa2x0_apm_sleep(struct pxa2x0_apm_softc
*);
49 #define PXA2X0_WAKEUP_POWERON (1<<0)
50 #define PXA2X0_WAKEUP_GPIORST (1<<1)
51 #define PXA2X0_WAKEUP_SD (1<<2)
52 #define PXA2X0_WAKEUP_RC (1<<3)
53 #define PXA2X0_WAKEUP_SYNC (1<<4)
54 #define PXA2X0_WAKEUP_KEYNS0 (1<<5)
55 #define PXA2X0_WAKEUP_KEYNS1 (1<<6)
56 #define PXA2X0_WAKEUP_KEYNS2 (1<<7)
57 #define PXA2X0_WAKEUP_KEYNS3 (1<<8)
58 #define PXA2X0_WAKEUP_KEYNS4 (1<<9)
59 #define PXA2X0_WAKEUP_KEYNS5 (1<<10)
60 #define PXA2X0_WAKEUP_KEYNS6 (1<<11)
61 #define PXA2X0_WAKEUP_CF0 (1<<12)
62 #define PXA2X0_WAKEUP_CF1 (1<<13)
63 #define PXA2X0_WAKEUP_USBD (1<<14)
64 #define PXA2X0_WAKEUP_LOCKSW (1<<15)
65 #define PXA2X0_WAKEUP_JACKIN (1<<16)
66 #define PXA2X0_WAKEUP_CHRGFULL (1<<17)
67 #define PXA2X0_WAKEUP_RTC (1<<18)
69 #define PXA2X0_WAKEUP_KEYNS_ALL (PXA2X0_WAKEUP_KEYNS0| \
70 PXA2X0_WAKEUP_KEYNS1|PXA2X0_WAKEUP_KEYNS2|PXA2X0_WAKEUP_KEYNS3| \
71 PXA2X0_WAKEUP_KEYNS4|PXA2X0_WAKEUP_KEYNS5|PXA2X0_WAKEUP_KEYNS6)
73 #define PXA2X0_WAKEUP_CF_ALL (PXA2X0_WAKEUP_CF0|PXA2X0_WAKEUP_CF1)
75 #define PXA2X0_WAKEUP_ALL (PXA2X0_WAKEUP_POWERON| \
76 PXA2X0_WAKEUP_GPIORST|PXA2X0_WAKEUP_SD|PXA2X0_WAKEUP_RC| \
77 PXA2X0_WAKEUP_SYNC|PXA2X0_WAKEUP_KEYNS_ALL|PXA2X0_WAKEUP_CF_ALL| \
78 PXA2X0_WAKEUP_USBD|PXA2X0_WAKEUP_LOCKSW|PXA2X0_WAKEUP_JACKIN| \
79 PXA2X0_WAKEUP_CHRGFULL|PXA2X0_WAKEUP_RTC)
81 void pxa2x0_wakeup_config(u_int
, int);
82 u_int
pxa2x0_wakeup_status(void);