static void acpi_button_notify_sleep(void *arg) { struct acpi_button_softc *sc; struct acpi_softc *acpi_sc; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); sc = (struct acpi_button_softc *)arg; acpi_sc = acpi_device_get_parent_softc(sc->button_dev); if (acpi_sc == NULL) return_VOID; acpi_UserNotify("Button", sc->button_handle, sc->button_type); switch (sc->button_type) { case ACPI_POWER_BUTTON: ACPI_VPRINT(sc->button_dev, acpi_sc, "power button pressed\n"); acpi_event_power_button_sleep(acpi_sc); break; case ACPI_SLEEP_BUTTON: ACPI_VPRINT(sc->button_dev, acpi_sc, "sleep button pressed\n"); acpi_event_sleep_button_sleep(acpi_sc); break; default: break; /* unknown button type */ } }
static void acpi_panasonic_hkey_action(struct acpi_panasonic_softc *sc, ACPI_HANDLE h, UINT32 key) { struct acpi_softc *acpi_sc; int arg, max, min; acpi_sc = acpi_device_get_parent_softc(sc->dev); ACPI_SERIAL_ASSERT(panasonic); switch (key) { case 1: /* Decrease LCD brightness. */ hkey_lcd_brightness_max(h, HKEY_GET, &max); hkey_lcd_brightness_min(h, HKEY_GET, &min); hkey_lcd_brightness(h, HKEY_GET, &arg); arg -= max / HKEY_LCD_BRIGHTNESS_DIV; if (arg < min) arg = min; else if (arg > max) arg = max; hkey_lcd_brightness(h, HKEY_SET, &arg); break; case 2: /* Increase LCD brightness. */ hkey_lcd_brightness_max(h, HKEY_GET, &max); hkey_lcd_brightness_min(h, HKEY_GET, &min); hkey_lcd_brightness(h, HKEY_GET, &arg); arg += max / HKEY_LCD_BRIGHTNESS_DIV; if (arg < min) arg = min; else if (arg > max) arg = max; hkey_lcd_brightness(h, HKEY_SET, &arg); break; case 4: /* Toggle sound mute. */ hkey_sound_mute(h, HKEY_GET, &arg); if (arg) arg = 0; else arg = 1; hkey_sound_mute(h, HKEY_SET, &arg); break; case 7: /* Suspend. */ acpi_event_sleep_button_sleep(acpi_sc); break; } }