Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Mar 2011 18:10:37 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r219514 - stable/7/sys/dev/acpi_support
Message-ID:  <201103111810.p2BIAbJJ088742@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: avg
Date: Fri Mar 11 18:10:37 2011
New Revision: 219514
URL: http://svn.freebsd.org/changeset/base/219514

Log:
  MFC r216376: acpi_fujitsu: update for P8010
  
  PR:		kern/121102

Modified:
  stable/7/sys/dev/acpi_support/acpi_fujitsu.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/acpi_support/acpi_fujitsu.c
==============================================================================
--- stable/7/sys/dev/acpi_support/acpi_fujitsu.c	Fri Mar 11 18:07:49 2011	(r219513)
+++ stable/7/sys/dev/acpi_support/acpi_fujitsu.c	Fri Mar 11 18:10:37 2011	(r219514)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2002 Sean Bullington <seanATstalker.org>
- *               2003-2006 Anish Mistry <amistry@am-productions.biz>
+ *               2003-2008 Anish Mistry <amistry@am-productions.biz>
  *               2004 Mark Santcroos <marks@ripe.net>
  * All Rights Reserved.
  *
@@ -84,6 +84,7 @@ ACPI_MODULE_NAME("Fujitsu")
 #define METHOD_RVOL	6
 #define METHOD_GSIF	7
 #define METHOD_GHKS	8
+#define METHOD_GBLS	9
 
 /* Notify event */
 #define	ACPI_NOTIFY_STATUS_CHANGED	0x80
@@ -108,6 +109,7 @@ struct acpi_fujitsu_softc {
 	/* Control methods */
 	struct int_nameval	_sta,	/* unused */
 				gbll,	/* brightness */
+				gbls,	/* get brightness state */
 				ghks,	/* hotkey selector */
 				gbuf,	/* unused (buffer?) */
 				gmou,	/* mouse */
@@ -189,6 +191,11 @@ static struct {
 		.description	= "Brightness level of the LCD panel"
 	},
 	{
+		.name		= "lcd_brightness",
+		.method		= METHOD_GBLS,
+		.description	= "Brightness level of the LCD panel"
+	},
+	{
 		.name		= "volume",
 		.method		= METHOD_GVOL,
 		.description	= "Speakers/headphones volume level"
@@ -358,6 +365,7 @@ acpi_fujitsu_init(struct acpi_fujitsu_so
 	/* Setup all of the names for each control method */
 	sc->_sta.name = "_STA";
 	sc->gbll.name = "GBLL";
+	sc->gbls.name = "GBLS";
 	sc->ghks.name = "GHKS";
 	sc->gmou.name = "GMOU";
 	sc->gsif.name = "GSIF";
@@ -386,6 +394,9 @@ acpi_fujitsu_init(struct acpi_fujitsu_so
 			case METHOD_GBLL:
 				exists = sc->gbll.exists;
 				break;
+			case METHOD_GBLS:
+				exists = sc->gbls.exists;
+				break;
 			case METHOD_GVOL:
 			case METHOD_MUTE:
 				exists = sc->gvol.exists;
@@ -462,6 +473,9 @@ acpi_fujitsu_method_get(struct acpi_fuji
 		case METHOD_GBLL:
 			nv = sc->gbll;
 			break;
+		case METHOD_GBLS:
+			nv = sc->gbls;
+			break;
 		case METHOD_GMOU:
 			nv = sc->gmou;
 			break;
@@ -519,6 +533,11 @@ acpi_fujitsu_method_set(struct acpi_fuji
 			control = "SBLL";
 			nv = sc->gbll;
 			break;
+		case METHOD_GBLS:
+			changed = BRIGHT_CHANGED;
+			control = "SBL2";
+			nv = sc->gbls;
+			break;
 		case METHOD_GMOU:
 			changed = MOUSE_CHANGED;
 			control = "SMOU";
@@ -587,6 +606,14 @@ acpi_fujitsu_check_hardware(struct acpi_
 	}
 
 	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
+		sc->gbls.name, &val))) {
+		sc->gbls.exists = 0;
+	} else {
+		sc->gbls.exists = 1;
+	}
+
+	// don't add if we can use the new method
+	if (sc->gbls.exists || ACPI_FAILURE(acpi_GetInteger(sc->handle,
 	    sc->gbll.name, &val))) {
 		sc->gbll.exists = 0;
 	} else {
@@ -683,6 +710,9 @@ acpi_fujitsu_update(struct acpi_fujitsu_
 			/* Clear the modification bit */
 			sc->gmou.value &= MOUSE_SETTING_BITS;
 			
+			/* Set the value in case it is not hardware controlled */
+                        acpi_fujitsu_method_set(sc, METHOD_GMOU, sc->gmou.value);
+
 			acpi_UserNotify("FUJITSU", sc->handle, FN_POINTER_ENABLE);
 	
 			ACPI_VPRINT(sc->dev, acpi_sc, "Internal pointer is now %s\n",
@@ -690,6 +720,29 @@ acpi_fujitsu_update(struct acpi_fujitsu_
 		}
 	}
 
+	/* Screen Brightness Level P8XXX */
+	if(sc->gbls.exists) {
+		if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
+                sc->gbls.name, &(sc->gbls.value)))) {
+                        device_printf(sc->dev, "Couldn't query P8XXX brightness level\n");
+                        return (FALSE);
+                }
+		if (changed & BRIGHT_CHANGED) {
+			/* No state to record here. */
+
+			/* Clear the modification bit */
+			sc->gbls.value &= BRIGHTNESS_SETTING_BITS;
+
+			/* Set the value in case it is not hardware controlled */
+			acpi_fujitsu_method_set(sc, METHOD_GBLS, sc->gbls.value);
+
+			acpi_UserNotify("FUJITSU", sc->handle, FN_LCD_BRIGHTNESS);
+
+			ACPI_VPRINT(sc->dev, acpi_sc, "P8XXX Brightness level is now %d\n",
+			sc->gbls.value);
+                }
+	}
+
 	/* Screen Brightness Level */
 	if(sc->gbll.exists) {
 		if (ACPI_FAILURE(acpi_GetInteger(sc->handle,



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