From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 E24C3CAC5B0 for ; Mon, 29 Sep 2025 03:56:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SXFrxfbwZn7OVQEmsZtIMU0iame1kRqgpWXqcEg9m2Y=; b=ytzyp9o1TzkCye l09lBVgZBefp9RxROLMR5ZBJqeGQnSu9QET/xGnyzO+yB6VQWl5CSI/jwhf0TO8V5uYYYKLVimVPH X3iEGpwrZklLBuBrLS8Vt72uBsdmyKzMEQX7rUjwK8vh7uWellw5G7lHnpjeaSy5kuG9yNuf/1caU y0l8Pc80JcEuAyFck04AghSqJcjIwCxKO1agFvFhDqK+6/u9uIwg4A3hA4r+VgsuIvLxqqc/k+Srq pHtvS4mQThw2v9yTfll0xYRIi+WAC+wSmc3CfjmDaARgogIgjuwYmV02PFpoqAuBq/98mFv/XsLzx SplqWYlBUP/i95DW8ftA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1v34zW-00000001G0g-3TLS; Mon, 29 Sep 2025 03:55:58 +0000 Received: from mail-m15592.qiye.163.com ([101.71.155.92]) by bombadil.infradead.org with esmtps (Exim 4.98.2 #2 (Red Hat Linux)) id 1v34zT-00000001Fzp-14TA; Mon, 29 Sep 2025 03:55:57 +0000 Received: from [172.16.12.153] (unknown [58.22.7.114]) by smtp.qiye.163.com (Hmail) with ESMTP id 24652f4a9; Mon, 29 Sep 2025 11:55:46 +0800 (GMT+08:00) Message-ID: <42f41be2-9afb-4087-9ce9-1e711df98df8@rock-chips.com> Date: Mon, 29 Sep 2025 11:55:44 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 5/7] drm/rockchip: cdn-dp: Add multiple bridges to support PHY port selection To: Dmitry Baryshkov Cc: Chaoyi Chen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Vinod Koul , Kishon Vijay Abraham I , Heiko Stuebner , Sandy Huang , Andy Yan , Yubing Zhang , Frank Wang , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Amit Sunil Dhamne , Heikki Krogerus , Greg Kroah-Hartman , Dragan Simic , Johan Jonker , Diederik de Haas , Peter Robinson , linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, dri-devel@lists.freedesktop.org References: <20250922012039.323-1-kernel@airkyi.com> <20250922012039.323-6-kernel@airkyi.com> Content-Language: en-US From: Chaoyi Chen In-Reply-To: X-HM-Tid: 0a99939cbbf503abkunmf7f47fbafa8c8 X-HM-MType: 1 X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly tZV1koWUFDSUNOT01LS0k3V1ktWUFJV1kPCRoVCBIfWUFZQ04fT1YfTkxDGBgYGBhCTx5WFRQJFh oXVRMBExYaEhckFA4PWVdZGBILWUFZTkNVSUlVTFVKSk9ZV1kWGg8SFR0UWUFZT0tIVUpLSEpPSE xVSktLVUpCS0tZBg++ DKIM-Signature: a=rsa-sha256; b=UVyf33FqlputOQa4i79XGybq+AHVBKpYG2XhkZ6ZsqEY+uBjh+doRGcpDIIyihJwJzLoZuBaP8YAxS1iEJ8+T496AL+scaEHMn+JL13fmHgyixWLNleRn15RaeUrcxUFa8lPcxDbkRBf/tFKJtLx0+uQh/Rz1zRor79EWuMmPyI=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1; bh=vM6i8BgSabuk/duHJbVX0Gnp95HLl19dL4T224ShB2g=; h=date:mime-version:subject:message-id:from; X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250928_205555_829891_93BCF680 X-CRM114-Status: GOOD ( 23.62 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org On 9/29/2025 5:27 AM, Dmitry Baryshkov wrote: > On Sun, Sep 28, 2025 at 05:52:35PM +0800, Chaoyi Chen wrote: >> On 9/23/2025 9:50 AM, Dmitry Baryshkov wrote: >> >> [...] >> >> >>>> + /* One endpoint may correspond to one HPD bridge. */ >>>> + for_each_of_graph_port_endpoint(port, dp_ep) { >>>> + /* Try to get "port" node of correspond PHY device */ >>>> + struct device_node *phy_ep __free(device_node) = >>>> + of_graph_get_remote_endpoint(dp_ep); >>>> + struct device_node *phy_port __free(device_node) = >>>> + of_get_parent(phy_ep); >>>> + >>>> + if (!phy_port) { >>>> + continue; >>>> + } >>>> + >>>> + /* >>>> + * A PHY port may contain two endpoints: USB connector port or CDN-DP port. >>>> + * Try to find the node of USB connector. >>> And then there can be a retimer between PHY and the USB-C connector. Or >>> some signal MUX. Or DP-to-HDMI bridge. Please, don't parse DT for other >>> devices. Instead you can add drm_aux_bridge to your PHY and let DRM core >>> build the bridge chain following OF graph. >>> >> I think building a bridge chain across multiple drm_aux_hpd_bridge may be difficult. First, drm_dp_hpd_bridge_register() cannot register the bridge immediately; instead, it is deferred until drm_aux_hpd_bridge_probe(). When it is added to the bridge_list, it may not yet be attached, and attempting to attach it at that point is too late. >> >> But, if I only use drm_aux_bridge on the USB-C connector, and use my own custom bridge on the PHY device and managing the alloc and attach bridge process myself, then things would become much easier. > Well... consider a your board, but add onnn,nb7vpq904m retimer between > the CDP and usb-c connector (it's not an uncommon device nowadays). Or > add fsa4480 analog audio switch. Build all the drivers as modules. You > should not need any changes to your drivers to handle such boards and > such kernel config. > > With those devices you can't handle everything inside the DP driver, > since there are two "streams" of probe events: the DRM bridge needs the > "next" bridge (in the direction from the SoC to the connector), but the > USB-C events code needs "previous" mux, switch or retirmer. After some > trial and error we have ended up with having a chain of drm_aux_bridge > devices ending up with the drm_aux_hpd_bridge inside the Type-C port > manager driver. This way the typec_* depetencies are resolved first, > going from the SoC to the Type-C controller driver then the DRM bridge > devices probe backwards, creating the chain, which is finally consumer > by the DP driver inside the SoC. Sorry, I kept trying to look for the "next bridge" in "drm_hpd_aux_bridge", and I didn't notice that "drm_aux_bridge" already had a similar implementation about "next bridge". Thanks again for your patience. BTW the devm_drm_of_get_bridge(&auxdev->dev, auxdev->dev.of_node, 0, 0) in drm_aux_bridge cannot be used directly with tcphy->dev. I may need to create a device for the dp-port child node, and then use drm_aux_bridge_register(). But this is no longer a big issue :) -- Best, Chaoyi _______________________________________________ Linux-rockchip mailing list Linux-rockchip@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-rockchip