mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-11-07 04:36:52 -10:00
acpi_lid: add an in-kernel lid state eventhandler
Lid state changes are only published to userland, via devd and evdev. Drivers that need to react to the lid in the kernel have no hook, so they end up installing a second ACPI_DEVICE_NOTIFY handler on the same lid object and reimplementing the _LID evaluation. Add acpi_lid_event, invoked from acpi_lid_status_update() alongside the existing devd notification, carrying the new state (1 open, 0 closed). Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D60704
This commit is contained in:
1 parent
3943973aae
commit
030e556ff8
2 files changed
+8
No files matched your search
@@ -117,6 +117,9 @@ acpi_lid_status_update(struct acpi_lid_softc *sc)
|
||||
/* Send notification via devd */
|
||||
acpi_UserNotify("Lid", sc->lid_handle, sc->lid_status);
|
||||
|
||||
/* Notify in-kernel consumers */
|
||||
EVENTHANDLER_INVOKE(acpi_lid_event, sc->lid_status);
|
||||
|
||||
#ifdef EVDEV_SUPPORT
|
||||
/* Notify evdev about lid status */
|
||||
evdev_push_sw(sc->lid_evdev, SW_LID, lid_status ? 0 : 1);
|
||||
|
||||
@@ -456,6 +456,11 @@ EVENTHANDLER_DECLARE(acpi_video_event, acpi_event_handler_t);
|
||||
EVENTHANDLER_DECLARE(acpi_post_dev_suspend, acpi_event_handler_t);
|
||||
EVENTHANDLER_DECLARE(acpi_pre_dev_resume, acpi_event_handler_t);
|
||||
|
||||
/* Lid state changes. The int argument is 1 for open, 0 for closed. */
|
||||
typedef void (*acpi_lid_event_handler_t)(void *, int);
|
||||
|
||||
EVENTHANDLER_DECLARE(acpi_lid_event, acpi_lid_event_handler_t);
|
||||
|
||||
void acpi_invoke_sleep_eventhandler(const enum power_stype *stype);
|
||||
void acpi_invoke_wake_eventhandler(const enum power_stype *stype);
|
||||
|
||||
|
||||
Reference in new issue
Block a user