Commit 61e5191c authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86

Pull x86 platform driver updates from Matthew Garrett:
 "Some significant updates to samsung-laptop, additional hardware
  support for Toshibas, misc updates to various hardware and a new
  backlight driver for some Apple machines."

Fix up trivial conflicts: geode Geos update happening next to net5501
support, and MSIC thermal platform support added twice.

* 'for_linus' of git://cavan.codon.org.uk/platform-drivers-x86: (77 commits)
  acer-wmi: add quirk table for video backlight vendor mode
  drivers/platform/x86/amilo-rfkill.c::amilo_rfkill_probe() avoid NULL deref
  samsung-laptop: unregister ACPI video module for some well known laptops
  acer-wmi: No wifi rfkill on Sony machines
  thinkpad-acpi: recognize Lenovo as version string in newer V-series BIOS
  asus-wmi: don't update power and brightness when using scalar
  eeepc-wmi: split et2012 specific hacks
  eeepc-wmi: refine quirks handling
  asus-nb-wmi: set panel_power correctly
  asus-wmi: move WAPF variable into quirks_entry
  asus-wmi: store backlight power status for AIO machine
  asus-wmi: add scalar board brightness adj. support
  samsung-laptop: cleanup return type: mode_t vs umode_t
  drivers, samsung-laptop: fix usage of isalnum
  drivers, samsung-laptop: fix initialization of sabi_data in sabi_set_commandb
  asus-wmi: on/off bit is not set when reading the value
  eeepc-wmi: add extra keymaps for EP121
  asus-nb-wmi: ignore useless keys
  acer-wmi: support Lenovo ideapad S205 Brazos wifi switch
  acer-wmi: fix out of input parameter size when set
  ...
