From patchwork Fri Mar 22 12:18:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13600034 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 2C48EC54E71 for ; Fri, 22 Mar 2024 12:24:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6103510E411; Fri, 22 Mar 2024 12:24:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="YhzKjwof"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7929410E411 for ; Fri, 22 Mar 2024 12:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711110293; x=1742646293; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=HjOtljFlVe6RqH9ji9IDuTV699YhRvvhG5Rv6bzSYMY=; b=YhzKjwofY1rJ8iEdiEtvSnPMsUxTv6cHs8WPHi5suI+sxsWmPWhycPRT ts0Z8/KiJMPU5J5VgAVDEB9b8BjDh5kEhCx8OZzre1SRttXrez/6XtPPb GUNnNtYjzsq6T5ADBFx+h4RT/mwYdRXKMe2QMA/J4P/afbJxFWCSYaTQw pIpAowaYyKpyWDkiXMVYWbdfBmv1WNs2cTxpxd+4BSFLjmpZo5z5QBd3l /3MtbSv77dervKL/voqDZwRPNAMgP1iGPK+dCo4PC7DXXjQyRIQhgrvfn pn0eYT7wfvxit2vjnRuoAMuK2p7Y9SQGpbiEETISKOhcX/s9cr3zMLtQq A==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="6281198" X-IronPort-AV: E=Sophos;i="6.07,146,1708416000"; d="scan'208";a="6281198" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2024 05:24:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,146,1708416000"; d="scan'208";a="15322036" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2024 05:24:51 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/2] drm/i915/lspcon: Separate function to set expected mode Date: Fri, 22 Mar 2024 17:48:31 +0530 Message-Id: <20240322121832.4170061-2-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240322121832.4170061-1-ankit.k.nautiyal@intel.com> References: <20240322121832.4170061-1-ankit.k.nautiyal@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" LSPCON can be configured to LS or PCON mode. Separate the function to set the expected mode from the lspcon probe function during lspcon init. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_lspcon.c | 47 ++++++++++++++------- 1 file changed, 31 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c index 1d048fa98561..62159d3ead56 100644 --- a/drivers/gpu/drm/i915/display/intel_lspcon.c +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c @@ -240,18 +240,40 @@ static bool lspcon_wake_native_aux_ch(struct intel_lspcon *lspcon) return true; } -static bool lspcon_probe(struct intel_lspcon *lspcon) +static bool lspcon_set_expected_mode(struct intel_lspcon *lspcon) { - int retry; - enum drm_dp_dual_mode_type adaptor_type; struct intel_dp *intel_dp = lspcon_to_intel_dp(lspcon); struct drm_i915_private *i915 = dp_to_i915(intel_dp); - struct i2c_adapter *ddc = &intel_dp->aux.ddc; enum drm_lspcon_mode expected_mode; expected_mode = lspcon_wake_native_aux_ch(lspcon) ? DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS; + lspcon->mode = lspcon_wait_mode(lspcon, expected_mode); + + /* + * In the SW state machine, lets Put LSPCON in PCON mode only. + * In this way, it will work with both HDMI 1.4 sinks as well as HDMI + * 2.0 sinks. + */ + if (lspcon->mode != DRM_LSPCON_MODE_PCON) { + if (lspcon_change_mode(lspcon, DRM_LSPCON_MODE_PCON) < 0) { + drm_err(&i915->drm, "LSPCON mode change to PCON failed\n"); + return false; + } + } + + return true; +} + +static bool lspcon_probe(struct intel_lspcon *lspcon) +{ + int retry; + enum drm_dp_dual_mode_type adaptor_type; + struct intel_dp *intel_dp = lspcon_to_intel_dp(lspcon); + struct drm_i915_private *i915 = dp_to_i915(intel_dp); + struct i2c_adapter *ddc = &intel_dp->aux.ddc; + /* Lets probe the adaptor and check its type */ for (retry = 0; retry < 6; retry++) { if (retry) @@ -270,19 +292,7 @@ static bool lspcon_probe(struct intel_lspcon *lspcon) /* Yay ... got a LSPCON device */ drm_dbg_kms(&i915->drm, "LSPCON detected\n"); - lspcon->mode = lspcon_wait_mode(lspcon, expected_mode); - /* - * In the SW state machine, lets Put LSPCON in PCON mode only. - * In this way, it will work with both HDMI 1.4 sinks as well as HDMI - * 2.0 sinks. - */ - if (lspcon->mode != DRM_LSPCON_MODE_PCON) { - if (lspcon_change_mode(lspcon, DRM_LSPCON_MODE_PCON) < 0) { - drm_err(&i915->drm, "LSPCON mode change to PCON failed\n"); - return false; - } - } return true; } @@ -671,6 +681,11 @@ bool lspcon_init(struct intel_digital_port *dig_port) return false; } + if (!lspcon_set_expected_mode(lspcon)) { + drm_err(&i915->drm, "LSPCON Set expected Mode failed\n"); + return false; + } + if (drm_dp_read_dpcd_caps(&intel_dp->aux, intel_dp->dpcd) != 0) { drm_err(&i915->drm, "LSPCON DPCD read failed\n"); return false; From patchwork Fri Mar 22 12:18:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nautiyal, Ankit K" X-Patchwork-Id: 13600033 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 E7344C47DD9 for ; Fri, 22 Mar 2024 12:24:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 31C4510E3B2; Fri, 22 Mar 2024 12:24:54 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="FK7S9DYf"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id A0D7A10E3B2 for ; Fri, 22 Mar 2024 12:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1711110294; x=1742646294; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=hvGWrwDzvE0P8RHKx7UXP2xMBzYnN06qzuYysZ6IAKg=; b=FK7S9DYfeLvxX0QusAYj2ABr35FV/8nbUrpvBOwoepO5G8RZ7Jrtww3l CpVPk7DD2BSxGM+7HDkXWG+DguIzjTLAsBKiwRT6nnpMwS9sBZryJUVmW XwTItHOE+od/cbYYofdnvWAilyWqIzXptSw1ndWxSAe1k597pvSTtSUpG AxzDvbmVSyWx6AMiJtWeH6z8Xy+5lRIT4yjGYikaj5GzJDK+80tX5NxtW uZTUoZD5Qi4dREhugkuln69q4POE5pxCtPDYhgmvJ0YPBvHDYM06ReTZb 0EE02qU2RLqLiW+AKruh0mvIJEZWWq2lnTex40XMP4atVgwQEGz0uvXJS w==; X-IronPort-AV: E=McAfee;i="6600,9927,11020"; a="6281202" X-IronPort-AV: E=Sophos;i="6.07,146,1708416000"; d="scan'208";a="6281202" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2024 05:24:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,146,1708416000"; d="scan'208";a="15322042" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Mar 2024 05:24:53 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 2/2] drm/i915/lspcon: Separate lspcon probe and lspcon init Date: Fri, 22 Mar 2024 17:48:32 +0530 Message-Id: <20240322121832.4170061-3-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240322121832.4170061-1-ankit.k.nautiyal@intel.com> References: <20240322121832.4170061-1-ankit.k.nautiyal@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" Currently we probe for lspcon, inside lspcon init. Which does 2 things: probe the lspcon and set the expected LS/PCON mode. If there is no lspcon connected, the probe expectedly fails and results in error message. This inturn gets propogated to lspcon init and we get again error message for lspcon init failure. Separate the probe function and avoid displaying error if probe fails. If probe succeeds, only then start lspcon init and set the expected LS/PCON mode as first step. While at it move the drm_err message in lspcon init, instead of the caller. Signed-off-by: Ankit Nautiyal --- drivers/gpu/drm/i915/display/intel_dp.c | 3 +++ drivers/gpu/drm/i915/display/intel_lspcon.c | 27 +++++++++++---------- drivers/gpu/drm/i915/display/intel_lspcon.h | 1 + 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp.c b/drivers/gpu/drm/i915/display/intel_dp.c index 94fa34f77cf0..ea8d3e70127e 100644 --- a/drivers/gpu/drm/i915/display/intel_dp.c +++ b/drivers/gpu/drm/i915/display/intel_dp.c @@ -5882,6 +5882,9 @@ intel_dp_connector_register(struct drm_connector *connector) * ToDo: Clean this up to handle lspcon init and resume more * efficiently and streamlined. */ + if (!lspcon_probe(lspcon)) + return ret; + if (lspcon_init(dig_port)) { lspcon_detect_hdr_capability(lspcon); if (lspcon->hdr_supported) diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c index 62159d3ead56..570fde848d00 100644 --- a/drivers/gpu/drm/i915/display/intel_lspcon.c +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c @@ -266,7 +266,7 @@ static bool lspcon_set_expected_mode(struct intel_lspcon *lspcon) return true; } -static bool lspcon_probe(struct intel_lspcon *lspcon) +bool lspcon_probe(struct intel_lspcon *lspcon) { int retry; enum drm_dp_dual_mode_type adaptor_type; @@ -676,30 +676,31 @@ bool lspcon_init(struct intel_digital_port *dig_port) lspcon->active = false; lspcon->mode = DRM_LSPCON_MODE_INVALID; - if (!lspcon_probe(lspcon)) { - drm_err(&i915->drm, "Failed to probe lspcon\n"); - return false; - } - if (!lspcon_set_expected_mode(lspcon)) { drm_err(&i915->drm, "LSPCON Set expected Mode failed\n"); - return false; + goto lspcon_init_failed; } if (drm_dp_read_dpcd_caps(&intel_dp->aux, intel_dp->dpcd) != 0) { drm_err(&i915->drm, "LSPCON DPCD read failed\n"); - return false; + goto lspcon_init_failed; } if (!lspcon_detect_vendor(lspcon)) { drm_err(&i915->drm, "LSPCON vendor detection failed\n"); - return false; + goto lspcon_init_failed; } connector->ycbcr_420_allowed = true; lspcon->active = true; drm_dbg_kms(&i915->drm, "Success: LSPCON init\n"); return true; + +lspcon_init_failed: + drm_err(&i915->drm, "LSPCON init failed on port %c\n", + port_name(dig_port->base.port)); + + return false; } u32 intel_lspcon_infoframes_enabled(struct intel_encoder *encoder, @@ -721,11 +722,11 @@ void lspcon_resume(struct intel_digital_port *dig_port) return; if (!lspcon->active) { - if (!lspcon_init(dig_port)) { - drm_err(&i915->drm, "LSPCON init failed on port %c\n", - port_name(dig_port->base.port)); + if (!lspcon_probe(lspcon)) + return; + + if (!lspcon_init(dig_port)) return; - } } if (lspcon_wake_native_aux_ch(lspcon)) { diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.h b/drivers/gpu/drm/i915/display/intel_lspcon.h index e19e10492b05..b156cc6b3a23 100644 --- a/drivers/gpu/drm/i915/display/intel_lspcon.h +++ b/drivers/gpu/drm/i915/display/intel_lspcon.h @@ -16,6 +16,7 @@ struct intel_encoder; struct intel_lspcon; bool lspcon_init(struct intel_digital_port *dig_port); +bool lspcon_probe(struct intel_lspcon *lspcon); void lspcon_detect_hdr_capability(struct intel_lspcon *lspcon); void lspcon_resume(struct intel_digital_port *dig_port); void lspcon_wait_pcon_mode(struct intel_lspcon *lspcon);