svn commit: r216376 - head/sys/dev/acpi_support

Andriy Gapon avg at FreeBSD.org
Sat Dec 11 10:55:19 UTC 2010


Author: avg
Date: Sat Dec 11 10:55:18 2010
New Revision: 216376
URL: http://svn.freebsd.org/changeset/base/216376

Log:
  acpi_fujitsu: update for P8010
  
  PR:		kern/121102
  Submitted by:	Anish Mistry <amistry at am-productions.biz>
  MFC after:	3 weeks

Modified:
  head/sys/dev/acpi_support/acpi_fujitsu.c

Modified: head/sys/dev/acpi_support/acpi_fujitsu.c
==============================================================================
--- head/sys/dev/acpi_support/acpi_fujitsu.c	Sat Dec 11 10:21:38 2010	(r216375)
+++ head/sys/dev/acpi_support/acpi_fujitsu.c	Sat Dec 11 10:55:18 2010	(r216376)
@@ -1,6 +1,6 @@
 /*-
  * Copyright (c) 2002 Sean Bullington <seanATstalker.org>
- *               2003-2006 Anish Mistry <amistry at am-productions.biz>
+ *               2003-2008 Anish Mistry <amistry at am-productions.biz>
  *               2004 Mark Santcroos <marks at ripe.net>
  * All Rights Reserved.
  *
@@ -86,6 +86,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
@@ -110,6 +111,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 */
@@ -191,6 +193,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"
@@ -360,6 +367,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";
@@ -387,6 +395,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;
@@ -463,6 +474,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;
@@ -520,6 +534,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";
@@ -585,6 +604,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 {
@@ -681,6 +708,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",
@@ -688,6 +718,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,


More information about the svn-src-head mailing list