Commit 7d3d09b0 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull x86 platform driver updates from Matthew Garrett:
 "Nothing overly dramatic here - improved support for the Classmate,
  some random small fixes and a rework of backlight management to deal
  with some of the more awkward cases."

* 'linux-next' of git://cavan.codon.org.uk/platform-drivers-x86:
  thinkpad_acpi: Free hotkey_keycode_map after unregistering tpacpi_inputdev
  thinkpad_acpi: Fix a memory leak during module exit
  thinkpad_acpi: Flush the workqueue before freeing tpacpi_leds
  dell-laptop: Add 6 machines to touchpad led quirk
  ACER: Fix Smatch double-free issue
  ACER: Fix up sparse warning
  asus-nb-wmi: add some video toggle keys
  asus-nb-wmi: add wapf quirk for ASUS machines
  classmate-laptop: Fix extra keys hardware id.
  classmate-laptop: Add support for Classmate V4 accelerometer.
  asus-wmi: enable resume on lid open
  asus-wmi: control backlight power through WMI, not ACPI
  samsung-laptop: support R40/R41
  acpi/video_detect: blacklist samsung x360
  samsung-laptop: X360 ACPI backlight device is broken
  drivers-platform-x86: use acpi_video_dmi_promote_vendor()
  acpi: add a way to promote/demote vendor backlight drivers
  ACER: Add support for accelerometer sensor
  asus-wmi: use ASUS_WMI_METHODID_DSTS2 as default DSTS ID.
