Lines Matching refs:eeepc
207 static int set_acpi(struct eeepc_laptop *eeepc, int cm, int value) in set_acpi() argument
213 if ((eeepc->cm_supported & (0x1 << cm)) == 0) in set_acpi()
216 if (write_acpi_int(eeepc->handle, method, value)) in set_acpi()
221 static int get_acpi(struct eeepc_laptop *eeepc, int cm) in get_acpi() argument
228 if ((eeepc->cm_supported & (0x1 << cm)) == 0) in get_acpi()
231 if (read_acpi_int(eeepc->handle, method, &value)) in get_acpi()
236 static int acpi_setter_handle(struct eeepc_laptop *eeepc, int cm, in acpi_setter_handle() argument
244 if ((eeepc->cm_supported & (0x1 << cm)) == 0) in acpi_setter_handle()
247 status = acpi_get_handle(eeepc->handle, (char *)method, in acpi_setter_handle()
270 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in store_sys_acpi() local
276 rv = set_acpi(eeepc, cm, value); in store_sys_acpi()
284 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in show_sys_acpi() local
285 int value = get_acpi(eeepc, cm); in show_sys_acpi()
326 static int get_cpufv(struct eeepc_laptop *eeepc, struct eeepc_cpufv *c) in get_cpufv() argument
328 c->cur = get_acpi(eeepc, CM_ASL_CPUFV); in get_cpufv()
343 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in available_cpufv_show() local
348 if (get_cpufv(eeepc, &c)) in available_cpufv_show()
360 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_show() local
363 if (get_cpufv(eeepc, &c)) in cpufv_show()
372 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_store() local
376 if (eeepc->cpufv_disabled) in cpufv_store()
378 if (get_cpufv(eeepc, &c)) in cpufv_store()
385 rv = set_acpi(eeepc, CM_ASL_CPUFV, value); in cpufv_store()
395 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_disabled_show() local
397 return sprintf(buf, "%d\n", eeepc->cpufv_disabled); in cpufv_disabled_show()
404 struct eeepc_laptop *eeepc = dev_get_drvdata(dev); in cpufv_disabled_store() local
413 if (eeepc->cpufv_disabled) in cpufv_disabled_store()
415 eeepc->cpufv_disabled = false; in cpufv_disabled_store()
443 static int eeepc_platform_init(struct eeepc_laptop *eeepc) in eeepc_platform_init() argument
447 eeepc->platform_device = platform_device_alloc(EEEPC_LAPTOP_FILE, PLATFORM_DEVID_NONE); in eeepc_platform_init()
448 if (!eeepc->platform_device) in eeepc_platform_init()
450 platform_set_drvdata(eeepc->platform_device, eeepc); in eeepc_platform_init()
452 result = platform_device_add(eeepc->platform_device); in eeepc_platform_init()
456 result = sysfs_create_group(&eeepc->platform_device->dev.kobj, in eeepc_platform_init()
463 platform_device_del(eeepc->platform_device); in eeepc_platform_init()
465 platform_device_put(eeepc->platform_device); in eeepc_platform_init()
469 static void eeepc_platform_exit(struct eeepc_laptop *eeepc) in eeepc_platform_exit() argument
471 sysfs_remove_group(&eeepc->platform_device->dev.kobj, in eeepc_platform_exit()
473 platform_device_unregister(eeepc->platform_device); in eeepc_platform_exit()
487 struct eeepc_laptop *eeepc; in tpd_led_update() local
489 eeepc = container_of(work, struct eeepc_laptop, tpd_led_work); in tpd_led_update()
491 set_acpi(eeepc, CM_ASL_TPD, eeepc->tpd_led_wk); in tpd_led_update()
497 struct eeepc_laptop *eeepc; in tpd_led_set() local
499 eeepc = container_of(led_cdev, struct eeepc_laptop, tpd_led); in tpd_led_set()
501 eeepc->tpd_led_wk = (value > 0) ? 1 : 0; in tpd_led_set()
502 queue_work(eeepc->led_workqueue, &eeepc->tpd_led_work); in tpd_led_set()
507 struct eeepc_laptop *eeepc; in tpd_led_get() local
509 eeepc = container_of(led_cdev, struct eeepc_laptop, tpd_led); in tpd_led_get()
511 return get_acpi(eeepc, CM_ASL_TPD); in tpd_led_get()
514 static int eeepc_led_init(struct eeepc_laptop *eeepc) in eeepc_led_init() argument
518 if (get_acpi(eeepc, CM_ASL_TPD) == -ENODEV) in eeepc_led_init()
521 eeepc->led_workqueue = create_singlethread_workqueue("led_workqueue"); in eeepc_led_init()
522 if (!eeepc->led_workqueue) in eeepc_led_init()
524 INIT_WORK(&eeepc->tpd_led_work, tpd_led_update); in eeepc_led_init()
526 eeepc->tpd_led.name = "eeepc::touchpad"; in eeepc_led_init()
527 eeepc->tpd_led.brightness_set = tpd_led_set; in eeepc_led_init()
528 if (get_acpi(eeepc, CM_ASL_TPD) >= 0) /* if method is available */ in eeepc_led_init()
529 eeepc->tpd_led.brightness_get = tpd_led_get; in eeepc_led_init()
530 eeepc->tpd_led.max_brightness = 1; in eeepc_led_init()
532 rv = led_classdev_register(&eeepc->platform_device->dev, in eeepc_led_init()
533 &eeepc->tpd_led); in eeepc_led_init()
535 destroy_workqueue(eeepc->led_workqueue); in eeepc_led_init()
542 static void eeepc_led_exit(struct eeepc_laptop *eeepc) in eeepc_led_exit() argument
544 led_classdev_unregister(&eeepc->tpd_led); in eeepc_led_exit()
545 if (eeepc->led_workqueue) in eeepc_led_exit()
546 destroy_workqueue(eeepc->led_workqueue); in eeepc_led_exit()
552 static bool eeepc_wlan_rfkill_blocked(struct eeepc_laptop *eeepc) in eeepc_wlan_rfkill_blocked() argument
554 if (get_acpi(eeepc, CM_ASL_WLAN) == 1) in eeepc_wlan_rfkill_blocked()
559 static void eeepc_rfkill_hotplug(struct eeepc_laptop *eeepc, acpi_handle handle) in eeepc_rfkill_hotplug() argument
564 bool blocked = eeepc_wlan_rfkill_blocked(eeepc); in eeepc_rfkill_hotplug()
568 if (eeepc->wlan_rfkill) in eeepc_rfkill_hotplug()
569 rfkill_set_sw_state(eeepc->wlan_rfkill, blocked); in eeepc_rfkill_hotplug()
571 mutex_lock(&eeepc->hotplug_lock); in eeepc_rfkill_hotplug()
574 if (!eeepc->hotplug_slot.ops) in eeepc_rfkill_hotplug()
629 mutex_unlock(&eeepc->hotplug_lock); in eeepc_rfkill_hotplug()
632 static void eeepc_rfkill_hotplug_update(struct eeepc_laptop *eeepc, char *node) in eeepc_rfkill_hotplug_update() argument
640 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_rfkill_hotplug_update()
645 struct eeepc_laptop *eeepc = data; in eeepc_rfkill_notify() local
650 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_rfkill_notify()
653 static int eeepc_register_rfkill_notifier(struct eeepc_laptop *eeepc, in eeepc_register_rfkill_notifier() argument
667 eeepc); in eeepc_register_rfkill_notifier()
675 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_register_rfkill_notifier()
679 static void eeepc_unregister_rfkill_notifier(struct eeepc_laptop *eeepc, in eeepc_unregister_rfkill_notifier() argument
701 eeepc_rfkill_hotplug(eeepc, handle); in eeepc_unregister_rfkill_notifier()
707 struct eeepc_laptop *eeepc; in eeepc_get_adapter_status() local
710 eeepc = container_of(hotplug_slot, struct eeepc_laptop, hotplug_slot); in eeepc_get_adapter_status()
711 val = get_acpi(eeepc, CM_ASL_WLAN); in eeepc_get_adapter_status()
726 static int eeepc_setup_pci_hotplug(struct eeepc_laptop *eeepc) in eeepc_setup_pci_hotplug() argument
736 eeepc->hotplug_slot.ops = &eeepc_hotplug_slot_ops; in eeepc_setup_pci_hotplug()
738 ret = pci_hp_register(&eeepc->hotplug_slot, bus, 0, "eeepc-wifi"); in eeepc_setup_pci_hotplug()
747 eeepc->hotplug_slot.ops = NULL; in eeepc_setup_pci_hotplug()
765 static int eeepc_new_rfkill(struct eeepc_laptop *eeepc, in eeepc_new_rfkill() argument
773 result = acpi_setter_handle(eeepc, cm, &handle); in eeepc_new_rfkill()
777 *rfkill = rfkill_alloc(name, &eeepc->platform_device->dev, type, in eeepc_new_rfkill()
783 rfkill_init_sw_state(*rfkill, get_acpi(eeepc, cm) != 1); in eeepc_new_rfkill()
797 static void eeepc_rfkill_exit(struct eeepc_laptop *eeepc) in eeepc_rfkill_exit() argument
799 eeepc_unregister_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_1); in eeepc_rfkill_exit()
800 eeepc_unregister_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_2); in eeepc_rfkill_exit()
801 eeepc_unregister_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_3); in eeepc_rfkill_exit()
802 if (eeepc->wlan_rfkill) { in eeepc_rfkill_exit()
803 rfkill_unregister(eeepc->wlan_rfkill); in eeepc_rfkill_exit()
804 rfkill_destroy(eeepc->wlan_rfkill); in eeepc_rfkill_exit()
805 eeepc->wlan_rfkill = NULL; in eeepc_rfkill_exit()
808 if (eeepc->hotplug_slot.ops) in eeepc_rfkill_exit()
809 pci_hp_deregister(&eeepc->hotplug_slot); in eeepc_rfkill_exit()
811 if (eeepc->bluetooth_rfkill) { in eeepc_rfkill_exit()
812 rfkill_unregister(eeepc->bluetooth_rfkill); in eeepc_rfkill_exit()
813 rfkill_destroy(eeepc->bluetooth_rfkill); in eeepc_rfkill_exit()
814 eeepc->bluetooth_rfkill = NULL; in eeepc_rfkill_exit()
816 if (eeepc->wwan3g_rfkill) { in eeepc_rfkill_exit()
817 rfkill_unregister(eeepc->wwan3g_rfkill); in eeepc_rfkill_exit()
818 rfkill_destroy(eeepc->wwan3g_rfkill); in eeepc_rfkill_exit()
819 eeepc->wwan3g_rfkill = NULL; in eeepc_rfkill_exit()
821 if (eeepc->wimax_rfkill) { in eeepc_rfkill_exit()
822 rfkill_unregister(eeepc->wimax_rfkill); in eeepc_rfkill_exit()
823 rfkill_destroy(eeepc->wimax_rfkill); in eeepc_rfkill_exit()
824 eeepc->wimax_rfkill = NULL; in eeepc_rfkill_exit()
828 static int eeepc_rfkill_init(struct eeepc_laptop *eeepc) in eeepc_rfkill_init() argument
832 mutex_init(&eeepc->hotplug_lock); in eeepc_rfkill_init()
834 result = eeepc_new_rfkill(eeepc, &eeepc->wlan_rfkill, in eeepc_rfkill_init()
841 result = eeepc_new_rfkill(eeepc, &eeepc->bluetooth_rfkill, in eeepc_rfkill_init()
848 result = eeepc_new_rfkill(eeepc, &eeepc->wwan3g_rfkill, in eeepc_rfkill_init()
855 result = eeepc_new_rfkill(eeepc, &eeepc->wimax_rfkill, in eeepc_rfkill_init()
862 if (eeepc->hotplug_disabled) in eeepc_rfkill_init()
865 result = eeepc_setup_pci_hotplug(eeepc); in eeepc_rfkill_init()
873 eeepc_register_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_1); in eeepc_rfkill_init()
874 eeepc_register_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_2); in eeepc_rfkill_init()
875 eeepc_register_rfkill_notifier(eeepc, EEEPC_RFKILL_NODE_3); in eeepc_rfkill_init()
879 eeepc_rfkill_exit(eeepc); in eeepc_rfkill_init()
888 struct eeepc_laptop *eeepc = dev_get_drvdata(device); in eeepc_hotk_thaw() local
890 if (eeepc->wlan_rfkill) { in eeepc_hotk_thaw()
898 wlan = get_acpi(eeepc, CM_ASL_WLAN); in eeepc_hotk_thaw()
900 set_acpi(eeepc, CM_ASL_WLAN, wlan); in eeepc_hotk_thaw()
908 struct eeepc_laptop *eeepc = dev_get_drvdata(device); in eeepc_hotk_restore() local
911 if (eeepc->wlan_rfkill) { in eeepc_hotk_restore()
912 eeepc_rfkill_hotplug_update(eeepc, EEEPC_RFKILL_NODE_1); in eeepc_hotk_restore()
913 eeepc_rfkill_hotplug_update(eeepc, EEEPC_RFKILL_NODE_2); in eeepc_hotk_restore()
914 eeepc_rfkill_hotplug_update(eeepc, EEEPC_RFKILL_NODE_3); in eeepc_hotk_restore()
917 if (eeepc->bluetooth_rfkill) in eeepc_hotk_restore()
918 rfkill_set_sw_state(eeepc->bluetooth_rfkill, in eeepc_hotk_restore()
919 get_acpi(eeepc, CM_ASL_BLUETOOTH) != 1); in eeepc_hotk_restore()
920 if (eeepc->wwan3g_rfkill) in eeepc_hotk_restore()
921 rfkill_set_sw_state(eeepc->wwan3g_rfkill, in eeepc_hotk_restore()
922 get_acpi(eeepc, CM_ASL_3G) != 1); in eeepc_hotk_restore()
923 if (eeepc->wimax_rfkill) in eeepc_hotk_restore()
924 rfkill_set_sw_state(eeepc->wimax_rfkill, in eeepc_hotk_restore()
925 get_acpi(eeepc, CM_ASL_WIMAX) != 1); in eeepc_hotk_restore()
1071 static int eeepc_hwmon_init(struct eeepc_laptop *eeepc) in eeepc_hwmon_init() argument
1073 struct device *dev = &eeepc->platform_device->dev; in eeepc_hwmon_init()
1090 struct eeepc_laptop *eeepc = bl_get_data(bd); in read_brightness() local
1092 return get_acpi(eeepc, CM_ASL_PANELBRIGHT); in read_brightness()
1097 struct eeepc_laptop *eeepc = bl_get_data(bd); in set_brightness() local
1099 return set_acpi(eeepc, CM_ASL_PANELBRIGHT, value); in set_brightness()
1112 static int eeepc_backlight_notify(struct eeepc_laptop *eeepc) in eeepc_backlight_notify() argument
1114 struct backlight_device *bd = eeepc->backlight_device; in eeepc_backlight_notify()
1122 static int eeepc_backlight_init(struct eeepc_laptop *eeepc) in eeepc_backlight_init() argument
1131 &eeepc->platform_device->dev, eeepc, in eeepc_backlight_init()
1135 eeepc->backlight_device = NULL; in eeepc_backlight_init()
1138 eeepc->backlight_device = bd; in eeepc_backlight_init()
1145 static void eeepc_backlight_exit(struct eeepc_laptop *eeepc) in eeepc_backlight_exit() argument
1147 backlight_device_unregister(eeepc->backlight_device); in eeepc_backlight_exit()
1148 eeepc->backlight_device = NULL; in eeepc_backlight_exit()
1155 static int eeepc_input_init(struct eeepc_laptop *eeepc) in eeepc_input_init() argument
1167 input->dev.parent = &eeepc->platform_device->dev; in eeepc_input_init()
1181 eeepc->inputdev = input; in eeepc_input_init()
1189 static void eeepc_input_exit(struct eeepc_laptop *eeepc) in eeepc_input_exit() argument
1191 if (eeepc->inputdev) in eeepc_input_exit()
1192 input_unregister_device(eeepc->inputdev); in eeepc_input_exit()
1193 eeepc->inputdev = NULL; in eeepc_input_exit()
1199 static void eeepc_input_notify(struct eeepc_laptop *eeepc, int event) in eeepc_input_notify() argument
1201 if (!eeepc->inputdev) in eeepc_input_notify()
1203 if (!sparse_keymap_report_event(eeepc->inputdev, event, 1, true)) in eeepc_input_notify()
1209 struct eeepc_laptop *eeepc = acpi_driver_data(device); in eeepc_acpi_notify() local
1215 count = eeepc->event_count[event % 128]++; in eeepc_acpi_notify()
1222 eeepc_input_notify(eeepc, event); in eeepc_acpi_notify()
1227 if (!eeepc->backlight_device) in eeepc_acpi_notify()
1231 old_brightness = eeepc_backlight_notify(eeepc); in eeepc_acpi_notify()
1246 eeepc_input_notify(eeepc, event); in eeepc_acpi_notify()
1249 static void eeepc_dmi_check(struct eeepc_laptop *eeepc) in eeepc_dmi_check() argument
1277 eeepc->cpufv_disabled = true; in eeepc_dmi_check()
1292 eeepc->hotplug_disabled = true; in eeepc_dmi_check()
1297 static void cmsg_quirk(struct eeepc_laptop *eeepc, int cm, const char *name) in cmsg_quirk() argument
1303 if (!(eeepc->cm_supported & (1 << cm)) in cmsg_quirk()
1304 && !read_acpi_int(eeepc->handle, cm_getv[cm], &dummy)) { in cmsg_quirk()
1307 eeepc->cm_supported |= 1 << cm; in cmsg_quirk()
1311 static void cmsg_quirks(struct eeepc_laptop *eeepc) in cmsg_quirks() argument
1313 cmsg_quirk(eeepc, CM_ASL_LID, "LID"); in cmsg_quirks()
1314 cmsg_quirk(eeepc, CM_ASL_TYPE, "TYPE"); in cmsg_quirks()
1315 cmsg_quirk(eeepc, CM_ASL_PANELPOWER, "PANELPOWER"); in cmsg_quirks()
1316 cmsg_quirk(eeepc, CM_ASL_TPD, "TPD"); in cmsg_quirks()
1319 static int eeepc_acpi_init(struct eeepc_laptop *eeepc) in eeepc_acpi_init() argument
1324 result = acpi_bus_get_status(eeepc->device); in eeepc_acpi_init()
1327 if (!eeepc->device->status.present) { in eeepc_acpi_init()
1335 if (write_acpi_int(eeepc->handle, "INIT", init_flags)) { in eeepc_acpi_init()
1341 if (read_acpi_int(eeepc->handle, "CMSG", &eeepc->cm_supported)) { in eeepc_acpi_init()
1345 cmsg_quirks(eeepc); in eeepc_acpi_init()
1346 pr_info("Get control methods supported: 0x%x\n", eeepc->cm_supported); in eeepc_acpi_init()
1351 static void eeepc_enable_camera(struct eeepc_laptop *eeepc) in eeepc_enable_camera() argument
1357 if (get_acpi(eeepc, CM_ASL_CAMERA) == 0) in eeepc_enable_camera()
1358 set_acpi(eeepc, CM_ASL_CAMERA, 1); in eeepc_enable_camera()
1365 struct eeepc_laptop *eeepc; in eeepc_acpi_add() local
1369 eeepc = kzalloc(sizeof(struct eeepc_laptop), GFP_KERNEL); in eeepc_acpi_add()
1370 if (!eeepc) in eeepc_acpi_add()
1372 eeepc->handle = device->handle; in eeepc_acpi_add()
1375 device->driver_data = eeepc; in eeepc_acpi_add()
1376 eeepc->device = device; in eeepc_acpi_add()
1378 eeepc->hotplug_disabled = hotplug_disabled; in eeepc_acpi_add()
1380 eeepc_dmi_check(eeepc); in eeepc_acpi_add()
1382 result = eeepc_acpi_init(eeepc); in eeepc_acpi_add()
1385 eeepc_enable_camera(eeepc); in eeepc_acpi_add()
1399 result = eeepc_platform_init(eeepc); in eeepc_acpi_add()
1404 result = eeepc_backlight_init(eeepc); in eeepc_acpi_add()
1409 result = eeepc_input_init(eeepc); in eeepc_acpi_add()
1413 result = eeepc_hwmon_init(eeepc); in eeepc_acpi_add()
1417 result = eeepc_led_init(eeepc); in eeepc_acpi_add()
1421 result = eeepc_rfkill_init(eeepc); in eeepc_acpi_add()
1429 eeepc_led_exit(eeepc); in eeepc_acpi_add()
1432 eeepc_input_exit(eeepc); in eeepc_acpi_add()
1434 eeepc_backlight_exit(eeepc); in eeepc_acpi_add()
1436 eeepc_platform_exit(eeepc); in eeepc_acpi_add()
1438 kfree(eeepc); in eeepc_acpi_add()
1445 struct eeepc_laptop *eeepc = acpi_driver_data(device); in eeepc_acpi_remove() local
1447 eeepc_backlight_exit(eeepc); in eeepc_acpi_remove()
1448 eeepc_rfkill_exit(eeepc); in eeepc_acpi_remove()
1449 eeepc_input_exit(eeepc); in eeepc_acpi_remove()
1450 eeepc_led_exit(eeepc); in eeepc_acpi_remove()
1451 eeepc_platform_exit(eeepc); in eeepc_acpi_remove()
1453 kfree(eeepc); in eeepc_acpi_remove()