linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RE: [PATCH] [RESEND] Add Dell laptop backlight brightness display
@ 2006-02-07  3:43 Michael E Brown
  2006-02-07  4:09 ` Matthew Garrett
  0 siblings, 1 reply; 18+ messages in thread
From: Michael E Brown @ 2006-02-07  3:43 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: Andrew Morton, matt_domsch, linux-kernel

Matthew, Andrew,
	(sorry, I'm not subscribed to l-k, so I'm just starting a new thread.)

	I would _strongly_ suggest that this patch _not_ go in. This driver
uses hardcoded values that are subject to change without notice. It is
perfectly legitimate for future versions of Dell BIOS to interpret pokes
to cmos location 0x99 as the command to format your hard drive.

	The proper way to do this is using libsmbios. The project page is at
http://linux.dell.com/libsmbios/main.  Using libsmbios, plus the
already-included dcdbas kernel driver, you can correctly do brightness
control. If you would like to write a proper brightness control, it can
be done entirely in user space, and I could help you.

	There are specific smbios structures, proprietary to Dell, that are
documented in libsmbios. These structures, properly decoded, tell the
proper port to use to control this. This is guaranteed to work across
BIOS versions and not to format your hard drive. :-)

	Libsmbios is 100% open source (dual GPL/OSL license).

--
Michael Brown
Libsmbios maintainer


^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: [PATCH] [RESEND] Add Dell laptop backlight brightness display
@ 2006-02-20 16:45 Michael_E_Brown
  2006-02-20 16:53 ` Pavel Machek
  0 siblings, 1 reply; 18+ messages in thread
From: Michael_E_Brown @ 2006-02-20 16:45 UTC (permalink / raw)
  To: pavel; +Cc: mjg59, akpm, Matt_Domsch, linux-kernel

Pavel,
	Matthew has shown up on the libsmbios-devel mailing list. I sent
all the
info needed to do a test of Dell LCD brightness control. The main thing
left
would be to make one utility out of the current separate, unsupported,
test 
utils. 

	As for fixing i8k, I don't have the slightest clue where to
begin. You 
either have to split initialization with userspace to parse and send in
the 
correct io/magic ports to do SMI, or you have to put Dell-specific SMI
token 
parsing in the kernel.

	If somebody wants to discuss the design, I can definetly
discuss. I 
even have a _very_ rough mockup of userspace code to do this. Did not
take
it further because I don't know enough about lmsensors or how to fix
i8k.
--
Michael

PS> sorry for top-posting, my non-broken email client at home for some
reason 
could not see your msg, so I could not reply from there.

-----Original Message-----
From: Pavel Machek [mailto:pavel@ucw.cz] 
Sent: Sunday, February 12, 2006 11:26 AM
To: Brown, Michael E
Cc: mjg59@srcf.ucam.org; akpm@osdl.org; Domsch, Matt;
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [RESEND] Add Dell laptop backlight brightness
display

Hi!

> You can get and set laptop brighness on Dell with the proper SMI call.
> 
> To do the proper SMI call requires parsing SMBIOS structure 0xDA, a 
> vendor-proprietary structure, and getting the SMI index and io port 
> and magic values. Then, you need to know how to setup the registers 
> and input/output buffers for the call. All of this is already present 
> in libsmbios.

Perhaps authors of libsmbios could help here?

> Reading nvram is not a valid way to get brighness unless you also do 
> similar work (parse specific vendor-proprietary SMBIOS structures) to 
> ensure that you are reading the correct location. This location is 
> subject to change from BIOS to BIOS and machine to machine. The fact 
> that you may have observed it in the same location on a few laptops 
> does not change this fact.

Well, folks reverse-engineering your machines had no idea until now...

> In fact, I have the same objection to the I8K driver in the kernel. It

> has hardcoded SMI calls, that are subject to change. There is a proper

> way to get the correct IO ports to make this safe, but it is not 
> currently being done.

Could you or someone at Dell submit patches to correct this?
-- 
64 bytes from 195.113.31.123: icmp_seq=28 ttl=51 time=448769.1 ms

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: [PATCH] [RESEND] Add Dell laptop backlight brightness display
@ 2006-02-07 17:23 Michael_E_Brown
  0 siblings, 0 replies; 18+ messages in thread
From: Michael_E_Brown @ 2006-02-07 17:23 UTC (permalink / raw)
  To: mjg59; +Cc: akpm, Matt_Domsch, linux-kernel

Yes, the list of things to do is called the token table. I am working on
getting permission to release it. As it is, I am releasing tokens as
people ask for them, on a case by case basis.

