From nobody Fri Dec 19 22:05:26 2025 Received: from fllvem-ot04.ext.ti.com (fllvem-ot04.ext.ti.com [198.47.19.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEFE120C46F for ; Thu, 8 May 2025 11:55:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.47.19.246 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746705307; cv=none; b=K6oiVF+UP5SiOI0/MGzvZhge80Xu0prh8hzDDrCl1aQH/IyhRms3jPC//HJfK48cmNGjFc4fOYkTGGqqUj4G0bOUDGuji2T5WFZ+5QN2vEqHt33o/QuLTDsGW8C0IYHe7L5g3hO1ps3NeBZBDe6FFeIMwduuVnLvJj1E/9ufS6s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1746705307; c=relaxed/simple; bh=PNm8y5BGW8kc2ndqg3OjOoXwMS6c/M43cJjrZdZqwf0=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Z9zRY/7f9mFLjKaXcExtK8MY98QsyafY/SxPUD3/QJuqiwUp3pcckAArX4gCxu1vb1NzFr55Sx1zTDB4VqvpCzqWLSpPshEKeQqaplEtHmzJPMUFXbhNek0ZdNLGgbGlrOXptHI/80cNy2wDTcmxRlySpqnbYVEXtbU7O536LZo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com; spf=pass smtp.mailfrom=ti.com; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b=nMYpl5rV; arc=none smtp.client-ip=198.47.19.246 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=ti.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ti.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ti.com header.i=@ti.com header.b="nMYpl5rV" Received: from fllv0035.itg.ti.com ([10.64.41.0]) by fllvem-ot04.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 548BsZ7B1659097 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 May 2025 06:54:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1746705275; bh=upFvHd4shpYUIeyOf3tyoUkOxHMwThPoUVnLvtpA/pM=; h=From:To:CC:Subject:Date; b=nMYpl5rViGwUspkDJya0JClws/Dc0ULo43z2uNw8jWn6Kls19B7jf2EKTZCMjBFKt Glg1OXb+Nhmd3XWDI1vNFD0cTlyWiA0ILx7wJD+c3NN6R5ufZTjlNvMxgbrDTmczP+ bPcJhFYDUO1ILLw6uI/fIAVOHxTK9Z8xoaVcA8aE= Received: from DLEE111.ent.ti.com (dlee111.ent.ti.com [157.170.170.22]) by fllv0035.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 548BsZI3068180 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 May 2025 06:54:35 -0500 Received: from DLEE114.ent.ti.com (157.170.170.25) by DLEE111.ent.ti.com (157.170.170.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Thu, 8 May 2025 06:54:35 -0500 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DLEE114.ent.ti.com (157.170.170.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Thu, 8 May 2025 06:54:35 -0500 Received: from localhost (jayesh-hp-z2-tower-g5-workstation.dhcp.ti.com [10.24.72.182]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 548BsYN5026702; Thu, 8 May 2025 06:54:34 -0500 From: Jayesh Choudhary To: , , , , , , , CC: , , , , , , , , , , , Subject: [PATCH v2] drm/bridge: ti-sn65dsi86: Add HPD for DisplayPort connector type Date: Thu, 8 May 2025 17:24:33 +0530 Message-ID: <20250508115433.449102-1-j-choudhary@ti.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea Content-Type: text/plain; charset="utf-8" By default, HPD was disabled on SN65DSI86 bridge. When the driver was added (commit "a095f15c00e27"), the HPD_DISABLE bit was set in pre-enable call which was moved to other function calls subsequently. Later on, commit "c312b0df3b13" added detect utility for DP mode. But with HPD_DISABLE bit set, all the HPD events are disabled[0] and the debounced state always return 1 (always connected state) Also, with the suspend and resume calls before every register access, the bridge starts with disconnected state and the HPD state is reflected correctly only after debounce time (400ms). However, adding this delay in the detect function causes frame drop and visible glitch in display. So to get the detect utility working properly for DP mode without any performance issues in display, instead of reading HPD state from the register, rely on aux communication. Use 'drm_dp_dpcd_read_link_status' to find if we have something connected at the sink. [0]: (Pg. 32) Fixes: c312b0df3b13 ("drm/bridge: ti-sn65dsi86: Implement bridge connector = operations for DP") Cc: Max Krummenacher Signed-off-by: Jayesh Choudhary Tested-by: Max Krummenacher --- v1 patch link which was sent as RFC: Changelog v1->v2: - Drop additional property in bindings and use conditional. - Instead of register read for HPD state, use dpcd read which returns 0 for success and error codes for no connection - Add relevant history for the required change in commit message - Drop RFC subject-prefix in v2 as v2 is in better state after discussion in v1 and Max's mail thread - Add "Cc:" tag=20 This approach does not make suspend/resume no-op and no additional delay needs to be added in the detect hook which causes frame drops. Here, I am adding conditional to HPD_DISABLE bit even when we are not using the register read to get HPD state. This is to prevent unnecessary register updates in every resume call. (It was adding to latency and leading to ~2-3 frame drop every 10 sec) Tested and verified on TI's J784S4-EVM platform: - Display comes up - Detect utility works with a couple of seconds latency. But I guess without interrupt support, this is acceptable. - No frame-drop observed =20 Discussion thread for Max's patch: drivers/gpu/drm/bridge/ti-sn65dsi86.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge= /ti-sn65dsi86.c index 60224f476e1d..9489e78b6da3 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -352,8 +352,10 @@ static void ti_sn65dsi86_enable_comms(struct ti_sn65ds= i86 *pdata, * change this to be conditional on someone specifying that HPD should * be used. */ - regmap_update_bits(pdata->regmap, SN_HPD_DISABLE_REG, HPD_DISABLE, - HPD_DISABLE); + + if (pdata->bridge.type =3D=3D DRM_MODE_CONNECTOR_eDP) + regmap_update_bits(pdata->regmap, SN_HPD_DISABLE_REG, HPD_DISABLE, + HPD_DISABLE); =20 pdata->comms_enabled =3D true; =20 @@ -1194,13 +1196,14 @@ static enum drm_connector_status ti_sn_bridge_detec= t(struct drm_bridge *bridge) { struct ti_sn65dsi86 *pdata =3D bridge_to_ti_sn65dsi86(bridge); int val =3D 0; + u8 link_status[DP_LINK_STATUS_SIZE]; =20 - pm_runtime_get_sync(pdata->dev); - regmap_read(pdata->regmap, SN_HPD_DISABLE_REG, &val); - pm_runtime_put_autosuspend(pdata->dev); + val =3D drm_dp_dpcd_read_link_status(&pdata->aux, link_status); =20 - return val & HPD_DEBOUNCED_STATE ? connector_status_connected - : connector_status_disconnected; + if (val < 0) + return connector_status_disconnected; + else + return connector_status_connected; } =20 static const struct drm_edid *ti_sn_bridge_edid_read(struct drm_bridge *br= idge, --=20 2.34.1