Lines Matching +full:entry +full:- +full:method

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>
11 * Controller) and a specific _DSM method under it. That method, if present,
13 * low-power state in which certain types of activity are not desirable or that
36 #define ACPI_LPS0_DSM_UUID_MICROSOFT "11e00d56-ce64-47ce-837b-1f898f9aa461"
38 #define ACPI_LPS0_DSM_UUID "c4eb40a0-6cd2-11e2-bcfd-0800200c9a66"
49 #define ACPI_LPS0_DSM_UUID_AMD "e3f32452-febc-43ce-9039-932122d37721"
62 /* Device constraint entry structure */
108 for (i = 0; i < out_obj->package.count; i++) { in lpi_device_get_constraints_amd()
109 union acpi_object *package = &out_obj->package.elements[i]; in lpi_device_get_constraints_amd()
111 if (package->type == ACPI_TYPE_PACKAGE) { in lpi_device_get_constraints_amd()
112 lpi_constraints_table = kcalloc(package->package.count, in lpi_device_get_constraints_amd()
122 for (j = 0; j < package->package.count; ++j) { in lpi_device_get_constraints_amd()
123 union acpi_object *info_obj = &package->package.elements[j]; in lpi_device_get_constraints_amd()
128 for (k = 0; k < info_obj->package.count; ++k) { in lpi_device_get_constraints_amd()
129 union acpi_object *obj = &info_obj->package.elements[k]; in lpi_device_get_constraints_amd()
132 list->min_dstate = -1; in lpi_device_get_constraints_amd()
136 dev_info.enabled = obj->integer.value; in lpi_device_get_constraints_amd()
139 dev_info.name = obj->string.pointer; in lpi_device_get_constraints_amd()
142 dev_info.function_states = obj->integer.value; in lpi_device_get_constraints_amd()
145 dev_info.min_dstate = obj->integer.value; in lpi_device_get_constraints_amd()
154 &list->handle); in lpi_device_get_constraints_amd()
161 list->min_dstate = dev_info.min_dstate; in lpi_device_get_constraints_amd()
163 if (list->min_dstate < 0) { in lpi_device_get_constraints_amd()
195 lpi_constraints_table = kcalloc(out_obj->package.count, in lpi_device_get_constraints()
203 for (i = 0; i < out_obj->package.count; i++) { in lpi_device_get_constraints()
206 union acpi_object *package = &out_obj->package.elements[i]; in lpi_device_get_constraints()
213 for (j = 0; j < package->package.count; ++j) { in lpi_device_get_constraints()
215 &(package->package.elements[j]); in lpi_device_get_constraints()
217 switch (element->type) { in lpi_device_get_constraints()
219 info.enabled = element->integer.value; in lpi_device_get_constraints()
222 info.name = element->string.pointer; in lpi_device_get_constraints()
225 package_count = element->package.count; in lpi_device_get_constraints()
226 info.package = element->package.elements; in lpi_device_get_constraints()
236 status = acpi_get_handle(NULL, info.name, &constraint->handle); in lpi_device_get_constraints()
243 constraint->min_dstate = -1; in lpi_device_get_constraints()
251 switch (info_obj->type) { in lpi_device_get_constraints()
256 if (info_obj->package.count < 2) in lpi_device_get_constraints()
259 cnstr_pkg = info_obj->package.elements; in lpi_device_get_constraints()
261 dev_info.uid = obj->integer.value; in lpi_device_get_constraints()
263 dev_info.min_dstate = obj->integer.value; in lpi_device_get_constraints()
270 constraint->min_dstate = dev_info.min_dstate; in lpi_device_get_constraints()
275 if (constraint->min_dstate < 0) { in lpi_device_get_constraints()
304 acpi_power_state_string(adev->power.state)); in lpi_check_constraints()
306 if (!adev->flags.power_manageable) { in lpi_check_constraints()
312 if (adev->power.state < lpi_constraints_table[i].min_dstate) in lpi_check_constraints()
316 acpi_power_state_string(adev->power.state)); in lpi_check_constraints()
343 int ret = -EINVAL; in validate_dsm()
349 if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length == 0 || in validate_dsm()
350 obj->buffer.length > sizeof(u32)) { in validate_dsm()
356 ret = *(int *)obj->buffer.pointer; in validate_dsm()
375 * - Should use rev_id 0x0 in lps0_device_attach()
376 * - function mask > 0x3: Should use AMD method, but has off by one bug in lps0_device_attach()
377 * - function mask = 0x3: Should use Microsoft method in lps0_device_attach()
379 * - should use rev_id 0x0 in lps0_device_attach()
380 * - function mask = 0x3: Should use Microsoft method in lps0_device_attach()
382 * - Should use rev_id 0x2 in lps0_device_attach()
383 * - Should only use AMD method in lps0_device_attach()
387 lps0_dsm_func_mask = validate_dsm(adev->handle, in lps0_device_attach()
389 lps0_dsm_func_mask_microsoft = validate_dsm(adev->handle, in lps0_device_attach()
396 acpi_handle_debug(adev->handle, "_DSM UUID %s: Adjusted function mask: 0x%x\n", in lps0_device_attach()
399 lps0_dsm_func_mask_microsoft = -EINVAL; in lps0_device_attach()
400 acpi_handle_debug(adev->handle, "_DSM Using AMD method\n"); in lps0_device_attach()
404 lps0_dsm_func_mask = validate_dsm(adev->handle, in lps0_device_attach()
406 lps0_dsm_func_mask_microsoft = -EINVAL; in lps0_device_attach()
412 lps0_device_handle = adev->handle; in lps0_device_attach()
420 * Use suspend-to-idle by default if the default suspend mode was not in lps0_device_attach()
427 * Some Intel based LPS0 systems, like ASUS Zenbook UX430UNR/i7-8550U don't in lps0_device_attach()
428 * use intel-hid or intel-vbtn but require the EC GPE to be enabled while in lps0_device_attach()
429 * suspended for certain wakeup devices to work, so mark it as wakeup-capable. in lps0_device_attach()
464 /* LPS0 entry */ in acpi_s2idle_prepare_late()
473 /* modern standby entry */ in acpi_s2idle_prepare_late()