Lines Matching full:asus
3 * asus-laptop.c - Asus Laptop Support
44 #define ASUS_LAPTOP_NAME "Asus Laptop Support"
112 * Some events we use, same for all Asus
217 struct asus_laptop *asus; member
228 struct asus_laptop *asus; member
413 static bool asus_check_pega_lucid(struct asus_laptop *asus) in asus_check_pega_lucid() argument
415 return !strcmp(asus->name, DEVICE_NAME_PEGA) && in asus_check_pega_lucid()
416 !acpi_check_handle(asus->handle, METHOD_PEGA_ENABLE, NULL) && in asus_check_pega_lucid()
417 !acpi_check_handle(asus->handle, METHOD_PEGA_DISABLE, NULL) && in asus_check_pega_lucid()
418 !acpi_check_handle(asus->handle, METHOD_PEGA_READ, NULL); in asus_check_pega_lucid()
421 static int asus_pega_lucid_set(struct asus_laptop *asus, int unit, bool enable) in asus_pega_lucid_set() argument
424 return write_acpi_int(asus->handle, method, unit); in asus_pega_lucid_set()
427 static int pega_acc_axis(struct asus_laptop *asus, int curr, char *method) in pega_acc_axis() argument
432 acpi_evaluate_integer(asus->handle, method, NULL, &val); in pega_acc_axis()
450 struct asus_laptop *asus = dev_get_drvdata(parent); in pega_accel_poll() local
456 if (!asus->pega_acc_live) { in pega_accel_poll()
457 asus->pega_acc_live = true; in pega_accel_poll()
465 asus->pega_acc_x = pega_acc_axis(asus, asus->pega_acc_x, METHOD_XLRX); in pega_accel_poll()
466 asus->pega_acc_y = pega_acc_axis(asus, asus->pega_acc_y, METHOD_XLRY); in pega_accel_poll()
467 asus->pega_acc_z = pega_acc_axis(asus, asus->pega_acc_z, METHOD_XLRZ); in pega_accel_poll()
472 input_report_abs(input, ABS_X, -asus->pega_acc_x); in pega_accel_poll()
473 input_report_abs(input, ABS_Y, -asus->pega_acc_y); in pega_accel_poll()
474 input_report_abs(input, ABS_Z, asus->pega_acc_z); in pega_accel_poll()
478 static void pega_accel_exit(struct asus_laptop *asus) in pega_accel_exit() argument
480 if (asus->pega_accel_poll) { in pega_accel_exit()
481 input_unregister_device(asus->pega_accel_poll); in pega_accel_exit()
482 asus->pega_accel_poll = NULL; in pega_accel_exit()
486 static int pega_accel_init(struct asus_laptop *asus) in pega_accel_init() argument
491 if (!asus->is_pega_lucid) in pega_accel_init()
494 if (acpi_check_handle(asus->handle, METHOD_XLRX, NULL) || in pega_accel_init()
495 acpi_check_handle(asus->handle, METHOD_XLRY, NULL) || in pega_accel_init()
496 acpi_check_handle(asus->handle, METHOD_XLRZ, NULL)) in pega_accel_init()
505 input->dev.parent = &asus->platform_device->dev; in pega_accel_init()
527 asus->pega_accel_poll = input; in pega_accel_init()
536 static int asus_led_set(struct asus_laptop *asus, const char *method, in asus_led_set() argument
546 return write_acpi_int(asus->handle, method, value); in asus_led_set()
557 struct asus_laptop *asus = led->asus; in asus_led_cdev_set() local
560 queue_work(asus->led_workqueue, &led->work); in asus_led_cdev_set()
566 struct asus_laptop *asus = led->asus; in asus_led_cdev_update() local
568 asus_led_set(asus, led->method, led->wk); in asus_led_cdev_update()
579 static int asus_kled_lvl(struct asus_laptop *asus) in asus_kled_lvl() argument
591 rv = acpi_evaluate_integer(asus->handle, METHOD_KBD_LIGHT_GET, in asus_kled_lvl()
600 static int asus_kled_set(struct asus_laptop *asus, int kblv) in asus_kled_set() argument
607 if (write_acpi_int(asus->handle, METHOD_KBD_LIGHT_SET, kblv)) { in asus_kled_set()
618 struct asus_laptop *asus = led->asus; in asus_kled_cdev_set() local
621 queue_work(asus->led_workqueue, &led->work); in asus_kled_cdev_set()
627 struct asus_laptop *asus = led->asus; in asus_kled_cdev_update() local
629 asus_kled_set(asus, led->wk); in asus_kled_cdev_update()
635 struct asus_laptop *asus = led->asus; in asus_kled_cdev_get() local
637 return asus_kled_lvl(asus); in asus_kled_cdev_get()
640 static void asus_led_exit(struct asus_laptop *asus) in asus_led_exit() argument
642 led_classdev_unregister(&asus->wled.led); in asus_led_exit()
643 led_classdev_unregister(&asus->bled.led); in asus_led_exit()
644 led_classdev_unregister(&asus->mled.led); in asus_led_exit()
645 led_classdev_unregister(&asus->tled.led); in asus_led_exit()
646 led_classdev_unregister(&asus->pled.led); in asus_led_exit()
647 led_classdev_unregister(&asus->rled.led); in asus_led_exit()
648 led_classdev_unregister(&asus->gled.led); in asus_led_exit()
649 led_classdev_unregister(&asus->kled.led); in asus_led_exit()
651 if (asus->led_workqueue) { in asus_led_exit()
652 destroy_workqueue(asus->led_workqueue); in asus_led_exit()
653 asus->led_workqueue = NULL; in asus_led_exit()
658 static int asus_led_register(struct asus_laptop *asus, in asus_led_register() argument
664 if (!method || acpi_check_handle(asus->handle, method, NULL)) in asus_led_register()
667 led->asus = asus; in asus_led_register()
675 return led_classdev_register(&asus->platform_device->dev, led_cdev); in asus_led_register()
678 static int asus_led_init(struct asus_laptop *asus) in asus_led_init() argument
686 if (asus->is_pega_lucid) in asus_led_init()
692 * subsystem asks, we avoid messing with the Asus ACPI stuff during a in asus_led_init()
695 asus->led_workqueue = create_singlethread_workqueue("led_workqueue"); in asus_led_init()
696 if (!asus->led_workqueue) in asus_led_init()
699 if (asus->wled_type == TYPE_LED) in asus_led_init()
700 r = asus_led_register(asus, &asus->wled, "asus::wlan", in asus_led_init()
704 if (asus->bled_type == TYPE_LED) in asus_led_init()
705 r = asus_led_register(asus, &asus->bled, "asus::bluetooth", in asus_led_init()
709 r = asus_led_register(asus, &asus->mled, "asus::mail", METHOD_MLED); in asus_led_init()
712 r = asus_led_register(asus, &asus->tled, "asus::touchpad", METHOD_TLED); in asus_led_init()
715 r = asus_led_register(asus, &asus->rled, "asus::record", METHOD_RLED); in asus_led_init()
718 r = asus_led_register(asus, &asus->pled, "asus::phone", METHOD_PLED); in asus_led_init()
721 r = asus_led_register(asus, &asus->gled, "asus::gaming", METHOD_GLED); in asus_led_init()
724 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL) && in asus_led_init()
725 !acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_GET, NULL)) { in asus_led_init()
726 struct asus_led *led = &asus->kled; in asus_led_init()
729 led->asus = asus; in asus_led_init()
732 cdev->name = "asus::kbd_backlight"; in asus_led_init()
736 r = led_classdev_register(&asus->platform_device->dev, cdev); in asus_led_init()
740 asus_led_exit(asus); in asus_led_init()
749 struct asus_laptop *asus = bl_get_data(bd); in asus_read_brightness() local
753 rv = acpi_evaluate_integer(asus->handle, METHOD_BRIGHTNESS_GET, in asus_read_brightness()
765 struct asus_laptop *asus = bl_get_data(bd); in asus_set_brightness() local
767 if (write_acpi_int(asus->handle, METHOD_BRIGHTNESS_SET, value)) { in asus_set_brightness()
786 static int asus_backlight_notify(struct asus_laptop *asus) in asus_backlight_notify() argument
788 struct backlight_device *bd = asus->backlight_device; in asus_backlight_notify()
796 static int asus_backlight_init(struct asus_laptop *asus) in asus_backlight_init() argument
801 if (acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_GET, NULL) || in asus_backlight_init()
802 acpi_check_handle(asus->handle, METHOD_BRIGHTNESS_SET, NULL)) in asus_backlight_init()
810 &asus->platform_device->dev, asus, in asus_backlight_init()
813 pr_err("Could not register asus backlight device\n"); in asus_backlight_init()
814 asus->backlight_device = NULL; in asus_backlight_init()
818 asus->backlight_device = bd; in asus_backlight_init()
825 static void asus_backlight_exit(struct asus_laptop *asus) in asus_backlight_exit() argument
827 backlight_device_unregister(asus->backlight_device); in asus_backlight_exit()
828 asus->backlight_device = NULL; in asus_backlight_exit()
843 struct asus_laptop *asus = dev_get_drvdata(dev); in infos_show() local
855 len += sysfs_emit_at(page, len, "Model reference : %s\n", asus->name); in infos_show()
862 rv = acpi_evaluate_integer(asus->handle, "SFUN", NULL, &temp); in infos_show()
874 rv = acpi_evaluate_integer(asus->handle, "HWRS", NULL, &temp); in infos_show()
885 rv = acpi_evaluate_integer(asus->handle, "ASYM", NULL, &temp); in infos_show()
889 if (asus->dsdt_info) { in infos_show()
890 snprintf(buf, 16, "%d", asus->dsdt_info->length); in infos_show()
892 snprintf(buf, 16, "%d", asus->dsdt_info->checksum); in infos_show()
894 snprintf(buf, 16, "%d", asus->dsdt_info->revision); in infos_show()
896 snprintf(buf, 7, "%s", asus->dsdt_info->oem_id); in infos_show()
898 snprintf(buf, 9, "%s", asus->dsdt_info->oem_table_id); in infos_show()
900 snprintf(buf, 16, "%x", asus->dsdt_info->oem_revision); in infos_show()
902 snprintf(buf, 5, "%s", asus->dsdt_info->asl_compiler_id); in infos_show()
904 snprintf(buf, 16, "%x", asus->dsdt_info->asl_compiler_revision); in infos_show()
912 static ssize_t sysfs_acpi_set(struct asus_laptop *asus, in sysfs_acpi_set() argument
922 if (write_acpi_int(asus->handle, method, value)) in sysfs_acpi_set()
933 struct asus_laptop *asus = dev_get_drvdata(dev); in ledd_show() local
935 return sysfs_emit(buf, "0x%08x\n", asus->ledd_status); in ledd_show()
941 struct asus_laptop *asus = dev_get_drvdata(dev); in ledd_store() local
948 if (write_acpi_int(asus->handle, METHOD_LEDD, value)) { in ledd_store()
953 asus->ledd_status = (u32) value; in ledd_store()
961 static int asus_wireless_status(struct asus_laptop *asus, int mask) in asus_wireless_status() argument
966 if (!asus->have_rsts) in asus_wireless_status()
967 return (asus->wireless_status & mask) ? 1 : 0; in asus_wireless_status()
969 rv = acpi_evaluate_integer(asus->handle, METHOD_WL_STATUS, in asus_wireless_status()
981 static int asus_wlan_set(struct asus_laptop *asus, int status) in asus_wlan_set() argument
983 if (write_acpi_int(asus->handle, METHOD_WLAN, !!status)) { in asus_wlan_set()
993 struct asus_laptop *asus = dev_get_drvdata(dev); in wlan_show() local
995 return sysfs_emit(buf, "%d\n", asus_wireless_status(asus, WL_RSTS)); in wlan_show()
1001 struct asus_laptop *asus = dev_get_drvdata(dev); in wlan_store() local
1003 return sysfs_acpi_set(asus, buf, count, METHOD_WLAN); in wlan_store()
1010 static int asus_bluetooth_set(struct asus_laptop *asus, int status) in asus_bluetooth_set() argument
1012 if (write_acpi_int(asus->handle, METHOD_BLUETOOTH, !!status)) { in asus_bluetooth_set()
1022 struct asus_laptop *asus = dev_get_drvdata(dev); in bluetooth_show() local
1024 return sysfs_emit(buf, "%d\n", asus_wireless_status(asus, BT_RSTS)); in bluetooth_show()
1031 struct asus_laptop *asus = dev_get_drvdata(dev); in bluetooth_store() local
1033 return sysfs_acpi_set(asus, buf, count, METHOD_BLUETOOTH); in bluetooth_store()
1040 static int asus_wimax_set(struct asus_laptop *asus, int status) in asus_wimax_set() argument
1042 if (write_acpi_int(asus->handle, METHOD_WIMAX, !!status)) { in asus_wimax_set()
1052 struct asus_laptop *asus = dev_get_drvdata(dev); in wimax_show() local
1054 return sysfs_emit(buf, "%d\n", asus_wireless_status(asus, WM_RSTS)); in wimax_show()
1060 struct asus_laptop *asus = dev_get_drvdata(dev); in wimax_store() local
1062 return sysfs_acpi_set(asus, buf, count, METHOD_WIMAX); in wimax_store()
1069 static int asus_wwan_set(struct asus_laptop *asus, int status) in asus_wwan_set() argument
1071 if (write_acpi_int(asus->handle, METHOD_WWAN, !!status)) { in asus_wwan_set()
1081 struct asus_laptop *asus = dev_get_drvdata(dev); in wwan_show() local
1083 return sysfs_emit(buf, "%d\n", asus_wireless_status(asus, WW_RSTS)); in wwan_show()
1089 struct asus_laptop *asus = dev_get_drvdata(dev); in wwan_store() local
1091 return sysfs_acpi_set(asus, buf, count, METHOD_WWAN); in wwan_store()
1098 static void asus_set_display(struct asus_laptop *asus, int value) in asus_set_display() argument
1101 if (write_acpi_int(asus->handle, METHOD_SWITCH_DISPLAY, value)) in asus_set_display()
1116 struct asus_laptop *asus = dev_get_drvdata(dev); in display_store() local
1123 asus_set_display(asus, value); in display_store()
1131 static void asus_als_switch(struct asus_laptop *asus, int value) in asus_als_switch() argument
1135 if (asus->is_pega_lucid) { in asus_als_switch()
1136 ret = asus_pega_lucid_set(asus, PEGA_ALS, value); in asus_als_switch()
1138 ret = asus_pega_lucid_set(asus, PEGA_ALS_POWER, value); in asus_als_switch()
1140 ret = write_acpi_int(asus->handle, METHOD_ALS_CONTROL, value); in asus_als_switch()
1145 asus->light_switch = value; in asus_als_switch()
1151 struct asus_laptop *asus = dev_get_drvdata(dev); in ls_switch_show() local
1153 return sysfs_emit(buf, "%d\n", asus->light_switch); in ls_switch_show()
1160 struct asus_laptop *asus = dev_get_drvdata(dev); in ls_switch_store() local
1167 asus_als_switch(asus, value ? 1 : 0); in ls_switch_store()
1172 static void asus_als_level(struct asus_laptop *asus, int value) in asus_als_level() argument
1174 if (write_acpi_int(asus->handle, METHOD_ALS_LEVEL, value)) in asus_als_level()
1176 asus->light_level = value; in asus_als_level()
1182 struct asus_laptop *asus = dev_get_drvdata(dev); in ls_level_show() local
1184 return sysfs_emit(buf, "%d\n", asus->light_level); in ls_level_show()
1190 struct asus_laptop *asus = dev_get_drvdata(dev); in ls_level_store() local
1199 asus_als_level(asus, value); in ls_level_store()
1205 static int pega_int_read(struct asus_laptop *asus, int arg, int *result) in pega_int_read() argument
1208 int err = write_acpi_int_ret(asus->handle, METHOD_PEGA_READ, arg, in pega_int_read()
1223 struct asus_laptop *asus = dev_get_drvdata(dev); in ls_value_show() local
1226 err = pega_int_read(asus, PEGA_READ_ALS_H, &hi); in ls_value_show()
1228 err = pega_int_read(asus, PEGA_READ_ALS_L, &lo); in ls_value_show()
1238 static int asus_gps_status(struct asus_laptop *asus) in asus_gps_status() argument
1243 rv = acpi_evaluate_integer(asus->handle, METHOD_GPS_STATUS, in asus_gps_status()
1252 static int asus_gps_switch(struct asus_laptop *asus, int status) in asus_gps_switch() argument
1256 if (write_acpi_int(asus->handle, meth, 0x02)) in asus_gps_switch()
1264 struct asus_laptop *asus = dev_get_drvdata(dev); in gps_show() local
1266 return sysfs_emit(buf, "%d\n", asus_gps_status(asus)); in gps_show()
1272 struct asus_laptop *asus = dev_get_drvdata(dev); in gps_store() local
1279 ret = asus_gps_switch(asus, !!value); in gps_store()
1282 rfkill_set_sw_state(asus->gps.rfkill, !value); in gps_store()
1292 struct asus_laptop *asus = data; in asus_gps_rfkill_set() local
1294 return asus_gps_switch(asus, !blocked); in asus_gps_rfkill_set()
1304 struct asus_laptop *asus = rfk->asus; in asus_rfkill_set() local
1307 return asus_wlan_set(asus, !blocked); in asus_rfkill_set()
1309 return asus_bluetooth_set(asus, !blocked); in asus_rfkill_set()
1311 return asus_wimax_set(asus, !blocked); in asus_rfkill_set()
1313 return asus_wwan_set(asus, !blocked); in asus_rfkill_set()
1332 static void asus_rfkill_exit(struct asus_laptop *asus) in asus_rfkill_exit() argument
1334 asus_rfkill_terminate(&asus->wwan); in asus_rfkill_exit()
1335 asus_rfkill_terminate(&asus->bluetooth); in asus_rfkill_exit()
1336 asus_rfkill_terminate(&asus->wlan); in asus_rfkill_exit()
1337 asus_rfkill_terminate(&asus->gps); in asus_rfkill_exit()
1340 static int asus_rfkill_setup(struct asus_laptop *asus, struct asus_rfkill *rfk, in asus_rfkill_setup() argument
1347 rfk->asus = asus; in asus_rfkill_setup()
1348 rfk->rfkill = rfkill_alloc(name, &asus->platform_device->dev, in asus_rfkill_setup()
1362 static int asus_rfkill_init(struct asus_laptop *asus) in asus_rfkill_init() argument
1366 if (asus->is_pega_lucid) in asus_rfkill_init()
1369 if (!acpi_check_handle(asus->handle, METHOD_GPS_ON, NULL) && in asus_rfkill_init()
1370 !acpi_check_handle(asus->handle, METHOD_GPS_OFF, NULL) && in asus_rfkill_init()
1371 !acpi_check_handle(asus->handle, METHOD_GPS_STATUS, NULL)) in asus_rfkill_init()
1372 result = asus_rfkill_setup(asus, &asus->gps, "asus-gps", in asus_rfkill_init()
1379 if (!acpi_check_handle(asus->handle, METHOD_WLAN, NULL) && in asus_rfkill_init()
1380 asus->wled_type == TYPE_RFKILL) in asus_rfkill_init()
1381 result = asus_rfkill_setup(asus, &asus->wlan, "asus-wlan", in asus_rfkill_init()
1387 if (!acpi_check_handle(asus->handle, METHOD_BLUETOOTH, NULL) && in asus_rfkill_init()
1388 asus->bled_type == TYPE_RFKILL) in asus_rfkill_init()
1389 result = asus_rfkill_setup(asus, &asus->bluetooth, in asus_rfkill_init()
1390 "asus-bluetooth", BT_RSTS, in asus_rfkill_init()
1396 if (!acpi_check_handle(asus->handle, METHOD_WWAN, NULL)) in asus_rfkill_init()
1397 result = asus_rfkill_setup(asus, &asus->wwan, "asus-wwan", in asus_rfkill_init()
1403 if (!acpi_check_handle(asus->handle, METHOD_WIMAX, NULL)) in asus_rfkill_init()
1404 result = asus_rfkill_setup(asus, &asus->wimax, "asus-wimax", in asus_rfkill_init()
1412 asus_rfkill_exit(asus); in asus_rfkill_init()
1421 int ret = asus_pega_lucid_set(rfk->asus, rfk->control_id, !blocked); in pega_rfkill_set()
1429 static int pega_rfkill_setup(struct asus_laptop *asus, struct asus_rfkill *rfk, in pega_rfkill_setup() argument
1432 return asus_rfkill_setup(asus, rfk, name, controlid, rfkill_type, in pega_rfkill_setup()
1436 static int pega_rfkill_init(struct asus_laptop *asus) in pega_rfkill_init() argument
1440 if(!asus->is_pega_lucid) in pega_rfkill_init()
1443 ret = pega_rfkill_setup(asus, &asus->wlan, "pega-wlan", in pega_rfkill_init()
1448 ret = pega_rfkill_setup(asus, &asus->bluetooth, "pega-bt", in pega_rfkill_init()
1453 ret = pega_rfkill_setup(asus, &asus->wwan, "pega-wwan", in pega_rfkill_init()
1458 asus_rfkill_exit(asus); in pega_rfkill_init()
1466 static void asus_input_notify(struct asus_laptop *asus, int event) in asus_input_notify() argument
1468 if (!asus->inputdev) in asus_input_notify()
1470 if (!sparse_keymap_report_event(asus->inputdev, event, 1, true)) in asus_input_notify()
1474 static int asus_input_init(struct asus_laptop *asus) in asus_input_init() argument
1483 input->name = "Asus Laptop extra buttons"; in asus_input_init()
1486 input->dev.parent = &asus->platform_device->dev; in asus_input_init()
1499 asus->inputdev = input; in asus_input_init()
1507 static void asus_input_exit(struct asus_laptop *asus) in asus_input_exit() argument
1509 if (asus->inputdev) in asus_input_exit()
1510 input_unregister_device(asus->inputdev); in asus_input_exit()
1511 asus->inputdev = NULL; in asus_input_exit()
1519 struct asus_laptop *asus = acpi_driver_data(device); in asus_acpi_notify() local
1523 count = asus->event_count[event % 128]++; in asus_acpi_notify()
1524 acpi_bus_generate_netlink_event(asus->device->pnp.device_class, in asus_acpi_notify()
1525 dev_name(&asus->device->dev), event, in asus_acpi_notify()
1536 if (asus->backlight_device != NULL) { in asus_acpi_notify()
1538 asus_backlight_notify(asus); in asus_acpi_notify()
1544 if (asus->pega_accel_poll && event == 0xEA) { in asus_acpi_notify()
1545 kobject_uevent(&asus->pega_accel_poll->dev.kobj, KOBJ_CHANGE); in asus_acpi_notify()
1549 asus_input_notify(asus, event); in asus_acpi_notify()
1572 struct asus_laptop *asus = dev_get_drvdata(dev); in asus_sysfs_is_visible() local
1573 acpi_handle handle = asus->handle; in asus_sysfs_is_visible()
1576 if (asus->is_pega_lucid) { in asus_sysfs_is_visible()
1600 !acpi_check_handle(asus->handle, METHOD_WIMAX, NULL); in asus_sysfs_is_visible()
1603 supported = !acpi_check_handle(asus->handle, METHOD_WWAN, NULL); in asus_sysfs_is_visible()
1613 supported = asus->is_pega_lucid; in asus_sysfs_is_visible()
1631 static int asus_platform_init(struct asus_laptop *asus) in asus_platform_init() argument
1635 asus->platform_device = platform_device_alloc(ASUS_LAPTOP_FILE, PLATFORM_DEVID_NONE); in asus_platform_init()
1636 if (!asus->platform_device) in asus_platform_init()
1638 platform_set_drvdata(asus->platform_device, asus); in asus_platform_init()
1640 result = platform_device_add(asus->platform_device); in asus_platform_init()
1644 result = sysfs_create_group(&asus->platform_device->dev.kobj, in asus_platform_init()
1652 platform_device_del(asus->platform_device); in asus_platform_init()
1654 platform_device_put(asus->platform_device); in asus_platform_init()
1658 static void asus_platform_exit(struct asus_laptop *asus) in asus_platform_exit() argument
1660 sysfs_remove_group(&asus->platform_device->dev.kobj, &asus_attr_group); in asus_platform_exit()
1661 platform_device_unregister(asus->platform_device); in asus_platform_exit()
1675 static int asus_laptop_get_info(struct asus_laptop *asus) in asus_laptop_get_info() argument
1690 status = acpi_get_table(ACPI_SIG_DSDT, 1, &asus->dsdt_info); in asus_laptop_get_info()
1694 /* We have to write 0 on init this far for all ASUS models */ in asus_laptop_get_info()
1695 if (write_acpi_int_ret(asus->handle, "INIT", 0, &buffer)) { in asus_laptop_get_info()
1702 acpi_evaluate_integer(asus->handle, "BSTS", NULL, &bsts_result); in asus_laptop_get_info()
1710 if (write_acpi_int(asus->handle, "CWAP", wapf)) in asus_laptop_get_info()
1732 asus->name = kstrdup(string, GFP_KERNEL); in asus_laptop_get_info()
1733 if (!asus->name) { in asus_laptop_get_info()
1741 if (!acpi_check_handle(asus->handle, METHOD_WL_STATUS, NULL)) in asus_laptop_get_info()
1742 asus->have_rsts = true; in asus_laptop_get_info()
1749 static int asus_acpi_init(struct asus_laptop *asus) in asus_acpi_init() argument
1753 result = acpi_bus_get_status(asus->device); in asus_acpi_init()
1756 if (!asus->device->status.present) { in asus_acpi_init()
1761 result = asus_laptop_get_info(asus); in asus_acpi_init()
1766 asus->bled_type = TYPE_LED; in asus_acpi_init()
1768 asus->bled_type = TYPE_RFKILL; in asus_acpi_init()
1771 asus->wled_type = TYPE_LED; in asus_acpi_init()
1773 asus->wled_type = TYPE_RFKILL; in asus_acpi_init()
1776 asus_bluetooth_set(asus, !!bluetooth_status); in asus_acpi_init()
1779 asus_wlan_set(asus, !!wlan_status); in asus_acpi_init()
1782 asus_wimax_set(asus, !!wimax_status); in asus_acpi_init()
1785 asus_wwan_set(asus, !!wwan_status); in asus_acpi_init()
1788 if (!acpi_check_handle(asus->handle, METHOD_KBD_LIGHT_SET, NULL)) in asus_acpi_init()
1789 asus_kled_set(asus, 1); in asus_acpi_init()
1792 asus->ledd_status = 0xFFF; in asus_acpi_init()
1795 asus->light_switch = !!als_status; in asus_acpi_init()
1796 asus->light_level = 5; /* level 5 for sensor sensitivity */ in asus_acpi_init()
1798 if (asus->is_pega_lucid) { in asus_acpi_init()
1799 asus_als_switch(asus, asus->light_switch); in asus_acpi_init()
1800 } else if (!acpi_check_handle(asus->handle, METHOD_ALS_CONTROL, NULL) && in asus_acpi_init()
1801 !acpi_check_handle(asus->handle, METHOD_ALS_LEVEL, NULL)) { in asus_acpi_init()
1802 asus_als_switch(asus, asus->light_switch); in asus_acpi_init()
1803 asus_als_level(asus, asus->light_level); in asus_acpi_init()
1826 struct asus_laptop *asus; in asus_acpi_add() local
1829 pr_notice("Asus Laptop Support version %s\n", in asus_acpi_add()
1831 asus = kzalloc(sizeof(struct asus_laptop), GFP_KERNEL); in asus_acpi_add()
1832 if (!asus) in asus_acpi_add()
1834 asus->handle = device->handle; in asus_acpi_add()
1837 device->driver_data = asus; in asus_acpi_add()
1838 asus->device = device; in asus_acpi_add()
1842 result = asus_acpi_init(asus); in asus_acpi_add()
1850 asus->is_pega_lucid = asus_check_pega_lucid(asus); in asus_acpi_add()
1851 result = asus_platform_init(asus); in asus_acpi_add()
1856 result = asus_backlight_init(asus); in asus_acpi_add()
1861 result = asus_input_init(asus); in asus_acpi_add()
1865 result = asus_led_init(asus); in asus_acpi_add()
1869 result = asus_rfkill_init(asus); in asus_acpi_add()
1873 result = pega_accel_init(asus); in asus_acpi_add()
1877 result = pega_rfkill_init(asus); in asus_acpi_add()
1885 pega_accel_exit(asus); in asus_acpi_add()
1887 asus_rfkill_exit(asus); in asus_acpi_add()
1889 asus_led_exit(asus); in asus_acpi_add()
1891 asus_input_exit(asus); in asus_acpi_add()
1893 asus_backlight_exit(asus); in asus_acpi_add()
1895 asus_platform_exit(asus); in asus_acpi_add()
1897 kfree(asus); in asus_acpi_add()
1904 struct asus_laptop *asus = acpi_driver_data(device); in asus_acpi_remove() local
1906 asus_backlight_exit(asus); in asus_acpi_remove()
1907 asus_rfkill_exit(asus); in asus_acpi_remove()
1908 asus_led_exit(asus); in asus_acpi_remove()
1909 asus_input_exit(asus); in asus_acpi_remove()
1910 pega_accel_exit(asus); in asus_acpi_remove()
1911 asus_platform_exit(asus); in asus_acpi_remove()
1913 kfree(asus->name); in asus_acpi_remove()
1914 kfree(asus); in asus_acpi_remove()