I, personally, do not build or design our laptops, nor do I have any
sway with those that do. Crying about it isn't going to help, sorry.

If you would care to move the discussion to libsmbios-devel, I would be
more than happy to help you get the token you need and write a
util/lib/whatever to do what you need.
--
Michael 

-----Original Message-----
From: Matthew Garrett [mailto:mjg59@srcf.ucam.org] 
Sent: Tuesday, February 07, 2006 11:20 AM
To: Brown, Michael E
Cc: akpm@osdl.org; Domsch, Matt; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [RESEND] Add Dell laptop backlight brightness
display

On Tue, Feb 07, 2006 at 10:34:31AM -0600, Michael_E_Brown@Dell.com
wrote:
> You can get and set laptop brighness on Dell with the proper SMI call.

Oh, heavens. Could you people (and here I include pretty much everyone
who manufactures laptops) please (please!) just implement the ACPI video
extension? We're going to end up having to ship a 200K library for each
and every laptop manufacturer who's decided to implement basic
functionality in a proprietary manner, and it's going to make me cry.

(Which SMI do I need for brightness control? The libsmbios docs seem to
be remarkably quiet on what functionality is actually available, and I'm
not keen on calling things randomly :))

--
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 18+ messages in thread
* RE: [PATCH] [RESEND] Add Dell laptop backlight brightness display
@ 2006-02-07 16:34 Michael_E_Brown
  2006-02-07 17:20 ` Matthew Garrett
  2006-02-12 17:26 ` Pavel Machek
  0 siblings, 2 replies; 18+ messages in thread
From: Michael_E_Brown @ 2006-02-07 16:34 UTC (permalink / raw)
  To: mjg59; +Cc: akpm, Matt_Domsch, linux-kernel

You can get and set laptop brighness on Dell with the proper SMI call.

To do the proper SMI call requires parsing SMBIOS structure 0xDA, a
vendor-proprietary structure, and getting the SMI index and io port and
magic values. Then, you need to know how to setup the registers and
input/output buffers for the call. All of this is already present in
libsmbios.

Reading nvram is not a valid way to get brighness unless you also do
similar work (parse specific vendor-proprietary SMBIOS structures) to
ensure that you are reading the correct location. This location is
subject to change from BIOS to BIOS and machine to machine. The fact
that you may have observed it in the same location on a few laptops does
not change this fact.

In fact, I have the same objection to the I8K driver in the kernel. It
has hardcoded SMI calls, that are subject to change. There is a proper
way to get the correct IO ports to make this safe, but it is not
currently being done.
--
Michael

-----Original Message-----
From: Matthew Garrett [mailto:mjg59@srcf.ucam.org] 
Sent: Monday, February 06, 2006 10:10 PM
To: Brown, Michael E
Cc: Andrew Morton; Domsch, Matt; linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [RESEND] Add Dell laptop backlight brightness
display

On Mon, Feb 06, 2006 at 09:43:16PM -0600, Michael E Brown wrote:

> 	I would _strongly_ suggest that this patch _not_ go in. This
driver 
> uses hardcoded values that are subject to change without notice. It is

> perfectly legitimate for future versions of Dell BIOS to interpret 
> pokes to cmos location 0x99 as the command to format your hard drive.

I managed to send the wrong patch - the Dell one only reads from nvram. 
If nvram reads are likely to reformat your hard drive, I think Dell
needs to reconsider its BIOS design :)

More seriously, a quick scan of libsmbios hasn't revealed any method for
obtaining the screen brightness. It's possible that I'm blind (I'm
certainly slightly drunk), but can you give a pointer to the correct
mechanism for making this call?

