diff options
| author | Lee, Chun-Yi <joeyli.kernel@gmail.com> | 2010-12-06 21:29:23 -0500 |
|---|---|---|
| committer | Matthew Garrett <mjg@redhat.com> | 2011-01-07 17:03:48 -0500 |
| commit | 6c3df88f19375217f0dbfc6160e8c2a635f56c53 (patch) | |
| tree | d6620311730180512be1c4b9590e7fb47da2583e | |
| parent | b3c9092b2fed427d45117d23ceb577ad8dc46a9a (diff) | |
acer-wmi: Detect the WiFi/Bluetooth/3G devices available
Check the Acer OEM-specific Type AA to detect the WiFi/Bluetooth/3G
devices available or not, and set the devices capability flag.
Signed-off-by: Lee, Chun-Yi <jlee@novell.com>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Reviewed-by: Dmitry Torokhov <dtor@mail.ru>
Acked-by: Thomas Renninger <trenn@suse.de>
Acked-by: Jiri Benc <jbenc@suse.cz>
Cc: Carlos Corbacho <carlos@strangeworlds.co.uk>
Cc: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Matthew Garrett <mjg@redhat.com>
| -rw-r--r-- | drivers/platform/x86/acer-wmi.c | 49 |
1 files changed, 42 insertions, 7 deletions
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 85d263349aac..583565a8bbce 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c | |||
| @@ -39,6 +39,7 @@ | |||
| 39 | #include <linux/slab.h> | 39 | #include <linux/slab.h> |
| 40 | #include <linux/input.h> | 40 | #include <linux/input.h> |
| 41 | #include <linux/input/sparse-keymap.h> | 41 | #include <linux/input/sparse-keymap.h> |
| 42 | #include <linux/dmi.h> | ||
| 42 | 43 | ||
| 43 | #include <acpi/acpi_drivers.h> | 44 | #include <acpi/acpi_drivers.h> |
| 44 | 45 | ||
| @@ -124,7 +125,9 @@ struct event_return_value { | |||
| 124 | /* | 125 | /* |
| 125 | * GUID3 Get Device Status device flags | 126 | * GUID3 Get Device Status device flags |
| 126 | */ | 127 | */ |
| 128 | #define ACER_WMID3_GDS_WIRELESS (1<<0) /* WiFi */ | ||
| 127 | #define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */ | 129 | #define ACER_WMID3_GDS_THREEG (1<<6) /* 3G */ |
| 130 | #define ACER_WMID3_GDS_BLUETOOTH (1<<11) /* BT */ | ||
| 128 | 131 | ||
| 129 | struct wmid3_gds_input_param { /* Get Device Status input parameter */ | 132 | struct wmid3_gds_input_param { /* Get Device Status input parameter */ |
| 130 | u8 function_num; /* Function Number */ | 133 | u8 function_num; /* Function Number */ |
| @@ -139,6 +142,13 @@ struct wmid3_gds_return_value { /* Get Device Status return value*/ | |||
| 139 | u32 reserved; | 142 | u32 reserved; |
| 140 | } __attribute__((packed)); | 143 | } __attribute__((packed)); |
| 141 | 144 | ||
| 145 | struct hotkey_function_type_aa { | ||
| 146 | u8 type; | ||
| 147 | u8 length; | ||
| 148 | u16 handle; | ||
| 149 | u16 commun_func_bitmap; | ||
| 150 | } __attribute__((packed)); | ||
| 151 | |||
| 142 | /* | 152 | /* |
| 143 | * Interface capability flags | 153 | * Interface capability flags |
| 144 | */ | 154 | */ |
| @@ -169,6 +179,7 @@ static int mailled = -1; | |||
| 169 | static int brightness = -1; | 179 | static int brightness = -1; |
| 170 | static int threeg = -1; | 180 | static int threeg = -1; |
| 171 | static int force_series; | 181 | static int force_series; |
| 182 | static bool has_type_aa; | ||
| 172 | 183 | ||
| 173 | module_param(mailled, int, 0444); | 184 | module_param(mailled, int, 0444); |
| 174 | module_param(brightness, int, 0444); | 185 | module_param(brightness, int, 0444); |
| @@ -807,6 +818,28 @@ static acpi_status WMID_set_u32(u32 value, u32 cap, struct wmi_interface *iface) | |||
| 807 | return WMI_execute_u32(method_id, (u32)value, NULL); | 818 | return WMI_execute_u32(method_id, (u32)value, NULL); |
| 808 | } | 819 | } |
| 809 | 820 | ||
| 821 | static void type_aa_dmi_decode(const struct dmi_header *header, void *dummy) | ||
| 822 | { | ||
| 823 | struct hotkey_function_type_aa *type_aa; | ||
| 824 | |||
| 825 | /* We are looking for OEM-specific Type AAh */ | ||
| 826 | if (header->type != 0xAA) | ||
| 827 | return; | ||
| 828 | |||
| 829 | has_type_aa = true; | ||
| 830 | type_aa = (struct hotkey_function_type_aa *) header; | ||
| 831 | |||
| 832 | printk(ACER_INFO "Function bitmap for Communication Button: 0x%x\n", | ||
| 833 | type_aa->commun_func_bitmap); | ||
| 834 | |||
| 835 | if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_WIRELESS) | ||
| 836 | interface->capability |= ACER_CAP_WIRELESS; | ||
| 837 | if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_THREEG) | ||
| 838 | interface->capability |= ACER_CAP_THREEG; | ||
| 839 | if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_BLUETOOTH) | ||
| 840 | interface->capability |= ACER_CAP_BLUETOOTH; | ||
| 841 | } | ||
| 842 | |||
| 810 | static acpi_status WMID_set_capabilities(void) | 843 | static acpi_status WMID_set_capabilities(void) |
| 811 | { | 844 | { |
| 812 | struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; | 845 | struct acpi_buffer out = {ACPI_ALLOCATE_BUFFER, NULL}; |
| @@ -827,16 +860,17 @@ static acpi_status WMID_set_capabilities(void) | |||
| 827 | return AE_ERROR; | 860 | return AE_ERROR; |
| 828 | } | 861 | } |
| 829 | 862 | ||
| 830 | /* Not sure on the meaning of the relevant bits yet to detect these */ | 863 | dmi_walk(type_aa_dmi_decode, NULL); |
| 831 | interface->capability |= ACER_CAP_WIRELESS; | 864 | if (!has_type_aa) { |
| 832 | interface->capability |= ACER_CAP_THREEG; | 865 | interface->capability |= ACER_CAP_WIRELESS; |
| 866 | interface->capability |= ACER_CAP_THREEG; | ||
| 867 | if (devices & 0x10) | ||
| 868 | interface->capability |= ACER_CAP_BLUETOOTH; | ||
| 869 | } | ||
| 833 | 870 | ||
| 834 | /* WMID always provides brightness methods */ | 871 | /* WMID always provides brightness methods */ |
| 835 | interface->capability |= ACER_CAP_BRIGHTNESS; | 872 | interface->capability |= ACER_CAP_BRIGHTNESS; |
| 836 | 873 | ||
| 837 | if (devices & 0x10) | ||
| 838 | interface->capability |= ACER_CAP_BLUETOOTH; | ||
| 839 | |||
| 840 | if (!(devices & 0x20)) | 874 | if (!(devices & 0x20)) |
| 841 | max_brightness = 0x9; | 875 | max_brightness = 0x9; |
| 842 | 876 | ||
| @@ -915,7 +949,8 @@ static void __init acer_commandline_init(void) | |||
| 915 | * capability isn't available on the given interface | 949 | * capability isn't available on the given interface |
| 916 | */ | 950 | */ |
| 917 | set_u32(mailled, ACER_CAP_MAILLED); | 951 | set_u32(mailled, ACER_CAP_MAILLED); |
| 918 | set_u32(threeg, ACER_CAP_THREEG); | 952 | if (!has_type_aa) |
| 953 | set_u32(threeg, ACER_CAP_THREEG); | ||
| 919 | set_u32(brightness, ACER_CAP_BRIGHTNESS); | 954 | set_u32(brightness, ACER_CAP_BRIGHTNESS); |
| 920 | } | 955 | } |
| 921 | 956 | ||
