aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorLee, Chun-Yi <joeyli.kernel@gmail.com>2010-12-12 21:02:41 -0500
committerMatthew Garrett <mjg@redhat.com>2011-01-07 17:03:48 -0500
commit466449cfe797b8a5d82d25d0e0e08426d8dfba19 (patch)
tree03d783cee6b3ec15fc42d24b6f437e380b12acb9 /drivers/platform/x86
parent6c3df88f19375217f0dbfc6160e8c2a635f56c53 (diff)
acer-wmi: Initialize wlan/bluetooth/wwan rfkill software block state
Initial wlan/bluetooth/wwan rfkill software block state when acer-wmi driver probe. Acer notebook can save the devices state and this patch can use it to initial the devices' rfkill state. Signed-off-by: Lee, Chun-Yi <jlee@novell.com> Acked-by: Thomas Renninger <trenn@suse.de> Cc: Carlos Corbacho <carlos@strangeworlds.co.uk> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/acer-wmi.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c
index 583565a8bbce..d80db0899382 100644
--- a/drivers/platform/x86/acer-wmi.c
+++ b/drivers/platform/x86/acer-wmi.c
@@ -1085,6 +1085,31 @@ static acpi_status wmid3_get_device_status(u32 *value, u16 device)
1085 return status; 1085 return status;
1086} 1086}
1087 1087
1088static acpi_status get_device_status(u32 *value, u32 cap)
1089{
1090 if (wmi_has_guid(WMID_GUID3)) {
1091 u16 device;
1092
1093 switch (cap) {
1094 case ACER_CAP_WIRELESS:
1095 device = ACER_WMID3_GDS_WIRELESS;
1096 break;
1097 case ACER_CAP_BLUETOOTH:
1098 device = ACER_WMID3_GDS_BLUETOOTH;
1099 break;
1100 case ACER_CAP_THREEG:
1101 device = ACER_WMID3_GDS_THREEG;
1102 break;
1103 default:
1104 return AE_ERROR;
1105 }
1106 return wmid3_get_device_status(value, device);
1107
1108 } else {
1109 return get_u32(value, cap);
1110 }
1111}
1112
1088/* 1113/*
1089 * Rfkill devices 1114 * Rfkill devices
1090 */ 1115 */
@@ -1135,6 +1160,8 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
1135{ 1160{
1136 int err; 1161 int err;
1137 struct rfkill *rfkill_dev; 1162 struct rfkill *rfkill_dev;
1163 u32 state;
1164 acpi_status status;
1138 1165
1139 rfkill_dev = rfkill_alloc(name, dev, type, 1166 rfkill_dev = rfkill_alloc(name, dev, type,
1140 &acer_rfkill_ops, 1167 &acer_rfkill_ops,
@@ -1142,6 +1169,10 @@ static struct rfkill *acer_rfkill_register(struct device *dev,
1142 if (!rfkill_dev) 1169 if (!rfkill_dev)
1143 return ERR_PTR(-ENOMEM); 1170 return ERR_PTR(-ENOMEM);
1144 1171
1172 status = get_device_status(&state, cap);
1173 if (ACPI_SUCCESS(status))
1174 rfkill_init_sw_state(rfkill_dev, !state);
1175
1145 err = rfkill_register(rfkill_dev); 1176 err = rfkill_register(rfkill_dev);
1146 if (err) { 1177 if (err) {
1147 rfkill_destroy(rfkill_dev); 1178 rfkill_destroy(rfkill_dev);