aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorMarco Chiappero <marco@absence.it>2012-05-19 09:35:44 -0400
committerMatthew Garrett <mjg@redhat.com>2012-05-31 14:29:33 -0400
commitd6f15ed876b83a1a0eba1d0473eef58acc95444a (patch)
tree2434fbf98aaab70b7a876af865cb407385e0f0cd /drivers/platform
parentdd258c00b96932ce2a81a9bb8bb8e6be997aa2cc (diff)
sony-laptop: use soft rfkill status stored in hw
The SNC device on recent Vaio laptops also stores the soft status and leaves it available after reboot. Use it and always set the last soft and hard status on module load. [malattia@linux.it: patch taken from a largely modified sony-laptop.c, smaller modifications to the original code to simplify it] Signed-off-by: Mattia Dongili <malattia@linux.it> Signed-off-by: Matthew Garrett <mjg@redhat.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/sony-laptop.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 8a51795aa02a..c6dc3f741ccd 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -1213,7 +1213,7 @@ static int sony_nc_rfkill_set(void *data, bool blocked)
1213 int argument = sony_rfkill_address[(long) data] + 0x100; 1213 int argument = sony_rfkill_address[(long) data] + 0x100;
1214 1214
1215 if (!blocked) 1215 if (!blocked)
1216 argument |= 0xff0000; 1216 argument |= 0x030000;
1217 1217
1218 return sony_call_snc_handle(sony_rfkill_handle, argument, &result); 1218 return sony_call_snc_handle(sony_rfkill_handle, argument, &result);
1219} 1219}
@@ -1230,7 +1230,7 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
1230 enum rfkill_type type; 1230 enum rfkill_type type;
1231 const char *name; 1231 const char *name;
1232 int result; 1232 int result;
1233 bool hwblock; 1233 bool hwblock, swblock;
1234 1234
1235 switch (nc_type) { 1235 switch (nc_type) {
1236 case SONY_WIFI: 1236 case SONY_WIFI:
@@ -1258,8 +1258,21 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
1258 if (!rfk) 1258 if (!rfk)
1259 return -ENOMEM; 1259 return -ENOMEM;
1260 1260
1261 sony_call_snc_handle(sony_rfkill_handle, 0x200, &result); 1261 if (sony_call_snc_handle(sony_rfkill_handle, 0x200, &result) < 0) {
1262 rfkill_destroy(rfk);
1263 return -1;
1264 }
1262 hwblock = !(result & 0x1); 1265 hwblock = !(result & 0x1);
1266
1267 if (sony_call_snc_handle(sony_rfkill_handle,
1268 sony_rfkill_address[nc_type],
1269 &result) < 0) {
1270 rfkill_destroy(rfk);
1271 return -1;
1272 }
1273 swblock = !(result & 0x2);
1274
1275 rfkill_init_sw_state(rfk, swblock);
1263 rfkill_set_hw_state(rfk, hwblock); 1276 rfkill_set_hw_state(rfk, hwblock);
1264 1277
1265 err = rfkill_register(rfk); 1278 err = rfkill_register(rfk);
@@ -1295,7 +1308,7 @@ static void sony_nc_rfkill_update(void)
1295 1308
1296 sony_call_snc_handle(sony_rfkill_handle, argument, &result); 1309 sony_call_snc_handle(sony_rfkill_handle, argument, &result);
1297 rfkill_set_states(sony_rfkill_devices[i], 1310 rfkill_set_states(sony_rfkill_devices[i],
1298 !(result & 0xf), false); 1311 !(result & 0x2), false);
1299 } 1312 }
1300} 1313}
1301 1314