Lines Matching defs:state

28  * acpi_power_state_string - String representation of ACPI device power state.
29 * @state: ACPI device power state to return the string representation of.
31 const char *acpi_power_state_string(int state)
33 switch (state) {
49 static int acpi_dev_pm_explicit_get(struct acpi_device *device, int *state)
58 *state = psc;
63 * acpi_device_get_power - Get power state of an ACPI device.
64 * @device: Device to get the power state of.
65 * @state: Place to store the power state of the device.
67 * This function does not update the device's power.state field, but it may
68 * update its parent's power.state field (when the parent's power state is
69 * unknown and the device's power state turns out to be D0).
72 * the power state returned by it will be persistent and it may return a power
73 * state shallower than previously set by acpi_device_set_power() for @device
74 * (if that power state depends on any power resources).
76 int acpi_device_get_power(struct acpi_device *device, int *state)
81 if (!device || !state)
86 *state = device->parent ?
87 device->parent->power.state : ACPI_STATE_D0;
92 * Get the device's power state from power resources settings and _PSC,
108 * The power resources settings may indicate a power state
109 * shallower than the actual power state of the device, because
113 * deepest state that can be supported.
122 * If we were unsure about the device parent's power state up to this
127 && device->parent->power.state == ACPI_STATE_UNKNOWN
129 device->parent->power.state = ACPI_STATE_D0;
131 *state = result;
134 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Device [%s] power state is %s\n",
135 device->pnp.bus_id, acpi_power_state_string(*state)));
140 static int acpi_dev_pm_explicit_set(struct acpi_device *adev, int state)
142 if (adev->power.states[state].flags.explicit_set) {
143 char method[5] = { '_', 'P', 'S', '0' + state, '\0' };
154 * acpi_device_set_power - Set power state of an ACPI device.
155 * @device: Device to set the power state of.
156 * @state: New power state to set.
161 int acpi_device_set_power(struct acpi_device *device, int state)
163 int target_state = state;
167 || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD))
170 acpi_handle_debug(device->handle, "Power state change: %s -> %s\n",
171 acpi_power_state_string(device->power.state),
172 acpi_power_state_string(state));
174 /* Make sure this is a valid target state */
177 if (state > ACPI_STATE_D0 && state == device->power.state) {
180 acpi_power_state_string(state)));
184 if (state == ACPI_STATE_D3_COLD) {
189 state = ACPI_STATE_D3_HOT;
190 /* If D3cold is not supported, use D3hot as the target state. */
192 target_state = state;
193 } else if (!device->power.states[state].flags.valid) {
194 dev_warn(&device->dev, "Power state %s not supported\n",
195 acpi_power_state_string(state));
200 device->parent && (state < device->parent->power.state)) {
202 "Cannot transition to power state %s for parent in %s\n",
203 acpi_power_state_string(state),
204 acpi_power_state_string(device->parent->power.state));
212 * resources, unless the target state is D0, in which case _PS0 is
215 if (state > ACPI_STATE_D0) {
220 if (state < device->power.state) {
222 acpi_power_state_string(device->power.state),
223 acpi_power_state_string(state));
231 if (device->power.state < ACPI_STATE_D3_HOT) {
232 result = acpi_dev_pm_explicit_set(device, state);
240 int cur_state = device->power.state;
256 * The power state of the device was set to D0 last
262 * state, and only invoke _PS0 if the evaluation of _PSC
263 * is successful and it returns a power state different
276 dev_warn(&device->dev, "Failed to change power state to %s\n",
279 device->power.state = target_state;
290 int acpi_bus_set_power(acpi_handle handle, int state)
299 return acpi_device_set_power(device, state);
305 int state;
311 device->power.state = ACPI_STATE_UNKNOWN;
317 result = acpi_device_get_power(device, &state);
321 if (state < ACPI_STATE_D3_COLD && device->power.flags.power_resources) {
323 result = acpi_power_on_resources(device, state);
327 if (state == ACPI_STATE_D0) {
329 * If _PSC is not present and the state inferred from
336 result = acpi_dev_pm_explicit_set(device, state);
340 } else if (state == ACPI_STATE_UNKNOWN) {
347 state = ACPI_STATE_D0;
349 device->power.state = state;
355 * @device: Device object whose power state is to be fixed up.
367 && device->power.state == ACPI_STATE_D0)
376 int state;
379 if (device->power.state == ACPI_STATE_UNKNOWN) {
382 *state_p = device->power.state;
387 result = acpi_device_get_power(device, &state);
391 if (state == ACPI_STATE_UNKNOWN) {
392 state = ACPI_STATE_D0;
393 result = acpi_device_set_power(device, state);
399 * We don't need to really switch the state, bu we need
402 result = acpi_power_transition(device, state);
406 device->power.state = state;
409 *state_p = state;
566 * acpi_dev_pm_get_state - Get preferred power state of ACPI device.
567 * @dev: Device whose preferred target power state to return.
569 * @target_state: System state to match the resultant device state.
570 * @d_min_p: Location to store the highest power state available to the device.
571 * @d_max_p: Location to store the lowest power state available to the device.
575 * state represented by @target_state. Store the integer numbers representing
598 * If the system state is S0, the lowest power state the device can be
601 * lowest power state available to the device.
607 * If present, _SxD methods return the minimum D-state (highest power
608 * state) we can use for the corresponding S-states. Otherwise, the
609 * minimum D-state is D0 (ACPI 3.x).
625 * D3cold if D3hot is not a valid state.
645 * If _PRW says we can wake up the system from the target sleep state,
646 * the D-state returned by _SxD is sufficient for that (we assume a
648 * (ACPI 3.x), it should return the maximum (lowest power) D-state that
656 * must not go into any power state deeper than the
662 /* Fall back to D3cold if ret is not a valid state. */
682 * acpi_pm_device_sleep_state - Get preferred power state of ACPI device.
683 * @dev: Device whose preferred target power state to return.
685 * @d_max_in: Deepest low-power state to take into consideration.
686 * Return value: Preferred power state of the device on success, -ENODEV
868 * acpi_dev_pm_low_power - Put ACPI device into a low-power state.
869 * @dev: Device to put into a low-power state.
871 * @system_state: System state to choose the device state for.
876 int ret, state;
881 ret = acpi_dev_pm_get_state(dev, adev, system_state, NULL, &state);
882 return ret ? ret : acpi_device_set_power(adev, state);
886 * acpi_dev_pm_full_power - Put ACPI device into the full-power state.
887 * @adev: ACPI device node to put into the full-power state.
896 * acpi_dev_suspend - Put device into a low-power state using ACPI.
897 * @dev: Device to put into a low-power state.
900 * Put the given device into a low-power state using the standard ACPI
901 * mechanism. Set up remote wakeup if desired, choose the state to put the
903 * the power state of the device.
931 * acpi_dev_resume - Put device into the full-power state using ACPI.
932 * @dev: Device to put into the full-power state.
934 * Put the given device into the full-power state using the standard ACPI
935 * mechanism. Set the power state of the device to ACPI D0 and disable wakeup.
956 * it into a runtime low-power state.
969 * Use ACPI to put the given device into the full-power state and carry out the
983 int ret, state;
995 ret = acpi_dev_pm_get_state(dev, adev, sys_target, NULL, &state);
999 return state != adev->power.state;
1003 * acpi_subsys_prepare - Prepare device for system transition to a sleep state.
1033 * the sleep state it is going out of and it has never been resumed till
1065 * it into a low-power state during system transition into a sleep state.
1095 * If the target system sleep state is suspend-to-idle, it is sufficient
1098 * acpi_subsys_complete() to take care of fixing up the device's state
1124 * Use ACPI to put the given device into the full-power state and carry out the
1126 * working state.
1150 * so it is better to ensure that the state saved in the image will be
1194 * it into a low-power state during system transition into a sleep state.
1268 * choice of the low-power state to put the device into.
1286 * be put into the ACPI D0 state before the function returns.