Thanks,
--
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply	[flat|nested] 18+ messages in thread
* [PATCH] Make DMI code store chassis type
@ 2006-02-06 19:15 Matthew Garrett
  2006-02-06 19:18 ` [PATCH] Add HP laptop backlight brightness display Matthew Garrett
  0 siblings, 1 reply; 18+ messages in thread
From: Matthew Garrett @ 2006-02-06 19:15 UTC (permalink / raw)
  To: linux-kernel

The previous patch had a typo, so here's a fixed one. This patch stores 
the chassis type of the hardware, making it easier to determine whether 
a piece of hardware from a manufacturer is a laptop. This information is 
not 100% reliable - some vendors insert bogus values, but most of the 
big ones are fairly accurate.

Signed-Off-By: Matthew Garrett <mjg59@srcf.ucam.org>

diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c
index 58516e2..e555588 100644
--- a/arch/i386/kernel/dmi_scan.c
+++ b/arch/i386/kernel/dmi_scan.c
@@ -30,6 +30,50 @@ static char * __init dmi_string(struct d
 	return str;
 }
 
+static char * __init dmi_chassis_type(struct dmi_header *dm, u8 s)
+{
+	char *str = "";
+	static const char *type[]={
+                "Other", /* 0x01 */
+                "Unknown",
+                "Desktop",
+                "Low Profile Desktop",
+                "Pizza Box",
+                "Mini Tower",
+                "Tower",
+                "Portable",
+                "Laptop",
+                "Notebook",
+                "Hand Held",
+                "Docking Station",
+                "All In One",
+                "Sub Notebook",
+                "Space-saving",
+                "Lunch Box",
+                "Main Server Chassis", /* master.mif says System */
+                "Expansion Chassis",
+                "Sub Chassis",
+                "Bus Expansion Chassis",
+                "Peripheral Chassis",
+                "RAID Chassis",
+                "Rack Mount Chassis",
+                "Sealed-case PC",
+                "Multi-system" /* 0x19 */
+        };
+
+        if(s>=0x01 && s<=0x19) {
+		str = alloc_bootmem(strlen(type[code-0x01]));
+		if (str != NULL)
+			strcpy(str, type[code-0x01]);
+		else
+			printk(KERN_ERR "dmi_chassis_type: out of memory.\n");
+
+                return str;
+	}
+
+	return NULL;
+}
+
 /*
  *	We have to be cautious here. We have seen BIOSes with DMI pointers
  *	pointing to completely the wrong place for example
@@ -93,7 +137,11 @@ static void __init dmi_save_ident(struct
 	if (dmi_ident[slot])
 		return;
 
-	p = dmi_string(dm, d[string]);
+	if (slot == DMI_CHASSIS_TYPE)
+		p = dmi_chassis_type(string & 0x7f);
+	else
+		p = dmi_string(dm, d[string]);
+
 	if (p == NULL)
 		return;
 
@@ -176,6 +224,11 @@ static void __init dmi_decode(struct dmi
 		dmi_save_ident(dm, DMI_BOARD_NAME, 5);
 		dmi_save_ident(dm, DMI_BOARD_VERSION, 6);
 		break;
+	case 3:         /* Chassis Information */
+		dmi_save_ident(dm, DMI_CHASSIS_VENDOR, 4);
+		dmi_save_ident(dm, DMI_CHASSIS_TYPE, 5);
+		break;
+		
 	case 10:	/* Onboard Devices Information */
 		dmi_save_devices(dm);
 		break;
diff --git a/include/linux/dmi.h b/include/linux/dmi.h
index 05f4132..5f425a7 100644
--- a/include/linux/dmi.h
+++ b/include/linux/dmi.h
@@ -15,6 +15,8 @@ enum dmi_field {
 	DMI_BOARD_VENDOR,
 	DMI_BOARD_NAME,
 	DMI_BOARD_VERSION,
+	DMI_CHASSIS_VENDOR,
+	DMI_CHASSIS_TYPE,
 	DMI_STRING_MAX,
 };
 

-- 
Matthew Garrett | mjg59@srcf.ucam.org

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2006-02-23  5:18 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-02-07  3:43 [PATCH] [RESEND] Add Dell laptop backlight brightness display Michael E Brown
2006-02-07  4:09 ` Matthew Garrett
  -- strict thread matches above, loose matches on Subject: below --
2006-02-20 16:45 Michael_E_Brown
2006-02-20 16:53 ` Pavel Machek
2006-02-23  5:17   ` Michael E Brown
2006-02-07 17:23 Michael_E_Brown
2006-02-07 16:34 Michael_E_Brown
2006-02-07 17:20 ` Matthew Garrett
2006-02-12 17:26 ` Pavel Machek
2006-02-06 19:15 [PATCH] Make DMI code store chassis type Matthew Garrett
2006-02-06 19:18 ` [PATCH] Add HP laptop backlight brightness display Matthew Garrett
2006-02-06 19:19   ` [PATCH] Add Dell " Matthew Garrett
2006-02-07  0:37     ` [PATCH] [RESEND] " Matthew Garrett
2006-02-07  3:37       ` Dmitry Torokhov
2006-02-07 12:32         ` Matthew Garrett
2006-02-07 13:06           ` Richard Purdie
2006-02-07 13:23             ` Matthew Garrett
2006-02-07 13:37               ` Richard Purdie
2006-02-07 13:55                 ` Matthew Garrett
2006-02-07 14:54                   ` Richard Purdie
2006-02-08  9:06                   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).