Skip to content

Commit c7c8937

Browse files
committed
ACPI: video: Handle fetching EDID as ACPI_TYPE_PACKAGE
JIRA: https://issues.redhat.com/browse/RHEL-114091 commit ebca08f Author: Gergo Koteles <soyer@irl.hu> Date: Mon, 31 Mar 2025 17:02:14 +0000 The _DDC method should return a buffer, or an integer in case of an error. But some Lenovo laptops incorrectly return EDID as buffer in ACPI package. Calling _DDC generates this ACPI Warning: ACPI Warning: \_SB.PCI0.GP17.VGA.LCD._DDC: Return type mismatch - \ found Package, expected Integer/Buffer (20240827/nspredef-254) Use the first element of the package to get the EDID buffer. The DSDT: Name (AUOP, Package (0x01) { Buffer (0x80) { ... } }) ... Method (_DDC, 1, NotSerialized) // _DDC: Display Data Current { If ((PAID == AUID)) { Return (AUOP) /* \_SB_.PCI0.GP17.VGA_.LCD_.AUOP */ } ElseIf ((PAID == IVID)) { Return (IVOP) /* \_SB_.PCI0.GP17.VGA_.LCD_.IVOP */ } ElseIf ((PAID == BOID)) { Return (BOEP) /* \_SB_.PCI0.GP17.VGA_.LCD_.BOEP */ } ElseIf ((PAID == SAID)) { Return (SUNG) /* \_SB_.PCI0.GP17.VGA_.LCD_.SUNG */ } Return (Zero) } 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 Cc: stable@vger.kernel.org Fixes: c6a8370 ("drm/amd/display: Fetch the EDID from _DDC if available for eDP") Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4085 Signed-off-by: Gergo Koteles <soyer@irl.hu> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Link: https://patch.msgid.link/61c3df83ab73aba0bc7a941a443cd7faf4cf7fb0.1743195250.git.soyer@irl.hu Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Mark Langsdorf <mlangsdo@redhat.com>
1 parent fdaeae8 commit c7c8937

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/acpi/acpi_video.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,6 +710,13 @@ acpi_video_device_EDID(struct acpi_video_device *device, void **edid, int length
710710

711711
obj = buffer.pointer;
712712

713+
/*
714+
* Some buggy implementations incorrectly return the EDID buffer in an ACPI package.
715+
* In this case, extract the buffer from the package.
716+
*/
717+
if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 1)
718+
obj = &obj->package.elements[0];
719+
713720
if (obj && obj->type == ACPI_TYPE_BUFFER) {
714721
*edid = kmemdup(obj->buffer.pointer, obj->buffer.length, GFP_KERNEL);
715722
ret = *edid ? obj->buffer.length : -ENOMEM;
@@ -719,7 +726,7 @@ acpi_video_device_EDID(struct acpi_video_device *device, void **edid, int length
719726
ret = -EFAULT;
720727
}
721728

722-
kfree(obj);
729+
kfree(buffer.pointer);
723730
return ret;
724731
}
725732

0 commit comments

Comments
 (0)