Lines Matching refs:eeepc
213 static int set_acpi(struct eeepc_laptop *eeepc, int cm, int value) in set_acpi() argument
219 if ((eeepc->cm_supported & (0x1 << cm)) == 0) in set_acpi()
222 if (write_acpi_int(eeepc->handle, method, value)) in set_acpi()
227 static int get_acpi(struct eeepc_laptop *eeepc, int cm) in get_acpi() argument
234 if ((eeepc->cm_supported & (0x1 << cm)) == 0) in get_acpi()
237 if (read_acpi_int(eeepc->handle, method, &value)) in get_acpi()
242 static int acpi_setter_handle(struct eeepc_laptop *eeepc, int cm, in acpi_setter_handle() argument
250 if ((eeepc->cm_supported & (0x1 << cm)) == 0) in acpi_setter_handle()
253 status = acpi_get_handle(eeepc->handle, (char *)method, in acpi_setter_handle()
276 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in store_sys_acpi() local
282 rv = set_acpi(eeepc, cm, value); in store_sys_acpi()
290 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in show_sys_acpi() local
291 int value = get_acpi(eeepc, cm); in show_sys_acpi()
332 static int get_cpufv(struct eeepc_laptop *eeepc, struct eeepc_cpufv *c) in get_cpufv() argument
334 c->cur = get_acpi(eeepc, CM_ASL_CPUFV); in get_cpufv()
349 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in available_cpufv_show() local
354 if (get_cpufv(eeepc, &c)) in available_cpufv_show()
366 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_show() local
369 if (get_cpufv(eeepc, &c)) in cpufv_show()
378 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_store() local
382 if (eeepc->cpufv_disabled) in cpufv_store()
384 if (get_cpufv(eeepc, &c)) in cpufv_store()
391 rv = set_acpi(eeepc, CM_ASL_CPUFV, value); in cpufv_store()
401 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_disabled_show() local
403 return sprintf(buf, "%d\n", eeepc->cpufv_disabled); in cpufv_disabled_show()
410 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_disabled_store() local
419 if (eeepc->cpufv_disabled) in cpufv_disabled_store()
421 eeepc->cpufv_disabled = false; in cpufv_disabled_store()
449 static int eeepc_platform_init(struct eeepc_laptop *eeepc) in eeepc_platform_init() argument
453 eeepc->platform_device = platform_device_alloc(EEEPC_LAPTOP_FILE, -1); in eeepc_platform_init()
454 if (!eeepc->platform_device) in eeepc_platform_init()
456 platform_set_drvdata(eeepc->platform_device, eeepc); in eeepc_platform_init()
458 result = platform_device_add(eeepc->platform_device); in eeepc_platform_init()
462 result = sysfs_create_group(&eeepc->platform_device->dev.kobj, in eeepc_platform_init()
469 platform_device_del(eeepc->platform_device); in eeepc_platform_init()
471 platform_device_put(eeepc->platform_device); in eeepc_platform_init()
475 static void eeepc_platform_exit(struct eeepc_laptop *eeepc) in eeepc_platform_exit() argument
477 sysfs_remove_group(&eeepc->platform_device->dev.kobj, in eeepc_platform_exit()
479 platform_device_unregister(eeepc->platform_device); in eeepc_platform_exit()
493 struct eeepc_laptop *eeepc; in tpd_led_update() local
495 eeepc = container_of(work, struct eeepc_laptop, tpd_led_work); in tpd_led_update()
497 set_acpi(eeepc, CM_ASL_TPD, eeepc->tpd_led_wk); in tpd_led_update()
503 struct eeepc_laptop *eeepc; in tpd_led_set() local
505 eeepc = container_of(led_cdev, struct eeepc_laptop, tpd_led); in tpd_led_set()
507 eeepc->tpd_led_wk = (value > 0) ? 1 : 0; in tpd_led_set()
508 queue_work(eeepc->led_workqueue, &eeepc->tpd_led_work); in tpd_led_set()
513 struct eeepc_laptop *eeepc; in tpd_led_get() local
515 eeepc = container_of(led_cdev, struct eeepc_laptop, tpd_led); in tpd_led_get()
517 return get_acpi(eeepc, CM_ASL_TPD); in tpd_led_get()
520 static int eeepc_led_init(struct eeepc_laptop *eeepc) in eeepc_led_init() argument
524 if (get_acpi(eeepc, CM_ASL_TPD) == -ENODEV) in eeepc_led_init()
527 eeepc->led_workqueue = create_singlethread_workqueue("led_workqueue"); in eeepc_led_init()
528 if (!eeepc->led_workqueue) in eeepc_led_init()
530 INIT_WORK(&eeepc->tpd_led_work, tpd_led_update); in eeepc_led_init()
532 eeepc->tpd_led.name = "eeepc::touchpad"; in eeepc_led_init()
533 eeepc->tpd_led.brightness_set = tpd_led_set; in eeepc_led_init()
534 if (get_acpi(eeepc, CM_ASL_TPD) >= 0) /* if method is available */ in eeepc_led_init()
535 eeepc->tpd_led.brightness_get = tpd_led_get; in eeepc_led_init()
536 eeepc->tpd_led.max_brightness = 1; in eeepc_led_init()
538 rv = led_classdev_register(&eeepc->platform_device->dev, in eeepc_led_init()
539 &eeepc->tpd_led); in eeepc_led_init()
541 destroy_workqueue(eeepc->led_workqueue); in eeepc_led_init()
548 static void eeepc_led_exit(struct eeepc_laptop *eeepc) in eeepc_led_exit() argument
550 if (!IS_ERR_OR_NULL(eeepc->tpd_led.dev)) in eeepc_led_exit()
551 led_classdev_unregister(&eeepc->tpd_led); in eeepc_led_exit()
552 if (eeepc->led_workqueue) in eeepc_led_exit()
553 destroy_workqueue(eeepc->led_workqueue); in eeepc_led_exit()
560 static bool eeepc_wlan_rfkill_blocked(struct eeepc_laptop *eeepc) in eeepc_wlan_rfkill_blocked() argument
562 if (get_acpi(eeepc, CM_ASL_WLAN) == 1) in eeepc_wlan_rfkill_blocked()
567 static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle) in eeepc_rfkill_hotplug() argument
572 bool blocked = eeepc_wlan_rfkill_blocked(eeepc); in eeepc_rfkill_hotplug()
576 if (eeepc->wlan_rfkill) in eeepc_rfkill_hotplug()
577 rfkill_set_sw_state(eeepc->wlan_rfkill, blocked); in eeepc_rfkill_hotplug()
579 mutex_lock(&eeepc->hotplug_lock); in eeepc_rfkill_hotplug()
582 if (!eeepc->hotplug_slot) in eeepc_rfkill_hotplug()
637 mutex_unlock(&eeepc->hotplug_lock); in eeepc_rfkill_hotplug()
640 static void eeepc_rfkill_hotplug_update(struct eeepc_laptop *eeepc, char *node) in eeepc_rfkill_hotplug_update() argument
648 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_rfkill_hotplug_update()
653 struct eeepc_laptop *eeepc = data; in eeepc_rfkill_notify() local
658 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_rfkill_notify()
661 static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, in eeepc_register_rfkill_notifier() argument
675 eeepc); in eeepc_register_rfkill_notifier()
683 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_register_rfkill_notifier()
687 static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc, in eeepc_unregister_rfkill_notifier() argument
709 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_unregister_rfkill_notifier()
715 struct eeepc_laptop *eeepc = hotplug_slot->private; in eeepc_get_adapter_status() local
716 int val = get_acpi(eeepc, CM_ASL_WLAN); in eeepc_get_adapter_status()
738 static int eeepc_setup_pci_hotplug(struct eeepc_laptop *eeepc) in eeepc_setup_pci_hotplug() argument
748 eeepc->hotplug_slot = kzalloc(sizeof(struct hotplug_slot), GFP_KERNEL); in eeepc_setup_pci_hotplug()
749 if (!eeepc->hotplug_slot) in eeepc_setup_pci_hotplug()
752 eeepc->hotplug_slot->info = kzalloc(sizeof(struct hotplug_slot_info), in eeepc_setup_pci_hotplug()
754 if (!eeepc->hotplug_slot->info) in eeepc_setup_pci_hotplug()
757 eeepc->hotplug_slot->private = eeepc; in eeepc_setup_pci_hotplug()
758 eeepc->hotplug_slot->release = &eeepc_cleanup_pci_hotplug; in eeepc_setup_pci_hotplug()
759 eeepc->hotplug_slot->ops = &eeepc_hotplug_slot_ops; in eeepc_setup_pci_hotplug()
760 eeepc_get_adapter_status(eeepc->hotplug_slot, in eeepc_setup_pci_hotplug()
761 &eeepc->hotplug_slot->info->adapter_status); in eeepc_setup_pci_hotplug()
763 ret = pci_hp_register(eeepc->hotplug_slot, bus, 0, "eeepc-wifi"); in eeepc_setup_pci_hotplug()
772 kfree(eeepc->hotplug_slot->info); in eeepc_setup_pci_hotplug()
774 kfree(eeepc->hotplug_slot); in eeepc_setup_pci_hotplug()
775 eeepc->hotplug_slot = NULL; in eeepc_setup_pci_hotplug()
794 static int eeepc_new_rfkill(struct eeepc_laptop *eeepc, in eeepc_new_rfkill() argument
802 result = acpi_setter_handle(eeepc, cm, &handle); in eeepc_new_rfkill()
806 *rfkill = rfkill_alloc(name, &eeepc->platform_device->dev, type, in eeepc_new_rfkill()
812 rfkill_init_sw_state(*rfkill, get_acpi(eeepc, cm) != 1); in eeepc_new_rfkill()
826 static void eeepc_rfkill_exit(struct eeepc_laptop *eeepc) in eeepc_rfkill_exit() argument
828 eeepc_unregister_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_1); in eeepc_rfkill_exit()
829 eeepc_unregister_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_2); in eeepc_rfkill_exit()
830 eeepc_unregister_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_3); in eeepc_rfkill_exit()
831 if (eeepc->wlan_rfkill) { in eeepc_rfkill_exit()
832 rfkill_unregister(eeepc->wlan_rfkill); in eeepc_rfkill_exit()
833 rfkill_destroy(eeepc->wlan_rfkill); in eeepc_rfkill_exit()
834 eeepc->wlan_rfkill = NULL; in eeepc_rfkill_exit()
837 if (eeepc->hotplug_slot) in eeepc_rfkill_exit()
838 pci_hp_deregister(eeepc->hotplug_slot); in eeepc_rfkill_exit()
840 if (eeepc->bluetooth_rfkill) { in eeepc_rfkill_exit()
841 rfkill_unregister(eeepc->bluetooth_rfkill); in eeepc_rfkill_exit()
842 rfkill_destroy(eeepc->bluetooth_rfkill); in eeepc_rfkill_exit()
843 eeepc->bluetooth_rfkill = NULL; in eeepc_rfkill_exit()
845 if (eeepc->wwan3g_rfkill) { in eeepc_rfkill_exit()
846 rfkill_unregister(eeepc->wwan3g_rfkill); in eeepc_rfkill_exit()
847 rfkill_destroy(eeepc->wwan3g_rfkill); in eeepc_rfkill_exit()
848 eeepc->wwan3g_rfkill = NULL; in eeepc_rfkill_exit()
850 if (eeepc->wimax_rfkill) { in eeepc_rfkill_exit()
851 rfkill_unregister(eeepc->wimax_rfkill); in eeepc_rfkill_exit()
852 rfkill_destroy(eeepc->wimax_rfkill); in eeepc_rfkill_exit()
853 eeepc->wimax_rfkill = NULL; in eeepc_rfkill_exit()
857 static int eeepc_rfkill_init(struct eeepc_laptop *eeepc) in eeepc_rfkill_init() argument
861 mutex_init(&eeepc->hotplug_lock); in eeepc_rfkill_init()
863 result = eeepc_new_rfkill(eeepc, &eeepc->wlan_rfkill, in eeepc_rfkill_init()
870 result = eeepc_new_rfkill(eeepc, &eeepc->bluetooth_rfkill, in eeepc_rfkill_init()
877 result = eeepc_new_rfkill(eeepc, &eeepc->wwan3g_rfkill, in eeepc_rfkill_init()
884 result = eeepc_new_rfkill(eeepc, &eeepc->wimax_rfkill, in eeepc_rfkill_init()
891 if (eeepc->hotplug_disabled) in eeepc_rfkill_init()
894 result = eeepc_setup_pci_hotplug(eeepc); in eeepc_rfkill_init()
902 eeepc_register_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_1); in eeepc_rfkill_init()
903 eeepc_register_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_2); in eeepc_rfkill_init()
904 eeepc_register_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_3); in eeepc_rfkill_init()
908 eeepc_rfkill_exit(eeepc); in eeepc_rfkill_init()
917 struct eeepc_laptop *eeepc = dev_get_drvdata(device); in eeepc_hotk_thaw() local
919 if (eeepc->wlan_rfkill) { in eeepc_hotk_thaw()
927 wlan = get_acpi(eeepc, CM_ASL_WLAN); in eeepc_hotk_thaw()
929 set_acpi(eeepc, CM_ASL_WLAN, wlan); in eeepc_hotk_thaw()
937 struct eeepc_laptop *eeepc = dev_get_drvdata(device); in eeepc_hotk_restore() local
940 if (eeepc->wlan_rfkill) { in eeepc_hotk_restore()
941 eeepc_rfkill_hotplug_update(eeepc, EEEPC_RFKILL_NODE_1); in eeepc_hotk_restore()
942 eeepc_rfkill_hotplug_update(eeepc, EEEPC_RFKILL_NODE_2); in eeepc_hotk_restore()
943 eeepc_rfkill_hotplug_update(eeepc, EEEPC_RFKILL_NODE_3); in eeepc_hotk_restore()
946 if (eeepc->bluetooth_rfkill) in eeepc_hotk_restore()
947 rfkill_set_sw_state(eeepc->bluetooth_rfkill, in eeepc_hotk_restore()
948 get_acpi(eeepc, CM_ASL_BLUETOOTH) != 1); in eeepc_hotk_restore()
949 if (eeepc->wwan3g_rfkill) in eeepc_hotk_restore()
950 rfkill_set_sw_state(eeepc->wwan3g_rfkill, in eeepc_hotk_restore()
951 get_acpi(eeepc, CM_ASL_3G) != 1); in eeepc_hotk_restore()
952 if (eeepc->wimax_rfkill) in eeepc_hotk_restore()
953 rfkill_set_sw_state(eeepc->wimax_rfkill, in eeepc_hotk_restore()
954 get_acpi(eeepc, CM_ASL_WIMAX) != 1); in eeepc_hotk_restore()
1100 static int eeepc_hwmon_init(struct eeepc_laptop *eeepc) in eeepc_hwmon_init() argument
1102 struct device *dev = &eeepc->platform_device->dev; in eeepc_hwmon_init()
1119 struct eeepc_laptop *eeepc = bl_get_data(bd); in read_brightness() local
1121 return get_acpi(eeepc, CM_ASL_PANELBRIGHT); in read_brightness()
1126 struct eeepc_laptop *eeepc = bl_get_data(bd); in set_brightness() local
1128 return set_acpi(eeepc, CM_ASL_PANELBRIGHT, value); in set_brightness()
1141 static int eeepc_backlight_notify(struct eeepc_laptop *eeepc) in eeepc_backlight_notify() argument
1143 struct backlight_device *bd = eeepc->backlight_device; in eeepc_backlight_notify()
1151 static int eeepc_backlight_init(struct eeepc_laptop *eeepc) in eeepc_backlight_init() argument
1160 &eeepc->platform_device->dev, eeepc, in eeepc_backlight_init()
1164 eeepc->backlight_device = NULL; in eeepc_backlight_init()
1167 eeepc->backlight_device = bd; in eeepc_backlight_init()
1174 static void eeepc_backlight_exit(struct eeepc_laptop *eeepc) in eeepc_backlight_exit() argument
1176 backlight_device_unregister(eeepc->backlight_device); in eeepc_backlight_exit()
1177 eeepc->backlight_device = NULL; in eeepc_backlight_exit()
1184 static int eeepc_input_init(struct eeepc_laptop *eeepc) in eeepc_input_init() argument
1196 input->dev.parent = &eeepc->platform_device->dev; in eeepc_input_init()
1210 eeepc->inputdev = input; in eeepc_input_init()
1220 static void eeepc_input_exit(struct eeepc_laptop *eeepc) in eeepc_input_exit() argument
1222 if (eeepc->inputdev) { in eeepc_input_exit()
1223 sparse_keymap_free(eeepc->inputdev); in eeepc_input_exit()
1224 input_unregister_device(eeepc->inputdev); in eeepc_input_exit()
1226 eeepc->inputdev = NULL; in eeepc_input_exit()
1232 static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) in eeepc_input_notify() argument
1234 if (!eeepc->inputdev) in eeepc_input_notify()
1236 if (!sparse_keymap_report_event(eeepc->inputdev, event, 1, true)) in eeepc_input_notify()
1242 struct eeepc_laptop *eeepc = acpi_driver_data(device); in eeepc_acpi_notify() local
1248 count = eeepc->event_count[event % 128]++; in eeepc_acpi_notify()
1255 eeepc_input_notify(eeepc, event); in eeepc_acpi_notify()
1260 if (!eeepc->backlight_device) in eeepc_acpi_notify()
1264 old_brightness = eeepc_backlight_notify(eeepc); in eeepc_acpi_notify()
1279 eeepc_input_notify(eeepc, event); in eeepc_acpi_notify()
1282 static void eeepc_dmi_check(struct eeepc_laptop *eeepc) in eeepc_dmi_check() argument
1310 eeepc->cpufv_disabled = true; in eeepc_dmi_check()
1325 eeepc->hotplug_disabled = true; in eeepc_dmi_check()
1330 static void cmsg_quirk(struct eeepc_laptop *eeepc, int cm, const char *name) in cmsg_quirk() argument
1336 if (!(eeepc->cm_supported & (1 << cm)) in cmsg_quirk()
1337 && !read_acpi_int(eeepc->handle, cm_getv[cm], &dummy)) { in cmsg_quirk()
1340 eeepc->cm_supported |= 1 << cm; in cmsg_quirk()
1344 static void cmsg_quirks(struct eeepc_laptop *eeepc) in cmsg_quirks() argument
1346 cmsg_quirk(eeepc, CM_ASL_LID, "LID"); in cmsg_quirks()
1347 cmsg_quirk(eeepc, CM_ASL_TYPE, "TYPE"); in cmsg_quirks()
1348 cmsg_quirk(eeepc, CM_ASL_PANELPOWER, "PANELPOWER"); in cmsg_quirks()
1349 cmsg_quirk(eeepc, CM_ASL_TPD, "TPD"); in cmsg_quirks()
1352 static int eeepc_acpi_init(struct eeepc_laptop *eeepc) in eeepc_acpi_init() argument
1357 result = acpi_bus_get_status(eeepc->device); in eeepc_acpi_init()
1360 if (!eeepc->device->status.present) { in eeepc_acpi_init()
1368 if (write_acpi_int(eeepc->handle, "INIT", init_flags)) { in eeepc_acpi_init()
1374 if (read_acpi_int(eeepc->handle, "CMSG", &eeepc->cm_supported)) { in eeepc_acpi_init()
1378 cmsg_quirks(eeepc); in eeepc_acpi_init()
1379 pr_info("Get control methods supported: 0x%x\n", eeepc->cm_supported); in eeepc_acpi_init()
1384 static void eeepc_enable_camera(struct eeepc_laptop *eeepc) in eeepc_enable_camera() argument
1390 if (get_acpi(eeepc, CM_ASL_CAMERA) == 0) in eeepc_enable_camera()
1391 set_acpi(eeepc, CM_ASL_CAMERA, 1); in eeepc_enable_camera()
1398 struct eeepc_laptop *eeepc; in eeepc_acpi_add() local
1402 eeepc = kzalloc(sizeof(struct eeepc_laptop), GFP_KERNEL); in eeepc_acpi_add()
1403 if (!eeepc) in eeepc_acpi_add()
1405 eeepc->handle = device->handle; in eeepc_acpi_add()
1408 device->driver_data = eeepc; in eeepc_acpi_add()
1409 eeepc->device = device; in eeepc_acpi_add()
1411 eeepc->hotplug_disabled = hotplug_disabled; in eeepc_acpi_add()
1413 eeepc_dmi_check(eeepc); in eeepc_acpi_add()
1415 result = eeepc_acpi_init(eeepc); in eeepc_acpi_add()
1418 eeepc_enable_camera(eeepc); in eeepc_acpi_add()
1432 result = eeepc_platform_init(eeepc); in eeepc_acpi_add()
1437 result = eeepc_backlight_init(eeepc); in eeepc_acpi_add()
1444 result = eeepc_input_init(eeepc); in eeepc_acpi_add()
1448 result = eeepc_hwmon_init(eeepc); in eeepc_acpi_add()
1452 result = eeepc_led_init(eeepc); in eeepc_acpi_add()
1456 result = eeepc_rfkill_init(eeepc); in eeepc_acpi_add()
1464 eeepc_led_exit(eeepc); in eeepc_acpi_add()
1467 eeepc_input_exit(eeepc); in eeepc_acpi_add()
1469 eeepc_backlight_exit(eeepc); in eeepc_acpi_add()
1471 eeepc_platform_exit(eeepc); in eeepc_acpi_add()
1473 kfree(eeepc); in eeepc_acpi_add()
1480 struct eeepc_laptop *eeepc = acpi_driver_data(device); in eeepc_acpi_remove() local
1482 eeepc_backlight_exit(eeepc); in eeepc_acpi_remove()
1483 eeepc_rfkill_exit(eeepc); in eeepc_acpi_remove()
1484 eeepc_input_exit(eeepc); in eeepc_acpi_remove()
1485 eeepc_led_exit(eeepc); in eeepc_acpi_remove()
1486 eeepc_platform_exit(eeepc); in eeepc_acpi_remove()
1488 kfree(eeepc); in eeepc_acpi_remove()