aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/platform/x86/sony-laptop.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/platform/x86/sony-laptop.c b/drivers/platform/x86/sony-laptop.c
index 9710f70040ba..1144686a33f5 100644
--- a/drivers/platform/x86/sony-laptop.c
+++ b/drivers/platform/x86/sony-laptop.c
@@ -131,6 +131,7 @@ enum sony_nc_rfkill {
131 N_SONY_RFKILL, 131 N_SONY_RFKILL,
132}; 132};
133 133
134static int sony_rfkill_handle;
134static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL]; 135static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL];
135static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900}; 136static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900};
136static void sony_nc_rfkill_update(void); 137static void sony_nc_rfkill_update(void);
@@ -965,7 +966,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)
965 else 966 else
966 sony_laptop_report_input_event(ev); 967 sony_laptop_report_input_event(ev);
967 } 968 }
968 } else if (sony_find_snc_handle(0x124) == ev) { 969 } else if (sony_find_snc_handle(sony_rfkill_handle) == ev) {
969 sony_nc_rfkill_update(); 970 sony_nc_rfkill_update();
970 return; 971 return;
971 } 972 }
@@ -1071,7 +1072,7 @@ static int sony_nc_rfkill_set(void *data, bool blocked)
1071 if (!blocked) 1072 if (!blocked)
1072 argument |= 0xff0000; 1073 argument |= 0xff0000;
1073 1074
1074 return sony_call_snc_handle(0x124, argument, &result); 1075 return sony_call_snc_handle(sony_rfkill_handle, argument, &result);
1075} 1076}
1076 1077
1077static const struct rfkill_ops sony_rfkill_ops = { 1078static const struct rfkill_ops sony_rfkill_ops = {
@@ -1114,7 +1115,7 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
1114 if (!rfk) 1115 if (!rfk)
1115 return -ENOMEM; 1116 return -ENOMEM;
1116 1117
1117 sony_call_snc_handle(0x124, 0x200, &result); 1118 sony_call_snc_handle(sony_rfkill_handle, 0x200, &result);
1118 hwblock = !(result & 0x1); 1119 hwblock = !(result & 0x1);
1119 rfkill_set_hw_state(rfk, hwblock); 1120 rfkill_set_hw_state(rfk, hwblock);
1120 1121
@@ -1133,7 +1134,7 @@ static void sony_nc_rfkill_update()
1133 int result; 1134 int result;
1134 bool hwblock; 1135 bool hwblock;
1135 1136
1136 sony_call_snc_handle(0x124, 0x200, &result); 1137 sony_call_snc_handle(sony_rfkill_handle, 0x200, &result);
1137 hwblock = !(result & 0x1); 1138 hwblock = !(result & 0x1);
1138 1139
1139 for (i = 0; i < N_SONY_RFKILL; i++) { 1140 for (i = 0; i < N_SONY_RFKILL; i++) {
@@ -1149,7 +1150,7 @@ static void sony_nc_rfkill_update()
1149 continue; 1150 continue;
1150 } 1151 }
1151 1152
1152 sony_call_snc_handle(0x124, argument, &result); 1153 sony_call_snc_handle(sony_rfkill_handle, argument, &result);
1153 rfkill_set_states(sony_rfkill_devices[i], 1154 rfkill_set_states(sony_rfkill_devices[i],
1154 !(result & 0xf), false); 1155 !(result & 0xf), false);
1155 } 1156 }
@@ -1159,10 +1160,15 @@ static int sony_nc_rfkill_setup(struct acpi_device *device)
1159{ 1160{
1160 int result, ret; 1161 int result, ret;
1161 1162
1162 if (sony_find_snc_handle(0x124) == -1) 1163 if (sony_find_snc_handle(0x124) == -1) {
1163 return -1; 1164 if (sony_find_snc_handle(0x135) == -1)
1165 return -1;
1166 else
1167 sony_rfkill_handle = 0x135;
1168 } else
1169 sony_rfkill_handle = 0x124;
1164 1170
1165 ret = sony_call_snc_handle(0x124, 0xb00, &result); 1171 ret = sony_call_snc_handle(sony_rfkill_handle, 0xb00, &result);
1166 if (ret) { 1172 if (ret) {
1167 printk(KERN_INFO DRV_PFX 1173 printk(KERN_INFO DRV_PFX
1168 "Unable to enumerate rfkill devices: %x\n", ret); 1174 "Unable to enumerate rfkill devices: %x\n", ret);