Deleted Added
full compact
acpi_button.c (77432) acpi_button.c (80067)
1/*-
2 * Copyright (c) 2000 Mitsaru IWASAKI <iwasaki@jp.freebsd.org>
3 * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000 BSDi
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

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
1/*-
2 * Copyright (c) 2000 Mitsaru IWASAKI <iwasaki@jp.freebsd.org>
3 * Copyright (c) 2000 Michael Smith <msmith@freebsd.org>
4 * Copyright (c) 2000 BSDi
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

--- 11 unchanged lines hidden (view full) ---

20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD: head/sys/dev/acpica/acpi_button.c 77432 2001-05-29 20:13:42Z msmith $
28 * $FreeBSD: head/sys/dev/acpica/acpi_button.c 80067 2001-07-21 04:05:08Z msmith $
29 */
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/kernel.h>
34#include <sys/bus.h>
35
36#include "acpi.h"

--- 41 unchanged lines hidden (view full) ---

78acpi_button_probe(device_t dev)
79{
80 struct acpi_button_softc *sc;
81
82 sc = device_get_softc(dev);
83 if (acpi_get_type(dev) == ACPI_TYPE_DEVICE) {
84 if (!acpi_disabled("button")) {
85 if (acpi_MatchHid(dev, "PNP0C0C")) {
29 */
30
31#include "opt_acpi.h"
32#include <sys/param.h>
33#include <sys/kernel.h>
34#include <sys/bus.h>
35
36#include "acpi.h"

--- 41 unchanged lines hidden (view full) ---

78acpi_button_probe(device_t dev)
79{
80 struct acpi_button_softc *sc;
81
82 sc = device_get_softc(dev);
83 if (acpi_get_type(dev) == ACPI_TYPE_DEVICE) {
84 if (!acpi_disabled("button")) {
85 if (acpi_MatchHid(dev, "PNP0C0C")) {
86 device_set_desc(dev, "Control Method Power Button Device");
86 device_set_desc(dev, "Power Button");
87 sc->button_type = ACPI_POWER_BUTTON;
88 return(0);
89 }
90 if (acpi_MatchHid(dev, "PNP0C0E")) {
87 sc->button_type = ACPI_POWER_BUTTON;
88 return(0);
89 }
90 if (acpi_MatchHid(dev, "PNP0C0E")) {
91 device_set_desc(dev, "Control Method Sleep Button Device");
91 device_set_desc(dev, "Sleep Button");
92 sc->button_type = ACPI_SLEEP_BUTTON;
93 return(0);
94 }
95 }
96 }
97 return(ENXIO);
98}
99

--- 28 unchanged lines hidden (view full) ---

128 sc = (struct acpi_button_softc *)arg;
129 acpi_sc = acpi_device_get_parent_softc(sc->button_dev);
130 if (acpi_sc == NULL) {
131 return_VOID;
132 }
133
134 switch (sc->button_type) {
135 case ACPI_POWER_BUTTON:
92 sc->button_type = ACPI_SLEEP_BUTTON;
93 return(0);
94 }
95 }
96 }
97 return(ENXIO);
98}
99

--- 28 unchanged lines hidden (view full) ---

128 sc = (struct acpi_button_softc *)arg;
129 acpi_sc = acpi_device_get_parent_softc(sc->button_dev);
130 if (acpi_sc == NULL) {
131 return_VOID;
132 }
133
134 switch (sc->button_type) {
135 case ACPI_POWER_BUTTON:
136 device_printf(sc->button_dev, "power button pressed\n", sc->button_type);
136 acpi_eventhandler_power_button_for_sleep((void *)acpi_sc);
137 break;
138 case ACPI_SLEEP_BUTTON:
137 acpi_eventhandler_power_button_for_sleep((void *)acpi_sc);
138 break;
139 case ACPI_SLEEP_BUTTON:
140 device_printf(sc->button_dev, "sleep button pressed\n", sc->button_type);
139 acpi_eventhandler_sleep_button_for_sleep((void *)acpi_sc);
140 break;
141 default:
142 break; /* unknown button type */
143 }
144 return_VOID;
145}
146

--- 8 unchanged lines hidden (view full) ---

155 sc = (struct acpi_button_softc *)arg;
156 acpi_sc = acpi_device_get_parent_softc(sc->button_dev);
157 if (acpi_sc == NULL) {
158 return_VOID;
159 }
160
161 switch (sc->button_type) {
162 case ACPI_POWER_BUTTON:
141 acpi_eventhandler_sleep_button_for_sleep((void *)acpi_sc);
142 break;
143 default:
144 break; /* unknown button type */
145 }
146 return_VOID;
147}
148

--- 8 unchanged lines hidden (view full) ---

157 sc = (struct acpi_button_softc *)arg;
158 acpi_sc = acpi_device_get_parent_softc(sc->button_dev);
159 if (acpi_sc == NULL) {
160 return_VOID;
161 }
162
163 switch (sc->button_type) {
164 case ACPI_POWER_BUTTON:
165 device_printf(sc->button_dev, "wakeup by power button\n", sc->button_type);
163 acpi_eventhandler_power_button_for_wakeup((void *)acpi_sc);
164 break;
165 case ACPI_SLEEP_BUTTON:
166 acpi_eventhandler_power_button_for_wakeup((void *)acpi_sc);
167 break;
168 case ACPI_SLEEP_BUTTON:
169 device_printf(sc->button_dev, "wakeup by sleep button\n", sc->button_type);
166 acpi_eventhandler_sleep_button_for_wakeup((void *)acpi_sc);
167 break;
168 default:
169 break; /* unknown button type */
170 }
171 return_VOID;
172}
173

--- 6 unchanged lines hidden (view full) ---

180{
181 struct acpi_button_softc *sc = (struct acpi_button_softc *)context;
182
183 FUNCTION_TRACE_U32(__func__, notify);
184
185 switch (notify) {
186 case ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP:
187 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_sleep, sc);
170 acpi_eventhandler_sleep_button_for_wakeup((void *)acpi_sc);
171 break;
172 default:
173 break; /* unknown button type */
174 }
175 return_VOID;
176}
177

--- 6 unchanged lines hidden (view full) ---

184{
185 struct acpi_button_softc *sc = (struct acpi_button_softc *)context;
186
187 FUNCTION_TRACE_U32(__func__, notify);
188
189 switch (notify) {
190 case ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP:
191 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_sleep, sc);
188 device_printf(sc->button_dev, "pressed for sleep, button type: %d\n", sc->button_type);
189 break;
190 case ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP:
191 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_wakeup, sc);
192 break;
193 case ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP:
194 AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_wakeup, sc);
192 device_printf(sc->button_dev, "pressed for wakeup, button type: %d\n", sc->button_type);
193 break;
194 default:
195 break; /* unknown notification value */
196 }
197 return_VOID;
198}
199
200
195 break;
196 default:
197 break; /* unknown notification value */
198 }
199 return_VOID;
200}
201
202