summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/acpica/acpi_acad.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sys/dev/acpica/acpi_acad.c b/sys/dev/acpica/acpi_acad.c
index 413a558..02da0e8 100644
--- a/sys/dev/acpica/acpi_acad.c
+++ b/sys/dev/acpica/acpi_acad.c
@@ -66,6 +66,7 @@ static int acpi_acad_attach(device_t);
static int acpi_acad_ioctl(u_long, caddr_t, void *);
static int acpi_acad_sysctl(SYSCTL_HANDLER_ARGS);
static void acpi_acad_init_acline(void *arg);
+static void acpi_acad_ac_only(void *arg);
static device_method_t acpi_acad_methods[] = {
/* Device interface */
@@ -87,6 +88,8 @@ MODULE_DEPEND(acpi_acad, acpi, 1, 1, 1);
ACPI_SERIAL_DECL(acad, "ACPI AC adapter");
+SYSINIT(acad, SI_SUB_KTHREAD_IDLE, SI_ORDER_FIRST, acpi_acad_ac_only, NULL);
+
static void
acpi_acad_get_status(void *context)
{
@@ -245,6 +248,21 @@ acpi_acad_init_acline(void *arg)
}
/*
+ * If no AC line devices detected after boot, create an "online" event
+ * so that userland code can adjust power settings accordingly. The default
+ * power profile is "performance" so we don't need to repeat that here.
+ */
+static void
+acpi_acad_ac_only(void __unused *arg)
+{
+
+ if (devclass_get_count(acpi_acad_devclass) > 0)
+ return;
+
+ acpi_UserNotify("ACAD", ACPI_ROOT_OBJECT, 1);
+}
+
+/*
* Public interfaces.
*/
int
OpenPOWER on IntegriCloud