ACPI: video: Handle fetching EDID that is longer than 256 bytes
The ACPI specification allows for an EDID to be up to 512 bytes but the _DDC EDID fetching code will only try up to 256 bytes. Modify the code to instead start at 512 bytes and work it's way down instead. As _DDC is now called up to 4 times on a machine debugging messages are noisier than necessary. Decrease from info to debug. Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/Apx_B_Video_Extensions/output-device-specific-methods.html#ddc-return-the-edid-for-this-device Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> [ rjw: Type mismatch fix, minor whitespace adjustment ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
54be6c6c5a
commit
5d389afc1f
@ -612,7 +612,7 @@ acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
acpi_video_device_EDID(struct acpi_video_device *device,
|
acpi_video_device_EDID(struct acpi_video_device *device,
|
||||||
union acpi_object **edid, ssize_t length)
|
union acpi_object **edid, int length)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
@ -625,13 +625,11 @@ acpi_video_device_EDID(struct acpi_video_device *device,
|
|||||||
|
|
||||||
if (!device)
|
if (!device)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (length == 128)
|
if (!length || (length % 128))
|
||||||
arg0.integer.value = 1;
|
|
||||||
else if (length == 256)
|
|
||||||
arg0.integer.value = 2;
|
|
||||||
else
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
arg0.integer.value = length / 128;
|
||||||
|
|
||||||
status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
|
status = acpi_evaluate_object(device->dev->handle, "_DDC", &args, &buffer);
|
||||||
if (ACPI_FAILURE(status))
|
if (ACPI_FAILURE(status))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -641,7 +639,8 @@ acpi_video_device_EDID(struct acpi_video_device *device,
|
|||||||
if (obj && obj->type == ACPI_TYPE_BUFFER)
|
if (obj && obj->type == ACPI_TYPE_BUFFER)
|
||||||
*edid = obj;
|
*edid = obj;
|
||||||
else {
|
else {
|
||||||
acpi_handle_info(device->dev->handle, "Invalid _DDC data\n");
|
acpi_handle_debug(device->dev->handle,
|
||||||
|
"Invalid _DDC data for length %d\n", length);
|
||||||
status = -EFAULT;
|
status = -EFAULT;
|
||||||
kfree(obj);
|
kfree(obj);
|
||||||
}
|
}
|
||||||
@ -1447,7 +1446,6 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
|
|||||||
|
|
||||||
for (i = 0; i < video->attached_count; i++) {
|
for (i = 0; i < video->attached_count; i++) {
|
||||||
video_device = video->attached_array[i].bind_info;
|
video_device = video->attached_array[i].bind_info;
|
||||||
length = 256;
|
|
||||||
|
|
||||||
if (!video_device)
|
if (!video_device)
|
||||||
continue;
|
continue;
|
||||||
@ -1478,18 +1476,14 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = acpi_video_device_EDID(video_device, &buffer, length);
|
for (length = 512; length > 0; length -= 128) {
|
||||||
|
|
||||||
if (ACPI_FAILURE(status) || !buffer ||
|
|
||||||
buffer->type != ACPI_TYPE_BUFFER) {
|
|
||||||
length = 128;
|
|
||||||
status = acpi_video_device_EDID(video_device, &buffer,
|
status = acpi_video_device_EDID(video_device, &buffer,
|
||||||
length);
|
length);
|
||||||
if (ACPI_FAILURE(status) || !buffer ||
|
if (ACPI_SUCCESS(status))
|
||||||
buffer->type != ACPI_TYPE_BUFFER) {
|
break;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (!length)
|
||||||
|
continue;
|
||||||
|
|
||||||
*edid = buffer->buffer.pointer;
|
*edid = buffer->buffer.pointer;
|
||||||
return length;
|
return length;
|
||||||
|
Loading…
Reference in New Issue
Block a user