FreeBSD/Linux Kernel Cross Reference
sys/sys/pmf.h
1 /* $NetBSD: pmf.h,v 1.12 2008/05/05 00:16:18 jmcneill Exp $ */
2
3 /*-
4 * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 #ifndef _SYS_PMF_H
30 #define _SYS_PMF_H
31
32 #ifdef _KERNEL
33
34 typedef enum {
35 PMFE_DISPLAY_ON,
36 PMFE_DISPLAY_REDUCED,
37 PMFE_DISPLAY_STANDBY,
38 PMFE_DISPLAY_SUSPEND,
39 PMFE_DISPLAY_OFF,
40 PMFE_DISPLAY_BRIGHTNESS_UP,
41 PMFE_DISPLAY_BRIGHTNESS_DOWN,
42 PMFE_AUDIO_VOLUME_UP,
43 PMFE_AUDIO_VOLUME_DOWN,
44 PMFE_AUDIO_VOLUME_TOGGLE,
45 PMFE_CHASSIS_LID_CLOSE,
46 PMFE_CHASSIS_LID_OPEN
47 } pmf_generic_event_t;
48
49 enum pmf_flags {
50 PMF_F_NONE = 0x0
51 , PMF_F_SELF = 0x1
52 };
53
54 typedef enum pmf_flags pmf_flags_t;
55
56 #define PMF_FN_PROTO1 pmf_flags_t
57 #define PMF_FN_ARGS1 pmf_flags_t flags
58
59 #define PMF_FN_PROTO , pmf_flags_t
60 #define PMF_FN_ARGS , pmf_flags_t flags
61 #define PMF_FN_CALL , flags
62
63 #define PMF_FLAGS_FMT "%x" /* "n/a" */
64
65 void pmf_init(void);
66
67 bool pmf_event_inject(device_t, pmf_generic_event_t);
68 bool pmf_event_register(device_t, pmf_generic_event_t,
69 void (*)(device_t), bool);
70 void pmf_event_deregister(device_t, pmf_generic_event_t,
71 void (*)(device_t), bool);
72
73 bool pmf_set_platform(const char *, const char *);
74 const char *pmf_get_platform(const char *);
75
76 bool pmf_system_resume(PMF_FN_PROTO1);
77 bool pmf_system_bus_resume(PMF_FN_PROTO1);
78 bool pmf_system_suspend(PMF_FN_PROTO1);
79 void pmf_system_shutdown(int);
80
81 bool pmf_device_register1(device_t,
82 bool (*)(device_t PMF_FN_PROTO),
83 bool (*)(device_t PMF_FN_PROTO),
84 bool (*)(device_t, int));
85 /* compatibility */
86 #define pmf_device_register(__d, __s, __r) \
87 pmf_device_register1((__d), (__s), (__r), NULL)
88
89 void pmf_device_deregister(device_t);
90 bool pmf_device_suspend(device_t PMF_FN_PROTO);
91 bool pmf_device_resume(device_t PMF_FN_PROTO);
92
93 bool pmf_device_suspend_self(device_t);
94 bool pmf_device_resume_self(device_t);
95
96 bool pmf_device_recursive_suspend(device_t PMF_FN_PROTO);
97 bool pmf_device_recursive_resume(device_t PMF_FN_PROTO);
98 bool pmf_device_resume_subtree(device_t PMF_FN_PROTO);
99
100 struct ifnet;
101 void pmf_class_network_register(device_t, struct ifnet *);
102
103 bool pmf_class_input_register(device_t);
104 bool pmf_class_display_register(device_t);
105
106 #endif /* !_KERNEL */
107
108 #endif /* !_SYS_PMF_H */
Cache object: a42a12c98f0c1b67c97d8c6a538dc942
|