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 * $FreeBSD: head/sys/dev/acpi_support/acpi_fujitsu.c 246128 2013-01-30 18:01:20Z sbz $ 29 */ 30 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 "acpi.h" 39 #include "accommon.h" 40 41 #include <dev/acpica/acpivar.h> 42 43 /* Hooks for the ACPICA 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 DEVMETHOD_END 156 }; 157 158 static driver_t acpi_fujitsu_driver = { 159 "acpi_fujitsu", 160 acpi_fujitsu_methods, 161 sizeof(struct acpi_fujitsu_softc), 162 }; 163 164 /* Prototype for function hotkeys for getting/setting a value. */ 165 static int acpi_fujitsu_method_get(struct acpi_fujitsu_softc *sc, int method); 166 static int acpi_fujitsu_method_set(struct acpi_fujitsu_softc *sc, int method, int value); 167 168 static char *fujitsu_ids[] = { "FUJ02B1", NULL }; 169 170 ACPI_SERIAL_DECL(fujitsu, "Fujitsu Function Hotkeys"); 171 172 /* sysctl names and function calls */ 173 static struct { 174 char *name; 175 int method; 176 char *description; 177 } sysctl_table[] = { 178 { 179 .name = "mute", 180 .method = METHOD_MUTE, 181 .description = "Speakers/headphones mute status" 182 }, 183 { 184 .name = "pointer_enable", 185 .method = METHOD_GMOU, 186 .description = "Enable and disable the internal pointer" 187 }, 188 { 189 .name = "lcd_brightness", 190 .method = METHOD_GBLL, 191 .description = "Brightness level of the LCD panel" 192 }, 193 { 194 .name = "lcd_brightness", 195 .method = METHOD_GBLS, 196 .description = "Brightness level of the LCD panel" 197 }, 198 { 199 .name = "volume", 200 .method = METHOD_GVOL, 201 .description = "Speakers/headphones volume level" 202 }, 203 { 204 .name = "volume_radix", 205 .method = METHOD_RVOL, 206 .description = "Number of volume level steps" 207 }, 208 { 209 .name = "lcd_brightness_radix", 210 .method = METHOD_RBLL, 211 .description = "Number of brightness level steps" 212 }, 213 214 { NULL, 0, NULL } 215 }; 216 217 static devclass_t acpi_fujitsu_devclass; 218 DRIVER_MODULE(acpi_fujitsu, acpi, acpi_fujitsu_driver, 219 acpi_fujitsu_devclass, 0, 0); 220 MODULE_DEPEND(acpi_fujitsu, acpi, 1, 1, 1); 221 MODULE_VERSION(acpi_fujitsu, 1); 222 223 static int 224 acpi_fujitsu_probe(device_t dev) 225 { 226 char *name; 227 char buffer[64]; 228 229 name = ACPI_ID_PROBE(device_get_parent(dev), dev, fujitsu_ids); 230 if (acpi_disabled("fujitsu") || name == NULL || 231 device_get_unit(dev) > 1) 232 return (ENXIO); 233 234 ksprintf(buffer, "Fujitsu Function Hotkeys %s", name); 235 device_set_desc_copy(dev, buffer); 236 237 return (0); 238 } 239 240 static int 241 acpi_fujitsu_attach(device_t dev) 242 { 243 struct acpi_fujitsu_softc *sc; 244 245 ACPI_SERIAL_INIT(fujitsu); 246 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); 247 248 sc = device_get_softc(dev); 249 sc->dev = dev; 250 sc->handle = acpi_get_handle(dev); 251 252 /* Install notification handler */ 253 AcpiInstallNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY, 254 acpi_fujitsu_notify_handler, sc); 255 256 /* Snag our default values for the hotkeys / hotkey states. */ 257 ACPI_SERIAL_BEGIN(fujitsu); 258 if (!acpi_fujitsu_init(sc)) 259 device_printf(dev, "Couldn't initialize hotkey states!\n"); 260 ACPI_SERIAL_END(fujitsu); 261 262 return (0); 263 } 264 265 /* 266 * Called when the system is being suspended, simply 267 * set an event to be signalled when we wake up. 268 */ 269 static int 270 acpi_fujitsu_suspend(device_t dev) 271 { 272 273 return (0); 274 } 275 276 static int 277 acpi_fujitsu_resume(device_t dev) 278 { 279 struct acpi_fujitsu_softc *sc; 280 ACPI_STATUS status; 281 282 sc = device_get_softc(dev); 283 284 /* 285 * The pointer needs to be re-enabled for 286 * some revisions of the P series (2120). 287 */ 288 ACPI_SERIAL_BEGIN(fujitsu); 289 290 if(sc->gmou.exists) { 291 status = acpi_SetInteger(sc->handle, "SMOU", 1); 292 if (ACPI_FAILURE(status)) 293 device_printf(sc->dev, "Couldn't enable pointer\n"); 294 } 295 ACPI_SERIAL_END(fujitsu); 296 297 return (0); 298 } 299 300 static void 301 acpi_fujitsu_notify_status_changed(void *arg) 302 { 303 struct acpi_fujitsu_softc *sc; 304 305 ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); 306 307 sc = (struct acpi_fujitsu_softc *)arg; 308 309 /* 310 * Since our notify function is called, we know something has 311 * happened. So the only reason for acpi_fujitsu_update to fail 312 * is if we can't find what has changed or an error occurs. 313 */ 314 ACPI_SERIAL_BEGIN(fujitsu); 315 acpi_fujitsu_update(sc); 316 ACPI_SERIAL_END(fujitsu); 317 } 318 319 320 static void 321 acpi_fujitsu_notify_handler(ACPI_HANDLE h, uint32_t notify, void *context) 322 { 323 struct acpi_fujitsu_softc *sc; 324 325 ACPI_FUNCTION_TRACE_U32((char *)(uintptr_t)__func__, notify); 326 327 sc = (struct acpi_fujitsu_softc *)context; 328 329 switch (notify) { 330 case ACPI_NOTIFY_STATUS_CHANGED: 331 AcpiOsExecute(OSL_NOTIFY_HANDLER, 332 acpi_fujitsu_notify_status_changed, sc); 333 break; 334 default: 335 /* unknown notification value */ 336 break; 337 } 338 } 339 340 static int 341 acpi_fujitsu_detach(device_t dev) 342 { 343 struct acpi_fujitsu_softc *sc; 344 345 sc = device_get_softc(dev); 346 AcpiRemoveNotifyHandler(sc->handle, ACPI_DEVICE_NOTIFY, 347 acpi_fujitsu_notify_handler); 348 349 sysctl_ctx_free(&sc->sysctl_ctx); 350 351 return (0); 352 } 353 354 /* 355 * Initializes the names of the ACPI control methods and grabs 356 * the current state of all of the ACPI hotkeys into the softc. 357 */ 358 static uint8_t 359 acpi_fujitsu_init(struct acpi_fujitsu_softc *sc) 360 { 361 struct acpi_softc *acpi_sc; 362 int i, exists; 363 364 ACPI_SERIAL_ASSERT(fujitsu); 365 366 /* Setup all of the names for each control method */ 367 sc->_sta.name = "_STA"; 368 sc->gbll.name = "GBLL"; 369 sc->gbls.name = "GBLS"; 370 sc->ghks.name = "GHKS"; 371 sc->gmou.name = "GMOU"; 372 sc->gsif.name = "GSIF"; 373 sc->gvol.name = "GVOL"; 374 sc->ghks.name = "GHKS"; 375 sc->gsif.name = "GSIF"; 376 sc->rbll.name = "RBLL"; 377 sc->rvol.name = "RVOL"; 378 379 /* Determine what hardware functionality is available */ 380 acpi_fujitsu_check_hardware(sc); 381 382 /* Build the sysctl tree */ 383 acpi_sc = acpi_device_get_parent_softc(sc->dev); 384 sysctl_ctx_init(&sc->sysctl_ctx); 385 sc->sysctl_tree = SYSCTL_ADD_NODE(&sc->sysctl_ctx, 386 SYSCTL_CHILDREN(acpi_sc->acpi_sysctl_tree), 387 OID_AUTO, "fujitsu", CTLFLAG_RD, 0, ""); 388 389 for (i = 0; sysctl_table[i].name != NULL; i++) { 390 switch(sysctl_table[i].method) { 391 case METHOD_GMOU: 392 exists = sc->gmou.exists; 393 break; 394 case METHOD_GBLL: 395 exists = sc->gbll.exists; 396 break; 397 case METHOD_GBLS: 398 exists = sc->gbls.exists; 399 break; 400 case METHOD_GVOL: 401 case METHOD_MUTE: 402 exists = sc->gvol.exists; 403 break; 404 case METHOD_RVOL: 405 exists = sc->rvol.exists; 406 break; 407 case METHOD_RBLL: 408 exists = sc->rbll.exists; 409 break; 410 default: 411 /* Allow by default */ 412 exists = 1; 413 break; 414 } 415 if(!exists) 416 continue; 417 SYSCTL_ADD_PROC(&sc->sysctl_ctx, 418 SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, 419 sysctl_table[i].name, 420 CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_ANYBODY, 421 sc, i, acpi_fujitsu_sysctl, "I", 422 sysctl_table[i].description); 423 } 424 425 426 /* Set the hotkeys to their initial states */ 427 if (!acpi_fujitsu_update(sc)) { 428 device_printf(sc->dev, "Couldn't init hotkey states\n"); 429 return (FALSE); 430 } 431 432 return (TRUE); 433 } 434 435 static int 436 acpi_fujitsu_sysctl(SYSCTL_HANDLER_ARGS) 437 { 438 struct acpi_fujitsu_softc *sc; 439 int method; 440 int arg; 441 int function_num, error = 0; 442 443 sc = (struct acpi_fujitsu_softc *)oidp->oid_arg1; 444 function_num = oidp->oid_arg2; 445 method = sysctl_table[function_num].method; 446 447 ACPI_SERIAL_BEGIN(fujitsu); 448 449 /* Get the current value */ 450 arg = acpi_fujitsu_method_get(sc, method); 451 error = sysctl_handle_int(oidp, &arg, 0, req); 452 453 if (error != 0 || req->newptr == NULL) 454 goto out; 455 456 /* Update the value */ 457 error = acpi_fujitsu_method_set(sc, method, arg); 458 459 out: 460 ACPI_SERIAL_END(fujitsu); 461 return (error); 462 } 463 464 static int 465 acpi_fujitsu_method_get(struct acpi_fujitsu_softc *sc, int method) 466 { 467 struct int_nameval nv; 468 ACPI_STATUS status; 469 470 ACPI_SERIAL_ASSERT(fujitsu); 471 472 switch (method) { 473 case METHOD_GBLL: 474 nv = sc->gbll; 475 break; 476 case METHOD_GBLS: 477 nv = sc->gbls; 478 break; 479 case METHOD_GMOU: 480 nv = sc->gmou; 481 break; 482 case METHOD_GVOL: 483 case METHOD_MUTE: 484 nv = sc->gvol; 485 break; 486 case METHOD_GHKS: 487 nv = sc->ghks; 488 break; 489 case METHOD_GSIF: 490 nv = sc->gsif; 491 break; 492 case METHOD_RBLL: 493 nv = sc->rbll; 494 break; 495 case METHOD_RVOL: 496 nv = sc->rvol; 497 break; 498 default: 499 return (FALSE); 500 } 501 502 if(!nv.exists) 503 return (EINVAL); 504 505 status = acpi_GetInteger(sc->handle, nv.name, &nv.value); 506 if (ACPI_FAILURE(status)) { 507 device_printf(sc->dev, "Couldn't query method (%s)\n", nv.name); 508 return (FALSE); 509 } 510 511 if (method == METHOD_MUTE) { 512 sc->bIsMuted = (uint8_t)((nv.value & VOLUME_MUTE_BIT) != 0); 513 return (sc->bIsMuted); 514 } 515 516 nv.value &= GENERAL_SETTING_BITS; 517 return (nv.value); 518 } 519 520 static int 521 acpi_fujitsu_method_set(struct acpi_fujitsu_softc *sc, int method, int value) 522 { 523 struct int_nameval nv; 524 ACPI_STATUS status; 525 char *control; 526 int changed; 527 528 ACPI_SERIAL_ASSERT(fujitsu); 529 530 switch (method) { 531 case METHOD_GBLL: 532 changed = BRIGHT_CHANGED; 533 control = "SBLL"; 534 nv = sc->gbll; 535 break; 536 case METHOD_GBLS: 537 changed = BRIGHT_CHANGED; 538 control = "SBL2"; 539 nv = sc->gbls; 540 break; 541 case METHOD_GMOU: 542 changed = MOUSE_CHANGED; 543 control = "SMOU"; 544 nv = sc->gmou; 545 break; 546 case METHOD_GVOL: 547 case METHOD_MUTE: 548 changed = VOLUME_CHANGED; 549 control = "SVOL"; 550 nv = sc->gvol; 551 break; 552 default: 553 return (EINVAL); 554 } 555 556 if(!nv.exists) 557 return (EINVAL); 558 559 if (method == METHOD_MUTE) { 560 if (value == 1) 561 value = nv.value | VOLUME_MUTE_BIT; 562 else if (value == 0) 563 value = nv.value & ~VOLUME_MUTE_BIT; 564 else 565 return (EINVAL); 566 } 567 568 status = acpi_SetInteger(sc->handle, control, value); 569 if (ACPI_FAILURE(status)) { 570 device_printf(sc->dev, "Couldn't update %s\n", control); 571 return (FALSE); 572 } 573 574 sc->lastValChanged = changed; 575 return (0); 576 } 577 578 /* 579 * Query the get methods to determine what functionality is available 580 * from the hardware function hotkeys. 581 */ 582 static uint8_t 583 acpi_fujitsu_check_hardware(struct acpi_fujitsu_softc *sc) 584 { 585 int val; 586 587 ACPI_SERIAL_ASSERT(fujitsu); 588 /* save the hotkey bitmask */ 589 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 590 sc->gsif.name, &(sc->gsif.value)))) { 591 sc->gsif.exists = 0; 592 device_printf(sc->dev, "Couldn't query bitmask value\n"); 593 } else { 594 sc->gsif.exists = 1; 595 } 596 597 /* System Volume Level */ 598 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 599 sc->gvol.name, &val))) { 600 sc->gvol.exists = 0; 601 } else { 602 sc->gvol.exists = 1; 603 } 604 605 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 606 sc->gbls.name, &val))) { 607 sc->gbls.exists = 0; 608 } else { 609 sc->gbls.exists = 1; 610 } 611 612 /* don't add if we can use the new method */ 613 if (sc->gbls.exists || ACPI_FAILURE(acpi_GetInteger(sc->handle, 614 sc->gbll.name, &val))) { 615 sc->gbll.exists = 0; 616 } else { 617 sc->gbll.exists = 1; 618 } 619 620 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 621 sc->ghks.name, &val))) { 622 sc->ghks.exists = 0; 623 } else { 624 sc->ghks.exists = 1; 625 } 626 627 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 628 sc->gmou.name, &val))) { 629 sc->gmou.exists = 0; 630 } else { 631 sc->gmou.exists = 1; 632 } 633 634 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 635 sc->rbll.name, &val))) { 636 sc->rbll.exists = 0; 637 } else { 638 sc->rbll.exists = 1; 639 } 640 641 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 642 sc->rvol.name, &val))) { 643 sc->rvol.exists = 0; 644 } else { 645 sc->rvol.exists = 1; 646 } 647 648 return (TRUE); 649 } 650 651 /* 652 * Query each of the ACPI control methods that contain information we're 653 * interested in. We check the return values from the control methods and 654 * adjust any state variables if they should be adjusted. 655 */ 656 static uint8_t 657 acpi_fujitsu_update(struct acpi_fujitsu_softc *sc) 658 { 659 int changed; 660 struct acpi_softc *acpi_sc; 661 662 acpi_sc = acpi_device_get_parent_softc(sc->dev); 663 664 ACPI_SERIAL_ASSERT(fujitsu); 665 if(sc->gsif.exists) 666 changed = sc->gsif.value & acpi_fujitsu_method_get(sc,METHOD_GHKS); 667 else 668 changed = 0; 669 670 /* System Volume Level */ 671 if(sc->gvol.exists) { 672 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 673 sc->gvol.name, &(sc->gvol.value)))) { 674 device_printf(sc->dev, "Couldn't query volume level\n"); 675 return (FALSE); 676 } 677 678 if (changed & VOLUME_CHANGED) { 679 sc->bIsMuted = 680 (uint8_t)((sc->gvol.value & VOLUME_MUTE_BIT) != 0); 681 682 /* Clear the modification bit */ 683 sc->gvol.value &= VOLUME_SETTING_BITS; 684 685 if (sc->bIsMuted) { 686 acpi_UserNotify("FUJITSU", sc->handle, FN_MUTE); 687 ACPI_VPRINT(sc->dev, acpi_sc, "Volume is now mute\n"); 688 } else 689 ACPI_VPRINT(sc->dev, acpi_sc, "Volume is now %d\n", 690 sc->gvol.value); 691 692 acpi_UserNotify("FUJITSU", sc->handle, FN_VOLUME); 693 } 694 } 695 696 /* Internal mouse pointer (eraserhead) */ 697 if(sc->gmou.exists) { 698 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 699 sc->gmou.name, &(sc->gmou.value)))) { 700 device_printf(sc->dev, "Couldn't query pointer state\n"); 701 return (FALSE); 702 } 703 704 if (changed & MOUSE_CHANGED) { 705 sc->bIntPtrEnabled = (uint8_t)(sc->gmou.value & 0x1); 706 707 /* Clear the modification bit */ 708 sc->gmou.value &= MOUSE_SETTING_BITS; 709 710 /* Set the value in case it is not hardware controlled */ 711 acpi_fujitsu_method_set(sc, METHOD_GMOU, sc->gmou.value); 712 713 acpi_UserNotify("FUJITSU", sc->handle, FN_POINTER_ENABLE); 714 715 ACPI_VPRINT(sc->dev, acpi_sc, "Internal pointer is now %s\n", 716 (sc->bIntPtrEnabled) ? "enabled" : "disabled"); 717 } 718 } 719 720 /* Screen Brightness Level P8XXX */ 721 if(sc->gbls.exists) { 722 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 723 sc->gbls.name, &(sc->gbls.value)))) { 724 device_printf(sc->dev, "Couldn't query P8XXX brightness level\n"); 725 return (FALSE); 726 } 727 if (changed & BRIGHT_CHANGED) { 728 /* No state to record here. */ 729 730 /* Clear the modification bit */ 731 sc->gbls.value &= BRIGHTNESS_SETTING_BITS; 732 733 /* Set the value in case it is not hardware controlled */ 734 acpi_fujitsu_method_set(sc, METHOD_GBLS, sc->gbls.value); 735 736 acpi_UserNotify("FUJITSU", sc->handle, FN_LCD_BRIGHTNESS); 737 738 ACPI_VPRINT(sc->dev, acpi_sc, "P8XXX Brightness level is now %d\n", 739 sc->gbls.value); 740 } 741 } 742 743 /* Screen Brightness Level */ 744 if(sc->gbll.exists) { 745 if (ACPI_FAILURE(acpi_GetInteger(sc->handle, 746 sc->gbll.name, &(sc->gbll.value)))) { 747 device_printf(sc->dev, "Couldn't query brightness level\n"); 748 return (FALSE); 749 } 750 751 if (changed & BRIGHT_CHANGED) { 752 /* No state to record here. */ 753 754 /* Clear the modification bit */ 755 sc->gbll.value &= BRIGHTNESS_SETTING_BITS; 756 757 acpi_UserNotify("FUJITSU", sc->handle, FN_LCD_BRIGHTNESS); 758 759 ACPI_VPRINT(sc->dev, acpi_sc, "Brightness level is now %d\n", 760 sc->gbll.value); 761 } 762 } 763 764 sc->lastValChanged = changed; 765 return (TRUE); 766 } 767