From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752495AbdF3ItI (ORCPT ); Fri, 30 Jun 2017 04:49:08 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:59913 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751940AbdF3Isd (ORCPT ); Fri, 30 Jun 2017 04:48:33 -0400 X-AuditID: cbfec7f2-f797e6d000004438-6f-5956105d3c35 Subject: Re: [PATCH 6/8] drm: Allow DSI devices to be registered before the host registers. To: Eric Anholt , Archit Taneja , dri-devel@lists.freedesktop.org, Laurent Pinchart , Thierry Reding Cc: linux-kernel@vger.kernel.org, Boris Brezillon From: Andrzej Hajda Message-id: <2bf3dec6-95a9-9572-8999-bbd89726bdfc@samsung.com> Date: Fri, 30 Jun 2017 10:48:27 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-version: 1.0 In-reply-to: <87injeom3p.fsf@eliezer.anholt.net> Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 7bit Content-language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCKsWRmVeSWpSXmKPExsWy7djP87pxAmGRBs/sLJo63rJaHHixkMXi ytf3bBYHGi8zWnROXMJucXnXHDaLn7vmsTiwezS9P8bmcbmvl8njyaaLjB47Z91l95jdMZPV 4373cSaPz5vkAtijuGxSUnMyy1KL9O0SuDLefVAp2ClbcXLTF7YGxrPiXYycHBICJhIt+xax QdhiEhfurQeyuTiEBJYySuxa8okZwvnMKPFt9Xw2mI5VVzcxQSSWMUoceDqVEcJ5xiix99d1 RpAqYYFYiX0tXWDtIgIXGSXuvvwClmAWiJDY+28XO4jNJqAp8XfzTbCxvAJ2Eo+ndYPZLAKq ElvaOphAbFGg+kWTJrJD1AhK/Jh8jwXE5hQwkOhddZgJYqamxIsvk1ggbHmJzWveMk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hqaXFuem6xkV5xYm5xaV66XnJ+7iZGYHRuO/Zzyw7GrnfBhxgFOBiVeHgj1EIj hVgTy4orcw8xSnAwK4nwGv8ECvGmJFZWpRblxxeV5qQWH2I0BXptIrOUaHI+MHHklcQbmhia WxoaGVtYmBsZKYnzTv1wJVxIID2xJDU7NbUgtQimj4mDU6qBMWtxg9iE7fU3FG8tOfZD3XOv 9R2bpb471aZtqjqXuch6w/EZ02ydJTalzzgdtedo9sFmkz1zZCR4ZhximNL4+p/n5/5Viq9L VOyWW/3us7yYU1bMpDPJ+sEXjycXtCVaPTyOM85rOxN/mGtq+86Xj3suO9Su0/W2LyxhO/SF I7hILeL0f961+5VYijMSDbWYi4oTAQe/eBzkAgAA X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170630084829eucas1p2d28730f034981d6928669dd871b6722e X-Msg-Generator: CA X-Sender-IP: 182.198.249.180 X-Local-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRvsgrw=?= =?UTF-8?B?7ISx7KCE7J6QG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Global-Sender: =?UTF-8?B?QW5kcnplaiBIYWpkYRtTUlBPTC1LZXJuZWwgKFRQKRtTYW1z?= =?UTF-8?B?dW5nIEVsZWN0cm9uaWNzG1NlbmlvciBTb2Z0d2FyZSBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG0VIURtDMTBDRDAyQ0QwMjczOTI=?= CMS-TYPE: 201P X-HopCount: 7 X-CMS-RootMailID: 20170629050326epcas4p2911c3ab64231110c8b095080db604ef4 X-RootMTR: 20170629050326epcas4p2911c3ab64231110c8b095080db604ef4 References: <20170627195839.3338-1-eric@anholt.net> <20170627195839.3338-7-eric@anholt.net> <6fbaa797-1040-48e8-c361-dad4363cd30d@codeaurora.org> <87injeom3p.fsf@eliezer.anholt.net> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29.06.2017 17:22, Eric Anholt wrote: > 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. No, drm master will wait till all components are present. > > I *think* what you're thinking is moving DSI host register to probe, yes, this way you will allow to create dsi devices. > and > then panel lookup stays in bind. no, panel lookup will be performed in dsi_host attach callback, and component_add will be called also there, if all required panels/bridges are get. > 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. I think it is irrelevant, with the current design only transactions between prepare/unprepare callbacks have chances to succeed. Andrzej