mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Raphael Gallais-Pou <raphael.gallais-pou@foss.st.com>
To: Paul Kocialkowski <paul.kocialkowski@bootlin.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: <dri-devel@lists.freedesktop.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@linux.ie>, <linux-kernel@vger.kernel.org>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jagan Teki <jagan@amarulasolutions.com>
Subject: Re: [PATCH 1/2] Revert "drm: of: Properly try all possible cases for bridge/panel detection"
Date: Fri, 22 Apr 2022 09:58:27 +0200	[thread overview]
Message-ID: <133fb3f2-16b9-aff8-c4c8-67beaa19703d@foss.st.com> (raw)
In-Reply-To: <YmED/vYsrjoc4OjC@aptenodytes>

Hi

On 4/21/22 09:13, Paul Kocialkowski wrote:
> Hi,
>
> On Wed 20 Apr 22, 16:19, Bjorn Andersson wrote:
>> On Wed 20 Apr 16:12 PDT 2022, Bjorn Andersson wrote:
>>
>> Sorry, I missed Jagan and Linus, author and reviewer of the reverted
>> patch 2, among the recipients.
> I'd be curious to have Jagan's feedback on why the change was needed in the
> first place and whether an accepted dt binding relies on it.
>
> We might be able to just keep the whole thing reverted (forever).


This patch was merged within the last mainline kernel and was breaking our STM32MP15 platforms.

Switching back to drm-based kernel (drm-next-fixes branch) made me realize this patch was faulty.
I'm glad it was reverted.


Thanks,

Raphaël

