summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_acad.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-10-24 05:34:21 +0000
committernjl <njl@FreeBSD.org>2005-10-24 05:34:21 +0000
commit2c9bd35a9a61d98e1936a24f0c9fc4cff5c47134 (patch)
tree00ecad58b8d6eb0270a31cd3f12f567d633a48e5 /sys/dev/acpica/acpi_acad.c
parent841a0c67c5562508c556920b582f92644d896306 (diff)
downloadFreeBSD-src-2c9bd35a9a61d98e1936a24f0c9fc4cff5c47134.zip
FreeBSD-src-2c9bd35a9a61d98e1936a24f0c9fc4cff5c47134.tar.gz
If no AC line devices are found, go ahead and notify devd that the system
is on AC power (i.e. not a laptop). This allows power_profile to run once for desktop systems as well, for instance, to set C3 or CPU frequency. MFC after: 2 weeks
Diffstat (limited to 'sys/dev/acpica/acpi_acad.c')
-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