aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/Kconfig2
-rw-r--r--drivers/misc/asus-laptop.c66
-rw-r--r--drivers/misc/msi-laptop.c12
-rw-r--r--drivers/misc/sony-laptop.c8
4 files changed, 71 insertions, 17 deletions
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 877e7909a0e5..2f2fbffafbe0 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -130,7 +130,7 @@ config SONY_LAPTOP
130 130
131 Read <file:Documentation/sony-laptop.txt> for more information. 131 Read <file:Documentation/sony-laptop.txt> for more information.
132 132
133config SONY_LAPTOP_OLD 133config SONYPI_COMPAT
134 bool "Sonypi compatibility" 134 bool "Sonypi compatibility"
135 depends on SONY_LAPTOP 135 depends on SONY_LAPTOP
136 ---help--- 136 ---help---
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index 65c32a95e121..4f9060a2a2f2 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -30,7 +30,7 @@
30 * Eric Burghard - LED display support for W1N 30 * Eric Burghard - LED display support for W1N
31 * Josh Green - Light Sens support 31 * Josh Green - Light Sens support
32 * Thomas Tuttle - His first patch for led support was very helpfull 32 * Thomas Tuttle - His first patch for led support was very helpfull
33 * 33 * Sam Lin - GPS support
34 */ 34 */
35 35
36#include <linux/autoconf.h> 36#include <linux/autoconf.h>
@@ -48,7 +48,7 @@
48#include <acpi/acpi_bus.h> 48#include <acpi/acpi_bus.h>
49#include <asm/uaccess.h> 49#include <asm/uaccess.h>
50 50
51#define ASUS_LAPTOP_VERSION "0.41" 51#define ASUS_LAPTOP_VERSION "0.42"
52 52
53#define ASUS_HOTK_NAME "Asus Laptop Support" 53#define ASUS_HOTK_NAME "Asus Laptop Support"
54#define ASUS_HOTK_CLASS "hotkey" 54#define ASUS_HOTK_CLASS "hotkey"
@@ -83,6 +83,7 @@
83#define PLED_ON 0x20 //Phone LED 83#define PLED_ON 0x20 //Phone LED
84#define GLED_ON 0x40 //Gaming LED 84#define GLED_ON 0x40 //Gaming LED
85#define LCD_ON 0x80 //LCD backlight 85#define LCD_ON 0x80 //LCD backlight
86#define GPS_ON 0x100 //GPS
86 87
87#define ASUS_LOG ASUS_HOTK_FILE ": " 88#define ASUS_LOG ASUS_HOTK_FILE ": "
88#define ASUS_ERR KERN_ERR ASUS_LOG 89#define ASUS_ERR KERN_ERR ASUS_LOG
@@ -148,7 +149,7 @@ ASUS_HANDLE(display_set, ASUS_HOTK_PREFIX "SDSP");
148ASUS_HANDLE(display_get, "\\_SB.PCI0.P0P1.VGA.GETD", /* A6B, A6K A6R A7D F3JM L4R M6R A3G 149ASUS_HANDLE(display_get, "\\_SB.PCI0.P0P1.VGA.GETD", /* A6B, A6K A6R A7D F3JM L4R M6R A3G
149 M6A M6V VX-1 V6J V6V W3Z */ 150 M6A M6V VX-1 V6J V6V W3Z */
150 "\\_SB.PCI0.P0P2.VGA.GETD", /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V 151 "\\_SB.PCI0.P0P2.VGA.GETD", /* A3E A4K, A4D A4L A6J A7J A8J Z71V M9V
151 S5A M5A z33A W1Jc W2V */ 152 S5A M5A z33A W1Jc W2V G1 */
152 "\\_SB.PCI0.P0P3.VGA.GETD", /* A6V A6Q */ 153 "\\_SB.PCI0.P0P3.VGA.GETD", /* A6V A6Q */
153 "\\_SB.PCI0.P0PA.VGA.GETD", /* A6T, A6M */ 154 "\\_SB.PCI0.P0PA.VGA.GETD", /* A6T, A6M */
154 "\\_SB.PCI0.PCI1.VGAC.NMAP", /* L3C */ 155 "\\_SB.PCI0.PCI1.VGAC.NMAP", /* L3C */
@@ -162,6 +163,12 @@ ASUS_HANDLE(display_get, "\\_SB.PCI0.P0P1.VGA.GETD", /* A6B, A6K A6R A7D F3JM L
162ASUS_HANDLE(ls_switch, ASUS_HOTK_PREFIX "ALSC"); /* Z71A Z71V */ 163ASUS_HANDLE(ls_switch, ASUS_HOTK_PREFIX "ALSC"); /* Z71A Z71V */
163ASUS_HANDLE(ls_level, ASUS_HOTK_PREFIX "ALSL"); /* Z71A Z71V */ 164ASUS_HANDLE(ls_level, ASUS_HOTK_PREFIX "ALSL"); /* Z71A Z71V */
164 165
166/* GPS */
167/* R2H use different handle for GPS on/off */
168ASUS_HANDLE(gps_on, ASUS_HOTK_PREFIX "SDON"); /* R2H */
169ASUS_HANDLE(gps_off, ASUS_HOTK_PREFIX "SDOF"); /* R2H */
170ASUS_HANDLE(gps_status, ASUS_HOTK_PREFIX "GPST");
171
165/* 172/*
166 * This is the main structure, we can use it to store anything interesting 173 * This is the main structure, we can use it to store anything interesting
167 * about the hotk device 174 * about the hotk device
@@ -278,12 +285,28 @@ static int read_wireless_status(int mask)
278 return (hotk->status & mask) ? 1 : 0; 285 return (hotk->status & mask) ? 1 : 0;
279} 286}
280 287
288static int read_gps_status(void)
289{
290 ulong status;
291 acpi_status rv = AE_OK;
292
293 rv = acpi_evaluate_integer(gps_status_handle, NULL, NULL, &status);
294 if (ACPI_FAILURE(rv))
295 printk(ASUS_WARNING "Error reading GPS status\n");
296 else
297 return status ? 1 : 0;
298
299 return (hotk->status & GPS_ON) ? 1 : 0;
300}
301
281/* Generic LED functions */ 302/* Generic LED functions */
282static int read_status(int mask) 303static int read_status(int mask)
283{ 304{
284 /* There is a special method for both wireless devices */ 305 /* There is a special method for both wireless devices */
285 if (mask == BT_ON || mask == WL_ON) 306 if (mask == BT_ON || mask == WL_ON)
286 return read_wireless_status(mask); 307 return read_wireless_status(mask);
308 else if (mask == GPS_ON)
309 return read_gps_status();
287 310
288 return (hotk->status & mask) ? 1 : 0; 311 return (hotk->status & mask) ? 1 : 0;
289} 312}
@@ -299,6 +322,10 @@ static void write_status(acpi_handle handle, int out, int mask)
299 case GLED_ON: 322 case GLED_ON:
300 out = (out & 0x1) + 1; 323 out = (out & 0x1) + 1;
301 break; 324 break;
325 case GPS_ON:
326 handle = (out) ? gps_on_handle : gps_off_handle;
327 out = 0x02;
328 break;
302 default: 329 default:
303 out &= 0x1; 330 out &= 0x1;
304 break; 331 break;
@@ -667,6 +694,21 @@ static ssize_t store_lslvl(struct device *dev, struct device_attribute *attr,
667 return rv; 694 return rv;
668} 695}
669 696
697/*
698 * GPS
699 */
700static ssize_t show_gps(struct device *dev,
701 struct device_attribute *attr, char *buf)
702{
703 return sprintf(buf, "%d\n", read_status(GPS_ON));
704}
705
706static ssize_t store_gps(struct device *dev, struct device_attribute *attr,
707 const char *buf, size_t count)
708{
709 return store_status(buf, count, NULL, GPS_ON);
710}
711
670static void asus_hotk_notify(acpi_handle handle, u32 event, void *data) 712static void asus_hotk_notify(acpi_handle handle, u32 event, void *data)
671{ 713{
672 /* TODO Find a better way to handle events count. */ 714 /* TODO Find a better way to handle events count. */
@@ -715,6 +757,7 @@ static ASUS_CREATE_DEVICE_ATTR(display);
715static ASUS_CREATE_DEVICE_ATTR(ledd); 757static ASUS_CREATE_DEVICE_ATTR(ledd);
716static ASUS_CREATE_DEVICE_ATTR(ls_switch); 758static ASUS_CREATE_DEVICE_ATTR(ls_switch);
717static ASUS_CREATE_DEVICE_ATTR(ls_level); 759static ASUS_CREATE_DEVICE_ATTR(ls_level);
760static ASUS_CREATE_DEVICE_ATTR(gps);
718 761
719static struct attribute *asuspf_attributes[] = { 762static struct attribute *asuspf_attributes[] = {
720 &dev_attr_infos.attr, 763 &dev_attr_infos.attr,
@@ -724,6 +767,7 @@ static struct attribute *asuspf_attributes[] = {
724 &dev_attr_ledd.attr, 767 &dev_attr_ledd.attr,
725 &dev_attr_ls_switch.attr, 768 &dev_attr_ls_switch.attr,
726 &dev_attr_ls_level.attr, 769 &dev_attr_ls_level.attr,
770 &dev_attr_gps.attr,
727 NULL 771 NULL
728}; 772};
729 773
@@ -763,6 +807,9 @@ static void asus_hotk_add_fs(void)
763 ASUS_SET_DEVICE_ATTR(ls_level, 0644, show_lslvl, store_lslvl); 807 ASUS_SET_DEVICE_ATTR(ls_level, 0644, show_lslvl, store_lslvl);
764 ASUS_SET_DEVICE_ATTR(ls_switch, 0644, show_lssw, store_lssw); 808 ASUS_SET_DEVICE_ATTR(ls_switch, 0644, show_lssw, store_lssw);
765 } 809 }
810
811 if (gps_status_handle && gps_on_handle && gps_off_handle)
812 ASUS_SET_DEVICE_ATTR(gps, 0644, show_gps, store_gps);
766} 813}
767 814
768static int asus_handle_init(char *name, acpi_handle * handle, 815static int asus_handle_init(char *name, acpi_handle * handle,
@@ -890,9 +937,13 @@ static int asus_hotk_get_info(void)
890 937
891 /* There is a lot of models with "ALSL", but a few get 938 /* There is a lot of models with "ALSL", but a few get
892 a real light sens, so we need to check it. */ 939 a real light sens, so we need to check it. */
893 if (ASUS_HANDLE_INIT(ls_switch)) 940 if (!ASUS_HANDLE_INIT(ls_switch))
894 ASUS_HANDLE_INIT(ls_level); 941 ASUS_HANDLE_INIT(ls_level);
895 942
943 ASUS_HANDLE_INIT(gps_on);
944 ASUS_HANDLE_INIT(gps_off);
945 ASUS_HANDLE_INIT(gps_status);
946
896 kfree(model); 947 kfree(model);
897 948
898 return AE_OK; 949 return AE_OK;
@@ -950,7 +1001,7 @@ static int asus_hotk_add(struct acpi_device *device)
950 * We install the handler, it will receive the hotk in parameter, so, we 1001 * We install the handler, it will receive the hotk in parameter, so, we
951 * could add other data to the hotk struct 1002 * could add other data to the hotk struct
952 */ 1003 */
953 status = acpi_install_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY, 1004 status = acpi_install_notify_handler(hotk->handle, ACPI_ALL_NOTIFY,
954 asus_hotk_notify, hotk); 1005 asus_hotk_notify, hotk);
955 if (ACPI_FAILURE(status)) 1006 if (ACPI_FAILURE(status))
956 printk(ASUS_ERR "Error installing notify handler\n"); 1007 printk(ASUS_ERR "Error installing notify handler\n");
@@ -981,6 +1032,9 @@ static int asus_hotk_add(struct acpi_device *device)
981 if (ls_level_handle) 1032 if (ls_level_handle)
982 set_light_sens_level(hotk->light_level); 1033 set_light_sens_level(hotk->light_level);
983 1034
1035 /* GPS is on by default */
1036 write_status(NULL, 1, GPS_ON);
1037
984 end: 1038 end:
985 if (result) { 1039 if (result) {
986 kfree(hotk->name); 1040 kfree(hotk->name);
@@ -997,7 +1051,7 @@ static int asus_hotk_remove(struct acpi_device *device, int type)
997 if (!device || !acpi_driver_data(device)) 1051 if (!device || !acpi_driver_data(device))
998 return -EINVAL; 1052 return -EINVAL;
999 1053
1000 status = acpi_remove_notify_handler(hotk->handle, ACPI_SYSTEM_NOTIFY, 1054 status = acpi_remove_notify_handler(hotk->handle, ACPI_ALL_NOTIFY,
1001 asus_hotk_notify); 1055 asus_hotk_notify);
1002 if (ACPI_FAILURE(status)) 1056 if (ACPI_FAILURE(status))
1003 printk(ASUS_ERR "Error removing notify handler\n"); 1057 printk(ASUS_ERR "Error removing notify handler\n");
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c
index 68c4b58525ba..41e901f53e7c 100644
--- a/drivers/misc/msi-laptop.c
+++ b/drivers/misc/msi-laptop.c
@@ -85,7 +85,7 @@ static int set_lcd_level(int level)
85 buf[0] = 0x80; 85 buf[0] = 0x80;
86 buf[1] = (u8) (level*31); 86 buf[1] = (u8) (level*31);
87 87
88 return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, buf, sizeof(buf), NULL, 0); 88 return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, buf, sizeof(buf), NULL, 0, 1);
89} 89}
90 90
91static int get_lcd_level(void) 91static int get_lcd_level(void)
@@ -93,7 +93,7 @@ static int get_lcd_level(void)
93 u8 wdata = 0, rdata; 93 u8 wdata = 0, rdata;
94 int result; 94 int result;
95 95
96 result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1); 96 result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1, 1);
97 if (result < 0) 97 if (result < 0)
98 return result; 98 return result;
99 99
@@ -105,7 +105,7 @@ static int get_auto_brightness(void)
105 u8 wdata = 4, rdata; 105 u8 wdata = 4, rdata;
106 int result; 106 int result;
107 107
108 result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1); 108 result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, &wdata, 1, &rdata, 1, 1);
109 if (result < 0) 109 if (result < 0)
110 return result; 110 return result;
111 111
@@ -119,14 +119,14 @@ static int set_auto_brightness(int enable)
119 119
120 wdata[0] = 4; 120 wdata[0] = 4;
121 121
122 result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 1, &rdata, 1); 122 result = ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 1, &rdata, 1, 1);
123 if (result < 0) 123 if (result < 0)
124 return result; 124 return result;
125 125
126 wdata[0] = 0x84; 126 wdata[0] = 0x84;
127 wdata[1] = (rdata & 0xF7) | (enable ? 8 : 0); 127 wdata[1] = (rdata & 0xF7) | (enable ? 8 : 0);
128 128
129 return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0); 129 return ec_transaction(MSI_EC_COMMAND_LCD_LEVEL, wdata, 2, NULL, 0, 1);
130} 130}
131 131
132static int get_wireless_state(int *wlan, int *bluetooth) 132static int get_wireless_state(int *wlan, int *bluetooth)
@@ -134,7 +134,7 @@ static int get_wireless_state(int *wlan, int *bluetooth)
134 u8 wdata = 0, rdata; 134 u8 wdata = 0, rdata;
135 int result; 135 int result;
136 136
137 result = ec_transaction(MSI_EC_COMMAND_WIRELESS, &wdata, 1, &rdata, 1); 137 result = ec_transaction(MSI_EC_COMMAND_WIRELESS, &wdata, 1, &rdata, 1, 1);
138 if (result < 0) 138 if (result < 0)
139 return -1; 139 return -1;
140 140
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index c15c1f61bd1b..8ee0321ef1c8 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -63,7 +63,7 @@
63#include <asm/uaccess.h> 63#include <asm/uaccess.h>
64#include <linux/sonypi.h> 64#include <linux/sonypi.h>
65#include <linux/sony-laptop.h> 65#include <linux/sony-laptop.h>
66#ifdef CONFIG_SONY_LAPTOP_OLD 66#ifdef CONFIG_SONYPI_COMPAT
67#include <linux/poll.h> 67#include <linux/poll.h>
68#include <linux/miscdevice.h> 68#include <linux/miscdevice.h>
69#endif 69#endif
@@ -114,7 +114,7 @@ MODULE_PARM_DESC(camera,
114 "set this to 1 to enable Motion Eye camera controls " 114 "set this to 1 to enable Motion Eye camera controls "
115 "(only use it if you have a C1VE or C1VN model)"); 115 "(only use it if you have a C1VE or C1VN model)");
116 116
117#ifdef CONFIG_SONY_LAPTOP_OLD 117#ifdef CONFIG_SONYPI_COMPAT
118static int minor = -1; 118static int minor = -1;
119module_param(minor, int, 0); 119module_param(minor, int, 0);
120MODULE_PARM_DESC(minor, 120MODULE_PARM_DESC(minor,
@@ -1504,7 +1504,7 @@ static struct attribute_group spic_attribute_group = {
1504}; 1504};
1505 1505
1506/******** SONYPI compatibility **********/ 1506/******** SONYPI compatibility **********/
1507#ifdef CONFIG_SONY_LAPTOP_OLD 1507#ifdef CONFIG_SONYPI_COMPAT
1508 1508
1509/* battery / brightness / temperature addresses */ 1509/* battery / brightness / temperature addresses */
1510#define SONYPI_BAT_FLAGS 0x81 1510#define SONYPI_BAT_FLAGS 0x81
@@ -1798,7 +1798,7 @@ static void sonypi_compat_exit(void)
1798static int sonypi_compat_init(void) { return 0; } 1798static int sonypi_compat_init(void) { return 0; }
1799static void sonypi_compat_exit(void) { } 1799static void sonypi_compat_exit(void) { }
1800static void sonypi_compat_report_event(u8 event) { } 1800static void sonypi_compat_report_event(u8 event) { }
1801#endif /* CONFIG_SONY_LAPTOP_OLD */ 1801#endif /* CONFIG_SONYPI_COMPAT */
1802 1802
1803/* 1803/*
1804 * ACPI callbacks 1804 * ACPI callbacks