Lines Matching refs:state

36 const char *acpi_power_state_string(int state)  in acpi_power_state_string()  argument
38 switch (state) { in acpi_power_state_string()
63 int acpi_device_get_power(struct acpi_device *device, int *state) in acpi_device_get_power() argument
67 if (!device || !state) in acpi_device_get_power()
72 *state = device->parent ? in acpi_device_get_power()
73 device->parent->power.state : ACPI_STATE_D0; in acpi_device_get_power()
115 && device->parent->power.state == ACPI_STATE_UNKNOWN in acpi_device_get_power()
117 device->parent->power.state = ACPI_STATE_D0; in acpi_device_get_power()
119 *state = result; in acpi_device_get_power()
123 device->pnp.bus_id, acpi_power_state_string(*state))); in acpi_device_get_power()
128 static int acpi_dev_pm_explicit_set(struct acpi_device *adev, int state) in acpi_dev_pm_explicit_set() argument
130 if (adev->power.states[state].flags.explicit_set) { in acpi_dev_pm_explicit_set()
131 char method[5] = { '_', 'P', 'S', '0' + state, '\0' }; in acpi_dev_pm_explicit_set()
149 int acpi_device_set_power(struct acpi_device *device, int state) in acpi_device_set_power() argument
151 int target_state = state; in acpi_device_set_power()
155 || (state < ACPI_STATE_D0) || (state > ACPI_STATE_D3_COLD)) in acpi_device_set_power()
160 if (state == device->power.state) { in acpi_device_set_power()
163 acpi_power_state_string(state))); in acpi_device_set_power()
167 if (state == ACPI_STATE_D3_COLD) { in acpi_device_set_power()
172 state = ACPI_STATE_D3_HOT; in acpi_device_set_power()
175 target_state = state; in acpi_device_set_power()
176 } else if (!device->power.states[state].flags.valid) { in acpi_device_set_power()
178 acpi_power_state_string(state)); in acpi_device_set_power()
183 device->parent && (state < device->parent->power.state)) { in acpi_device_set_power()
186 acpi_power_state_string(state), in acpi_device_set_power()
187 acpi_power_state_string(device->parent->power.state)); in acpi_device_set_power()
198 if (state > ACPI_STATE_D0) { in acpi_device_set_power()
203 if (state < device->power.state) { in acpi_device_set_power()
205 acpi_power_state_string(device->power.state), in acpi_device_set_power()
206 acpi_power_state_string(state)); in acpi_device_set_power()
210 result = acpi_dev_pm_explicit_set(device, state); in acpi_device_set_power()
228 acpi_power_state_string(state)); in acpi_device_set_power()
230 device->power.state = target_state; in acpi_device_set_power()
234 acpi_power_state_string(state))); in acpi_device_set_power()
241 int acpi_bus_set_power(acpi_handle handle, int state) in acpi_bus_set_power() argument
250 return acpi_device_set_power(device, state); in acpi_bus_set_power()
256 int state; in acpi_bus_init_power() local
262 device->power.state = ACPI_STATE_UNKNOWN; in acpi_bus_init_power()
266 result = acpi_device_get_power(device, &state); in acpi_bus_init_power()
270 if (state < ACPI_STATE_D3_COLD && device->power.flags.power_resources) { in acpi_bus_init_power()
272 result = acpi_power_on_resources(device, state); in acpi_bus_init_power()
276 if (state == ACPI_STATE_D0) { in acpi_bus_init_power()
285 result = acpi_dev_pm_explicit_set(device, state); in acpi_bus_init_power()
289 } else if (state == ACPI_STATE_UNKNOWN) { in acpi_bus_init_power()
296 state = ACPI_STATE_D0; in acpi_bus_init_power()
298 device->power.state = state; in acpi_bus_init_power()
316 && device->power.state == ACPI_STATE_D0) in acpi_device_fix_up_power()
324 int state; in acpi_device_update_power() local
327 if (device->power.state == ACPI_STATE_UNKNOWN) { in acpi_device_update_power()
330 *state_p = device->power.state; in acpi_device_update_power()
335 result = acpi_device_get_power(device, &state); in acpi_device_update_power()
339 if (state == ACPI_STATE_UNKNOWN) { in acpi_device_update_power()
340 state = ACPI_STATE_D0; in acpi_device_update_power()
341 result = acpi_device_set_power(device, state); in acpi_device_update_power()
350 result = acpi_power_transition(device, state); in acpi_device_update_power()
354 device->power.state = state; in acpi_device_update_power()
357 *state_p = state; in acpi_device_update_power()
778 int ret, state; in acpi_dev_pm_low_power() local
783 ret = acpi_dev_pm_get_state(dev, adev, system_state, NULL, &state); in acpi_dev_pm_low_power()
784 return ret ? ret : acpi_device_set_power(adev, state); in acpi_dev_pm_low_power()
943 int ret, state; in acpi_subsys_prepare() local
960 ret = acpi_dev_pm_get_state(dev, adev, sys_target, NULL, &state); in acpi_subsys_prepare()
961 return !ret && state == adev->power.state; in acpi_subsys_prepare()