From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Anholt Subject: Re: [PATCH 6/8] drm: Allow DSI devices to be registered before the host registers. Date: Thu, 29 Jun 2017 08:22:02 -0700 Message-ID: <87injeom3p.fsf@eliezer.anholt.net> References: <20170627195839.3338-1-eric@anholt.net> <20170627195839.3338-7-eric@anholt.net> <6fbaa797-1040-48e8-c361-dad4363cd30d@codeaurora.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1708046612==" Return-path: Received: from anholt.net (anholt.net [50.246.234.109]) by gabe.freedesktop.org (Postfix) with ESMTP id A737F6E142 for ; Thu, 29 Jun 2017 15:22:05 +0000 (UTC) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" To: Andrzej Hajda , Archit Taneja , dri-devel@lists.freedesktop.org, Laurent Pinchart , Thierry Reding Cc: Boris Brezillon , linux-kernel@vger.kernel.org List-Id: dri-devel@lists.freedesktop.org --===============1708046612== Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" --=-=-= Content-Type: text/plain Andrzej Hajda writes: > On 29.06.2017 07:03, Archit Taneja wrote: >> >> On 06/28/2017 01:28 AM, Eric Anholt wrote: >>> When a mipi_dsi_host is registered, the DT is walked to find any child >>> nodes with compatible strings. Those get registered as DSI devices, >>> and most DSI panel drivers are mipi_dsi_drivers that attach to those nodes. >>> >>> There is one special case currently, the adv7533 bridge, where the >>> bridge probes on I2C, and during the bridge attach step it looks up >>> the mipi_dsi_host and registers the mipi_dsi_device (for its own stub >>> mipi_dsi_driver). >>> >>> For the Raspberry Pi panel, though, we also need to attach on I2C (our >>> control bus), but don't have a bridge driver. The lack of a bridge's >>> attach() step like adv7533 uses means that we aren't able to delay the >>> mipi_dsi_device creation until the mipi_dsi_host is present. >>> >>> To fix this, we extend mipi_dsi_device_register_full() to allow being >>> called with a NULL host, which puts the device on a queue waiting for >>> a host to appear. When a new host is registered, we fill in the host >>> value and finish the device creation process. >> This is quite a nice idea. The only bothering thing is the info.of_node usage >> varies between child nodes (mipi_dsi_devs) and non-child nodes (i2c control >> bus). >> >> For DSI children expressed in DT, the of_node in info holds the DT node >> corresponding to the DSI child itself. For non-DT ones, this patch assumes >> that info.of_node stores the DSI host DT node. I think it should be okay as >> long as we mention the usage in a comment somewhere. The other option is to >> have a new info.host_node field to keep a track of the host DT node. > > Field abuse is not a biggest issue. > > This patch changes totally semantic of mipi_dsi_device_register_full. > Currently semantic of *_device_register* function is to create and add > device to existing bus, ie after return we have device attached to bus, > so it can be instantly used. With this change function can return some > unattached device, without warranty it will be ever attached - kind of > hidden deferring. Such change looks for me quite dangerous, even if it > looks convenient in this case. It only changes the semantic if you past in a NULL host, from "oops" to "do something useful". > As discussed in other thread more appealing solution for me would be: > 1. host creates dsi bus, but doesn't call component_add as it does not > have all required resources. > 2. host waits for all required dsi devs attached, gets registered panels > or bridges and calls component_add after that. > 3. in bind phase it has all it needs, hasn't it? > > I did not spent much time on this idea, so I cannot guarantee it has not > fundamental issues :) If component_add() isn't called during probe, then DSI would just get skipped during bind as far as I know. I *think* what you're thinking is moving DSI host register to probe, and then panel lookup stays in bind. That seems much more risky to me -- do we know for sure that no mipi_dsi_device will do any DSI transactions during its probe? I would expect some of them to. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE/JuuFDWp9/ZkuCBXtdYpNtH8nugFAllVGxoACgkQtdYpNtH8 nuhqYg//Vwj272DLD/OtELTJt1xPf2+9j85FU+0OGHpBSuQrXQn3wPEe5K4C7EGO BMGbR9STEb0dWKcVT1Fa1tL68k4iaOk73qgB3in6espETEAOSTFg+oz9F9legib8 eViAAPmwAY/+Say1cADaTzP1Qa4wNGrg1aCg8TAv0lJxERrrkPJXAPvG0c23cGRF eSKXNCZGAnw5gxjZ6eb4HXfBJNiZ7o11inv64XJQanI+ThO9+JCt3Ir9jRAA/Eb2 kDnKy3D88skzTWyMWKIFwV4iDkq+0U3F870b6300S7eril8gMPerGiJ9399IZosW mFUdi03j100Im6YgFS17FsVpJFAeKajLl+2fjpw53/fBKyk9otLnVyQgCIwmcci8 YuWk1oxqY/IAnaqZRQpRXuVf83CYvs4oAenzGZKUpBd9Cd0RB+4+dlESiG4xaAF1 /B4rkcnneJeDV5BNH+NbFvGhKz2eQkPA9EupF7z7j3Mm8c8FFfZzev0Js9zloc6s fJAwIogV9+RAmUMLgyTMfnK4eYE5RKJF+joaBeU7v9A2ej/UCsccJcCU/HvwipC0 9s0NCitwFPI/jIrjweqxqwq33PlzLfj9UN+7FqVInKTPrYM/BWXVJgtE2v9y5jA0 d47BTuDT276W/+rvI3TpuQev2OdaEGWJJaRtzlluwgfvtpGnYSU= =sVYQ -----END PGP SIGNATURE----- --=-=-=-- --===============1708046612== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KZHJpLWRldmVs IG1haWxpbmcgbGlzdApkcmktZGV2ZWxAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vZHJpLWRldmVsCg== --===============1708046612==--