parents d2a2fc18 86924de2
...@@ -17,3 +17,21 @@ Description: Some Samsung laptops have different "performance levels" ...@@ -17,3 +17,21 @@ Description: Some Samsung laptops have different "performance levels"
Specifically, not all support the "overclock" option, Specifically, not all support the "overclock" option,
and it's still unknown if this value even changes and it's still unknown if this value even changes
anything, other than making the user feel a bit better. anything, other than making the user feel a bit better.
What: /sys/devices/platform/samsung/battery_life_extender
Date: December 1, 2011
KernelVersion: 3.3
Contact: Corentin Chary <corentin.chary@gmail.com>
Description: Max battery charge level can be modified, battery cycle
life can be extended by reducing the max battery charge
level.
0 means normal battery mode (100% charge)
1 means battery life extender mode (80% charge)
What: /sys/devices/platform/samsung/usb_charge
Date: December 1, 2011
KernelVersion: 3.3
Contact: Corentin Chary <corentin.chary@gmail.com>
Description: Use your USB ports to charge devices, even
when your laptop is powered off.
1 means enabled, 0 means disabled.
...@@ -45,7 +45,7 @@ Status ...@@ -45,7 +45,7 @@ Status
Usage Usage
----- -----
Try "modprobe asus_acpi". Check your dmesg (simply type dmesg). You should Try "modprobe asus-laptop". Check your dmesg (simply type dmesg). You should
see some lines like this : see some lines like this :
Asus Laptop Extras version 0.42 Asus Laptop Extras version 0.42
......
...@@ -17,6 +17,11 @@ subsystem. See the logs of acpid or /proc/acpi/event and ...@@ -17,6 +17,11 @@ subsystem. See the logs of acpid or /proc/acpi/event and
devices are created by the driver. Additionally, loading the driver with the devices are created by the driver. Additionally, loading the driver with the
debug option will report all events in the kernel log. debug option will report all events in the kernel log.
The "scancodes" passed to the input system (that can be remapped with udev)
are indexes to the table "sony_laptop_input_keycode_map" in the sony-laptop.c
module. For example the "FN/E" key combination (EJECTCD on some models)
generates the scancode 20 (0x14).
Backlight control: Backlight control:
------------------ ------------------
If your laptop model supports it, you will find sysfs files in the If your laptop model supports it, you will find sysfs files in the
......
...@@ -5776,6 +5776,12 @@ F: drivers/media/common/saa7146* ...@@ -5776,6 +5776,12 @@ F: drivers/media/common/saa7146*
F: drivers/media/video/*7146* F: drivers/media/video/*7146*
F: include/media/*7146* F: include/media/*7146*
SAMSUNG LAPTOP DRIVER
M: Corentin Chary <corentincj@iksaif.net>
L: platform-driver-x86@vger.kernel.org
S: Maintained
F: drivers/platform/x86/samsung-laptop.c
SAMSUNG AUDIO (ASoC) DRIVERS SAMSUNG AUDIO (ASoC) DRIVERS
M: Sangbeom Kim <sbkim73@samsung.com> M: Sangbeom Kim <sbkim73@samsung.com>
L: alsa-devel@alsa-project.org (moderated for non-subscribers) L: alsa-devel@alsa-project.org (moderated for non-subscribers)
......
...@@ -2125,6 +2125,13 @@ config NET5501 ...@@ -2125,6 +2125,13 @@ config NET5501
---help--- ---help---
This option enables system support for the Soekris Engineering net5501. This option enables system support for the Soekris Engineering net5501.
config GEOS
bool "Traverse Technologies GEOS System Support (LEDS, GPIO, etc)"
select GPIOLIB
depends on DMI
---help---
This option enables system support for the Traverse Technologies GEOS.
endif # X86_32 endif # X86_32
config AMD_NB config AMD_NB
......
obj-$(CONFIG_ALIX) += alix.o obj-$(CONFIG_ALIX) += alix.o
obj-$(CONFIG_NET5501) += net5501.o obj-$(CONFIG_NET5501) += net5501.o
obj-$(CONFIG_GEOS) += geos.o
/*
* System Specific setup for Traverse Technologies GEOS.
* At the moment this means setup of GPIO control of LEDs.
*
* Copyright (C) 2008 Constantin Baranov <const@mimas.ru>
* Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com>
* and Philip Prindeville <philipp@redfish-solutions.com>
*
* TODO: There are large similarities with leds-net5501.c
* by Alessandro Zummo <a.zummo@towertech.it>
* In the future leds-net5501.c should be migrated over to platform
*
* 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/kernel.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/string.h>
#include <linux/module.h>
#include <linux/leds.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/input.h>
#include <linux/gpio_keys.h>
#include <linux/dmi.h>
#include <asm/geode.h>
static struct gpio_keys_button geos_gpio_buttons[] = {
{
.code = KEY_RESTART,
.gpio = 3,
.active_low = 1,
.desc = "Reset button",
.type = EV_KEY,
.wakeup = 0,
.debounce_interval = 100,
.can_disable = 0,
}
};
static struct gpio_keys_platform_data geos_buttons_data = {
.buttons = geos_gpio_buttons,
.nbuttons = ARRAY_SIZE(geos_gpio_buttons),
.poll_interval = 20,
};
static struct platform_device geos_buttons_dev = {
.name = "gpio-keys-polled",
.id = 1,
.dev = {
.platform_data = &geos_buttons_data,
}
};
static struct gpio_led geos_leds[] = {
{
.name = "geos:1",
.gpio = 6,
.default_trigger = "default-on",
.active_low = 1,
},
{
.name = "geos:2",
.gpio = 25,
.default_trigger = "default-off",
.active_low = 1,
},
{
.name = "geos:3",
.gpio = 27,
.default_trigger = "default-off",
.active_low = 1,
},
};
static struct gpio_led_platform_data geos_leds_data = {
.num_leds = ARRAY_SIZE(geos_leds),
.leds = geos_leds,
};
static struct platform_device geos_leds_dev = {
.name = "leds-gpio",
.id = -1,
.dev.platform_data = &geos_leds_data,
};
static struct __initdata platform_device *geos_devs[] = {
&geos_buttons_dev,
&geos_leds_dev,
};
static void __init register_geos(void)
{
/* Setup LED control through leds-gpio driver */
platform_add_devices(geos_devs, ARRAY_SIZE(geos_devs));
}
static int __init geos_init(void)
{
const char *vendor, *product;
if (!is_geode())
return 0;
vendor = dmi_get_system_info(DMI_SYS_VENDOR);
if (!vendor || strcmp(vendor, "Traverse Technologies"))
return 0;
product = dmi_get_system_info(DMI_PRODUCT_NAME);
if (!product || strcmp(product, "Geos"))
return 0;
printk(KERN_INFO "%s: system is recognized as \"%s %s\"\n",
KBUILD_MODNAME, vendor, product);
register_geos();
return 0;
}
module_init(geos_init);
MODULE_AUTHOR("Philip Prindeville <philipp@redfish-solutions.com>");
MODULE_DESCRIPTION("Traverse Technologies Geos System Setup");
MODULE_LICENSE("GPL");
...@@ -445,6 +445,16 @@ int ec_transaction(u8 command, ...@@ -445,6 +445,16 @@ int ec_transaction(u8 command,
EXPORT_SYMBOL(ec_transaction); EXPORT_SYMBOL(ec_transaction);
/* Get the handle to the EC device */
acpi_handle ec_get_handle(void)
{
if (!first_ec)
return NULL;
return first_ec->handle;
}
EXPORT_SYMBOL(ec_get_handle);
void acpi_ec_block_transactions(void) void acpi_ec_block_transactions(void)
{ {
struct acpi_ec *ec = first_ec; struct acpi_ec *ec = first_ec;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* Depending on whether ACPI graphics extensions (cmp. ACPI spec Appendix B) * Depending on whether ACPI graphics extensions (cmp. ACPI spec Appendix B)
* are available, video.ko should be used to handle the device. * are available, video.ko should be used to handle the device.
* *
* Otherwise vendor specific drivers like thinkpad_acpi, asus_acpi, * Otherwise vendor specific drivers like thinkpad_acpi, asus-laptop,
* sony_acpi,... can take care about backlight brightness. * sony_acpi,... can take care about backlight brightness.
* *
* If CONFIG_ACPI_VIDEO is neither set as "compiled in" (y) nor as a module (m) * If CONFIG_ACPI_VIDEO is neither set as "compiled in" (y) nor as a module (m)
......
...@@ -26,6 +26,10 @@ config ACER_WMI ...@@ -26,6 +26,10 @@ config ACER_WMI
depends on RFKILL || RFKILL = n depends on RFKILL || RFKILL = n
depends on ACPI_WMI depends on ACPI_WMI
select INPUT_SPARSEKMAP select INPUT_SPARSEKMAP
# Acer WMI depends on ACPI_VIDEO when ACPI is enabled
# but for select to work, need to select ACPI_VIDEO's dependencies, ick
select VIDEO_OUTPUT_CONTROL if ACPI
select ACPI_VIDEO if ACPI
---help--- ---help---
This is a driver for newer Acer (and Wistron) laptops. It adds This is a driver for newer Acer (and Wistron) laptops. It adds
wireless radio and bluetooth control, and on some laptops, wireless radio and bluetooth control, and on some laptops,
...@@ -54,7 +58,6 @@ config ACERHDF ...@@ -54,7 +58,6 @@ config ACERHDF
config ASUS_LAPTOP config ASUS_LAPTOP
tristate "Asus Laptop Extras" tristate "Asus Laptop Extras"
depends on ACPI depends on ACPI
depends on !ACPI_ASUS
select LEDS_CLASS select LEDS_CLASS
select NEW_LEDS select NEW_LEDS
select BACKLIGHT_CLASS_DEVICE select BACKLIGHT_CLASS_DEVICE
...@@ -460,10 +463,9 @@ config INTEL_MENLOW ...@@ -460,10 +463,9 @@ config INTEL_MENLOW
If unsure, say N. If unsure, say N.
config EEEPC_LAPTOP config EEEPC_LAPTOP
tristate "Eee PC Hotkey Driver (EXPERIMENTAL)" tristate "Eee PC Hotkey Driver"
depends on ACPI depends on ACPI
depends on INPUT depends on INPUT
depends on EXPERIMENTAL
depends on RFKILL || RFKILL = n depends on RFKILL || RFKILL = n
depends on HOTPLUG_PCI depends on HOTPLUG_PCI
select BACKLIGHT_CLASS_DEVICE select BACKLIGHT_CLASS_DEVICE
...@@ -482,11 +484,10 @@ config EEEPC_LAPTOP ...@@ -482,11 +484,10 @@ config EEEPC_LAPTOP
doesn't work on your Eee PC, try eeepc-wmi instead. doesn't work on your Eee PC, try eeepc-wmi instead.
config ASUS_WMI config ASUS_WMI
tristate "ASUS WMI Driver (EXPERIMENTAL)" tristate "ASUS WMI Driver"
depends on ACPI_WMI depends on ACPI_WMI
depends on INPUT depends on INPUT
depends on HWMON depends on HWMON
depends on EXPERIMENTAL
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
depends on RFKILL || RFKILL = n depends on RFKILL || RFKILL = n
depends on HOTPLUG_PCI depends on HOTPLUG_PCI
...@@ -501,7 +502,7 @@ config ASUS_WMI ...@@ -501,7 +502,7 @@ config ASUS_WMI
be called asus-wmi. be called asus-wmi.
config ASUS_NB_WMI config ASUS_NB_WMI
tristate "Asus Notebook WMI Driver (EXPERIMENTAL)" tristate "Asus Notebook WMI Driver"
depends on ASUS_WMI depends on ASUS_WMI
---help--- ---help---
This is a driver for newer Asus notebooks. It adds extra features This is a driver for newer Asus notebooks. It adds extra features
...@@ -514,7 +515,7 @@ config ASUS_NB_WMI ...@@ -514,7 +515,7 @@ config ASUS_NB_WMI
here. here.
config EEEPC_WMI config EEEPC_WMI
tristate "Eee PC WMI Driver (EXPERIMENTAL)" tristate "Eee PC WMI Driver"
depends on ASUS_WMI depends on ASUS_WMI
---help--- ---help---
This is a driver for newer Eee PC laptops. It adds extra features This is a driver for newer Eee PC laptops. It adds extra features
...@@ -559,38 +560,6 @@ config MSI_WMI ...@@ -559,38 +560,6 @@ config MSI_WMI
To compile this driver as a module, choose M here: the module will To compile this driver as a module, choose M here: the module will
be called msi-wmi. be called msi-wmi.
config ACPI_ASUS
tristate "ASUS/Medion Laptop Extras (DEPRECATED)"
depends on ACPI
select BACKLIGHT_CLASS_DEVICE
---help---
This driver provides support for extra features of ACPI-compatible
ASUS laptops. As some of Medion laptops are made by ASUS, it may also
support some Medion laptops (such as 9675 for example). It makes all
the extra buttons generate standard ACPI events that go through
/proc/acpi/events, and (on some models) adds support for changing the
display brightness and output, switching the LCD backlight on and off,
and most importantly, allows you to blink those fancy LEDs intended
for reporting mail and wireless status.
Note: display switching code is currently considered EXPERIMENTAL,
toying with these values may even lock your machine.
All settings are changed via /proc/acpi/asus directory entries. Owner
and group for these entries can be set with asus_uid and asus_gid
parameters.
More information and a userspace daemon for handling the extra buttons
at <http://acpi4asus.sf.net>.
If you have an ACPI-compatible ASUS laptop, say Y or M here. This
driver is still under development, so if your laptop is unsupported or
something works not quite as expected, please use the mailing list
available on the above page (acpi4asus-user@lists.sourceforge.net).
NOTE: This driver is deprecated and will probably be removed soon,
use asus-laptop instead.
config TOPSTAR_LAPTOP config TOPSTAR_LAPTOP
tristate "Topstar Laptop Extras" tristate "Topstar Laptop Extras"
depends on ACPI depends on ACPI
...@@ -604,6 +573,7 @@ config TOPSTAR_LAPTOP ...@@ -604,6 +573,7 @@ config TOPSTAR_LAPTOP
config ACPI_TOSHIBA config ACPI_TOSHIBA
tristate "Toshiba Laptop Extras" tristate "Toshiba Laptop Extras"
depends on ACPI depends on ACPI
depends on ACPI_WMI
select LEDS_CLASS select LEDS_CLASS
select NEW_LEDS select NEW_LEDS
depends on BACKLIGHT_CLASS_DEVICE depends on BACKLIGHT_CLASS_DEVICE
...@@ -746,13 +716,18 @@ config XO15_EBOOK ...@@ -746,13 +716,18 @@ config XO15_EBOOK
config SAMSUNG_LAPTOP config SAMSUNG_LAPTOP
tristate "Samsung Laptop driver" tristate "Samsung Laptop driver"
depends on RFKILL && BACKLIGHT_CLASS_DEVICE && X86 depends on X86
depends on RFKILL || RFKILL = n
depends on BACKLIGHT_CLASS_DEVICE
select LEDS_CLASS
select NEW_LEDS
---help--- ---help---
This module implements a driver for a wide range of different This module implements a driver for a wide range of different
Samsung laptops. It offers control over the different Samsung laptops. It offers control over the different
function keys, wireless LED, LCD backlight level, and function keys, wireless LED, LCD backlight level.
sometimes provides a "performance_control" sysfs file to allow
the performance level of the laptop to be changed. It may also provide some sysfs files described in
<file:Documentation/ABI/testing/sysfs-platform-samsung-laptop>
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
will be called samsung-laptop. will be called samsung-laptop.
...@@ -781,4 +756,14 @@ config SAMSUNG_Q10 ...@@ -781,4 +756,14 @@ config SAMSUNG_Q10
This driver provides support for backlight control on Samsung Q10 This driver provides support for backlight control on Samsung Q10
and related laptops, including Dell Latitude X200. and related laptops, including Dell Latitude X200.
config APPLE_GMUX
tristate "Apple Gmux Driver"
depends on PNP
select BACKLIGHT_CLASS_DEVICE
---help---
This driver provides support for the gmux device found on many
Apple laptops, which controls the display mux for the hybrid
graphics as well as the backlight. Currently only backlight
control is supported by the driver.
endif # X86_PLATFORM_DEVICES endif # X86_PLATFORM_DEVICES
...@@ -29,9 +29,12 @@ obj-$(CONFIG_PANASONIC_LAPTOP) += panasonic-laptop.o ...@@ -29,9 +29,12 @@ obj-$(CONFIG_PANASONIC_LAPTOP) += panasonic-laptop.o
obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o
obj-$(CONFIG_ACPI_WMI) += wmi.o obj-$(CONFIG_ACPI_WMI) += wmi.o
obj-$(CONFIG_MSI_WMI) += msi-wmi.o obj-$(CONFIG_MSI_WMI) += msi-wmi.o
obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o
obj-$(CONFIG_TOPSTAR_LAPTOP) += topstar-laptop.o obj-$(CONFIG_TOPSTAR_LAPTOP) += topstar-laptop.o
# toshiba_acpi must link after wmi to ensure that wmi devices are found
# before toshiba_acpi initializes
obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o
obj-$(CONFIG_TOSHIBA_BT_RFKILL) += toshiba_bluetooth.o obj-$(CONFIG_TOSHIBA_BT_RFKILL) += toshiba_bluetooth.o
obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o obj-$(CONFIG_INTEL_SCU_IPC) += intel_scu_ipc.o
obj-$(CONFIG_INTEL_SCU_IPC_UTIL) += intel_scu_ipcutil.o obj-$(CONFIG_INTEL_SCU_IPC_UTIL) += intel_scu_ipcutil.o
...@@ -46,3 +49,4 @@ obj-$(CONFIG_MXM_WMI) += mxm-wmi.o ...@@ -46,3 +49,4 @@ obj-$(CONFIG_MXM_WMI) += mxm-wmi.o
obj-$(CONFIG_INTEL_MID_POWER_BUTTON) += intel_mid_powerbtn.o obj-$(CONFIG_INTEL_MID_POWER_BUTTON) += intel_mid_powerbtn.o
obj-$(CONFIG_INTEL_OAKTRAIL) += intel_oaktrail.o obj-$(CONFIG_INTEL_OAKTRAIL) += intel_oaktrail.o
obj-$(CONFIG_SAMSUNG_Q10) += samsung-q10.o obj-$(CONFIG_SAMSUNG_Q10) += samsung-q10.o
obj-$(CONFIG_APPLE_GMUX) += apple-gmux.o
This diff is collapsed.
...@@ -244,8 +244,7 @@ static void acerhdf_change_fanstate(int state) ...@@ -244,8 +244,7 @@ static void acerhdf_change_fanstate(int state)
unsigned char cmd; unsigned char cmd;
if (verbose) if (verbose)
pr_notice("fan %s\n", (state == ACERHDF_FAN_OFF) ? pr_notice("fan %s\n", state == ACERHDF_FAN_OFF ? "OFF" : "ON");
"OFF" : "ON");
if ((state != ACERHDF_FAN_OFF) && (state != ACERHDF_FAN_AUTO)) { if ((state != ACERHDF_FAN_OFF) && (state != ACERHDF_FAN_AUTO)) {
pr_err("invalid fan state %d requested, setting to auto!\n", pr_err("invalid fan state %d requested, setting to auto!\n",
...@@ -275,8 +274,7 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal) ...@@ -275,8 +274,7 @@ static void acerhdf_check_param(struct thermal_zone_device *thermal)
interval = ACERHDF_MAX_INTERVAL; interval = ACERHDF_MAX_INTERVAL;
} }
if (verbose) if (verbose)
pr_notice("interval changed to: %d\n", pr_notice("interval changed to: %d\n", interval);
interval);
thermal->polling_delay = interval*1000; thermal->polling_delay = interval*1000;
prev_interval = interval; prev_interval = interval;
} }
...@@ -587,8 +585,8 @@ static int acerhdf_check_hardware(void) ...@@ -587,8 +585,8 @@ static int acerhdf_check_hardware(void)
} }
if (!bios_cfg) { if (!bios_cfg) {
pr_err("unknown (unsupported) BIOS version %s/%s/%s, " pr_err("unknown (unsupported) BIOS version %s/%s/%s, please report, aborting!\n",
"please report, aborting!\n", vendor, product, version); vendor, product, version);
return -EINVAL; return -EINVAL;
} }
...@@ -598,8 +596,7 @@ static int acerhdf_check_hardware(void) ...@@ -598,8 +596,7 @@ static int acerhdf_check_hardware(void)
*/ */
if (!kernelmode) { if (!kernelmode) {
pr_notice("Fan control off, to enable do:\n"); pr_notice("Fan control off, to enable do:\n");
pr_notice("echo -n \"enabled\" > " pr_notice("echo -n \"enabled\" > /sys/class/thermal/thermal_zone0/mode\n");
"/sys/class/thermal/thermal_zone0/mode\n");
} }
return 0; return 0;
......
...@@ -97,9 +97,12 @@ static struct rfkill *amilo_rfkill_dev; ...@@ -97,9 +97,12 @@ static struct rfkill *amilo_rfkill_dev;
static int __devinit amilo_rfkill_probe(struct platform_device *device) static int __devinit amilo_rfkill_probe(struct platform_device *device)
{ {
int rc;
const struct dmi_system_id *system_id = const struct dmi_system_id *system_id =
dmi_first_match(amilo_rfkill_id_table); dmi_first_match(amilo_rfkill_id_table);
int rc;
if (!system_id)
return -ENXIO;
amilo_rfkill_dev = rfkill_alloc(KBUILD_MODNAME, &device->dev, amilo_rfkill_dev = rfkill_alloc(KBUILD_MODNAME, &device->dev,
RFKILL_TYPE_WLAN, RFKILL_TYPE_WLAN,
......
/*
* Gmux driver for Apple laptops
*
* Copyright (C) Canonical Ltd. <seth.forshee@canonical.com>
*
* 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/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/backlight.h>
#include <linux/acpi.h>
#include <linux/pnp.h>
#include <linux/apple_bl.h>
#include <linux/slab.h>
#include <acpi/video.h>
#include <asm/io.h>
struct apple_gmux_data {
unsigned long iostart;
unsigned long iolen;
struct backlight_device *bdev;
};
/*
* gmux port offsets. Many of these are not yet used, but may be in the
* future, and it's useful to have them documented here anyhow.
*/
#define GMUX_PORT_VERSION_MAJOR 0x04
#define GMUX_PORT_VERSION_MINOR 0x05
#define GMUX_PORT_VERSION_RELEASE 0x06
#define GMUX_PORT_SWITCH_DISPLAY 0x10
#define GMUX_PORT_SWITCH_GET_DISPLAY 0x11
#define GMUX_PORT_INTERRUPT_ENABLE 0x14
#define GMUX_PORT_INTERRUPT_STATUS 0x16
#define GMUX_PORT_SWITCH_DDC 0x28
#define GMUX_PORT_SWITCH_EXTERNAL 0x40
#define GMUX_PORT_SWITCH_GET_EXTERNAL 0x41
#define GMUX_PORT_DISCRETE_POWER 0x50
#define GMUX_PORT_MAX_BRIGHTNESS 0x70
#define GMUX_PORT_BRIGHTNESS 0x74
#define GMUX_MIN_IO_LEN (GMUX_PORT_BRIGHTNESS + 4)
#define GMUX_INTERRUPT_ENABLE 0xff
#define GMUX_INTERRUPT_DISABLE 0x00
#define GMUX_INTERRUPT_STATUS_ACTIVE 0
#define GMUX_INTERRUPT_STATUS_DISPLAY (1 << 0)
#define GMUX_INTERRUPT_STATUS_POWER (1 << 2)
#define GMUX_INTERRUPT_STATUS_HOTPLUG (1 << 3)
#define GMUX_BRIGHTNESS_MASK 0x00ffffff
#define GMUX_MAX_BRIGHTNESS GMUX_BRIGHTNESS_MASK
static inline u8 gmux_read8(struct apple_gmux_data *gmux_data, int port)
{
return inb(gmux_data->iostart + port);
}
static inline void gmux_write8(struct apple_gmux_data *gmux_data, int port,
u8 val)
{
outb(val, gmux_data->iostart + port);
}
static inline u32 gmux_read32(struct apple_gmux_data *gmux_data, int port)
{
return inl(gmux_data->iostart + port);
}
static int gmux_get_brightness(struct backlight_device *bd)
{
struct apple_gmux_data *gmux_data = bl_get_data(bd);
return gmux_read32(gmux_data, GMUX_PORT_BRIGHTNESS) &
GMUX_BRIGHTNESS_MASK;
}
static int gmux_update_status(struct backlight_device *bd)
{
struct apple_gmux_data *gmux_data = bl_get_data(bd);
u32 brightness = bd->props.brightness;
/*
* Older gmux versions require writing out lower bytes first then
* setting the upper byte to 0 to flush the values. Newer versions
* accept a single u32 write, but the old method also works, so we
* just use the old method for all gmux versions.
*/
gmux_write8(gmux_data, GMUX_PORT_BRIGHTNESS, brightness);
gmux_write8(gmux_data, GMUX_PORT_BRIGHTNESS + 1, brightness >> 8);
gmux_write8(gmux_data, GMUX_PORT_BRIGHTNESS + 2, brightness >> 16);
gmux_write8(gmux_data, GMUX_PORT_BRIGHTNESS + 3, 0);
return 0;
}
static const struct backlight_ops gmux_bl_ops = {
.get_brightness = gmux_get_brightness,
.update_status = gmux_update_status,
};
static int __devinit gmux_probe(struct pnp_dev *pnp,
const struct pnp_device_id *id)
{
struct apple_gmux_data *gmux_data;
struct resource *res;
struct backlight_properties props;
struct backlight_device *bdev;
u8 ver_major, ver_minor, ver_release;
int ret = -ENXIO;
gmux_data = kzalloc(sizeof(*gmux_data), GFP_KERNEL);
if (!gmux_data)
return -ENOMEM;
pnp_set_drvdata(pnp, gmux_data);
res = pnp_get_resource(pnp, IORESOURCE_IO, 0);
if (!res) {
pr_err("Failed to find gmux I/O resource\n");
goto err_free;
}
gmux_data->iostart = res->start;
gmux_data->iolen = res->end - res->start;
if (gmux_data->iolen < GMUX_MIN_IO_LEN) {
pr_err("gmux I/O region too small (%lu < %u)\n",
gmux_data->iolen, GMUX_MIN_IO_LEN);
goto err_free;
}
if (!request_region(gmux_data->iostart, gmux_data->iolen,
"Apple gmux")) {
pr_err("gmux I/O already in use\n");
goto err_free;
}
/*
* On some machines the gmux is in ACPI even thought the machine
* doesn't really have a gmux. Check for invalid version information
* to detect this.
*/
ver_major = gmux_read8(gmux_data, GMUX_PORT_VERSION_MAJOR);
ver_minor = gmux_read8(gmux_data, GMUX_PORT_VERSION_MINOR);
ver_release = gmux_read8(gmux_data, GMUX_PORT_VERSION_RELEASE);
if (ver_major == 0xff && ver_minor == 0xff && ver_release == 0xff) {
pr_info("gmux device not present\n");
ret = -ENODEV;
goto err_release;
}
pr_info("Found gmux version %d.%d.%d\n", ver_major, ver_minor,
ver_release);
memset(&props, 0, sizeof(props));
props.type = BACKLIGHT_PLATFORM;
props.max_brightness = gmux_read32(gmux_data, GMUX_PORT_MAX_BRIGHTNESS);
/*
* Currently it's assumed that the maximum brightness is less than
* 2^24 for compatibility with old gmux versions. Cap the max
* brightness at this value, but print a warning if the hardware
* reports something higher so that it can be fixed.
*/
if (WARN_ON(props.max_brightness > GMUX_MAX_BRIGHTNESS))
props.max_brightness = GMUX_MAX_BRIGHTNESS;
bdev = backlight_device_register("gmux_backlight", &pnp->dev,
gmux_data, &gmux_bl_ops, &props);
if (IS_ERR(bdev)) {
ret = PTR_ERR(bdev);
goto err_release;
}
gmux_data->bdev = bdev;
bdev->props.brightness = gmux_get_brightness(bdev);
backlight_update_status(bdev);
/*
* The backlight situation on Macs is complicated. If the gmux is
* present it's the best choice, because it always works for
* backlight control and supports more levels than other options.
* Disable the other backlight choices.
*/
acpi_video_unregister();
apple_bl_unregister();
return 0;
err_release:
release_region(gmux_data->iostart, gmux_data->iolen);
err_free:
kfree(gmux_data);
return ret;
}
static void __devexit gmux_remove(struct pnp_dev *pnp)
{
struct apple_gmux_data *gmux_data = pnp_get_drvdata(pnp);
backlight_device_unregister(gmux_data->bdev);
release_region(gmux_data->iostart, gmux_data->iolen);
kfree(gmux_data);
acpi_video_register();
apple_bl_register();
}
static const struct pnp_device_id gmux_device_ids[] = {
{"APP000B", 0},
{"", 0}
};
static struct pnp_driver gmux_pnp_driver = {
.name = "apple-gmux",
.probe = gmux_probe,
.remove = __devexit_p(gmux_remove),
.id_table = gmux_device_ids,
};
static int __init apple_gmux_init(void)
{
return pnp_register_driver(&gmux_pnp_driver);
}
static void __exit apple_gmux_exit(void)
{
pnp_unregister_driver(&gmux_pnp_driver);
}
module_init(apple_gmux_init);
module_exit(apple_gmux_exit);
MODULE_AUTHOR("Seth Forshee <seth.forshee@canonical.com>");
MODULE_DESCRIPTION("Apple Gmux Driver");
MODULE_LICENSE("GPL");
MODULE_DEVICE_TABLE(pnp, gmux_device_ids);
This diff is collapsed.
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/input.h> #include <linux/input.h>
#include <linux/input/sparse-keymap.h> #include <linux/input/sparse-keymap.h>
#include <linux/fb.h>
#include "asus-wmi.h" #include "asus-wmi.h"
...@@ -51,9 +52,14 @@ static uint wapf; ...@@ -51,9 +52,14 @@ static uint wapf;
module_param(wapf, uint, 0444); module_param(wapf, uint, 0444);
MODULE_PARM_DESC(wapf, "WAPF value"); MODULE_PARM_DESC(wapf, "WAPF value");
static struct quirk_entry quirk_asus_unknown = {
};
static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver) static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
{ {
driver->wapf = wapf; driver->quirks = &quirk_asus_unknown;
driver->quirks->wapf = wapf;
driver->panel_power = FB_BLANK_UNBLANK;
} }
static const struct key_entry asus_nb_wmi_keymap[] = { static const struct key_entry asus_nb_wmi_keymap[] = {
...@@ -70,6 +76,8 @@ static const struct key_entry asus_nb_wmi_keymap[] = { ...@@ -70,6 +76,8 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
{ KE_KEY, 0x50, { KEY_EMAIL } }, { KE_KEY, 0x50, { KEY_EMAIL } },
{ KE_KEY, 0x51, { KEY_WWW } }, { KE_KEY, 0x51, { KEY_WWW } },
{ KE_KEY, 0x55, { KEY_CALC } }, { KE_KEY, 0x55, { KEY_CALC } },
{ KE_IGNORE, 0x57, }, /* Battery mode */
{ KE_IGNORE, 0x58, }, /* AC mode */
{ KE_KEY, 0x5C, { KEY_F15 } }, /* Power Gear key */ { KE_KEY, 0x5C, { KEY_F15 } }, /* Power Gear key */
{ KE_KEY, 0x5D, { KEY_WLAN } }, /* Wireless console Toggle */ { KE_KEY, 0x5D, { KEY_WLAN } }, /* Wireless console Toggle */
{ KE_KEY, 0x5E, { KEY_WLAN } }, /* Wireless console Enable */ { KE_KEY, 0x5E, { KEY_WLAN } }, /* Wireless console Enable */
...@@ -99,7 +107,7 @@ static struct asus_wmi_driver asus_nb_wmi_driver = { ...@@ -99,7 +107,7 @@ static struct asus_wmi_driver asus_nb_wmi_driver = {
.keymap = asus_nb_wmi_keymap, .keymap = asus_nb_wmi_keymap,
.input_name = "Asus WMI hotkeys", .input_name = "Asus WMI hotkeys",
.input_phys = ASUS_NB_WMI_FILE "/input0", .input_phys = ASUS_NB_WMI_FILE "/input0",
.quirks = asus_nb_wmi_quirks, .detect_quirks = asus_nb_wmi_quirks,
}; };
......
...@@ -411,7 +411,7 @@ static int kbd_led_read(struct asus_wmi *asus, int *level, int *env) ...@@ -411,7 +411,7 @@ static int kbd_led_read(struct asus_wmi *asus, int *level, int *env)
if (retval >= 0) { if (retval >= 0) {
if (level) if (level)
*level = retval & 0x80 ? retval & 0x7F : 0; *level = retval & 0x7F;
if (env) if (env)
*env = (retval >> 8) & 0x7F; *env = (retval >> 8) & 0x7F;
retval = 0; retval = 0;
...@@ -784,7 +784,8 @@ static int asus_new_rfkill(struct asus_wmi *asus, ...@@ -784,7 +784,8 @@ static int asus_new_rfkill(struct asus_wmi *asus,
arfkill->dev_id = dev_id; arfkill->dev_id = dev_id;
arfkill->asus = asus; arfkill->asus = asus;
if (dev_id == ASUS_WMI_DEVID_WLAN && asus->driver->hotplug_wireless) if (dev_id == ASUS_WMI_DEVID_WLAN &&
asus->driver->quirks->hotplug_wireless)
*rfkill = rfkill_alloc(name, &asus->platform_device->dev, type, *rfkill = rfkill_alloc(name, &asus->platform_device->dev, type,
&asus_rfkill_wlan_ops, arfkill); &asus_rfkill_wlan_ops, arfkill);
else else
...@@ -895,7 +896,7 @@ static int asus_wmi_rfkill_init(struct asus_wmi *asus) ...@@ -895,7 +896,7 @@ static int asus_wmi_rfkill_init(struct asus_wmi *asus)
if (result && result != -ENODEV) if (result && result != -ENODEV)
goto exit; goto exit;
if (!asus->driver->hotplug_wireless) if (!asus->driver->quirks->hotplug_wireless)
goto exit; goto exit;
result = asus_setup_pci_hotplug(asus); result = asus_setup_pci_hotplug(asus);
...@@ -1075,7 +1076,12 @@ static int asus_wmi_hwmon_init(struct asus_wmi *asus) ...@@ -1075,7 +1076,12 @@ static int asus_wmi_hwmon_init(struct asus_wmi *asus)
*/ */
static int read_backlight_power(struct asus_wmi *asus) static int read_backlight_power(struct asus_wmi *asus)
{ {
int ret = asus_wmi_get_devstate_simple(asus, ASUS_WMI_DEVID_BACKLIGHT); int ret;
if (asus->driver->quirks->store_backlight_power)
ret = !asus->driver->panel_power;
else
ret = asus_wmi_get_devstate_simple(asus,
ASUS_WMI_DEVID_BACKLIGHT);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -1116,26 +1122,51 @@ static int read_brightness(struct backlight_device *bd) ...@@ -1116,26 +1122,51 @@ static int read_brightness(struct backlight_device *bd)
return retval & ASUS_WMI_DSTS_BRIGHTNESS_MASK; return retval & ASUS_WMI_DSTS_BRIGHTNESS_MASK;
} }
static int update_bl_status(struct backlight_device *bd) static u32 get_scalar_command(struct backlight_device *bd)
{ {
struct asus_wmi *asus = bl_get_data(bd); struct asus_wmi *asus = bl_get_data(bd);
u32 ctrl_param; u32 ctrl_param = 0;
int power, err;
ctrl_param = bd->props.brightness; if ((asus->driver->brightness < bd->props.brightness) ||
bd->props.brightness == bd->props.max_brightness)
ctrl_param = 0x00008001;
else if ((asus->driver->brightness > bd->props.brightness) ||
bd->props.brightness == 0)
ctrl_param = 0x00008000;
err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS, asus->driver->brightness = bd->props.brightness;
ctrl_param, NULL);
if (err < 0) return ctrl_param;
return err; }
static int update_bl_status(struct backlight_device *bd)
{
struct asus_wmi *asus = bl_get_data(bd);
u32 ctrl_param;
int power, err = 0;
power = read_backlight_power(asus); power = read_backlight_power(asus);
if (power != -ENODEV && bd->props.power != power) { if (power != -ENODEV && bd->props.power != power) {
ctrl_param = !!(bd->props.power == FB_BLANK_UNBLANK); ctrl_param = !!(bd->props.power == FB_BLANK_UNBLANK);
err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT, err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BACKLIGHT,
ctrl_param, NULL); ctrl_param, NULL);
if (asus->driver->quirks->store_backlight_power)
asus->driver->panel_power = bd->props.power;
/* When using scalar brightness, updating the brightness
* will mess with the backlight power */
if (asus->driver->quirks->scalar_panel_brightness)
return err;
} }
if (asus->driver->quirks->scalar_panel_brightness)
ctrl_param = get_scalar_command(bd);
else
ctrl_param = bd->props.brightness;
err = asus_wmi_set_devstate(ASUS_WMI_DEVID_BRIGHTNESS,
ctrl_param, NULL);
return err; return err;
} }
...@@ -1196,10 +1227,15 @@ static int asus_wmi_backlight_init(struct asus_wmi *asus) ...@@ -1196,10 +1227,15 @@ static int asus_wmi_backlight_init(struct asus_wmi *asus)
asus->backlight_device = bd; asus->backlight_device = bd;
if (asus->driver->quirks->store_backlight_power)
asus->driver->panel_power = power;
bd->props.brightness = read_brightness(bd); bd->props.brightness = read_brightness(bd);
bd->props.power = power; bd->props.power = power;
backlight_update_status(bd); backlight_update_status(bd);
asus->driver->brightness = bd->props.brightness;
return 0; return 0;
} }
...@@ -1441,9 +1477,9 @@ static int asus_wmi_platform_init(struct asus_wmi *asus) ...@@ -1441,9 +1477,9 @@ static int asus_wmi_platform_init(struct asus_wmi *asus)
/* CWAP allow to define the behavior of the Fn+F2 key, /* CWAP allow to define the behavior of the Fn+F2 key,
* this method doesn't seems to be present on Eee PCs */ * this method doesn't seems to be present on Eee PCs */
if (asus->driver->wapf >= 0) if (asus->driver->quirks->wapf >= 0)
asus_wmi_set_devstate(ASUS_WMI_DEVID_CWAP, asus_wmi_set_devstate(ASUS_WMI_DEVID_CWAP,
asus->driver->wapf, NULL); asus->driver->quirks->wapf, NULL);
return asus_wmi_sysfs_init(asus->platform_device); return asus_wmi_sysfs_init(asus->platform_device);
} }
...@@ -1622,8 +1658,8 @@ static int asus_wmi_add(struct platform_device *pdev) ...@@ -1622,8 +1658,8 @@ static int asus_wmi_add(struct platform_device *pdev)
wdrv->platform_device = pdev; wdrv->platform_device = pdev;
platform_set_drvdata(asus->platform_device, asus); platform_set_drvdata(asus->platform_device, asus);
if (wdrv->quirks) if (wdrv->detect_quirks)
wdrv->quirks(asus->driver); wdrv->detect_quirks(asus->driver);
err = asus_wmi_platform_init(asus); err = asus_wmi_platform_init(asus);
if (err) if (err)
......
...@@ -35,9 +35,16 @@ struct module; ...@@ -35,9 +35,16 @@ struct module;
struct key_entry; struct key_entry;
struct asus_wmi; struct asus_wmi;
struct asus_wmi_driver { struct quirk_entry {
bool hotplug_wireless; bool hotplug_wireless;
bool scalar_panel_brightness;
bool store_backlight_power;
int wapf; int wapf;
};
struct asus_wmi_driver {
int brightness;
int panel_power;
const char *name; const char *name;
struct module *owner; struct module *owner;
...@@ -47,13 +54,14 @@ struct asus_wmi_driver { ...@@ -47,13 +54,14 @@ struct asus_wmi_driver {
const struct key_entry *keymap; const struct key_entry *keymap;
const char *input_name; const char *input_name;
const char *input_phys; const char *input_phys;
struct quirk_entry *quirks;
/* Returns new code, value, and autorelease values in arguments. /* Returns new code, value, and autorelease values in arguments.
* Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */ * Return ASUS_WMI_KEY_IGNORE in code if event should be ignored. */
void (*key_filter) (struct asus_wmi_driver *driver, int *code, void (*key_filter) (struct asus_wmi_driver *driver, int *code,
unsigned int *value, bool *autorelease); unsigned int *value, bool *autorelease);
int (*probe) (struct platform_device *device); int (*probe) (struct platform_device *device);
void (*quirks) (struct asus_wmi_driver *driver); void (*detect_quirks) (struct asus_wmi_driver *driver);
struct platform_driver platform_driver; struct platform_driver platform_driver;
struct platform_device *platform_device; struct platform_device *platform_device;
......
This diff is collapsed.
...@@ -882,6 +882,7 @@ static struct dmi_system_id __initdata compal_dmi_table[] = { ...@@ -882,6 +882,7 @@ static struct dmi_system_id __initdata compal_dmi_table[] = {
}, },
{ } { }
}; };
MODULE_DEVICE_TABLE(dmi, compal_dmi_table);
static void initialize_power_supply_data(struct compal_data *data) static void initialize_power_supply_data(struct compal_data *data)
{ {
...@@ -1097,16 +1098,3 @@ MODULE_AUTHOR("Roald Frederickx (roald.frederickx@gmail.com)"); ...@@ -1097,16 +1098,3 @@ MODULE_AUTHOR("Roald Frederickx (roald.frederickx@gmail.com)");
MODULE_DESCRIPTION("Compal Laptop Support"); MODULE_DESCRIPTION("Compal Laptop Support");
MODULE_VERSION(DRIVER_VERSION); MODULE_VERSION(DRIVER_VERSION);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("dmi:*:rnIFL90:rvrIFT00:*");
MODULE_ALIAS("dmi:*:rnIFL90:rvrREFERENCE:*");
MODULE_ALIAS("dmi:*:rnIFL91:rvrIFT00:*");
MODULE_ALIAS("dmi:*:rnJFL92:rvrIFT00:*");
MODULE_ALIAS("dmi:*:rnIFT00:rvrIFT00:*");
MODULE_ALIAS("dmi:*:rnJHL90:rvrREFERENCE:*");
MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron910:*");
MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1010:*");
MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1011:*");
MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1012:*");
MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1110:*");
MODULE_ALIAS("dmi:*:svnDellInc.:pnInspiron1210:*");
...@@ -117,6 +117,7 @@ static const struct dmi_system_id __initdata dell_device_table[] = { ...@@ -117,6 +117,7 @@ static const struct dmi_system_id __initdata dell_device_table[] = {
}, },
{ } { }
}; };
MODULE_DEVICE_TABLE(dmi, dell_device_table);
static struct dmi_system_id __devinitdata dell_blacklist[] = { static struct dmi_system_id __devinitdata dell_blacklist[] = {
/* Supported by compal-laptop */ /* Supported by compal-laptop */
...@@ -184,6 +185,33 @@ static struct dmi_system_id __devinitdata dell_quirks[] = { ...@@ -184,6 +185,33 @@ static struct dmi_system_id __devinitdata dell_quirks[] = {
}, },
.driver_data = &quirk_dell_vostro_v130, .driver_data = &quirk_dell_vostro_v130,
}, },
{
.callback = dmi_matched,
.ident = "Dell Vostro 3555",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Vostro 3555"),
},
.driver_data = &quirk_dell_vostro_v130,
},
{
.callback = dmi_matched,
.ident = "Dell Inspiron N311z",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron N311z"),
},
.driver_data = &quirk_dell_vostro_v130,
},
{
.callback = dmi_matched,
.ident = "Dell Inspiron M5110",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron M5110"),
},
.driver_data = &quirk_dell_vostro_v130,
},
}; };
static struct calling_interface_buffer *buffer; static struct calling_interface_buffer *buffer;
...@@ -236,9 +264,7 @@ static void __init find_tokens(const struct dmi_header *dm, void *dummy) ...@@ -236,9 +264,7 @@ static void __init find_tokens(const struct dmi_header *dm, void *dummy)
{ {
switch (dm->type) { switch (dm->type) {
case 0xd4: /* Indexed IO */ case 0xd4: /* Indexed IO */
break;
case 0xd5: /* Protected Area Type 1 */ case 0xd5: /* Protected Area Type 1 */
break;
case 0xd6: /* Protected Area Type 2 */ case 0xd6: /* Protected Area Type 2 */
break; break;
case 0xda: /* Calling interface */ case 0xda: /* Calling interface */
...@@ -615,6 +641,7 @@ static void touchpad_led_set(struct led_classdev *led_cdev, ...@@ -615,6 +641,7 @@ static void touchpad_led_set(struct led_classdev *led_cdev,
static struct led_classdev touchpad_led = { static struct led_classdev touchpad_led = {
.name = "dell-laptop::touchpad", .name = "dell-laptop::touchpad",
.brightness_set = touchpad_led_set, .brightness_set = touchpad_led_set,
.flags = LED_CORE_SUSPENDRESUME,
}; };
static int __devinit touchpad_led_init(struct device *dev) static int __devinit touchpad_led_init(struct device *dev)
...@@ -794,6 +821,3 @@ module_exit(dell_exit); ...@@ -794,6 +821,3 @@ module_exit(dell_exit);
MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>"); MODULE_AUTHOR("Matthew Garrett <mjg@redhat.com>");
MODULE_DESCRIPTION("Dell laptop driver"); MODULE_DESCRIPTION("Dell laptop driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("dmi:*svnDellInc.:*:ct8:*");
MODULE_ALIAS("dmi:*svnDellInc.:*:ct9:*");
MODULE_ALIAS("dmi:*svnDellComputerCorporation.:*:ct8:*");
...@@ -1251,6 +1251,14 @@ static void eeepc_input_exit(struct eeepc_laptop *eeepc) ...@@ -1251,6 +1251,14 @@ static void eeepc_input_exit(struct eeepc_laptop *eeepc)
/* /*
* ACPI driver * ACPI driver
*/ */
static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event)
{
if (!eeepc->inputdev)
return ;
if (!sparse_keymap_report_event(eeepc->inputdev, event, 1, true))
pr_info("Unknown key %x pressed\n", event);
}
static void eeepc_acpi_notify(struct acpi_device *device, u32 event) static void eeepc_acpi_notify(struct acpi_device *device, u32 event)
{ {
struct eeepc_laptop *eeepc = acpi_driver_data(device); struct eeepc_laptop *eeepc = acpi_driver_data(device);
...@@ -1287,12 +1295,11 @@ static void eeepc_acpi_notify(struct acpi_device *device, u32 event) ...@@ -1287,12 +1295,11 @@ static void eeepc_acpi_notify(struct acpi_device *device, u32 event)
* event will be desired value (or else ignored) * event will be desired value (or else ignored)
*/ */
} }
sparse_keymap_report_event(eeepc->inputdev, event, eeepc_input_notify(eeepc, event);
1, true);
} }
} else { } else {
/* Everything else is a bona-fide keypress event */ /* Everything else is a bona-fide keypress event */
sparse_keymap_report_event(eeepc->inputdev, event, 1, true); eeepc_input_notify(eeepc, event);
} }
} }
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <linux/input.h> #include <linux/input.h>
#include <linux/input/sparse-keymap.h> #include <linux/input/sparse-keymap.h>
#include <linux/dmi.h> #include <linux/dmi.h>
#include <linux/fb.h>
#include <acpi/acpi_bus.h> #include <acpi/acpi_bus.h>
#include "asus-wmi.h" #include "asus-wmi.h"
...@@ -84,9 +85,81 @@ static const struct key_entry eeepc_wmi_keymap[] = { ...@@ -84,9 +85,81 @@ static const struct key_entry eeepc_wmi_keymap[] = {
{ KE_KEY, 0xed, { KEY_CAMERA_DOWN } }, { KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
{ KE_KEY, 0xee, { KEY_CAMERA_LEFT } }, { KE_KEY, 0xee, { KEY_CAMERA_LEFT } },
{ KE_KEY, 0xef, { KEY_CAMERA_RIGHT } }, { KE_KEY, 0xef, { KEY_CAMERA_RIGHT } },
{ KE_KEY, 0xf3, { KEY_MENU } },
{ KE_KEY, 0xf5, { KEY_HOMEPAGE } },
{ KE_KEY, 0xf6, { KEY_ESC } },
{ KE_END, 0}, { KE_END, 0},
}; };
static struct quirk_entry quirk_asus_unknown = {
};
static struct quirk_entry quirk_asus_1000h = {
.hotplug_wireless = true,
};
static struct quirk_entry quirk_asus_et2012_type1 = {
.store_backlight_power = true,
};
static struct quirk_entry quirk_asus_et2012_type3 = {
.scalar_panel_brightness = true,
.store_backlight_power = true,
};
static struct quirk_entry *quirks;
static void et2012_quirks(void)
{
const struct dmi_device *dev = NULL;
char oemstring[30];
while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, NULL, dev))) {
if (sscanf(dev->name, "AEMS%24c", oemstring) == 1) {
if (oemstring[18] == '1')
quirks = &quirk_asus_et2012_type1;
else if (oemstring[18] == '3')
quirks = &quirk_asus_et2012_type3;
break;
}
}
}
static int dmi_matched(const struct dmi_system_id *dmi)
{
char *model;
quirks = dmi->driver_data;
model = (char *)dmi->matches[1].substr;
if (unlikely(strncmp(model, "ET2012", 6) == 0))
et2012_quirks();
return 1;
}
static struct dmi_system_id asus_quirks[] = {
{
.callback = dmi_matched,
.ident = "ASUSTeK Computer INC. 1000H",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "1000H"),
},
.driver_data = &quirk_asus_1000h,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK Computer INC. ET2012E/I",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "ET2012"),
},
.driver_data = &quirk_asus_unknown,
},
{},
};
static void eeepc_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code, static void eeepc_wmi_key_filter(struct asus_wmi_driver *asus_wmi, int *code,
unsigned int *value, bool *autorelease) unsigned int *value, bool *autorelease)
{ {
...@@ -141,33 +214,16 @@ static int eeepc_wmi_probe(struct platform_device *pdev) ...@@ -141,33 +214,16 @@ static int eeepc_wmi_probe(struct platform_device *pdev)
return 0; return 0;
} }
static void eeepc_dmi_check(struct asus_wmi_driver *driver) static void eeepc_wmi_quirks(struct asus_wmi_driver *driver)
{ {
const char *model; quirks = &quirk_asus_unknown;
quirks->hotplug_wireless = hotplug_wireless;
model = dmi_get_system_info(DMI_PRODUCT_NAME); dmi_check_system(asus_quirks);
if (!model)
return;
/* driver->quirks = quirks;
* Whitelist for wlan hotplug driver->quirks->wapf = -1;
* driver->panel_power = FB_BLANK_UNBLANK;
* Asus 1000H needs the current hotplug code to handle
* Fn+F2 correctly. We may add other Asus here later, but
* it seems that most of the laptops supported by asus-wmi
* don't need to be on this list
*/
if (strcmp(model, "1000H") == 0) {
driver->hotplug_wireless = true;
pr_info("wlan hotplug enabled\n");
}
}
static void eeepc_wmi_quirks(struct asus_wmi_driver *driver)
{
driver->hotplug_wireless = hotplug_wireless;
driver->wapf = -1;
eeepc_dmi_check(driver);
} }
static struct asus_wmi_driver asus_wmi_driver = { static struct asus_wmi_driver asus_wmi_driver = {
...@@ -179,7 +235,7 @@ static struct asus_wmi_driver asus_wmi_driver = { ...@@ -179,7 +235,7 @@ static struct asus_wmi_driver asus_wmi_driver = {
.input_phys = EEEPC_WMI_FILE "/input0", .input_phys = EEEPC_WMI_FILE "/input0",
.key_filter = eeepc_wmi_key_filter, .key_filter = eeepc_wmi_key_filter,
.probe = eeepc_wmi_probe, .probe = eeepc_wmi_probe,
.quirks = eeepc_wmi_quirks, .detect_quirks = eeepc_wmi_quirks,
}; };
......
...@@ -375,7 +375,7 @@ static ssize_t hdaps_variance_show(struct device *dev, ...@@ -375,7 +375,7 @@ static ssize_t hdaps_variance_show(struct device *dev,
static ssize_t hdaps_temp1_show(struct device *dev, static ssize_t hdaps_temp1_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
u8 temp; u8 uninitialized_var(temp);
int ret; int ret;
ret = hdaps_readb_one(HDAPS_PORT_TEMP1, &temp); ret = hdaps_readb_one(HDAPS_PORT_TEMP1, &temp);
...@@ -388,7 +388,7 @@ static ssize_t hdaps_temp1_show(struct device *dev, ...@@ -388,7 +388,7 @@ static ssize_t hdaps_temp1_show(struct device *dev,
static ssize_t hdaps_temp2_show(struct device *dev, static ssize_t hdaps_temp2_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
u8 temp; u8 uninitialized_var(temp);
int ret; int ret;
ret = hdaps_readb_one(HDAPS_PORT_TEMP2, &temp); ret = hdaps_readb_one(HDAPS_PORT_TEMP2, &temp);
......
...@@ -142,17 +142,7 @@ static struct platform_driver mfld_pb_driver = { ...@@ -142,17 +142,7 @@ static struct platform_driver mfld_pb_driver = {
.remove = __devexit_p(mfld_pb_remove), .remove = __devexit_p(mfld_pb_remove),
}; };
static int __init mfld_pb_init(void) module_platform_driver(mfld_pb_driver);
{
return platform_driver_register(&mfld_pb_driver);
}
module_init(mfld_pb_init);
static void __exit mfld_pb_exit(void)
{
platform_driver_unregister(&mfld_pb_driver);
}
module_exit(mfld_pb_exit);
MODULE_AUTHOR("Hong Liu <hong.liu@intel.com>"); MODULE_AUTHOR("Hong Liu <hong.liu@intel.com>");
MODULE_DESCRIPTION("Intel Medfield Power Button Driver"); MODULE_DESCRIPTION("Intel Medfield Power Button Driver");
......
...@@ -549,6 +549,7 @@ static int mid_thermal_remove(struct platform_device *pdev) ...@@ -549,6 +549,7 @@ static int mid_thermal_remove(struct platform_device *pdev)
static const struct platform_device_id therm_id_table[] = { static const struct platform_device_id therm_id_table[] = {
{ DRIVER_NAME, 1 }, { DRIVER_NAME, 1 },
{ "msic_thermal", 1 },
{ } { }
}; };
...@@ -564,18 +565,7 @@ static struct platform_driver mid_thermal_driver = { ...@@ -564,18 +565,7 @@ static struct platform_driver mid_thermal_driver = {
.id_table = therm_id_table, .id_table = therm_id_table,
}; };
static int __init mid_thermal_module_init(void) module_platform_driver(mid_thermal_driver);
{
return platform_driver_register(&mid_thermal_driver);
}
static void __exit mid_thermal_module_exit(void)
{
platform_driver_unregister(&mid_thermal_driver);
}
module_init(mid_thermal_module_init);
module_exit(mid_thermal_module_exit);
MODULE_AUTHOR("Durgadoss R <durgadoss.r@intel.com>"); MODULE_AUTHOR("Durgadoss R <durgadoss.r@intel.com>");
MODULE_DESCRIPTION("Intel Medfield Platform Thermal Driver"); MODULE_DESCRIPTION("Intel Medfield Platform Thermal Driver");
......
...@@ -313,6 +313,7 @@ static struct dmi_system_id __initdata oaktrail_dmi_table[] = { ...@@ -313,6 +313,7 @@ static struct dmi_system_id __initdata oaktrail_dmi_table[] = {
}, },
{ } { }
}; };
MODULE_DEVICE_TABLE(dmi, oaktrail_dmi_table);
static int __init oaktrail_init(void) static int __init oaktrail_init(void)
{ {
...@@ -394,4 +395,3 @@ MODULE_AUTHOR("Yin Kangkai (kangkai.yin@intel.com)"); ...@@ -394,4 +395,3 @@ MODULE_AUTHOR("Yin Kangkai (kangkai.yin@intel.com)");
MODULE_DESCRIPTION("Intel Oaktrail Platform ACPI Extras"); MODULE_DESCRIPTION("Intel Oaktrail Platform ACPI Extras");
MODULE_VERSION(DRIVER_VERSION); MODULE_VERSION(DRIVER_VERSION);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("dmi:*:svnIntelCorporation:pnOakTrailplatform:*");
This diff is collapsed.
...@@ -127,7 +127,7 @@ MODULE_PARM_DESC(minor, ...@@ -127,7 +127,7 @@ MODULE_PARM_DESC(minor,
"default is -1 (automatic)"); "default is -1 (automatic)");
#endif #endif
static int kbd_backlight; /* = 1 */ static int kbd_backlight = 1;
module_param(kbd_backlight, int, 0444); module_param(kbd_backlight, int, 0444);
MODULE_PARM_DESC(kbd_backlight, MODULE_PARM_DESC(kbd_backlight,
"set this to 0 to disable keyboard backlight, " "set this to 0 to disable keyboard backlight, "
...@@ -347,6 +347,7 @@ static void sony_laptop_report_input_event(u8 event) ...@@ -347,6 +347,7 @@ static void sony_laptop_report_input_event(u8 event)
struct input_dev *jog_dev = sony_laptop_input.jog_dev; struct input_dev *jog_dev = sony_laptop_input.jog_dev;
struct input_dev *key_dev = sony_laptop_input.key_dev; struct input_dev *key_dev = sony_laptop_input.key_dev;
struct sony_laptop_keypress kp = { NULL }; struct sony_laptop_keypress kp = { NULL };
int scancode = -1;
if (event == SONYPI_EVENT_FNKEY_RELEASED || if (event == SONYPI_EVENT_FNKEY_RELEASED ||
event == SONYPI_EVENT_ANYBUTTON_RELEASED) { event == SONYPI_EVENT_ANYBUTTON_RELEASED) {
...@@ -380,8 +381,8 @@ static void sony_laptop_report_input_event(u8 event) ...@@ -380,8 +381,8 @@ static void sony_laptop_report_input_event(u8 event)
dprintk("sony_laptop_report_input_event, event not known: %d\n", event); dprintk("sony_laptop_report_input_event, event not known: %d\n", event);
break; break;
} }
if (sony_laptop_input_index[event] != -1) { if ((scancode = sony_laptop_input_index[event]) != -1) {
kp.key = sony_laptop_input_keycode_map[sony_laptop_input_index[event]]; kp.key = sony_laptop_input_keycode_map[scancode];
if (kp.key != KEY_UNKNOWN) if (kp.key != KEY_UNKNOWN)
kp.dev = key_dev; kp.dev = key_dev;
} }
...@@ -389,9 +390,11 @@ static void sony_laptop_report_input_event(u8 event) ...@@ -389,9 +390,11 @@ static void sony_laptop_report_input_event(u8 event)
} }
if (kp.dev) { if (kp.dev) {
/* if we have a scancode we emit it so we can always
remap the key */
if (scancode != -1)
input_event(kp.dev, EV_MSC, MSC_SCAN, scancode);
input_report_key(kp.dev, kp.key, 1); input_report_key(kp.dev, kp.key, 1);
/* we emit the scancode so we can always remap the key */
input_event(kp.dev, EV_MSC, MSC_SCAN, event);
input_sync(kp.dev); input_sync(kp.dev);
/* schedule key release */ /* schedule key release */
...@@ -466,7 +469,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device) ...@@ -466,7 +469,7 @@ static int sony_laptop_setup_input(struct acpi_device *acpi_device)
jog_dev->name = "Sony Vaio Jogdial"; jog_dev->name = "Sony Vaio Jogdial";
jog_dev->id.bustype = BUS_ISA; jog_dev->id.bustype = BUS_ISA;
jog_dev->id.vendor = PCI_VENDOR_ID_SONY; jog_dev->id.vendor = PCI_VENDOR_ID_SONY;
key_dev->dev.parent = &acpi_device->dev; jog_dev->dev.parent = &acpi_device->dev;
input_set_capability(jog_dev, EV_KEY, BTN_MIDDLE); input_set_capability(jog_dev, EV_KEY, BTN_MIDDLE);
input_set_capability(jog_dev, EV_REL, REL_WHEEL); input_set_capability(jog_dev, EV_REL, REL_WHEEL);
......
...@@ -8658,7 +8658,7 @@ static int __must_check __init get_thinkpad_model_data( ...@@ -8658,7 +8658,7 @@ static int __must_check __init get_thinkpad_model_data(
} }
s = dmi_get_system_info(DMI_PRODUCT_VERSION); s = dmi_get_system_info(DMI_PRODUCT_VERSION);
if (s && !strnicmp(s, "ThinkPad", 8)) { if (s && !(strnicmp(s, "ThinkPad", 8) && strnicmp(s, "Lenovo", 6))) {
tp->model_str = kstrdup(s, GFP_KERNEL); tp->model_str = kstrdup(s, GFP_KERNEL);
if (!tp->model_str) if (!tp->model_str)
return -ENOMEM; return -ENOMEM;
......
This diff is collapsed.
...@@ -67,19 +67,8 @@ static struct platform_driver xo1_rfkill_driver = { ...@@ -67,19 +67,8 @@ static struct platform_driver xo1_rfkill_driver = {
.remove = __devexit_p(xo1_rfkill_remove), .remove = __devexit_p(xo1_rfkill_remove),
}; };
static int __init xo1_rfkill_init(void) module_platform_driver(xo1_rfkill_driver);
{
return platform_driver_register(&xo1_rfkill_driver);
}
static void __exit xo1_rfkill_exit(void)
{
platform_driver_unregister(&xo1_rfkill_driver);
}
MODULE_AUTHOR("Daniel Drake <dsd@laptop.org>"); MODULE_AUTHOR("Daniel Drake <dsd@laptop.org>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:xo1-rfkill"); MODULE_ALIAS("platform:xo1-rfkill");
module_init(xo1_rfkill_init);
module_exit(xo1_rfkill_exit);
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/pci.h> #include <linux/pci.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/atomic.h>
static struct backlight_device *apple_backlight_device; static struct backlight_device *apple_backlight_device;
...@@ -221,15 +222,33 @@ static struct acpi_driver apple_bl_driver = { ...@@ -221,15 +222,33 @@ static struct acpi_driver apple_bl_driver = {
}, },
}; };
static int __init apple_bl_init(void) static atomic_t apple_bl_registered = ATOMIC_INIT(0);
int apple_bl_register(void)
{ {
if (atomic_xchg(&apple_bl_registered, 1) == 0)
return acpi_bus_register_driver(&apple_bl_driver); return acpi_bus_register_driver(&apple_bl_driver);
return 0;
} }
EXPORT_SYMBOL_GPL(apple_bl_register);
static void __exit apple_bl_exit(void) void apple_bl_unregister(void)
{ {
if (atomic_xchg(&apple_bl_registered, 0) == 1)
acpi_bus_unregister_driver(&apple_bl_driver); acpi_bus_unregister_driver(&apple_bl_driver);
} }
EXPORT_SYMBOL_GPL(apple_bl_unregister);
static int __init apple_bl_init(void)
{
return apple_bl_register();
}
static void __exit apple_bl_exit(void)
{
apple_bl_unregister();
}
module_init(apple_bl_init); module_init(apple_bl_init);
module_exit(apple_bl_exit); module_exit(apple_bl_exit);
......
...@@ -151,6 +151,7 @@ extern int ec_write(u8 addr, u8 val); ...@@ -151,6 +151,7 @@ extern int ec_write(u8 addr, u8 val);
extern int ec_transaction(u8 command, extern int ec_transaction(u8 command,
const u8 *wdata, unsigned wdata_len, const u8 *wdata, unsigned wdata_len,
u8 *rdata, unsigned rdata_len); u8 *rdata, unsigned rdata_len);
extern acpi_handle ec_get_handle(void);
#if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE) #if defined(CONFIG_ACPI_WMI) || defined(CONFIG_ACPI_WMI_MODULE)
......
/*
* apple_bl exported symbols
*/
#ifndef _LINUX_APPLE_BL_H
#define _LINUX_APPLE_BL_H
#ifdef CONFIG_BACKLIGHT_APPLE
extern int apple_bl_register(void);
extern void apple_bl_unregister(void);
#else /* !CONFIG_BACKLIGHT_APPLE */
static inline int apple_bl_register(void)
{
return 0;
}
static inline void apple_bl_unregister(void)
{
}
#endif /* !CONFIG_BACKLIGHT_APPLE */
#endif /* _LINUX_APPLE_BL_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment