Lines Matching refs:eeepc
214 static int set_acpi(struct eeepc_laptop *eeepc, int cm, int value) in set_acpi() argument
220 if ((eeepc->cm_supported & (0x1 << cm)) == 0) in set_acpi()
223 if (write_acpi_int(eeepc->handle, method, value)) in set_acpi()
228 static int get_acpi(struct eeepc_laptop *eeepc, int cm) in get_acpi() argument
235 if ((eeepc->cm_supported & (0x1 << cm)) == 0) in get_acpi()
238 if (read_acpi_int(eeepc->handle, method, &value)) in get_acpi()
243 static int acpi_setter_handle(struct eeepc_laptop *eeepc, int cm, in acpi_setter_handle() argument
251 if ((eeepc->cm_supported & (0x1 << cm)) == 0) in acpi_setter_handle()
254 status = acpi_get_handle(eeepc->handle, (char *)method, in acpi_setter_handle()
277 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in store_sys_acpi() local
283 rv = set_acpi(eeepc, cm, value); in store_sys_acpi()
291 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in show_sys_acpi() local
292 int value = get_acpi(eeepc, cm); in show_sys_acpi()
333 static int get_cpufv(struct eeepc_laptop *eeepc, struct eeepc_cpufv *c) in get_cpufv() argument
335 c->cur = get_acpi(eeepc, CM_ASL_CPUFV); in get_cpufv()
350 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in available_cpufv_show() local
355 if (get_cpufv(eeepc, &c)) in available_cpufv_show()
367 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_show() local
370 if (get_cpufv(eeepc, &c)) in cpufv_show()
379 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_store() local
383 if (eeepc->cpufv_disabled) in cpufv_store()
385 if (get_cpufv(eeepc, &c)) in cpufv_store()
392 rv = set_acpi(eeepc, CM_ASL_CPUFV, value); in cpufv_store()
402 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_disabled_show() local
404 return sprintf(buf, "%d\n", eeepc->cpufv_disabled); in cpufv_disabled_show()
411 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_disabled_store() local
420 if (eeepc->cpufv_disabled) in cpufv_disabled_store()
422 eeepc->cpufv_disabled = false; in cpufv_disabled_store()
450 static int eeepc_platform_init(struct eeepc_laptop *eeepc) in eeepc_platform_init() argument
454 eeepc->platform_device = platform_device_alloc(EEEPC_LAPTOP_FILE, -1); in eeepc_platform_init()
455 if (!eeepc->platform_device) in eeepc_platform_init()
457 platform_set_drvdata(eeepc->platform_device, eeepc); in eeepc_platform_init()
459 result = platform_device_add(eeepc->platform_device); in eeepc_platform_init()
463 result = sysfs_create_group(&eeepc->platform_device->dev.kobj, in eeepc_platform_init()
470 platform_device_del(eeepc->platform_device); in eeepc_platform_init()
472 platform_device_put(eeepc->platform_device); in eeepc_platform_init()
476 static void eeepc_platform_exit(struct eeepc_laptop *eeepc) in eeepc_platform_exit() argument
478 sysfs_remove_group(&eeepc->platform_device->dev.kobj, in eeepc_platform_exit()
480 platform_device_unregister(eeepc->platform_device); in eeepc_platform_exit()
494 struct eeepc_laptop *eeepc; in tpd_led_update() local
496 eeepc = container_of(work, struct eeepc_laptop, tpd_led_work); in tpd_led_update()
498 set_acpi(eeepc, CM_ASL_TPD, eeepc->tpd_led_wk); in tpd_led_update()
504 struct eeepc_laptop *eeepc; in tpd_led_set() local
506 eeepc = container_of(led_cdev, struct eeepc_laptop, tpd_led); in tpd_led_set()
508 eeepc->tpd_led_wk = (value > 0) ? 1 : 0; in tpd_led_set()
509 queue_work(eeepc->led_workqueue, &eeepc->tpd_led_work); in tpd_led_set()
514 struct eeepc_laptop *eeepc; in tpd_led_get() local
516 eeepc = container_of(led_cdev, struct eeepc_laptop, tpd_led); in tpd_led_get()
518 return get_acpi(eeepc, CM_ASL_TPD); in tpd_led_get()
521 static int eeepc_led_init(struct eeepc_laptop *eeepc) in eeepc_led_init() argument
525 if (get_acpi(eeepc, CM_ASL_TPD) == -ENODEV) in eeepc_led_init()
528 eeepc->led_workqueue = create_singlethread_workqueue("led_workqueue"); in eeepc_led_init()
529 if (!eeepc->led_workqueue) in eeepc_led_init()
531 INIT_WORK(&eeepc->tpd_led_work, tpd_led_update); in eeepc_led_init()
533 eeepc->tpd_led.name = "eeepc::touchpad"; in eeepc_led_init()
534 eeepc->tpd_led.brightness_set = tpd_led_set; in eeepc_led_init()
535 if (get_acpi(eeepc, CM_ASL_TPD) >= 0) /* if method is available */ in eeepc_led_init()
536 eeepc->tpd_led.brightness_get = tpd_led_get; in eeepc_led_init()
537 eeepc->tpd_led.max_brightness = 1; in eeepc_led_init()
539 rv = led_classdev_register(&eeepc->platform_device->dev, in eeepc_led_init()
540 &eeepc->tpd_led); in eeepc_led_init()
542 destroy_workqueue(eeepc->led_workqueue); in eeepc_led_init()
549 static void eeepc_led_exit(struct eeepc_laptop *eeepc) in eeepc_led_exit() argument
551 if (!IS_ERR_OR_NULL(eeepc->tpd_led.dev)) in eeepc_led_exit()
552 led_classdev_unregister(&eeepc->tpd_led); in eeepc_led_exit()
553 if (eeepc->led_workqueue) in eeepc_led_exit()
554 destroy_workqueue(eeepc->led_workqueue); in eeepc_led_exit()
561 static bool eeepc_wlan_rfkill_blocked(struct eeepc_laptop *eeepc) in eeepc_wlan_rfkill_blocked() argument
563 if (get_acpi(eeepc, CM_ASL_WLAN) == 1) in eeepc_wlan_rfkill_blocked()
568 static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle) in eeepc_rfkill_hotplug() argument
573 bool blocked = eeepc_wlan_rfkill_blocked(eeepc); in eeepc_rfkill_hotplug()
577 if (eeepc->wlan_rfkill) in eeepc_rfkill_hotplug()
578 rfkill_set_sw_state(eeepc->wlan_rfkill, blocked); in eeepc_rfkill_hotplug()
580 mutex_lock(&eeepc->hotplug_lock); in eeepc_rfkill_hotplug()
583 if (!eeepc->hotplug_slot) in eeepc_rfkill_hotplug()
638 mutex_unlock(&eeepc->hotplug_lock); in eeepc_rfkill_hotplug()
641 static void eeepc_rfkill_hotplug_update(struct eeepc_laptop *eeepc, char *node) in eeepc_rfkill_hotplug_update() argument
649 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_rfkill_hotplug_update()
654 struct eeepc_laptop *eeepc = data; in eeepc_rfkill_notify() local
659 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_rfkill_notify()
662 static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, in eeepc_register_rfkill_notifier() argument
676 eeepc); in eeepc_register_rfkill_notifier()
684 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_register_rfkill_notifier()
688 static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc, in eeepc_unregister_rfkill_notifier() argument
710 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_unregister_rfkill_notifier()
716 struct eeepc_laptop *eeepc = hotplug_slot->private; in eeepc_get_adapter_status() local
717 int val = get_acpi(eeepc, CM_ASL_WLAN); in eeepc_get_adapter_status()
739 static int eeepc_setup_pci_hotplug(struct eeepc_laptop *eeepc) in eeepc_setup_pci_hotplug() argument
749 eeepc->hotplug_slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL); in eeepc_setup_pci_hotplug()
750 if (!eeepc->hotplug_slot) in eeepc_setup_pci_hotplug()
753 eeepc->hotplug_slot->info = kzalloc(sizeof(struct hotplug_slot_info), in eeepc_setup_pci_hotplug()
755 if (!eeepc->hotplug_slot->info) in eeepc_setup_pci_hotplug()
758 eeepc->hotplug_slot->private = eeepc; in eeepc_setup_pci_hotplug()
759 eeepc->hotplug_slot->release = &eeepc_cleanup_pci_hotplug; in eeepc_setup_pci_hotplug()
760 eeepc->hotplug_slot->ops = &eeepc_hotplug_slot_ops; in eeepc_setup_pci_hotplug()
761 eeepc_get_adapter_status(eeepc->hotplug_slot, in eeepc_setup_pci_hotplug()
762 &eeepc->hotplug_slot->info->adapter_status); in eeepc_setup_pci_hotplug()
764 ret = pci_hp_register(eeepc->hotplug_slot, bus, 0, "eeepc-wifi"); in eeepc_setup_pci_hotplug()
773 kfree(eeepc->hotplug_slot->info); in eeepc_setup_pci_hotplug()
775 kfree(eeepc->hotplug_slot); in eeepc_setup_pci_hotplug()
776 eeepc->hotplug_slot = NULL; in eeepc_setup_pci_hotplug()
795 static int eeepc_new_rfkill(struct eeepc_laptop *eeepc, in eeepc_new_rfkill() argument
803 result = acpi_setter_handle(eeepc, cm, &handle); in eeepc_new_rfkill()
807 *rfkill = rfkill_alloc(name, &eeepc->platform_device->dev, type, in eeepc_new_rfkill()
813 rfkill_init_sw_state(*rfkill, get_acpi(eeepc, cm) != 1); in eeepc_new_rfkill()
827 static void eeepc_rfkill_exit(struct eeepc_laptop *eeepc) in eeepc_rfkill_exit() argument
829 eeepc_unregister_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_1); in eeepc_rfkill_exit()
830 eeepc_unregister_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_2); in eeepc_rfkill_exit()
831 eeepc_unregister_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_3); in eeepc_rfkill_exit()
832 if (eeepc->wlan_rfkill) { in eeepc_rfkill_exit()
833 rfkill_unregister(eeepc->wlan_rfkill); in eeepc_rfkill_exit()
834 rfkill_destroy(eeepc->wlan_rfkill); in eeepc_rfkill_exit()
835 eeepc->wlan_rfkill = NULL; in eeepc_rfkill_exit()
838 if (eeepc->hotplug_slot) in eeepc_rfkill_exit()
839 pci_hp_deregister(eeepc->hotplug_slot); in eeepc_rfkill_exit()
841 if (eeepc->bluetooth_rfkill) { in eeepc_rfkill_exit()
842 rfkill_unregister(eeepc->bluetooth_rfkill); in eeepc_rfkill_exit()
843 rfkill_destroy(eeepc->bluetooth_rfkill); in eeepc_rfkill_exit()
844 eeepc->bluetooth_rfkill = NULL; in eeepc_rfkill_exit()
846 if (eeepc->wwan3g_rfkill) { in eeepc_rfkill_exit()
847 rfkill_unregister(eeepc->wwan3g_rfkill); in eeepc_rfkill_exit()
848 rfkill_destroy(eeepc->wwan3g_rfkill); in eeepc_rfkill_exit()
849 eeepc->wwan3g_rfkill = NULL; in eeepc_rfkill_exit()
851 if (eeepc->wimax_rfkill) { in eeepc_rfkill_exit()
852 rfkill_unregister(eeepc->wimax_rfkill); in eeepc_rfkill_exit()
853 rfkill_destroy(eeepc->wimax_rfkill); in eeepc_rfkill_exit()
854 eeepc->wimax_rfkill = NULL; in eeepc_rfkill_exit()
858 static int eeepc_rfkill_init(struct eeepc_laptop *eeepc) in eeepc_rfkill_init() argument
862 mutex_init(&eeepc->hotplug_lock); in eeepc_rfkill_init()
864 result = eeepc_new_rfkill(eeepc, &eeepc->wlan_rfkill, in eeepc_rfkill_init()
871 result = eeepc_new_rfkill(eeepc, &eeepc->bluetooth_rfkill, in eeepc_rfkill_init()
878 result = eeepc_new_rfkill(eeepc, &eeepc->wwan3g_rfkill, in eeepc_rfkill_init()
885 result = eeepc_new_rfkill(eeepc, &eeepc->wimax_rfkill, in eeepc_rfkill_init()
892 if (eeepc->hotplug_disabled) in eeepc_rfkill_init()
895 result = eeepc_setup_pci_hotplug(eeepc); in eeepc_rfkill_init()
903 eeepc_register_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_1); in eeepc_rfkill_init()
904 eeepc_register_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_2); in eeepc_rfkill_init()
905 eeepc_register_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_3); in eeepc_rfkill_init()
909 eeepc_rfkill_exit(eeepc); in eeepc_rfkill_init()
918 struct eeepc_laptop *eeepc = dev_get_drvdata(device); in eeepc_hotk_thaw() local
920 if (eeepc->wlan_rfkill) { in eeepc_hotk_thaw()
928 wlan = get_acpi(eeepc, CM_ASL_WLAN); in eeepc_hotk_thaw()
930 set_acpi(eeepc, CM_ASL_WLAN, wlan); in eeepc_hotk_thaw()
938 struct eeepc_laptop *eeepc = dev_get_drvdata(device); in eeepc_hotk_restore() local
941 if (eeepc->wlan_rfkill) { in eeepc_hotk_restore()
942 eeepc_rfkill_hotplug_update(eeepc, EEEPC_RFKILL_NODE_1); in eeepc_hotk_restore()
943 eeepc_rfkill_hotplug_update(eeepc, EEEPC_RFKILL_NODE_2); in eeepc_hotk_restore()
944 eeepc_rfkill_hotplug_update(eeepc, EEEPC_RFKILL_NODE_3); in eeepc_hotk_restore()
947 if (eeepc->bluetooth_rfkill) in eeepc_hotk_restore()
948 rfkill_set_sw_state(eeepc->bluetooth_rfkill, in eeepc_hotk_restore()
949 get_acpi(eeepc, CM_ASL_BLUETOOTH) != 1); in eeepc_hotk_restore()
950 if (eeepc->wwan3g_rfkill) in eeepc_hotk_restore()
951 rfkill_set_sw_state(eeepc->wwan3g_rfkill, in eeepc_hotk_restore()
952 get_acpi(eeepc, CM_ASL_3G) != 1); in eeepc_hotk_restore()
953 if (eeepc->wimax_rfkill) in eeepc_hotk_restore()
954 rfkill_set_sw_state(eeepc->wimax_rfkill, in eeepc_hotk_restore()
955 get_acpi(eeepc, CM_ASL_WIMAX) != 1); in eeepc_hotk_restore()
1101 static int eeepc_hwmon_init(struct eeepc_laptop *eeepc) in eeepc_hwmon_init() argument
1103 struct device *dev = &eeepc->platform_device->dev; in eeepc_hwmon_init()
1120 struct eeepc_laptop *eeepc = bl_get_data(bd); in read_brightness() local
1122 return get_acpi(eeepc, CM_ASL_PANELBRIGHT); in read_brightness()
1127 struct eeepc_laptop *eeepc = bl_get_data(bd); in set_brightness() local
1129 return set_acpi(eeepc, CM_ASL_PANELBRIGHT, value); in set_brightness()
1142 static int eeepc_backlight_notify(struct eeepc_laptop *eeepc) in eeepc_backlight_notify() argument
1144 struct backlight_device *bd = eeepc->backlight_device; in eeepc_backlight_notify()
1152 static int eeepc_backlight_init(struct eeepc_laptop *eeepc) in eeepc_backlight_init() argument
1161 &eeepc->platform_device->dev, eeepc, in eeepc_backlight_init()
1165 eeepc->backlight_device = NULL; in eeepc_backlight_init()
1168 eeepc->backlight_device = bd; in eeepc_backlight_init()
1175 static void eeepc_backlight_exit(struct eeepc_laptop *eeepc) in eeepc_backlight_exit() argument
1177 backlight_device_unregister(eeepc->backlight_device); in eeepc_backlight_exit()
1178 eeepc->backlight_device = NULL; in eeepc_backlight_exit()
1185 static int eeepc_input_init(struct eeepc_laptop *eeepc) in eeepc_input_init() argument
1197 input->dev.parent = &eeepc->platform_device->dev; in eeepc_input_init()
1211 eeepc->inputdev = input; in eeepc_input_init()
1221 static void eeepc_input_exit(struct eeepc_laptop *eeepc) in eeepc_input_exit() argument
1223 if (eeepc->inputdev) { in eeepc_input_exit()
1224 sparse_keymap_free(eeepc->inputdev); in eeepc_input_exit()
1225 input_unregister_device(eeepc->inputdev); in eeepc_input_exit()
1227 eeepc->inputdev = NULL; in eeepc_input_exit()
1233 static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) in eeepc_input_notify() argument
1235 if (!eeepc->inputdev) in eeepc_input_notify()
1237 if (!sparse_keymap_report_event(eeepc->inputdev, event, 1, true)) in eeepc_input_notify()
1243 struct eeepc_laptop *eeepc = acpi_driver_data(device); in eeepc_acpi_notify() local
1249 count = eeepc->event_count[event % 128]++; in eeepc_acpi_notify()
1256 eeepc_input_notify(eeepc, event); in eeepc_acpi_notify()
1261 if (!eeepc->backlight_device) in eeepc_acpi_notify()
1265 old_brightness = eeepc_backlight_notify(eeepc); in eeepc_acpi_notify()
1280 eeepc_input_notify(eeepc, event); in eeepc_acpi_notify()
1283 static void eeepc_dmi_check(struct eeepc_laptop *eeepc) in eeepc_dmi_check() argument
1311 eeepc->cpufv_disabled = true; in eeepc_dmi_check()
1326 eeepc->hotplug_disabled = true; in eeepc_dmi_check()
1331 static void cmsg_quirk(struct eeepc_laptop *eeepc, int cm, const char *name) in cmsg_quirk() argument
1337 if (!(eeepc->cm_supported & (1 << cm)) in cmsg_quirk()
1338 && !read_acpi_int(eeepc->handle, cm_getv[cm], &dummy)) { in cmsg_quirk()
1341 eeepc->cm_supported |= 1 << cm; in cmsg_quirk()
1345 static void cmsg_quirks(struct eeepc_laptop *eeepc) in cmsg_quirks() argument
1347 cmsg_quirk(eeepc, CM_ASL_LID, "LID"); in cmsg_quirks()
1348 cmsg_quirk(eeepc, CM_ASL_TYPE, "TYPE"); in cmsg_quirks()
1349 cmsg_quirk(eeepc, CM_ASL_PANELPOWER, "PANELPOWER"); in cmsg_quirks()
1350 cmsg_quirk(eeepc, CM_ASL_TPD, "TPD"); in cmsg_quirks()
1353 static int eeepc_acpi_init(struct eeepc_laptop *eeepc) in eeepc_acpi_init() argument
1358 result = acpi_bus_get_status(eeepc->device); in eeepc_acpi_init()
1361 if (!eeepc->device->status.present) { in eeepc_acpi_init()
1369 if (write_acpi_int(eeepc->handle, "INIT", init_flags)) { in eeepc_acpi_init()
1375 if (read_acpi_int(eeepc->handle, "CMSG", &eeepc->cm_supported)) { in eeepc_acpi_init()
1379 cmsg_quirks(eeepc); in eeepc_acpi_init()
1380 pr_info("Get control methods supported: 0x%x\n", eeepc->cm_supported); in eeepc_acpi_init()
1385 static void eeepc_enable_camera(struct eeepc_laptop *eeepc) in eeepc_enable_camera() argument
1391 if (get_acpi(eeepc, CM_ASL_CAMERA) == 0) in eeepc_enable_camera()
1392 set_acpi(eeepc, CM_ASL_CAMERA, 1); in eeepc_enable_camera()
1399 struct eeepc_laptop *eeepc; in eeepc_acpi_add() local
1403 eeepc = kzalloc(sizeof(struct eeepc_laptop), GFP_KERNEL); in eeepc_acpi_add()
1404 if (!eeepc) in eeepc_acpi_add()
1406 eeepc->handle = device->handle; in eeepc_acpi_add()
1409 device->driver_data = eeepc; in eeepc_acpi_add()
1410 eeepc->device = device; in eeepc_acpi_add()
1412 eeepc->hotplug_disabled = hotplug_disabled; in eeepc_acpi_add()
1414 eeepc_dmi_check(eeepc); in eeepc_acpi_add()
1416 result = eeepc_acpi_init(eeepc); in eeepc_acpi_add()
1419 eeepc_enable_camera(eeepc); in eeepc_acpi_add()
1433 result = eeepc_platform_init(eeepc); in eeepc_acpi_add()
1438 result = eeepc_backlight_init(eeepc); in eeepc_acpi_add()
1443 result = eeepc_input_init(eeepc); in eeepc_acpi_add()
1447 result = eeepc_hwmon_init(eeepc); in eeepc_acpi_add()
1451 result = eeepc_led_init(eeepc); in eeepc_acpi_add()
1455 result = eeepc_rfkill_init(eeepc); in eeepc_acpi_add()
1463 eeepc_led_exit(eeepc); in eeepc_acpi_add()
1466 eeepc_input_exit(eeepc); in eeepc_acpi_add()
1468 eeepc_backlight_exit(eeepc); in eeepc_acpi_add()
1470 eeepc_platform_exit(eeepc); in eeepc_acpi_add()
1472 kfree(eeepc); in eeepc_acpi_add()
1479 struct eeepc_laptop *eeepc = acpi_driver_data(device); in eeepc_acpi_remove() local
1481 eeepc_backlight_exit(eeepc); in eeepc_acpi_remove()
1482 eeepc_rfkill_exit(eeepc); in eeepc_acpi_remove()
1483 eeepc_input_exit(eeepc); in eeepc_acpi_remove()
1484 eeepc_led_exit(eeepc); in eeepc_acpi_remove()
1485 eeepc_platform_exit(eeepc); in eeepc_acpi_remove()
1487 kfree(eeepc); in eeepc_acpi_remove()