Skip to contentSkip to conversation

misc,acpi,backlight: MSI S270 Laptop support, third try

PATCH In review Lennart Poettering 3 participants 3 messages Aug 20, 2006 – Aug 24, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc,acpi,backlight: MSI S270 Laptop support, third try

From: Lennart Poettering <[email protected]>

This is the third version of my MSI S270 Laptop driver. Most things I wrote about the first two versions are still true:

http://marc.theaimsgroup.com/?l=linux-acpi&m=115517193510912&w=2
http://marc.theaimsgroup.com/?l=linux-kernel&m=115522739203174&w=2

Changes from the second version are:

- Added a new DMI entry for a supported laptop model

- Renamed to "msi-laptop.c" (originally s270.c). This driver probably works on more MSI laptops than just the S270. (On request of Thomas Renninger)

- Don't use a static brightness level translation table, instead just multiply/divide by 31 to convert from harware to software brightness levels (On request of Pavel Machek)

- Split up "if" lines (on request of Pavel Machek)

- Fix the maximum brightness level passed to the backlight control subsystem.

Applies to Linus' current GIT tree. (2.6.18pre)

Requires the ec_transaction patch I posted earlier.

Please merge!

I wonder who's the right one to ask for merging, since this driver sits in drivers/misc/. According to MAINTAINERS Alessandro Rubini maintains that directory. However it's somewhat based on the ACPI EC access stuff I posted earlier, hence the APCI tree might be another path to get this merged. Len, Alessandro, which one of you shall I bug to get this driver commited?

Thanks,
Lennart

---
 MAINTAINERS               |    7 +
 drivers/misc/Kconfig      |   19 ++
 drivers/misc/Makefile     |    1 
 drivers/misc/msi-laptop.c |  386 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 413 insertions(+), 0 deletions(-)
MAINTAINERS +7 -0
index 21116cc..6210002 100644
@@ -1949,6 +1949,13 @@ M:	[email protected]
 L:	[email protected]
 S:	Maintained
 
+MSI LAPTOP SUPPORT
+P:	Lennart Poettering
+M:	[email protected]
+L:	https://tango.0pointer.de/mailman/listinfo/s270-linux
+W:	http://0pointer.de/lennart/tchibo.html
+S:	Maintained
+
 MTRR AND SIMILAR SUPPORT [i386]
 P:	Richard Gooch
 M:	[email protected]
drivers/misc/Kconfig +19 -0
index 7fc692a..d25b0db 100644
@@ -28,5 +28,24 @@ config IBM_ASM
 
 	  If unsure, say N.
 
+config MSI_LAPTOP
+        tristate "MSI Laptop Extras"
+        depends on X86
+        depends on ACPI_EC
+        depends on BACKLIGHT_CLASS_DEVICE
+        ---help---
+          This is a driver for laptops built by MSI (MICRO-STAR 
+	  INTERNATIONAL):
+	      
+	      MSI MegaBook S270 (MS-1013)
+	      Cytron/TCM/Medion/Tchibo MD96100/SAM2000
+	   
+	  It adds support for Bluetooth, WLAN and LCD brightness control.
+
+          More information about this driver is available at
+          <http://0pointer.de/lennart/tchibo.html>.
+
+          If you have an MSI S270 laptop, say Y or M here.
+
 endmenu
 
drivers/misc/Makefile +1 -0
index 19c2b85..1328c5f 100644
@@ -5,3 +5,4 @@ obj- := misc.o	# Dummy rule to force bui
 
 obj-$(CONFIG_IBM_ASM)	+= ibmasm/
 obj-$(CONFIG_HDPU_FEATURES)	+= hdpuftrs/
+obj-$(CONFIG_MSI_LAPTOP)     += msi-laptop.o
drivers/misc/msi-laptop.c new file +386 -0

386 lines not on this page · raw message

Signature · 1 line
1.4.1
#1 lore raw

drivers/misc/msi-laptop.c line 247

Quoted 6 lines · On Mon, 21 Aug 2006 00:52:09 +0200 Lennart Poettering <[email protected]>…
drivers/misc/msi-laptop.c new file +6 -0
+static ssize_t store_auto_brightness(
+        struct device *dev,
+        struct device_attribute *attr,
+        const char *buf, size_t count) {
+        
+        int enable, ret;

Please follow the usual kernel coding style, which would yield something like:

static ssize_t store_auto_brightness(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)

{
        int enable, ret;

(affects entire patch).

And please also prepare and maintain a standalone changelog. The one you have here is full of references to some long-gone email. Think: "how will my changelog look when it is in the main git tree".

Thanks.

#2 lore raw
In reply to Lennart Poettering

Hi!

Quoted 8 lines

Please merge!

I wonder who's the right one to ask for merging, since this driver sits in drivers/misc/. According to MAINTAINERS Alessandro Rubini maintains that directory. However it's somewhat based on the ACPI EC access stuff I posted earlier, hence the APCI tree might be another path to get this merged. Len, Alessandro, which one of you shall I bug to get this driver commited?

I guess Andrew is right person to get this in, but please follow SubmittingPatches w.r.t. changelog.

Quoted 1 line

+/* $Id: msi-laptop.c 115 2006-08-20 20:02:54Z lennart $ */

Can you kill this? It only causes problems...

Quoted 9 lines

+/*
+ * msi-laptop.c - MSI S270 laptop support. This laptop is sold under
+ * various brands, including "Cytron/TCM/Medion/Tchibo MD96100".
+ *
+ * This driver exports a few files in /sys/devices/platform/msi-laptop-pf/:
+ *
+ * lcd_level - Screen brightness: contains a single integer in the
+ * range 0..8. (rw)
+ *

Quoted 10 lines
+ *   auto_brightness - Enable automatic brightness control: contains
+ *   either 0 or 1. If set to 1 the hardware adjusts the screen
+ *   brightness automatically when the power cord is
+ *   plugged/unplugged. (rw)
+ *
+ *   wlan - WLAN subsystem enabled: contains either 0 or 1. (ro)
+ *
+ *   bluetooth - Bluetooth subsystem enabled: contains either 0 or 1
+ *   Please note that this file is constantly 0 if no Bluetooth
+ *   hardware is available. (ro)

User level documentation should go to Documentation/ somewhere. Not sure if we have centralized place for /sys docs?

Quoted 1 line

+/*** Hardware access ***/

Can you remove extra ** s? They hurt my eyes.

Quoted 1 line

+static int set_lcd_level(int level) {

Indentation (you have this one detail consistently wrong).
Pavel

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html