From patchwork Wed Feb 5 11:50:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harikrishna Shenoy X-Patchwork-Id: 13962581 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 07E5BC0219C for ; Thu, 6 Feb 2025 08:05:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 65AA410E7E6; Thu, 6 Feb 2025 08:05:34 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="BYTbs25L"; dkim-atps=neutral Received: from fllvem-ot04.ext.ti.com (fllvem-ot04.ext.ti.com [198.47.19.246]) by gabe.freedesktop.org (Postfix) with ESMTPS id D05A310E1C8 for ; Wed, 5 Feb 2025 14:03:54 +0000 (UTC) Received: from fllv0034.itg.ti.com ([10.64.40.246]) by fllvem-ot04.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 515Boerv2525990 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Feb 2025 05:50:40 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1738756240; bh=VCtGI+uCG2hWdsoWCIe4rbkbeS3s2t98T4jUhXD2A+c=; h=From:To:Subject:Date:In-Reply-To:References; b=BYTbs25La01gzes7U3VWPeKdIFbiB38mEOMZ2tjGXU28ns//v9JAOAIhx9a8Ffp/L utiaMWNrEBZdD5Eo/aAhb5FclsbjrHXD49+OMcFqEPYp3vq0Pc9Nr/T0uJeb/S4c+O k5XAvKGVUXUmFPBPfGxCc2ROuPSUJO1d1D1EUr50= Received: from DFLE107.ent.ti.com (dfle107.ent.ti.com [10.64.6.28]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 515Boesf101811 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 5 Feb 2025 05:50:40 -0600 Received: from DFLE101.ent.ti.com (10.64.6.22) by DFLE107.ent.ti.com (10.64.6.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 5 Feb 2025 05:50:40 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE101.ent.ti.com (10.64.6.22) 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; Wed, 5 Feb 2025 05:50:40 -0600 Received: from hkshenoy.dhcp.ti.com (hkshenoy.dhcp.ti.com [172.24.227.96]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 515BoPCi043245; Wed, 5 Feb 2025 05:50:33 -0600 From: Harikrishna Shenoy To: , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v3 1/2] dt-bindings: drm/bridge: Add no-hpd property Date: Wed, 5 Feb 2025 17:20:24 +0530 Message-ID: <20250205115025.3133487-2-h-shenoy@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250205115025.3133487-1-h-shenoy@ti.com> References: <20250205115025.3133487-1-h-shenoy@ti.com> MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-Mailman-Approved-At: Thu, 06 Feb 2025 08:05:28 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Rahul T R The mhdp bridge can work without its HPD pin hooked up to the connector, but the current bridge driver throws an error when hpd line is not connected to the connector. For such cases, we need an indication for no-hpd, using which we can bypass the hpd detection and instead use the auxiliary channels connected to the DP connector to confirm the connection. So add no-hpd property to the bindings, to disable hpd when not connected or unusable due to DP0-HPD not connected to correct HPD pin on SOC like in case of J721S2. Signed-off-by: Rahul T R Signed-off-by: Jayesh Choudhary --- .../devicetree/bindings/display/bridge/cdns,mhdp8546.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml b/Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml index c2b369456e4e..3a6c6d837593 100644 --- a/Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml +++ b/Documentation/devicetree/bindings/display/bridge/cdns,mhdp8546.yaml @@ -57,6 +57,12 @@ properties: interrupts: maxItems: 1 + cdns,no-hpd: + type: boolean + description: + Set if the HPD line on the bridge isn't hooked up to anything or is + otherwise unusable. + ports: $ref: /schemas/graph.yaml#/properties/ports From patchwork Wed Feb 5 11:50:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Harikrishna Shenoy X-Patchwork-Id: 13962578 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 B6628C02196 for ; Thu, 6 Feb 2025 08:05:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 04BD410E7EB; Thu, 6 Feb 2025 08:05:29 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="vd2Wr/Of"; dkim-atps=neutral X-Greylist: delayed 1308 seconds by postgrey-1.36 at gabe; Wed, 05 Feb 2025 12:12:57 UTC Received: from lelvem-ot02.ext.ti.com (lelvem-ot02.ext.ti.com [198.47.23.235]) by gabe.freedesktop.org (Postfix) with ESMTPS id A2D9810E0FF for ; Wed, 5 Feb 2025 12:12:57 +0000 (UTC) Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelvem-ot02.ext.ti.com (8.15.2/8.15.2) with ESMTPS id 515Bol852591319 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 5 Feb 2025 05:50:47 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1738756247; bh=OaM5rfFZ68e3HGHbqVx4CWq+S7n+bCh/84iARh27Z8s=; h=From:To:Subject:Date:In-Reply-To:References; b=vd2Wr/Ofyd/J3tkzUwdPdMLJG86LDY+rTuIjJIRaaZ1MLNxfsccUGF+QvLY49pg2B zwRX7KtYf8Ozuj/dptFFjsMkZ/FfA4oDzYJ9gk2Oh5keVi2cXuBrua0s5MLMTabMe5 M9Y95caWOOUOhEHT4MoM1KXGNJT1k1tZJRWRQeTg= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 515BolxH025164 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 5 Feb 2025 05:50:47 -0600 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Wed, 5 Feb 2025 05:50:47 -0600 Received: from lelvsmtp5.itg.ti.com (10.180.75.250) by DFLE104.ent.ti.com (10.64.6.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; Wed, 5 Feb 2025 05:50:46 -0600 Received: from hkshenoy.dhcp.ti.com (hkshenoy.dhcp.ti.com [172.24.227.96]) by lelvsmtp5.itg.ti.com (8.15.2/8.15.2) with ESMTP id 515BoPCj043245; Wed, 5 Feb 2025 05:50:40 -0600 From: Harikrishna Shenoy To: , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v3 2/2] drm: bridge: cdns-mhdp8546: Add support for no-hpd Date: Wed, 5 Feb 2025 17:20:25 +0530 Message-ID: <20250205115025.3133487-3-h-shenoy@ti.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250205115025.3133487-1-h-shenoy@ti.com> References: <20250205115025.3133487-1-h-shenoy@ti.com> MIME-Version: 1.0 X-C2ProcessedOrg: 333ef613-75bf-4e12-a4b1-8e3623f5dcea X-Mailman-Approved-At: Thu, 06 Feb 2025 08:05:28 +0000 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Rahul T R In J721S2 EVMs DP0 hpd is not connected to correct hpd pin on SOC, to handle such cases, Add support for "no-hpd" property in the device tree node to disable hpd. Also change the log level for dpcd read failuers to debug, since framework retries 32 times for each read. Adding timeout in to wait asynchronously for state to change to MHDP_HW_READY. With HPD the driver acts only on the interrupt, which is enabled only after both have happened.Here the driver waits in the attach until everything is ready, and then probes the DP given the HPD interrupt is broken. Add update_link_status in case of no_hpd in cdns_mhdp_bridge_detect() to update status of mhdp->plugged via polling, as cdns_mhdp_bridge_detect() is being polled by drm framework. Signed-off-by: Rahul T R [j-choudhary@ti.com: Fix cdns_mhdp_attach hook for no-hpd usecase] Signed-off-by: Jayesh Choudhary [h-shenoy@ti.com: Updated mhdp->plugged status in cdns_mhdp_bridge_detect for no-hpd usecase] Signed-off-by: Harikrishna Shenoy --- .../drm/bridge/cadence/cdns-mhdp8546-core.c | 54 ++++++++++++++++--- .../drm/bridge/cadence/cdns-mhdp8546-core.h | 1 + 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c index 6a121a2700d2..223370717ce8 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.c @@ -53,6 +53,8 @@ #include "cdns-mhdp8546-hdcp.h" #include "cdns-mhdp8546-j721e.h" +static int cdns_mhdp_update_link_status(struct cdns_mhdp_device *mhdp); + static void cdns_mhdp_bridge_hpd_enable(struct drm_bridge *bridge) { struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge); @@ -768,7 +770,8 @@ static int cdns_mhdp_fw_activate(const struct firmware *fw, * MHDP_HW_STOPPED happens only due to driver removal when * bridge should already be detached. */ - cdns_mhdp_bridge_hpd_enable(&mhdp->bridge); + if (!mhdp->no_hpd) + cdns_mhdp_bridge_hpd_enable(&mhdp->bridge); spin_unlock(&mhdp->start_lock); @@ -862,7 +865,7 @@ static ssize_t cdns_mhdp_transfer(struct drm_dp_aux *aux, ret = cdns_mhdp_dpcd_read(mhdp, msg->address, msg->buffer, msg->size); if (ret) { - dev_err(mhdp->dev, + dev_dbg(mhdp->dev, "Failed to read DPCD addr %u\n", msg->address); @@ -1752,8 +1755,22 @@ static int cdns_mhdp_attach(struct drm_bridge *bridge, spin_unlock(&mhdp->start_lock); + if (mhdp->no_hpd) { + ret = wait_event_timeout(mhdp->fw_load_wq, + mhdp->hw_state == MHDP_HW_READY, + msecs_to_jiffies(100)); + if (ret == 0) { + dev_err(mhdp->dev, "%s: Timeout waiting for fw loading\n", + __func__); + return -ETIMEDOUT; + } + + cdns_mhdp_update_link_status(mhdp); + return 0; + } + /* Enable SW event interrupts */ - if (hw_ready) + if (hw_ready && !mhdp->no_hpd) cdns_mhdp_bridge_hpd_enable(bridge); return 0; @@ -2217,6 +2234,19 @@ static enum drm_connector_status cdns_mhdp_bridge_detect(struct drm_bridge *brid { struct cdns_mhdp_device *mhdp = bridge_to_mhdp(bridge); + if (mhdp->no_hpd) { + int ret = cdns_mhdp_update_link_status(mhdp); + + if (mhdp->connector.dev) { + if (ret < 0) + schedule_work(&mhdp->modeset_retry_work); + else + drm_kms_helper_hotplug_event(mhdp->bridge.dev); + } else { + drm_bridge_hpd_notify(&mhdp->bridge, cdns_mhdp_detect(mhdp)); + } + } + return cdns_mhdp_detect(mhdp); } @@ -2284,7 +2314,16 @@ static int cdns_mhdp_update_link_status(struct cdns_mhdp_device *mhdp) mutex_lock(&mhdp->link_mutex); - mhdp->plugged = cdns_mhdp_detect_hpd(mhdp, &hpd_pulse); + if (mhdp->no_hpd) { + ret = drm_dp_dpcd_read_link_status(&mhdp->aux, status); + hpd_pulse = false; + if (ret < 0) + mhdp->plugged = false; + else + mhdp->plugged = true; + } else { + mhdp->plugged = cdns_mhdp_detect_hpd(mhdp, &hpd_pulse); + } if (!mhdp->plugged) { cdns_mhdp_link_down(mhdp); @@ -2481,6 +2520,8 @@ static int cdns_mhdp_probe(struct platform_device *pdev) mhdp->aux.dev = dev; mhdp->aux.transfer = cdns_mhdp_transfer; + mhdp->no_hpd = of_property_read_bool(dev->of_node, "cdns,no-hpd"); + mhdp->regs = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(mhdp->regs)) { dev_err(dev, "Failed to get memory resource\n"); @@ -2556,8 +2597,9 @@ static int cdns_mhdp_probe(struct platform_device *pdev) mhdp->bridge.of_node = pdev->dev.of_node; mhdp->bridge.funcs = &cdns_mhdp_bridge_funcs; - mhdp->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID | - DRM_BRIDGE_OP_HPD; + mhdp->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID; + if (!mhdp->no_hpd) + mhdp->bridge.ops |= DRM_BRIDGE_OP_HPD; mhdp->bridge.type = DRM_MODE_CONNECTOR_DisplayPort; ret = phy_init(mhdp->phy); diff --git a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h index bad2fc0c7306..48517193cf0b 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h +++ b/drivers/gpu/drm/bridge/cadence/cdns-mhdp8546-core.h @@ -388,6 +388,7 @@ struct cdns_mhdp_device { bool link_up; bool plugged; + bool no_hpd; /* * "start_lock" protects the access to bridge_attached and