diff options
author | Andy Ross <andy.ross@windriver.com> | 2011-10-14 05:13:35 -0400 |
---|---|---|
committer | Matthew Garrett <mjg@redhat.com> | 2011-10-24 10:52:37 -0400 |
commit | 8819de7f988289111cf4c44946f0d8c008b2d9a7 (patch) | |
tree | a1f3a842bb8038fb2e90d70b7d4f0288b7c46907 /drivers/platform | |
parent | ba05b237372bad82533d1f717569d1d817ff3c27 (diff) |
asus-laptop: Platform detection for Pegatron Lucid
Recognize the Pegatron Lucid tablets by their method signatures.
Signed-off-by: Andy Ross <andy.ross@windriver.com>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r-- | drivers/platform/x86/Kconfig | 16 | ||||
-rw-r--r-- | drivers/platform/x86/asus-laptop.c | 23 |
2 files changed, 29 insertions, 10 deletions
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig index 1e88d4785321..4e5623e4fa0b 100644 --- a/drivers/platform/x86/Kconfig +++ b/drivers/platform/x86/Kconfig | |||
@@ -64,15 +64,17 @@ config ASUS_LAPTOP | |||
64 | depends on INPUT | 64 | depends on INPUT |
65 | depends on RFKILL || RFKILL = n | 65 | depends on RFKILL || RFKILL = n |
66 | select INPUT_SPARSEKMAP | 66 | select INPUT_SPARSEKMAP |
67 | select INPUT_POLLDEV | ||
67 | ---help--- | 68 | ---help--- |
68 | This is the new Linux driver for Asus laptops. It may also support some | 69 | This is a driver for Asus laptops, Lenovo SL and the Pegatron |
69 | MEDION, JVC or VICTOR laptops. It makes all the extra buttons generate | 70 | Lucid tablet. It may also support some MEDION, JVC or VICTOR |
70 | standard ACPI events and input events. It also adds | 71 | laptops. It makes all the extra buttons generate standard |
71 | support for video output switching, LCD backlight control, Bluetooth and | 72 | ACPI events and input events. It also adds support for video |
72 | Wlan control, and most importantly, allows you to blink those fancy LEDs. | 73 | output switching, LCD backlight control, Bluetooth and Wlan |
74 | control, and most importantly, allows you to blink those | ||
75 | fancy LEDs. | ||
73 | 76 | ||
74 | For more information and a userspace daemon for handling the extra | 77 | For more information see <http://acpi4asus.sf.net>. |
75 | buttons see <http://acpi4asus.sf.net>. | ||
76 | 78 | ||
77 | If you have an ACPI-compatible ASUS laptop, say Y or M here. | 79 | If you have an ACPI-compatible ASUS laptop, say Y or M here. |
78 | 80 | ||
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index fa6d7ec68b26..c08f4c26b988 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (C) 2002-2005 Julien Lerouge, 2003-2006 Karol Kozimor | 5 | * Copyright (C) 2002-2005 Julien Lerouge, 2003-2006 Karol Kozimor |
6 | * Copyright (C) 2006-2007 Corentin Chary | 6 | * Copyright (C) 2006-2007 Corentin Chary |
7 | * Copyright (C) 2011 Wind River Systems | ||
7 | * | 8 | * |
8 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License as published by |
@@ -48,6 +49,7 @@ | |||
48 | #include <linux/uaccess.h> | 49 | #include <linux/uaccess.h> |
49 | #include <linux/input.h> | 50 | #include <linux/input.h> |
50 | #include <linux/input/sparse-keymap.h> | 51 | #include <linux/input/sparse-keymap.h> |
52 | #include <linux/input-polldev.h> | ||
51 | #include <linux/rfkill.h> | 53 | #include <linux/rfkill.h> |
52 | #include <linux/slab.h> | 54 | #include <linux/slab.h> |
53 | #include <linux/dmi.h> | 55 | #include <linux/dmi.h> |
@@ -173,6 +175,12 @@ MODULE_PARM_DESC(wwan_status, "Set the wireless status on boot " | |||
173 | #define METHOD_KBD_LIGHT_SET "SLKB" | 175 | #define METHOD_KBD_LIGHT_SET "SLKB" |
174 | #define METHOD_KBD_LIGHT_GET "GLKB" | 176 | #define METHOD_KBD_LIGHT_GET "GLKB" |
175 | 177 | ||
178 | /* For Pegatron Lucid tablet */ | ||
179 | #define DEVICE_NAME_PEGA "Lucid" | ||
180 | #define METHOD_PEGA_ENABLE "ENPR" | ||
181 | #define METHOD_PEGA_DISABLE "DAPR" | ||
182 | #define METHOD_PEGA_READ "RDLN" | ||
183 | |||
176 | /* | 184 | /* |
177 | * Define a specific led structure to keep the main structure clean | 185 | * Define a specific led structure to keep the main structure clean |
178 | */ | 186 | */ |
@@ -209,6 +217,7 @@ struct asus_laptop { | |||
209 | 217 | ||
210 | int wireless_status; | 218 | int wireless_status; |
211 | bool have_rsts; | 219 | bool have_rsts; |
220 | bool is_pega_lucid; | ||
212 | 221 | ||
213 | struct rfkill *gps_rfkill; | 222 | struct rfkill *gps_rfkill; |
214 | 223 | ||
@@ -323,6 +332,14 @@ static int acpi_check_handle(acpi_handle handle, const char *method, | |||
323 | return 0; | 332 | return 0; |
324 | } | 333 | } |
325 | 334 | ||
335 | static bool asus_check_pega_lucid(struct asus_laptop *asus) | ||
336 | { | ||
337 | return !strcmp(asus->name, DEVICE_NAME_PEGA) && | ||
338 | !acpi_check_handle(asus->handle, METHOD_PEGA_ENABLE, NULL) && | ||
339 | !acpi_check_handle(asus->handle, METHOD_PEGA_DISABLE, NULL) && | ||
340 | !acpi_check_handle(asus->handle, METHOD_PEGA_READ, NULL); | ||
341 | } | ||
342 | |||
326 | /* Generic LED function */ | 343 | /* Generic LED function */ |
327 | static int asus_led_set(struct asus_laptop *asus, const char *method, | 344 | static int asus_led_set(struct asus_laptop *asus, const char *method, |
328 | int value) | 345 | int value) |
@@ -1203,7 +1220,6 @@ static mode_t asus_sysfs_is_visible(struct kobject *kobj, | |||
1203 | attr == &dev_attr_ls_level.attr) { | 1220 | attr == &dev_attr_ls_level.attr) { |
1204 | supported = !acpi_check_handle(handle, METHOD_ALS_CONTROL, NULL) && | 1221 | supported = !acpi_check_handle(handle, METHOD_ALS_CONTROL, NULL) && |
1205 | !acpi_check_handle(handle, METHOD_ALS_LEVEL, NULL); | 1222 | !acpi_check_handle(handle, METHOD_ALS_LEVEL, NULL); |
1206 | |||
1207 | } else if (attr == &dev_attr_gps.attr) { | 1223 | } else if (attr == &dev_attr_gps.attr) { |
1208 | supported = !acpi_check_handle(handle, METHOD_GPS_ON, NULL) && | 1224 | supported = !acpi_check_handle(handle, METHOD_GPS_ON, NULL) && |
1209 | !acpi_check_handle(handle, METHOD_GPS_OFF, NULL) && | 1225 | !acpi_check_handle(handle, METHOD_GPS_OFF, NULL) && |
@@ -1439,9 +1455,10 @@ static int __devinit asus_acpi_add(struct acpi_device *device) | |||
1439 | goto fail_platform; | 1455 | goto fail_platform; |
1440 | 1456 | ||
1441 | /* | 1457 | /* |
1442 | * Register the platform device first. It is used as a parent for the | 1458 | * Need platform type detection first, then the platform |
1443 | * sub-devices below. | 1459 | * device. It is used as a parent for the sub-devices below. |
1444 | */ | 1460 | */ |
1461 | asus->is_pega_lucid = asus_check_pega_lucid(asus); | ||
1445 | result = asus_platform_init(asus); | 1462 | result = asus_platform_init(asus); |
1446 | if (result) | 1463 | if (result) |
1447 | goto fail_platform; | 1464 | goto fail_platform; |