Loading Documentation/ABI/testing/sysfs-devices-power +31 −0 Original line number Diff line number Diff line Loading @@ -204,3 +204,34 @@ Description: This attribute has no effect on system-wide suspend/resume and hibernation. What: /sys/devices/.../power/pm_qos_no_power_off Date: September 2012 Contact: Rafael J. Wysocki <rjw@sisk.pl> Description: The /sys/devices/.../power/pm_qos_no_power_off attribute is used for manipulating the PM QoS "no power off" flag. If set, this flag indicates to the kernel that power should not be removed entirely from the device. Not all drivers support this attribute. If it isn't supported, it is not present. This attribute has no effect on system-wide suspend/resume and hibernation. What: /sys/devices/.../power/pm_qos_remote_wakeup Date: September 2012 Contact: Rafael J. Wysocki <rjw@sisk.pl> Description: The /sys/devices/.../power/pm_qos_remote_wakeup attribute is used for manipulating the PM QoS "remote wakeup required" flag. If set, this flag indicates to the kernel that the device is a source of user events that have to be signaled from its low-power states. Not all drivers support this attribute. If it isn't supported, it is not present. This attribute has no effect on system-wide suspend/resume and hibernation. Documentation/power/pm_qos_interface.txt +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ reading the aggregated value does not require any locking mechanism. From kernel mode the use of this interface is the following: int dev_pm_qos_add_request(device, handle, value): int dev_pm_qos_add_request(device, handle, type, value): Will insert an element into the list for that identified device with the target value. Upon change to this list the new target is recomputed and any registered notifiers are called only if the target value is now different. Loading drivers/acpi/sleep.c +17 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <linux/acpi.h> #include <linux/module.h> #include <linux/pm_runtime.h> #include <linux/pm_qos.h> #include <asm/io.h> Loading Loading @@ -711,6 +712,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) struct acpi_device *adev; char acpi_method[] = "_SxD"; unsigned long long d_min, d_max; bool wakeup = false; if (d_max_in < ACPI_STATE_D0 || d_max_in > ACPI_STATE_D3) return -EINVAL; Loading @@ -718,6 +720,13 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) printk(KERN_DEBUG "ACPI handle has no context!\n"); return -ENODEV; } if (d_max_in > ACPI_STATE_D3_HOT) { enum pm_qos_flags_status stat; stat = dev_pm_qos_flags(dev, PM_QOS_FLAG_NO_POWER_OFF); if (stat == PM_QOS_FLAGS_ALL) d_max_in = ACPI_STATE_D3_HOT; } acpi_method[2] = '0' + acpi_target_sleep_state; /* Loading @@ -737,8 +746,14 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) * NOTE: We rely on acpi_evaluate_integer() not clobbering the integer * provided -- that's our fault recovery, we ignore retval. */ if (acpi_target_sleep_state > ACPI_STATE_S0) if (acpi_target_sleep_state > ACPI_STATE_S0) { acpi_evaluate_integer(handle, acpi_method, NULL, &d_min); wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid && adev->wakeup.sleep_state >= acpi_target_sleep_state; } else if (dev_pm_qos_flags(dev, PM_QOS_FLAG_REMOTE_WAKEUP) != PM_QOS_FLAGS_NONE) { wakeup = adev->wakeup.flags.valid; } /* * If _PRW says we can wake up the system from the target sleep state, Loading @@ -747,9 +762,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) * (ACPI 3.x), it should return the maximum (lowest power) D-state that * can wake the system. _S0W may be valid, too. */ if (acpi_target_sleep_state == ACPI_STATE_S0 || (device_may_wakeup(dev) && adev->wakeup.flags.valid && adev->wakeup.sleep_state >= acpi_target_sleep_state)) { if (wakeup) { acpi_status status; acpi_method[3] = 'W'; Loading drivers/base/power/domain.c +10 −1 Original line number Diff line number Diff line Loading @@ -470,10 +470,19 @@ static int pm_genpd_poweroff(struct generic_pm_domain *genpd) return -EBUSY; not_suspended = 0; list_for_each_entry(pdd, &genpd->dev_list, list_node) list_for_each_entry(pdd, &genpd->dev_list, list_node) { enum pm_qos_flags_status stat; stat = dev_pm_qos_flags(pdd->dev, PM_QOS_FLAG_NO_POWER_OFF | PM_QOS_FLAG_REMOTE_WAKEUP); if (stat > PM_QOS_FLAGS_NONE) return -EBUSY; if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev) || pdd->dev->power.irq_safe)) not_suspended++; } if (not_suspended > genpd->in_progress) return -EBUSY; Loading drivers/base/power/power.h +4 −2 Original line number Diff line number Diff line Loading @@ -93,8 +93,10 @@ extern void dpm_sysfs_remove(struct device *dev); extern void rpm_sysfs_remove(struct device *dev); extern int wakeup_sysfs_add(struct device *dev); extern void wakeup_sysfs_remove(struct device *dev); extern int pm_qos_sysfs_add(struct device *dev); extern void pm_qos_sysfs_remove(struct device *dev); extern int pm_qos_sysfs_add_latency(struct device *dev); extern void pm_qos_sysfs_remove_latency(struct device *dev); extern int pm_qos_sysfs_add_flags(struct device *dev); extern void pm_qos_sysfs_remove_flags(struct device *dev); #else /* CONFIG_PM */ Loading Loading
Documentation/ABI/testing/sysfs-devices-power +31 −0 Original line number Diff line number Diff line Loading @@ -204,3 +204,34 @@ Description: This attribute has no effect on system-wide suspend/resume and hibernation. What: /sys/devices/.../power/pm_qos_no_power_off Date: September 2012 Contact: Rafael J. Wysocki <rjw@sisk.pl> Description: The /sys/devices/.../power/pm_qos_no_power_off attribute is used for manipulating the PM QoS "no power off" flag. If set, this flag indicates to the kernel that power should not be removed entirely from the device. Not all drivers support this attribute. If it isn't supported, it is not present. This attribute has no effect on system-wide suspend/resume and hibernation. What: /sys/devices/.../power/pm_qos_remote_wakeup Date: September 2012 Contact: Rafael J. Wysocki <rjw@sisk.pl> Description: The /sys/devices/.../power/pm_qos_remote_wakeup attribute is used for manipulating the PM QoS "remote wakeup required" flag. If set, this flag indicates to the kernel that the device is a source of user events that have to be signaled from its low-power states. Not all drivers support this attribute. If it isn't supported, it is not present. This attribute has no effect on system-wide suspend/resume and hibernation.
Documentation/power/pm_qos_interface.txt +1 −1 Original line number Diff line number Diff line Loading @@ -99,7 +99,7 @@ reading the aggregated value does not require any locking mechanism. From kernel mode the use of this interface is the following: int dev_pm_qos_add_request(device, handle, value): int dev_pm_qos_add_request(device, handle, type, value): Will insert an element into the list for that identified device with the target value. Upon change to this list the new target is recomputed and any registered notifiers are called only if the target value is now different. Loading
drivers/acpi/sleep.c +17 −4 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <linux/acpi.h> #include <linux/module.h> #include <linux/pm_runtime.h> #include <linux/pm_qos.h> #include <asm/io.h> Loading Loading @@ -711,6 +712,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) struct acpi_device *adev; char acpi_method[] = "_SxD"; unsigned long long d_min, d_max; bool wakeup = false; if (d_max_in < ACPI_STATE_D0 || d_max_in > ACPI_STATE_D3) return -EINVAL; Loading @@ -718,6 +720,13 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) printk(KERN_DEBUG "ACPI handle has no context!\n"); return -ENODEV; } if (d_max_in > ACPI_STATE_D3_HOT) { enum pm_qos_flags_status stat; stat = dev_pm_qos_flags(dev, PM_QOS_FLAG_NO_POWER_OFF); if (stat == PM_QOS_FLAGS_ALL) d_max_in = ACPI_STATE_D3_HOT; } acpi_method[2] = '0' + acpi_target_sleep_state; /* Loading @@ -737,8 +746,14 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) * NOTE: We rely on acpi_evaluate_integer() not clobbering the integer * provided -- that's our fault recovery, we ignore retval. */ if (acpi_target_sleep_state > ACPI_STATE_S0) if (acpi_target_sleep_state > ACPI_STATE_S0) { acpi_evaluate_integer(handle, acpi_method, NULL, &d_min); wakeup = device_may_wakeup(dev) && adev->wakeup.flags.valid && adev->wakeup.sleep_state >= acpi_target_sleep_state; } else if (dev_pm_qos_flags(dev, PM_QOS_FLAG_REMOTE_WAKEUP) != PM_QOS_FLAGS_NONE) { wakeup = adev->wakeup.flags.valid; } /* * If _PRW says we can wake up the system from the target sleep state, Loading @@ -747,9 +762,7 @@ int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in) * (ACPI 3.x), it should return the maximum (lowest power) D-state that * can wake the system. _S0W may be valid, too. */ if (acpi_target_sleep_state == ACPI_STATE_S0 || (device_may_wakeup(dev) && adev->wakeup.flags.valid && adev->wakeup.sleep_state >= acpi_target_sleep_state)) { if (wakeup) { acpi_status status; acpi_method[3] = 'W'; Loading
drivers/base/power/domain.c +10 −1 Original line number Diff line number Diff line Loading @@ -470,10 +470,19 @@ static int pm_genpd_poweroff(struct generic_pm_domain *genpd) return -EBUSY; not_suspended = 0; list_for_each_entry(pdd, &genpd->dev_list, list_node) list_for_each_entry(pdd, &genpd->dev_list, list_node) { enum pm_qos_flags_status stat; stat = dev_pm_qos_flags(pdd->dev, PM_QOS_FLAG_NO_POWER_OFF | PM_QOS_FLAG_REMOTE_WAKEUP); if (stat > PM_QOS_FLAGS_NONE) return -EBUSY; if (pdd->dev->driver && (!pm_runtime_suspended(pdd->dev) || pdd->dev->power.irq_safe)) not_suspended++; } if (not_suspended > genpd->in_progress) return -EBUSY; Loading
drivers/base/power/power.h +4 −2 Original line number Diff line number Diff line Loading @@ -93,8 +93,10 @@ extern void dpm_sysfs_remove(struct device *dev); extern void rpm_sysfs_remove(struct device *dev); extern int wakeup_sysfs_add(struct device *dev); extern void wakeup_sysfs_remove(struct device *dev); extern int pm_qos_sysfs_add(struct device *dev); extern void pm_qos_sysfs_remove(struct device *dev); extern int pm_qos_sysfs_add_latency(struct device *dev); extern void pm_qos_sysfs_remove_latency(struct device *dev); extern int pm_qos_sysfs_add_flags(struct device *dev); extern void pm_qos_sysfs_remove_flags(struct device *dev); #else /* CONFIG_PM */ Loading