aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Dongili <malattia@linux.it>2009-12-16 10:08:35 -0500
committerLen Brown <len.brown@intel.com>2009-12-23 22:58:46 -0500
commitd5a664a311c1957a75bec1808cae0f10d606c378 (patch)
treed3baadac7cca0030f50a3a134a2e6ffed454b5de
parent4f924ba5b5aaf1477daafeae779495d39549186d (diff)
sony-laptop: rfkill support for newer models
Vaio Type X and possibly other new models use F135 as the radio frequency controlling function attached to the SNC device. In the indexed table this corresponds to 0x0135 (surpise!). Signed-off-by: Mattia Dongili <malattia@linux.it> Signed-off-by: Len Brown <len.brown@intel.com>
-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);