Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Feb 2008 19:42:42 -0500
From:      "Anish Mistry" <amistry@am-productions.biz>
To:        "FreeBSD gnats submit" <FreeBSD-gnats-submit@FreeBSD.org>
Subject:   ports/121102: Update acpi_fujitsu for the P8010
Message-ID:  <1203986562.85295@bigguy.am-productions.biz>
Resent-Message-ID: <200802260040.m1Q0e1fl097886@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         121102
>Category:       ports
>Synopsis:       Update acpi_fujitsu for the P8010
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Feb 26 00:40:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Anish Mistry
>Release:        FreeBSD 7.0-RELEASE amd64
>Organization:
AM Productions 
>Environment:


FreeBSD smallguy.am-productions.biz 7.0-RELEASE FreeBSD 7.0-RELEASE #1: Mon Feb 25 18:43:50 EST 2008     root@smallguy.am-productions.biz:/usr/obj/usr/src/sys/SMALLGUY  amd64


>Description:


acpi_fujitsu only partially works on the P8010.  There are a few issues.
1) The ASL calls out to "External" methods.  I don't know how to hook OS code into that external call.  Consequently whenever the mouse enable/disable or brightness is press ACPI tells us that there is no method.  After looking at the ASL there are Windows version checks and if it can't match a version is falls back to the Windows 2006 settings. ie.  Calls the external method.
2) Since there is compatibility code for Windows XP we'll use that and set our hw.acpi.osname="Windows 2001"
Unfortunately this doesn't work.  The OsdTable patch fixes this problem so that we can actually override the OS name.
3) Now that we can fall back to the "compatibility" mode we can handle the button events.  Add the METHOD_GBLS and associated code to handle the "new" brightness changing method in compatibility mode.

http://am-productions.biz/docs/smallguy.asl

I need some older P Series users to test this out just so it doesn't break anything.

This isn't ready to commit, I just want to get it out there so others can have thier hotkeys working.


>How-To-Repeat:





>Fix:


--- acpi_fujitsu-p8010.patch begins here ---
--- acpi_fujitsu.c.orig	2008-02-25 17:50:02.000000000 -0500
+++ acpi_fujitsu.c	2008-02-25 19:15:04.000000000 -0500
@@ -64,8 +64,9 @@
 #define VOLUME_CHANGED	0x04
 #define MOUSE_CHANGED	0x08
 /*
- * It is unknown which hotkey this bit is supposed to indicate, but
- * according to values from GSIF this is a valid flag.
+ * On the P8010 this indicated a backlight change event when
+ * Running under a Windows OS that is not Windows 2006
+ * We get here by overriding hw.acpi.osname
  */
 #define UNKNOWN_CHANGED	0x10
 
@@ -84,6 +85,7 @@
 #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 +110,7 @@
 	/* Control methods */
 	struct int_nameval	_sta,	/* unused */
 				gbll,	/* brightness */
+				gbls,	/* get brightness state */
 				ghks,	/* hotkey selector */
 				gbuf,	/* unused (buffer?) */
 				gmou,	/* mouse */
@@ -189,6 +192,11 @@
 		.description	= "Brightness level of the LCD panel"
 	},
 	{
+		.name		= "backlight",
+		.method		= METHOD_GBLS,
+		.description	= "P8XXX Backlight State"
+	},
+	{
 		.name		= "volume",
 		.method		= METHOD_GVOL,
 		.description	= "Speakers/headphones volume level"
@@ -358,6 +366,7 @@
 	/* 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 +395,9 @@
 			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 +474,9 @@
 		case METHOD_GBLL:
 			nv = sc->gbll;
 			break;
+		case METHOD_GBLS:
+			nv = sc->gbls;
+			break;
 		case METHOD_GMOU:
 			nv = sc->gmou;
 			break;
@@ -519,6 +534,11 @@
 			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";
@@ -608,6 +628,13 @@
 	}
 
 	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
+		sc->gbls.name, &val))) {
+		sc->gbls.exists = 0;
+	} else {
+		sc->gbls.exists = 1;
+	}
+
+	if (ACPI_FAILURE(acpi_GetInteger(sc->handle,
 	    sc->rbll.name, &val))) {
 		sc->rbll.exists = 0;
 	} else {
@@ -683,6 +710,9 @@
 			/* 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 @@
 		}
 	}
 
+	/* Screen Brightness 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,
--- acpi_fujitsu-p8010.patch ends here ---



>Release-Note:
>Audit-Trail:
>Unformatted:



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