diff options
Diffstat (limited to 'drivers/platform/x86/asus-wmi.c')
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index c7a36f6b0580..2eb9fe8e8efd 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -101,6 +101,7 @@ MODULE_LICENSE("GPL"); | |||
101 | #define ASUS_WMI_DEVID_WIRELESS_LED 0x00010002 | 101 | #define ASUS_WMI_DEVID_WIRELESS_LED 0x00010002 |
102 | #define ASUS_WMI_DEVID_CWAP 0x00010003 | 102 | #define ASUS_WMI_DEVID_CWAP 0x00010003 |
103 | #define ASUS_WMI_DEVID_WLAN 0x00010011 | 103 | #define ASUS_WMI_DEVID_WLAN 0x00010011 |
104 | #define ASUS_WMI_DEVID_WLAN_LED 0x00010012 | ||
104 | #define ASUS_WMI_DEVID_BLUETOOTH 0x00010013 | 105 | #define ASUS_WMI_DEVID_BLUETOOTH 0x00010013 |
105 | #define ASUS_WMI_DEVID_GPS 0x00010015 | 106 | #define ASUS_WMI_DEVID_GPS 0x00010015 |
106 | #define ASUS_WMI_DEVID_WIMAX 0x00010017 | 107 | #define ASUS_WMI_DEVID_WIMAX 0x00010017 |
@@ -731,8 +732,21 @@ static int asus_rfkill_set(void *data, bool blocked) | |||
731 | { | 732 | { |
732 | struct asus_rfkill *priv = data; | 733 | struct asus_rfkill *priv = data; |
733 | u32 ctrl_param = !blocked; | 734 | u32 ctrl_param = !blocked; |
735 | u32 dev_id = priv->dev_id; | ||
734 | 736 | ||
735 | return asus_wmi_set_devstate(priv->dev_id, ctrl_param, NULL); | 737 | /* |
738 | * If the user bit is set, BIOS can't set and record the wlan status, | ||
739 | * it will report the value read from id ASUS_WMI_DEVID_WLAN_LED | ||
740 | * while we query the wlan status through WMI(ASUS_WMI_DEVID_WLAN). | ||
741 | * So, we have to record wlan status in id ASUS_WMI_DEVID_WLAN_LED | ||
742 | * while setting the wlan status through WMI. | ||
743 | * This is also the behavior that windows app will do. | ||
744 | */ | ||
745 | if ((dev_id == ASUS_WMI_DEVID_WLAN) && | ||
746 | priv->asus->driver->wlan_ctrl_by_user) | ||
747 | dev_id = ASUS_WMI_DEVID_WLAN_LED; | ||
748 | |||
749 | return asus_wmi_set_devstate(dev_id, ctrl_param, NULL); | ||
736 | } | 750 | } |
737 | 751 | ||
738 | static void asus_rfkill_query(struct rfkill *rfkill, void *data) | 752 | static void asus_rfkill_query(struct rfkill *rfkill, void *data) |
@@ -1653,6 +1667,7 @@ static int asus_wmi_add(struct platform_device *pdev) | |||
1653 | struct asus_wmi *asus; | 1667 | struct asus_wmi *asus; |
1654 | acpi_status status; | 1668 | acpi_status status; |
1655 | int err; | 1669 | int err; |
1670 | u32 result; | ||
1656 | 1671 | ||
1657 | asus = kzalloc(sizeof(struct asus_wmi), GFP_KERNEL); | 1672 | asus = kzalloc(sizeof(struct asus_wmi), GFP_KERNEL); |
1658 | if (!asus) | 1673 | if (!asus) |
@@ -1711,6 +1726,10 @@ static int asus_wmi_add(struct platform_device *pdev) | |||
1711 | if (err) | 1726 | if (err) |
1712 | goto fail_debugfs; | 1727 | goto fail_debugfs; |
1713 | 1728 | ||
1729 | asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_WLAN, &result); | ||
1730 | if (result & (ASUS_WMI_DSTS_PRESENCE_BIT | ASUS_WMI_DSTS_USER_BIT)) | ||
1731 | asus->driver->wlan_ctrl_by_user = 1; | ||
1732 | |||
1714 | return 0; | 1733 | return 0; |
1715 | 1734 | ||
1716 | fail_debugfs: | 1735 | fail_debugfs: |