Lines Matching +full:valid +full:- +full:wakeup +full:- +full:mask
1 // SPDX-License-Identifier: GPL-2.0
3 * wakeup.c - support wakeup devices
17 bool (*wakeup)(void *context); member
26 * suspend/resume and isn't really required as this is called in S-state. At
31 * acpi_enable_wakeup_devices - Enable wake-up device GPEs.
34 * Enable wakeup device power of devices with the state.enable flag set and set
35 * the wakeup enable mask bits in the GPE registers that correspond to wakeup
44 if (!dev->wakeup.flags.valid in acpi_enable_wakeup_devices()
45 || sleep_state > (u32) dev->wakeup.sleep_state in acpi_enable_wakeup_devices()
46 || !(device_may_wakeup(&dev->dev) in acpi_enable_wakeup_devices()
47 || dev->wakeup.prepare_count)) in acpi_enable_wakeup_devices()
50 if (device_may_wakeup(&dev->dev)) in acpi_enable_wakeup_devices()
53 /* The wake-up power should have been enabled already. */ in acpi_enable_wakeup_devices()
54 acpi_set_gpe_wake_mask(dev->wakeup.gpe_device, dev->wakeup.gpe_number, in acpi_enable_wakeup_devices()
60 * acpi_disable_wakeup_devices - Disable devices' wakeup capability.
69 if (!dev->wakeup.flags.valid in acpi_disable_wakeup_devices()
70 || sleep_state > (u32) dev->wakeup.sleep_state in acpi_disable_wakeup_devices()
71 || !(device_may_wakeup(&dev->dev) in acpi_disable_wakeup_devices()
72 || dev->wakeup.prepare_count)) in acpi_disable_wakeup_devices()
75 acpi_set_gpe_wake_mask(dev->wakeup.gpe_device, dev->wakeup.gpe_number, in acpi_disable_wakeup_devices()
78 if (device_may_wakeup(&dev->dev)) in acpi_disable_wakeup_devices()
90 if (device_can_wakeup(&dev->dev)) { in acpi_wakeup_device_init()
92 acpi_enable_gpe(dev->wakeup.gpe_device, in acpi_wakeup_device_init()
93 dev->wakeup.gpe_number); in acpi_wakeup_device_init()
94 device_set_wakeup_enable(&dev->dev, true); in acpi_wakeup_device_init()
102 * acpi_register_wakeup_handler - Register wakeup handler
104 * @wakeup: Wakeup-handler to call when the SCI has triggered a wakeup
109 * to trigger a wakeup.
111 int acpi_register_wakeup_handler(int wake_irq, bool (*wakeup)(void *context), in acpi_register_wakeup_handler()
125 return -ENOMEM; in acpi_register_wakeup_handler()
127 handler->wakeup = wakeup; in acpi_register_wakeup_handler()
128 handler->context = context; in acpi_register_wakeup_handler()
131 list_add(&handler->list_node, &acpi_wakeup_handler_head); in acpi_register_wakeup_handler()
139 * acpi_unregister_wakeup_handler - Unregister wakeup handler
140 * @wakeup: Wakeup-handler passed to acpi_register_wakeup_handler()
143 void acpi_unregister_wakeup_handler(bool (*wakeup)(void *context), in acpi_unregister_wakeup_handler()
150 if (handler->wakeup == wakeup && handler->context == context) { in acpi_unregister_wakeup_handler()
151 list_del(&handler->list_node); in acpi_unregister_wakeup_handler()
166 if (handler->wakeup(handler->context)) in acpi_check_wakeup_handlers()