From owner-freebsd-acpi@FreeBSD.ORG Tue Jul 5 21:49:20 2011 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5298D106566C; Tue, 5 Jul 2011 21:49:20 +0000 (UTC) (envelope-from vmagerya@gmail.com) Received: from mail-vx0-f182.google.com (mail-vx0-f182.google.com [209.85.220.182]) by mx1.freebsd.org (Postfix) with ESMTP id E5C478FC0A; Tue, 5 Jul 2011 21:49:19 +0000 (UTC) Received: by vxg33 with SMTP id 33so6207045vxg.13 for ; Tue, 05 Jul 2011 14:49:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=VXAo4sG/7dqv0ybKRnaWTtpU8/B+hOmgCKK3wHpKWVI=; b=ZqxOQoPwZIVyp7MJ7prJNX5o0q7bQ9+R6KF5FbCqQPYdklDba+LjeL+6TQRVNf1QSZ xbOHU4UU1DNgyOFIqmPpCBAOEaZiIe0Y3v7fMw5ZfsGAVaYEw80RS2rNcaVMq1k3gXWb cP9AJgemcCnDGNhoeMfqqOsnppRjnjmorOEbg= MIME-Version: 1.0 Received: by 10.52.110.133 with SMTP id ia5mr1027478vdb.239.1309902558090; Tue, 05 Jul 2011 14:49:18 -0700 (PDT) Received: by 10.52.108.226 with HTTP; Tue, 5 Jul 2011 14:49:18 -0700 (PDT) In-Reply-To: <4E130154.9080809@FreeBSD.org> References: <4E05EB91.9090509@FreeBSD.org> <4E0862A0.7060405@FreeBSD.org> <4E09BADF.7050702@FreeBSD.org> <4E0A41C8.3000904@FreeBSD.org> <4E0CE158.6030804@FreeBSD.org> <4E0DB58F.4070906@FreeBSD.org> <4E130154.9080809@FreeBSD.org> Date: Wed, 6 Jul 2011 00:49:18 +0300 Message-ID: From: Vitaly Magerya To: Andriy Gapon Content-Type: text/plain; charset=UTF-8 Cc: freebsd-acpi@freebsd.org Subject: Re: (Missing) power states of an Atom N455-based netbook X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Jul 2011 21:49:20 -0000 Andriy Gapon 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) return; /* Update the list of Cx states. */ + prev_cx_count = sc->cpu_cx_count; acpi_cpu_cx_cst(sc); acpi_cpu_cx_list(sc); @@ -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)); ACPI_SERIAL_END(cpu); + 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