>
> Paul
>
>> Regards,
>> Bjorn
>>
>>> Commit '80253168dbfd ("drm: of: Lookup if child node has panel or
>>> bridge")' introduced the ability to describe a panel under a display
>>> controller without having to use a graph to connect the controller to
>>> its single child panel (or bridge).
>>>
>>> The implementation of this would find the first non-graph node and
>>> attempt to acquire the related panel or bridge. This prevents cases
>>> where any other child node, such as a aux bus for a DisplayPort
>>> controller, or an opp-table to find the referenced panel.
>>>
>>> Commit '67bae5f28c89 ("drm: of: Properly try all possible cases for
>>> bridge/panel detection")' attempted to solve this problem by not
>>> bypassing the graph reference lookup before attempting to find the panel
>>> or bridge.
>>>
>>> While this does solve the case where a proper graph reference is
>>> present, it does not allow the caller to distinguish between a
>>> yet-to-be-probed panel or bridge and the absence of a reference to a
>>> panel.
>>>
>>> One such case is a DisplayPort controller that on some boards have an
>>> explicitly described reference to a panel, but on others have a
>>> discoverable DisplayPort display attached (which doesn't need to be
>>> expressed in DeviceTree).
>>>
>>> This reverts commit '67bae5f28c89 ("drm: of: Properly try all possible
>>> cases for bridge/panel detection")', as a step towards reverting commit
>>> '80253168dbfd ("drm: of: Lookup if child node has panel or bridge")'.
>>>
>>> Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
>>> ---
>>>  drivers/gpu/drm/drm_of.c | 99 ++++++++++++++++++++--------------------
>>>  1 file changed, 49 insertions(+), 50 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
>>> index f4df344509a8..026e4e29a0f3 100644
>>> --- a/drivers/gpu/drm/drm_of.c
>>> +++ b/drivers/gpu/drm/drm_of.c
>>> @@ -214,29 +214,6 @@ int drm_of_encoder_active_endpoint(struct device_node *node,
>>>  }
>>>  EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint);
>>>  
>>> -static int find_panel_or_bridge(struct device_node *node,
>>> -				struct drm_panel **panel,
>>> -				struct drm_bridge **bridge)
>>> -{
>>> -	if (panel) {
>>> -		*panel = of_drm_find_panel(node);
>>> -		if (!IS_ERR(*panel))
>>> -			return 0;
>>> -
>>> -		/* Clear the panel pointer in case of error. */
>>> -		*panel = NULL;
>>> -	}
>>> -
>>> -	/* No panel found yet, check for a bridge next. */
>>> -	if (bridge) {
>>> -		*bridge = of_drm_find_bridge(node);
>>> -		if (*bridge)
>>> -			return 0;
>>> -	}
>>> -
>>> -	return -EPROBE_DEFER;
>>> -}
>>> -
>>>  /**
>>>   * drm_of_find_panel_or_bridge - return connected panel or bridge device
>>>   * @np: device tree node containing encoder output ports
>>> @@ -259,44 +236,66 @@ int drm_of_find_panel_or_bridge(const struct device_node *np,
>>>  				struct drm_panel **panel,
>>>  				struct drm_bridge **bridge)
>>>  {
>>> -	struct device_node *node;
>>> -	int ret;
>>> +	int ret = -EPROBE_DEFER;
>>> +	struct device_node *remote;
>>>  
>>>  	if (!panel && !bridge)
>>>  		return -EINVAL;
>>> -
>>>  	if (panel)
>>>  		*panel = NULL;
>>> -	if (bridge)
>>> -		*bridge = NULL;
>>> -
>>> -	/* Check for a graph on the device node first. */
>>> -	if (of_graph_is_present(np)) {
>>> -		node = of_graph_get_remote_node(np, port, endpoint);
>>> -		if (node) {
>>> -			ret = find_panel_or_bridge(node, panel, bridge);
>>> -			of_node_put(node);
>>> -
>>> -			if (!ret)
>>> -				return 0;
>>> -		}
>>> -	}
>>>  
>>> -	/* Otherwise check for any child node other than port/ports. */
>>> -	for_each_available_child_of_node(np, node) {
>>> -		if (of_node_name_eq(node, "port") ||
>>> -		    of_node_name_eq(node, "ports"))
>>> +	/**
>>> +	 * Devices can also be child nodes when we also control that device
>>> +	 * through the upstream device (ie, MIPI-DCS for a MIPI-DSI device).
>>> +	 *
>>> +	 * Lookup for a child node of the given parent that isn't either port
>>> +	 * or ports.
>>> +	 */
>>> +	for_each_available_child_of_node(np, remote) {
>>> +		if (of_node_name_eq(remote, "port") ||
>>> +		    of_node_name_eq(remote, "ports"))
>>>  			continue;
>>>  
>>> -		ret = find_panel_or_bridge(node, panel, bridge);
>>> -		of_node_put(node);
>>> +		goto of_find_panel_or_bridge;
>>> +	}
>>> +
>>> +	/*
>>> +	 * of_graph_get_remote_node() produces a noisy error message if port
>>> +	 * node isn't found and the absence of the port is a legit case here,
>>> +	 * so at first we silently check whether graph presents in the
>>> +	 * device-tree node.
>>> +	 */
>>> +	if (!of_graph_is_present(np))
>>> +		return -ENODEV;
>>> +
>>> +	remote = of_graph_get_remote_node(np, port, endpoint);
>>> +
>>> +of_find_panel_or_bridge:
>>> +	if (!remote)
>>> +		return -ENODEV;
>>> +
>>> +	if (panel) {
>>> +		*panel = of_drm_find_panel(remote);
>>> +		if (!IS_ERR(*panel))
>>> +			ret = 0;
>>> +		else
>>> +			*panel = NULL;
>>> +	}
>>> +
>>> +	/* No panel found yet, check for a bridge next. */
>>> +	if (bridge) {
>>> +		if (ret) {
>>> +			*bridge = of_drm_find_bridge(remote);
>>> +			if (*bridge)
>>> +				ret = 0;
>>> +		} else {
>>> +			*bridge = NULL;
>>> +		}
>>>  
>>> -		/* Stop at the first found occurrence. */
>>> -		if (!ret)
>>> -			return 0;
>>>  	}
>>>  
>>> -	return -EPROBE_DEFER;
>>> +	of_node_put(remote);
>>> +	return ret;
>>>  }
>>>  EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge);
>>>  
>>> -- 
>>> 2.35.1
>>>

  parent reply	other threads:[~2022-04-22  7:58 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-20 23:12 Bjorn Andersson
2022-04-20 23:12 ` [PATCH 2/2] Revert "drm: of: Lookup if child node has panel or bridge" Bjorn Andersson
2022-04-21  7:20   ` (subset) " Maxime Ripard
2022-04-21  7:45   ` Jagan Teki
2022-04-21  8:23     ` Maxime Ripard
2022-04-21  8:59       ` Paul Kocialkowski
2022-04-26  7:54         ` Paul Kocialkowski
2022-04-26  8:10           ` Jagan Teki
2022-04-27 14:34             ` Maxime Ripard
2022-04-28  6:17               ` Marek Szyprowski
2022-04-28  8:25                 ` Jagan Teki
2022-04-28  8:39               ` Jagan Teki
2022-04-28 22:17                 ` Laurent Pinchart
2022-04-29  8:24                   ` Jagan Teki
2022-04-29 15:46                   ` Maxime Ripard
2022-04-29 16:05                     ` Laurent Pinchart
2022-05-04 15:08                       ` Maxime Ripard
2022-04-26 11:33           ` Laurent Pinchart
2022-04-26 12:41             ` Paul Kocialkowski
2022-04-26 12:54               ` Maxime Ripard
2022-04-26 12:55                 ` Maxime Ripard
2022-04-26 13:04                   ` Paul Kocialkowski
2022-04-26 13:19                     ` Maxime Ripard
2022-04-26 13:50                       ` Paul Kocialkowski
2022-04-26 21:10                         ` Bjorn Andersson
2022-04-27  7:34                           ` Paul Kocialkowski
2022-05-03  0:03                             ` Bjorn Andersson
2022-04-26 12:58                 ` Paul Kocialkowski
2022-04-27 13:10                 ` Laurent Pinchart
2022-04-26 12:51           ` Maxime Ripard
2022-04-27  6:59       ` Jagan Teki
2022-04-27 11:52         ` Jagan Teki
2022-04-27 12:19           ` Paul Kocialkowski
2022-04-27 12:59             ` Jagan Teki
2022-04-27 13:10           ` Laurent Pinchart
2022-04-20 23:19 ` [PATCH 1/2] Revert "drm: of: Properly try all possible cases for bridge/panel detection" Bjorn Andersson
2022-04-21  7:13   ` Paul Kocialkowski
2022-04-21  7:26     ` Maxime Ripard
2022-04-22  7:58     ` Raphael Gallais-Pou [this message]
2022-04-21  7:11 ` Paul Kocialkowski
2022-04-21  7:20 ` (subset) " Maxime Ripard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=133fb3f2-16b9-aff8-c4c8-67beaa19703d@foss.st.com \
    --to=raphael.gallais-pou@foss.st.com \
    --cc=airlied@linux.ie \
    --cc=bjorn.andersson@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=jagan@amarulasolutions.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paul.kocialkowski@bootlin.com \
    --cc=thierry.reding@gmail.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®