Lines Matching +full:battery +full:- +full:profile

1 // SPDX-License-Identifier: GPL-2.0-or-later
6 * Copyright(C) 2010-2011 Corentin Chary <corentin.chary@gmail.com>
22 #include <linux/hwmon-sysfs.h>
25 #include <linux/input/sparse-keymap.h>
31 #include <linux/platform_data/x86/asus-wmi.h>
41 #include <acpi/battery.h>
44 #include "asus-wmi.h"
57 #define ASUS_WMI_MGMT_GUID "97845ED0-4E6D-11DE-8A39-0800200C9A66"
146 u16 mfun; /* probably "Multi-function" to be called */
147 u16 sfun; /* probably "Sub-function" to be called */
157 u32 speed; /* read: RPM/100 - write: 0-255 */
161 * <platform>/ - debugfs root directory
162 * dev_id - current dev_id
163 * ctrl_param - current ctrl_param
164 * method_id - current method_id
165 * devs - call DEVS(dev_id, ctrl_param) and print result
166 * dsts - call DSTS(dev_id) and print result
167 * call - call method_id(dev_id, ctrl_param) and print result
294 return -EIO; in asus_wmi_evaluate_method3()
297 if (obj && obj->type == ACPI_TYPE_INTEGER) in asus_wmi_evaluate_method3()
298 tmp = (u32) obj->integer.value; in asus_wmi_evaluate_method3()
306 return -ENODEV; in asus_wmi_evaluate_method3()
337 return -EIO; in asus_wmi_evaluate_method5()
340 if (obj && obj->type == ACPI_TYPE_INTEGER) in asus_wmi_evaluate_method5()
341 tmp = (u32) obj->integer.value; in asus_wmi_evaluate_method5()
349 return -ENODEV; in asus_wmi_evaluate_method5()
376 return -EIO; in asus_wmi_evaluate_method_buf()
380 switch (obj->type) { in asus_wmi_evaluate_method_buf()
382 if (obj->buffer.length > size) { in asus_wmi_evaluate_method_buf()
383 err = -ENOSPC; in asus_wmi_evaluate_method_buf()
386 if (obj->buffer.length == 0) { in asus_wmi_evaluate_method_buf()
387 err = -ENODATA; in asus_wmi_evaluate_method_buf()
391 memcpy(ret_buffer, obj->buffer.pointer, obj->buffer.length); in asus_wmi_evaluate_method_buf()
394 err = (u32)obj->integer.value; in asus_wmi_evaluate_method_buf()
397 err = -ENODEV; in asus_wmi_evaluate_method_buf()
403 err = -ENODATA; in asus_wmi_evaluate_method_buf()
406 err = -ENODATA; in asus_wmi_evaluate_method_buf()
432 return -ENOMEM; in asus_wmi_evaluate_method_agfn()
442 return -ENXIO; in asus_wmi_evaluate_method_agfn()
449 return asus_wmi_evaluate_method(asus->dsts_id, dev_id, 0, retval); in asus_wmi_get_devstate()
471 return -ENODEV; in asus_wmi_get_devstate_bits()
475 return -ENODEV; in asus_wmi_get_devstate_bits()
498 struct device *dev = &asus->platform_device->dev; in asus_wmi_tablet_sw_init()
503 input_set_capability(asus->inputdev, EV_SW, SW_TABLET_MODE); in asus_wmi_tablet_sw_init()
504 input_report_switch(asus->inputdev, SW_TABLET_MODE, result); in asus_wmi_tablet_sw_init()
505 asus->tablet_switch_dev_id = dev_id; in asus_wmi_tablet_sw_init()
506 asus->tablet_switch_event_code = event_code; in asus_wmi_tablet_sw_init()
507 } else if (result == -ENODEV) { in asus_wmi_tablet_sw_init()
508 …dev_err(dev, "This device has tablet-mode-switch quirk but got ENODEV checking it. This is a bug."… in asus_wmi_tablet_sw_init()
510 dev_err(dev, "Error checking for tablet-mode-switch: %d\n", result); in asus_wmi_tablet_sw_init()
516 struct device *dev = &asus->platform_device->dev; in asus_wmi_input_init()
519 asus->inputdev = input_allocate_device(); in asus_wmi_input_init()
520 if (!asus->inputdev) in asus_wmi_input_init()
521 return -ENOMEM; in asus_wmi_input_init()
523 asus->inputdev->name = asus->driver->input_name; in asus_wmi_input_init()
524 asus->inputdev->phys = asus->driver->input_phys; in asus_wmi_input_init()
525 asus->inputdev->id.bustype = BUS_HOST; in asus_wmi_input_init()
526 asus->inputdev->dev.parent = dev; in asus_wmi_input_init()
527 set_bit(EV_REP, asus->inputdev->evbit); in asus_wmi_input_init()
529 err = sparse_keymap_setup(asus->inputdev, asus->driver->keymap, NULL); in asus_wmi_input_init()
533 switch (asus->driver->quirks->tablet_switch_mode) { in asus_wmi_input_init()
547 err = input_register_device(asus->inputdev); in asus_wmi_input_init()
554 input_free_device(asus->inputdev); in asus_wmi_input_init()
560 if (asus->inputdev) in asus_wmi_input_exit()
561 input_unregister_device(asus->inputdev); in asus_wmi_input_exit()
563 asus->inputdev = NULL; in asus_wmi_input_exit()
572 if (!asus->tablet_switch_dev_id) in asus_wmi_tablet_mode_get_state()
575 result = asus_wmi_get_devstate_simple(asus, asus->tablet_switch_dev_id); in asus_wmi_tablet_mode_get_state()
577 input_report_switch(asus->inputdev, SW_TABLET_MODE, result); in asus_wmi_tablet_mode_get_state()
578 input_sync(asus->inputdev); in asus_wmi_tablet_mode_get_state()
616 return -EINVAL; in dgpu_disable_store()
626 return -EIO; in dgpu_disable_store()
629 sysfs_notify(&asus->platform_device->dev.kobj, NULL, "dgpu_disable"); in dgpu_disable_store()
664 return -EINVAL; in egpu_enable_store()
674 return -EIO; in egpu_enable_store()
677 sysfs_notify(&asus->platform_device->dev.kobj, NULL, "egpu_enable"); in egpu_enable_store()
710 return -EINVAL; in gpu_mux_mode_store()
720 return -EIO; in gpu_mux_mode_store()
723 sysfs_notify(&asus->platform_device->dev.kobj, NULL, "gpu_mux_mode"); in gpu_mux_mode_store()
738 return -EINVAL; in kbd_rgb_mode_store()
796 return -EINVAL; in kbd_rgb_state_store()
845 /* Battery ********************************************************************/
847 /* The battery maximum charging percentage */
861 return -EINVAL; in charge_control_end_threshold_store()
868 return -EIO; in charge_control_end_threshold_store()
886 static int asus_wmi_battery_add(struct power_supply *battery) in asus_wmi_battery_add() argument
888 /* The WMI method does not provide a way to specific a battery, so we in asus_wmi_battery_add()
889 * just assume it is the first battery. in asus_wmi_battery_add()
891 * battery is named BATT. in asus_wmi_battery_add()
893 if (strcmp(battery->desc->name, "BAT0") != 0 && in asus_wmi_battery_add()
894 strcmp(battery->desc->name, "BAT1") != 0 && in asus_wmi_battery_add()
895 strcmp(battery->desc->name, "BATC") != 0 && in asus_wmi_battery_add()
896 strcmp(battery->desc->name, "BATT") != 0) in asus_wmi_battery_add()
897 return -ENODEV; in asus_wmi_battery_add()
899 if (device_create_file(&battery->dev, in asus_wmi_battery_add()
901 return -ENODEV; in asus_wmi_battery_add()
905 * a battery is added. in asus_wmi_battery_add()
913 static int asus_wmi_battery_remove(struct power_supply *battery) in asus_wmi_battery_remove() argument
915 device_remove_file(&battery->dev, in asus_wmi_battery_remove()
923 .name = "ASUS Battery Extension",
928 asus->battery_rsoc_available = false; in asus_wmi_battery_init()
930 asus->battery_rsoc_available = true; in asus_wmi_battery_init()
937 if (asus->battery_rsoc_available) in asus_wmi_battery_exit()
956 ctrl_param = asus->tpd_led_wk; in tpd_led_update()
967 asus->tpd_led_wk = !!value; in tpd_led_set()
968 queue_work(asus->led_workqueue, &asus->tpd_led_work); in tpd_led_set()
989 ctrl_param = 0x80 | (asus->kbd_led_wk & 0x7F); in kbd_led_update()
998 * bits 0-2: level in kbd_led_read()
1000 * bit 8-10: environment (0: dark, 1: normal, 2: light) in kbd_led_read()
1026 max_level = asus->kbd_led.max_brightness; in do_kbd_led_set()
1028 asus->kbd_led_wk = clamp_val(value, 0, max_level); in do_kbd_led_set()
1036 if (led_cdev->flags & LED_UNREGISTERING) in kbd_led_set()
1044 struct led_classdev *led_cdev = &asus->kbd_led; in kbd_led_set_by_kbd()
1047 led_classdev_notify_brightness_hw_changed(led_cdev, asus->kbd_led_wk); in kbd_led_set_by_kbd()
1080 ctrl_param = asus->wlan_led_wk; in wlan_led_update()
1091 asus->wlan_led_wk = !!value; in wlan_led_set()
1092 queue_work(asus->led_workqueue, &asus->wlan_led_work); in wlan_led_set()
1113 ctrl_param = asus->lightbar_led_wk; in lightbar_led_update()
1124 asus->lightbar_led_wk = !!value; in lightbar_led_set()
1125 queue_work(asus->led_workqueue, &asus->lightbar_led_work); in lightbar_led_set()
1151 led_classdev_unregister(&asus->kbd_led); in asus_wmi_led_exit()
1152 led_classdev_unregister(&asus->tpd_led); in asus_wmi_led_exit()
1153 led_classdev_unregister(&asus->wlan_led); in asus_wmi_led_exit()
1154 led_classdev_unregister(&asus->lightbar_led); in asus_wmi_led_exit()
1155 led_classdev_unregister(&asus->micmute_led); in asus_wmi_led_exit()
1157 if (asus->led_workqueue) in asus_wmi_led_exit()
1158 destroy_workqueue(asus->led_workqueue); in asus_wmi_led_exit()
1165 if (asus->kbd_rgb_mode_available) in asus_wmi_led_init()
1167 if (asus->kbd_rgb_state_available) in asus_wmi_led_init()
1170 asus->led_workqueue = create_singlethread_workqueue("led_workqueue"); in asus_wmi_led_init()
1171 if (!asus->led_workqueue) in asus_wmi_led_init()
1172 return -ENOMEM; in asus_wmi_led_init()
1175 INIT_WORK(&asus->tpd_led_work, tpd_led_update); in asus_wmi_led_init()
1177 asus->tpd_led.name = "asus::touchpad"; in asus_wmi_led_init()
1178 asus->tpd_led.brightness_set = tpd_led_set; in asus_wmi_led_init()
1179 asus->tpd_led.brightness_get = tpd_led_get; in asus_wmi_led_init()
1180 asus->tpd_led.max_brightness = 1; in asus_wmi_led_init()
1182 rv = led_classdev_register(&asus->platform_device->dev, in asus_wmi_led_init()
1183 &asus->tpd_led); in asus_wmi_led_init()
1189 asus->kbd_led_wk = led_val; in asus_wmi_led_init()
1190 asus->kbd_led.name = "asus::kbd_backlight"; in asus_wmi_led_init()
1191 asus->kbd_led.flags = LED_BRIGHT_HW_CHANGED; in asus_wmi_led_init()
1192 asus->kbd_led.brightness_set = kbd_led_set; in asus_wmi_led_init()
1193 asus->kbd_led.brightness_get = kbd_led_get; in asus_wmi_led_init()
1194 asus->kbd_led.max_brightness = 3; in asus_wmi_led_init()
1197 asus->kbd_led.groups = kbd_rgb_mode_groups; in asus_wmi_led_init()
1199 rv = led_classdev_register(&asus->platform_device->dev, in asus_wmi_led_init()
1200 &asus->kbd_led); in asus_wmi_led_init()
1206 && (asus->driver->quirks->wapf > 0)) { in asus_wmi_led_init()
1207 INIT_WORK(&asus->wlan_led_work, wlan_led_update); in asus_wmi_led_init()
1209 asus->wlan_led.name = "asus::wlan"; in asus_wmi_led_init()
1210 asus->wlan_led.brightness_set = wlan_led_set; in asus_wmi_led_init()
1212 asus->wlan_led.brightness_get = wlan_led_get; in asus_wmi_led_init()
1213 asus->wlan_led.flags = LED_CORE_SUSPENDRESUME; in asus_wmi_led_init()
1214 asus->wlan_led.max_brightness = 1; in asus_wmi_led_init()
1215 asus->wlan_led.default_trigger = "asus-wlan"; in asus_wmi_led_init()
1217 rv = led_classdev_register(&asus->platform_device->dev, in asus_wmi_led_init()
1218 &asus->wlan_led); in asus_wmi_led_init()
1224 INIT_WORK(&asus->lightbar_led_work, lightbar_led_update); in asus_wmi_led_init()
1226 asus->lightbar_led.name = "asus::lightbar"; in asus_wmi_led_init()
1227 asus->lightbar_led.brightness_set = lightbar_led_set; in asus_wmi_led_init()
1228 asus->lightbar_led.brightness_get = lightbar_led_get; in asus_wmi_led_init()
1229 asus->lightbar_led.max_brightness = 1; in asus_wmi_led_init()
1231 rv = led_classdev_register(&asus->platform_device->dev, in asus_wmi_led_init()
1232 &asus->lightbar_led); in asus_wmi_led_init()
1236 asus->micmute_led.name = "platform::micmute"; in asus_wmi_led_init()
1237 asus->micmute_led.max_brightness = 1; in asus_wmi_led_init()
1238 asus->micmute_led.brightness = ledtrig_audio_get(LED_AUDIO_MICMUTE); in asus_wmi_led_init()
1239 asus->micmute_led.brightness_set_blocking = micmute_led_set; in asus_wmi_led_init()
1240 asus->micmute_led.default_trigger = "audio-micmute"; in asus_wmi_led_init()
1242 rv = led_classdev_register(&asus->platform_device->dev, in asus_wmi_led_init()
1243 &asus->micmute_led); in asus_wmi_led_init()
1277 mutex_lock(&asus->wmi_lock); in asus_rfkill_hotplug()
1279 mutex_unlock(&asus->wmi_lock); in asus_rfkill_hotplug()
1281 mutex_lock(&asus->hotplug_lock); in asus_rfkill_hotplug()
1284 if (asus->wlan.rfkill) in asus_rfkill_hotplug()
1285 rfkill_set_sw_state(asus->wlan.rfkill, blocked); in asus_rfkill_hotplug()
1287 if (asus->hotplug_slot.ops) { in asus_rfkill_hotplug()
1331 mutex_unlock(&asus->hotplug_lock); in asus_rfkill_hotplug()
1348 queue_work(asus->hotplug_workqueue, &asus->hotplug_work); in asus_rfkill_notify()
1358 return -ENODEV; in asus_register_rfkill_notifier()
1412 int ret = -ENOMEM; in asus_setup_pci_hotplug()
1417 return -ENODEV; in asus_setup_pci_hotplug()
1420 asus->hotplug_workqueue = in asus_setup_pci_hotplug()
1422 if (!asus->hotplug_workqueue) in asus_setup_pci_hotplug()
1425 INIT_WORK(&asus->hotplug_work, asus_hotplug_work); in asus_setup_pci_hotplug()
1427 asus->hotplug_slot.ops = &asus_hotplug_slot_ops; in asus_setup_pci_hotplug()
1429 ret = pci_hp_register(&asus->hotplug_slot, bus, 0, "asus-wifi"); in asus_setup_pci_hotplug()
1431 pr_err("Unable to register hotplug slot - %d\n", ret); in asus_setup_pci_hotplug()
1438 asus->hotplug_slot.ops = NULL; in asus_setup_pci_hotplug()
1439 destroy_workqueue(asus->hotplug_workqueue); in asus_setup_pci_hotplug()
1451 u32 dev_id = priv->dev_id; in asus_rfkill_set()
1462 priv->asus->driver->wlan_ctrl_by_user) in asus_rfkill_set()
1473 result = asus_wmi_get_devstate_simple(priv->asus, priv->dev_id); in asus_rfkill_query()
1478 rfkill_set_sw_state(priv->rfkill, !result); in asus_rfkill_query()
1484 struct asus_wmi *asus = priv->asus; in asus_rfkill_wlan_set()
1494 mutex_lock(&asus->wmi_lock); in asus_rfkill_wlan_set()
1496 mutex_unlock(&asus->wmi_lock); in asus_rfkill_wlan_set()
1515 struct rfkill **rfkill = &arfkill->rfkill; in asus_new_rfkill()
1520 arfkill->dev_id = dev_id; in asus_new_rfkill()
1521 arfkill->asus = asus; in asus_new_rfkill()
1524 asus->driver->quirks->hotplug_wireless) in asus_new_rfkill()
1525 *rfkill = rfkill_alloc(name, &asus->platform_device->dev, type, in asus_new_rfkill()
1528 *rfkill = rfkill_alloc(name, &asus->platform_device->dev, type, in asus_new_rfkill()
1532 return -EINVAL; in asus_new_rfkill()
1535 (asus->driver->quirks->wapf > 0)) in asus_new_rfkill()
1536 rfkill_set_led_trigger_name(*rfkill, "asus-wlan"); in asus_new_rfkill()
1550 if (asus->driver->wlan_ctrl_by_user && ashs_present()) in asus_wmi_rfkill_exit()
1556 if (asus->wlan.rfkill) { in asus_wmi_rfkill_exit()
1557 rfkill_unregister(asus->wlan.rfkill); in asus_wmi_rfkill_exit()
1558 rfkill_destroy(asus->wlan.rfkill); in asus_wmi_rfkill_exit()
1559 asus->wlan.rfkill = NULL; in asus_wmi_rfkill_exit()
1566 if (asus->hotplug_slot.ops) in asus_wmi_rfkill_exit()
1567 pci_hp_deregister(&asus->hotplug_slot); in asus_wmi_rfkill_exit()
1568 if (asus->hotplug_workqueue) in asus_wmi_rfkill_exit()
1569 destroy_workqueue(asus->hotplug_workqueue); in asus_wmi_rfkill_exit()
1571 if (asus->bluetooth.rfkill) { in asus_wmi_rfkill_exit()
1572 rfkill_unregister(asus->bluetooth.rfkill); in asus_wmi_rfkill_exit()
1573 rfkill_destroy(asus->bluetooth.rfkill); in asus_wmi_rfkill_exit()
1574 asus->bluetooth.rfkill = NULL; in asus_wmi_rfkill_exit()
1576 if (asus->wimax.rfkill) { in asus_wmi_rfkill_exit()
1577 rfkill_unregister(asus->wimax.rfkill); in asus_wmi_rfkill_exit()
1578 rfkill_destroy(asus->wimax.rfkill); in asus_wmi_rfkill_exit()
1579 asus->wimax.rfkill = NULL; in asus_wmi_rfkill_exit()
1581 if (asus->wwan3g.rfkill) { in asus_wmi_rfkill_exit()
1582 rfkill_unregister(asus->wwan3g.rfkill); in asus_wmi_rfkill_exit()
1583 rfkill_destroy(asus->wwan3g.rfkill); in asus_wmi_rfkill_exit()
1584 asus->wwan3g.rfkill = NULL; in asus_wmi_rfkill_exit()
1586 if (asus->gps.rfkill) { in asus_wmi_rfkill_exit()
1587 rfkill_unregister(asus->gps.rfkill); in asus_wmi_rfkill_exit()
1588 rfkill_destroy(asus->gps.rfkill); in asus_wmi_rfkill_exit()
1589 asus->gps.rfkill = NULL; in asus_wmi_rfkill_exit()
1591 if (asus->uwb.rfkill) { in asus_wmi_rfkill_exit()
1592 rfkill_unregister(asus->uwb.rfkill); in asus_wmi_rfkill_exit()
1593 rfkill_destroy(asus->uwb.rfkill); in asus_wmi_rfkill_exit()
1594 asus->uwb.rfkill = NULL; in asus_wmi_rfkill_exit()
1602 mutex_init(&asus->hotplug_lock); in asus_wmi_rfkill_init()
1603 mutex_init(&asus->wmi_lock); in asus_wmi_rfkill_init()
1605 result = asus_new_rfkill(asus, &asus->wlan, "asus-wlan", in asus_wmi_rfkill_init()
1608 if (result && result != -ENODEV) in asus_wmi_rfkill_init()
1611 result = asus_new_rfkill(asus, &asus->bluetooth, in asus_wmi_rfkill_init()
1612 "asus-bluetooth", RFKILL_TYPE_BLUETOOTH, in asus_wmi_rfkill_init()
1615 if (result && result != -ENODEV) in asus_wmi_rfkill_init()
1618 result = asus_new_rfkill(asus, &asus->wimax, "asus-wimax", in asus_wmi_rfkill_init()
1621 if (result && result != -ENODEV) in asus_wmi_rfkill_init()
1624 result = asus_new_rfkill(asus, &asus->wwan3g, "asus-wwan3g", in asus_wmi_rfkill_init()
1627 if (result && result != -ENODEV) in asus_wmi_rfkill_init()
1630 result = asus_new_rfkill(asus, &asus->gps, "asus-gps", in asus_wmi_rfkill_init()
1633 if (result && result != -ENODEV) in asus_wmi_rfkill_init()
1636 result = asus_new_rfkill(asus, &asus->uwb, "asus-uwb", in asus_wmi_rfkill_init()
1639 if (result && result != -ENODEV) in asus_wmi_rfkill_init()
1642 if (!asus->driver->quirks->hotplug_wireless) in asus_wmi_rfkill_init()
1647 * If we get -EBUSY then something else is handling the PCI hotplug - in asus_wmi_rfkill_init()
1650 if (result == -EBUSY) in asus_wmi_rfkill_init()
1663 if (result && result != -ENODEV) in asus_wmi_rfkill_init()
1666 if (result == -ENODEV) in asus_wmi_rfkill_init()
1700 return -EINVAL; in panel_od_store()
1711 return -EIO; in panel_od_store()
1714 sysfs_notify(&asus->platform_device->dev.kobj, NULL, "panel_od"); in panel_od_store()
1726 u32 ports_available = asus->driver->quirks->xusb2pr; in asus_wmi_set_xusb2pr()
1772 return -EINVAL; in asus_agfn_fan_speed_read()
1777 return -ENXIO; in asus_agfn_fan_speed_read()
1800 return -EINVAL; in asus_agfn_fan_speed_write()
1805 return -ENXIO; in asus_agfn_fan_speed_write()
1808 asus->agfn_pwm = *speed; in asus_agfn_fan_speed_write()
1835 * - ASUS_WMI_UNSUPPORTED_METHOD is returned in asus_wmi_has_agfn_fan()
1836 * - reverved bits are non-zero in asus_wmi_has_agfn_fan()
1837 * - sfun and presence bit are not set in asus_wmi_has_agfn_fan()
1840 || (!asus->sfun && !(value & ASUS_WMI_DSTS_PRESENCE_BIT))); in asus_wmi_has_agfn_fan()
1848 switch (asus->fan_type) { in asus_fan_set_auto()
1856 return -EIO; in asus_fan_set_auto()
1862 return -ENXIO; in asus_fan_set_auto()
1866 return -ENXIO; in asus_fan_set_auto()
1872 if (asus->gpu_fan_type == FAN_TYPE_SPEC83) { in asus_fan_set_auto()
1879 return -EIO; in asus_fan_set_auto()
1894 if (asus->agfn_pwm >= 0) in pwm1_show()
1895 return sprintf(buf, "%d\n", asus->agfn_pwm); in pwm1_show()
1899 * we read a current value through the (now-deprecated) FAN_CTRL device. in pwm1_show()
1915 value = -1; in pwm1_show()
1939 asus->fan_pwm_mode = ASUS_FAN_CTRL_MANUAL; in pwm1_store()
1952 switch (asus->fan_type) { in fan1_input_show()
1964 if (asus->fan_pwm_mode == ASUS_FAN_CTRL_MANUAL) in fan1_input_show()
1965 return -ENXIO; in fan1_input_show()
1970 return -ENXIO; in fan1_input_show()
1975 return -ENXIO; in fan1_input_show()
1978 return sysfs_emit(buf, "%d\n", value < 0 ? -1 : value * 100); in fan1_input_show()
1996 return sysfs_emit(buf, "%d\n", asus->fan_pwm_mode); in pwm1_enable_show()
2014 if (asus->fan_type == FAN_TYPE_SPEC83) { in pwm1_enable_store()
2023 return -EINVAL; in pwm1_enable_store()
2032 return -EIO; in pwm1_enable_store()
2033 } else if (asus->fan_type == FAN_TYPE_AGFN) { in pwm1_enable_store()
2045 return -EINVAL; in pwm1_enable_store()
2049 asus->fan_pwm_mode = state; in pwm1_enable_store()
2052 if (asus->cpu_fan_curve_available) in pwm1_enable_store()
2053 asus->custom_fan_curves[FAN_CURVE_DEV_CPU].enabled = false; in pwm1_enable_store()
2054 if (asus->gpu_fan_curve_available) in pwm1_enable_store()
2055 asus->custom_fan_curves[FAN_CURVE_DEV_GPU].enabled = false; in pwm1_enable_store()
2114 return sysfs_emit(buf, "%d\n", asus->gpu_fan_pwm_mode); in pwm2_enable_show()
2139 return -EINVAL; in pwm2_enable_store()
2148 return -EIO; in pwm2_enable_store()
2150 asus->gpu_fan_pwm_mode = state; in pwm2_enable_store()
2159 /* Fan2 - GPU fan */
2184 struct asus_wmi *asus = dev_get_drvdata(dev->parent); in asus_hwmon_sysfs_is_visible()
2188 if (asus->fan_type != FAN_TYPE_AGFN) in asus_hwmon_sysfs_is_visible()
2193 if (asus->fan_type == FAN_TYPE_NONE) in asus_hwmon_sysfs_is_visible()
2198 if (asus->gpu_fan_type == FAN_TYPE_NONE) in asus_hwmon_sysfs_is_visible()
2209 * If the temperature value in deci-Kelvin is near the absolute in asus_hwmon_sysfs_is_visible()
2216 return attr->mode; in asus_hwmon_sysfs_is_visible()
2227 struct device *dev = &asus->platform_device->dev; in asus_wmi_hwmon_init()
2242 asus->gpu_fan_type = FAN_TYPE_NONE; in asus_wmi_fan_init()
2243 asus->fan_type = FAN_TYPE_NONE; in asus_wmi_fan_init()
2244 asus->agfn_pwm = -1; in asus_wmi_fan_init()
2247 asus->fan_type = FAN_TYPE_SPEC83; in asus_wmi_fan_init()
2249 asus->fan_type = FAN_TYPE_AGFN; in asus_wmi_fan_init()
2253 asus->gpu_fan_type = FAN_TYPE_SPEC83; in asus_wmi_fan_init()
2255 if (asus->fan_type == FAN_TYPE_NONE) in asus_wmi_fan_init()
2256 return -ENODEV; in asus_wmi_fan_init()
2259 asus->fan_pwm_mode = ASUS_FAN_CTRL_AUTO; in asus_wmi_fan_init()
2270 asus->fan_boost_mode_available = false; in fan_boost_mode_check_present()
2275 if (err == -ENODEV) in fan_boost_mode_check_present()
2283 asus->fan_boost_mode_available = true; in fan_boost_mode_check_present()
2284 asus->fan_boost_mode_mask = result & ASUS_FAN_BOOST_MODES_MASK; in fan_boost_mode_check_present()
2296 value = asus->fan_boost_mode; in fan_boost_mode_write()
2302 sysfs_notify(&asus->platform_device->dev.kobj, NULL, in fan_boost_mode_write()
2313 return -EIO; in fan_boost_mode_write()
2321 u8 mask = asus->fan_boost_mode_mask; in fan_boost_mode_switch_next()
2323 if (asus->fan_boost_mode == ASUS_FAN_BOOST_MODE_NORMAL) { in fan_boost_mode_switch_next()
2325 asus->fan_boost_mode = ASUS_FAN_BOOST_MODE_OVERBOOST; in fan_boost_mode_switch_next()
2327 asus->fan_boost_mode = ASUS_FAN_BOOST_MODE_SILENT; in fan_boost_mode_switch_next()
2328 } else if (asus->fan_boost_mode == ASUS_FAN_BOOST_MODE_OVERBOOST) { in fan_boost_mode_switch_next()
2330 asus->fan_boost_mode = ASUS_FAN_BOOST_MODE_SILENT; in fan_boost_mode_switch_next()
2332 asus->fan_boost_mode = ASUS_FAN_BOOST_MODE_NORMAL; in fan_boost_mode_switch_next()
2334 asus->fan_boost_mode = ASUS_FAN_BOOST_MODE_NORMAL; in fan_boost_mode_switch_next()
2345 return sysfs_emit(buf, "%d\n", asus->fan_boost_mode); in fan_boost_mode_show()
2353 u8 mask = asus->fan_boost_mode_mask; in fan_boost_mode_store()
2365 return -EINVAL; in fan_boost_mode_store()
2368 return -EINVAL; in fan_boost_mode_store()
2370 return -EINVAL; in fan_boost_mode_store()
2373 asus->fan_boost_mode = new_mode; in fan_boost_mode_store()
2379 // Fan boost mode: 0 - normal, 1 - overboost, 2 - silent
2389 data->temps[i] = buf[i]; in fan_curve_copy_from_buf()
2393 data->percents[i] = in fan_curve_copy_from_buf()
2406 if (asus->throttle_thermal_policy_available) in fan_curve_get_factory_default()
2407 mode = asus->throttle_thermal_policy_mode; in fan_curve_get_factory_default()
2417 curves = &asus->custom_fan_curves[fan_idx]; in fan_curve_get_factory_default()
2418 err = asus_wmi_evaluate_method_buf(asus->dsts_id, fan_dev, mode, buf, in fan_curve_get_factory_default()
2426 curves->device_id = fan_dev; in fan_curve_get_factory_default()
2452 int index = to_sensor_dev_attr(attr)->index; in fan_curve_attr_select()
2454 return &asus->custom_fan_curves[index & FAN_CURVE_DEV_GPU]; in fan_curve_attr_select()
2461 int nr = to_sensor_dev_attr_2(attr)->nr; in fan_curve_attr_2_select()
2463 return &asus->custom_fan_curves[nr & FAN_CURVE_DEV_GPU]; in fan_curve_attr_2_select()
2475 index = dev_attr->index; in fan_curve_show()
2476 nr = dev_attr->nr; in fan_curve_show()
2479 value = data->percents[index]; in fan_curve_show()
2481 value = data->temps[index]; in fan_curve_show()
2493 u8 *percents = data->percents; in fan_curve_write()
2494 u8 *temps = data->temps; in fan_curve_write()
2497 if (!data->enabled) in fan_curve_write()
2510 data->device_id, in fan_curve_write()
2524 int pwm = dev_attr->nr & FAN_CURVE_PWM_MASK; in fan_curve_store()
2525 int index = dev_attr->index; in fan_curve_store()
2534 data->percents[index] = value; in fan_curve_store()
2536 data->temps[index] = value; in fan_curve_store()
2542 * many changes as one-write-per-change. in fan_curve_store()
2544 data->enabled = false; in fan_curve_store()
2558 if (data->enabled) in fan_curve_enable_show()
2580 data->enabled = true; in fan_curve_enable_store()
2583 data->enabled = false; in fan_curve_enable_store()
2590 err = fan_curve_get_factory_default(asus, data->device_id); in fan_curve_enable_store()
2593 data->enabled = false; in fan_curve_enable_store()
2596 return -EINVAL; in fan_curve_enable_store()
2599 if (data->enabled) { in fan_curve_enable_store()
2608 if (asus->throttle_thermal_policy_available) { in fan_curve_enable_store()
2613 } else if (asus->fan_type == FAN_TYPE_SPEC83) { in fan_curve_enable_store()
2619 err = fan_curve_get_factory_default(asus, data->device_id); in fan_curve_enable_store()
2746 struct asus_wmi *asus = dev_get_drvdata(dev->parent); in asus_fan_curve_is_visible()
2752 if (asus->cpu_fan_curve_available && attr->name[3] == '1') in asus_fan_curve_is_visible()
2755 if (asus->gpu_fan_curve_available && attr->name[3] == '2') in asus_fan_curve_is_visible()
2773 struct device *dev = &asus->platform_device->dev; in asus_wmi_custom_fan_curve_init()
2777 err = fan_curve_check_present(asus, &asus->cpu_fan_curve_available, in asus_wmi_custom_fan_curve_init()
2782 err = fan_curve_check_present(asus, &asus->gpu_fan_curve_available, in asus_wmi_custom_fan_curve_init()
2787 if (!asus->cpu_fan_curve_available && !asus->gpu_fan_curve_available) in asus_wmi_custom_fan_curve_init()
2809 asus->throttle_thermal_policy_available = false; in throttle_thermal_policy_check_present()
2815 if (err == -ENODEV) in throttle_thermal_policy_check_present()
2821 asus->throttle_thermal_policy_available = true; in throttle_thermal_policy_check_present()
2832 value = asus->throttle_thermal_policy_mode; in throttle_thermal_policy_write()
2837 sysfs_notify(&asus->platform_device->dev.kobj, NULL, in throttle_thermal_policy_write()
2848 return -EIO; in throttle_thermal_policy_write()
2852 if (asus->cpu_fan_curve_available) in throttle_thermal_policy_write()
2853 asus->custom_fan_curves[FAN_CURVE_DEV_CPU].enabled = false; in throttle_thermal_policy_write()
2854 if (asus->gpu_fan_curve_available) in throttle_thermal_policy_write()
2855 asus->custom_fan_curves[FAN_CURVE_DEV_GPU].enabled = false; in throttle_thermal_policy_write()
2862 if (!asus->throttle_thermal_policy_available) in throttle_thermal_policy_set_default()
2865 asus->throttle_thermal_policy_mode = ASUS_THROTTLE_THERMAL_POLICY_DEFAULT; in throttle_thermal_policy_set_default()
2871 u8 new_mode = asus->throttle_thermal_policy_mode + 1; in throttle_thermal_policy_switch_next()
2877 asus->throttle_thermal_policy_mode = new_mode; in throttle_thermal_policy_switch_next()
2895 u8 mode = asus->throttle_thermal_policy_mode; in throttle_thermal_policy_show()
2914 return -EINVAL; in throttle_thermal_policy_store()
2916 asus->throttle_thermal_policy_mode = new_mode; in throttle_thermal_policy_store()
2930 // Throttle thermal policy: 0 - default, 1 - overboost, 2 - silent
2933 /* Platform profile ***********************************************************/
2935 enum platform_profile_option *profile) in asus_wmi_platform_profile_get() argument
2942 tp = asus->throttle_thermal_policy_mode; in asus_wmi_platform_profile_get()
2946 *profile = PLATFORM_PROFILE_BALANCED; in asus_wmi_platform_profile_get()
2949 *profile = PLATFORM_PROFILE_PERFORMANCE; in asus_wmi_platform_profile_get()
2952 *profile = PLATFORM_PROFILE_QUIET; in asus_wmi_platform_profile_get()
2955 return -EINVAL; in asus_wmi_platform_profile_get()
2962 enum platform_profile_option profile) in asus_wmi_platform_profile_set() argument
2969 switch (profile) { in asus_wmi_platform_profile_set()
2980 return -EOPNOTSUPP; in asus_wmi_platform_profile_set()
2983 asus->throttle_thermal_policy_mode = tp; in asus_wmi_platform_profile_set()
2989 struct device *dev = &asus->platform_device->dev; in platform_profile_setup()
2996 if (!asus->throttle_thermal_policy_available) in platform_profile_setup()
3001 asus->platform_profile_handler.profile_get = asus_wmi_platform_profile_get; in platform_profile_setup()
3002 asus->platform_profile_handler.profile_set = asus_wmi_platform_profile_set; in platform_profile_setup()
3004 set_bit(PLATFORM_PROFILE_QUIET, asus->platform_profile_handler.choices); in platform_profile_setup()
3006 asus->platform_profile_handler.choices); in platform_profile_setup()
3008 asus->platform_profile_handler.choices); in platform_profile_setup()
3010 err = platform_profile_register(&asus->platform_profile_handler); in platform_profile_setup()
3014 asus->platform_profile_support = true; in platform_profile_setup()
3024 if (asus->driver->quirks->store_backlight_power) in read_backlight_power()
3025 ret = !asus->driver->panel_power; in read_backlight_power()
3049 return -ENODEV; in read_brightness_max()
3072 if ((asus->driver->brightness < bd->props.brightness) || in get_scalar_command()
3073 bd->props.brightness == bd->props.max_brightness) in get_scalar_command()
3075 else if ((asus->driver->brightness > bd->props.brightness) || in get_scalar_command()
3076 bd->props.brightness == 0) in get_scalar_command()
3079 asus->driver->brightness = bd->props.brightness; in get_scalar_command()
3091 if (power != -ENODEV && bd->props.power != power) { in update_bl_status()
3092 ctrl_param = !!(bd->props.power == FB_BLANK_UNBLANK); in update_bl_status()
3095 if (asus->driver->quirks->store_backlight_power) in update_bl_status()
3096 asus->driver->panel_power = bd->props.power; in update_bl_status()
3100 if (asus->driver->quirks->scalar_panel_brightness) in update_bl_status()
3104 if (asus->driver->quirks->scalar_panel_brightness) in update_bl_status()
3107 ctrl_param = bd->props.brightness; in update_bl_status()
3122 struct backlight_device *bd = asus->backlight_device; in asus_wmi_backlight_notify()
3123 int old = bd->props.brightness; in asus_wmi_backlight_notify()
3127 new = code - NOTIFY_BRNUP_MIN + 1; in asus_wmi_backlight_notify()
3129 new = code - NOTIFY_BRNDOWN_MIN; in asus_wmi_backlight_notify()
3131 bd->props.brightness = new; in asus_wmi_backlight_notify()
3150 if (power == -ENODEV) in asus_wmi_backlight_init()
3158 bd = backlight_device_register(asus->driver->name, in asus_wmi_backlight_init()
3159 &asus->platform_device->dev, asus, in asus_wmi_backlight_init()
3166 asus->backlight_device = bd; in asus_wmi_backlight_init()
3168 if (asus->driver->quirks->store_backlight_power) in asus_wmi_backlight_init()
3169 asus->driver->panel_power = power; in asus_wmi_backlight_init()
3171 bd->props.brightness = read_brightness(bd); in asus_wmi_backlight_init()
3172 bd->props.power = power; in asus_wmi_backlight_init()
3175 asus->driver->brightness = bd->props.brightness; in asus_wmi_backlight_init()
3182 backlight_device_unregister(asus->backlight_device); in asus_wmi_backlight_exit()
3184 asus->backlight_device = NULL; in asus_wmi_backlight_exit()
3199 /* Fn-lock ********************************************************************/
3213 int mode = asus->fnlock_locked; in asus_wmi_fnlock_update()
3231 return -EIO; in asus_wmi_get_event_code()
3236 if (obj && obj->type == ACPI_TYPE_INTEGER) in asus_wmi_get_event_code()
3237 code = (int)(obj->integer.value & WMI_EVENT_MASK); in asus_wmi_get_event_code()
3239 code = -EIO; in asus_wmi_get_event_code()
3251 if (asus->driver->key_filter) { in asus_wmi_handle_event_code()
3252 asus->driver->key_filter(asus->driver, &code, &key_value, in asus_wmi_handle_event_code()
3271 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1); in asus_wmi_handle_event_code()
3275 kbd_led_set_by_kbd(asus, asus->kbd_led_wk - 1); in asus_wmi_handle_event_code()
3279 if (asus->kbd_led_wk == asus->kbd_led.max_brightness) in asus_wmi_handle_event_code()
3282 kbd_led_set_by_kbd(asus, asus->kbd_led_wk + 1); in asus_wmi_handle_event_code()
3287 asus->fnlock_locked = !asus->fnlock_locked; in asus_wmi_handle_event_code()
3292 if (code == asus->tablet_switch_event_code) { in asus_wmi_handle_event_code()
3298 if (asus->fan_boost_mode_available) in asus_wmi_handle_event_code()
3300 if (asus->throttle_thermal_policy_available) in asus_wmi_handle_event_code()
3306 if (is_display_toggle(code) && asus->driver->quirks->no_display_toggle) in asus_wmi_handle_event_code()
3309 if (!sparse_keymap_report_event(asus->inputdev, code, in asus_wmi_handle_event_code()
3336 if (!asus->wmi_event_queue || value != WMI_EVENT_VALUE_ATK) in asus_wmi_notify()
3360 return -EIO; in asus_wmi_notify_queue_flush()
3437 return -EINVAL; in cpufv_store()
3470 int devid = -1; in asus_sysfs_is_visible()
3483 ok = asus->egpu_enable_available; in asus_sysfs_is_visible()
3485 ok = asus->dgpu_disable_available; in asus_sysfs_is_visible()
3487 ok = asus->gpu_mux_mode_available; in asus_sysfs_is_visible()
3489 ok = asus->fan_boost_mode_available; in asus_sysfs_is_visible()
3491 ok = asus->throttle_thermal_policy_available; in asus_sysfs_is_visible()
3493 ok = asus->panel_overdrive_available; in asus_sysfs_is_visible()
3495 if (devid != -1) in asus_sysfs_is_visible()
3498 return ok ? attr->mode : 0; in asus_sysfs_is_visible()
3508 sysfs_remove_group(&device->dev.kobj, &platform_attribute_group); in asus_wmi_sysfs_exit()
3513 return sysfs_create_group(&device->dev.kobj, &platform_attribute_group); in asus_wmi_sysfs_init()
3520 struct device *dev = &asus->platform_device->dev; in asus_wmi_platform_init()
3531 asus->spec = rv; in asus_wmi_platform_init()
3537 * bit signifies that the laptop is equipped with a Wi-Fi MiniPCI card. in asus_wmi_platform_init()
3542 asus->sfun = rv; in asus_wmi_platform_init()
3560 return -ENODEV; in asus_wmi_platform_init()
3564 asus->dsts_id = ASUS_WMI_METHODID_DCTS; in asus_wmi_platform_init()
3567 asus->dsts_id = ASUS_WMI_METHODID_DSTS; in asus_wmi_platform_init()
3579 wmi_uid = wmi_get_acpi_device_uid(asus->driver->event_guid); in asus_wmi_platform_init()
3584 asus->wmi_event_queue = true; in asus_wmi_platform_init()
3589 if (asus->driver->quirks->wapf >= 0) in asus_wmi_platform_init()
3591 asus->driver->quirks->wapf, NULL); in asus_wmi_platform_init()
3606 struct asus_wmi *asus = m->private; in show_dsts()
3608 u32 retval = -1; in show_dsts()
3610 err = asus_wmi_get_devstate(asus, asus->debug.dev_id, &retval); in show_dsts()
3614 seq_printf(m, "DSTS(%#x) = %#x\n", asus->debug.dev_id, retval); in show_dsts()
3621 struct asus_wmi *asus = m->private; in show_devs()
3623 u32 retval = -1; in show_devs()
3625 err = asus_wmi_set_devstate(asus->debug.dev_id, asus->debug.ctrl_param, in show_devs()
3630 seq_printf(m, "DEVS(%#x, %#x) = %#x\n", asus->debug.dev_id, in show_devs()
3631 asus->debug.ctrl_param, retval); in show_devs()
3638 struct asus_wmi *asus = m->private; in show_call()
3640 .arg0 = asus->debug.dev_id, in show_call()
3641 .arg1 = asus->debug.ctrl_param, in show_call()
3649 0, asus->debug.method_id, in show_call()
3653 return -EIO; in show_call()
3656 if (obj && obj->type == ACPI_TYPE_INTEGER) in show_call()
3657 seq_printf(m, "%#x(%#x, %#x) = %#x\n", asus->debug.method_id, in show_call()
3658 asus->debug.dev_id, asus->debug.ctrl_param, in show_call()
3659 (u32) obj->integer.value); in show_call()
3661 seq_printf(m, "%#x(%#x, %#x) = t:%d\n", asus->debug.method_id, in show_call()
3662 asus->debug.dev_id, asus->debug.ctrl_param, in show_call()
3663 obj ? obj->type : -1); in show_call()
3678 struct asus_wmi_debugfs_node *node = inode->i_private; in asus_wmi_debugfs_open()
3680 return single_open(file, node->show, node->asus); in asus_wmi_debugfs_open()
3693 debugfs_remove_recursive(asus->debug.root); in asus_wmi_debugfs_exit()
3700 asus->debug.root = debugfs_create_dir(asus->driver->name, NULL); in asus_wmi_debugfs_init()
3702 debugfs_create_x32("method_id", S_IRUGO | S_IWUSR, asus->debug.root, in asus_wmi_debugfs_init()
3703 &asus->debug.method_id); in asus_wmi_debugfs_init()
3705 debugfs_create_x32("dev_id", S_IRUGO | S_IWUSR, asus->debug.root, in asus_wmi_debugfs_init()
3706 &asus->debug.dev_id); in asus_wmi_debugfs_init()
3708 debugfs_create_x32("ctrl_param", S_IRUGO | S_IWUSR, asus->debug.root, in asus_wmi_debugfs_init()
3709 &asus->debug.ctrl_param); in asus_wmi_debugfs_init()
3714 node->asus = asus; in asus_wmi_debugfs_init()
3715 debugfs_create_file(node->name, S_IFREG | S_IRUGO, in asus_wmi_debugfs_init()
3716 asus->debug.root, node, in asus_wmi_debugfs_init()
3725 struct platform_driver *pdrv = to_platform_driver(pdev->dev.driver); in asus_wmi_add()
3734 return -ENOMEM; in asus_wmi_add()
3736 asus->driver = wdrv; in asus_wmi_add()
3737 asus->platform_device = pdev; in asus_wmi_add()
3738 wdrv->platform_device = pdev; in asus_wmi_add()
3739 platform_set_drvdata(asus->platform_device, asus); in asus_wmi_add()
3741 if (wdrv->detect_quirks) in asus_wmi_add()
3742 wdrv->detect_quirks(asus->driver); in asus_wmi_add()
3748 asus->egpu_enable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_EGPU); in asus_wmi_add()
3749 asus->dgpu_disable_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_DGPU); in asus_wmi_add()
3750 asus->gpu_mux_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_GPU_MUX); in asus_wmi_add()
3751 asus->kbd_rgb_mode_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_MODE); in asus_wmi_add()
3752 asus->kbd_rgb_state_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_TUF_RGB_STATE); in asus_wmi_add()
3753 asus->panel_overdrive_available = asus_wmi_dev_is_present(asus, ASUS_WMI_DEVID_PANEL_OD); in asus_wmi_add()
3769 err = asus_wmi_sysfs_init(asus->platform_device); in asus_wmi_add()
3793 asus->driver->wlan_ctrl_by_user = 1; in asus_wmi_add()
3795 if (!(asus->driver->wlan_ctrl_by_user && ashs_present())) { in asus_wmi_add()
3801 if (asus->driver->quirks->wmi_force_als_set) in asus_wmi_add()
3804 if (asus->driver->quirks->xusb2pr) in asus_wmi_add()
3809 if (err && err != -ENODEV) in asus_wmi_add()
3811 } else if (asus->driver->quirks->wmi_backlight_set_devstate) in asus_wmi_add()
3815 asus->fnlock_locked = fnlock_default; in asus_wmi_add()
3819 status = wmi_install_notify_handler(asus->driver->event_guid, in asus_wmi_add()
3822 pr_err("Unable to register notify handler - %d\n", status); in asus_wmi_add()
3823 err = -ENODEV; in asus_wmi_add()
3843 asus_wmi_sysfs_exit(asus->platform_device); in asus_wmi_add()
3848 if (asus->platform_profile_support) in asus_wmi_add()
3861 wmi_remove_notify_handler(asus->driver->event_guid); in asus_wmi_remove()
3867 asus_wmi_sysfs_exit(asus->platform_device); in asus_wmi_remove()
3872 if (asus->platform_profile_support) in asus_wmi_remove()
3879 /* Platform driver - hibernate/resume callbacks *******************************/
3885 if (asus->wlan.rfkill) { in asus_hotk_thaw()
3889 * Work around bios bug - acpi _PTS turns off the wireless led in asus_hotk_thaw()
3904 if (!IS_ERR_OR_NULL(asus->kbd_led.dev)) in asus_hotk_resume()
3920 if (asus->wlan.rfkill) in asus_hotk_restore()
3923 if (asus->bluetooth.rfkill) { in asus_hotk_restore()
3926 rfkill_set_sw_state(asus->bluetooth.rfkill, bl); in asus_hotk_restore()
3928 if (asus->wimax.rfkill) { in asus_hotk_restore()
3930 rfkill_set_sw_state(asus->wimax.rfkill, bl); in asus_hotk_restore()
3932 if (asus->wwan3g.rfkill) { in asus_hotk_restore()
3934 rfkill_set_sw_state(asus->wwan3g.rfkill, bl); in asus_hotk_restore()
3936 if (asus->gps.rfkill) { in asus_hotk_restore()
3938 rfkill_set_sw_state(asus->gps.rfkill, bl); in asus_hotk_restore()
3940 if (asus->uwb.rfkill) { in asus_hotk_restore()
3942 rfkill_set_sw_state(asus->uwb.rfkill, bl); in asus_hotk_restore()
3944 if (!IS_ERR_OR_NULL(asus->kbd_led.dev)) in asus_hotk_restore()
3964 struct platform_driver *pdrv = to_platform_driver(pdev->dev.driver); in asus_wmi_probe()
3970 return -ENODEV; in asus_wmi_probe()
3973 if (wdrv->event_guid && !wmi_has_guid(wdrv->event_guid)) { in asus_wmi_probe()
3975 return -ENODEV; in asus_wmi_probe()
3978 if (wdrv->probe) { in asus_wmi_probe()
3979 ret = wdrv->probe(pdev); in asus_wmi_probe()
3995 return -EBUSY; in asus_wmi_register_driver()
3997 platform_driver = &driver->platform_driver; in asus_wmi_register_driver()
3998 platform_driver->remove = asus_wmi_remove; in asus_wmi_register_driver()
3999 platform_driver->driver.owner = driver->owner; in asus_wmi_register_driver()
4000 platform_driver->driver.name = driver->name; in asus_wmi_register_driver()
4001 platform_driver->driver.pm = &asus_pm_ops; in asus_wmi_register_driver()
4016 platform_device_unregister(driver->platform_device); in asus_wmi_unregister_driver()
4017 platform_driver_unregister(&driver->platform_driver); in asus_wmi_unregister_driver()