2023-02-28 14:09:20 +08:00
|
|
|
--- a/kernel/nv-acpi.c 2020-01-01 00:00:00.000000000 +0000
|
|
|
|
+++ b/kernel/nv-acpi.c 2020-01-01 00:00:00.000000000 +0000
|
|
|
|
@@ -190,9 +190,9 @@
|
2022-10-13 11:35:20 +08:00
|
|
|
union acpi_object control_argument_0 = { ACPI_TYPE_INTEGER };
|
|
|
|
struct acpi_object_list control_argument_list = { 0, NULL };
|
|
|
|
nv_stack_t *sp = NULL;
|
2023-02-28 14:09:20 +08:00
|
|
|
- struct list_head *node, *next;
|
2022-10-13 11:35:20 +08:00
|
|
|
nv_acpi_integer_t device_id = 0;
|
|
|
|
int device_counter = 0;
|
2023-02-28 14:09:20 +08:00
|
|
|
+ acpi_handle handle = NULL;
|
2022-10-13 11:35:20 +08:00
|
|
|
|
|
|
|
NV_KMEM_CACHE_ALLOC_STACK(sp);
|
2023-02-28 14:09:20 +08:00
|
|
|
if (sp == NULL)
|
|
|
|
@@ -220,13 +220,12 @@
|
2022-10-13 11:35:20 +08:00
|
|
|
|
|
|
|
// grab handles to all the important nodes representing devices
|
|
|
|
|
2023-02-28 14:09:20 +08:00
|
|
|
- list_for_each_safe(node, next, &device->children)
|
|
|
|
+ do
|
2022-10-13 11:35:20 +08:00
|
|
|
{
|
2023-02-28 14:09:20 +08:00
|
|
|
- struct acpi_device *dev =
|
|
|
|
- list_entry(node, struct acpi_device, node);
|
|
|
|
-
|
|
|
|
- if (!dev)
|
|
|
|
- continue;
|
|
|
|
+ status = acpi_get_next_object(ACPI_TYPE_DEVICE, device->handle,
|
|
|
|
+ handle, &handle);
|
|
|
|
+ if (ACPI_FAILURE(status) || (handle == NULL))
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
if (device_counter == NV_MAXNUM_DISPLAY_DEVICES)
|
|
|
|
{
|
|
|
|
@@ -237,7 +236,7 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
status =
|
|
|
|
- acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
|
|
|
|
+ acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
/* Couldnt query device_id for this device */
|
|
|
|
continue;
|
|
|
|
@@ -256,11 +255,11 @@
|
|
|
|
}
|
|
|
|
|
|
|
|
pNvAcpiObject->pNvVideo[device_counter].dev_id = device_id;
|
|
|
|
- pNvAcpiObject->pNvVideo[device_counter].dev_handle = dev->handle;
|
|
|
|
+ pNvAcpiObject->pNvVideo[device_counter].dev_handle = handle;
|
|
|
|
|
2022-10-13 11:35:20 +08:00
|
|
|
device_counter++;
|
|
|
|
|
2023-02-28 14:09:20 +08:00
|
|
|
- }
|
|
|
|
+ } while (handle != NULL);
|
2022-10-13 11:35:20 +08:00
|
|
|
|
|
|
|
// arg 0, bits 1:0, 0 = enable events
|
|
|
|
control_argument_0.integer.type = ACPI_TYPE_INTEGER;
|
2023-02-28 14:09:20 +08:00
|
|
|
@@ -1202,16 +1201,15 @@
|
|
|
|
)
|
|
|
|
{
|
|
|
|
acpi_status status;
|
|
|
|
- struct acpi_device *device = NULL;
|
|
|
|
struct acpi_buffer output = { ACPI_ALLOCATE_BUFFER, NULL };
|
2022-10-13 11:35:20 +08:00
|
|
|
union acpi_object *ddc;
|
|
|
|
union acpi_object ddc_arg0 = { ACPI_TYPE_INTEGER };
|
|
|
|
struct acpi_object_list input = { 1, &ddc_arg0 };
|
2023-02-28 14:09:20 +08:00
|
|
|
- struct list_head *node, *next;
|
2022-10-13 11:35:20 +08:00
|
|
|
nv_acpi_integer_t device_id = 0;
|
|
|
|
NvU32 i;
|
|
|
|
acpi_handle dev_handle = NULL;
|
|
|
|
acpi_handle lcd_dev_handle = NULL;
|
2023-02-28 14:09:20 +08:00
|
|
|
+ acpi_handle handle = NULL;
|
|
|
|
|
|
|
|
if (!nv_acpi_get_device_handle(nv, &dev_handle))
|
2022-10-13 11:35:20 +08:00
|
|
|
return RM_ERR_NOT_SUPPORTED;
|
2023-02-28 14:09:20 +08:00
|
|
|
@@ -1219,16 +1217,6 @@
|
|
|
|
if (!dev_handle)
|
|
|
|
return RM_ERR_INVALID_ARGUMENT;
|
2022-10-13 11:35:20 +08:00
|
|
|
|
2023-02-28 14:09:20 +08:00
|
|
|
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 18, 0)
|
|
|
|
- device = acpi_fetch_acpi_dev(dev_handle);
|
|
|
|
- status = 0;
|
|
|
|
-#else
|
|
|
|
- status = acpi_bus_get_device(dev_handle, &device);
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
- if (ACPI_FAILURE(status) || !device)
|
|
|
|
- return RM_ERR_INVALID_ARGUMENT;
|
|
|
|
-
|
|
|
|
if (!NV_MAY_SLEEP())
|
2022-10-13 11:35:20 +08:00
|
|
|
{
|
2023-02-28 14:09:20 +08:00
|
|
|
#if defined(DEBUG)
|
|
|
|
@@ -1239,15 +1227,15 @@
|
|
|
|
return RM_ERR_NOT_SUPPORTED;
|
2022-10-13 11:35:20 +08:00
|
|
|
}
|
|
|
|
|
2023-02-28 14:09:20 +08:00
|
|
|
- list_for_each_safe(node, next, &device->children)
|
|
|
|
+ while (lcd_dev_handle == NULL)
|
2022-10-13 11:35:20 +08:00
|
|
|
{
|
2023-02-28 14:09:20 +08:00
|
|
|
- struct acpi_device *dev =
|
|
|
|
- list_entry(node, struct acpi_device, node);
|
|
|
|
+ status = acpi_get_next_object(ACPI_TYPE_DEVICE, dev_handle,
|
|
|
|
+ handle, &handle);
|
|
|
|
+ if (ACPI_FAILURE(status) || (handle == NULL))
|
|
|
|
+ break;
|
|
|
|
|
|
|
|
- if (!dev)
|
|
|
|
- continue;
|
|
|
|
+ status = acpi_evaluate_integer(handle, "_ADR", NULL, &device_id);
|
|
|
|
|
|
|
|
- status = acpi_evaluate_integer(dev->handle, "_ADR", NULL, &device_id);
|
|
|
|
if (ACPI_FAILURE(status))
|
|
|
|
/* Couldnt query device_id for this device */
|
|
|
|
continue;
|
|
|
|
@@ -1256,7 +1244,7 @@
|
|
|
|
|
|
|
|
if ((device_id == 0x0110) || (device_id == 0x0118) || (device_id == 0x0400)) /* Only for an LCD*/
|
|
|
|
{
|
|
|
|
- lcd_dev_handle = dev->handle;
|
|
|
|
+ lcd_dev_handle = handle;
|
|
|
|
nv_printf(NV_DBG_INFO, "NVRM: %s Found LCD: %x\n", __FUNCTION__, device_id);
|
|
|
|
break;
|
|
|
|
}
|