acpi(9): Add EVENTHANDLERs for video and AC adapter events.

They are required for coming ACPI support in LinuxKPI.

Reviewed by:	hselasky, manu (as part of D26603)
This commit is contained in:
Vladimir Kondratyev 2020-10-31 20:14:28 +00:00
parent fe64ff3c04
commit ae2b074bbb
3 changed files with 15 additions and 0 deletions

View file

@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
#include <machine/bus.h>
#include <sys/rman.h>
#include <sys/eventhandler.h>
#include <sys/ioccom.h>
#include <sys/malloc.h>
#include <sys/module.h>
@ -115,6 +116,7 @@ acpi_acad_get_status(void *context)
ACPI_VPRINT(dev, acpi_device_get_parent_softc(dev),
"%s Line\n", newstatus ? "On" : "Off");
acpi_UserNotify("ACAD", h, newstatus);
EVENTHANDLER_INVOKE(acpi_acad_event, newstatus);
} else
ACPI_SERIAL_END(acad);
}

View file

@ -350,6 +350,12 @@ acpi_video_shutdown(device_t dev)
return (0);
}
static void
acpi_video_invoke_event_handler(void *context)
{
EVENTHANDLER_INVOKE(acpi_video_event, (int)(intptr_t)context);
}
static void
acpi_video_notify_handler(ACPI_HANDLE handle, UINT32 notify, void *context)
{
@ -402,6 +408,8 @@ acpi_video_notify_handler(ACPI_HANDLE handle, UINT32 notify, void *context)
device_printf(sc->device, "unknown notify event 0x%x\n",
notify);
}
AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_video_invoke_event_handler,
(void *)(uintptr_t)notify);
}
static void
@ -752,6 +760,9 @@ acpi_video_vo_notify_handler(ACPI_HANDLE handle, UINT32 notify, void *context)
out:
ACPI_SERIAL_END(video_output);
AcpiOsExecute(OSL_NOTIFY_HANDLER, acpi_video_invoke_event_handler,
(void *)(uintptr_t)notify);
}
/* ARGSUSED */

View file

@ -433,6 +433,8 @@ typedef void (*acpi_event_handler_t)(void *, int);
EVENTHANDLER_DECLARE(acpi_sleep_event, acpi_event_handler_t);
EVENTHANDLER_DECLARE(acpi_wakeup_event, acpi_event_handler_t);
EVENTHANDLER_DECLARE(acpi_acad_event, acpi_event_handler_t);
EVENTHANDLER_DECLARE(acpi_video_event, acpi_event_handler_t);
/* Device power control. */
ACPI_STATUS acpi_pwr_wake_enable(ACPI_HANDLE consumer, int enable);