Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5245820pxv; Wed, 28 Jul 2021 06:37:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXC6zC3in5MBsB7FrsYwMd7Z3aDd9K2pzln3j655sj+g9cBXoM3KNOKZN2Y7kUPZowvpMk X-Received: by 2002:a17:907:1c94:: with SMTP id nb20mr26863464ejc.289.1627479441283; Wed, 28 Jul 2021 06:37:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627479441; cv=none; d=google.com; s=arc-20160816; b=OzhJiGYWZ2nuZrUl9fZESgr14jGO/VpZCb8Erqp/dhHyzqqI9G7DJ6KeldW1mVpCwq vE4HSzpqAIr766ND34gYRDvSiRlEyKljefHGhViSflZcxs3A/nH5V8THpYi4ol3BbXWu nNVwH0iRsa0ci/onvZqzAHj0DpZHSG8OlxWe7gvkjsgn1QbcZgfCO5Iv3mURvHGzDn84 Pf93/blBrCmEWhPtnyxVM1s2gWoJabI2idUzHYzgt2eFbH8RTDJHYwizO82r2rElFtmP hh+27xirKpqauYPIzVG1DuQPZ6XOHO5ewceYTKu69+c4K2ahiDA5J1eUZ6/Py29EoQZY TU2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=W9clNQN5uDyZQ55X1bMgue4S4/1Xdcf9dM8OuoUM0nQ=; b=0xr2N+emZlbqhKuk8cuGWYZtiYpXFFLaUBhnScXYlNIT0sISGrsmZY6BP6oUv5IqZ+ 7Aw8GLnn5EJU6o7X7un8N60w4g5XG4bHJnEcVEqsLsFaYKHLsrad+r5QK2oTwGN2B/x7 ubXD4CUOH/WKktW5PpGEWYrsP1bFg3kseEc6kZFRHvoErjxWwsRZA7HrzRe4t0V62kT1 9LBrjNBO0JPt+7SdRkW+STgq6rspKNnptLViK1I9krm4pBIFgx57CbsRgdx9hocc87YW 0RE0h4t7dYEgai37S4FJ4axDNVnTRlASRq15pNcEZCG3ZY3cv6Swb55sIRxKwBG5n8vk 77zA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=nB0VmPq3; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=I8prGpLH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f2si6737242edl.338.2021.07.28.06.36.57; Wed, 28 Jul 2021 06:37:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cerno.tech header.s=fm3 header.b=nB0VmPq3; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=I8prGpLH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cerno.tech Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236419AbhG1Nfj (ORCPT + 99 others); Wed, 28 Jul 2021 09:35:39 -0400 Received: from new3-smtp.messagingengine.com ([66.111.4.229]:38951 "EHLO new3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236320AbhG1Nfi (ORCPT ); Wed, 28 Jul 2021 09:35:38 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id E402D580B89; Wed, 28 Jul 2021 09:35:36 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Wed, 28 Jul 2021 09:35:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=W9clNQN5uDyZQ55X1bMgue4S4/1 Xdcf9dM8OuoUM0nQ=; b=nB0VmPq3DYC+cySpIdUPJsH/LS0+P9/Ph4Qr9ivb3oo 0zVHUt4KVitO0OodusrEUMZnwud1drOFrIElZ7Px/+wDVxE6A0086KoMvHsTDVIP 7+bDpLy5lfxYEc4sKXKTfVCYClfFx699kCyp6Hw8HlZm3GWFmqLg/HM3pur8BsEk 8R4+CrD1mgHIbw+QMh1xS/Gt5W1rTHXh9OWkG9xUDHcE6fJUVsC4d0gn1ihE3OZH e+osiSQktMuxzAk5f09bT5ZOsXRAxaphKm1TXWcbQIT+iK/CbnLW/HoM8LJaGD4V as93NE7bCG2Gqr4YiOKpn1JgjJZ5bwgBxcyCmB6iWyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=W9clNQ N5uDyZQ55X1bMgue4S4/1Xdcf9dM8OuoUM0nQ=; b=I8prGpLHw3q/FnMBCfD3q6 NomVyf5sOp5A4DcamVRqiez2I72DGurZs1raDUX2OOD0R/bgtPTo9UKzYx1U9P4y MsUPHuYdJcEq0CAS+ENDBSQXUcEHlHYOOavCM73sut1EY1KHv/L3ni9YnyUZGmRD 4tMBKFt5PJYZFbdf1Inyeb3Vwi3Saph1Od75LWfydbhdddvRPB2jz2xC+R3qbApd gsL7/nT1Gq4t/L3Kre0+Ce0ubEavtX56QLQhkvyL3ro0frTWtcbLBABmxP9DjTD4 mKmnRv5c1ds5hSO1KUxVRgiMO2BsPEfB2/qTHriJMSlxMWr1G6Scmjvl6lbTtFtg == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrgeelgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofgrgihimhgv ucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrghtth gvrhhnpeelkeeghefhuddtleejgfeljeffheffgfeijefhgfeufefhtdevteegheeiheeg udenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrg igihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 28 Jul 2021 09:35:33 -0400 (EDT) Date: Wed, 28 Jul 2021 15:35:31 +0200 From: Maxime Ripard To: Jagan Teki Cc: Robert Foss , Andrzej Hajda , Daniel Vetter , David Airlie , Sam Ravnborg , Maarten Lankhorst , Thomas Zimmermann , Neil Armstrong , Jonas Karlman , Jernej Skrabec , Thierry Reding , Laurent Pinchart , linux-kernel , dri-devel Subject: Re: [PATCH 04/10] drm/bridge: Document the probe issue with MIPI-DSI bridges Message-ID: <20210728133531.yzamhx5fhrofxwee@gilmour> References: <20210720134525.563936-1-maxime@cerno.tech> <20210720134525.563936-5-maxime@cerno.tech> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="utqwuarjxeuflrvb" Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --utqwuarjxeuflrvb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Jagan, On Tue, Jul 27, 2021 at 03:12:09PM +0530, Jagan Teki wrote: > On Tue, Jul 20, 2021 at 7:15 PM Maxime Ripard wrote: > > > > Interactions between bridges, panels, MIPI-DSI host and the component > > framework are not trivial and can lead to probing issues when > > implementing a display driver. Let's document the various cases we need > > too consider, and the solution to support all the cases. > > > > Signed-off-by: Maxime Ripard > > --- > > Documentation/gpu/drm-kms-helpers.rst | 6 +++ > > drivers/gpu/drm/drm_bridge.c | 60 +++++++++++++++++++++++++++ > > 2 files changed, 66 insertions(+) > > > > diff --git a/Documentation/gpu/drm-kms-helpers.rst b/Documentation/gpu/= drm-kms-helpers.rst > > index 10f8df7aecc0..ec2f65b31930 100644 > > --- a/Documentation/gpu/drm-kms-helpers.rst > > +++ b/Documentation/gpu/drm-kms-helpers.rst > > @@ -157,6 +157,12 @@ Display Driver Integration > > .. kernel-doc:: drivers/gpu/drm/drm_bridge.c > > :doc: display driver integration > > > > +Special Care with MIPI-DSI bridges > > +---------------------------------- > > + > > +.. kernel-doc:: drivers/gpu/drm/drm_bridge.c > > + :doc: special care dsi > > + > > Bridge Operations > > ----------------- > > > > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c > > index c9a950bfdfe5..81f8dac12367 100644 > > --- a/drivers/gpu/drm/drm_bridge.c > > +++ b/drivers/gpu/drm/drm_bridge.c > > @@ -95,6 +95,66 @@ > > * documentation of bridge operations for more details). > > */ > > > > +/** > > + * DOC: special care dsi > > + * > > + * The interaction between the bridges and other frameworks involved in > > + * the probing of the display driver and the bridge driver can be > > + * challenging. Indeed, there's multiple cases that needs to be > > + * considered: > > + * > > + * - The display driver doesn't use the component framework and isn't a > > + * MIPI-DSI host. In this case, the bridge driver will probe at some > > + * point and the display driver should try to probe again by returni= ng > > + * EPROBE_DEFER as long as the bridge driver hasn't probed. > > + * > > + * - The display driver doesn't use the component framework, but is a > > + * MIPI-DSI host. The bridge device uses the MIPI-DCS commands to be > > + * controlled. In this case, the bridge device is a child of the > > + * display device and when it will probe it's assured that the displ= ay > > + * device (and MIPI-DSI host) is present. The display driver will be > > + * assured that the bridge driver is connected between the > > + * &mipi_dsi_host_ops.attach and &mipi_dsi_host_ops.detach operation= s. > > + * Therefore, it must run mipi_dsi_host_register() in its probe > > + * function, and then run drm_bridge_attach() in its > > + * &mipi_dsi_host_ops.attach hook. > > + * > > + * - The display driver uses the component framework and is a MIPI-DSI > > + * host. The bridge device uses the MIPI-DCS commands to be > > + * controlled. This is the same situation than above, and can run > > + * mipi_dsi_host_register() in either its probe or bind hooks. > > + * > > + * - The display driver uses the component framework and is a MIPI-DSI > > + * host. The bridge device uses a separate bus (such as I2C) to be > > + * controlled. In this case, there's no correlation between the probe > > + * of the bridge and display drivers, so care must be taken to avoid > > + * an endless EPROBE_DEFER loop, with each driver waiting for the > > + * other to probe. > > + * > > + * The ideal pattern to cover the last item (and all the others in the > > + * display driver case) is to split the operations like this: > > + * > > + * - In the display driver must run mipi_dsi_host_register() and > > + * component_add in its probe hook. It will make sure that the > > + * MIPI-DSI host sticks around, and that the driver's bind can be > > + * called. > > + * > > + * - In its probe hook, the bridge driver must not try to find its > > + * MIPI-DSI host or register as a MIPI-DSI device. As far as the > > + * framework is concerned, it must only call drm_bridge_add(). > > + * > > + * - In its bind hook, the display driver must try to find the bridge > > + * and return -EPROBE_DEFER if it doesn't find it. If it's there, it > > + * must call drm_bridge_attach(). The MIPI-DSI host is now functiona= l. >=20 > There is an another problem occur for this scenario in the case of kms > hotplug driver, sun6i_mipi_dsi.c. When host attach wait till drm > device pointer found and drm device pointer would found only when bind > done, and bind would complete only when &drm_bridge_funcs.attach hooks > are complete. But, If DSI driver is fully bridge driven then this > attach in bind will trigger panel_bridge hook attach and at this point > we cannot get panel_bridge at all which indeed second attach would > would failed. >=20 > This is one of the reason I'm trying to use drm_bridge_attach host > attach itself instead of component bind, not yet succeeded. I'm not really sure what you mean, but if you mention the code we have in the DSI driver to make sure we can probe without our panel, then it's not something that we really can support. Bridges cannot be hotplugged in DRM and having some inconsistencies between drivers (since none of them behave the same way there) and between what's plugged on the other side of the DSI bus feels weird. Maxime --utqwuarjxeuflrvb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYIAB0WIQRcEzekXsqa64kGDp7j7w1vZxhRxQUCYQFdIwAKCRDj7w1vZxhR xXboAQDPd3516XTZxLz6b/R54mWo7oRQoZNppedrau7xd1FxAAD/WG/gX9F5lHP5 3F16+6CsvvDV4X2i2GlzFEuQaaRImQM= =xE4I -----END PGP SIGNATURE----- --utqwuarjxeuflrvb--