From owner-svn-src-all@FreeBSD.ORG Thu Jun 21 16:48:57 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F593106564A; Thu, 21 Jun 2012 16:48:57 +0000 (UTC) (envelope-from iwasaki@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 2002E8FC08; Thu, 21 Jun 2012 16:48:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q5LGmukC024850; Thu, 21 Jun 2012 16:48:56 GMT (envelope-from iwasaki@svn.freebsd.org) Received: (from iwasaki@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q5LGmuhg024848; Thu, 21 Jun 2012 16:48:56 GMT (envelope-from iwasaki@svn.freebsd.org) Message-Id: <201206211648.q5LGmuhg024848@svn.freebsd.org> From: Mitsuru IWASAKI Date: Thu, 21 Jun 2012 16:48:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r237405 - stable/9/sys/dev/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Jun 2012 16:48:57 -0000 Author: iwasaki Date: Thu Jun 21 16:48:56 2012 New Revision: 237405 URL: http://svn.freebsd.org/changeset/base/237405 Log: MFC r237197: - Resotre LCD brightness level on resuming. Modified: stable/9/sys/dev/acpica/acpi_video.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/acpica/acpi_video.c ============================================================================== --- stable/9/sys/dev/acpica/acpi_video.c Thu Jun 21 16:37:36 2012 (r237404) +++ stable/9/sys/dev/acpica/acpi_video.c Thu Jun 21 16:48:56 2012 (r237405) @@ -75,6 +75,7 @@ static void acpi_video_identify(driver_t static int acpi_video_probe(device_t); static int acpi_video_attach(device_t); static int acpi_video_detach(device_t); +static int acpi_video_resume(device_t); static int acpi_video_shutdown(device_t); static void acpi_video_notify_handler(ACPI_HANDLE, UINT32, void *); static void acpi_video_power_profile(void *); @@ -155,6 +156,7 @@ static device_method_t acpi_video_method DEVMETHOD(device_probe, acpi_video_probe), DEVMETHOD(device_attach, acpi_video_attach), DEVMETHOD(device_detach, acpi_video_detach), + DEVMETHOD(device_resume, acpi_video_resume), DEVMETHOD(device_shutdown, acpi_video_shutdown), { 0, 0 } }; @@ -305,6 +307,36 @@ acpi_video_detach(device_t dev) } static int +acpi_video_resume(device_t dev) +{ + struct acpi_video_softc *sc; + struct acpi_video_output *vo, *vn; + int level; + + sc = device_get_softc(dev); + + /* Restore brightness level */ + ACPI_SERIAL_BEGIN(video); + ACPI_SERIAL_BEGIN(video_output); + STAILQ_FOREACH_SAFE(vo, &sc->vid_outputs, vo_next, vn) { + if ((vo->adr & DOD_DEVID_MASK_FULL) != DOD_DEVID_LCD && + (vo->adr & DOD_DEVID_MASK) != DOD_DEVID_INTDFP) + continue; + + if ((vo_get_device_status(vo->handle) & DCS_ACTIVE) == 0) + continue; + + level = vo_get_brightness(vo->handle); + if (level != -1) + vo_set_brightness(vo->handle, level); + } + ACPI_SERIAL_END(video_output); + ACPI_SERIAL_END(video); + + return (0); +} + +static int acpi_video_shutdown(device_t dev) { struct acpi_video_softc *sc;