parents 287dc4b7 00d39597
......@@ -29,3 +29,10 @@ KernelVersion: 2.6.39
Contact: "Corentin Chary" <corentincj@iksaif.net>
Description:
Control the card touchpad. 1 means on, 0 means off.
What: /sys/devices/platform/<platform>/lid_resume
Date: May 2012
KernelVersion: 3.5
Contact: "AceLan Kao" <acelan.kao@canonical.com>
Description:
Resume on lid open. 1 means on, 0 means off.
......@@ -132,6 +132,33 @@ find_video(acpi_handle handle, u32 lvl, void *context, void **rv)
return AE_OK;
}
/* Force to use vendor driver when the ACPI device is known to be
* buggy */
static int video_detect_force_vendor(const struct dmi_system_id *d)
{
acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
return 0;
}
static struct dmi_system_id video_detect_dmi_table[] = {
/* On Samsung X360, the BIOS will set a flag (VDRV) if generic
* ACPI backlight device is used. This flag will definitively break
* the backlight interface (even the vendor interface) untill next
* reboot. It's why we should prevent video.ko from being used here
* and we can't rely on a later call to acpi_video_unregister().
*/
{
.callback = video_detect_force_vendor,
.ident = "X360",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
DMI_MATCH(DMI_BOARD_NAME, "X360"),
},
},
{ },
};
/*
* Returns the video capabilities of a specific ACPI graphics device
*
......@@ -164,6 +191,8 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
* ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
*}
*/
dmi_check_system(video_detect_dmi_table);
} else {
status = acpi_bus_get_device(graphics_handle, &tmp_dev);
if (ACPI_FAILURE(status)) {
......@@ -182,8 +211,7 @@ long acpi_video_get_capabilities(acpi_handle graphics_handle)
}
EXPORT_SYMBOL(acpi_video_get_capabilities);
/* Returns true if video.ko can do backlight switching */
int acpi_video_backlight_support(void)
static void acpi_video_caps_check(void)
{
/*
* We must check whether the ACPI graphics device is physically plugged
......@@ -191,6 +219,34 @@ int acpi_video_backlight_support(void)
*/
if (!acpi_video_caps_checked)
acpi_video_get_capabilities(NULL);
}
/* Promote the vendor interface instead of the generic video module.
* This function allow DMI blacklists to be implemented by externals
* platform drivers instead of putting a big blacklist in video_detect.c
* After calling this function you will probably want to call
* acpi_video_unregister() to make sure the video module is not loaded
*/
void acpi_video_dmi_promote_vendor(void)
{
acpi_video_caps_check();
acpi_video_support |= ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
}
EXPORT_SYMBOL(acpi_video_dmi_promote_vendor);
/* To be called when a driver who previously promoted the vendor
* interface */
void acpi_video_dmi_demote_vendor(void)
{
acpi_video_caps_check();
acpi_video_support &= ~ACPI_VIDEO_BACKLIGHT_DMI_VENDOR;
}
EXPORT_SYMBOL(acpi_video_dmi_demote_vendor);
/* Returns true if video.ko can do backlight switching */
int acpi_video_backlight_support(void)
{
acpi_video_caps_check();
/* First check for boot param -> highest prio */
if (acpi_video_support & ACPI_VIDEO_BACKLIGHT_FORCE_VENDOR)
......
......@@ -95,6 +95,7 @@ MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026");
enum acer_wmi_event_ids {
WMID_HOTKEY_EVENT = 0x1,
WMID_ACCEL_EVENT = 0x5,
};
static const struct key_entry acer_wmi_keymap[] = {
......@@ -130,6 +131,7 @@ static const struct key_entry acer_wmi_keymap[] = {
};
static struct input_dev *acer_wmi_input_dev;
static struct input_dev *acer_wmi_accel_dev;
struct event_return_value {
u8 function;
......@@ -200,6 +202,7 @@ struct hotkey_function_type_aa {
#define ACER_CAP_BLUETOOTH (1<<2)
#define ACER_CAP_BRIGHTNESS (1<<3)
#define ACER_CAP_THREEG (1<<4)
#define ACER_CAP_ACCEL (1<<5)
#define ACER_CAP_ANY (0xFFFFFFFF)
/*
......@@ -1398,6 +1401,60 @@ static void acer_backlight_exit(void)
backlight_device_unregister(acer_backlight_device);
}
/*
* Accelerometer device
*/
static acpi_handle gsensor_handle;
static int acer_gsensor_init(void)
{
acpi_status status;
struct acpi_buffer output;
union acpi_object out_obj;
output.length = sizeof(out_obj);
output.pointer = &out_obj;
status = acpi_evaluate_object(gsensor_handle, "_INI", NULL, &output);
if (ACPI_FAILURE(status))
return -1;
return 0;
}
static int acer_gsensor_open(struct input_dev *input)
{
return acer_gsensor_init();
}
static int acer_gsensor_event(void)
{
acpi_status status;
struct acpi_buffer output;
union acpi_object out_obj[5];
if (!has_cap(ACER_CAP_ACCEL))
return -1;
output.length = sizeof(out_obj);
output.pointer = out_obj;
status = acpi_evaluate_object(gsensor_handle, "RDVL", NULL, &output);
if (ACPI_FAILURE(status))
return -1;
if (out_obj->package.count != 4)
return -1;
input_report_abs(acer_wmi_accel_dev, ABS_X,
(s16)out_obj->package.elements[0].integer.value);
input_report_abs(acer_wmi_accel_dev, ABS_Y,
(s16)out_obj->package.elements[1].integer.value);
input_report_abs(acer_wmi_accel_dev, ABS_Z,
(s16)out_obj->package.elements[2].integer.value);
input_sync(acer_wmi_accel_dev);
return 0;
}
/*
* Rfkill devices
*/
......@@ -1673,6 +1730,9 @@ static void acer_wmi_notify(u32 value, void *context)
1, true);
}
break;
case WMID_ACCEL_EVENT:
acer_gsensor_event();
break;
default:
pr_warn("Unknown function number - %d - %d\n",
return_value.function, return_value.key_num);
......@@ -1758,6 +1818,73 @@ static int acer_wmi_enable_lm(void)
return status;
}
static acpi_status __init acer_wmi_get_handle_cb(acpi_handle ah, u32 level,
void *ctx, void **retval)
{
*(acpi_handle *)retval = ah;
return AE_OK;
}
static int __init acer_wmi_get_handle(const char *name, const char *prop,
acpi_handle *ah)
{
acpi_status status;
acpi_handle handle;
BUG_ON(!name || !ah);
handle = NULL;
status = acpi_get_devices(prop, acer_wmi_get_handle_cb,
(void *)name, &handle);
if (ACPI_SUCCESS(status)) {
*ah = handle;
return 0;
} else {
return -ENODEV;
}
}
static int __init acer_wmi_accel_setup(void)
{
int err;
err = acer_wmi_get_handle("SENR", "BST0001", &gsensor_handle);
if (err)
return err;
interface->capability |= ACER_CAP_ACCEL;
acer_wmi_accel_dev = input_allocate_device();
if (!acer_wmi_accel_dev)
return -ENOMEM;
acer_wmi_accel_dev->open = acer_gsensor_open;
acer_wmi_accel_dev->name = "Acer BMA150 accelerometer";
acer_wmi_accel_dev->phys = "wmi/input1";
acer_wmi_accel_dev->id.bustype = BUS_HOST;
acer_wmi_accel_dev->evbit[0] = BIT_MASK(EV_ABS);
input_set_abs_params(acer_wmi_accel_dev, ABS_X, -16384, 16384, 0, 0);
input_set_abs_params(acer_wmi_accel_dev, ABS_Y, -16384, 16384, 0, 0);
input_set_abs_params(acer_wmi_accel_dev, ABS_Z, -16384, 16384, 0, 0);
err = input_register_device(acer_wmi_accel_dev);
if (err)
goto err_free_dev;
return 0;
err_free_dev:
input_free_device(acer_wmi_accel_dev);
return err;
}
static void acer_wmi_accel_destroy(void)
{
input_unregister_device(acer_wmi_accel_dev);
}
static int __init acer_wmi_input_setup(void)
{
acpi_status status;
......@@ -1912,6 +2039,9 @@ static int acer_resume(struct device *dev)
if (has_cap(ACER_CAP_BRIGHTNESS))
set_u32(data->brightness, ACER_CAP_BRIGHTNESS);
if (has_cap(ACER_CAP_ACCEL))
acer_gsensor_init();
return 0;
}
......@@ -2060,14 +2190,16 @@ static int __init acer_wmi_init(void)
set_quirks();
if (dmi_check_system(video_vendor_dmi_table))
acpi_video_dmi_promote_vendor();
if (acpi_video_backlight_support()) {
if (dmi_check_system(video_vendor_dmi_table)) {
acpi_video_unregister();
} else {
interface->capability &= ~ACER_CAP_BRIGHTNESS;
pr_info("Brightness must be controlled by "
"acpi video driver\n");
}
interface->capability &= ~ACER_CAP_BRIGHTNESS;
pr_info("Brightness must be controlled by acpi video driver\n");
} else {
#ifdef CONFIG_ACPI_VIDEO
pr_info("Disabling ACPI video driver\n");
acpi_video_unregister();
#endif
}
if (wmi_has_guid(WMID_GUID3)) {
......@@ -2090,6 +2222,8 @@ static int __init acer_wmi_init(void)
return err;
}
acer_wmi_accel_setup();
err = platform_driver_register(&acer_platform_driver);
if (err) {
pr_err("Unable to register platform driver\n");
......@@ -2133,6 +2267,8 @@ static int __init acer_wmi_init(void)
error_platform_register:
if (wmi_has_guid(ACERWMID_EVENT_GUID))
acer_wmi_input_destroy();
if (has_cap(ACER_CAP_ACCEL))
acer_wmi_accel_destroy();
return err;
}
......@@ -2142,6 +2278,9 @@ static void __exit acer_wmi_exit(void)
if (wmi_has_guid(ACERWMID_EVENT_GUID))
acer_wmi_input_destroy();
if (has_cap(ACER_CAP_ACCEL))
acer_wmi_accel_destroy();
remove_sysfs(acer_platform_device);
remove_debugfs();
platform_device_unregister(acer_platform_device);
......
......@@ -193,7 +193,10 @@ static int __devinit gmux_probe(struct pnp_dev *pnp,
* backlight control and supports more levels than other options.
* Disable the other backlight choices.
*/
acpi_video_dmi_promote_vendor();
#ifdef CONFIG_ACPI_VIDEO
acpi_video_unregister();
#endif
apple_bl_unregister();
return 0;
......@@ -213,7 +216,10 @@ static void __devexit gmux_remove(struct pnp_dev *pnp)
release_region(gmux_data->iostart, gmux_data->iolen);
kfree(gmux_data);
acpi_video_dmi_demote_vendor();
#ifdef CONFIG_ACPI_VIDEO
acpi_video_register();
#endif
apple_bl_register();
}
......
......@@ -26,6 +26,7 @@
#include <linux/input.h>
#include <linux/input/sparse-keymap.h>
#include <linux/fb.h>
#include <linux/dmi.h>
#include "asus-wmi.h"
......@@ -48,18 +49,115 @@ MODULE_ALIAS("wmi:"ASUS_NB_WMI_EVENT_GUID);
* 1 | Hardware | Software
* 4 | Software | Software
*/
static uint wapf;
static int wapf = -1;
module_param(wapf, uint, 0444);
MODULE_PARM_DESC(wapf, "WAPF value");
static struct quirk_entry *quirks;
static struct quirk_entry quirk_asus_unknown = {
.wapf = 0,
};
static struct quirk_entry quirk_asus_x401u = {
.wapf = 4,
};
static int dmi_matched(const struct dmi_system_id *dmi)
{
quirks = dmi->driver_data;
return 1;
}
static struct dmi_system_id asus_quirks[] = {
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X401U",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X401U"),
},
.driver_data = &quirk_asus_x401u,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X401A1",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X401A1"),
},
.driver_data = &quirk_asus_x401u,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X501U",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X501U"),
},
.driver_data = &quirk_asus_x401u,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X501A1",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X501A1"),
},
.driver_data = &quirk_asus_x401u,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X55A",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X55A"),
},
.driver_data = &quirk_asus_x401u,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X55C",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X55C"),
},
.driver_data = &quirk_asus_x401u,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X55U",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X55U"),
},
.driver_data = &quirk_asus_x401u,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK COMPUTER INC. X55VD",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X55VD"),
},
.driver_data = &quirk_asus_x401u,
},
{},
};
static void asus_nb_wmi_quirks(struct asus_wmi_driver *driver)
{
driver->quirks = &quirk_asus_unknown;
driver->quirks->wapf = wapf;
quirks = &quirk_asus_unknown;
dmi_check_system(asus_quirks);
driver->quirks = quirks;
driver->panel_power = FB_BLANK_UNBLANK;
/* overwrite the wapf setting if the wapf paramater is specified */
if (wapf != -1)
quirks->wapf = wapf;
else
wapf = quirks->wapf;
}
static const struct key_entry asus_nb_wmi_keymap[] = {
......@@ -94,6 +192,10 @@ static const struct key_entry asus_nb_wmi_keymap[] = {
{ KE_KEY, 0x8A, { KEY_PROG1 } },
{ KE_KEY, 0x95, { KEY_MEDIA } },
{ KE_KEY, 0x99, { KEY_PHONE } },
{ KE_KEY, 0xA0, { KEY_SWITCHVIDEOMODE } }, /* SDSP HDMI only */
{ KE_KEY, 0xA1, { KEY_SWITCHVIDEOMODE } }, /* SDSP LCD + HDMI */
{ KE_KEY, 0xA2, { KEY_SWITCHVIDEOMODE } }, /* SDSP CRT + HDMI */
{ KE_KEY, 0xA3, { KEY_SWITCHVIDEOMODE } }, /* SDSP TV + HDMI */
{ KE_KEY, 0xb5, { KEY_CALC } },
{ KE_KEY, 0xc4, { KEY_KBDILLUMUP } },
{ KE_KEY, 0xc5, { KEY_KBDILLUMDOWN } },
......
......@@ -47,6 +47,9 @@
#include <linux/thermal.h>
#include <acpi/acpi_bus.h>
#include <acpi/acpi_drivers.h>
#ifdef CONFIG_ACPI_VIDEO
#include <acpi/video.h>
#endif
#include "asus-wmi.h"
......@@ -136,6 +139,9 @@ MODULE_LICENSE("GPL");
/* Power */
#define ASUS_WMI_DEVID_PROCESSOR_STATE 0x00120012
/* Deep S3 / Resume on LID open */
#define ASUS_WMI_DEVID_LID_RESUME 0x00120031
/* DSTS masks */
#define ASUS_WMI_DSTS_STATUS_BIT 0x00000001
#define ASUS_WMI_DSTS_UNKNOWN_BIT 0x00000002
......@@ -1365,6 +1371,7 @@ static ssize_t show_sys_wmi(struct asus_wmi *asus, int devid, char *buf)
ASUS_WMI_CREATE_DEVICE_ATTR(touchpad, 0644, ASUS_WMI_DEVID_TOUCHPAD);
ASUS_WMI_CREATE_DEVICE_ATTR(camera, 0644, ASUS_WMI_DEVID_CAMERA);
ASUS_WMI_CREATE_DEVICE_ATTR(cardr, 0644, ASUS_WMI_DEVID_CARDREADER);
ASUS_WMI_CREATE_DEVICE_ATTR(lid_resume, 0644, ASUS_WMI_DEVID_LID_RESUME);
static ssize_t store_cpufv(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
......@@ -1390,6 +1397,7 @@ static struct attribute *platform_attributes[] = {
&dev_attr_camera.attr,
&dev_attr_cardr.attr,
&dev_attr_touchpad.attr,
&dev_attr_lid_resume.attr,
NULL
};
......@@ -1408,6 +1416,8 @@ static umode_t asus_sysfs_is_visible(struct kobject *kobj,
devid = ASUS_WMI_DEVID_CARDREADER;
else if (attr == &dev_attr_touchpad.attr)
devid = ASUS_WMI_DEVID_TOUCHPAD;
else if (attr == &dev_attr_lid_resume.attr)
devid = ASUS_WMI_DEVID_LID_RESUME;
if (devid != -1)
ok = !(asus_wmi_get_devstate_simple(asus, devid) < 0);
......@@ -1467,14 +1477,9 @@ static int asus_wmi_platform_init(struct asus_wmi *asus)
*/
if (!asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS, 0, 0, NULL))
asus->dsts_id = ASUS_WMI_METHODID_DSTS;
else if (!asus_wmi_evaluate_method(ASUS_WMI_METHODID_DSTS2, 0, 0, NULL))
else
asus->dsts_id = ASUS_WMI_METHODID_DSTS2;
if (!asus->dsts_id) {
pr_err("Can't find DSTS");
return -ENODEV;
}
/* CWAP allow to define the behavior of the Fn+F2 key,
* this method doesn't seems to be present on Eee PCs */
if (asus->driver->quirks->wapf >= 0)
......@@ -1681,7 +1686,13 @@ static int asus_wmi_add(struct platform_device *pdev)
if (err)
goto fail_rfkill;
if (asus->driver->quirks->wmi_backlight_power)
acpi_video_dmi_promote_vendor();
if (!acpi_video_backlight_support()) {
#ifdef CONFIG_ACPI_VIDEO
pr_info("Disabling ACPI video driver\n");
acpi_video_unregister();
#endif
err = asus_wmi_backlight_init(asus);
if (err && err != -ENODEV)
goto fail_backlight;
......
......@@ -39,6 +39,7 @@ struct quirk_entry {
bool hotplug_wireless;
bool scalar_panel_brightness;
bool store_backlight_power;
bool wmi_backlight_power;
int wapf;
};
......
This diff is collapsed.
......@@ -206,6 +206,60 @@ static struct dmi_system_id __devinitdata dell_quirks[] = {
},
.driver_data = &quirk_dell_vostro_v130,
},
{
.callback = dmi_matched,
.ident = "Dell Inspiron 5420",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Isnpiron 5420"),
},
.driver_data = &quirk_dell_vostro_v130,
},
{
.callback = dmi_matched,
.ident = "Dell Inspiron 5520",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Isnpiron 5520"),
},
.driver_data = &quirk_dell_vostro_v130,
},
{
.callback = dmi_matched,
.ident = "Dell Inspiron 5720",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Isnpiron 5720"),
},
.driver_data = &quirk_dell_vostro_v130,
},
{
.callback = dmi_matched,
.ident = "Dell Inspiron 7420",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Isnpiron 7420"),
},
.driver_data = &quirk_dell_vostro_v130,
},
{
.callback = dmi_matched,
.ident = "Dell Inspiron 7520",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Isnpiron 7520"),
},
.driver_data = &quirk_dell_vostro_v130,
},
{
.callback = dmi_matched,
.ident = "Dell Inspiron 7720",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
DMI_MATCH(DMI_PRODUCT_NAME, "Isnpiron 7720"),
},
.driver_data = &quirk_dell_vostro_v130,
},
{ }
};
......
......@@ -79,7 +79,7 @@ static const struct key_entry eeepc_wmi_keymap[] = {
{ KE_KEY, 0xe1, { KEY_F14 } }, /* Change Resolution */
{ KE_KEY, HOME_PRESS, { KEY_CONFIG } }, /* Home/Express gate key */
{ KE_KEY, 0xe8, { KEY_SCREENLOCK } },
{ KE_KEY, 0xe9, { KEY_BRIGHTNESS_ZERO } },
{ KE_KEY, 0xe9, { KEY_DISPLAYTOGGLE } },
{ KE_KEY, 0xeb, { KEY_CAMERA_ZOOMOUT } },
{ KE_KEY, 0xec, { KEY_CAMERA_UP } },
{ KE_KEY, 0xed, { KEY_CAMERA_DOWN } },
......@@ -107,6 +107,11 @@ static struct quirk_entry quirk_asus_et2012_type3 = {
.store_backlight_power = true,
};
static struct quirk_entry quirk_asus_x101ch = {
/* We need this when ACPI function doesn't do this well */
.wmi_backlight_power = true,
};
static struct quirk_entry *quirks;
static void et2012_quirks(void)
......@@ -157,6 +162,24 @@ static struct dmi_system_id asus_quirks[] = {
},
.driver_data = &quirk_asus_unknown,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK Computer INC. X101CH",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "X101CH"),
},
.driver_data = &quirk_asus_x101ch,
},
{
.callback = dmi_matched,
.ident = "ASUSTeK Computer INC. 1015CX",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
DMI_MATCH(DMI_PRODUCT_NAME, "1015CX"),
},
.driver_data = &quirk_asus_x101ch,
},
{},
};
......
......@@ -26,7 +26,7 @@
#include <linux/seq_file.h>
#include <linux/debugfs.h>
#include <linux/ctype.h>
#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
#ifdef CONFIG_ACPI_VIDEO
#include <acpi/video.h>
#endif
......@@ -1465,6 +1465,15 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
},
},
/* DMI ids for laptops with bad Chassis Type */
{
.ident = "R40/R41",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
DMI_MATCH(DMI_PRODUCT_NAME, "R40/R41"),
DMI_MATCH(DMI_BOARD_NAME, "R40/R41"),
},
},
/* Specific DMI ids for laptop with quirks */
{
.callback = samsung_dmi_matched,
......@@ -1506,6 +1515,16 @@ static struct dmi_system_id __initdata samsung_dmi_table[] = {
},
.driver_data = &samsung_broken_acpi_video,
},
{
.callback = samsung_dmi_matched,
.ident = "X360",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
DMI_MATCH(DMI_BOARD_NAME, "X360"),
},
.driver_data = &samsung_broken_acpi_video,
},
{ },
};
MODULE_DEVICE_TABLE(dmi, samsung_dmi_table);
......@@ -1530,15 +1549,18 @@ static int __init samsung_init(void)
samsung->quirks = quirks;
#if (defined CONFIG_ACPI_VIDEO || defined CONFIG_ACPI_VIDEO_MODULE)
#ifdef CONFIG_ACPI
if (samsung->quirks->broken_acpi_video)
acpi_video_dmi_promote_vendor();
/* Don't handle backlight here if the acpi video already handle it */
if (acpi_video_backlight_support()) {
if (samsung->quirks->broken_acpi_video) {
pr_info("Disabling ACPI video driver\n");
acpi_video_unregister();
} else {
samsung->handle_backlight = false;
}
samsung->handle_backlight = false;
} else if (samsung->quirks->broken_acpi_video) {
pr_info("Disabling ACPI video driver\n");
#ifdef CONFIG_ACPI_VIDEO
acpi_video_unregister();
#endif
}
#endif
......@@ -1552,8 +1574,7 @@ static int __init samsung_init(void)
#ifdef CONFIG_ACPI
/* Only log that if we are really on a sabi platform */
if (acpi_video_backlight_support() &&
!samsung->quirks->broken_acpi_video)
if (acpi_video_backlight_support())
pr_info("Backlight controlled by ACPI video driver\n");
#endif
......
......@@ -3015,8 +3015,6 @@ static void hotkey_exit(void)
if (hotkey_dev_attributes)
delete_attr_set(hotkey_dev_attributes, &tpacpi_pdev->dev.kobj);
kfree(hotkey_keycode_map);
dbg_printk(TPACPI_DBG_EXIT | TPACPI_DBG_HKEY,
"restoring original HKEY status and mask\n");
/* yes, there is a bitwise or below, we want the
......@@ -5217,6 +5215,7 @@ static void led_exit(void)
led_classdev_unregister(&tpacpi_leds[i].led_classdev);
}
flush_workqueue(tpacpi_wq);
kfree(tpacpi_leds);
}
......@@ -8936,6 +8935,7 @@ static void thinkpad_acpi_module_exit(void)
input_unregister_device(tpacpi_inputdev);
else
input_free_device(tpacpi_inputdev);
kfree(hotkey_keycode_map);
}
if (tpacpi_hwmon)
......@@ -8969,6 +8969,7 @@ static void thinkpad_acpi_module_exit(void)
kfree(thinkpad_id.bios_version_str);
kfree(thinkpad_id.ec_version_str);
kfree(thinkpad_id.model_str);
kfree(thinkpad_id.nummodel_str);
}
......
......@@ -190,6 +190,8 @@ extern bool wmi_has_guid(const char *guid);
extern long acpi_video_get_capabilities(acpi_handle graphics_dev_handle);
extern long acpi_is_video_device(struct acpi_device *device);
extern void acpi_video_dmi_promote_vendor(void);
extern void acpi_video_dmi_demote_vendor(void);
extern int acpi_video_backlight_support(void);
extern int acpi_video_display_switch_support(void);
......@@ -205,6 +207,14 @@ static inline long acpi_is_video_device(struct acpi_device *device)
return 0;
}
static inline void acpi_video_dmi_promote_vendor(void)
{
}
static inline void acpi_video_dmi_demote_vendor(void)
{
}
static inline int acpi_video_backlight_support(void)
{
return 0;
......
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