Skip to contentSkip to conversation

Platform: add Samsung Laptop platform driver

PATCH New Greg KH 2 participants 2 messages Feb 25, 2011

Subsystems (2)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 Platform: add Samsung Laptop platform driver

From: Greg Kroah-Hartman <[email protected]>

This adds the samsung-laptop driver to the kernel. It now supports all known Samsung laptops that use the SABI interface.

---

 Documentation/ABI/testing/sysfs-driver-samsung-laptop |   19 
 drivers/platform/x86/Kconfig                          |   13 
 drivers/platform/x86/Makefile                         |    1 
 drivers/platform/x86/samsung-laptop.c                 |  805 ++++++++++++++++++
 4 files changed, 838 insertions(+)

Matthew, this is a copy of the latest version in the linux-next tree of the driver. Once it has been accepted into your tree, I'll delete the staging driver. Or, if you want to give your ACK, I can just move the driver from staging into this directory in my tree, which will properly preserve the history of the code.

I have also addressed all of the review comments you gave me previously, and fixed a bug in the previous version that broke the driver on the N128 laptop, as well as added support for a wide range of other laptops thanks to many testers who sent in patches.

Documentation/ABI/testing/sysfs-driver-samsung-laptop new file +19 -0
@@ -0,0 +1,19 @@
+What:		/sys/devices/platform/samsung/performance_level
+Date:		January 1, 2010
+KernelVersion:	2.6.33
+Contact:	Greg Kroah-Hartman <[email protected]>
+Description:	Some Samsung laptops have different "performance levels"
+		that are can be modified by a function key, and by this
+		sysfs file.  These values don't always make a whole lot
+		of sense, but some users like to modify them to keep
+		their fans quiet at all costs.  Reading from this file
+		will show the current performance level.  Writing to the
+		file can change this value.
+			Valid options:
+				"silent"
+				"normal"
+				"overclock"
+		Note that not all laptops support all of these options.
+		Specifically, not all support the "overclock" option,
+		and it's still unknown if this value even changes
+		anything, other than making the user feel a bit better.
drivers/platform/x86/Kconfig +13 -0
index a59af5b..5624267 100644
@@ -654,4 +654,17 @@ config XO1_RFKILL
 	  Support for enabling/disabling the WLAN interface on the OLPC XO-1
 	  laptop.
 
+config SAMSUNG_LAPTOP
+	tristate "Samsung Laptop driver"
+	depends on RFKILL && BACKLIGHT_CLASS_DEVICE && X86
+	---help---
+	  This module implements a driver for a wide range of different
+	  Samsung laptops.  It offers control over the different
+	  function keys, wireless LED, LCD backlight level, and
+	  sometimes provides a "performance_control" sysfs file to allow
+	  the performance level of the laptop to be changed.
+
+	  To compile this driver as a module, choose M here: the module
+	  will be called samsung-laptop.
+
 endif # X86_PLATFORM_DEVICES
drivers/platform/x86/Makefile +1 -0
index 4ec4ff8..ad2fb97 100644
@@ -34,3 +34,4 @@ obj-$(CONFIG_INTEL_IPS)		+= intel_ips.o
 obj-$(CONFIG_GPIO_INTEL_PMIC)	+= intel_pmic_gpio.o
 obj-$(CONFIG_XO1_RFKILL)	+= xo1-rfkill.o
 obj-$(CONFIG_IBM_RTL)		+= ibm_rtl.o
+obj-$(CONFIG_SAMSUNG_LAPTOP)	+= samsung-laptop.o
drivers/platform/x86/samsung-laptop.c new file +805 -0

805 lines not on this page · raw message

#1 lore raw

PATCH 1/1 platform: Constify samsung-laptop.c

Change sabi_config to const.
Reduces data, increases text ~200 bytes.

$ size drivers/platform/x86/samsung-laptop.o*
   text	   data	    bss	    dec	    hex	filename
   6933	   5084	   1560	  13577	   3509	drivers/platform/x86/samsung-laptop.o.new
   6765	   5252	   1560	  13577	   3509	drivers/platform/x86/samsung-laptop.o.old
---
 drivers/platform/x86/samsung-laptop.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/platform/x86/samsung-laptop.c +6 -6
index a8e82b8..720c9eb 100644
@@ -108,12 +108,12 @@ struct sabi_performance_level {
 struct sabi_config {
 	const char *test_string;
 	u16 main_function;
-	struct sabi_header_offsets header_offsets;
-	struct sabi_commands commands;
-	struct sabi_performance_level performance_levels[4];
+	const struct sabi_header_offsets header_offsets;
+	const struct sabi_commands commands;
+	const struct sabi_performance_level performance_levels[4];
 };
 
-static struct sabi_config sabi_configs[] = {
+static const struct sabi_config sabi_configs[] = {
 	{
 		.test_string = "SECLINUX",
 
@@ -211,7 +211,7 @@ static struct sabi_config sabi_configs[] = {
 	{ },
 };
 
-static struct sabi_config *sabi_config;
+static const struct sabi_config *sabi_config;
 
 static void __iomem *sabi;
 static void __iomem *sabi_iface;
@@ -467,7 +467,7 @@ static ssize_t set_performance_level(struct device *dev,
 	if (count >= 1) {
 		int i;
 		for (i = 0; sabi_config->performance_levels[i].name; ++i) {
-			struct sabi_performance_level *level =
+			const struct sabi_performance_level *level =
 				&sabi_config->performance_levels[i];
 			if (!strncasecmp(level->name, buf, strlen(level->name))) {
 				sabi_set_command(sabi_config->commands.set_performance_level,
Signature · 1 line
1.7.4.2.g597a6.dirty