From patchwork Mon Apr 8 05:05:56 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: 13620583 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 5E52ACD128A for ; Mon, 8 Apr 2024 05:14:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 94AD5112050; Mon, 8 Apr 2024 05:14:30 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="J58yT7Bq"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1ACC810F799 for ; Mon, 8 Apr 2024 05:14:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712553268; x=1744089268; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=F8IVLzvpzQ5q1lL/iJppNJOaJsl4bDmA5UweQyGN3pA=; b=J58yT7BqU01kZ6YCSghB87DJibpgu+MFBdA70i1hUlEpuNrRo5H1euEr svdYE0iSvtUi/akeEpuIdQ2ReaeLzy9riPZbriF4WnhHIe2amU9YSVgoZ YzxRLT4sqiurSbVnj44LIRoUibKkVZ1LBYhtjhlJ75qXAGAX3axaVEVNh P9vdeURgjgQ+odYBuYCF0QjGcbWzt/70bgF5cA2zCrIcN3hg/2GfvIG67 6DJGVuuU/RqpHB/AvlFhqXIEH5pz276D1bBK+aBMqsWpsZQlE53jugeed i7nks04ew/zxI1/CwjhY4j/Xf6DsgJFob0TzOqKQIpnlnsXtUo+9xRPDW w==; X-CSE-ConnectionGUID: OAa4qznXT52GSFgw+fY1nA== X-CSE-MsgGUID: zpf0CJM/RWaAvv+XT/ZfQg== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="18429006" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="18429006" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2024 22:14:28 -0700 X-CSE-ConnectionGUID: 6mtbiNHjQKKB/IuQKHEiEw== X-CSE-MsgGUID: QTERfjG/QFCndMwTWvLvGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="24401485" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2024 22:14:27 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 1/3] drm/i915/lspcon: Separate out function to get expected mode Date: Mon, 8 Apr 2024 10:35:56 +0530 Message-Id: <20240408050558.865396-2-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240408050558.865396-1-ankit.k.nautiyal@intel.com> References: <20240408050558.865396-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" Reuse code to wake native aux channel and get the expected lspcon mode. Signed-off-by: Ankit Nautiyal Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_lspcon.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c index 1d048fa98561..36e8d9fb2bbb 100644 --- a/drivers/gpu/drm/i915/display/intel_lspcon.c +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c @@ -240,6 +240,13 @@ static bool lspcon_wake_native_aux_ch(struct intel_lspcon *lspcon) return true; } +static +enum drm_lspcon_mode lspcon_get_expected_mode(struct intel_lspcon *lspcon) +{ + return lspcon_wake_native_aux_ch(lspcon) ? + DRM_LSPCON_MODE_PCON : DRM_LSPCON_MODE_LS; +} + static bool lspcon_probe(struct intel_lspcon *lspcon) { int retry; @@ -249,9 +256,7 @@ static bool lspcon_probe(struct intel_lspcon *lspcon) 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; - + expected_mode = lspcon_get_expected_mode(lspcon); /* Lets probe the adaptor and check its type */ for (retry = 0; retry < 6; retry++) { if (retry) @@ -713,12 +718,9 @@ void lspcon_resume(struct intel_digital_port *dig_port) } } - if (lspcon_wake_native_aux_ch(lspcon)) { - expected_mode = DRM_LSPCON_MODE_PCON; + expected_mode = lspcon_get_expected_mode(lspcon); + if (expected_mode == DRM_LSPCON_MODE_PCON) lspcon_resume_in_pcon_wa(lspcon); - } else { - expected_mode = DRM_LSPCON_MODE_LS; - } if (lspcon_wait_mode(lspcon, expected_mode) == DRM_LSPCON_MODE_PCON) return; From patchwork Mon Apr 8 05:05:57 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: 13620584 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 C2AAFC67861 for ; Mon, 8 Apr 2024 05:14:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 109D0112068; Mon, 8 Apr 2024 05:14:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="Juh0Jipv"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 73E4510F5D1 for ; Mon, 8 Apr 2024 05:14:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712553269; x=1744089269; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=7NFdnI8RpQ0eCx8hWYOR7faGXoLhbGblNz/QS52evLA=; b=Juh0JipvkzaFZ6hM3E4ToEMvpdrwcwrQlllTTmj+JKwiQN1DmraNRftQ A741Lp7o34vxyqW/heIPX4jtFRQuRHjCw9nkeT5cwkmGXFu0Vepl3Tjzb zDgMwY58pJWd6v/dIBr4rP7U8xj3KIMBCW8ipVPBsdkJCWSD60UFZ3WO+ B6s/9RIi/a6aAZq31kKiDinO1aUQ6OZtnZiGIE8LrCaJCksvJyLg6ES9u w8F+4tSqMQh7NUCev2lO+aiWxmXnAFyEEyNlyJUTpgTz3f9wmgeZvNcha zM8100sF+GaERepxRDHkDukfNUI4o9oSvyPb+ZAvn5u57D7NE8aUQcWBk Q==; X-CSE-ConnectionGUID: N4LPEc21StSS+cXANvCJMg== X-CSE-MsgGUID: ERcrhs7oTN+VcDAFwNxhzQ== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="18429010" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="18429010" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2024 22:14:29 -0700 X-CSE-ConnectionGUID: y2nz0l7fT2q9AM9Po4P3lw== X-CSE-MsgGUID: e+gGykWASDSoAR/+Xj5AMw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="24401486" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2024 22:14:28 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 2/3] drm/i915/lspcon: Separate out function to set pcon mode Date: Mon, 8 Apr 2024 10:35:57 +0530 Message-Id: <20240408050558.865396-3-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240408050558.865396-1-ankit.k.nautiyal@intel.com> References: <20240408050558.865396-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 lspcon_probe tries to probe for LSPCON and also set the PCON mode on the LSPCON. If any of these fails, it returns fail resulting in error message. So even if there is nothing connected to LSPCON port we get error messages for probe failure. Separate out the function to set pcon mode from the lspcon_probe function, and show the error message only when the set pcon mode fails. Do not show error message if no LSPCON is detected. Signed-off-by: Ankit Nautiyal Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_lspcon.c | 24 ++++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c index 36e8d9fb2bbb..16ee0dc179f7 100644 --- a/drivers/gpu/drm/i915/display/intel_lspcon.c +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c @@ -277,17 +277,22 @@ static bool lspcon_probe(struct intel_lspcon *lspcon) drm_dbg_kms(&i915->drm, "LSPCON detected\n"); lspcon->mode = lspcon_wait_mode(lspcon, expected_mode); + return true; +} + +static bool lspcon_set_pcon_mode(struct intel_lspcon *lspcon) +{ /* * 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; - } - } + if (lspcon->mode == DRM_LSPCON_MODE_PCON) + return true; + + if (lspcon_change_mode(lspcon, DRM_LSPCON_MODE_PCON) < 0) + return false; + return true; } @@ -671,8 +676,11 @@ 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"); + if (!lspcon_probe(lspcon)) + return false; + + if (!lspcon_set_pcon_mode(lspcon)) { + drm_err(&i915->drm, "LSPCON mode change to PCON failed\n"); return false; } From patchwork Mon Apr 8 05:05:58 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: 13620585 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 E17FBCD128A for ; Mon, 8 Apr 2024 05:14:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A51C410F799; Mon, 8 Apr 2024 05:14:31 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="TbgmZf5V"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 215A6112050 for ; Mon, 8 Apr 2024 05:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1712553270; x=1744089270; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=38rmfi60vTmWWgEOKXmuinCgj+zkmAHMpDFxMQHObks=; b=TbgmZf5VwEy5zJCCzOcBMXAyhoAHw37/kNInZGHCG+U3WVGxuqo/RMzb EOsutRI5SJV2l88XOmSl1QdkW+eSiF/ATjUtSaaIV2QeWhiqv23jQhG4D 6iEIhHORjKavqc0jjvq/Qy4/WTsu7mwl+luKbZEunDvI1Ljs7EhnU7p/i xthPipjSpQIUpG19ztFUQ8js2Ei/EiKwpzcMJgTooWyopfdf62BwK1eTP 5Bx1aTFoon57jGk/PKnd66Lym1xa9lW9O1LfMUrylVV/Q70qdsyC6PRHh lUqGYD0W5PQwJWvvosFamGc74mqkJwu3YydmNiXtjD5zctyn2DOsIRx+s A==; X-CSE-ConnectionGUID: mzzGo1KISMW32Eab9jFppw== X-CSE-MsgGUID: yeeDQED2S7e41qTGOaahzA== X-IronPort-AV: E=McAfee;i="6600,9927,11037"; a="18429011" X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="18429011" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2024 22:14:30 -0700 X-CSE-ConnectionGUID: R7uVmquJQ5yut7TUZ7E6CQ== X-CSE-MsgGUID: y0kjym3GTPqVP/MWEfvDLw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,186,1708416000"; d="scan'208";a="24401487" Received: from srr4-3-linux-103-aknautiy.iind.intel.com ([10.223.34.160]) by fmviesa004-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2024 22:14:29 -0700 From: Ankit Nautiyal To: intel-gfx@lists.freedesktop.org Subject: [PATCH 3/3] drm/915/lspcon: Reduce dmesg errors during lspcon_init failure Date: Mon, 8 Apr 2024 10:35:58 +0530 Message-Id: <20240408050558.865396-4-ankit.k.nautiyal@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240408050558.865396-1-ankit.k.nautiyal@intel.com> References: <20240408050558.865396-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 lspcon_resume calls lspcon_init and in case of failure we get error messages from lspcon_init and then again from lspcon_resume. Just have a single error message in lspcon_init and convert all other errors as dbg messages. Signed-off-by: Ankit Nautiyal Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/display/intel_lspcon.c | 27 +++++++++++---------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_lspcon.c b/drivers/gpu/drm/i915/display/intel_lspcon.c index 16ee0dc179f7..3c3bc80e32f0 100644 --- a/drivers/gpu/drm/i915/display/intel_lspcon.c +++ b/drivers/gpu/drm/i915/display/intel_lspcon.c @@ -680,24 +680,30 @@ bool lspcon_init(struct intel_digital_port *dig_port) return false; if (!lspcon_set_pcon_mode(lspcon)) { - drm_err(&i915->drm, "LSPCON mode change to PCON failed\n"); - return false; + drm_dbg_kms(&i915->drm, "LSPCON mode change to PCON failed\n"); + 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; + drm_dbg_kms(&i915->drm, "LSPCON DPCD read failed\n"); + goto lspcon_init_failed; } if (!lspcon_detect_vendor(lspcon)) { - drm_err(&i915->drm, "LSPCON vendor detection failed\n"); - return false; + drm_dbg_kms(&i915->drm, "LSPCON vendor detection failed\n"); + 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, @@ -718,13 +724,8 @@ void lspcon_resume(struct intel_digital_port *dig_port) if (!intel_bios_encoder_is_lspcon(dig_port->base.devdata)) 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)); - return; - } - } + if (!lspcon->active && !lspcon_init(dig_port)) + return; expected_mode = lspcon_get_expected_mode(lspcon); if (expected_mode == DRM_LSPCON_MODE_PCON)