From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED5892192F2; Tue, 8 Apr 2025 11:35:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744112134; cv=none; b=DzaMCsRA1dy99zq+/ocTJdoxQnbK0/4W3XRpWGmNU2zDNl1cDen7efAOwjZOuXQLmPB/Gn2sYEf9uxSPAtktbx0bAN2WfhhB7y+5gtaRDXQjkg6iamyjUPCaVca1Q6dj6OZGy5aEgnWIMLpOtUH5EJae19vpGkOqgLRfDyBf5Ls= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744112134; c=relaxed/simple; bh=UXwViAboYL881URZzSl71xL0Rjx9w3qzHBT3a5QC9Io=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=j8oGlUKGOGnGBB6hbWHFc3dj6bvBAZPAFquhudAeRdZXY70RN9lyhguroTL4wTHruMKNMQYJ5pVHbAXFu1Q55Fz+uicKFOmUQ4OEpfdVu0uz5ooUE2rTl7WR3sFO8SYz/9dGex2oc1tPIC7stlKPvHdiQr8rMhIQM+SNkJORSBE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gBRdcxA8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gBRdcxA8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7B2D0C4CEE7; Tue, 8 Apr 2025 11:35:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744112133; bh=UXwViAboYL881URZzSl71xL0Rjx9w3qzHBT3a5QC9Io=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gBRdcxA8OXHlM3gZakEsNoJtLVf32YF1bLMLDGtfyGw7QQINy4B3QjMwud8oDwVae f5R7rIiGwleAjrrcM2CMtXHB1NomkjNJog3YxJbZdn5wnqGSTyZAslSNDVS+a1PYbC nn3PAoMcECUoGttYSqv5SI/2uZX1laD2WYQdrsdw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Gergo Koteles , Hans de Goede , Mario Limonciello , "Rafael J. Wysocki" Subject: [PATCH 6.14 689/731] ACPI: video: Handle fetching EDID as ACPI_TYPE_PACKAGE Date: Tue, 8 Apr 2025 12:49:46 +0200 Message-ID: <20250408104930.293948003@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104914.247897328@linuxfoundation.org> References: <20250408104914.247897328@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Gergo Koteles commit ebca08fef88febdb0a898cefa7c99b9e25b3a984 upstream. 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: c6a837088bed ("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 Reviewed-by: Hans de Goede Reviewed-by: Mario Limonciello Link: https://patch.msgid.link/61c3df83ab73aba0bc7a941a443cd7faf4cf7fb0.1743195250.git.soyer@irl.hu Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/acpi/acpi_video.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -648,6 +648,13 @@ acpi_video_device_EDID(struct acpi_video obj = buffer.pointer; + /* + * Some buggy implementations incorrectly return the EDID buffer in an ACPI package. + * In this case, extract the buffer from the package. + */ + if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count == 1) + obj = &obj->package.elements[0]; + if (obj && obj->type == ACPI_TYPE_BUFFER) { *edid = kmemdup(obj->buffer.pointer, obj->buffer.length, GFP_KERNEL); ret = *edid ? obj->buffer.length : -ENOMEM; @@ -657,7 +664,7 @@ acpi_video_device_EDID(struct acpi_video ret = -EFAULT; } - kfree(obj); + kfree(buffer.pointer); return ret; }