diff options
Diffstat (limited to 'drivers/platform/x86/asus-wmi.c')
-rw-r--r-- | drivers/platform/x86/asus-wmi.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index c7a36f6b0580..c0e9ff489b24 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c | |||
@@ -47,9 +47,7 @@ | |||
47 | #include <linux/thermal.h> | 47 | #include <linux/thermal.h> |
48 | #include <acpi/acpi_bus.h> | 48 | #include <acpi/acpi_bus.h> |
49 | #include <acpi/acpi_drivers.h> | 49 | #include <acpi/acpi_drivers.h> |
50 | #ifdef CONFIG_ACPI_VIDEO | ||
51 | #include <acpi/video.h> | 50 | #include <acpi/video.h> |
52 | #endif | ||
53 | 51 | ||
54 | #include "asus-wmi.h" | 52 | #include "asus-wmi.h" |
55 | 53 | ||
@@ -101,6 +99,7 @@ MODULE_LICENSE("GPL"); | |||
101 | #define ASUS_WMI_DEVID_WIRELESS_LED 0x00010002 | 99 | #define ASUS_WMI_DEVID_WIRELESS_LED 0x00010002 |
102 | #define ASUS_WMI_DEVID_CWAP 0x00010003 | 100 | #define ASUS_WMI_DEVID_CWAP 0x00010003 |
103 | #define ASUS_WMI_DEVID_WLAN 0x00010011 | 101 | #define ASUS_WMI_DEVID_WLAN 0x00010011 |
102 | #define ASUS_WMI_DEVID_WLAN_LED 0x00010012 | ||
104 | #define ASUS_WMI_DEVID_BLUETOOTH 0x00010013 | 103 | #define ASUS_WMI_DEVID_BLUETOOTH 0x00010013 |
105 | #define ASUS_WMI_DEVID_GPS 0x00010015 | 104 | #define ASUS_WMI_DEVID_GPS 0x00010015 |
106 | #define ASUS_WMI_DEVID_WIMAX 0x00010017 | 105 | #define ASUS_WMI_DEVID_WIMAX 0x00010017 |
@@ -731,8 +730,21 @@ static int asus_rfkill_set(void *data, bool blocked) | |||
731 | { | 730 | { |
732 | struct asus_rfkill *priv = data; | 731 | struct asus_rfkill *priv = data; |
733 | u32 ctrl_param = !blocked; | 732 | u32 ctrl_param = !blocked; |
733 | u32 dev_id = priv->dev_id; | ||
734 | 734 | ||
735 | return asus_wmi_set_devstate(priv->dev_id, ctrl_param, NULL); | 735 | /* |
736 | * If the user bit is set, BIOS can't set and record the wlan status, | ||
737 | * it will report the value read from id ASUS_WMI_DEVID_WLAN_LED | ||
738 | * while we query the wlan status through WMI(ASUS_WMI_DEVID_WLAN). | ||
739 | * So, we have to record wlan status in id ASUS_WMI_DEVID_WLAN_LED | ||
740 | * while setting the wlan status through WMI. | ||
741 | * This is also the behavior that windows app will do. | ||
742 | */ | ||
743 | if ((dev_id == ASUS_WMI_DEVID_WLAN) && | ||
744 | priv->asus->driver->wlan_ctrl_by_user) | ||
745 | dev_id = ASUS_WMI_DEVID_WLAN_LED; | ||
746 | |||
747 | return asus_wmi_set_devstate(dev_id, ctrl_param, NULL); | ||
736 | } | 748 | } |
737 | 749 | ||
738 | static void asus_rfkill_query(struct rfkill *rfkill, void *data) | 750 | static void asus_rfkill_query(struct rfkill *rfkill, void *data) |
@@ -1653,6 +1665,7 @@ static int asus_wmi_add(struct platform_device *pdev) | |||
1653 | struct asus_wmi *asus; | 1665 | struct asus_wmi *asus; |
1654 | acpi_status status; | 1666 | acpi_status status; |
1655 | int err; | 1667 | int err; |
1668 | u32 result; | ||
1656 | 1669 | ||
1657 | asus = kzalloc(sizeof(struct asus_wmi), GFP_KERNEL); | 1670 | asus = kzalloc(sizeof(struct asus_wmi), GFP_KERNEL); |
1658 | if (!asus) | 1671 | if (!asus) |
@@ -1689,10 +1702,8 @@ static int asus_wmi_add(struct platform_device *pdev) | |||
1689 | if (asus->driver->quirks->wmi_backlight_power) | 1702 | if (asus->driver->quirks->wmi_backlight_power) |
1690 | acpi_video_dmi_promote_vendor(); | 1703 | acpi_video_dmi_promote_vendor(); |
1691 | if (!acpi_video_backlight_support()) { | 1704 | if (!acpi_video_backlight_support()) { |
1692 | #ifdef CONFIG_ACPI_VIDEO | ||
1693 | pr_info("Disabling ACPI video driver\n"); | 1705 | pr_info("Disabling ACPI video driver\n"); |
1694 | acpi_video_unregister(); | 1706 | acpi_video_unregister(); |
1695 | #endif | ||
1696 | err = asus_wmi_backlight_init(asus); | 1707 | err = asus_wmi_backlight_init(asus); |
1697 | if (err && err != -ENODEV) | 1708 | if (err && err != -ENODEV) |
1698 | goto fail_backlight; | 1709 | goto fail_backlight; |
@@ -1711,6 +1722,10 @@ static int asus_wmi_add(struct platform_device *pdev) | |||
1711 | if (err) | 1722 | if (err) |
1712 | goto fail_debugfs; | 1723 | goto fail_debugfs; |
1713 | 1724 | ||
1725 | asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_WLAN, &result); | ||
1726 | if (result & (ASUS_WMI_DSTS_PRESENCE_BIT | ASUS_WMI_DSTS_USER_BIT)) | ||
1727 | asus->driver->wlan_ctrl_by_user = 1; | ||
1728 | |||
1714 | return 0; | 1729 | return 0; |
1715 | 1730 | ||
1716 | fail_debugfs: | 1731 | fail_debugfs: |