From patchwork Fri Jan 3 12:58:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 855034 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E87C71FA27F for ; Fri, 3 Jan 2025 12:58:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735909133; cv=none; b=Obuy3qETcPyPxQrebeWRI7g8f2tnZL3X1Z+CsCkWmV0cWBVv3PwXMVy2lproND3KrS8N/B4RTZPJn4wCIPLt4Cf7y0cDa1OhjbJUD2OHjeMrpbwE1ZYLoPjP1or0uG02Q+HxWISvcru0P9rXZ+ZNOTN/FJcOZZPgdYmRzb7juPA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735909133; c=relaxed/simple; bh=IAGUczkW072b8mGGChIWkavp4t+w24yTtaDV/z14qGY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bDFgkJ1zK1RjpojrSX1s+ppMO/fDzPrvkdm275rL4gI8ymsj3F+TrTO1hUHclNcrR5Ma1zp/798mTS9r7xhmN3r4hJoPsDS6BrmzkaDLrYWyA4BkqAtMacd/1kUsIpCpFQ3vTKkHcSLt24fmjJFzmPDp8+7xt5oA0labrJL4qso= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=SZkW3Dhr; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="SZkW3Dhr" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4368a293339so85430615e9.3 for ; Fri, 03 Jan 2025 04:58:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735909129; x=1736513929; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=OKAq3a0q8ySBqrMfqf9zRs6QOpHzCqi3UnYgQ6KB45c=; b=SZkW3Dhr2QXijy130+jLmKf9Jn3DaWExi/PaI4rKt3xTmopKx1XJCFn7/N+tyTYl4j MAjRY8gNwqeaQeEYE+XiRAUOMLHwiIX2d8FiCFLtjPZgfcErMkIBs/uqDz5ChM647w3m 24I5ydWj8cpYA/W4JMhR9lyjJ2L35vDPjQNSHt8EbNo8TTBShu/xXspf5WReO+IHCguz 3zaDZHi9FgKLRZ3gtag8qCYM3twYVoga/OQWKGg4DTRiSjjZjl1mybvgK43kR+qariMB zq+zeoAHViSWgRHuOqrAlnlKX2IgqV92Olaa5pa3vmOpHWAjk/pwK547ifBI5XId+eDF FOuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735909129; x=1736513929; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OKAq3a0q8ySBqrMfqf9zRs6QOpHzCqi3UnYgQ6KB45c=; b=DX6UVNc/BMF3XMWMv0MzyofiiMrRD/zu5cL7KE2itJjxz2+ruefC/KA7w2mnsSRP/G CQUWRF4jzLQKVo5ZHQyfrPufYE8SqvqkwOAQDbHxLUmiV26cA5FtrEmBQ2QlW8a8/Mm9 UyOd7LCiXAxT8zeENN1qq4FvCfgg+A67uAmojO5LjqkkhoyU3YqbD6AGFjsYvMvhP7Hj cXrBcMr9kScXJ6pb22Opb6qZpC0vYUwl0KrP/jlxFM3IbDrdP//NYldttlma2sME+pg4 r/0iZ7PAzQTNlh1+NDuYOGpN+ASCFJ4gFofz+Og/wlNeKGoCph3NkqKCy2nPpbOOE63y KjKQ== X-Forwarded-Encrypted: i=1; AJvYcCWVB7WAR7bLARmue9sddVF+2mezDcrCF/h3xgkViqlYW2zDg+d7uTFgkcswtOpLs/8mPmFDSIouLOPvBSE4@vger.kernel.org X-Gm-Message-State: AOJu0Yxef+AM67RuEoP0Ed+SlFNPZ4pWW5muBMk9zFnDwmetCNDjQbAX 9f7NWZRxtFQkGzjn9EPbzj1mmR1HOun35qdfOAeQYDXOyhzXcVt0SY7iJ9XnJxc= X-Gm-Gg: ASbGncsuv088lyomQWaWkNmAwTpbyN55uOykGBXnO9pR4KSEyvW1fTu2c1BvS3yX8d1 M11NiLyS7+59ntnAL/WHvNGUMQZGXHOHWTt90E9A0tz9nJklYZsrr1A9Mp3+cigsQf5ENWmDutI e9aK7wpWpKZKWnhUYhi0hMvaxL2WO0VQ/djDqXzOzKBQP47eg4rUSavKkrzX0l41urTP8OBLDWl 3oYMgmuEdjm0FoM1jVbjeyiGyO2rwP7lYbR0hQtGCGvsseRyySUczVq X-Google-Smtp-Source: AGHT+IHD8YK70XCWsS7Q8xW846WSlCt8IGnNQia/YfnRwEzKk1+3N50SwVA3xTK+T6w7X+CkkhvEfw== X-Received: by 2002:adf:b30c:0:b0:38a:4b8b:1ba with SMTP id ffacd0b85a97d-38a4b8b01d1mr16138981f8f.14.1735909129150; Fri, 03 Jan 2025 04:58:49 -0800 (PST) Received: from [127.0.1.1] ([86.121.162.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8acadcsm40225591f8f.105.2025.01.03.04.58.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 04:58:48 -0800 (PST) From: Abel Vesa Date: Fri, 03 Jan 2025 14:58:15 +0200 Subject: [PATCH v3 1/4] drm/dp: Add helper to set LTTPRs in transparent mode Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-1-5c367f4b0763@linaro.org> References: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-0-5c367f4b0763@linaro.org> In-Reply-To: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-0-5c367f4b0763@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Karol Herbst , Lyude Paul , Danilo Krummrich , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten Cc: Bjorn Andersson , Konrad Dybcio , Johan Hovold , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Abel Vesa , Johan Hovold X-Mailer: b4 0.15-dev-dedf8 X-Developer-Signature: v=1; a=openpgp-sha256; l=4243; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=IAGUczkW072b8mGGChIWkavp4t+w24yTtaDV/z14qGY=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBnd98AKCbN6HYV2+NFqGW7h5ppSXp32Xa6J/RTD a0btqWjPhuJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCZ3ffAAAKCRAbX0TJAJUV VggyD/4r5JoRIbCRjEq+MPJyTb4GwkaPFIb5NyhhsBjJZXXCUuYCS09PW1MGmb4pKaO5I1vX+fW a+a3Vh8RMMU0dR7yFgi/LATU68/SniAxsC3OBbPDECwT6XdIusMV77aoFVKyipSJ9gflsiBUN7U huB+z6rK663s0CGIOVrFtCSTuuB+ibyRD2VHWDx8ZyPBAdM6yv15S6u7MrLCGvcRZfX2/jMeJl1 3D70KtIzVXqXNy/CYN7H6DMWbu99oXMANZCHdYTQWGtxb6ODdhhXCl7n5iSUBSbX9gfX8/KEph+ v/tENqZ7PBV49JJ8WSrn2J4HZUePGn4He0aRdoKFbsRU1GfAnrpxDwSqlC2FAl/wp/eCVcRN7ZI PFbEKVvndTc2HUkKxUVOw74s63TDSBInqXXqjBH2/oUKNz4uB/NywN1Hg5IL8WBWtLiBjJG1Cmb DdTSbvbSkS1sTEFE8H1SM5bGxv2RBEPUoKOlJiYarux3+clnIZrJLhOicKyhLCA0E9C96Q+93CW pVnYkyYFN/aI/d06XbqYzEaONTNjir8o1GVo7O4WCjmKEk1LCPoso7V9sJ77ZVwdI3wLcqrWS4o t2k0YpThtHc0CkG2sXGtKyZXmYUEgDS2aromcAXcu/wjaguuahZIYnGMNUkERlL4ZT3ZnIsBa8o ZSsvi4Ypj24qAAw== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE According to the DisplayPort standard, LTTPRs have two operating modes: - non-transparent - it replies to DPCD LTTPR field specific AUX requests, while passes through all other AUX requests - transparent - it passes through all AUX requests. Switching between this two modes is done by the DPTX by issuing an AUX write to the DPCD PHY_REPEATER_MODE register. Add a generic helper that allows switching between these modes. Also add a generic wrapper for the helper that handles the explicit disabling of non-transparent mode and its disable->enable sequence mentioned in the DP Standard v2.0 section 3.6.6.1. Do this in order to move this handling out of the vendor specific driver implementation into the generic framework. Tested-by: Johan Hovold Signed-off-by: Abel Vesa --- drivers/gpu/drm/display/drm_dp_helper.c | 61 +++++++++++++++++++++++++++++++++ include/drm/display/drm_dp_helper.h | 2 ++ 2 files changed, 63 insertions(+) diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c index da3c8521a7fa7d3c9761377363cdd4b44ab1106e..0f665d9adf02cfd16f0c250eb7ae8fe0461f8fdd 100644 --- a/drivers/gpu/drm/display/drm_dp_helper.c +++ b/drivers/gpu/drm/display/drm_dp_helper.c @@ -2817,6 +2817,67 @@ int drm_dp_lttpr_max_link_rate(const u8 caps[DP_LTTPR_COMMON_CAP_SIZE]) } EXPORT_SYMBOL(drm_dp_lttpr_max_link_rate); +/** + * drm_dp_lttpr_set_transparent_mode - set the LTTPR in transparent mode + * @aux: DisplayPort AUX channel + * @enable: Enable or disable transparent mode + * + * Returns 0 on success or a negative error code on failure. + */ +int drm_dp_lttpr_set_transparent_mode(struct drm_dp_aux *aux, bool enable) +{ + u8 val = enable ? DP_PHY_REPEATER_MODE_TRANSPARENT : + DP_PHY_REPEATER_MODE_NON_TRANSPARENT; + int ret = drm_dp_dpcd_writeb(aux, DP_PHY_REPEATER_MODE, val); + + if (ret < 0) + return ret; + + return (ret == 1) ? 0 : -EIO; +} +EXPORT_SYMBOL(drm_dp_lttpr_set_transparent_mode); + +/** + * drm_dp_lttpr_init - init LTTPR transparency mode according to DP standard + * + * @aux: DisplayPort AUX channel + * @lttpr_count: Number of LTTPRs. Between 0 and 8, according to DP standard. + * Negative error code for any non-valid number. + * See drm_dp_lttpr_count(). + * + * Returns 0 on success or a negative error code on failure. + */ +int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count) +{ + int ret; + + if (!lttpr_count) + return 0; + + /* + * See DP Standard v2.0 3.6.6.1 about the explicit disabling of + * non-transparent mode and the disable->enable non-transparent mode + * sequence. + */ + ret = drm_dp_lttpr_set_transparent_mode(aux, true); + if (ret) + return ret; + + if (lttpr_count < 0) + return -ENODEV; + + /* + * Roll-back to tranparent mode if setting non-tranparent mode failed + */ + if (drm_dp_lttpr_set_transparent_mode(aux, false)) { + drm_dp_lttpr_set_transparent_mode(aux, true); + return -EINVAL; + } + + return 0; +} +EXPORT_SYMBOL(drm_dp_lttpr_init); + /** * drm_dp_lttpr_max_lane_count - get the maximum lane count supported by all LTTPRs * @caps: LTTPR common capabilities diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h index 8f4054a560396a43750570a8c2e95624039ab8ad..3311df3b58255cf0620391d0948ccf6b569a8a34 100644 --- a/include/drm/display/drm_dp_helper.h +++ b/include/drm/display/drm_dp_helper.h @@ -630,6 +630,8 @@ int drm_dp_read_lttpr_phy_caps(struct drm_dp_aux *aux, u8 caps[DP_LTTPR_PHY_CAP_SIZE]); int drm_dp_lttpr_count(const u8 cap[DP_LTTPR_COMMON_CAP_SIZE]); int drm_dp_lttpr_max_link_rate(const u8 caps[DP_LTTPR_COMMON_CAP_SIZE]); +int drm_dp_lttpr_set_transparent_mode(struct drm_dp_aux *aux, bool enable); +int drm_dp_lttpr_init(struct drm_dp_aux *aux, int lttpr_count); int drm_dp_lttpr_max_lane_count(const u8 caps[DP_LTTPR_COMMON_CAP_SIZE]); bool drm_dp_lttpr_voltage_swing_level_3_supported(const u8 caps[DP_LTTPR_PHY_CAP_SIZE]); bool drm_dp_lttpr_pre_emphasis_level_3_supported(const u8 caps[DP_LTTPR_PHY_CAP_SIZE]); From patchwork Fri Jan 3 12:58:16 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 854890 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F145F1F866F for ; Fri, 3 Jan 2025 12:58:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735909135; cv=none; b=ipAAvwZCa8l3tNPEpFetvPJin53vdDbZnMTVVfwm55Sl9dm4fopXjp+BQc7OM/QYpEbwyVB9IVGi4ZPDqD9ll9I1Jiyp08mly01o3WSYd6AQLGUjCyn57pdcciVztA3pHmWa/6fweOQsiW2pM0nPBm3MrfaKAPYuYvMtrIZBOWE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735909135; c=relaxed/simple; bh=zSpYhtCfdoGV8lx5sZ6QJCKOEoZaxgqNtvMuGie1uZU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tPmdH3RWOjUQah2KSQa8oOOw8dTxH49beOOCxrXlcDlxYZm7TvAnfuKHqCMjlVCdPxFnpuybIbE2qM1b9/LvP0kbKifwCWTCvYBWyR3X0cpFkfijJt4oAB/d+OSamhu9ctHYWtSIyGS/y1kblEnndVw7jyZAxoHuf7dTQu1Z11c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Udaxm0V2; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Udaxm0V2" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-435f8f29f8aso88834035e9.2 for ; Fri, 03 Jan 2025 04:58:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735909131; x=1736513931; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=8ja7AsPHVhh/ztffyEqltS3S3NOI8MWwC75cFS3zUfQ=; b=Udaxm0V2Zx0cNb/iCDGyA9CmcOVm4AMc6/bIfHQ9X8j+NxUQ01n9EazJMkEy7bc56B EdyD7TWoEQJkEAfNAg0Jls3Slq/eYvNuq4CUv2t/AsG4bwhTtTKi4pXSxO98JVaLuxw8 /Kvp0lZOwkI6frhmScrNY7VxFS43rIpoUuQWkU7K0F17/9OIzDPhJdV110J6OdQK1FsI FNaHDOePMJYZSd+GKjuHhWXMQz84ClWRHDHVsnUXutfDEpgU63UVQvFTORVzhoNKgM5P w7xjwGW00MZALjWf+vJw8ymKLhnV49hSUWKrgN9HQ92CX1q+4TzseOysn2Hft//rm2lV vNyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735909131; x=1736513931; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8ja7AsPHVhh/ztffyEqltS3S3NOI8MWwC75cFS3zUfQ=; b=ECx5bUd9LKBAEzOcZKtUqoozlt4JfgabPl6EGNeK8b3h1+CqlirbjSpifVMSVZJ/tG IgP3qkk3Tb1xpADA2xEp5ZWDkJxN0ObEe1wMN2NZ7smyk9UbVW3jDa9qZj896bG5bt7V jpSZNXkTWlj0Jy5JUeKqyLub1XvAyvR7P5cLycDrYpQmrt5hY9SuSZLMlCEEZDsjfYVV Q7sc6O/I1VLP6LI52qH7wUDexLUqmYHvgmfh6nh0ea8oAXlu8ZKc+Pj+4b7tVB/QJAlx 97yG82J7IdyZ+8S5aFM/zYRhCjEC8WGraHeOJG0RbhK4mwshnX7Iio2s455xhknRKNFS +VYg== X-Forwarded-Encrypted: i=1; AJvYcCXRc6adzf1aXTRcjn6BNy41w1NOyjb/hFon/ln1ZSzk8V4k3K4vOLiRokVOBuL0+HPh8SJcdVjgSeuwr0Xc@vger.kernel.org X-Gm-Message-State: AOJu0YyTP7iY2vZqd7BbtEwXMpTTlBFifsROWR60+826vt2ll6/rIesg 8sFoR8IXhWGVGZjpC/yJQ/oQhDH4Rx22QHEEitNmMSLqtwmgKjW1n283fKHkYyk= X-Gm-Gg: ASbGncv4UO7BzgUY5MmdbVsyheq0yWfEhfmlH1JIJy2j2QgBPqfC145zPqFITGtElA9 p9TWSSDrs9ycz+rnAq0Z3VFAXIxXZ1EmgLB4GxMRWIc/Ks+aBrIgVPcDbYnp5vAUJDRrt0lKza5 ltZ4FMNi9CSIkTYyaribIE/9fHj+U7YipIkL/c7qDdbHUPe52BlR15NrIDDymFRxeTdjTMHAOmE IGo6Qu6gdK4h+WbfoVHu6T7MLfkU/XuXWpC8wP24OaukJXj4UPoly+L X-Google-Smtp-Source: AGHT+IHuqDHnHcd3WF9fZflWdy+Epup29qUDvzgDke+6NvPjnNnt0l09UcQvUzjj7ALc15cgq9nQ7g== X-Received: by 2002:a05:6000:186e:b0:386:378c:b7ec with SMTP id ffacd0b85a97d-38a22405d3emr42892574f8f.58.1735909131268; Fri, 03 Jan 2025 04:58:51 -0800 (PST) Received: from [127.0.1.1] ([86.121.162.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8acadcsm40225591f8f.105.2025.01.03.04.58.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 04:58:50 -0800 (PST) From: Abel Vesa Date: Fri, 03 Jan 2025 14:58:16 +0200 Subject: [PATCH v3 2/4] drm/nouveau/dp: Use the generic helper to control LTTPR transparent mode Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-2-5c367f4b0763@linaro.org> References: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-0-5c367f4b0763@linaro.org> In-Reply-To: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-0-5c367f4b0763@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Karol Herbst , Lyude Paul , Danilo Krummrich , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten Cc: Bjorn Andersson , Konrad Dybcio , Johan Hovold , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Abel Vesa X-Mailer: b4 0.15-dev-dedf8 X-Developer-Signature: v=1; a=openpgp-sha256; l=1634; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=zSpYhtCfdoGV8lx5sZ6QJCKOEoZaxgqNtvMuGie1uZU=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBnd98By7+7V5W8HMUxlKldGyiQrYwuq4jO5Of1X B3VQSkyoXKJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCZ3ffAQAKCRAbX0TJAJUV VuApD/4qJrXPMuVFlu1Y3C0w2QBGNOwC8Kd1/O1an/dVPfDmHFzp1BN4X5XeV54FXsFUPl7z/Yv CLx7tlv9WL2kvIqM/n93QJkE67uOATYU1pcOPkmnQc8HZ+x5JN2QZgyD3saXpcv2UUEzEMlcxY/ KeZHgN4TKA7G4LZHG79/0tYd26xSR0HgOOpjD+ltQ8LCD9rF6zY4TAgCy3HgzrbQvBG8c++rQRA He8crsrdI25Xh1uXL+YuieNyNP6OwxpYfxbUcJNEbmfK66CDf7vHcbM8uyzR6+dq4DHof8D/VRv LL7F5L7VHvN5ysvlCRTuEBRaZ+k41TLkkCW2C2QABpXk/NE1Nc6honOz8l0kOnfxuKK6xqg+tgk 5h39FDZEaMvbkcz2JD/Cu6KfhgNiqMeY/UzReYHNDVoK71OdB2ogBcdujH8tCQAhHoE1t06Civ+ /x4fsT3oyE6IKfInlIDQq0rpK+4F6eDNwHFBJCCp0lIY6XWmTk1ehHrySv6zH3z2MbUJBNZsKQ2 GKQO9QF7w9OgfciGKtoKNptEilU9MO/yIyih95mVXG97xYdGt1QwZqD+MjLVoihfhl9SiavHziH VbIalr2poTpXTXVQZ67PSqmogwtYx5ba2nwdNhrOm9hu8tu2/sXkpgUb5g86pQo3WI98DUoS2ak dzODu9EtTIz9otA== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE LTTPRs operating modes are defined by the DisplayPort standard and the generic framework now provides a helper to switch between them, which is handling the explicit disabling of non-transparent mode and its disable->enable sequence mentioned in the DP Standard v2.0 section 3.6.6.1. So use the new drm generic helper instead as it makes the code a bit cleaner. Reviewed-by: Lyude Paul Signed-off-by: Abel Vesa --- drivers/gpu/drm/nouveau/nouveau_dp.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c index bcda0105160f1450df855281e0d932606a5095dd..55691ec44abaa53c84e73358e33df1949bb1e35c 100644 --- a/drivers/gpu/drm/nouveau/nouveau_dp.c +++ b/drivers/gpu/drm/nouveau/nouveau_dp.c @@ -79,21 +79,8 @@ nouveau_dp_probe_dpcd(struct nouveau_connector *nv_connector, !drm_dp_read_lttpr_common_caps(aux, dpcd, outp->dp.lttpr.caps)) { int nr = drm_dp_lttpr_count(outp->dp.lttpr.caps); - if (nr) { - drm_dp_dpcd_writeb(aux, DP_PHY_REPEATER_MODE, - DP_PHY_REPEATER_MODE_TRANSPARENT); - - if (nr > 0) { - ret = drm_dp_dpcd_writeb(aux, DP_PHY_REPEATER_MODE, - DP_PHY_REPEATER_MODE_NON_TRANSPARENT); - if (ret != 1) { - drm_dp_dpcd_writeb(aux, DP_PHY_REPEATER_MODE, - DP_PHY_REPEATER_MODE_TRANSPARENT); - } else { - outp->dp.lttpr.nr = nr; - } - } - } + if (!drm_dp_lttpr_init(aux, nr)) + outp->dp.lttpr.nr = nr; } ret = drm_dp_read_dpcd_caps(aux, dpcd); From patchwork Fri Jan 3 12:58:17 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 855033 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E3D61FAC3E for ; Fri, 3 Jan 2025 12:58:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735909137; cv=none; b=LnfWG09ydE1jOJauN+J+MUj7lVr4ZzFWITrrdFDp4JWSwYea+E2J38enY6pgafkxzOhSGQsBGSAotXvEYLfZNGHwsybmMi1byyQSPAU8iXZNnMRuZ28eVPNkZV3cdpvvgDWCGxPl+HttsG/Cb6+lpu98/TGJZ4P5hPDH9y5x9kA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735909137; c=relaxed/simple; bh=t7uWQZmvlqArOJmOhip0vxH0p5Ao0CcrYSITs3tqLBs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Z7CdQznDuk0qZ3jl0XJToO7WnPHHP6EDQLI+52kNP6lv/cMIN7j2qRMxBIOxTHKyr/WgGYrov6aHOn0CEsT4mcFefKsEkmvCyLZzk96lqrrziNKJ0ah1VotCFHjtFcvDA17ZTnkqQJPLYx4iMkQcm3wyEIda9gw2KBLfY7oyXnU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=CuXziwUz; arc=none smtp.client-ip=209.85.128.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CuXziwUz" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-436202dd7f6so138535055e9.0 for ; Fri, 03 Jan 2025 04:58:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735909133; x=1736513933; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YZpHTfSit5gO2Gh5m2JOOcpLY4DaYFIg1vpxWhNZbDk=; b=CuXziwUzophIYbXfPHuVVobOIaFhwG2dDoJgRrcnC5Gqnj0byFi8hifJ+QAEFZeLyu N1G5PW8OlSMk6MSa2wf41GV1jdJ8q/rtqd+UjvdKnchMLADHHdGIobdSPQwt7kzsBMvN V/ZIpnrE5w7MHvmrwaZgBFbOhJ86Hefxuf1jKpRi56m8LGFv7seDYCmgThM2hFY5XPgc q/k0pr6UcKnmlE/yxJryOgkxjwGKok7JISW/SHktH00406sVVgixpCtZVdg4p2zVPU5/ 7w/Xvd+YOzTquHN3Gf1lZA8GfphoPweD80D/taBa7XY5YH493h8ZKWMLgU6AFk/oHHWA myrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735909133; x=1736513933; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YZpHTfSit5gO2Gh5m2JOOcpLY4DaYFIg1vpxWhNZbDk=; b=kn0QAXMWfnie9PCp3ghSUTQW0jq67SPRrz+k464ZmYCaPy/+5/t0ZzsSHhs9ePvzjg 2fv+1uybHGjmUUi00kXW992O+9rOJRG2QcPAXyiw1+yiXjds3v39i5y9rUBgdAopKCDV Ap/1gKWHWZ8w4/6FtFyS+GUDgywixgQdQEVjNv3Al4eK3Xd0xF/pNeTIjTYcz+usDxmc rwPhVL2SQSBQwvimUMqAYQz77WrRhU/iUQ8pgu7zlSbi7INvxM+biURDfpcFRDnnD0fw Og7Ir+RQnJWt1j5/Y41qywc4FZT6EPKZSusQ3mIfx4t997605voBeBHQXOfWDKwFaP+o m0gg== X-Forwarded-Encrypted: i=1; AJvYcCVkWlEf5UX5urJffhZtZ3LsI5UXPmbxIYlhDwK8aUCtMt4746uS5BrM6aIAHHufjuToecS00Wt1w/IkK+AY@vger.kernel.org X-Gm-Message-State: AOJu0YwRnRwqVEcN0orKW6oQh8L8wGeDa18IjCGZw1V3uPuETFPNBVXT jocp+8W72X+WFCvPEpzqk7a9jzSQuT8UIa5T0GL5hsJbnrUoCordlKBefTELhrWTKPtJUNYvnkh H X-Gm-Gg: ASbGncs5+Ajvqh4XJwGdubNsUXvYVxE1FU6sU74cml+H9l4bnAFOHW3KLESrnFHC1+7 y96g+BNMhn2C3kjq429b37YfjuYSJPSAMvwAPIZq59ZRo1xBy7Rw2QefDWmLgHUW9nHtivk/ZeH dKrIzQKStVxXu1sByYNt58n++DrD6+2VLH0WZgg3XWdoZXicrJZSnsoRKScYBVw1UGgN/FJqe9t jlwzuwvnLrUs35o9ofEstvl0Lp+TXAl9LGBOYbAwCVvynruibM++Jy9 X-Google-Smtp-Source: AGHT+IHzzw0z0olhiMQIF4i+m6RWPCwn/5pzBtPbIPQehiZzeOw1sBpO5b4V2d1MU84ARWYaRT4n1A== X-Received: by 2002:a5d:5f4f:0:b0:386:3329:6a04 with SMTP id ffacd0b85a97d-38a223f5b4cmr45535380f8f.39.1735909133357; Fri, 03 Jan 2025 04:58:53 -0800 (PST) Received: from [127.0.1.1] ([86.121.162.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8acadcsm40225591f8f.105.2025.01.03.04.58.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 04:58:52 -0800 (PST) From: Abel Vesa Date: Fri, 03 Jan 2025 14:58:17 +0200 Subject: [PATCH v3 3/4] drm/i915/dp: Use the generic helper to control LTTPR transparent mode Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-3-5c367f4b0763@linaro.org> References: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-0-5c367f4b0763@linaro.org> In-Reply-To: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-0-5c367f4b0763@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Karol Herbst , Lyude Paul , Danilo Krummrich , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten Cc: Bjorn Andersson , Konrad Dybcio , Johan Hovold , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Abel Vesa , Imre Deak X-Mailer: b4 0.15-dev-dedf8 X-Developer-Signature: v=1; a=openpgp-sha256; l=2875; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=t7uWQZmvlqArOJmOhip0vxH0p5Ao0CcrYSITs3tqLBs=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBnd98CWJIRcWNajaQUs0XtEmjBpJ6OADba5w2NK CosooeKSVCJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCZ3ffAgAKCRAbX0TJAJUV VqLKEACTE5rtDEB+D33MFt/oZ45AqV9b3HvDi4rXOsndYQGSTU63k5aEsmdo6JZy3Qg0D+xuuCR No9K5tdKFT0oiyRF4TvWaH/9wNmSFsIcgwcyng+spkYd4QZ+7E7kkMTW7RLXwmixcX+PjnAbhRu uyWVArrU3Q9yFK5JJb7zh3DEq5YqSBXK9iE1Kjls0cIR7CkmSer/AmxrISk43jNNHajVr0a+EIT cblU0Z4x3n9TlXxwCsowpn45Wl3PaemuzNzmKo9SEbGorOnfB0wYxTX78pIr1D4M1/OXG+FjxuB WyNd75KSJMQMigAKoKTA4DOLYtL1XB/Bbt6byj01kMwbXeg1rApXR5lgIAzx9GfiI7LmkdDZGL1 RlDFiT3f/uMfw7tzUohgIsQIodhlCuZ2eFXrHtb9u8XapXiH+knM5qqObAd4U6ePoM6Zj6MEFK6 4W0Xtc4G8RFAkDZWJk05I3mbnXUL/2Qdik+U2Phyz/k9eltZvpFm5eQgTDYI+nqEMlJmH5LGsi0 4DJ3EKsEUGwFVDi93iwvKHYq6dP9nkU47NbWjRe6jY8BHgLi6HQuyAC3trQELmnGY35TFpNbjL6 Q9GYYK4NNMqjIZ86oG/ibnG2NjtBKCdOhR7bzrw03Cii+gZK9vG/vaQujwKNdO+h9bjcuGNNAU0 AMan2WsFQIdj0uQ== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE LTTPRs operating modes are defined by the DisplayPort standard and the generic framework now provides a helper to switch between them, which is handling the explicit disabling of non-transparent mode and its disable->enable sequence mentioned in the DP Standard v2.0 section 3.6.6.1. So use the new drm generic helper instead as it makes the code a bit cleaner. Acked-by: Imre Deak Signed-off-by: Abel Vesa --- .../gpu/drm/i915/display/intel_dp_link_training.c | 24 +++++----------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_training.c b/drivers/gpu/drm/i915/display/intel_dp_link_training.c index 8b1977cfec503c70f07af716ee2c00e7605c6adf..c5bad311edf7b9a5cebb633b9e9692bae397f9ed 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_link_training.c +++ b/drivers/gpu/drm/i915/display/intel_dp_link_training.c @@ -119,9 +119,6 @@ intel_dp_set_lttpr_transparent_mode(struct intel_dp *intel_dp, bool enable) u8 val = enable ? DP_PHY_REPEATER_MODE_TRANSPARENT : DP_PHY_REPEATER_MODE_NON_TRANSPARENT; - if (drm_dp_dpcd_write(&intel_dp->aux, DP_PHY_REPEATER_MODE, &val, 1) != 1) - return false; - intel_dp->lttpr_common_caps[DP_PHY_REPEATER_MODE - DP_LT_TUNABLE_PHY_REPEATER_FIELD_DATA_STRUCTURE_REV] = val; @@ -146,6 +143,7 @@ static bool intel_dp_lttpr_transparent_mode_enabled(struct intel_dp *intel_dp) static int intel_dp_init_lttpr_phys(struct intel_dp *intel_dp, const u8 dpcd[DP_RECEIVER_CAP_SIZE]) { int lttpr_count; + int ret; if (!intel_dp_read_lttpr_common_caps(intel_dp, dpcd)) return 0; @@ -172,22 +170,8 @@ static int intel_dp_init_lttpr_phys(struct intel_dp *intel_dp, const u8 dpcd[DP_ return lttpr_count; } - /* - * See DP Standard v2.0 3.6.6.1. about the explicit disabling of - * non-transparent mode and the disable->enable non-transparent mode - * sequence. - */ - intel_dp_set_lttpr_transparent_mode(intel_dp, true); - - /* - * In case of unsupported number of LTTPRs or failing to switch to - * non-transparent mode fall-back to transparent link training mode, - * still taking into account any LTTPR common lane- rate/count limits. - */ - if (lttpr_count < 0) - goto out_reset_lttpr_count; - - if (!intel_dp_set_lttpr_transparent_mode(intel_dp, false)) { + ret = drm_dp_lttpr_init(&intel_dp->aux, lttpr_count); + if (ret) { lt_dbg(intel_dp, DP_PHY_DPRX, "Switching to LTTPR non-transparent LT mode failed, fall-back to transparent mode\n"); @@ -196,6 +180,8 @@ static int intel_dp_init_lttpr_phys(struct intel_dp *intel_dp, const u8 dpcd[DP_ goto out_reset_lttpr_count; } + intel_dp_set_lttpr_transparent_mode(intel_dp, false); + return lttpr_count; out_reset_lttpr_count: From patchwork Fri Jan 3 12:58:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abel Vesa X-Patchwork-Id: 854889 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F9431FBCA8 for ; Fri, 3 Jan 2025 12:58:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735909140; cv=none; b=VTLoDm37+4b/NlaGGiRhq8YdY70yRA0r66MDjzXZFhCHNutCuHR5PO2UR/cFuJ0rTubEZV5b2u0UPVFjbKoIL5husXsTNNZi/fSanHIGdJbkkPgXn+l1kUsqiyekVP4oSlKNWky46CTgyKP6gpEH0TYdpZhR9/lM5bI7ppvTupk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735909140; c=relaxed/simple; bh=zhRY8lT1G9JeELkZ54ealjEatpcKTP9np6vn+j2kA9w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=G1LjIwtbVvjvLcwWHnJIrh8z867QQLXsuNOeERZEOgsI16CX7p1GEr50QGu5FHmwHwked0f93H3+eMwP2SKLD3sGBr01YsQCCLKSIuWNQo8S/krX4oAaLxGBmuNphaEl6PjUnPhTyT9kWd8ASXLCMfmh18CJp0nBWTPK8F3gEnI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ikqd4528; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ikqd4528" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-43675b1155bso110884675e9.2 for ; Fri, 03 Jan 2025 04:58:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1735909135; x=1736513935; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=VITqw/dBrN6Eh2YzRoSLvwchdbQ5DNjyYt5nkHrQ30o=; b=ikqd45288racRs98N5fdxsszjtQ3DxYTYVxBnLZLXIiV7qw4URbIlqpQtEzay1wgNd axLtCR7VkJosdcQPPANZjf6dIn4zvmNOVhN5aoYkY7nAiP9B90ZhFGjU5ralZjQdgnmt iryTBZ9d6daRe0rBMzMihk2pfnCc5007w1YJdwQI9YE1p+gbqWnZlhivxvYjyZvaonQ1 v4+lSxhREfbGBVT96HBcX3bR+nERBOgLwBRKAw72DinKKusN4C/IBU9oUdzlVoMeqx7U LYFxEYUSGhWfkpCZVpxbIE/6NMgD2MrZfE8zJvfKa3V8xQotX0Nwxbf4Vt5XGLknoDpl qeNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735909135; x=1736513935; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=VITqw/dBrN6Eh2YzRoSLvwchdbQ5DNjyYt5nkHrQ30o=; b=dqNkYVGI0zG8Ow3ADlNAbI+VtNpTW+Vh0YGNewkTEuOLm/sWzpJQFYQVAf1zf2vc8X x172tMV9T6gCqerz8NkW28AiqzqDMdgq6pS6emah8JfM0aqxVo7fR/ev4aOgQd5Lslnr GN4gL3MO12j+BzEvEOt/oShtUYcvZqzDYtuC/LCRVq7V4nfTSJsTMufiCuhA4tD+jSMr kp/0d0bQodbhpdYiLFJi92PqREuEv3Zj+1ccdQNxHrhOLUyvhEDcm6J1STtOahudixgz MrHwf/PhUDhPh9Xb37KHvgMDTc2Q7ixv5uqHB5AzjY5GUb9p/mjT+VGGti0pFzGNjtRe TG+Q== X-Forwarded-Encrypted: i=1; AJvYcCX1Q0bdptMVICRUQ+ccm7G20k70HCjlcSI25ZfVc7Irl1HwFeO2r7YO05xKoG9h47T42Rwmrmb1Mi92KDC6@vger.kernel.org X-Gm-Message-State: AOJu0Yzp+5/US03Hn64duFHf0FdrhbLgBiBC0GXxbVrE6G2DjBxocRPL WaBs77ObBjnP7kc2c+XYztE/Og9H+XWednWoEykDtuEHApwUMIBk7a7DhZeEeEI= X-Gm-Gg: ASbGncu8H676VBmshxrsm+vEsoZdv4v1lH3sOWN0NUjT/kLAxbHWOMcarvzscc42QDP o/T/WknR9CUlv6+A80usWQbN3r39I+v+gO38HYwF0lNCJI7h9oSANRkhiwad2z1Vj+fTsSB18Rs QYH1AtIrSdDTUG/UuSxK9QJKugGYA+rXJ7jMspxRygUdc99tPAmGYY8WBgP5OFySzjvit1y1qiF 1AOu8tus4H4lmU15nhaZmgVugJkmoxJjneCzrIxTm6cG+AJauKEtwfU X-Google-Smtp-Source: AGHT+IGUnpXjnchYmTBFtUQ71LNCqNAU5Q0SOmAgi8sEQyivFL6wDbTXzLedPgyb7rzrtBvhgs98IA== X-Received: by 2002:a05:600c:468a:b0:436:1b96:7072 with SMTP id 5b1f17b1804b1-4366854c062mr416478835e9.5.1735909135449; Fri, 03 Jan 2025 04:58:55 -0800 (PST) Received: from [127.0.1.1] ([86.121.162.10]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38a1c8acadcsm40225591f8f.105.2025.01.03.04.58.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 04:58:55 -0800 (PST) From: Abel Vesa Date: Fri, 03 Jan 2025 14:58:18 +0200 Subject: [PATCH v3 4/4] drm/msm/dp: Add support for LTTPR handling Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-4-5c367f4b0763@linaro.org> References: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-0-5c367f4b0763@linaro.org> In-Reply-To: <20250103-drm-dp-msm-add-lttpr-transparent-mode-set-v3-0-5c367f4b0763@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Karol Herbst , Lyude Paul , Danilo Krummrich , Jani Nikula , Rodrigo Vivi , Joonas Lahtinen , Tvrtko Ursulin , Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Sean Paul , Marijn Suijten Cc: Bjorn Andersson , Konrad Dybcio , Johan Hovold , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Abel Vesa , Johan Hovold X-Mailer: b4 0.15-dev-dedf8 X-Developer-Signature: v=1; a=openpgp-sha256; l=3291; i=abel.vesa@linaro.org; h=from:subject:message-id; bh=zhRY8lT1G9JeELkZ54ealjEatpcKTP9np6vn+j2kA9w=; b=owEBbQKS/ZANAwAKARtfRMkAlRVWAcsmYgBnd98D5vjbEpomMQ8dXV6RVZNIUGfQhGggxggBR Qdgu7UHk5eJAjMEAAEKAB0WIQRO8+4RTnqPKsqn0bgbX0TJAJUVVgUCZ3ffAwAKCRAbX0TJAJUV Voh8D/9SfWx0sZ/dkeV5jYSYWRDoRArPfvo/DRVwDxLshqbRTU8todXxZViuaYxdh0+wz1yC/Tl QEgnwoaexcdVCEAq25zErdxGc4DeAW9RvqP/VVsiJug9NL1tl3wpnml4UY6A5JfU7ZB3/JOy9/F /ONMwxpcEqk7hKvuddzOaCg1m/haAPzk+i1foSK1pMOcFttgGGASktqORFxgTLVEfYY8cHB4yxM dvBYkfyMHeH4AHeDxpk08PfpDC7+kdjNESFHUjBbTQXdkT5tEu/AGxWOoyPQ/T84KwG/0izcapT mM2YxbX25qmTlAbYB7G6xo0nZs9IPz1lhpDnv49OF6A0Cji+YOfhvDdQizk4uDXrcS1rwEqNJja O82hu9RoIPEiXDGv3rYeLjA/4mkctvac/eWZv3CKxxxadOQfbX46cqUP5ax+8tvgzsY4GDpQ97M o0ZNmdt1dc09tsGlamOHx4vapCTX3qSXt9Oj8w0HWezaWJW0MHuDfoH+tZpHYbYZ5+J4i2DExJK 6igXX5ziVN/sJVwhFYPYRdVp0T3ZkUkCpBTJRBAG/+6uS4hffPzIh+wWpkfNmHMhAatBd10ifQo SovAsasDDp0M8XgZ6QSM4qpqr2Z6a0qO6NY0DuXvyC5loIDA2uFCsYWFvBQe8y3+YQAOqdaq5ma Xl+1+4xOfJyy7zw== X-Developer-Key: i=abel.vesa@linaro.org; a=openpgp; fpr=6AFF162D57F4223A8770EF5AF7BF214136F41FAE Link Training Tunable PHY Repeaters (LTTPRs) are defined in DisplayPort 1.4a specification. As the name suggests, these PHY repeaters are capable of adjusting their output for link training purposes. According to the DisplayPort standard, LTTPRs have two operating modes: - non-transparent - it replies to DPCD LTTPR field specific AUX requests, while passes through all other AUX requests - transparent - it passes through all AUX requests. Switching between this two modes is done by the DPTX by issuing an AUX write to the DPCD PHY_REPEATER_MODE register. The msm DP driver is currently lacking any handling of LTTPRs. This means that if at least one LTTPR is found between DPTX and DPRX, the link training would fail if that LTTPR was not already configured in transparent mode. The section 3.6.6.1 from the DisplayPort v2.0 specification mandates that before link training with the LTTPR is started, the DPTX may place the LTTPR in non-transparent mode by first switching to transparent mode and then to non-transparent mode. This operation seems to be needed only on first link training and doesn't need to be done again until device is unplugged. It has been observed on a few X Elite-based platforms which have such LTTPRs in their board design that the DPTX needs to follow the procedure described above in order for the link training to be successful. So add support for reading the LTTPR DPCD caps to figure out the number of such LTTPRs first. Then, for platforms (or Type-C dongles) that have at least one such an LTTPR, set its operation mode to transparent mode first and then to non-transparent, just like the mentioned section of the specification mandates. Tested-by: Johan Hovold Signed-off-by: Abel Vesa --- drivers/gpu/drm/msm/dp/dp_display.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index aff51bb973ebe0835c96420d16547ebae0c6c0f2..6ea8245284ab5b6068bfba64f01a960838f577b2 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -107,6 +107,8 @@ struct msm_dp_display_private { struct msm_dp_event event_list[DP_EVENT_Q_MAX]; spinlock_t event_lock; + u8 lttpr_caps[DP_LTTPR_COMMON_CAP_SIZE]; + bool wide_bus_supported; struct msm_dp_audio *audio; @@ -367,12 +369,27 @@ static int msm_dp_display_send_hpd_notification(struct msm_dp_display_private *d return 0; } +static void msm_dp_display_lttpr_init(struct msm_dp_display_private *dp) +{ + int rc; + + if (drm_dp_read_lttpr_common_caps(dp->aux, dp->panel->dpcd, + dp->lttpr_caps)) + return; + + rc = drm_dp_lttpr_init(dp->aux, drm_dp_lttpr_count(dp->lttpr_caps)); + if (rc) + DRM_ERROR("failed to set LTTPRs transparency mode, rc=%d\n", rc); +} + static int msm_dp_display_process_hpd_high(struct msm_dp_display_private *dp) { struct drm_connector *connector = dp->msm_dp_display.connector; const struct drm_display_info *info = &connector->display_info; int rc = 0; + msm_dp_display_lttpr_init(dp); + rc = msm_dp_panel_read_sink_caps(dp->panel, connector); if (rc) goto end;