From patchwork Fri Apr 8 06:52:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Almahallawy, Khaled" X-Patchwork-Id: 12806159 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 2FB56C433F5 for ; Fri, 8 Apr 2022 06:52:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4FD3110F81D; Fri, 8 Apr 2022 06:52:40 +0000 (UTC) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C51B10F81D; Fri, 8 Apr 2022 06:52:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1649400758; x=1680936758; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=cZqsgQb4S07zXarKn6un/N4G9uMUcM+dYhSDHpg1uSU=; b=Hi+v/so1fP2HwhRcTu/zo+JgTsie56E+0ktI/nOzJuo8IvTeZXe4MhMA DA+sBdP6cvYg2zijWKarjV/xOI2v8SeH/mf7Qq0wDphNTgOamwZ96lKc0 xadmJunYZy7ZCOkzJ9Spnx6GQZPM3spPTatMoaMvkOtUjUL53UOxxW9Kx fUZouseaD8W4yPEdInbhcd6vHGjcz0HOrFIrdyry73IWZZ6g3aBv3Vihf ejUF/SlI+vFmvdTRZK4qCIn+uRy1Yb0GNu4Wmoa6f/JOTvKbpsfjm+bAL p8C4BZo735U5h7cwc/opMEC1r/VPKVrPqd3WTKE9rb1G045+opPWGPwM/ w==; X-IronPort-AV: E=McAfee;i="6400,9594,10310"; a="261519494" X-IronPort-AV: E=Sophos;i="5.90,244,1643702400"; d="scan'208";a="261519494" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2022 23:52:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,244,1643702400"; d="scan'208";a="557668473" Received: from mrnys-mobl2.amr.corp.intel.com (HELO kialmah1-mobl1.amr.corp.intel.com.com) ([10.209.45.228]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2022 23:52:36 -0700 From: Khaled Almahallawy To: dri-devel@lists.freedesktop.org Date: Thu, 7 Apr 2022 23:52:32 -0700 Message-Id: <20220408065232.180146-1-khaled.almahallawy@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH] drm/dp: Don't rewrite link config when setting phy CTS test pattern with LTTPR 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-gfx@lists.freedesktop.org, Khaled Almahallawy Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The sequence for Source DP PHY CTS automation[1]: 1- Emulate successful Link Training 2- Short HPD and Change link rates and number of lanes 3- Short HPD and Change PHY test pattern and swing/pre-emp levels With DP PHY CTS setup as follow: [DPTX + on board LTTPR]------Main Link--->[Scope] ^ | | | | | ----------Aux Ch------>[Aux Emulator] Writing to LINK_BW_SET on a port that has LTTPR is an indication of the LT start for LTTPR [Check DP 2.0 E11 - Sec 3.6.8.2 & 3.6.8.6.3]. As LTTPR snoops LINK_BW_SET/LANE_COUNT_SET, it will stop sending DP signals to DP Scope causing the measurements to fail. This can be tested with a monitor connected to LTTPR port by writing to LINK_BW_SET as follow: igt/tools/dpcd_reg write --offset=0x100 --value 0x14 --device=2 OR printf '\x14' | sudo dd of=/dev/drm_dp_aux2 bs=1 count=1 conv=notrunc seek=$((0x100)) This single aux write causes the screen to blank, sending short HPD to DPTX, setting LINK_STATUS_UPDATE = 1 in DPCD 0x204, and triggering LT. However, sending the same aux write on a port without LTTPR (direct port to the monitor) has no effect. In the case of DP PHY CTS setup described above, the AUX emulator executes a script file of aux transactoins it sends to DPTX. For setting PHY pattern the relevant segment of the script looks like the following: # Set TEST_REQUEST (0x0218): PHY_TEST_PATTERN (0x0218.3) to 1 SetByte 0x218 0 SetBit 0x201 1 SetBit 0x218 3 # Set Test Pattern SetPattern # Trigger 1ms HPD Pulse HPDPulse 0x06 # Wait For 2 seconds Wait 2000000 MODULEEND After the aux emulator finish executing the above segment, the scope waits for the required pattern from DPTX to verify it is the right one and perform the measurements. No more aux transactions the AUX emulator will send. So, when DPTX update LINK_BW_SET/LANE_COUNT_SET, the LTTPR will stop the signals on the main link to DPRX/Scope in order to adjust rate and lane count it snooped and will wait for link training to start which will never happen given the script file for aux transactions already finished. The fix for this issue, is to not rewrite link config that is already done in step 2 by modeset, and just change PHY test patterns and swing/pre-emph levels. [1]: LTTPR Re-timer PHY test procedure proposal https://groups.vesa.org/wg/Link/document/16521 Cc: Imre Deak Cc: Jani Nikula Signed-off-by: Khaled Almahallawy --- drivers/gpu/drm/dp/drm_dp.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/drivers/gpu/drm/dp/drm_dp.c b/drivers/gpu/drm/dp/drm_dp.c index 580016a1b9eb..f72d48e59b89 100644 --- a/drivers/gpu/drm/dp/drm_dp.c +++ b/drivers/gpu/drm/dp/drm_dp.c @@ -2613,17 +2613,8 @@ int drm_dp_set_phy_test_pattern(struct drm_dp_aux *aux, struct drm_dp_phy_test_params *data, u8 dp_rev) { int err, i; - u8 link_config[2]; u8 test_pattern; - link_config[0] = drm_dp_link_rate_to_bw_code(data->link_rate); - link_config[1] = data->num_lanes; - if (data->enhanced_frame_cap) - link_config[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; - err = drm_dp_dpcd_write(aux, DP_LINK_BW_SET, link_config, 2); - if (err < 0) - return err; - test_pattern = data->phy_pattern; if (dp_rev < 0x12) { test_pattern = (test_pattern << 2) &