2011-03-05 04:25:29

by Greg KH

[permalink] [raw]
Subject: [PATCH] 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.

Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
Documentation/ABI/testing/sysfs-driver-samsung-laptop | 19
drivers/platform/x86/Kconfig | 13
drivers/platform/x86/Makefile | 1
drivers/platform/x86/samsung-laptop.c | 832 ++++++++++++++++++
4 files changed, 865 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.

v2 - 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.

v3 - Added a few more device ids, const changes, and now supports
variable brightness levels as not all laptops are the same with
this.


diff --git a/Documentation/ABI/testing/sysfs-driver-samsung-laptop b/Documentation/ABI/testing/sysfs-driver-samsung-laptop
new file mode 100644
index 0000000..0a81023
--- /dev/null
+++ b/Documentation/ABI/testing/sysfs-driver-samsung-laptop
@@ -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.
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index a59af5b..5624267 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -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
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
index 4ec4ff8..ad2fb97 100644
--- a/drivers/platform/x86/Makefile
+++ b/drivers/platform/x86/Makefile
@@ -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
diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c
new file mode 100644
index 0000000..e0b390d
--- /dev/null
+++ b/drivers/platform/x86/samsung-laptop.c
@@ -0,0 +1,832 @@
+/*
+ * Samsung Laptop driver
+ *
+ * Copyright (C) 2009,2011 Greg Kroah-Hartman ([email protected])
+ * Copyright (C) 2009,2011 Novell Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ */
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/delay.h>
+#include <linux/pci.h>
+#include <linux/backlight.h>
+#include <linux/fb.h>
+#include <linux/dmi.h>
+#include <linux/platform_device.h>
+#include <linux/rfkill.h>
+
+/*
+ * This driver is needed because a number of Samsung laptops do not hook
+ * their control settings through ACPI. So we have to poke around in the
+ * BIOS to do things like brightness values, and "special" key controls.
+ */
+
+/*
+ * We have 0 - 8 as valid brightness levels. The specs say that level 0 should
+ * be reserved by the BIOS (which really doesn't make much sense), we tell
+ * userspace that the value is 0 - 7 and then just tell the hardware 1 - 8
+ */
+#define MAX_BRIGHT 0x07
+
+
+#define SABI_IFACE_MAIN 0x00
+#define SABI_IFACE_SUB 0x02
+#define SABI_IFACE_COMPLETE 0x04
+#define SABI_IFACE_DATA 0x05
+
+/* Structure to get data back to the calling function */
+struct sabi_retval {
+ u8 retval[20];
+};
+
+struct sabi_header_offsets {
+ u8 port;
+ u8 re_mem;
+ u8 iface_func;
+ u8 en_mem;
+ u8 data_offset;
+ u8 data_segment;
+};
+
+struct sabi_commands {
+ /*
+ * Brightness is 0 - 8, as described above.
+ * Value 0 is for the BIOS to use
+ */
+ u8 get_brightness;
+ u8 set_brightness;
+
+ /*
+ * first byte:
+ * 0x00 - wireless is off
+ * 0x01 - wireless is on
+ * second byte:
+ * 0x02 - 3G is off
+ * 0x03 - 3G is on
+ * TODO, verify 3G is correct, that doesn't seem right...
+ */
+ u8 get_wireless_button;
+ u8 set_wireless_button;
+
+ /* 0 is off, 1 is on */
+ u8 get_backlight;
+ u8 set_backlight;
+
+ /*
+ * 0x80 or 0x00 - no action
+ * 0x81 - recovery key pressed
+ */
+ u8 get_recovery_mode;
+ u8 set_recovery_mode;
+
+ /*
+ * on seclinux: 0 is low, 1 is high,
+ * on swsmi: 0 is normal, 1 is silent, 2 is turbo
+ */
+ u8 get_performance_level;
+ u8 set_performance_level;
+
+ /*
+ * Tell the BIOS that Linux is running on this machine.
+ * 81 is on, 80 is off
+ */
+ u8 set_linux;
+};
+
+struct sabi_performance_level {
+ const char *name;
+ u8 value;
+};
+
+struct sabi_config {
+ const char *test_string;
+ u16 main_function;
+ const struct sabi_header_offsets header_offsets;
+ const struct sabi_commands commands;
+ const struct sabi_performance_level performance_levels[4];
+ u8 min_brightness;
+ u8 max_brightness;
+};
+
+static const struct sabi_config sabi_configs[] = {
+ {
+ .test_string = "SECLINUX",
+
+ .main_function = 0x4c49,
+
+ .header_offsets = {
+ .port = 0x00,
+ .re_mem = 0x02,
+ .iface_func = 0x03,
+ .en_mem = 0x04,
+ .data_offset = 0x05,
+ .data_segment = 0x07,
+ },
+
+ .commands = {
+ .get_brightness = 0x00,
+ .set_brightness = 0x01,
+
+ .get_wireless_button = 0x02,
+ .set_wireless_button = 0x03,
+
+ .get_backlight = 0x04,
+ .set_backlight = 0x05,
+
+ .get_recovery_mode = 0x06,
+ .set_recovery_mode = 0x07,
+
+ .get_performance_level = 0x08,
+ .set_performance_level = 0x09,
+
+ .set_linux = 0x0a,
+ },
+
+ .performance_levels = {
+ {
+ .name = "silent",
+ .value = 0,
+ },
+ {
+ .name = "normal",
+ .value = 1,
+ },
+ { },
+ },
+ .min_brightness = 1,
+ .max_brightness = 8,
+ },
+ {
+ .test_string = "SwSmi@",
+
+ .main_function = 0x5843,
+
+ .header_offsets = {
+ .port = 0x00,
+ .re_mem = 0x04,
+ .iface_func = 0x02,
+ .en_mem = 0x03,
+ .data_offset = 0x05,
+ .data_segment = 0x07,
+ },
+
+ .commands = {
+ .get_brightness = 0x10,
+ .set_brightness = 0x11,
+
+ .get_wireless_button = 0x12,
+ .set_wireless_button = 0x13,
+
+ .get_backlight = 0x2d,
+ .set_backlight = 0x2e,
+
+ .get_recovery_mode = 0xff,
+ .set_recovery_mode = 0xff,
+
+ .get_performance_level = 0x31,
+ .set_performance_level = 0x32,
+
+ .set_linux = 0xff,
+ },
+
+ .performance_levels = {
+ {
+ .name = "normal",
+ .value = 0,
+ },
+ {
+ .name = "silent",
+ .value = 1,
+ },
+ {
+ .name = "overclock",
+ .value = 2,
+ },
+ { },
+ },
+ .min_brightness = 0,
+ .max_brightness = 8,
+ },
+ { },
+};
+
+static const struct sabi_config *sabi_config;
+
+static void __iomem *sabi;
+static void __iomem *sabi_iface;
+static void __iomem *f0000_segment;
+static struct backlight_device *backlight_device;
+static struct mutex sabi_mutex;
+static struct platform_device *sdev;
+static struct rfkill *rfk;
+
+static int force;
+module_param(force, bool, 0);
+MODULE_PARM_DESC(force,
+ "Disable the DMI check and forces the driver to be loaded");
+
+static int debug;
+module_param(debug, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(debug, "Debug enabled or not");
+
+static int sabi_get_command(u8 command, struct sabi_retval *sretval)
+{
+ int retval = 0;
+ u16 port = readw(sabi + sabi_config->header_offsets.port);
+ u8 complete, iface_data;
+
+ mutex_lock(&sabi_mutex);
+
+ /* enable memory to be able to write to it */
+ outb(readb(sabi + sabi_config->header_offsets.en_mem), port);
+
+ /* write out the command */
+ writew(sabi_config->main_function, sabi_iface + SABI_IFACE_MAIN);
+ writew(command, sabi_iface + SABI_IFACE_SUB);
+ writeb(0, sabi_iface + SABI_IFACE_COMPLETE);
+ outb(readb(sabi + sabi_config->header_offsets.iface_func), port);
+
+ /* write protect memory to make it safe */
+ outb(readb(sabi + sabi_config->header_offsets.re_mem), port);
+
+ /* see if the command actually succeeded */
+ complete = readb(sabi_iface + SABI_IFACE_COMPLETE);
+ iface_data = readb(sabi_iface + SABI_IFACE_DATA);
+ if (complete != 0xaa || iface_data == 0xff) {
+ pr_warn("SABI get command 0x%02x failed with completion flag 0x%02x and data 0x%02x\n",
+ command, complete, iface_data);
+ retval = -EINVAL;
+ goto exit;
+ }
+ /*
+ * Save off the data into a structure so the caller use it.
+ * Right now we only want the first 4 bytes,
+ * There are commands that need more, but not for the ones we
+ * currently care about.
+ */
+ sretval->retval[0] = readb(sabi_iface + SABI_IFACE_DATA);
+ sretval->retval[1] = readb(sabi_iface + SABI_IFACE_DATA + 1);
+ sretval->retval[2] = readb(sabi_iface + SABI_IFACE_DATA + 2);
+ sretval->retval[3] = readb(sabi_iface + SABI_IFACE_DATA + 3);
+
+exit:
+ mutex_unlock(&sabi_mutex);
+ return retval;
+
+}
+
+static int sabi_set_command(u8 command, u8 data)
+{
+ int retval = 0;
+ u16 port = readw(sabi + sabi_config->header_offsets.port);
+ u8 complete, iface_data;
+
+ mutex_lock(&sabi_mutex);
+
+ /* enable memory to be able to write to it */
+ outb(readb(sabi + sabi_config->header_offsets.en_mem), port);
+
+ /* write out the command */
+ writew(sabi_config->main_function, sabi_iface + SABI_IFACE_MAIN);
+ writew(command, sabi_iface + SABI_IFACE_SUB);
+ writeb(0, sabi_iface + SABI_IFACE_COMPLETE);
+ writeb(data, sabi_iface + SABI_IFACE_DATA);
+ outb(readb(sabi + sabi_config->header_offsets.iface_func), port);
+
+ /* write protect memory to make it safe */
+ outb(readb(sabi + sabi_config->header_offsets.re_mem), port);
+
+ /* see if the command actually succeeded */
+ complete = readb(sabi_iface + SABI_IFACE_COMPLETE);
+ iface_data = readb(sabi_iface + SABI_IFACE_DATA);
+ if (complete != 0xaa || iface_data == 0xff) {
+ pr_warn("SABI set command 0x%02x failed with completion flag 0x%02x and data 0x%02x\n",
+ command, complete, iface_data);
+ retval = -EINVAL;
+ }
+
+ mutex_unlock(&sabi_mutex);
+ return retval;
+}
+
+static void test_backlight(void)
+{
+ struct sabi_retval sretval;
+
+ sabi_get_command(sabi_config->commands.get_backlight, &sretval);
+ printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]);
+
+ sabi_set_command(sabi_config->commands.set_backlight, 0);
+ printk(KERN_DEBUG "backlight should be off\n");
+
+ sabi_get_command(sabi_config->commands.get_backlight, &sretval);
+ printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]);
+
+ msleep(1000);
+
+ sabi_set_command(sabi_config->commands.set_backlight, 1);
+ printk(KERN_DEBUG "backlight should be on\n");
+
+ sabi_get_command(sabi_config->commands.get_backlight, &sretval);
+ printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]);
+}
+
+static void test_wireless(void)
+{
+ struct sabi_retval sretval;
+
+ sabi_get_command(sabi_config->commands.get_wireless_button, &sretval);
+ printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]);
+
+ sabi_set_command(sabi_config->commands.set_wireless_button, 0);
+ printk(KERN_DEBUG "wireless led should be off\n");
+
+ sabi_get_command(sabi_config->commands.get_wireless_button, &sretval);
+ printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]);
+
+ msleep(1000);
+
+ sabi_set_command(sabi_config->commands.set_wireless_button, 1);
+ printk(KERN_DEBUG "wireless led should be on\n");
+
+ sabi_get_command(sabi_config->commands.get_wireless_button, &sretval);
+ printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]);
+}
+
+static u8 read_brightness(void)
+{
+ struct sabi_retval sretval;
+ int user_brightness = 0;
+ int retval;
+
+ retval = sabi_get_command(sabi_config->commands.get_brightness,
+ &sretval);
+ if (!retval) {
+ user_brightness = sretval.retval[0];
+ if (user_brightness != 0)
+ user_brightness -= sabi_config->min_brightness;
+ }
+ return user_brightness;
+}
+
+static void set_brightness(u8 user_brightness)
+{
+ u8 user_level = user_brightness - sabi_config->min_brightness;
+
+ sabi_set_command(sabi_config->commands.set_brightness, user_level);
+}
+
+static int get_brightness(struct backlight_device *bd)
+{
+ return (int)read_brightness();
+}
+
+static int update_status(struct backlight_device *bd)
+{
+ set_brightness(bd->props.brightness);
+
+ if (bd->props.power == FB_BLANK_UNBLANK)
+ sabi_set_command(sabi_config->commands.set_backlight, 1);
+ else
+ sabi_set_command(sabi_config->commands.set_backlight, 0);
+ return 0;
+}
+
+static const struct backlight_ops backlight_ops = {
+ .get_brightness = get_brightness,
+ .update_status = update_status,
+};
+
+static int rfkill_set(void *data, bool blocked)
+{
+ /* Do something with blocked...*/
+ /*
+ * blocked == false is on
+ * blocked == true is off
+ */
+ if (blocked)
+ sabi_set_command(sabi_config->commands.set_wireless_button, 0);
+ else
+ sabi_set_command(sabi_config->commands.set_wireless_button, 1);
+
+ return 0;
+}
+
+static struct rfkill_ops rfkill_ops = {
+ .set_block = rfkill_set,
+};
+
+static int init_wireless(struct platform_device *sdev)
+{
+ int retval;
+
+ rfk = rfkill_alloc("samsung-wifi", &sdev->dev, RFKILL_TYPE_WLAN,
+ &rfkill_ops, NULL);
+ if (!rfk)
+ return -ENOMEM;
+
+ retval = rfkill_register(rfk);
+ if (retval) {
+ rfkill_destroy(rfk);
+ return -ENODEV;
+ }
+
+ return 0;
+}
+
+static void destroy_wireless(void)
+{
+ rfkill_unregister(rfk);
+ rfkill_destroy(rfk);
+}
+
+static ssize_t get_performance_level(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ struct sabi_retval sretval;
+ int retval;
+ int i;
+
+ /* Read the state */
+ retval = sabi_get_command(sabi_config->commands.get_performance_level,
+ &sretval);
+ if (retval)
+ return retval;
+
+ /* The logic is backwards, yeah, lots of fun... */
+ for (i = 0; sabi_config->performance_levels[i].name; ++i) {
+ if (sretval.retval[0] == sabi_config->performance_levels[i].value)
+ return sprintf(buf, "%s\n", sabi_config->performance_levels[i].name);
+ }
+ return sprintf(buf, "%s\n", "unknown");
+}
+
+static ssize_t set_performance_level(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t count)
+{
+ if (count >= 1) {
+ int i;
+ for (i = 0; sabi_config->performance_levels[i].name; ++i) {
+ 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,
+ level->value);
+ break;
+ }
+ }
+ if (!sabi_config->performance_levels[i].name)
+ return -EINVAL;
+ }
+ return count;
+}
+static DEVICE_ATTR(performance_level, S_IWUSR | S_IRUGO,
+ get_performance_level, set_performance_level);
+
+
+static int __init dmi_check_cb(const struct dmi_system_id *id)
+{
+ pr_info("found laptop model '%s'\n",
+ id->ident);
+ return 0;
+}
+
+static struct dmi_system_id __initdata samsung_dmi_table[] = {
+ {
+ .ident = "N128",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N128"),
+ DMI_MATCH(DMI_BOARD_NAME, "N128"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "N130",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N130"),
+ DMI_MATCH(DMI_BOARD_NAME, "N130"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "X125",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "X125"),
+ DMI_MATCH(DMI_BOARD_NAME, "X125"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "X120/X170",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "X120/X170"),
+ DMI_MATCH(DMI_BOARD_NAME, "X120/X170"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "NC10",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "NC10"),
+ DMI_MATCH(DMI_BOARD_NAME, "NC10"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "NP-Q45",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"),
+ DMI_MATCH(DMI_BOARD_NAME, "SQ45S70S"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "X360",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
+ DMI_MATCH(DMI_BOARD_NAME, "X360"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "R518",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "R518"),
+ DMI_MATCH(DMI_BOARD_NAME, "R518"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "R519/R719",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "R519/R719"),
+ DMI_MATCH(DMI_BOARD_NAME, "R519/R719"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "N150/N210/N220",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"),
+ DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "N150P/N210P/N220P",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N150P/N210P/N220P"),
+ DMI_MATCH(DMI_BOARD_NAME, "N150P/N210P/N220P"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "R530/R730",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "R530/R730"),
+ DMI_MATCH(DMI_BOARD_NAME, "R530/R730"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "NF110/NF210/NF310",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
+ DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "N145P/N250P/N260P",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
+ DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "R70/R71",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "R70/R71"),
+ DMI_MATCH(DMI_BOARD_NAME, "R70/R71"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
+ .ident = "P460",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "P460"),
+ DMI_MATCH(DMI_BOARD_NAME, "P460"),
+ },
+ .callback = dmi_check_cb,
+ },
+ { },
+};
+MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
+
+static int find_signature(void __iomem *memcheck, const char *testStr)
+{
+ int i = 0;
+ int loca;
+
+ for (loca = 0; loca < 0xffff; loca++) {
+ char temp = readb(memcheck + loca);
+
+ if (temp == testStr[i]) {
+ if (i == strlen(testStr)-1)
+ break;
+ ++i;
+ } else {
+ i = 0;
+ }
+ }
+ return loca;
+}
+
+static int __init samsung_init(void)
+{
+ struct backlight_properties props;
+ struct sabi_retval sretval;
+ unsigned int ifaceP;
+ int i;
+ int loca;
+ int retval;
+
+ mutex_init(&sabi_mutex);
+
+ if (!force && !dmi_check_system(samsung_dmi_table))
+ return -ENODEV;
+
+ f0000_segment = ioremap_nocache(0xf0000, 0xffff);
+ if (!f0000_segment) {
+ pr_err("Can't map the segment at 0xf0000\n");
+ return -EINVAL;
+ }
+
+ /* Try to find one of the signatures in memory to find the header */
+ for (i = 0; sabi_configs[i].test_string != 0; ++i) {
+ sabi_config = &sabi_configs[i];
+ loca = find_signature(f0000_segment, sabi_config->test_string);
+ if (loca != 0xffff)
+ break;
+ }
+
+ if (loca == 0xffff) {
+ pr_err("This computer does not support SABI\n");
+ goto error_no_signature;
+ }
+
+ /* point to the SMI port Number */
+ loca += 1;
+ sabi = (f0000_segment + loca);
+
+ if (debug) {
+ printk(KERN_DEBUG "This computer supports SABI==%x\n",
+ loca + 0xf0000 - 6);
+ printk(KERN_DEBUG "SABI header:\n");
+ printk(KERN_DEBUG " SMI Port Number = 0x%04x\n",
+ readw(sabi + sabi_config->header_offsets.port));
+ printk(KERN_DEBUG " SMI Interface Function = 0x%02x\n",
+ readb(sabi + sabi_config->header_offsets.iface_func));
+ printk(KERN_DEBUG " SMI enable memory buffer = 0x%02x\n",
+ readb(sabi + sabi_config->header_offsets.en_mem));
+ printk(KERN_DEBUG " SMI restore memory buffer = 0x%02x\n",
+ readb(sabi + sabi_config->header_offsets.re_mem));
+ printk(KERN_DEBUG " SABI data offset = 0x%04x\n",
+ readw(sabi + sabi_config->header_offsets.data_offset));
+ printk(KERN_DEBUG " SABI data segment = 0x%04x\n",
+ readw(sabi + sabi_config->header_offsets.data_segment));
+ }
+
+ /* Get a pointer to the SABI Interface */
+ ifaceP = (readw(sabi + sabi_config->header_offsets.data_segment) & 0x0ffff) << 4;
+ ifaceP += readw(sabi + sabi_config->header_offsets.data_offset) & 0x0ffff;
+ sabi_iface = ioremap_nocache(ifaceP, 16);
+ if (!sabi_iface) {
+ pr_err("Can't remap %x\n", ifaceP);
+ goto exit;
+ }
+ if (debug) {
+ printk(KERN_DEBUG "ifaceP = 0x%08x\n", ifaceP);
+ printk(KERN_DEBUG "sabi_iface = %p\n", sabi_iface);
+
+ test_backlight();
+ test_wireless();
+
+ retval = sabi_get_command(sabi_config->commands.get_brightness,
+ &sretval);
+ printk(KERN_DEBUG "brightness = 0x%02x\n", sretval.retval[0]);
+ }
+
+ /* Turn on "Linux" mode in the BIOS */
+ if (sabi_config->commands.set_linux != 0xff) {
+ retval = sabi_set_command(sabi_config->commands.set_linux,
+ 0x81);
+ if (retval) {
+ pr_warn("Linux mode was not set!\n");
+ goto error_no_platform;
+ }
+ }
+
+ /* knock up a platform device to hang stuff off of */
+ sdev = platform_device_register_simple("samsung", -1, NULL, 0);
+ if (IS_ERR(sdev))
+ goto error_no_platform;
+
+ /* create a backlight device to talk to this one */
+ memset(&props, 0, sizeof(struct backlight_properties));
+ props.max_brightness = sabi_config->max_brightness;
+ backlight_device = backlight_device_register("samsung", &sdev->dev,
+ NULL, &backlight_ops,
+ &props);
+ if (IS_ERR(backlight_device))
+ goto error_no_backlight;
+
+ backlight_device->props.brightness = read_brightness();
+ backlight_device->props.power = FB_BLANK_UNBLANK;
+ backlight_update_status(backlight_device);
+
+ retval = init_wireless(sdev);
+ if (retval)
+ goto error_no_rfk;
+
+ retval = device_create_file(&sdev->dev, &dev_attr_performance_level);
+ if (retval)
+ goto error_file_create;
+
+exit:
+ return 0;
+
+error_file_create:
+ destroy_wireless();
+
+error_no_rfk:
+ backlight_device_unregister(backlight_device);
+
+error_no_backlight:
+ platform_device_unregister(sdev);
+
+error_no_platform:
+ iounmap(sabi_iface);
+
+error_no_signature:
+ iounmap(f0000_segment);
+ return -EINVAL;
+}
+
+static void __exit samsung_exit(void)
+{
+ /* Turn off "Linux" mode in the BIOS */
+ if (sabi_config->commands.set_linux != 0xff)
+ sabi_set_command(sabi_config->commands.set_linux, 0x80);
+
+ device_remove_file(&sdev->dev, &dev_attr_performance_level);
+ backlight_device_unregister(backlight_device);
+ destroy_wireless();
+ iounmap(sabi_iface);
+ iounmap(f0000_segment);
+ platform_device_unregister(sdev);
+}
+
+module_init(samsung_init);
+module_exit(samsung_exit);
+
+MODULE_AUTHOR("Greg Kroah-Hartman <[email protected]>");
+MODULE_DESCRIPTION("Samsung Backlight driver");
+MODULE_LICENSE("GPL");


2011-03-11 17:43:56

by Matthew Garrett

[permalink] [raw]
Subject: Re: [PATCH] Platform: add Samsung Laptop platform driver

Applied, thanks.

--
Matthew Garrett | [email protected]

2011-03-11 17:57:53

by Tommaso Massimi

[permalink] [raw]
Subject: Re: [PATCH] Platform: add Samsung Laptop platform driver

On 03/10/2011 08:09 PM, Greg KH wrote:
>On Thu, Mar 10, 2011 at 07:28:00PM +0200, Nikolai Kondrashov wrote:
> > On 03/10/2011 07:19 PM, Greg KH wrote:
> > >Can you provide me the output of:
> > > grep . /sys/class/dmi/id/*
> > >so I can try to add support for this machine to the driver?
> > Sure, here it is.
>
> Great, here's a new version of the samsung-laptop.c file, can you
> replace it whereever you were building the previous one, rebuild it and
> test it for this machine to see if it works?

Hi,
here the output you required from my laptop:

tom@localhost tom_samsung]$ grep . /sys/class/dmi/id/*
/sys/class/dmi/id/bios_date:09/21/2009
/sys/class/dmi/id/bios_vendor:Phoenix Technologies Ltd.
/sys/class/dmi/id/bios_version:04IA.M005.20090921.KSY
/sys/class/dmi/id/board_name:X420/X520
grep: /sys/class/dmi/id/board_serial: Permission denied
/sys/class/dmi/id/board_vendor:SAMSUNG ELECTRONICS CO., LTD.
/sys/class/dmi/id/board_version:Not Applicable
/sys/class/dmi/id/chassis_asset_tag:No Asset Tag
grep: /sys/class/dmi/id/chassis_serial: Permission denied
/sys/class/dmi/id/chassis_type:10
/sys/class/dmi/id/chassis_vendor:SAMSUNG ELECTRONICS CO., LTD.
/sys/class/dmi/id/chassis_version:N/A
/sys/class/dmi/id/modalias:dmi:bvnPhoenixTechnologiesLtd.:bvr04IA.M005.20090921.KSY:bd09/21/2009:svnSAMSUNGELECTRONICSCO.,LTD.:pnX420/X520:pvrNotApplicable:rvnSAMSUNGELECTRONICSCO.,LTD.:rnX420/X520:rvrNotApplicable:cvnSAMSUNGELECTRONICSCO.,LTD.:ct10:cvrN/A:
/sys/class/dmi/id/product_name:X420/X520
grep: /sys/class/dmi/id/product_serial: Permission denied
grep: /sys/class/dmi/id/product_uuid: Permission denied
/sys/class/dmi/id/product_version:Not Applicable
/sys/class/dmi/id/sys_vendor:SAMSUNG ELECTRONICS CO., LTD.
/sys/class/dmi/id/uevent:MODALIAS=dmi:bvnPhoenixTechnologiesLtd.:bvr04IA.M005.20090921.KSY:bd09/21/2009:svnSAMSUNGELECTRONICSCO.,LTD.:pnX420/X520:pvrNotApplicable:rvnSAMSUNGELECTRONICSCO.,LTD.:rnX420/X520:rvrNotApplicable:cvnSAMSUNGELECTRONICSCO.,LTD.:ct10:cvrN/A:

I have added these lines to your source file

668a669,677
> {
> .ident = "X520",
> .matches = {
> DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
> DMI_MATCH(DMI_PRODUCT_NAME, "X520"),
> DMI_MATCH(DMI_BOARD_NAME, "X520"),
> },
> .callback = dmi_check_cb,
> },

When I load the module with the option debug=1,
it turns on and off my backligth and my wireless card,
so I think it is working fine.
Here what dmesg says:

samsung_laptop: module is from the staging directory, the quality is
unknown, you have been warned.
samsung_laptop: found laptop model 'X520'
This computer supports SABI==f48b4
SABI header:
SMI Port Number = 0x00b2
SMI Interface Function = 0xc0
SMI enable memory buffer = 0xc1
SMI restore memory buffer = 0xc2
SABI data offset = 0x0f00
SABI data segment = 0xdf01
ifaceP = 0x000dff10
sabi_iface = ffff8800000dff10
backlight = 0x01
backlight should be off
backlight = 0x00
backlight should be on
backlight = 0x01
wireless led = 0x01
wireless led should be off
wireless led = 0x00
wireless led should be on
wireless led = 0x01
brightness = 0x08
atkbd serio0: Unknown key pressed (translated set 2, code 0x89 on
isa0060/serio0).
atkbd serio0: Use 'setkeycodes e009 <keycode>' to make it known.

Now I think I need only to use the setkeycodes command to have
these new commands under my fingers :)

Thanks for that!!

Tom

PS: I'm not subscribed to the list, so please CC me if you need some other info

2011-03-11 19:39:25

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] Platform: add Samsung Laptop platform driver

On Fri, Mar 11, 2011 at 05:43:39PM +0000, Matthew Garrett wrote:
> Applied, thanks.

Great, any pointers to where it was applied? I think I need to send you
a few more 'add a new device id' patches and I want to make sure I get
the right version to patch against.

thanks,

greg k-h

2011-03-11 19:44:39

by Matthew Garrett

[permalink] [raw]
Subject: Re: [PATCH] Platform: add Samsung Laptop platform driver

On Fri, Mar 11, 2011 at 11:35:12AM -0800, Greg KH wrote:
> On Fri, Mar 11, 2011 at 05:43:39PM +0000, Matthew Garrett wrote:
> > Applied, thanks.
>
> Great, any pointers to where it was applied? I think I need to send you
> a few more 'add a new device id' patches and I want to make sure I get
> the right version to patch against.

http://git.kernel.org/?p=linux/kernel/git/mjg59/platform-drivers-x86.git;a=shortlog;h=refs/heads/linux-next
- ideally we'd just have it id against all Samsung laptops and check for
SABI? Or are there machines where that might break?

--
Matthew Garrett | [email protected]

2011-03-11 19:52:57

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] Platform: add Samsung Laptop platform driver

On Fri, Mar 11, 2011 at 07:44:22PM +0000, Matthew Garrett wrote:
> On Fri, Mar 11, 2011 at 11:35:12AM -0800, Greg KH wrote:
> > On Fri, Mar 11, 2011 at 05:43:39PM +0000, Matthew Garrett wrote:
> > > Applied, thanks.
> >
> > Great, any pointers to where it was applied? I think I need to send you
> > a few more 'add a new device id' patches and I want to make sure I get
> > the right version to patch against.
>
> http://git.kernel.org/?p=linux/kernel/git/mjg59/platform-drivers-x86.git;a=shortlog;h=refs/heads/linux-next

Thanks.

> - ideally we'd just have it id against all Samsung laptops and check for
> SABI? Or are there machines where that might break?

I thought all samsung laptops had SABI, but as the other samsung laptop
driver shows, that's not true.

I don't know what happens if we try to check for SABI on those machines.
We are just rooting around in the BIOS rom and reading values,
_hopefully_ that wouldn't break any other machines, but I don't really
know.

I wouldn't mind just doing a DMI match on all Samsung laptops, it would
save me having to constantly send patch updates, so I'll let this be
your call :)

thanks,

greg k-h

2011-03-11 19:55:19

by Matthew Garrett

[permalink] [raw]
Subject: Re: [PATCH] Platform: add Samsung Laptop platform driver

On Fri, Mar 11, 2011 at 11:52:21AM -0800, Greg KH wrote:

> I wouldn't mind just doing a DMI match on all Samsung laptops, it would
> save me having to constantly send patch updates, so I'll let this be
> your call :)

I think it'd be worth a go, at least. dell-laptop has example alias
lines for that, there's a few different DMI classes that can be used for
laptops so you'd need to check which one Samsung are using.

--
Matthew Garrett | [email protected]

2011-03-14 15:18:39

by Jörg-Volker Peetz

[permalink] [raw]
Subject: Re: [PATCH] Platform: add Samsung Laptop platform driver

Hi Matthew,

concering the hp-wmi driver I would like to answer a few questions.

My GNU/Linux Debian system with a self compiled custom kernel 2.6.37.3 is
running on a HP Pavilion DV7-4151sg notebook (dmidecode output, DSDT, and kernel
config attached).
I activated the driver on my HP notebook in order to achieve several goals:
(1) make the rfkill hardware button work
(seems to work according to the output of rfkill list and acpi_listen)
(2) make the buttons for lowering and increasing display brightness work
(do not work, no output with acpi_listen)
(3) the display back side has an illuminated "hp" logo which I would like to
be able to switch off (alone or together with the display) to save a
little energy
How can I found out if these functionality is achievable via ACPI WMI functions
or somehow else?
What would I have to change in hp-wmi.c?

Any help is appreciated.
Best regards,
J?rg-Volker.


Attachments:
DSDT.dsl.gz (40.16 kB)
config-2.6.37.3.gz (13.32 kB)
dmidecode.gz (2.17 kB)
Download all attachments

2011-03-14 15:25:10

by Jörg-Volker Peetz

[permalink] [raw]
Subject: HP WMI driver

Hi Matthew,

concering the hp-wmi driver I would like to answer a few questions.

My GNU/Linux Debian system with a self compiled custom kernel 2.6.37.3 is
running on a HP Pavilion DV7-4151sg notebook (dmidecode output, DSDT, and kernel
config attached).
I activated the driver on my HP notebook in order to achieve several goals:
(1) make the rfkill hardware button work
(seems to work according to the output of rfkill list and acpi_listen)
(2) make the buttons for lowering and increasing display brightness work
(do not work, no output with acpi_listen)
(3) the display back side has an illuminated "hp" logo which I would like to
be able to switch off (alone or together with the display) to save a
little energy
How can I found out if these functionality is achievable via ACPI WMI functions
or somehow else?
What would I have to change in hp-wmi.c?

By the way, I see the following messages in dmesg concerning WMI (these messages
did not appear before 2.6.37.4):

ACPI Error: Field [D128] at 1040 exceeds Buffer [NULL] size 160 (bits)
(20101013/dsopcode-597)
ACPI Error: Method parse/execution failed [\_SB_.WMID.HWMC] (Node
ffff88011be42320), AE_AML_BUFFER_LIMIT (20101013/psparse-537)
ACPI Error: Method parse/execution failed [\_SB_.WMID.WMAD] (Node
ffff88011be42500), AE_AML_BUFFER_LIMIT (20101013/psparse-537)
ACPI Error: Field [D128] at 1040 exceeds Buffer [NULL] size 160 (bits)
(20101013/dsopcode-597)
ACPI Error: Method parse/execution failed [\_SB_.WMID.HWMC] (Node
ffff88011be42320), AE_AML_BUFFER_LIMIT (20101013/psparse-537)
ACPI Error: Method parse/execution failed [\_SB_.WMID.WMAD] (Node
ffff88011be42500), AE_AML_BUFFER_LIMIT (20101013/psparse-537)
ACPI Error: Field [D128] at 1040 exceeds Buffer [NULL] size 160 (bits)
(20101013/dsopcode-597)
ACPI Error: Method parse/execution failed [\_SB_.WMID.HWMC] (Node
ffff88011be42320), AE_AML_BUFFER_LIMIT (20101013/psparse-537)
ACPI Error: Method parse/execution failed [\_SB_.WMID.WMAD] (Node
ffff88011be42500), AE_AML_BUFFER_LIMIT (20101013/psparse-537)
hp-wmi: probe of hp-wmi failed with error -22

Any help is appreciated.
Best regards,
J?rg-Volker.

P.S.: Please excuse the previous unready e-mail with the wrong subject.


Attachments:
DSDT.dsl.gz (40.16 kB)
config-2.6.37.3.gz (13.32 kB)
dmidecode.gz (2.17 kB)
Download all attachments

2011-04-23 20:37:00

by Tommaso Massimi

[permalink] [raw]
Subject: Fwd: [PATCH] Platform: add Samsung Laptop platform driver

Hi,

my samsung laptop would be very happy if you add
these lines to the file drivers/platform/x86/samsung-laptop.c

Thanks
Tommaso Massimi

@@ -666,6 +666,15 @@
},
.callback = dmi_check_cb,
},
+ {
+ .ident = "X520",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS
CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "X520"),
+ DMI_MATCH(DMI_BOARD_NAME, "X520"),
+ },
+ .callback = dmi_check_cb,
+ },
{ },
};
MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);


---------- Forwarded message ----------
From: Tommaso Massimi <[email protected]>
Date: Fri, Mar 11, 2011 at 6:57 PM
Subject: Re: [PATCH] Platform: add Samsung Laptop platform driver
To: [email protected]


On 03/10/2011 08:09 PM, Greg KH wrote:
>On Thu, Mar 10, 2011 at 07:28:00PM +0200, Nikolai Kondrashov wrote:
> > On 03/10/2011 07:19 PM, Greg KH wrote:
> > >Can you provide me the output of:
> > > grep . /sys/class/dmi/id/*
> > >so I can try to add support for this machine to the driver?
> > Sure, here it is.
>
> Great, here's a new version of the samsung-laptop.c file, can you
> replace it whereever you were building the previous one, rebuild it and
> test it for this machine to see if it works?

Hi,
here the output you required from my laptop:

tom@localhost tom_samsung]$ grep . /sys/class/dmi/id/*
/sys/class/dmi/id/bios_date:09/21/2009
/sys/class/dmi/id/bios_vendor:Phoenix Technologies Ltd.
/sys/class/dmi/id/bios_version:04IA.M005.20090921.KSY
/sys/class/dmi/id/board_name:X420/X520
grep: /sys/class/dmi/id/board_serial: Permission denied
/sys/class/dmi/id/board_vendor:SAMSUNG ELECTRONICS CO., LTD.
/sys/class/dmi/id/board_version:Not Applicable
/sys/class/dmi/id/chassis_asset_tag:No Asset Tag
grep: /sys/class/dmi/id/chassis_serial: Permission denied
/sys/class/dmi/id/chassis_type:10
/sys/class/dmi/id/chassis_vendor:SAMSUNG ELECTRONICS CO., LTD.
/sys/class/dmi/id/chassis_version:N/A
/sys/class/dmi/id/modalias:dmi:bvnPhoenixTechnologiesLtd.:bvr04IA.M005.20090921.KSY:bd09/21/2009:svnSAMSUNGELECTRONICSCO.,LTD.:pnX420/X520:pvrNotApplicable:rvnSAMSUNGELECTRONICSCO.,LTD.:rnX420/X520:rvrNotApplicable:cvnSAMSUNGELECTRONICSCO.,LTD.:ct10:cvrN/A:
/sys/class/dmi/id/product_name:X420/X520
grep: /sys/class/dmi/id/product_serial: Permission denied
grep: /sys/class/dmi/id/product_uuid: Permission denied
/sys/class/dmi/id/product_version:Not Applicable
/sys/class/dmi/id/sys_vendor:SAMSUNG ELECTRONICS CO., LTD.
/sys/class/dmi/id/uevent:MODALIAS=dmi:bvnPhoenixTechnologiesLtd.:bvr04IA.M005.20090921.KSY:bd09/21/2009:svnSAMSUNGELECTRONICSCO.,LTD.:pnX420/X520:pvrNotApplicable:rvnSAMSUNGELECTRONICSCO.,LTD.:rnX420/X520:rvrNotApplicable:cvnSAMSUNGELECTRONICSCO.,LTD.:ct10:cvrN/A:

I have added these lines to your source file

668a669,677
>               {
>               .ident = "X520",
>               .matches = {
>                       DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
>                       DMI_MATCH(DMI_PRODUCT_NAME, "X520"),
>                       DMI_MATCH(DMI_BOARD_NAME, "X520"),
>               },
>               .callback = dmi_check_cb,
>       },

When I load the module with the option debug=1,
it turns on and off my backligth and my wireless card,
so I think it is working fine.
Here what dmesg says:

samsung_laptop: module is from the staging directory, the quality is
unknown, you have been warned.
samsung_laptop: found laptop model 'X520'
This computer supports SABI==f48b4
SABI header:
 SMI Port Number = 0x00b2
 SMI Interface Function = 0xc0
 SMI enable memory buffer = 0xc1
 SMI restore memory buffer = 0xc2
 SABI data offset = 0x0f00
 SABI data segment = 0xdf01
ifaceP = 0x000dff10
sabi_iface = ffff8800000dff10
backlight = 0x01
backlight should be off
backlight = 0x00
backlight should be on
backlight = 0x01
wireless led = 0x01
wireless led should be off
wireless led = 0x00
wireless led should be on
wireless led = 0x01
brightness = 0x08
atkbd serio0: Unknown key pressed (translated set 2, code 0x89 on
isa0060/serio0).
atkbd serio0: Use 'setkeycodes e009 <keycode>' to make it known.

Now I think I need only to use the setkeycodes command to have
these new commands under my fingers :)

Thanks for that!!

Tom

PS: I'm not subscribed to the list, so please CC me if you need some other info



--
With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be  dangerous sitting under them as they fly
overhead. -- RFC 1925

2011-06-27 21:06:49

by J Witteveen

[permalink] [raw]
Subject: Re: [PATCH] Platform: add Samsung Laptop platform driver

On Fri, Feb 11, 2011 at 10:17, Jouke Witteveen <[email protected]> wrote:
> On Wed, Feb 9, 2011 at 23:40, Greg KH <[email protected]> wrote:
>> From: Greg Kroah-Hartman <[email protected]>
>>
>> This adds the samsung-laptop driver to the kernel. ?It now supports
>> all known Samsung laptops.
>>
>
> I don't see the N510, is this intentional? The netbook does not differ
> that much from some that are included.
>

The N510 benefits from this code as well. Below is a patch to include support.

Signed-off-by: Jouke Witteveen <[email protected]>

Thanks,
- Jouke

--- a/drivers/platform/x86/samsung-laptop.c 2011-06-26 16:18:06.517840468 +0200
+++ b/drivers/platform/x86/samsung-laptop.c 2011-06-26 16:19:14.677574644 +0200
@@ -521,6 +521,16 @@ static struct dmi_system_id __initdata s
.callback = dmi_check_cb,
},
{
+ .ident = "N510",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR,
+ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N510"),
+ DMI_MATCH(DMI_BOARD_NAME, "N510"),
+ },
+ .callback = dmi_check_cb,
+ },
+ {
.ident = "X125",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR,