(Missing) power states of an Atom N455-based netbook

Vitaly Magerya vmagerya at gmail.com
Tue Jul 5 21:49:20 UTC 2011

Andriy Gapon <avg at freebsd.org> wrote:
>> I don't have acpi_video loaded (it's not loaded by default). If I
>> do load it, VDRV indeed becomes 1 (brightness controls that acpi_video
>> exposes don't work though; this appears to be a known problem with
>> Samsung laptops).
> This might warrant a separate investigation and a PR if we don't have one already.
> Not sure if I could be of help with it, though.

>From what I heard this isn't a problem with FreeBSD ACPI code, it's
a problem with Samsung firmware. AFAIK to get brightness controls
working on Windows you need to setup Samsung software that uses
undocument BIOS interface for it's function.

Linux has what appears to be a reverse-engineered driver [1] that
does the same. Someone (probably me) needs to port it.

> Possible courses of action:
> 1. Do nothing and leave you with your workaround.
> 2. Provide intel_idle-like driver for FreeBSD.  I don't like this approach for
> reasons I've stated before.
> 3. Try to make FreeBSD smarter with respect to dynamically changing C-states.  I
> think it would be useful if we received a devd notifications about C-state
> reconfiguration.  Then we could execute /etc/rc.d/power_profile to account for the
> new configuration.

This would be the most useful option.

Here's what I tried (trivial diff, sending inline):

--- acpi_cpu.c.orig     2011-07-05 19:50:31.000000000 +0000
+++ acpi_cpu.c  2011-07-05 21:44:56.000000000 +0000
@@ -988,12 +988,13 @@
     struct acpi_cpu_softc *sc = (struct acpi_cpu_softc *)context;
     struct acpi_cpu_softc *isc;
-    int i;
+    int prev_cx_count, i;

     if (notify != ACPI_NOTIFY_CX_STATES)

     /* Update the list of Cx states. */
+    prev_cx_count = sc->cpu_cx_count;

@@ -1008,6 +1009,8 @@
     if (sc->cpu_cx_lowest < cpu_cx_lowest)
        acpi_cpu_set_cx_lowest(sc, min(cpu_cx_lowest, sc->cpu_cx_count - 1));
+    if (prev_cx_count != sc->cpu_cx_count)
+       acpi_UserNotify("CPU_CX", h, sc->cpu_cx_count);

 static int
--- devd.conf.orig      2011-07-05 20:19:30.000000000 +0000
+++ devd.conf   2011-07-05 20:30:08.000000000 +0000
@@ -209,6 +209,13 @@
        action "/etc/rc.d/power_profile $notify";

+# Update power profile when available CPU Cx states are updated.
+notify 10 {
+       match "system"          "ACPI";
+       match "subsystem"       "CPU_CX";
+       action "/etc/rc.d/power_profile 0x0`sysctl -n hw.acpi.acline`";
 # Notify all users before beginning emergency shutdown when we get
 # a _CRT or _HOT thermal event and we're going to power down the system
 # very soon.

This generally works, except that power_profile is executed multiple
times (the event is generated once per core, and when it is triggered
by plugging the power cord, ACPI ACAD is reported at the same time
thus resulting in one more power_profile execution).

[1] http://lxr.linux.no/#/drivers/platform/x86/samsung-laptop.c

More information about the freebsd-acpi mailing list