acpi_powerres: acpi_pwr_get_state and getting initial D-state for device
Add acpi_pwr_get_state as a prerequisite to LPI (low-power idle)
states. Since these states define minimum D-state constraints on other
devices to be able to enter them, it will be necessary to use this
function to check them before attempting to do so.
Aside from that, this function is used to get the initial D-state of a
power consumer when registering it (previously the ac_state value
would be set to ACPI_STATE_UNKNOWN). It uses the _PSC method if
available (older devices), or infers the D-state through the _PRx
objects (cached in ac_prx) with acpi_pwr_infer_state if not.
acpi_pwr_switch_consumer now uses this to verify that the D-state of
a power consumer was switched correctly.
Reviewed by: imp, markj, jrm (mentor)
Approved by: markj, jrm (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48386