Bug 121102

Summary: [acpi] [patch] update acpi_fujitsu for the P8010
Product: Base System Reporter: amistry
Component: kernAssignee: Andriy Gapon <avg>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 7.0-RELEASE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
acpi_fujitsu-p8010.patch none

Description amistry 2008-02-26 00:40:01 UTC

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.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2008-02-26 11:37:45 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-bugs

Looks more like a kernel issue.
Comment 2 Gavin Atkinson freebsd_committer freebsd_triage 2008-02-26 13:15:59 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-acpi

Over to acpi mailing list
Comment 3 amistry 2008-05-01 03:15:59 UTC
This doesn't need to wait on kern/121504 since it still fixes the 
sysctl toggling not working on the P8010.
-- 
Anish Mistry
amistry@am-productions.biz
AM Productions http://am-productions.biz/
Comment 4 Andriy Gapon freebsd_committer freebsd_triage 2010-12-05 15:08:46 UTC
Anish,
is this patch still needed?
It's been > 2 years since you've updated it and there was no obvious action on
our part, so I'd like to clarify current status.
Thanks!
-- 
Andriy Gapon
Comment 5 amistry 2010-12-05 17:27:44 UTC
On Sunday 05 December 2010 10:08:46 Andriy Gapon wrote:
> Anish,
> is this patch still needed?


Yes.

> It's been > 2 years since you've updated it and there was no obvious
> action on our part, so I'd like to clarify current status.
> Thanks!


-- 
Anish Mistry
Comment 6 dfilter service freebsd_committer freebsd_triage 2010-12-11 10:55:28 UTC
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@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@am-productions.biz>
+ *               2003-2008 Anish Mistry <amistry@am-productions.biz>
  *               2004 Mark Santcroos <marks@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,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 7 Andriy Gapon freebsd_committer freebsd_triage 2010-12-11 10:56:20 UTC
State Changed
From-To: open->patched

Patch applied in head. 


Comment 8 Andriy Gapon freebsd_committer freebsd_triage 2010-12-11 10:56:20 UTC
Responsible Changed
From-To: freebsd-acpi->avg

I am handling this PR.
Comment 9 dfilter service freebsd_committer freebsd_triage 2011-03-11 18:08:08 UTC
Author: avg
Date: Fri Mar 11 18:07:49 2011
New Revision: 219513
URL: http://svn.freebsd.org/changeset/base/219513

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

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

Modified: stable/8/sys/dev/acpi_support/acpi_fujitsu.c
==============================================================================
--- stable/8/sys/dev/acpi_support/acpi_fujitsu.c	Fri Mar 11 17:47:59 2011	(r219512)
+++ stable/8/sys/dev/acpi_support/acpi_fujitsu.c	Fri Mar 11 18:07:49 2011	(r219513)
@@ -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.
  *
@@ -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,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
Comment 10 Andriy Gapon freebsd_committer freebsd_triage 2011-03-11 18:10:45 UTC
State Changed
From-To: patched->closed

The fix has been MFCed.
Comment 11 dfilter service freebsd_committer freebsd_triage 2011-03-11 18:10:51 UTC
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,
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"