Lines Matching +full:package +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0
3 * Architecture-specific ACPI-based support for suspend-to-idle.
7 * Author: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
13 * low-power state in which certain types of activity are not desirable or that
15 * mode accordingly.
37 #define ACPI_LPS0_DSM_UUID_MICROSOFT "11e00d56-ce64-47ce-837b-1f898f9aa461"
39 #define ACPI_LPS0_DSM_UUID "c4eb40a0-6cd2-11e2-bcfd-0800200c9a66"
50 #define ACPI_LPS0_DSM_UUID_AMD "e3f32452-febc-43ce-9039-932122d37721"
68 union acpi_object *package; member
71 /* Constraint package structure */
83 /* AMD Constraint package structure */
117 for (i = 0; i < out_obj->package.count; i++) { in lpi_device_get_constraints_amd()
118 union acpi_object *package = &out_obj->package.elements[i]; in lpi_device_get_constraints_amd() local
120 if (package->type == ACPI_TYPE_PACKAGE) { in lpi_device_get_constraints_amd()
127 lpi_constraints_table = kcalloc(package->package.count, in lpi_device_get_constraints_amd()
137 for (j = 0; j < package->package.count; j++) { in lpi_device_get_constraints_amd()
138 union acpi_object *info_obj = &package->package.elements[j]; in lpi_device_get_constraints_amd()
145 for (k = 0; k < info_obj->package.count; k++) { in lpi_device_get_constraints_amd()
146 union acpi_object *obj = &info_obj->package.elements[k]; in lpi_device_get_constraints_amd()
150 dev_info.enabled = obj->integer.value; in lpi_device_get_constraints_amd()
153 dev_info.name = obj->string.pointer; in lpi_device_get_constraints_amd()
156 dev_info.function_states = obj->integer.value; in lpi_device_get_constraints_amd()
159 dev_info.min_dstate = obj->integer.value; in lpi_device_get_constraints_amd()
175 status = acpi_get_handle(NULL, dev_info.name, &list->handle); in lpi_device_get_constraints_amd()
179 list->min_dstate = dev_info.min_dstate; in lpi_device_get_constraints_amd()
207 lpi_constraints_table = kcalloc(out_obj->package.count, in lpi_device_get_constraints()
215 for (i = 0; i < out_obj->package.count; i++) { in lpi_device_get_constraints()
218 union acpi_object *package = &out_obj->package.elements[i]; in lpi_device_get_constraints() local
222 if (!package) in lpi_device_get_constraints()
225 for (j = 0; j < package->package.count; j++) { in lpi_device_get_constraints()
227 &(package->package.elements[j]); in lpi_device_get_constraints()
229 switch (element->type) { in lpi_device_get_constraints()
231 info.enabled = element->integer.value; in lpi_device_get_constraints()
234 info.name = element->string.pointer; in lpi_device_get_constraints()
237 package_count = element->package.count; in lpi_device_get_constraints()
238 info.package = element->package.elements; in lpi_device_get_constraints()
243 if (!info.enabled || !info.package || !info.name) in lpi_device_get_constraints()
248 status = acpi_get_handle(NULL, info.name, &constraint->handle); in lpi_device_get_constraints()
255 constraint->min_dstate = -1; in lpi_device_get_constraints()
258 union acpi_object *info_obj = &info.package[j]; in lpi_device_get_constraints()
263 switch (info_obj->type) { in lpi_device_get_constraints()
268 if (info_obj->package.count < 2) in lpi_device_get_constraints()
271 cnstr_pkg = info_obj->package.elements; in lpi_device_get_constraints()
273 dev_info.uid = obj->integer.value; in lpi_device_get_constraints()
275 dev_info.min_dstate = obj->integer.value; in lpi_device_get_constraints()
282 constraint->min_dstate = dev_info.min_dstate; in lpi_device_get_constraints()
287 if (constraint->min_dstate < 0) { in lpi_device_get_constraints()
303 * acpi_get_lps0_constraint - Get the LPS0 constraint for a device.
308 * energy conservation by utilizing a system-wide low-power state.
311 * - ACPI power state value of the constraint for @adev on success.
312 * - Otherwise, ACPI_STATE_UNKNOWN.
319 if (adev->handle == entry->handle) in acpi_get_lps0_constraint()
320 return entry->min_dstate; in acpi_get_lps0_constraint()
331 struct acpi_device *adev = acpi_fetch_acpi_dev(entry->handle); in lpi_check_constraints()
336 acpi_handle_debug(entry->handle, in lpi_check_constraints()
338 acpi_power_state_string(entry->min_dstate), in lpi_check_constraints()
339 acpi_power_state_string(adev->power.state)); in lpi_check_constraints()
341 if (!adev->flags.power_manageable) { in lpi_check_constraints()
342 acpi_handle_info(entry->handle, "LPI: Device not power manageable\n"); in lpi_check_constraints()
343 entry->handle = NULL; in lpi_check_constraints()
347 if (adev->power.state < entry->min_dstate) in lpi_check_constraints()
348 acpi_handle_info(entry->handle, in lpi_check_constraints()
350 acpi_power_state_string(entry->min_dstate), in lpi_check_constraints()
351 acpi_power_state_string(adev->power.state)); in lpi_check_constraints()
417 int ret = -EINVAL; in validate_dsm()
423 if (!obj || obj->buffer.length == 0 || obj->buffer.length > sizeof(u32)) { in validate_dsm()
429 ret = *(int *)obj->buffer.pointer; in validate_dsm()
463 lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle, in lps0_device_attach()
470 for (dev_id = &amd_hid_ids[0]; dev_id->id[0]; dev_id++) in lps0_device_attach()
471 if (acpi_dev_hid_uid_match(adev, dev_id->id, NULL)) in lps0_device_attach()
473 if (dev_id->id[0]) in lps0_device_attach()
474 data = (const struct amd_lps0_hid_device_data *) dev_id->driver_data; in lps0_device_attach()
477 lps0_dsm_func_mask = validate_dsm(adev->handle, in lps0_device_attach()
479 if (lps0_dsm_func_mask > 0x3 && data->check_off_by_one) { in lps0_device_attach()
481 acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n", in lps0_device_attach()
484 lps0_dsm_func_mask_microsoft = -EINVAL; in lps0_device_attach()
485 acpi_handle_debug(adev->handle, "_DSM Using AMD method\n"); in lps0_device_attach()
489 lps0_dsm_func_mask = validate_dsm(adev->handle, in lps0_device_attach()
500 acpi_handle_info(adev->handle, in lps0_device_attach()
509 lps0_device_handle = adev->handle; in lps0_device_attach()
517 * Use suspend-to-idle by default if ACPI_FADT_LOW_POWER_S0 is set in in lps0_device_attach()
518 * the FADT and the default suspend mode was not set from the command in lps0_device_attach()
524 pr_info("Low-power S0 idle used by default for system suspend\n"); in lps0_device_attach()
528 * Some LPS0 systems, like ASUS Zenbook UX430UNR/i7-8550U, require the in lps0_device_attach()
530 * work, so mark it as wakeup-capable. in lps0_device_attach()
581 if (handler->prepare) in acpi_s2idle_prepare_late()
582 handler->prepare(); in acpi_s2idle_prepare_late()
596 if (handler->check) in acpi_s2idle_check()
597 handler->check(); in acpi_s2idle_check()
609 if (handler->restore) in acpi_s2idle_restore_early()
610 handler->restore(); in acpi_s2idle_restore_early()
660 return -ENODEV; in acpi_register_lps0_dev()
663 list_add(&arg->list_node, &lps0_s2idle_devops_head); in acpi_register_lps0_dev()
678 list_del(&arg->list_node); in acpi_unregister_lps0_dev()