Lines Matching full:wakeup
488 * acpi_dev_power_state_for_wake - Deepest power state for wakeup signaling
531 if (adev->wakeup.flags.notifier_present) { in acpi_pm_notify_handler()
532 pm_wakeup_ws_event(adev->wakeup.ws, 0, acpi_s2idle_wakeup()); in acpi_pm_notify_handler()
533 if (adev->wakeup.context.func) { in acpi_pm_notify_handler()
535 adev->wakeup.context.func, in acpi_pm_notify_handler()
536 dev_name(adev->wakeup.context.dev)); in acpi_pm_notify_handler()
537 adev->wakeup.context.func(&adev->wakeup.context); in acpi_pm_notify_handler()
549 * @dev: Device to generate a wakeup event for while handling the notification.
552 * NOTE: @adev need not be a run-wake or wakeup device to be a valid source of
553 * PM wakeup events. For example, wakeup events may be generated for bridges
554 * if one of the devices below the bridge is signaling wakeup, even if the
555 * bridge itself doesn't have a wakeup GPE associated with it.
567 if (adev->wakeup.flags.notifier_present) in acpi_add_pm_notifier()
576 adev->wakeup.ws = wakeup_source_register(&adev->dev, in acpi_add_pm_notifier()
578 adev->wakeup.context.dev = dev; in acpi_add_pm_notifier()
579 adev->wakeup.context.func = func; in acpi_add_pm_notifier()
580 adev->wakeup.flags.notifier_present = true; in acpi_add_pm_notifier()
598 if (!adev->wakeup.flags.notifier_present) in acpi_remove_pm_notifier()
608 adev->wakeup.context.func = NULL; in acpi_remove_pm_notifier()
609 adev->wakeup.context.dev = NULL; in acpi_remove_pm_notifier()
610 wakeup_source_unregister(adev->wakeup.ws); in acpi_remove_pm_notifier()
611 adev->wakeup.flags.notifier_present = false; in acpi_remove_pm_notifier()
623 return device && device->wakeup.flags.valid; in acpi_bus_can_wakeup()
662 bool wakeup = false; in acpi_dev_pm_get_state() local
669 * wakeup, in which case the return value of _S0W has to be used as the in acpi_dev_pm_get_state()
707 wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid in acpi_dev_pm_get_state()
708 && adev->wakeup.sleep_state >= target_state; in acpi_dev_pm_get_state()
722 wakeup = true; in acpi_dev_pm_get_state()
725 wakeup = adev->wakeup.flags.valid; in acpi_dev_pm_get_state()
731 * wakeup-aware driver if wake is set). Still, if _SxW exists in acpi_dev_pm_get_state()
735 if (wakeup) { in acpi_dev_pm_get_state()
821 * acpi_pm_notify_work_func - ACPI devices wakeup notification work function.
822 * @context: Device wakeup context.
839 struct acpi_device_wakeup *wakeup = &adev->wakeup; in __acpi_device_wakeup_enable() local
846 * If the device wakeup power is already enabled, disable it and enable in __acpi_device_wakeup_enable()
851 if (wakeup->enable_count > 0) in __acpi_device_wakeup_enable()
856 if (wakeup->enable_count > 0) { in __acpi_device_wakeup_enable()
857 acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); in __acpi_device_wakeup_enable()
858 wakeup->enable_count = 0; in __acpi_device_wakeup_enable()
863 if (wakeup->enable_count > 0) in __acpi_device_wakeup_enable()
866 status = acpi_enable_gpe(wakeup->gpe_device, wakeup->gpe_number); in __acpi_device_wakeup_enable()
873 acpi_handle_debug(adev->handle, "GPE%2X enabled for wakeup\n", in __acpi_device_wakeup_enable()
874 (unsigned int)wakeup->gpe_number); in __acpi_device_wakeup_enable()
877 if (wakeup->enable_count < INT_MAX) in __acpi_device_wakeup_enable()
878 wakeup->enable_count++; in __acpi_device_wakeup_enable()
880 acpi_handle_info(adev->handle, "Wakeup enable count out of bounds!\n"); in __acpi_device_wakeup_enable()
888 * acpi_device_wakeup_enable - Enable wakeup functionality for device.
889 * @adev: ACPI device to enable wakeup functionality for.
892 * Enable the GPE associated with @adev so that it can generate wakeup signals
893 * for the device in response to external (remote) events and enable wakeup
905 * acpi_device_wakeup_disable - Disable wakeup functionality for device.
906 * @adev: ACPI device to disable wakeup functionality for.
908 * Disable the GPE associated with @adev and disable wakeup power for it.
915 struct acpi_device_wakeup *wakeup = &adev->wakeup; in acpi_device_wakeup_disable() local
919 if (!wakeup->enable_count) in acpi_device_wakeup_disable()
922 acpi_disable_gpe(wakeup->gpe_device, wakeup->gpe_number); in acpi_device_wakeup_disable()
925 wakeup->enable_count--; in acpi_device_wakeup_disable()
932 * acpi_pm_set_device_wakeup - Enable/disable remote wakeup for given device.
933 * @dev: Device to enable/disable to generate wakeup events.
934 * @enable: Whether to enable or disable the wakeup functionality.
952 dev_dbg(dev, "Wakeup disabled by ACPI\n"); in acpi_pm_set_device_wakeup()
958 dev_dbg(dev, "Wakeup enabled by ACPI\n"); in acpi_pm_set_device_wakeup()
995 * @wakeup: Whether or not to enable wakeup for the device.
998 * mechanism. Set up remote wakeup if desired, choose the state to put the
999 * device into (this checks if remote wakeup is expected to work too), and set
1002 int acpi_dev_suspend(struct device *dev, bool wakeup) in acpi_dev_suspend() argument
1011 if (wakeup && acpi_device_can_wakeup(adev)) { in acpi_dev_suspend()
1016 wakeup = false; in acpi_dev_suspend()
1020 if (error && wakeup) in acpi_dev_suspend()
1032 * mechanism. Set the power state of the device to ACPI D0 and disable wakeup.
1084 if (!pm_runtime_suspended(dev) || !adev || (adev->wakeup.flags.valid && in acpi_dev_needs_resume()
1085 device_may_wakeup(dev) != !!adev->wakeup.prepare_count)) in acpi_dev_needs_resume()
1195 * to check whether or not the device's wakeup settings are good for in acpi_subsys_suspend_noirq()
1379 * Remove the device from the general ACPI PM domain and remove its wakeup
1414 * attached to it, install a wakeup notification handler for the device and