Commit 1c2a66d4 authored by Mario Limonciello's avatar Mario Limonciello Committed by Rafael J. Wysocki

ACPI: x86: s2idle: Add a function to get LPS0 constraint for a device

Other parts of the kernel may use LPS0 constraints information to make
decisions on what power state to put a device into.
Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
[ rjw: Rewrite kerneldoc, rearrange if () statement, edit subject and
  changelog ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 41233988
...@@ -299,6 +299,30 @@ static void lpi_device_get_constraints(void) ...@@ -299,6 +299,30 @@ static void lpi_device_get_constraints(void)
ACPI_FREE(out_obj); ACPI_FREE(out_obj);
} }
/**
* acpi_get_lps0_constraint - Get the LPS0 constraint for a device.
* @adev: Device to get the constraint for.
*
* The LPS0 constraint is the shallowest (minimum) power state in which the
* device can be so as to allow the platform as a whole to achieve additional
* energy conservation by utilizing a system-wide low-power state.
*
* Returns:
* - ACPI power state value of the constraint for @adev on success.
* - Otherwise, ACPI_STATE_UNKNOWN.
*/
int acpi_get_lps0_constraint(struct acpi_device *adev)
{
struct lpi_constraints *entry;
for_each_lpi_constraint(entry) {
if (adev->handle == entry->handle)
return entry->min_dstate;
}
return ACPI_STATE_UNKNOWN;
}
static void lpi_check_constraints(void) static void lpi_check_constraints(void)
{ {
struct lpi_constraints *entry; struct lpi_constraints *entry;
......
...@@ -1109,6 +1109,12 @@ struct acpi_s2idle_dev_ops { ...@@ -1109,6 +1109,12 @@ struct acpi_s2idle_dev_ops {
}; };
int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg); int acpi_register_lps0_dev(struct acpi_s2idle_dev_ops *arg);
void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg); void acpi_unregister_lps0_dev(struct acpi_s2idle_dev_ops *arg);
int acpi_get_lps0_constraint(struct acpi_device *adev);
#else /* CONFIG_SUSPEND && CONFIG_X86 */
static inline int acpi_get_lps0_constraint(struct device *dev)
{
return ACPI_STATE_UNKNOWN;
}
#endif /* CONFIG_SUSPEND && CONFIG_X86 */ #endif /* CONFIG_SUSPEND && CONFIG_X86 */
#ifndef CONFIG_IA64 #ifndef CONFIG_IA64
void arch_reserve_mem_area(acpi_physical_address addr, size_t size); void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment