Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 17 Jun 2012 16:19:09 +0000 (UTC)
From:      Mitsuru IWASAKI <iwasaki@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r237197 - head/sys/dev/acpica
Message-ID:  <201206171619.q5HGJ94j017230@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: iwasaki
Date: Sun Jun 17 16:19:09 2012
New Revision: 237197
URL: http://svn.freebsd.org/changeset/base/237197

Log:
  Resotre LCD brightness level on resuming.
  
  MFC after:	3 days

Modified:
  head/sys/dev/acpica/acpi_video.c

Modified: head/sys/dev/acpica/acpi_video.c
==============================================================================
--- head/sys/dev/acpica/acpi_video.c	Sun Jun 17 13:48:39 2012	(r237196)
+++ head/sys/dev/acpica/acpi_video.c	Sun Jun 17 16:19:09 2012	(r237197)
@@ -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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201206171619.q5HGJ94j017230>