mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 11:16:11 +00:00
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>
This commit is contained in:
parent
4f924ba5b5
commit
d5a664a311
1 changed files with 14 additions and 8 deletions
|
@ -131,6 +131,7 @@ enum sony_nc_rfkill {
|
||||||
N_SONY_RFKILL,
|
N_SONY_RFKILL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int sony_rfkill_handle;
|
||||||
static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL];
|
static struct rfkill *sony_rfkill_devices[N_SONY_RFKILL];
|
||||||
static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900};
|
static int sony_rfkill_address[N_SONY_RFKILL] = {0x300, 0x500, 0x700, 0x900};
|
||||||
static void sony_nc_rfkill_update(void);
|
static void sony_nc_rfkill_update(void);
|
||||||
|
@ -965,7 +966,7 @@ static void sony_nc_notify(struct acpi_device *device, u32 event)
|
||||||
else
|
else
|
||||||
sony_laptop_report_input_event(ev);
|
sony_laptop_report_input_event(ev);
|
||||||
}
|
}
|
||||||
} else if (sony_find_snc_handle(0x124) == ev) {
|
} else if (sony_find_snc_handle(sony_rfkill_handle) == ev) {
|
||||||
sony_nc_rfkill_update();
|
sony_nc_rfkill_update();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1071,7 +1072,7 @@ static int sony_nc_rfkill_set(void *data, bool blocked)
|
||||||
if (!blocked)
|
if (!blocked)
|
||||||
argument |= 0xff0000;
|
argument |= 0xff0000;
|
||||||
|
|
||||||
return sony_call_snc_handle(0x124, argument, &result);
|
return sony_call_snc_handle(sony_rfkill_handle, argument, &result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct rfkill_ops sony_rfkill_ops = {
|
static const struct rfkill_ops sony_rfkill_ops = {
|
||||||
|
@ -1114,7 +1115,7 @@ static int sony_nc_setup_rfkill(struct acpi_device *device,
|
||||||
if (!rfk)
|
if (!rfk)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
sony_call_snc_handle(0x124, 0x200, &result);
|
sony_call_snc_handle(sony_rfkill_handle, 0x200, &result);
|
||||||
hwblock = !(result & 0x1);
|
hwblock = !(result & 0x1);
|
||||||
rfkill_set_hw_state(rfk, hwblock);
|
rfkill_set_hw_state(rfk, hwblock);
|
||||||
|
|
||||||
|
@ -1133,7 +1134,7 @@ static void sony_nc_rfkill_update()
|
||||||
int result;
|
int result;
|
||||||
bool hwblock;
|
bool hwblock;
|
||||||
|
|
||||||
sony_call_snc_handle(0x124, 0x200, &result);
|
sony_call_snc_handle(sony_rfkill_handle, 0x200, &result);
|
||||||
hwblock = !(result & 0x1);
|
hwblock = !(result & 0x1);
|
||||||
|
|
||||||
for (i = 0; i < N_SONY_RFKILL; i++) {
|
for (i = 0; i < N_SONY_RFKILL; i++) {
|
||||||
|
@ -1149,7 +1150,7 @@ static void sony_nc_rfkill_update()
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
sony_call_snc_handle(0x124, argument, &result);
|
sony_call_snc_handle(sony_rfkill_handle, argument, &result);
|
||||||
rfkill_set_states(sony_rfkill_devices[i],
|
rfkill_set_states(sony_rfkill_devices[i],
|
||||||
!(result & 0xf), false);
|
!(result & 0xf), false);
|
||||||
}
|
}
|
||||||
|
@ -1159,10 +1160,15 @@ static int sony_nc_rfkill_setup(struct acpi_device *device)
|
||||||
{
|
{
|
||||||
int result, ret;
|
int result, ret;
|
||||||
|
|
||||||
if (sony_find_snc_handle(0x124) == -1)
|
if (sony_find_snc_handle(0x124) == -1) {
|
||||||
return -1;
|
if (sony_find_snc_handle(0x135) == -1)
|
||||||
|
return -1;
|
||||||
|
else
|
||||||
|
sony_rfkill_handle = 0x135;
|
||||||
|
} else
|
||||||
|
sony_rfkill_handle = 0x124;
|
||||||
|
|
||||||
ret = sony_call_snc_handle(0x124, 0xb00, &result);
|
ret = sony_call_snc_handle(sony_rfkill_handle, 0xb00, &result);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printk(KERN_INFO DRV_PFX
|
printk(KERN_INFO DRV_PFX
|
||||||
"Unable to enumerate rfkill devices: %x\n", ret);
|
"Unable to enumerate rfkill devices: %x\n", ret);
|
||||||
|
|
Loading…
Reference in a new issue