Lines Matching full:button
3 * button.c - ACPI Button Driver
9 #define pr_fmt(fmt) "ACPI: button: " fmt
22 #include <acpi/button.h>
24 #define ACPI_BUTTON_CLASS "button"
30 #define ACPI_BUTTON_DEVICE_NAME_POWER "Power Button"
34 #define ACPI_BUTTON_DEVICE_NAME_SLEEP "Sleep Button"
56 MODULE_DESCRIPTION("ACPI Button Driver");
160 .name = "button",
206 struct acpi_button *button = acpi_driver_data(device); in acpi_lid_notify_state() local
218 button->last_state != !!state) in acpi_lid_notify_state()
223 next_report = ktime_add(button->last_time, in acpi_lid_notify_state()
225 if (button->last_state == !!state && in acpi_lid_notify_state()
267 input_report_switch(button->input, in acpi_lid_notify_state()
269 input_sync(button->input); in acpi_lid_notify_state()
277 input_report_switch(button->input, SW_LID, !state); in acpi_lid_notify_state()
278 input_sync(button->input); in acpi_lid_notify_state()
279 button->last_state = !!state; in acpi_lid_notify_state()
280 button->last_time = ktime_get(); in acpi_lid_notify_state()
300 struct acpi_button *button = acpi_driver_data(device); in acpi_button_add_fs() local
305 if (button->type != ACPI_BUTTON_TYPE_LID) in acpi_button_add_fs()
313 /* create /proc/acpi/button */ in acpi_button_add_fs()
318 /* create /proc/acpi/button/lid */ in acpi_button_add_fs()
325 /* create /proc/acpi/button/lid/LID/ */ in acpi_button_add_fs()
332 /* create /proc/acpi/button/lid/LID/state */ in acpi_button_add_fs()
359 struct acpi_button *button = acpi_driver_data(device); in acpi_button_remove_fs() local
361 if (button->type != ACPI_BUTTON_TYPE_LID) in acpi_button_remove_fs()
404 struct acpi_button *button = acpi_driver_data(device); in acpi_lid_initialize_state() local
418 button->lid_state_initialized = true; in acpi_lid_initialize_state()
424 struct acpi_button *button; in acpi_lid_notify() local
432 button = acpi_driver_data(device); in acpi_lid_notify()
433 if (!button->lid_state_initialized) in acpi_lid_notify()
442 struct acpi_button *button; in acpi_button_notify() local
454 button = acpi_driver_data(device); in acpi_button_notify()
455 if (button->suspended) in acpi_button_notify()
458 input = button->input; in acpi_button_notify()
468 event, ++button->pushed); in acpi_button_notify()
486 struct acpi_button *button = acpi_driver_data(device); in acpi_button_suspend() local
488 button->suspended = true; in acpi_button_suspend()
496 struct acpi_button *button = acpi_driver_data(device); in acpi_button_resume() local
498 button->suspended = false; in acpi_button_resume()
499 if (button->type == ACPI_BUTTON_TYPE_LID) { in acpi_button_resume()
500 button->last_state = !!acpi_lid_evaluate_state(device); in acpi_button_resume()
501 button->last_time = ktime_get(); in acpi_button_resume()
505 if (button->type == ACPI_BUTTON_TYPE_POWER) { in acpi_button_resume()
506 input = button->input; in acpi_button_resume()
519 struct acpi_button *button = acpi_driver_data(device); in acpi_lid_input_open() local
521 button->last_state = !!acpi_lid_evaluate_state(device); in acpi_lid_input_open()
522 button->last_time = ktime_get(); in acpi_lid_input_open()
531 struct acpi_button *button; in acpi_button_add() local
542 button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL); in acpi_button_add()
543 if (!button) in acpi_button_add()
546 device->driver_data = button; in acpi_button_add()
548 button->input = input = input_allocate_device(); in acpi_button_add()
559 button->type = ACPI_BUTTON_TYPE_POWER; in acpi_button_add()
566 button->type = ACPI_BUTTON_TYPE_SLEEP; in acpi_button_add()
572 button->type = ACPI_BUTTON_TYPE_LID; in acpi_button_add()
591 snprintf(button->phys, sizeof(button->phys), "%s/button/input0", hid); in acpi_button_add()
594 input->phys = button->phys; in acpi_button_add()
596 input->id.product = button->type; in acpi_button_add()
599 switch (button->type) { in acpi_button_add()
641 if (button->type == ACPI_BUTTON_TYPE_LID) { in acpi_button_add()
658 kfree(button); in acpi_button_add()
664 struct acpi_button *button = acpi_driver_data(device); in acpi_button_remove() local
677 button->type == ACPI_BUTTON_TYPE_LID ? in acpi_button_remove()
685 input_unregister_device(button->input); in acpi_button_remove()
686 kfree(button); in acpi_button_remove()