From patchwork Fri Jan 12 07:41:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kandpal, Suraj" X-Patchwork-Id: 13518022 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 7BB26C4706C for ; Fri, 12 Jan 2024 07:43:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D795210EA86; Fri, 12 Jan 2024 07:43:43 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7434C10EA86 for ; Fri, 12 Jan 2024 07:43:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1705045422; x=1736581422; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SpWAwf74Rr6RQlBR0XppFZVnKeRr3A/xyCfzZhCZuZA=; b=MzE+NI+3S9wf93FFb6ENCJl0ZxVRDLhgSWD8fVhaOT+/6kh63cEb+hoP tScJi6tOc2JRH8WP8oiBsni5S0v4CoIQqHFLzFsWf31JFFDOCARaV9beh ElIkvLQMYyWgF3OwywDnEZwMOOMMn538IWJhFP+sECyFCf8wceEi0k5ha 4aRq+Z3g0MhELqBotb7UWd4Ja3/dXNh8l1rb3DxuSyxnlxJAbdIUqv+lZ /eH8i56jxw1I+bYvnKp8IHda/WPuKO8j9bzyFCFdAwU6pBXKlGq/0+fOP 7L1+RAsLlyOBUpTsvp6f2EBc0GFo6zuLF4cMfQwe139Y0P2uLMqKBaW9q Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10950"; a="5867059" X-IronPort-AV: E=Sophos;i="6.04,188,1695711600"; d="scan'208";a="5867059" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2024 23:43:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.04,188,1695711600"; d="scan'208";a="17317596" Received: from kandpal-x299-ud4-pro.iind.intel.com ([10.190.239.32]) by fmviesa002.fm.intel.com with ESMTP; 11 Jan 2024 23:43:40 -0800 From: Suraj Kandpal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 6/7] drm/i915/hdcp: Read Rxcaps for robustibility Date: Fri, 12 Jan 2024 13:11:19 +0530 Message-Id: <20240112074120.159797-7-suraj.kandpal@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240112074120.159797-1-suraj.kandpal@intel.com> References: <20240112074120.159797-1-suraj.kandpal@intel.com> MIME-Version: 1.0 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: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We see some monitors and docks report incorrect hdcp version and capability in first few reads so we read rx_caps three times before we conclude the monitor's or docks HDCP capability Signed-off-by: Suraj Kandpal --- drivers/gpu/drm/i915/display/intel_dp_hdcp.c | 22 ++++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c index eff2da976d2c..fce9b4e27f67 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_hdcp.c +++ b/drivers/gpu/drm/i915/display/intel_dp_hdcp.c @@ -651,20 +651,24 @@ int intel_dp_hdcp2_capable(struct intel_connector *connector, { struct drm_dp_aux *aux; u8 rx_caps[3]; - int ret; + int ret, i; aux = intel_dp_hdcp_get_aux(connector, remote_req); *capable = false; - ret = drm_dp_dpcd_read(aux, - DP_HDCP_2_2_REG_RX_CAPS_OFFSET, - rx_caps, HDCP_2_2_RXCAPS_LEN); - if (ret != HDCP_2_2_RXCAPS_LEN) - return ret >= 0 ? -EIO : ret; + for (i = 0; i < 3; i++) { + ret = drm_dp_dpcd_read(aux, + DP_HDCP_2_2_REG_RX_CAPS_OFFSET, + rx_caps, HDCP_2_2_RXCAPS_LEN); + if (ret != HDCP_2_2_RXCAPS_LEN) + return ret >= 0 ? -EIO : ret; - if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL && - HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2])) - *capable = true; + if (rx_caps[0] == HDCP_2_2_RX_CAPS_VERSION_VAL && + HDCP_2_2_DP_HDCP_CAPABLE(rx_caps[2])) { + *capable = true; + break; + } + } return 0; }