xref: /freebsd/sys/dev/acpi_support/acpi_fujitsu.c (revision 5515e8874a8d85a8d961fca64c494dfc1bea4bd0)
1 /*-
2  * Copyright (c) 2002 Sean Bullington <seanATstalker.org>
3  *               2003-2008 Anish Mistry <amistry@am-productions.biz>
4  *               2004 Mark Santcroos <marks@ripe.net>
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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
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  */
29 
30 #include <sys/cdefs.h>
31 #include "opt_acpi.h"
32 #include <sys/param.h>
33 #include <sys/kernel.h>
34 #include <sys/bus.h>
35 #include <sys/module.h>
36 #include <sys/sysctl.h>
37 
38 #include <contrib/dev/acpica/include/acpi.h>
39 #include <contrib/dev/acpica/include/accommon.h>
40 
41 #include <dev/acpica/acpivar.h>
42 
43 /* Hooks for the ACPI CA debugging infrastructure */
44 #define _COMPONENT	ACPI_OEM
45 ACPI_MODULE_NAME("Fujitsu")
46 
47 /* Change and update bits for the hotkeys */
48 #define VOLUME_MUTE_BIT		0x40000000
49 
50 /* Values of settings */
51 #define GENERAL_SETTING_BITS	0x0fffffff
52 #define MOUSE_SETTING_BITS	GENERAL_SETTING_BITS
53 #define VOLUME_SETTING_BITS	GENERAL_SETTING_BITS
54 #define BRIGHTNESS_SETTING_BITS	GENERAL_SETTING_BITS
55 
56 /* Possible state changes */
57 /*
58  * These are NOT arbitrary values.  They are the
59  * GHKS return value from the device that says which
60  * hotkey is active.  They should match up with a bit
61  * from the GSIF bitmask.
62  */
63 #define BRIGHT_CHANGED	0x01
64 #define VOLUME_CHANGED	0x04
65 #define MOUSE_CHANGED	0x08
66 /*
67  * It is unknown which hotkey this bit is supposed to indicate, but
68  * according to values from GSIF this is a valid flag.
69  */
70 #define UNKNOWN_CHANGED	0x10
71 
72 /* sysctl values */
73 #define FN_MUTE			0
74 #define FN_POINTER_ENABLE	1
75 #define FN_LCD_BRIGHTNESS	2
76 #define FN_VOLUME		3
77 
78 /* Methods */
79 #define METHOD_GBLL	1
80 #define METHOD_GMOU	2
81 #define METHOD_GVOL	3
82 #define METHOD_MUTE	4
83 #define METHOD_RBLL	5
84 #define METHOD_RVOL	6
85 #define METHOD_GSIF	7
86 #define METHOD_GHKS	8
87 #define METHOD_GBLS	9
88 
89 /* Notify event */
90 #define	ACPI_NOTIFY_STATUS_CHANGED	0x80
91 
92 /*
93  * Holds a control method name and its associated integer value.
94  * Only used for no-argument control methods which return a value.
95  */
96 struct int_nameval {
97 	char	*name;
98 	int	value;
99 	int	exists;
100 };
101 
102 /*
103  * Driver extension for the FUJITSU ACPI driver.
104  */
105 struct acpi_fujitsu_softc {
106 	device_t	dev;
107 	ACPI_HANDLE	handle;
108 
109 	/* Control methods */
110 	struct int_nameval	_sta,	/* unused */
111 				gbll,	/* brightness */
112 				gbls,	/* get brightness state */
113 				ghks,	/* hotkey selector */
114 				gbuf,	/* unused (buffer?) */
115 				gmou,	/* mouse */
116 				gsif,	/* function key bitmask */
117 				gvol,	/* volume */
118 				rbll,	/* number of brightness levels (radix) */
119 				rvol;	/* number of volume levels (radix) */
120 
121 	/* State variables */
122 	uint8_t		bIsMuted;	/* Is volume muted */
123 	uint8_t		bIntPtrEnabled;	/* Is internal ptr enabled */
124 	uint32_t	lastValChanged;	/* The last value updated */
125 
126 	/* sysctl tree */
127 	struct sysctl_ctx_list	sysctl_ctx;
128 	struct sysctl_oid	*sysctl_tree;
129 };
130 
131 /* Driver entry point forward declarations. */
132 static int	acpi_fujitsu_probe(device_t dev);
133 static int	acpi_fujitsu_attach(device_t dev);
134 static int	acpi_fujitsu_detach(device_t dev);
135 static int	acpi_fujitsu_suspend(device_t dev);
136 static int	acpi_fujitsu_resume(device_t dev);
137 
138 static void	acpi_fujitsu_notify_status_changed(void *arg);
139 static void	acpi_fujitsu_notify_handler(ACPI_HANDLE h, uint32_t notify, void *context);
140 static int	acpi_fujitsu_sysctl(SYSCTL_HANDLER_ARGS);
141 
142 /* Utility function declarations */
143 static uint8_t acpi_fujitsu_update(struct acpi_fujitsu_softc *sc);
144 static uint8_t acpi_fujitsu_init(struct acpi_fujitsu_softc *sc);
145 static uint8_t acpi_fujitsu_check_hardware(struct acpi_fujitsu_softc *sc);
146 
147 /* Driver/Module specific structure definitions. */
148 static device_method_t acpi_fujitsu_methods[] = {
149 	/* Device interface */
150 	DEVMETHOD(device_probe,		acpi_fujitsu_probe),
151 	DEVMETHOD(device_attach,	acpi_fujitsu_attach),
152 	DEVMETHOD(device_detach,	acpi_fujitsu_detach),
153 	DEVMETHOD(device_suspend,	acpi_fujitsu_suspend),
154 	DEVMETHOD(device_resume,	acpi_fujitsu_resume),
155 
156 	DEVMETHOD_END
157 };
158 
159 static driver_t acpi_fujitsu_driver = {
160 	"acpi_fujitsu",
161 	acpi_fujitsu_methods,
162 	sizeof(struct acpi_fujitsu_softc),
163 };
164 
165 /* Prototype for function hotkeys for getting/setting a value. */
166 static int acpi_fujitsu_method_get(struct acpi_fujitsu_softc *sc, int method);
167 static int acpi_fujitsu_method_set(struct acpi_fujitsu_softc *sc, int method, int value);
168 
169 static char *fujitsu_ids[] = { "FUJ02B1", NULL };
170 
171 ACPI_SERIAL_DECL(fujitsu, "Fujitsu Function Hotkeys");
172 
173 /* sysctl names and function calls */
174 static struct {
175 	char		*name;
176 	int		method;
177 	char		*description;
178 } sysctl_table[] = {
179 	{
180 		.name		= "mute",
181 		.method		= METHOD_MUTE,
182 		.description	= "Speakers/headphones mute status"
183 	},
184 	{
185 		.name		= "pointer_enable",
186 		.method		= METHOD_GMOU,
187 		.description	= "Enable and disable the internal pointer"
188 	},
189 	{
190 		.name		= "lcd_brightness",
191 		.method		= METHOD_GBLL,
192 		.description	= "Brightness level of the LCD panel"
193 	},
194 	{
195 		.name		= "lcd_brightness",
196 		.method		= METHOD_GBLS,
197 		.description	= "Brightness level of the LCD panel"
198 	},
199 	{
200 		.name		= "volume",
201 		.method		= METHOD_GVOL,
202 		.description	= "Speakers/headphones volume level"
203 	},
204 	{
205 		.name		= "volume_radix",
206 		.method		= METHOD_RVOL,
207 		.description	= "Number of volume level steps"
208 	},
209 	{
210 		.name		= "lcd_brightness_radix",
211 		.method		= METHOD_RBLL,
212 		.description	= "Number of brightness level steps"
213 	},
214 	{ NULL, 0, NULL }
215 };
216 
217 DRIVER_MODULE(acpi_fujitsu, acpi, acpi_fujitsu_driver, 0, 0);
218 MODULE_DEPEND(acpi_fujitsu, acpi, 1, 1, 1);
219 MODULE_VERSION(acpi_fujitsu, 1);
220 
221 static int
222 acpi_fujitsu_probe(device_t dev)
223 {
224 	char *name;
225 	int rv;
226 
227 	rv =  ACPI_ID_PROBE(device_get_parent(dev), dev, fujitsu_ids, &name);
228 	if (acpi_disabled("fujitsu") || rv > 0 || device_get_unit(dev) > 1)
229 		return (ENXIO);
230 	device_set_descf(dev, "Fujitsu Function Hotkeys %s", name);
231 
232 	return (rv);
233 }
234 
235 static int
236 acpi_fujitsu_attach(device_t dev)
237 {
238 	struct acpi_fujitsu_softc *sc;
239 
240 	ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
241 
242 	sc = device_get_softc(dev);
243 	sc->dev = dev;
244 	sc->handle = acpi_get_handle(dev);
245 
246 	/* Install notification handler */
247 	AcpiInstallNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY,
248 	    acpi_fujitsu_notify_handler, sc);
249 
250 	/* Snag our default values for the hotkeys / hotkey states. */
251 	ACPI_SERIAL_BEGIN(fujitsu);
252 	if (!acpi_fujitsu_init(sc))
253 		device_printf(dev, "Couldn't initialize hotkey states!\n");
254 	ACPI_SERIAL_END(fujitsu);
255 
256 	return (0);
257 }
258 
259 /*
260  * Called when the system is being suspended, simply
261  * set an event to be signalled when we wake up.
262  */
263 static int
264 acpi_fujitsu_suspend(device_t dev)
265 {
266 
267 	return (0);
268 }
269 
270 static int
271 acpi_fujitsu_resume(device_t dev)
272 {
273 	struct acpi_fujitsu_softc   *sc;
274 	ACPI_STATUS		    status;
275 
276 	sc = device_get_softc(dev);
277 
278 	/*
279 	 * The pointer needs to be re-enabled for
280 	 * some revisions of the P series (2120).
281 	 */
282 	ACPI_SERIAL_BEGIN(fujitsu);
283 
284 	if(sc->gmou.exists) {
285 		status = acpi_SetInteger(sc->handle, "SMOU", 1);
286 		if (ACPI_FAILURE(status))
287 			device_printf(sc->dev, "Couldn't enable pointer\n");
288 	}
289 	ACPI_SERIAL_END(fujitsu);
290 
291 	return (0);
292 }
293 
294 static void
295 acpi_fujitsu_notify_status_changed(void *arg)
296 {
297 	struct acpi_fujitsu_softc *sc;
298 
299 	ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
300 
301 	sc = (struct acpi_fujitsu_softc *)arg;
302 
303 	/*
304 	 * Since our notify function is called, we know something has
305 	 * happened.  So the only reason for acpi_fujitsu_update to fail
306 	 * is if we can't find what has changed or an error occurs.
307 	 */
308 	ACPI_SERIAL_BEGIN(fujitsu);
309 	acpi_fujitsu_update(sc);
310 	ACPI_SERIAL_END(fujitsu);
311 }
312 
313 static void
314 acpi_fujitsu_notify_handler(ACPI_HANDLE h, uint32_t notify, void *context)
315 {
316 	struct acpi_fujitsu_softc *sc;
317 
318 	ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, notify);
319 
320 	sc = (struct acpi_fujitsu_softc *)context;
321 
322 	switch (notify) {
323 	case ACPI_NOTIFY_STATUS_CHANGED:
324 		AcpiOsExecute(OSL_NOTIFY_HANDLER,
325 		    acpi_fujitsu_notify_status_changed, sc);
326 		break;
327 	default:
328 		/* unknown notification value */
329 		break;
330 	}
331 }
332 
333 static int
334 acpi_fujitsu_detach(device_t dev)
335 {
336 	struct acpi_fujitsu_softc *sc;
337 
338 	sc = device_get_softc(dev);
339 	AcpiRemoveNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY,
340 	   acpi_fujitsu_notify_handler);
341 
342 	sysctl_ctx_free(&sc->sysctl_ctx);
343 
344 	return (0);
345 }
346 
347 /*
348  * Initializes the names of the ACPI control methods and grabs
349  * the current state of all of the ACPI hotkeys into the softc.
350  */
351 static uint8_t
352 acpi_fujitsu_init(struct acpi_fujitsu_softc *sc)
353 {
354 	struct acpi_softc *acpi_sc;
355 	int i, exists;
356 
357 	ACPI_SERIAL_ASSERT(fujitsu);
358 
359 	/* Setup all of the names for each control method */
360 	sc->_sta.name = "_STA";
361 	sc->gbll.name = "GBLL";
362 	sc->gbls.name = "GBLS";
363 	sc->ghks.name = "GHKS";
364 	sc->gmou.name = "GMOU";
365 	sc->gsif.name = "GSIF";
366 	sc->gvol.name = "GVOL";
367 	sc->ghks.name = "GHKS";
368 	sc->gsif.name = "GSIF";
369 	sc->rbll.name = "RBLL";
370 	sc->rvol.name = "RVOL";
371 
372 	/* Determine what hardware functionality is available */
373 	acpi_fujitsu_check_hardware(sc);
374 
375 	/* Build the sysctl tree */
376 	acpi_sc = acpi_device_get_parent_softc(sc->dev);
377 	sysctl_ctx_init(&sc->sysctl_ctx);
378 	sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx,
379 	    SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree),
380 	    OID_AUTO, "fujitsu", CTLFLAG_RD | CTLFLAG_MPSAFE, 0, "");
381 
382 	for (i = 0; sysctl_table[i].name != NULL; i++) {
383 		switch(sysctl_table[i].method) {
384 			case METHOD_GMOU:
385 				exists = sc->gmou.exists;
386 				break;
387 			case METHOD_GBLL:
388 				exists = sc->gbll.exists;
389 				break;
390 			case METHOD_GBLS:
391 				exists = sc->gbls.exists;
392 				break;
393 			case METHOD_GVOL:
394 			case METHOD_MUTE:
395 				exists = sc->gvol.exists;
396 				break;
397 			case METHOD_RVOL:
398 				exists = sc->rvol.exists;
399 				break;
400 			case METHOD_RBLL:
401 				exists = sc->rbll.exists;
402 				break;
403 			default:
404 				/* Allow by default */
405 				exists = 1;
406 				break;
407 		}
408 		if(!exists)
409 			continue;
410 		SYSCTL_ADD_PROC(&sc->sysctl_ctx,
411 		    SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO,
412 		    sysctl_table[i].name,
413 		    CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY |
414 		    CTLFLAG_MPSAFE, sc, i, acpi_fujitsu_sysctl, "I",
415 		    sysctl_table[i].description);
416 	}
417 
418 	/* Set the hotkeys to their initial states */
419 	if (!acpi_fujitsu_update(sc)) {
420 		device_printf(sc->dev, "Couldn't init hotkey states\n");
421 		return (FALSE);
422 	}
423 
424 	return (TRUE);
425 }
426 
427 static int
428 acpi_fujitsu_sysctl(SYSCTL_HANDLER_ARGS)
429 {
430 	struct acpi_fujitsu_softc	*sc;
431 	int				method;
432 	int				arg;
433 	int				function_num, error = 0;
434 
435 	sc = (struct acpi_fujitsu_softc *)oidp->oid_arg1;
436 	function_num = oidp->oid_arg2;
437 	method = sysctl_table[function_num].method;
438 
439 	ACPI_SERIAL_BEGIN(fujitsu);
440 
441 	/* Get the current value */
442 	arg = acpi_fujitsu_method_get(sc, method);
443 	error = sysctl_handle_int(oidp, &arg, 0, req);
444 
445 	if (error != 0 || req->newptr == NULL)
446 		goto out;
447 
448 	/* Update the value */
449 	error = acpi_fujitsu_method_set(sc, method, arg);
450 
451 out:
452 	ACPI_SERIAL_END(fujitsu);
453 	return (error);
454 }
455 
456 static int
457 acpi_fujitsu_method_get(struct acpi_fujitsu_softc *sc, int method)
458 {
459 	struct int_nameval	nv;
460 	ACPI_STATUS		status;
461 
462 	ACPI_SERIAL_ASSERT(fujitsu);
463 
464 	switch (method) {
465 		case METHOD_GBLL:
466 			nv = sc->gbll;
467 			break;
468 		case METHOD_GBLS:
469 			nv = sc->gbls;
470 			break;
471 		case METHOD_GMOU:
472 			nv = sc->gmou;
473 			break;
474 		case METHOD_GVOL:
475 		case METHOD_MUTE:
476 			nv = sc->gvol;
477 			break;
478 		case METHOD_GHKS:
479 			nv = sc->ghks;
480 			break;
481 		case METHOD_GSIF:
482 			nv = sc->gsif;
483 			break;
484 		case METHOD_RBLL:
485 			nv = sc->rbll;
486 			break;
487 		case METHOD_RVOL:
488 			nv = sc->rvol;
489 			break;
490 		default:
491 			return (FALSE);
492 	}
493 
494 	if(!nv.exists)
495 		return (EINVAL);
496 
497 	status = acpi_GetInteger(sc->handle, nv.name, &nv.value);
498 	if (ACPI_FAILURE(status)) {
499 		device_printf(sc->dev, "Couldn't query method (%s)\n", nv.name);
500 		return (FALSE);
501 	}
502 
503 	if (method == METHOD_MUTE) {
504 		sc->bIsMuted = (uint8_t)((nv.value & VOLUME_MUTE_BIT) != 0);
505 		return (sc->bIsMuted);
506 	}
507 
508 	nv.value &= GENERAL_SETTING_BITS;
509 	return (nv.value);
510 }
511 
512 static int
513 acpi_fujitsu_method_set(struct acpi_fujitsu_softc *sc, int method, int value)
514 {
515 	struct int_nameval	nv;
516 	ACPI_STATUS		status;
517 	char			*control;
518 	int			changed;
519 
520 	ACPI_SERIAL_ASSERT(fujitsu);
521 
522 	switch (method) {
523 		case METHOD_GBLL:
524 			changed = BRIGHT_CHANGED;
525 			control = "SBLL";
526 			nv = sc->gbll;
527 			break;
528 		case METHOD_GBLS:
529 			changed = BRIGHT_CHANGED;
530 			control = "SBL2";
531 			nv = sc->gbls;
532 			break;
533 		case METHOD_GMOU:
534 			changed = MOUSE_CHANGED;
535 			control = "SMOU";
536 			nv = sc->gmou;
537 			break;
538 		case METHOD_GVOL:
539 		case METHOD_MUTE:
540 			changed = VOLUME_CHANGED;
541 			control = "SVOL";
542 			nv = sc->gvol;
543 			break;
544 		default:
545 			return (EINVAL);
546 	}
547 
548 	if(!nv.exists)
549 		return (EINVAL);
550 
551 	if (method == METHOD_MUTE) {
552 		if (value == 1)
553 			value = nv.value | VOLUME_MUTE_BIT;
554 		else if (value == 0)
555 			value = nv.value & ~VOLUME_MUTE_BIT;
556 		else
557 			return (EINVAL);
558 	}
559 
560 	status = acpi_SetInteger(sc->handle, control, value);
561 	if (ACPI_FAILURE(status)) {
562 		device_printf(sc->dev, "Couldn't update %s\n", control);
563 		return (FALSE);
564 	}
565 
566 	sc->lastValChanged = changed;
567 	return (0);
568 }
569 
570 /*
571  * Query the get methods to determine what functionality is available
572  * from the hardware function hotkeys.
573  */
574 static uint8_t
575 acpi_fujitsu_check_hardware(struct acpi_fujitsu_softc *sc)
576 {
577 	int val;
578 
579 	ACPI_SERIAL_ASSERT(fujitsu);
580 	/* save the hotkey bitmask */
581 	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
582 	sc->gsif.name, &(sc->gsif.value)))) {
583 		sc->gsif.exists = 0;
584 		device_printf(sc->dev, "Couldn't query bitmask value\n");
585 	} else {
586 		sc->gsif.exists = 1;
587 	}
588 
589 	/* System Volume Level */
590 	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
591 	    sc->gvol.name, &val))) {
592 		sc->gvol.exists = 0;
593 	} else {
594 		sc->gvol.exists = 1;
595 	}
596 
597 	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
598 		sc->gbls.name, &val))) {
599 		sc->gbls.exists = 0;
600 	} else {
601 		sc->gbls.exists = 1;
602 	}
603 
604 	// don't add if we can use the new method
605 	if (sc->gbls.exists || ACPI_FAILURE(acpi_GetInteger(sc->handle,
606 	    sc->gbll.name, &val))) {
607 		sc->gbll.exists = 0;
608 	} else {
609 		sc->gbll.exists = 1;
610 	}
611 
612 	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
613 	    sc->ghks.name, &val))) {
614 		sc->ghks.exists = 0;
615 	} else {
616 		sc->ghks.exists = 1;
617 	}
618 
619 	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
620 	    sc->gmou.name, &val))) {
621 		sc->gmou.exists = 0;
622 	} else {
623 		sc->gmou.exists = 1;
624 	}
625 
626 	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
627 	    sc->rbll.name, &val))) {
628 		sc->rbll.exists = 0;
629 	} else {
630 		sc->rbll.exists = 1;
631 	}
632 
633 	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
634 	    sc->rvol.name, &val))) {
635 		sc->rvol.exists = 0;
636 	} else {
637 		sc->rvol.exists = 1;
638 	}
639 
640 	return (TRUE);
641 }
642 
643 /*
644  * Query each of the ACPI control methods that contain information we're
645  * interested in. We check the return values from the control methods and
646  * adjust any state variables if they should be adjusted.
647  */
648 static uint8_t
649 acpi_fujitsu_update(struct acpi_fujitsu_softc *sc)
650 {
651 	int changed;
652 	struct acpi_softc *acpi_sc;
653 
654 	acpi_sc = acpi_device_get_parent_softc(sc->dev);
655 
656 	ACPI_SERIAL_ASSERT(fujitsu);
657 	if(sc->gsif.exists)
658 		changed = sc->gsif.value & acpi_fujitsu_method_get(sc,METHOD_GHKS);
659 	else
660 		changed = 0;
661 
662 	/* System Volume Level */
663 	if(sc->gvol.exists) {
664 		if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
665 		sc->gvol.name, &(sc->gvol.value)))) {
666 			device_printf(sc->dev, "Couldn't query volume level\n");
667 			return (FALSE);
668 		}
669 
670 		if (changed & VOLUME_CHANGED) {
671 			sc->bIsMuted =
672 			(uint8_t)((sc->gvol.value & VOLUME_MUTE_BIT) != 0);
673 
674 			/* Clear the modification bit */
675 			sc->gvol.value &= VOLUME_SETTING_BITS;
676 
677 			if (sc->bIsMuted) {
678 				acpi_UserNotify("FUJITSU", sc->handle, FN_MUTE);
679 				ACPI_VPRINT(sc->dev, acpi_sc, "Volume is now mute\n");
680 			} else
681 				ACPI_VPRINT(sc->dev, acpi_sc, "Volume is now %d\n",
682 				sc->gvol.value);
683 
684 			acpi_UserNotify("FUJITSU", sc->handle, FN_VOLUME);
685 		}
686 	}
687 
688 	/* Internal mouse pointer (eraserhead) */
689 	if(sc->gmou.exists) {
690 		if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
691 		sc->gmou.name, &(sc->gmou.value)))) {
692 			device_printf(sc->dev, "Couldn't query pointer state\n");
693 			return (FALSE);
694 		}
695 
696 		if (changed & MOUSE_CHANGED) {
697 			sc->bIntPtrEnabled = (uint8_t)(sc->gmou.value & 0x1);
698 
699 			/* Clear the modification bit */
700 			sc->gmou.value &= MOUSE_SETTING_BITS;
701 
702 			/* Set the value in case it is not hardware controlled */
703                         acpi_fujitsu_method_set(sc, METHOD_GMOU, sc->gmou.value);
704 
705 			acpi_UserNotify("FUJITSU", sc->handle, FN_POINTER_ENABLE);
706 
707 			ACPI_VPRINT(sc->dev, acpi_sc, "Internal pointer is now %s\n",
708 			(sc->bIntPtrEnabled) ? "enabled" : "disabled");
709 		}
710 	}
711 
712 	/* Screen Brightness Level P8XXX */
713 	if(sc->gbls.exists) {
714 		if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
715                 sc->gbls.name, &(sc->gbls.value)))) {
716                         device_printf(sc->dev, "Couldn't query P8XXX brightness level\n");
717                         return (FALSE);
718                 }
719 		if (changed & BRIGHT_CHANGED) {
720 			/* No state to record here. */
721 
722 			/* Clear the modification bit */
723 			sc->gbls.value &= BRIGHTNESS_SETTING_BITS;
724 
725 			/* Set the value in case it is not hardware controlled */
726 			acpi_fujitsu_method_set(sc, METHOD_GBLS, sc->gbls.value);
727 
728 			acpi_UserNotify("FUJITSU", sc->handle, FN_LCD_BRIGHTNESS);
729 
730 			ACPI_VPRINT(sc->dev, acpi_sc, "P8XXX Brightness level is now %d\n",
731 			sc->gbls.value);
732                 }
733 	}
734 
735 	/* Screen Brightness Level */
736 	if(sc->gbll.exists) {
737 		if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
738 		sc->gbll.name, &(sc->gbll.value)))) {
739 			device_printf(sc->dev, "Couldn't query brightness level\n");
740 			return (FALSE);
741 		}
742 
743 		if (changed & BRIGHT_CHANGED) {
744 			/* No state to record here. */
745 
746 			/* Clear the modification bit */
747 			sc->gbll.value &= BRIGHTNESS_SETTING_BITS;
748 
749 			acpi_UserNotify("FUJITSU", sc->handle, FN_LCD_BRIGHTNESS);
750 
751 			ACPI_VPRINT(sc->dev, acpi_sc, "Brightness level is now %d\n",
752 			sc->gbll.value);
753 		}
754 	}
755 
756 	sc->lastValChanged = changed;
757 	return (TRUE);
758 }
759