diff options
-rw-r--r-- | drivers/platform/x86/dell-laptop.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index 48fabf6b6ecb..06f281bf7790 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c | |||
@@ -425,21 +425,24 @@ out: | |||
425 | return ret; | 425 | return ret; |
426 | } | 426 | } |
427 | 427 | ||
428 | static void dell_rfkill_update(struct rfkill *rfkill, int radio, int status) | ||
429 | { | ||
430 | rfkill_set_sw_state(rfkill, !!(status & BIT(radio + 16))); | ||
431 | |||
432 | if (hwswitch_state & (BIT(radio - 1))) | ||
433 | rfkill_set_hw_state(rfkill, !(status & BIT(16))); | ||
434 | } | ||
435 | |||
428 | static void dell_rfkill_query(struct rfkill *rfkill, void *data) | 436 | static void dell_rfkill_query(struct rfkill *rfkill, void *data) |
429 | { | 437 | { |
430 | int status; | 438 | int status; |
431 | int bit = (unsigned long)data + 16; | ||
432 | int hwswitch_bit = (unsigned long)data - 1; | ||
433 | 439 | ||
434 | get_buffer(); | 440 | get_buffer(); |
435 | dell_send_request(buffer, 17, 11); | 441 | dell_send_request(buffer, 17, 11); |
436 | status = buffer->output[1]; | 442 | status = buffer->output[1]; |
437 | release_buffer(); | 443 | release_buffer(); |
438 | 444 | ||
439 | rfkill_set_sw_state(rfkill, !!(status & BIT(bit))); | 445 | dell_rfkill_update(rfkill, (unsigned long)data, status); |
440 | |||
441 | if (hwswitch_state & (BIT(hwswitch_bit))) | ||
442 | rfkill_set_hw_state(rfkill, !(status & BIT(16))); | ||
443 | } | 446 | } |
444 | 447 | ||
445 | static const struct rfkill_ops dell_rfkill_ops = { | 448 | static const struct rfkill_ops dell_rfkill_ops = { |
@@ -518,12 +521,19 @@ static const struct file_operations dell_debugfs_fops = { | |||
518 | 521 | ||
519 | static void dell_update_rfkill(struct work_struct *ignored) | 522 | static void dell_update_rfkill(struct work_struct *ignored) |
520 | { | 523 | { |
524 | int status; | ||
525 | |||
526 | get_buffer(); | ||
527 | dell_send_request(buffer, 17, 11); | ||
528 | status = buffer->output[1]; | ||
529 | release_buffer(); | ||
530 | |||
521 | if (wifi_rfkill) | 531 | if (wifi_rfkill) |
522 | dell_rfkill_query(wifi_rfkill, (void *)1); | 532 | dell_rfkill_update(wifi_rfkill, 1, status); |
523 | if (bluetooth_rfkill) | 533 | if (bluetooth_rfkill) |
524 | dell_rfkill_query(bluetooth_rfkill, (void *)2); | 534 | dell_rfkill_update(bluetooth_rfkill, 2, status); |
525 | if (wwan_rfkill) | 535 | if (wwan_rfkill) |
526 | dell_rfkill_query(wwan_rfkill, (void *)3); | 536 | dell_rfkill_update(wwan_rfkill, 3, status); |
527 | } | 537 | } |
528 | static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); | 538 | static DECLARE_DELAYED_WORK(dell_rfkill_work, dell_update_rfkill); |
529 | 539 | ||