diff options
Diffstat (limited to 'drivers/platform/x86/asus-laptop.c')
-rw-r--r-- | drivers/platform/x86/asus-laptop.c | 221 |
1 files changed, 111 insertions, 110 deletions
diff --git a/drivers/platform/x86/asus-laptop.c b/drivers/platform/x86/asus-laptop.c index 8834405be1fd..2505f15cbe6b 100644 --- a/drivers/platform/x86/asus-laptop.c +++ b/drivers/platform/x86/asus-laptop.c | |||
@@ -52,11 +52,11 @@ | |||
52 | 52 | ||
53 | #define ASUS_LAPTOP_VERSION "0.42" | 53 | #define ASUS_LAPTOP_VERSION "0.42" |
54 | 54 | ||
55 | #define ASUS_HOTK_NAME "Asus Laptop Support" | 55 | #define ASUS_LAPTOP_NAME "Asus Laptop Support" |
56 | #define ASUS_HOTK_CLASS "hotkey" | 56 | #define ASUS_LAPTOP_CLASS "hotkey" |
57 | #define ASUS_HOTK_DEVICE_NAME "Hotkey" | 57 | #define ASUS_LAPTOP_DEVICE_NAME "Hotkey" |
58 | #define ASUS_HOTK_FILE KBUILD_MODNAME | 58 | #define ASUS_LAPTOP_FILE KBUILD_MODNAME |
59 | #define ASUS_HOTK_PREFIX "\\_SB.ATKD." | 59 | #define ASUS_LAPTOP_PREFIX "\\_SB.ATKD." |
60 | 60 | ||
61 | 61 | ||
62 | /* | 62 | /* |
@@ -89,7 +89,7 @@ | |||
89 | #define KEY_ON 0x200 /* Keyboard backlight */ | 89 | #define KEY_ON 0x200 /* Keyboard backlight */ |
90 | 90 | ||
91 | MODULE_AUTHOR("Julien Lerouge, Karol Kozimor, Corentin Chary"); | 91 | MODULE_AUTHOR("Julien Lerouge, Karol Kozimor, Corentin Chary"); |
92 | MODULE_DESCRIPTION(ASUS_HOTK_NAME); | 92 | MODULE_DESCRIPTION(ASUS_LAPTOP_NAME); |
93 | MODULE_LICENSE("GPL"); | 93 | MODULE_LICENSE("GPL"); |
94 | 94 | ||
95 | /* | 95 | /* |
@@ -124,27 +124,27 @@ MODULE_PARM_DESC(bluetooth_status, "Set the wireless status on boot " | |||
124 | static char *object##_paths[] = { paths } | 124 | static char *object##_paths[] = { paths } |
125 | 125 | ||
126 | /* LED */ | 126 | /* LED */ |
127 | ASUS_HANDLE(mled_set, ASUS_HOTK_PREFIX "MLED"); | 127 | ASUS_HANDLE(mled_set, ASUS_LAPTOP_PREFIX "MLED"); |
128 | ASUS_HANDLE(tled_set, ASUS_HOTK_PREFIX "TLED"); | 128 | ASUS_HANDLE(tled_set, ASUS_LAPTOP_PREFIX "TLED"); |
129 | ASUS_HANDLE(rled_set, ASUS_HOTK_PREFIX "RLED"); /* W1JC */ | 129 | ASUS_HANDLE(rled_set, ASUS_LAPTOP_PREFIX "RLED"); /* W1JC */ |
130 | ASUS_HANDLE(pled_set, ASUS_HOTK_PREFIX "PLED"); /* A7J */ | 130 | ASUS_HANDLE(pled_set, ASUS_LAPTOP_PREFIX "PLED"); /* A7J */ |
131 | ASUS_HANDLE(gled_set, ASUS_HOTK_PREFIX "GLED"); /* G1, G2 (probably) */ | 131 | ASUS_HANDLE(gled_set, ASUS_LAPTOP_PREFIX "GLED"); /* G1, G2 (probably) */ |
132 | 132 | ||
133 | /* LEDD */ | 133 | /* LEDD */ |
134 | ASUS_HANDLE(ledd_set, ASUS_HOTK_PREFIX "SLCM"); | 134 | ASUS_HANDLE(ledd_set, ASUS_LAPTOP_PREFIX "SLCM"); |
135 | 135 | ||
136 | /* | 136 | /* |
137 | * Bluetooth and WLAN | 137 | * Bluetooth and WLAN |
138 | * WLED and BLED are not handled like other XLED, because in some dsdt | 138 | * WLED and BLED are not handled like other XLED, because in some dsdt |
139 | * they also control the WLAN/Bluetooth device. | 139 | * they also control the WLAN/Bluetooth device. |
140 | */ | 140 | */ |
141 | ASUS_HANDLE(wl_switch, ASUS_HOTK_PREFIX "WLED"); | 141 | ASUS_HANDLE(wl_switch, ASUS_LAPTOP_PREFIX "WLED"); |
142 | ASUS_HANDLE(bt_switch, ASUS_HOTK_PREFIX "BLED"); | 142 | ASUS_HANDLE(bt_switch, ASUS_LAPTOP_PREFIX "BLED"); |
143 | ASUS_HANDLE(wireless_status, ASUS_HOTK_PREFIX "RSTS"); /* All new models */ | 143 | ASUS_HANDLE(wireless_status, ASUS_LAPTOP_PREFIX "RSTS"); /* All new models */ |
144 | 144 | ||
145 | /* Brightness */ | 145 | /* Brightness */ |
146 | ASUS_HANDLE(brightness_set, ASUS_HOTK_PREFIX "SPLV"); | 146 | ASUS_HANDLE(brightness_set, ASUS_LAPTOP_PREFIX "SPLV"); |
147 | ASUS_HANDLE(brightness_get, ASUS_HOTK_PREFIX "GPLV"); | 147 | ASUS_HANDLE(brightness_get, ASUS_LAPTOP_PREFIX "GPLV"); |
148 | 148 | ||
149 | /* Backlight */ | 149 | /* Backlight */ |
150 | ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */ | 150 | ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */ |
@@ -157,7 +157,7 @@ ASUS_HANDLE(lcd_switch, "\\_SB.PCI0.SBRG.EC0._Q10", /* All new models */ | |||
157 | "\\Q10"); /* A2x, L2D, L3D, M2E */ | 157 | "\\Q10"); /* A2x, L2D, L3D, M2E */ |
158 | 158 | ||
159 | /* Display */ | 159 | /* Display */ |
160 | ASUS_HANDLE(display_set, ASUS_HOTK_PREFIX "SDSP"); | 160 | ASUS_HANDLE(display_set, ASUS_LAPTOP_PREFIX "SDSP"); |
161 | ASUS_HANDLE(display_get, | 161 | ASUS_HANDLE(display_get, |
162 | /* A6B, A6K A6R A7D F3JM L4R M6R A3G M6A M6V VX-1 V6J V6V W3Z */ | 162 | /* A6B, A6K A6R A7D F3JM L4R M6R A3G M6A M6V VX-1 V6J V6V W3Z */ |
163 | "\\_SB.PCI0.P0P1.VGA.GETD", | 163 | "\\_SB.PCI0.P0P1.VGA.GETD", |
@@ -182,24 +182,24 @@ ASUS_HANDLE(display_get, | |||
182 | /* A3F A6F A3N A3L M6N W3N W6A */ | 182 | /* A3F A6F A3N A3L M6N W3N W6A */ |
183 | "\\SSTE"); | 183 | "\\SSTE"); |
184 | 184 | ||
185 | ASUS_HANDLE(ls_switch, ASUS_HOTK_PREFIX "ALSC"); /* Z71A Z71V */ | 185 | ASUS_HANDLE(ls_switch, ASUS_LAPTOP_PREFIX "ALSC"); /* Z71A Z71V */ |
186 | ASUS_HANDLE(ls_level, ASUS_HOTK_PREFIX "ALSL"); /* Z71A Z71V */ | 186 | ASUS_HANDLE(ls_level, ASUS_LAPTOP_PREFIX "ALSL"); /* Z71A Z71V */ |
187 | 187 | ||
188 | /* GPS */ | 188 | /* GPS */ |
189 | /* R2H use different handle for GPS on/off */ | 189 | /* R2H use different handle for GPS on/off */ |
190 | ASUS_HANDLE(gps_on, ASUS_HOTK_PREFIX "SDON"); /* R2H */ | 190 | ASUS_HANDLE(gps_on, ASUS_LAPTOP_PREFIX "SDON"); /* R2H */ |
191 | ASUS_HANDLE(gps_off, ASUS_HOTK_PREFIX "SDOF"); /* R2H */ | 191 | ASUS_HANDLE(gps_off, ASUS_LAPTOP_PREFIX "SDOF"); /* R2H */ |
192 | ASUS_HANDLE(gps_status, ASUS_HOTK_PREFIX "GPST"); | 192 | ASUS_HANDLE(gps_status, ASUS_LAPTOP_PREFIX "GPST"); |
193 | 193 | ||
194 | /* Keyboard light */ | 194 | /* Keyboard light */ |
195 | ASUS_HANDLE(kled_set, ASUS_HOTK_PREFIX "SLKB"); | 195 | ASUS_HANDLE(kled_set, ASUS_LAPTOP_PREFIX "SLKB"); |
196 | ASUS_HANDLE(kled_get, ASUS_HOTK_PREFIX "GLKB"); | 196 | ASUS_HANDLE(kled_get, ASUS_LAPTOP_PREFIX "GLKB"); |
197 | 197 | ||
198 | /* | 198 | /* |
199 | * This is the main structure, we can use it to store anything interesting | 199 | * This is the main structure, we can use it to store anything interesting |
200 | * about the hotk device | 200 | * about the hotk device |
201 | */ | 201 | */ |
202 | struct asus_hotk { | 202 | struct asus_laptop { |
203 | char *name; /* laptop name */ | 203 | char *name; /* laptop name */ |
204 | 204 | ||
205 | struct platform_device *platform_device; | 205 | struct platform_device *platform_device; |
@@ -216,13 +216,13 @@ struct asus_hotk { | |||
216 | 216 | ||
217 | /* | 217 | /* |
218 | * This header is made available to allow proper configuration given model, | 218 | * This header is made available to allow proper configuration given model, |
219 | * revision number , ... this info cannot go in struct asus_hotk because it is | 219 | * revision number , ... this info cannot go in struct asus_laptop because it is |
220 | * available before the hotk | 220 | * available before the hotk |
221 | */ | 221 | */ |
222 | static struct acpi_table_header *asus_info; | 222 | static struct acpi_table_header *asus_info; |
223 | 223 | ||
224 | /* The actual device the driver binds to */ | 224 | /* The actual device the driver binds to */ |
225 | static struct asus_hotk *hotk; | 225 | static struct asus_laptop *asus; |
226 | 226 | ||
227 | /* The backlight device /sys/class/backlight */ | 227 | /* The backlight device /sys/class/backlight */ |
228 | static struct backlight_device *asus_backlight_device; | 228 | static struct backlight_device *asus_backlight_device; |
@@ -353,7 +353,7 @@ static int read_wireless_status(int mask) | |||
353 | acpi_status rv = AE_OK; | 353 | acpi_status rv = AE_OK; |
354 | 354 | ||
355 | if (!wireless_status_handle) | 355 | if (!wireless_status_handle) |
356 | return (hotk->status & mask) ? 1 : 0; | 356 | return (asus->status & mask) ? 1 : 0; |
357 | 357 | ||
358 | rv = acpi_evaluate_integer(wireless_status_handle, NULL, NULL, &status); | 358 | rv = acpi_evaluate_integer(wireless_status_handle, NULL, NULL, &status); |
359 | if (ACPI_FAILURE(rv)) | 359 | if (ACPI_FAILURE(rv)) |
@@ -361,7 +361,7 @@ static int read_wireless_status(int mask) | |||
361 | else | 361 | else |
362 | return (status & mask) ? 1 : 0; | 362 | return (status & mask) ? 1 : 0; |
363 | 363 | ||
364 | return (hotk->status & mask) ? 1 : 0; | 364 | return (asus->status & mask) ? 1 : 0; |
365 | } | 365 | } |
366 | 366 | ||
367 | static int read_gps_status(void) | 367 | static int read_gps_status(void) |
@@ -375,7 +375,7 @@ static int read_gps_status(void) | |||
375 | else | 375 | else |
376 | return status ? 1 : 0; | 376 | return status ? 1 : 0; |
377 | 377 | ||
378 | return (hotk->status & GPS_ON) ? 1 : 0; | 378 | return (asus->status & GPS_ON) ? 1 : 0; |
379 | } | 379 | } |
380 | 380 | ||
381 | /* Generic LED functions */ | 381 | /* Generic LED functions */ |
@@ -387,12 +387,12 @@ static int read_status(int mask) | |||
387 | else if (mask == GPS_ON) | 387 | else if (mask == GPS_ON) |
388 | return read_gps_status(); | 388 | return read_gps_status(); |
389 | 389 | ||
390 | return (hotk->status & mask) ? 1 : 0; | 390 | return (asus->status & mask) ? 1 : 0; |
391 | } | 391 | } |
392 | 392 | ||
393 | static void write_status(acpi_handle handle, int out, int mask) | 393 | static void write_status(acpi_handle handle, int out, int mask) |
394 | { | 394 | { |
395 | hotk->status = (out) ? (hotk->status | mask) : (hotk->status & ~mask); | 395 | asus->status = (out) ? (asus->status | mask) : (asus->status & ~mask); |
396 | 396 | ||
397 | switch (mask) { | 397 | switch (mask) { |
398 | case MLED_ON: | 398 | case MLED_ON: |
@@ -586,15 +586,15 @@ static ssize_t show_infos(struct device *dev, | |||
586 | * to 1 | 586 | * to 1 |
587 | */ | 587 | */ |
588 | 588 | ||
589 | len += sprintf(page, ASUS_HOTK_NAME " " ASUS_LAPTOP_VERSION "\n"); | 589 | len += sprintf(page, ASUS_LAPTOP_NAME " " ASUS_LAPTOP_VERSION "\n"); |
590 | len += sprintf(page + len, "Model reference : %s\n", hotk->name); | 590 | len += sprintf(page + len, "Model reference : %s\n", asus->name); |
591 | /* | 591 | /* |
592 | * The SFUN method probably allows the original driver to get the list | 592 | * The SFUN method probably allows the original driver to get the list |
593 | * of features supported by a given model. For now, 0x0100 or 0x0800 | 593 | * of features supported by a given model. For now, 0x0100 or 0x0800 |
594 | * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card. | 594 | * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card. |
595 | * The significance of others is yet to be found. | 595 | * The significance of others is yet to be found. |
596 | */ | 596 | */ |
597 | rv = acpi_evaluate_integer(hotk->handle, "SFUN", NULL, &temp); | 597 | rv = acpi_evaluate_integer(asus->handle, "SFUN", NULL, &temp); |
598 | if (!ACPI_FAILURE(rv)) | 598 | if (!ACPI_FAILURE(rv)) |
599 | len += sprintf(page + len, "SFUN value : %#x\n", | 599 | len += sprintf(page + len, "SFUN value : %#x\n", |
600 | (uint) temp); | 600 | (uint) temp); |
@@ -604,7 +604,7 @@ static ssize_t show_infos(struct device *dev, | |||
604 | * The significance of others is yet to be found. | 604 | * The significance of others is yet to be found. |
605 | * If we don't find the method, we assume the device are present. | 605 | * If we don't find the method, we assume the device are present. |
606 | */ | 606 | */ |
607 | rv = acpi_evaluate_integer(hotk->handle, "HRWS", NULL, &temp); | 607 | rv = acpi_evaluate_integer(asus->handle, "HRWS", NULL, &temp); |
608 | if (!ACPI_FAILURE(rv)) | 608 | if (!ACPI_FAILURE(rv)) |
609 | len += sprintf(page + len, "HRWS value : %#x\n", | 609 | len += sprintf(page + len, "HRWS value : %#x\n", |
610 | (uint) temp); | 610 | (uint) temp); |
@@ -615,7 +615,7 @@ static ssize_t show_infos(struct device *dev, | |||
615 | * Note: since not all the laptops provide this method, errors are | 615 | * Note: since not all the laptops provide this method, errors are |
616 | * silently ignored. | 616 | * silently ignored. |
617 | */ | 617 | */ |
618 | rv = acpi_evaluate_integer(hotk->handle, "ASYM", NULL, &temp); | 618 | rv = acpi_evaluate_integer(asus->handle, "ASYM", NULL, &temp); |
619 | if (!ACPI_FAILURE(rv)) | 619 | if (!ACPI_FAILURE(rv)) |
620 | len += sprintf(page + len, "ASYM value : %#x\n", | 620 | len += sprintf(page + len, "ASYM value : %#x\n", |
621 | (uint) temp); | 621 | (uint) temp); |
@@ -673,7 +673,7 @@ static ssize_t store_status(const char *buf, size_t count, | |||
673 | static ssize_t show_ledd(struct device *dev, | 673 | static ssize_t show_ledd(struct device *dev, |
674 | struct device_attribute *attr, char *buf) | 674 | struct device_attribute *attr, char *buf) |
675 | { | 675 | { |
676 | return sprintf(buf, "0x%08x\n", hotk->ledd_status); | 676 | return sprintf(buf, "0x%08x\n", asus->ledd_status); |
677 | } | 677 | } |
678 | 678 | ||
679 | static ssize_t store_ledd(struct device *dev, struct device_attribute *attr, | 679 | static ssize_t store_ledd(struct device *dev, struct device_attribute *attr, |
@@ -686,7 +686,7 @@ static ssize_t store_ledd(struct device *dev, struct device_attribute *attr, | |||
686 | if (write_acpi_int(ledd_set_handle, NULL, value)) | 686 | if (write_acpi_int(ledd_set_handle, NULL, value)) |
687 | pr_warning("LED display write failed\n"); | 687 | pr_warning("LED display write failed\n"); |
688 | else | 688 | else |
689 | hotk->ledd_status = (u32) value; | 689 | asus->ledd_status = (u32) value; |
690 | } | 690 | } |
691 | return rv; | 691 | return rv; |
692 | } | 692 | } |
@@ -789,13 +789,13 @@ static void set_light_sens_switch(int value) | |||
789 | { | 789 | { |
790 | if (write_acpi_int(ls_switch_handle, NULL, value)) | 790 | if (write_acpi_int(ls_switch_handle, NULL, value)) |
791 | pr_warning("Error setting light sensor switch\n"); | 791 | pr_warning("Error setting light sensor switch\n"); |
792 | hotk->light_switch = value; | 792 | asus->light_switch = value; |
793 | } | 793 | } |
794 | 794 | ||
795 | static ssize_t show_lssw(struct device *dev, | 795 | static ssize_t show_lssw(struct device *dev, |
796 | struct device_attribute *attr, char *buf) | 796 | struct device_attribute *attr, char *buf) |
797 | { | 797 | { |
798 | return sprintf(buf, "%d\n", hotk->light_switch); | 798 | return sprintf(buf, "%d\n", asus->light_switch); |
799 | } | 799 | } |
800 | 800 | ||
801 | static ssize_t store_lssw(struct device *dev, struct device_attribute *attr, | 801 | static ssize_t store_lssw(struct device *dev, struct device_attribute *attr, |
@@ -814,13 +814,13 @@ static void set_light_sens_level(int value) | |||
814 | { | 814 | { |
815 | if (write_acpi_int(ls_level_handle, NULL, value)) | 815 | if (write_acpi_int(ls_level_handle, NULL, value)) |
816 | pr_warning("Error setting light sensor level\n"); | 816 | pr_warning("Error setting light sensor level\n"); |
817 | hotk->light_level = value; | 817 | asus->light_level = value; |
818 | } | 818 | } |
819 | 819 | ||
820 | static ssize_t show_lslvl(struct device *dev, | 820 | static ssize_t show_lslvl(struct device *dev, |
821 | struct device_attribute *attr, char *buf) | 821 | struct device_attribute *attr, char *buf) |
822 | { | 822 | { |
823 | return sprintf(buf, "%d\n", hotk->light_level); | 823 | return sprintf(buf, "%d\n", asus->light_level); |
824 | } | 824 | } |
825 | 825 | ||
826 | static ssize_t store_lslvl(struct device *dev, struct device_attribute *attr, | 826 | static ssize_t store_lslvl(struct device *dev, struct device_attribute *attr, |
@@ -929,23 +929,23 @@ static void asus_acpi_notify(struct acpi_device *device, u32 event) | |||
929 | } | 929 | } |
930 | 930 | ||
931 | /* TODO Find a better way to handle events count. */ | 931 | /* TODO Find a better way to handle events count. */ |
932 | count = hotk->event_count[event % 128]++; | 932 | count = asus->event_count[event % 128]++; |
933 | acpi_bus_generate_proc_event(hotk->device, event, count); | 933 | acpi_bus_generate_proc_event(asus->device, event, count); |
934 | acpi_bus_generate_netlink_event(hotk->device->pnp.device_class, | 934 | acpi_bus_generate_netlink_event(asus->device->pnp.device_class, |
935 | dev_name(&hotk->device->dev), event, | 935 | dev_name(&asus->device->dev), event, |
936 | count); | 936 | count); |
937 | 937 | ||
938 | if (hotk->inputdev) { | 938 | if (asus->inputdev) { |
939 | key = asus_get_entry_by_scancode(event); | 939 | key = asus_get_entry_by_scancode(event); |
940 | if (!key) | 940 | if (!key) |
941 | return ; | 941 | return ; |
942 | 942 | ||
943 | switch (key->type) { | 943 | switch (key->type) { |
944 | case KE_KEY: | 944 | case KE_KEY: |
945 | input_report_key(hotk->inputdev, key->keycode, 1); | 945 | input_report_key(asus->inputdev, key->keycode, 1); |
946 | input_sync(hotk->inputdev); | 946 | input_sync(asus->inputdev); |
947 | input_report_key(hotk->inputdev, key->keycode, 0); | 947 | input_report_key(asus->inputdev, key->keycode, 0); |
948 | input_sync(hotk->inputdev); | 948 | input_sync(asus->inputdev); |
949 | break; | 949 | break; |
950 | } | 950 | } |
951 | } | 951 | } |
@@ -996,42 +996,42 @@ static int asus_platform_init(void) | |||
996 | { | 996 | { |
997 | int result; | 997 | int result; |
998 | 998 | ||
999 | hotk->platform_device = platform_device_alloc(ASUS_HOTK_FILE, -1); | 999 | asus->platform_device = platform_device_alloc(ASUS_LAPTOP_FILE, -1); |
1000 | if (!hotk->platform_device) | 1000 | if (!asus->platform_device) |
1001 | return -ENOMEM; | 1001 | return -ENOMEM; |
1002 | 1002 | ||
1003 | result = platform_device_add(hotk->platform_device); | 1003 | result = platform_device_add(asus->platform_device); |
1004 | if (result) | 1004 | if (result) |
1005 | goto fail_platform_device; | 1005 | goto fail_platform_device; |
1006 | 1006 | ||
1007 | result = sysfs_create_group(&hotk->platform_device->dev.kobj, | 1007 | result = sysfs_create_group(&asus->platform_device->dev.kobj, |
1008 | &platform_attribute_group); | 1008 | &platform_attribute_group); |
1009 | if (result) | 1009 | if (result) |
1010 | goto fail_sysfs; | 1010 | goto fail_sysfs; |
1011 | return 0; | 1011 | return 0; |
1012 | 1012 | ||
1013 | fail_sysfs: | 1013 | fail_sysfs: |
1014 | platform_device_del(hotk->platform_device); | 1014 | platform_device_del(asus->platform_device); |
1015 | fail_platform_device: | 1015 | fail_platform_device: |
1016 | platform_device_put(hotk->platform_device); | 1016 | platform_device_put(asus->platform_device); |
1017 | return result; | 1017 | return result; |
1018 | } | 1018 | } |
1019 | 1019 | ||
1020 | static void asus_platform_exit(void) | 1020 | static void asus_platform_exit(void) |
1021 | { | 1021 | { |
1022 | sysfs_remove_group(&hotk->platform_device->dev.kobj, | 1022 | sysfs_remove_group(&asus->platform_device->dev.kobj, |
1023 | &platform_attribute_group); | 1023 | &platform_attribute_group); |
1024 | platform_device_unregister(hotk->platform_device); | 1024 | platform_device_unregister(asus->platform_device); |
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | static struct platform_driver platform_driver = { | 1027 | static struct platform_driver platform_driver = { |
1028 | .driver = { | 1028 | .driver = { |
1029 | .name = ASUS_HOTK_FILE, | 1029 | .name = ASUS_LAPTOP_FILE, |
1030 | .owner = THIS_MODULE, | 1030 | .owner = THIS_MODULE, |
1031 | } | 1031 | } |
1032 | }; | 1032 | }; |
1033 | 1033 | ||
1034 | static void asus_hotk_add_fs(void) | 1034 | static void asus_laptop_add_fs(void) |
1035 | { | 1035 | { |
1036 | ASUS_SET_DEVICE_ATTR(infos, 0444, show_infos, NULL); | 1036 | ASUS_SET_DEVICE_ATTR(infos, 0444, show_infos, NULL); |
1037 | 1037 | ||
@@ -1080,10 +1080,11 @@ static int asus_handle_init(char *name, acpi_handle * handle, | |||
1080 | ARRAY_SIZE(object##_paths)) | 1080 | ARRAY_SIZE(object##_paths)) |
1081 | 1081 | ||
1082 | /* | 1082 | /* |
1083 | * This function is used to initialize the hotk with right values. In this | 1083 | * This function is used to initialize the context with right values. In this |
1084 | * method, we can make all the detection we want, and modify the hotk struct | 1084 | * method, we can make all the detection we want, and modify the asus_laptop |
1085 | * struct | ||
1085 | */ | 1086 | */ |
1086 | static int asus_hotk_get_info(void) | 1087 | static int asus_laptop_get_info(void) |
1087 | { | 1088 | { |
1088 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 1089 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
1089 | union acpi_object *model = NULL; | 1090 | union acpi_object *model = NULL; |
@@ -1104,14 +1105,14 @@ static int asus_hotk_get_info(void) | |||
1104 | pr_warning("Couldn't get the DSDT table header\n"); | 1105 | pr_warning("Couldn't get the DSDT table header\n"); |
1105 | 1106 | ||
1106 | /* We have to write 0 on init this far for all ASUS models */ | 1107 | /* We have to write 0 on init this far for all ASUS models */ |
1107 | if (write_acpi_int_ret(hotk->handle, "INIT", 0, &buffer)) { | 1108 | if (write_acpi_int_ret(asus->handle, "INIT", 0, &buffer)) { |
1108 | pr_err("Hotkey initialization failed\n"); | 1109 | pr_err("Hotkey initialization failed\n"); |
1109 | return -ENODEV; | 1110 | return -ENODEV; |
1110 | } | 1111 | } |
1111 | 1112 | ||
1112 | /* This needs to be called for some laptops to init properly */ | 1113 | /* This needs to be called for some laptops to init properly */ |
1113 | status = | 1114 | status = |
1114 | acpi_evaluate_integer(hotk->handle, "BSTS", NULL, &bsts_result); | 1115 | acpi_evaluate_integer(asus->handle, "BSTS", NULL, &bsts_result); |
1115 | if (ACPI_FAILURE(status)) | 1116 | if (ACPI_FAILURE(status)) |
1116 | pr_warning("Error calling BSTS\n"); | 1117 | pr_warning("Error calling BSTS\n"); |
1117 | else if (bsts_result) | 1118 | else if (bsts_result) |
@@ -1119,7 +1120,7 @@ static int asus_hotk_get_info(void) | |||
1119 | (uint) bsts_result); | 1120 | (uint) bsts_result); |
1120 | 1121 | ||
1121 | /* This too ... */ | 1122 | /* This too ... */ |
1122 | write_acpi_int(hotk->handle, "CWAP", wapf); | 1123 | write_acpi_int(asus->handle, "CWAP", wapf); |
1123 | 1124 | ||
1124 | /* | 1125 | /* |
1125 | * Try to match the object returned by INIT to the specific model. | 1126 | * Try to match the object returned by INIT to the specific model. |
@@ -1141,8 +1142,8 @@ static int asus_hotk_get_info(void) | |||
1141 | break; | 1142 | break; |
1142 | } | 1143 | } |
1143 | } | 1144 | } |
1144 | hotk->name = kstrdup(string, GFP_KERNEL); | 1145 | asus->name = kstrdup(string, GFP_KERNEL); |
1145 | if (!hotk->name) | 1146 | if (!asus->name) |
1146 | return -ENOMEM; | 1147 | return -ENOMEM; |
1147 | 1148 | ||
1148 | if (*string) | 1149 | if (*string) |
@@ -1166,7 +1167,7 @@ static int asus_hotk_get_info(void) | |||
1166 | * If we don't find the method, we assume the device are present. | 1167 | * If we don't find the method, we assume the device are present. |
1167 | */ | 1168 | */ |
1168 | status = | 1169 | status = |
1169 | acpi_evaluate_integer(hotk->handle, "HRWS", NULL, &hwrs_result); | 1170 | acpi_evaluate_integer(asus->handle, "HRWS", NULL, &hwrs_result); |
1170 | if (ACPI_FAILURE(status)) | 1171 | if (ACPI_FAILURE(status)) |
1171 | hwrs_result = WL_HWRS | BT_HWRS; | 1172 | hwrs_result = WL_HWRS | BT_HWRS; |
1172 | 1173 | ||
@@ -1206,30 +1207,30 @@ static int asus_input_init(struct device *dev) | |||
1206 | const struct key_entry *key; | 1207 | const struct key_entry *key; |
1207 | int result; | 1208 | int result; |
1208 | 1209 | ||
1209 | hotk->inputdev = input_allocate_device(); | 1210 | asus->inputdev = input_allocate_device(); |
1210 | if (!hotk->inputdev) { | 1211 | if (!asus->inputdev) { |
1211 | pr_info("Unable to allocate input device\n"); | 1212 | pr_info("Unable to allocate input device\n"); |
1212 | return 0; | 1213 | return 0; |
1213 | } | 1214 | } |
1214 | hotk->inputdev->name = "Asus Laptop extra buttons"; | 1215 | asus->inputdev->name = "Asus Laptop extra buttons"; |
1215 | hotk->inputdev->dev.parent = dev; | 1216 | asus->inputdev->dev.parent = dev; |
1216 | hotk->inputdev->phys = ASUS_HOTK_FILE "/input0"; | 1217 | asus->inputdev->phys = ASUS_LAPTOP_FILE "/input0"; |
1217 | hotk->inputdev->id.bustype = BUS_HOST; | 1218 | asus->inputdev->id.bustype = BUS_HOST; |
1218 | hotk->inputdev->getkeycode = asus_getkeycode; | 1219 | asus->inputdev->getkeycode = asus_getkeycode; |
1219 | hotk->inputdev->setkeycode = asus_setkeycode; | 1220 | asus->inputdev->setkeycode = asus_setkeycode; |
1220 | 1221 | ||
1221 | for (key = asus_keymap; key->type != KE_END; key++) { | 1222 | for (key = asus_keymap; key->type != KE_END; key++) { |
1222 | switch (key->type) { | 1223 | switch (key->type) { |
1223 | case KE_KEY: | 1224 | case KE_KEY: |
1224 | set_bit(EV_KEY, hotk->inputdev->evbit); | 1225 | set_bit(EV_KEY, asus->inputdev->evbit); |
1225 | set_bit(key->keycode, hotk->inputdev->keybit); | 1226 | set_bit(key->keycode, asus->inputdev->keybit); |
1226 | break; | 1227 | break; |
1227 | } | 1228 | } |
1228 | } | 1229 | } |
1229 | result = input_register_device(hotk->inputdev); | 1230 | result = input_register_device(asus->inputdev); |
1230 | if (result) { | 1231 | if (result) { |
1231 | pr_info("Unable to register input device\n"); | 1232 | pr_info("Unable to register input device\n"); |
1232 | input_free_device(hotk->inputdev); | 1233 | input_free_device(asus->inputdev); |
1233 | } | 1234 | } |
1234 | return result; | 1235 | return result; |
1235 | } | 1236 | } |
@@ -1257,8 +1258,8 @@ static void asus_led_exit(void) | |||
1257 | 1258 | ||
1258 | static void asus_input_exit(void) | 1259 | static void asus_input_exit(void) |
1259 | { | 1260 | { |
1260 | if (hotk->inputdev) | 1261 | if (asus->inputdev) |
1261 | input_unregister_device(hotk->inputdev); | 1262 | input_unregister_device(asus->inputdev); |
1262 | } | 1263 | } |
1263 | 1264 | ||
1264 | static int asus_backlight_init(struct device *dev) | 1265 | static int asus_backlight_init(struct device *dev) |
@@ -1266,7 +1267,7 @@ static int asus_backlight_init(struct device *dev) | |||
1266 | struct backlight_device *bd; | 1267 | struct backlight_device *bd; |
1267 | 1268 | ||
1268 | if (brightness_set_handle && lcd_switch_handle) { | 1269 | if (brightness_set_handle && lcd_switch_handle) { |
1269 | bd = backlight_device_register(ASUS_HOTK_FILE, dev, | 1270 | bd = backlight_device_register(ASUS_LAPTOP_FILE, dev, |
1270 | NULL, &asusbl_ops); | 1271 | NULL, &asusbl_ops); |
1271 | if (IS_ERR(bd)) { | 1272 | if (IS_ERR(bd)) { |
1272 | pr_err("Could not register asus backlight device\n"); | 1273 | pr_err("Could not register asus backlight device\n"); |
@@ -1354,19 +1355,19 @@ static int __devinit asus_acpi_init(struct acpi_device *device) | |||
1354 | { | 1355 | { |
1355 | int result = 0; | 1356 | int result = 0; |
1356 | 1357 | ||
1357 | result = acpi_bus_get_status(hotk->device); | 1358 | result = acpi_bus_get_status(asus->device); |
1358 | if (result) | 1359 | if (result) |
1359 | return result; | 1360 | return result; |
1360 | if (!hotk->device->status.present) { | 1361 | if (!asus->device->status.present) { |
1361 | pr_err("Hotkey device not present, aborting\n"); | 1362 | pr_err("Hotkey device not present, aborting\n"); |
1362 | return -ENODEV; | 1363 | return -ENODEV; |
1363 | } | 1364 | } |
1364 | 1365 | ||
1365 | result = asus_hotk_get_info(); | 1366 | result = asus_laptop_get_info(); |
1366 | if (result) | 1367 | if (result) |
1367 | return result; | 1368 | return result; |
1368 | 1369 | ||
1369 | asus_hotk_add_fs(); | 1370 | asus_laptop_add_fs(); |
1370 | 1371 | ||
1371 | /* WLED and BLED are on by default */ | 1372 | /* WLED and BLED are on by default */ |
1372 | write_status(bt_switch_handle, 1, BT_ON); | 1373 | write_status(bt_switch_handle, 1, BT_ON); |
@@ -1384,17 +1385,17 @@ static int __devinit asus_acpi_init(struct acpi_device *device) | |||
1384 | set_kled_lvl(1); | 1385 | set_kled_lvl(1); |
1385 | 1386 | ||
1386 | /* LED display is off by default */ | 1387 | /* LED display is off by default */ |
1387 | hotk->ledd_status = 0xFFF; | 1388 | asus->ledd_status = 0xFFF; |
1388 | 1389 | ||
1389 | /* Set initial values of light sensor and level */ | 1390 | /* Set initial values of light sensor and level */ |
1390 | hotk->light_switch = 0; /* Default to light sensor disabled */ | 1391 | hotk->light_switch = 0; /* Default to light sensor disabled */ |
1391 | hotk->light_level = 5; /* level 5 for sensor sensitivity */ | 1392 | hotk->light_level = 5; /* level 5 for sensor sensitivity */ |
1392 | 1393 | ||
1393 | if (ls_switch_handle) | 1394 | if (ls_switch_handle) |
1394 | set_light_sens_switch(hotk->light_switch); | 1395 | set_light_sens_switch(asus->light_switch); |
1395 | 1396 | ||
1396 | if (ls_level_handle) | 1397 | if (ls_level_handle) |
1397 | set_light_sens_level(hotk->light_level); | 1398 | set_light_sens_level(asus->light_level); |
1398 | 1399 | ||
1399 | /* GPS is on by default */ | 1400 | /* GPS is on by default */ |
1400 | write_status(NULL, 1, GPS_ON); | 1401 | write_status(NULL, 1, GPS_ON); |
@@ -1407,14 +1408,14 @@ static int __devinit asus_acpi_add(struct acpi_device *device) | |||
1407 | 1408 | ||
1408 | pr_notice("Asus Laptop Support version %s\n", | 1409 | pr_notice("Asus Laptop Support version %s\n", |
1409 | ASUS_LAPTOP_VERSION); | 1410 | ASUS_LAPTOP_VERSION); |
1410 | hotk = kzalloc(sizeof(struct asus_hotk), GFP_KERNEL); | 1411 | asus = kzalloc(sizeof(struct asus_laptop), GFP_KERNEL); |
1411 | if (!hotk) | 1412 | if (!asus) |
1412 | return -ENOMEM; | 1413 | return -ENOMEM; |
1413 | hotk->handle = device->handle; | 1414 | asus->handle = device->handle; |
1414 | strcpy(acpi_device_name(device), ASUS_HOTK_DEVICE_NAME); | 1415 | strcpy(acpi_device_name(device), ASUS_LAPTOP_DEVICE_NAME); |
1415 | strcpy(acpi_device_class(device), ASUS_HOTK_CLASS); | 1416 | strcpy(acpi_device_class(device), ASUS_LAPTOP_CLASS); |
1416 | device->driver_data = hotk; | 1417 | device->driver_data = asus; |
1417 | hotk->device = device; | 1418 | asus->device = device; |
1418 | 1419 | ||
1419 | result = asus_acpi_init(device); | 1420 | result = asus_acpi_init(device); |
1420 | if (result) | 1421 | if (result) |
@@ -1429,17 +1430,17 @@ static int __devinit asus_acpi_add(struct acpi_device *device) | |||
1429 | goto fail_platform; | 1430 | goto fail_platform; |
1430 | 1431 | ||
1431 | if (!acpi_video_backlight_support()) { | 1432 | if (!acpi_video_backlight_support()) { |
1432 | result = asus_backlight_init(&hotk->platform_device->dev); | 1433 | result = asus_backlight_init(&asus->platform_device->dev); |
1433 | if (result) | 1434 | if (result) |
1434 | goto fail_backlight; | 1435 | goto fail_backlight; |
1435 | } else | 1436 | } else |
1436 | pr_info("Backlight controlled by ACPI video driver\n"); | 1437 | pr_info("Backlight controlled by ACPI video driver\n"); |
1437 | 1438 | ||
1438 | result = asus_input_init(&hotk->platform_device->dev); | 1439 | result = asus_input_init(&asus->platform_device->dev); |
1439 | if (result) | 1440 | if (result) |
1440 | goto fail_input; | 1441 | goto fail_input; |
1441 | 1442 | ||
1442 | result = asus_led_init(&hotk->platform_device->dev); | 1443 | result = asus_led_init(&asus->platform_device->dev); |
1443 | if (result) | 1444 | if (result) |
1444 | goto fail_led; | 1445 | goto fail_led; |
1445 | 1446 | ||
@@ -1453,8 +1454,8 @@ fail_input: | |||
1453 | fail_backlight: | 1454 | fail_backlight: |
1454 | asus_platform_exit(); | 1455 | asus_platform_exit(); |
1455 | fail_platform: | 1456 | fail_platform: |
1456 | kfree(hotk->name); | 1457 | kfree(asus->name); |
1457 | kfree(hotk); | 1458 | kfree(asus); |
1458 | 1459 | ||
1459 | return result; | 1460 | return result; |
1460 | } | 1461 | } |
@@ -1466,8 +1467,8 @@ static int asus_acpi_remove(struct acpi_device *device, int type) | |||
1466 | asus_input_exit(); | 1467 | asus_input_exit(); |
1467 | asus_platform_exit(); | 1468 | asus_platform_exit(); |
1468 | 1469 | ||
1469 | kfree(hotk->name); | 1470 | kfree(asus->name); |
1470 | kfree(hotk); | 1471 | kfree(asus); |
1471 | return 0; | 1472 | return 0; |
1472 | } | 1473 | } |
1473 | 1474 | ||
@@ -1479,8 +1480,8 @@ static const struct acpi_device_id asus_device_ids[] = { | |||
1479 | MODULE_DEVICE_TABLE(acpi, asus_device_ids); | 1480 | MODULE_DEVICE_TABLE(acpi, asus_device_ids); |
1480 | 1481 | ||
1481 | static struct acpi_driver asus_acpi_driver = { | 1482 | static struct acpi_driver asus_acpi_driver = { |
1482 | .name = ASUS_HOTK_NAME, | 1483 | .name = ASUS_LAPTOP_NAME, |
1483 | .class = ASUS_HOTK_CLASS, | 1484 | .class = ASUS_LAPTOP_CLASS, |
1484 | .owner = THIS_MODULE, | 1485 | .owner = THIS_MODULE, |
1485 | .ids = asus_device_ids, | 1486 | .ids = asus_device_ids, |
1486 | .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, | 1487 | .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS, |