Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F2B0AFD3747 for ; Wed, 25 Feb 2026 12:20:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6020010E766; Wed, 25 Feb 2026 12:20:12 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.b="eZLTLM0p"; dkim-atps=neutral Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by gabe.freedesktop.org (Postfix) with ESMTPS id 348B210E767; Wed, 25 Feb 2026 12:20:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=CkDaCqCvFcb8/v5XBFM7wb0WjYn53MLeOZSbNpvbNoQ=; b=eZLTLM0p9naQnE8ZHjt9uPDWJj 1ki5J4URi30ImiO6IQGh4lvw/JGFuyX6hx0ZmHfWOBBPx+JWiq8y4IzszdqKxC6Hj7LumUpoTVEMM +53fOeDvrJNqZIqJtOh/jG38ewslS3mqknmXuR079L9VyE5nvWg85kHYh/BXGbJwqHeta78oQwJbv PlLd9u/fvmkS0B6KaqCc5M3dWZ3/JFlqrv7Y77fsS5DMHWojQ97/lg7Da/4w0w6rL3RiAZ4pwR04w 7FTOER/e+ZcTlNMHCRTR2dM6lGy2yGlUilCuDRkHuSUQNhHqTBsKdlsrtGcw7E1eTgF4SK7fBa2O2 sy+jQs1g==; Received: from [186.208.68.119] (helo=killbill.home) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1vvDrv-005DpP-Bv; Wed, 25 Feb 2026 13:19:55 +0100 From: Melissa Wen To: airlied@gmail.com, alexander.deucher@amd.com, alex.hung@amd.com, andrzej.hajda@intel.com, christian.koenig@amd.com, harry.wentland@amd.com, jernej.skrabec@gmail.com, jonas@kwiboo.se, Laurent.pinchart@ideasonboard.com, maarten.lankhorst@linux.intel.com, mario.limonciello@amd.com, mripard@kernel.org, mwen@igalia.com, neil.armstrong@linaro.org, rfoss@kernel.org, simona@ffwll.ch, siqueira@igalia.com, sunpeng.li@amd.com, tzimmermann@suse.de Cc: Jani Nikula , Michel Daenzer , =?UTF-8?q?Timur=20Krist=C3=B3f?= , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, kernel-dev@igalia.com Subject: [PATCH v8 7/8] drm/amd/display: get SAD from drm_eld when parsing EDID caps Date: Wed, 25 Feb 2026 09:04:36 -0300 Message-ID: <20260225121903.236115-8-mwen@igalia.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260225121903.236115-1-mwen@igalia.com> References: <20260225121903.236115-1-mwen@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm_edid_connector_update() updates display info, filling ELD with audio info from Short-Audio Descriptors in the last step of update_dislay_info(). Our goal is stopping using raw edid, so we can extract SAD from drm_eld instead of access raw edid to get audio caps. Reviewed-by: Mario Limonciello Reviewed-by: Timur Kristóf Signed-off-by: Melissa Wen --- .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c index 7cef16ed2eb9..519b80f43b90 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include "dm_services.h" @@ -107,9 +108,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( struct edid *edid_buf = edid ? (struct edid *) edid->raw_edid : NULL; const struct drm_edid *drm_edid; struct drm_edid_product_id product_id; - struct cea_sad *sads; - int sad_count = -1; - int sadb_count = -1; + int sad_count, sadb_count; int i = 0; uint8_t *sadb = NULL; enum dc_edid_status result = EDID_OK; @@ -123,6 +122,7 @@ enum dc_edid_status dm_helpers_parse_edid_caps( if (!drm_edid_valid(drm_edid)) result = EDID_BAD_CHECKSUM; + drm_edid_connector_update(connector, drm_edid); drm_edid_get_product_id(drm_edid, &product_id); edid_caps->manufacturer_id = product_id.manufacturer_name; @@ -143,19 +143,22 @@ enum dc_edid_status dm_helpers_parse_edid_caps( apply_edid_quirks(dev, drm_edid, edid_caps); - sad_count = drm_edid_to_sad((struct edid *) edid->raw_edid, &sads); + sad_count = drm_eld_sad_count(connector->eld); if (sad_count <= 0) { goto cleanup; } edid_caps->audio_mode_count = min(sad_count, DC_MAX_AUDIO_DESC_COUNT); for (i = 0; i < edid_caps->audio_mode_count; ++i) { - struct cea_sad *sad = &sads[i]; + struct cea_sad sad; - edid_caps->audio_modes[i].format_code = sad->format; - edid_caps->audio_modes[i].channel_count = sad->channels + 1; - edid_caps->audio_modes[i].sample_rate = sad->freq; - edid_caps->audio_modes[i].sample_size = sad->byte2; + if (drm_eld_sad_get(connector->eld, i, &sad) < 0) + continue; + + edid_caps->audio_modes[i].format_code = sad.format; + edid_caps->audio_modes[i].channel_count = sad.channels + 1; + edid_caps->audio_modes[i].sample_rate = sad.freq; + edid_caps->audio_modes[i].sample_size = sad.byte2; } sadb_count = drm_edid_to_speaker_allocation((struct edid *) edid->raw_edid, &sadb); @@ -170,7 +173,6 @@ enum dc_edid_status dm_helpers_parse_edid_caps( else edid_caps->speaker_flags = DEFAULT_SPEAKER_LOCATION; - kfree(sads); kfree(sadb); cleanup: -- 2.51.0