[kernel] r16083 - in dists/sid/linux-2.6/debian: . config config/kernelarch-x86 patches/features/x86/samsung-laptop patches/series
Ben Hutchings
benh at alioth.debian.org
Wed Aug 4 23:28:51 UTC 2010
Author: benh
Date: Wed Aug 4 23:28:34 2010
New Revision: 16083
Log:
[x86] Add samsung-laptop driver
Added:
dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/
dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0001-Staging-add-Samsung-Laptop-driver.patch
dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0002-Staging-samsung-laptop-remove-old-kernel-code.patch
dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0003-Staging-samsung-laptop-add-TODO-file.patch
dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0004-Staging-samsung-laptop-fix-coding-style-issues.patch
Modified:
dists/sid/linux-2.6/debian/changelog
dists/sid/linux-2.6/debian/config/defines
dists/sid/linux-2.6/debian/config/kernelarch-x86/config
dists/sid/linux-2.6/debian/patches/series/19
Modified: dists/sid/linux-2.6/debian/changelog
==============================================================================
--- dists/sid/linux-2.6/debian/changelog Wed Aug 4 23:14:04 2010 (r16082)
+++ dists/sid/linux-2.6/debian/changelog Wed Aug 4 23:28:34 2010 (r16083)
@@ -24,6 +24,7 @@
G33 and Atom "Pineview") (Closes: #590193, maybe others)
* [i386/xen-686] Remove AMD Geode LX and VIA C3 "Nehemiah" from the list
of supported processors; they do not implement PAE
+ * [x86] Add samsung-laptop driver
[ dann frazier ]
* [ia64] Fix crash when gcore reads gate area (Closes: #588574)
Modified: dists/sid/linux-2.6/debian/config/defines
==============================================================================
--- dists/sid/linux-2.6/debian/config/defines Wed Aug 4 23:14:04 2010 (r16082)
+++ dists/sid/linux-2.6/debian/config/defines Wed Aug 4 23:28:34 2010 (r16083)
@@ -92,6 +92,7 @@
drivers/staging/rt2870sta/: 2.6.34
drivers/staging/rtl8192su/: 2.6.34
drivers/staging/rtl8192u/: 2.6.34
+drivers/staging/samsung-laptop/: 2.6.35
drivers/staging/udlfb/: 2.6.34
drivers/usb/serial/usb_wwan.c: 2.6.34
drivers/usb/serial/usb-wwan.h: 2.6.34
Modified: dists/sid/linux-2.6/debian/config/kernelarch-x86/config
==============================================================================
--- dists/sid/linux-2.6/debian/config/kernelarch-x86/config Wed Aug 4 23:14:04 2010 (r16082)
+++ dists/sid/linux-2.6/debian/config/kernelarch-x86/config Wed Aug 4 23:28:34 2010 (r16083)
@@ -1118,6 +1118,11 @@
CONFIG_PRISM2_USB=m
##
+## file: drivers/staging/samsung-laptop/Kconfi
+##
+CONFIG_SAMSUNG_LAPTOP=m
+
+##
## file: drivers/telephony/Kconfig
##
CONFIG_PHONE=m
Added: dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0001-Staging-add-Samsung-Laptop-driver.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0001-Staging-add-Samsung-Laptop-driver.patch Wed Aug 4 23:28:34 2010 (r16083)
@@ -0,0 +1,661 @@
+From: Greg Kroah-Hartman <gregkh at suse.de>
+Date: Thu, 3 Dec 2009 16:19:47 -0800
+Subject: [PATCH 1/4] Staging: add Samsung Laptop driver
+
+commit d189164a2426a5169117cfe154186c2f999ada87 upstream.
+
+This is a drive for the Samsung N128 laptop to control the wireless LED
+and backlight.
+
+Many thanks to Joey Lee for his help in testing and finding all of my
+bugs in the development of this driver, it has been invaluable.
+
+Cc: Joey Lee <jlee at novell.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
+[bwh: Adjust context for Debian's 2.6.32]
+---
+ drivers/staging/Kconfig | 2 +
+ drivers/staging/Makefile | 1 +
+ drivers/staging/samsung-laptop/Kconfig | 10 +
+ drivers/staging/samsung-laptop/Makefile | 1 +
+ drivers/staging/samsung-laptop/samsung-laptop.c | 582 +++++++++++++++++++++++
+ 5 files changed, 596 insertions(+), 0 deletions(-)
+ create mode 100644 drivers/staging/samsung-laptop/Kconfig
+ create mode 100644 drivers/staging/samsung-laptop/Makefile
+ create mode 100644 drivers/staging/samsung-laptop/samsung-laptop.c
+
+diff --git a/drivers/staging/Kconfig b/drivers/staging/Kconfig
+index d30fa45..a44ac2e 100644
+--- a/drivers/staging/Kconfig
++++ b/drivers/staging/Kconfig
+@@ -131,5 +131,7 @@
+
+ source "drivers/staging/xgifb/Kconfig"
+
++source "drivers/staging/samsung-laptop/Kconfig"
++
+ endif # !STAGING_EXCLUDE_BUILD
+ endif # STAGING
+diff --git a/drivers/staging/Makefile b/drivers/staging/Makefile
+index 910e55d..069864f 100644
+--- a/drivers/staging/Makefile
++++ b/drivers/staging/Makefile
+@@ -46,3 +46,4 @@
+ obj-$(CONFIG_RAMZSWAP) += ramzswap/
+ obj-$(CONFIG_SPEAKUP) += speakup/
+ obj-$(CONFIG_FB_XGI) += xgifb/
++obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop/
+diff --git a/drivers/staging/samsung-laptop/Kconfig b/drivers/staging/samsung-laptop/Kconfig
+new file mode 100644
+index 0000000..f27c608
+--- /dev/null
++++ b/drivers/staging/samsung-laptop/Kconfig
+@@ -0,0 +1,10 @@
++config SAMSUNG_LAPTOP
++ tristate "Samsung Laptop driver"
++ default n
++ depends on RFKILL && BACKLIGHT_CLASS_DEVICE && X86
++ help
++ This module implements a driver for the N128 Samsung Laptop
++ providing control over the Wireless LED and the LCD backlight
++
++ To compile this driver as a module, choose
++ M here: the module will be called samsung-laptop.
+diff --git a/drivers/staging/samsung-laptop/Makefile b/drivers/staging/samsung-laptop/Makefile
+new file mode 100644
+index 0000000..3c6f420
+--- /dev/null
++++ b/drivers/staging/samsung-laptop/Makefile
+@@ -0,0 +1 @@
++obj-$(CONFIG_SAMSUNG_LAPTOP) += samsung-laptop.o
+diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c
+new file mode 100644
+index 0000000..253b447
+--- /dev/null
++++ b/drivers/staging/samsung-laptop/samsung-laptop.c
+@@ -0,0 +1,582 @@
++/*
++ * Samsung N130 Laptop driver
++ *
++ * Copyright (C) 2009 Greg Kroah-Hartman (gregkh at suse.de)
++ * Copyright (C) 2009 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.
++ *
++ */
++#include <linux/version.h>
++#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
++
++/* Brightness is 0 - 8, as described above. Value 0 is for the BIOS to use */
++#define GET_BRIGHTNESS 0x00
++#define SET_BRIGHTNESS 0x01
++
++/* 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...
++ */
++#define GET_WIRELESS_BUTTON 0x02
++#define SET_WIRELESS_BUTTON 0x03
++
++/* 0 is off, 1 is on */
++#define GET_BACKLIGHT 0x04
++#define SET_BACKLIGHT 0x05
++
++/*
++ * 0x80 or 0x00 - no action
++ * 0x81 - recovery key pressed
++ */
++#define GET_RECOVERY_METHOD 0x06
++#define SET_RECOVERY_METHOD 0x07
++
++/* 0 is low, 1 is high */
++#define GET_PERFORMANCE_LEVEL 0x08
++#define SET_PERFORMANCE_LEVEL 0x09
++
++/*
++ * Tell the BIOS that Linux is running on this machine.
++ * 81 is on, 80 is off
++ */
++#define SET_LINUX 0x0a
++
++
++#define MAIN_FUNCTION 0x4c49
++
++#define SABI_HEADER_PORT 0x00
++#define SABI_HEADER_RE_MEM 0x02
++#define SABI_HEADER_IFACEFUNC 0x03
++#define SABI_HEADER_EN_MEM 0x04
++#define SABI_HEADER_DATA_OFFSET 0x05
++#define SABI_HEADER_DATA_SEGMENT 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];
++};
++
++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_HEADER_PORT);
++
++ mutex_lock(&sabi_mutex);
++
++ /* enable memory to be able to write to it */
++ outb(readb(sabi + SABI_HEADER_EN_MEM), port);
++
++ /* write out the command */
++ writew(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_HEADER_IFACEFUNC), port);
++
++ /* write protect memory to make it safe */
++ outb(readb(sabi + SABI_HEADER_RE_MEM), port);
++
++ /* see if the command actually succeeded */
++ if (readb(sabi_iface + SABI_IFACE_COMPLETE) == 0xaa &&
++ readb(sabi_iface + SABI_IFACE_DATA) != 0xff) {
++ /*
++ * It did!
++ * Save off the data into a structure so the caller use it.
++ * Right now we only care about the first 4 bytes,
++ * I suppose there are commands that need more, but I don't
++ * know about them.
++ */
++ 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);
++ goto exit;
++ }
++
++ /* Something bad happened, so report it and error out */
++ printk(KERN_WARNING "SABI command 0x%02x failed with completion flag 0x%02x and output 0x%02x\n",
++ command, readb(sabi_iface + SABI_IFACE_COMPLETE),
++ readb(sabi_iface + SABI_IFACE_DATA));
++ retval = -EINVAL;
++exit:
++ mutex_unlock(&sabi_mutex);
++ return retval;
++
++}
++
++static int sabi_set_command(u8 command, u8 data)
++{
++ int retval = 0;
++ u16 port = readw(sabi + SABI_HEADER_PORT);
++
++ mutex_lock(&sabi_mutex);
++
++ /* enable memory to be able to write to it */
++ outb(readb(sabi + SABI_HEADER_EN_MEM), port);
++
++ /* write out the command */
++ writew(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_HEADER_IFACEFUNC), port);
++
++ /* write protect memory to make it safe */
++ outb(readb(sabi + SABI_HEADER_RE_MEM), port);
++
++ /* see if the command actually succeeded */
++ if (readb(sabi_iface + SABI_IFACE_COMPLETE) == 0xaa &&
++ readb(sabi_iface + SABI_IFACE_DATA) != 0xff) {
++ /* it did! */
++ goto exit;
++ }
++
++ /* Something bad happened, so report it and error out */
++ printk(KERN_WARNING "SABI command 0x%02x failed with completion flag 0x%02x and output 0x%02x\n",
++ command, readb(sabi_iface + SABI_IFACE_COMPLETE),
++ readb(sabi_iface + SABI_IFACE_DATA));
++ retval = -EINVAL;
++exit:
++ mutex_unlock(&sabi_mutex);
++ return retval;
++}
++
++static void test_backlight(void)
++{
++ struct sabi_retval sretval;
++
++ sabi_get_command(GET_BACKLIGHT, &sretval);
++ printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]);
++
++ sabi_set_command(SET_BACKLIGHT, 0);
++ printk(KERN_DEBUG "backlight should be off\n");
++
++ sabi_get_command(GET_BACKLIGHT, &sretval);
++ printk(KERN_DEBUG "backlight = 0x%02x\n", sretval.retval[0]);
++
++ msleep(1000);
++
++ sabi_set_command(SET_BACKLIGHT, 1);
++ printk(KERN_DEBUG "backlight should be on\n");
++
++ sabi_get_command(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(GET_WIRELESS_BUTTON, &sretval);
++ printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]);
++
++ sabi_set_command(SET_WIRELESS_BUTTON, 0);
++ printk(KERN_DEBUG "wireless led should be off\n");
++
++ sabi_get_command(GET_WIRELESS_BUTTON, &sretval);
++ printk(KERN_DEBUG "wireless led = 0x%02x\n", sretval.retval[0]);
++
++ msleep(1000);
++
++ sabi_set_command(SET_WIRELESS_BUTTON, 1);
++ printk(KERN_DEBUG "wireless led should be on\n");
++
++ sabi_get_command(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(GET_BRIGHTNESS, &sretval);
++ if (!retval)
++ user_brightness = sretval.retval[0];
++ if (user_brightness != 0)
++ --user_brightness;
++ return user_brightness;
++}
++
++static void set_brightness(u8 user_brightness)
++{
++ sabi_set_command(SET_BRIGHTNESS, user_brightness + 1);
++}
++
++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(SET_BACKLIGHT, 1);
++ else
++ sabi_set_command(SET_BACKLIGHT, 0);
++ return 0;
++}
++
++static struct backlight_ops backlight_ops = {
++ .get_brightness = get_brightness,
++ .update_status = update_status,
++};
++
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
++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(SET_WIRELESS_BUTTON, 0);
++ else
++ sabi_set_command(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);
++}
++
++#else
++
++static int rfkill_set(void *data, enum rfkill_state state)
++{
++ if (state == RFKILL_STATE_UNBLOCKED)
++ sabi_set_command(SET_WIRELESS_BUTTON, 1);
++ else
++ sabi_set_command(SET_WIRELESS_BUTTON, 0);
++
++ return 0;
++}
++
++static int init_wireless(struct platform_device *sdev)
++{
++ int retval;
++
++ rfk = rfkill_allocate(&sdev->dev, RFKILL_TYPE_WLAN);
++ if (!rfk)
++ return -ENOMEM;
++ rfk->toggle_radio = rfkill_set;
++ rfk->name = "samsung-wifi";
++
++ retval = rfkill_register(rfk);
++ if (retval) {
++ rfkill_free(rfk);
++ return -ENODEV;
++ }
++
++ return 0;
++}
++
++static void destroy_wireless(void)
++{
++ rfkill_unregister(rfk);
++}
++
++#endif
++
++static ssize_t get_silent_state(struct device *dev,
++ struct device_attribute *attr, char *buf)
++{
++ struct sabi_retval sretval;
++ int retval;
++
++ /* Read the state */
++ retval = sabi_get_command(GET_PERFORMANCE_LEVEL, &sretval);
++ if (retval)
++ return retval;
++
++ /* The logic is backwards, yeah, lots of fun... */
++ if (sretval.retval[0] == 0)
++ retval = 1;
++ else
++ retval = 0;
++ return sprintf(buf, "%d\n", retval);
++}
++
++static ssize_t set_silent_state(struct device *dev,
++ struct device_attribute *attr, const char *buf,
++ size_t count)
++{
++ char value;
++
++ if (count >= 1) {
++ value = buf[0];
++ if ((value == '0') || (value == 'n') || (value == 'N')) {
++ /* Turn speed up */
++ sabi_set_command(SET_PERFORMANCE_LEVEL, 0x01);
++ } else if ((value == '1') || (value == 'y') || (value == 'Y')) {
++ /* Turn speed down */
++ sabi_set_command(SET_PERFORMANCE_LEVEL, 0x00);
++ } else {
++ return -EINVAL;
++ }
++ }
++ return count;
++}
++static DEVICE_ATTR(silent, S_IWUGO | S_IRUGO,
++ get_silent_state, set_silent_state);
++
++
++static int __init dmi_check_cb(const struct dmi_system_id *id)
++{
++ printk(KERN_INFO KBUILD_MODNAME ": 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,
++ },
++ { },
++};
++MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
++
++static int __init samsung_init(void)
++{
++ struct sabi_retval sretval;
++ const char *testStr = "SECLINUX";
++ void __iomem *memcheck;
++ unsigned int ifaceP;
++ int pStr;
++ int loca;
++ int retval;
++
++ mutex_init(&sabi_mutex);
++
++ if (!force && !dmi_check_system(samsung_dmi_table))
++ return -ENODEV;
++
++ f0000_segment = ioremap(0xf0000, 0xffff);
++ if (!f0000_segment) {
++ printk(KERN_ERR "Can't map the segment at 0xf0000\n");
++ return -EINVAL;
++ }
++
++ /* Try to find the signature "SECLINUX" in memory to find the header */
++ pStr = 0;
++ memcheck = f0000_segment;
++ for (loca = 0; loca < 0xffff; loca++) {
++ char temp = readb(memcheck + loca);
++
++ if (temp == testStr[pStr]) {
++ if (pStr == strlen(testStr)-1)
++ break;
++ ++pStr;
++ } else {
++ pStr = 0;
++ }
++ }
++ if (loca == 0xffff) {
++ printk(KERN_ERR "This computer does not support SABI\n");
++ goto error_no_signature;
++ }
++
++ /* point to the SMI port Number */
++ loca += 1;
++ sabi = (memcheck + 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_HEADER_PORT));
++ printk(KERN_DEBUG " SMI Interface Function = 0x%02x\n",
++ readb(sabi + SABI_HEADER_IFACEFUNC));
++ printk(KERN_DEBUG " SMI enable memory buffer = 0x%02x\n",
++ readb(sabi + SABI_HEADER_EN_MEM));
++ printk(KERN_DEBUG " SMI restore memory buffer = 0x%02x\n",
++ readb(sabi + SABI_HEADER_RE_MEM));
++ printk(KERN_DEBUG " SABI data offset = 0x%04x\n",
++ readw(sabi + SABI_HEADER_DATA_OFFSET));
++ printk(KERN_DEBUG " SABI data segment = 0x%04x\n",
++ readw(sabi + SABI_HEADER_DATA_SEGMENT));
++ }
++
++ /* Get a pointer to the SABI Interface */
++ ifaceP = (readw(sabi + SABI_HEADER_DATA_SEGMENT) & 0x0ffff) << 4;
++ ifaceP += readw(sabi + SABI_HEADER_DATA_OFFSET) & 0x0ffff;
++ sabi_iface = ioremap(ifaceP, 16);
++ if (!sabi_iface) {
++ printk(KERN_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(GET_BRIGHTNESS, &sretval);
++ printk(KERN_DEBUG "brightness = 0x%02x\n", sretval.retval[0]);
++ }
++
++ /* Turn on "Linux" mode in the BIOS */
++ retval = sabi_set_command(SET_LINUX, 0x81);
++ if (retval) {
++ printk(KERN_ERR KBUILD_MODNAME ": 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 */
++ backlight_device = backlight_device_register("samsung", &sdev->dev,
++ NULL, &backlight_ops);
++ if (IS_ERR(backlight_device))
++ goto error_no_backlight;
++
++ backlight_device->props.max_brightness = MAX_BRIGHT;
++ 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_silent);
++ 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 */
++ sabi_set_command(SET_LINUX, 0x80);
++
++ device_remove_file(&sdev->dev, &dev_attr_silent);
++ 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 <gregkh at suse.de>");
++MODULE_DESCRIPTION("Samsung Backlight driver");
++MODULE_LICENSE("GPL");
+--
+1.7.1
+
Added: dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0002-Staging-samsung-laptop-remove-old-kernel-code.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0002-Staging-samsung-laptop-remove-old-kernel-code.patch Wed Aug 4 23:28:34 2010 (r16083)
@@ -0,0 +1,82 @@
+From: Greg Kroah-Hartman <gregkh at suse.de>
+Date: Thu, 3 Dec 2009 16:24:47 -0800
+Subject: [PATCH 2/4] Staging: samsung-laptop: remove old kernel code
+
+commit 5b4c4dc61d5445346b1d5465c4b4934ea933165b upstream.
+
+Don't test for the kernel version, we know what version we are in,
+the latest.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
+---
+ drivers/staging/samsung-laptop/samsung-laptop.c | 40 -----------------------
+ 1 files changed, 0 insertions(+), 40 deletions(-)
+
+diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c
+index 253b447..4877138 100644
+--- a/drivers/staging/samsung-laptop/samsung-laptop.c
++++ b/drivers/staging/samsung-laptop/samsung-laptop.c
+@@ -9,7 +9,6 @@
+ * the Free Software Foundation.
+ *
+ */
+-#include <linux/version.h>
+ #include <linux/kernel.h>
+ #include <linux/init.h>
+ #include <linux/module.h>
+@@ -274,7 +273,6 @@ static struct backlight_ops backlight_ops = {
+ .update_status = update_status,
+ };
+
+-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,31)
+ static int rfkill_set(void *data, bool blocked)
+ {
+ /* Do something with blocked...*/
+@@ -318,44 +316,6 @@ static void destroy_wireless(void)
+ rfkill_destroy(rfk);
+ }
+
+-#else
+-
+-static int rfkill_set(void *data, enum rfkill_state state)
+-{
+- if (state == RFKILL_STATE_UNBLOCKED)
+- sabi_set_command(SET_WIRELESS_BUTTON, 1);
+- else
+- sabi_set_command(SET_WIRELESS_BUTTON, 0);
+-
+- return 0;
+-}
+-
+-static int init_wireless(struct platform_device *sdev)
+-{
+- int retval;
+-
+- rfk = rfkill_allocate(&sdev->dev, RFKILL_TYPE_WLAN);
+- if (!rfk)
+- return -ENOMEM;
+- rfk->toggle_radio = rfkill_set;
+- rfk->name = "samsung-wifi";
+-
+- retval = rfkill_register(rfk);
+- if (retval) {
+- rfkill_free(rfk);
+- return -ENODEV;
+- }
+-
+- return 0;
+-}
+-
+-static void destroy_wireless(void)
+-{
+- rfkill_unregister(rfk);
+-}
+-
+-#endif
+-
+ static ssize_t get_silent_state(struct device *dev,
+ struct device_attribute *attr, char *buf)
+ {
+--
+1.7.1
+
Added: dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0003-Staging-samsung-laptop-add-TODO-file.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0003-Staging-samsung-laptop-add-TODO-file.patch Wed Aug 4 23:28:34 2010 (r16083)
@@ -0,0 +1,26 @@
+From: Greg Kroah-Hartman <gregkh at suse.de>
+Date: Thu, 3 Dec 2009 16:27:19 -0800
+Subject: [PATCH 3/4] Staging: samsung-laptop: add TODO file
+
+commit 7f1f6e72e26c9e0f5d1b9b7766e174da4057a72d upstream.
+
+Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
+---
+ drivers/staging/samsung-laptop/TODO | 5 +++++
+ 1 files changed, 5 insertions(+), 0 deletions(-)
+ create mode 100644 drivers/staging/samsung-laptop/TODO
+
+diff --git a/drivers/staging/samsung-laptop/TODO b/drivers/staging/samsung-laptop/TODO
+new file mode 100644
+index 0000000..f7a6d58
+--- /dev/null
++++ b/drivers/staging/samsung-laptop/TODO
+@@ -0,0 +1,5 @@
++TODO:
++ - review from other developers
++ - figure out ACPI video issues
++
++Please send patches to Greg Kroah-Hartman <gregkh at suse.de>
+--
+1.7.1
+
Added: dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0004-Staging-samsung-laptop-fix-coding-style-issues.patch
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ dists/sid/linux-2.6/debian/patches/features/x86/samsung-laptop/0004-Staging-samsung-laptop-fix-coding-style-issues.patch Wed Aug 4 23:28:34 2010 (r16083)
@@ -0,0 +1,51 @@
+From: Chihau Chau <chihau at gmail.com>
+Date: Fri, 5 Feb 2010 15:23:48 -0300
+Subject: [PATCH 4/4] Staging: samsung-laptop: fix coding style issues
+
+commit d3c796fd57f33a20b2ca968e0e449382397c8dba upstream.
+
+This fixes some lines over 80 characters coding style issues.
+
+Signed-off-by: Chihau Chau <chihau at gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>
+---
+ drivers/staging/samsung-laptop/samsung-laptop.c | 9 ++++++---
+ 1 files changed, 6 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/staging/samsung-laptop/samsung-laptop.c b/drivers/staging/samsung-laptop/samsung-laptop.c
+index 4877138..dd7ea4c 100644
+--- a/drivers/staging/samsung-laptop/samsung-laptop.c
++++ b/drivers/staging/samsung-laptop/samsung-laptop.c
+@@ -99,7 +99,8 @@ 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");
++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);
+@@ -370,7 +371,8 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
+ {
+ .ident = "N128",
+ .matches = {
+- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
++ DMI_MATCH(DMI_SYS_VENDOR,
++ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N128"),
+ DMI_MATCH(DMI_BOARD_NAME, "N128"),
+ },
+@@ -379,7 +381,8 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
+ {
+ .ident = "N130",
+ .matches = {
+- DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
++ DMI_MATCH(DMI_SYS_VENDOR,
++ "SAMSUNG ELECTRONICS CO., LTD."),
+ DMI_MATCH(DMI_PRODUCT_NAME, "N130"),
+ DMI_MATCH(DMI_BOARD_NAME, "N130"),
+ },
+--
+1.7.1
+
Modified: dists/sid/linux-2.6/debian/patches/series/19
==============================================================================
--- dists/sid/linux-2.6/debian/patches/series/19 Wed Aug 4 23:14:04 2010 (r16082)
+++ dists/sid/linux-2.6/debian/patches/series/19 Wed Aug 4 23:28:34 2010 (r16083)
@@ -28,3 +28,7 @@
+ bugfix/all/ssb-Handle-alternate-SSPROM-location.patch
+ debian/ssb-Avoid-ABI-change-in-2.6.32.17.patch
+ debian/firmware-Avoid-ABI-change-in-2.6.32.17.patch
++ features/x86/samsung-laptop/0001-Staging-add-Samsung-Laptop-driver.patch
++ features/x86/samsung-laptop/0002-Staging-samsung-laptop-remove-old-kernel-code.patch
++ features/x86/samsung-laptop/0003-Staging-samsung-laptop-add-TODO-file.patch
++ features/x86/samsung-laptop/0004-Staging-samsung-laptop-fix-coding-style-issues.patch
More information about the Kernel-svn-changes
mailing list