From patchwork Tue May 3 09:23:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jani Nikula X-Patchwork-Id: 12835404 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 4FD13C433F5 for ; Tue, 3 May 2022 09:25:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AD04110F821; Tue, 3 May 2022 09:25:08 +0000 (UTC) Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6EFF410F822 for ; Tue, 3 May 2022 09:25:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651569907; x=1683105907; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=vAz4hEvneVOC/eJPJl1JkMyCzrsy0rv4//Elp39fIyg=; b=dsiihRfC3D4YOhkAkwYIl07aenGVDRK4VJ4Wz7hdQf1X76fhCpZ8iKwa U6lH29PIYXnfqo3Km7ruSvgLPe9x4ASN+vtOqGGGyTvKymSiLViuvwdDs 2FbAsMEJ88N36vLEXxDgBEByv4TKjJo6Tvm/Ir4UT/94vKKSqt8sKrg9k PGAyCwcxAy6oHMud/I5wcXYvrNbrAa12LId/5yOKaoFj76GybyWxc5dy6 lLKN1rwyOxi5T9gSCM9v9D5CU04BP6Kb5MkPqT4ioSw3tESr2b0we7+6P kXN7elGbEMCX7by0CpFmwmrK6dZJq5y8i/Ju65Rl9LWTYVZUPoDJgqiwo g==; X-IronPort-AV: E=McAfee;i="6400,9594,10335"; a="327978562" X-IronPort-AV: E=Sophos;i="5.91,194,1647327600"; d="scan'208";a="327978562" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2022 02:25:07 -0700 X-IronPort-AV: E=Sophos;i="5.91,194,1647327600"; d="scan'208";a="562142254" Received: from jasinski-mobl1.ger.corp.intel.com (HELO localhost) ([10.249.133.126]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 May 2022 02:25:05 -0700 From: Jani Nikula To: intel-gfx@lists.freedesktop.org Date: Tue, 3 May 2022 12:23:56 +0300 Message-Id: X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Subject: [Intel-gfx] [PATCH v2 11/20] drm/edid: convert drm_detect_hdmi_monitor() to use cea db iter X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jani.nikula@intel.com Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Iterate through all CTA data blocks, not just the first CTA extension. Cc: Ville Syrjälä Signed-off-by: Jani Nikula --- drivers/gpu/drm/drm_edid.c | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 1ea27278652b..ca594d502941 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -5131,27 +5131,24 @@ EXPORT_SYMBOL(drm_av_sync_delay); */ bool drm_detect_hdmi_monitor(const struct edid *edid) { - const u8 *edid_ext; - int i; - int start_offset, end_offset; - - edid_ext = drm_find_cea_extension(edid); - if (!edid_ext) - return false; - - if (cea_db_offsets(edid_ext, &start_offset, &end_offset)) - return false; + const struct cea_db *db; + struct cea_db_iter iter; + bool hdmi = false; /* * Because HDMI identifier is in Vendor Specific Block, * search it from all data blocks of CEA extension. */ - for_each_cea_db(edid_ext, i, start_offset, end_offset) { - if (cea_db_is_hdmi_vsdb(&edid_ext[i])) - return true; + cea_db_iter_edid_begin(edid, &iter); + cea_db_iter_for_each(db, &iter) { + if (cea_db_is_hdmi_vsdb(db)) { + hdmi = true; + break; + } } + cea_db_iter_end(&iter); - return false; + return hdmi; } EXPORT_SYMBOL(drm_detect_hdmi_monitor);