device_pm.c (e219aafe50fd546b8686582ddbafd24c3c2eda04) device_pm.c (989561de9b5112999475b406557d9c7e9e59c041)
1/*
2 * drivers/acpi/device_pm.c - ACPI device power management routines.
3 *
4 * Copyright (C) 2012, Intel Corp.
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *

--- 8 unchanged lines hidden (view full) ---

17 *
18 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 */
20
21#include <linux/acpi.h>
22#include <linux/export.h>
23#include <linux/mutex.h>
24#include <linux/pm_qos.h>
1/*
2 * drivers/acpi/device_pm.c - ACPI device power management routines.
3 *
4 * Copyright (C) 2012, Intel Corp.
5 * Author: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
6 *
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 *

--- 8 unchanged lines hidden (view full) ---

17 *
18 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 */
20
21#include <linux/acpi.h>
22#include <linux/export.h>
23#include <linux/mutex.h>
24#include <linux/pm_qos.h>
25#include <linux/pm_domain.h>
25#include <linux/pm_runtime.h>
26
27#include "internal.h"
28
29#define _COMPONENT ACPI_POWER_COMPONENT
30ACPI_MODULE_NAME("device_pm");
31
32/**

--- 1021 unchanged lines hidden (view full) ---

1054 * Callers must ensure proper synchronization of this function with power
1055 * management callbacks.
1056 */
1057static void acpi_dev_pm_detach(struct device *dev, bool power_off)
1058{
1059 struct acpi_device *adev = ACPI_COMPANION(dev);
1060
1061 if (adev && dev->pm_domain == &acpi_general_pm_domain) {
26#include <linux/pm_runtime.h>
27
28#include "internal.h"
29
30#define _COMPONENT ACPI_POWER_COMPONENT
31ACPI_MODULE_NAME("device_pm");
32
33/**

--- 1021 unchanged lines hidden (view full) ---

1055 * Callers must ensure proper synchronization of this function with power
1056 * management callbacks.
1057 */
1058static void acpi_dev_pm_detach(struct device *dev, bool power_off)
1059{
1060 struct acpi_device *adev = ACPI_COMPANION(dev);
1061
1062 if (adev && dev->pm_domain == &acpi_general_pm_domain) {
1062 dev->pm_domain = NULL;
1063 dev_pm_domain_set(dev, NULL);
1063 acpi_remove_pm_notifier(adev);
1064 if (power_off) {
1065 /*
1066 * If the device's PM QoS resume latency limit or flags
1067 * have been exposed to user space, they have to be
1068 * hidden at this point, so that they don't affect the
1069 * choice of the low-power state to put the device into.
1070 */

--- 35 unchanged lines hidden (view full) ---

1106 * Only attach the power domain to the first device if the
1107 * companion is shared by multiple. This is to prevent doing power
1108 * management twice.
1109 */
1110 if (!acpi_device_is_first_physical_node(adev, dev))
1111 return -EBUSY;
1112
1113 acpi_add_pm_notifier(adev, dev, acpi_pm_notify_work_func);
1064 acpi_remove_pm_notifier(adev);
1065 if (power_off) {
1066 /*
1067 * If the device's PM QoS resume latency limit or flags
1068 * have been exposed to user space, they have to be
1069 * hidden at this point, so that they don't affect the
1070 * choice of the low-power state to put the device into.
1071 */

--- 35 unchanged lines hidden (view full) ---

1107 * Only attach the power domain to the first device if the
1108 * companion is shared by multiple. This is to prevent doing power
1109 * management twice.
1110 */
1111 if (!acpi_device_is_first_physical_node(adev, dev))
1112 return -EBUSY;
1113
1114 acpi_add_pm_notifier(adev, dev, acpi_pm_notify_work_func);
1114 dev->pm_domain = &acpi_general_pm_domain;
1115 dev_pm_domain_set(dev, &acpi_general_pm_domain);
1115 if (power_on) {
1116 acpi_dev_pm_full_power(adev);
1117 acpi_device_wakeup(adev, ACPI_STATE_S0, false);
1118 }
1119
1120 dev->pm_domain->detach = acpi_dev_pm_detach;
1121 return 0;
1122}
1123EXPORT_SYMBOL_GPL(acpi_dev_pm_attach);
1124#endif /* CONFIG_PM */
1116 if (power_on) {
1117 acpi_dev_pm_full_power(adev);
1118 acpi_device_wakeup(adev, ACPI_STATE_S0, false);
1119 }
1120
1121 dev->pm_domain->detach = acpi_dev_pm_detach;
1122 return 0;
1123}
1124EXPORT_SYMBOL_GPL(acpi_dev_pm_attach);
1125#endif /* CONFIG_PM */