Re: [PATCH 2/2] Revert "drm: of: Lookup if child node has panel or bridge"

From: Marek Szyprowski
Date: Thu Apr 28 2022 - 02:17:50 EST


Hi Maxime,

On 27.04.2022 16:34, Maxime Ripard wrote:
> On Tue, Apr 26, 2022 at 01:40:31PM +0530, Jagan Teki wrote:
>> On Tue, Apr 26, 2022 at 1:24 PM Paul Kocialkowski
>> <paul.kocialkowski@xxxxxxxxxxx> wrote:
>>> On Thu 21 Apr 22, 10:59, Paul Kocialkowski wrote:
>>>> On Thu 21 Apr 22, 10:23, Maxime Ripard wrote:
>>>>> On Thu, Apr 21, 2022 at 01:15:54PM +0530, Jagan Teki wrote:
>>>>>> + Linus
>>>>>> + Marek
>>>>>> + Laurent
>>>>>> + Robert
>>>>>>
>>>>>> On Thu, Apr 21, 2022 at 4:40 AM Bjorn Andersson
>>>>>> <bjorn.andersson@xxxxxxxxxx> wrote:
>>>>>>> Commit '80253168dbfd ("drm: of: Lookup if child node has panel or
>>>>>>> bridge")' attempted to simplify the case of expressing a simple panel
>>>>>>> under a DSI controller, by assuming that the first non-graph child node
>>>>>>> was a panel or bridge.
>>>>>>>
>>>>>>> Unfortunately for non-trivial cases the first child node might not be a
>>>>>>> panel or bridge. Examples of this can be a aux-bus in the case of
>>>>>>> DisplayPort, or an opp-table represented before the panel node.
>>>>>>>
>>>>>>> In these cases the reverted commit prevents the caller from ever finding
>>>>>>> a reference to the panel.
>>>>>>>
>>>>>>> This reverts commit '80253168dbfd ("drm: of: Lookup if child node has
>>>>>>> panel or bridge")', in favor of using an explicit graph reference to the
>>>>>>> panel in the trivial case as well.
>>>>>> This eventually breaks many child-based devm_drm_of_get_bridge
>>>>>> switched drivers. Do you have any suggestions on how to proceed to
>>>>>> succeed in those use cases as well?
>>>>> I guess we could create a new helper for those, like
>>>>> devm_drm_of_get_bridge_with_panel, or something.
>>>> Oh wow I feel stupid for not thinking about that.
>>>>
>>>> Yeah I agree that it seems like the best option.
>>> Should I prepare a patch with such a new helper?
>>>
>>> The idea would be to keep drm_of_find_panel_or_bridge only for the of graph
>>> case and add one for the child node case, maybe:
>>> drm_of_find_child_panel_or_bridge.
>>>
>>> I really don't have a clear idea of which driver would need to be switched
>>> over though. Could someone (Jagan?) let me know where it would be needed?
>> sun6i_mipi_dsi
> It doesn't look like sun6i_mipi_dsi is using devm_drm_of_get_bridge at all?
>
>> exynos_drm_dsi
> If you reference 711c7adc4687, I don't see why we would need to switch
> it back to the old behaviour. It wasn't iterating over its child node
> before, so what does the switch to drm_of_get_bridge broke exactly?

It broke getting the panel if it is a direct child of the DSI device
node. It worked before because it used following code:

dsi->panel = of_drm_find_panel(device->dev.of_node);

which got replaced by devm_drm_of_get_bridge().

>> mcde_dsi (as of now)
> Yeah, we do need to revert 3730bc6147b0 and 3d7039e1e649
>
> Maxime
>
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland