From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Jagan Teki <jagan@amarulasolutions.com>
Cc: Maxime Ripard <maxime@cerno.tech>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Michael Nazzareno Trimarchi <michael@amarulasolutions.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
Thierry Reding <thierry.reding@gmail.com>,
Rob Clark <robdclark@gmail.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Linus Walleij <linus.walleij@linaro.org>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robert Foss <robert.foss@linaro.org>
Subject: Re: [PATCH 2/2] Revert "drm: of: Lookup if child node has panel or bridge"
Date: Wed, 27 Apr 2022 14:19:32 +0200 [thread overview]
Message-ID: <Ymk01GLqfIKoZtJQ@aptenodytes> (raw)
In-Reply-To: <CAMty3ZAkw0rssCzR_ka7U9JeoGxJr5JPM7GWDfd1dob9goL-BQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 4509 bytes --]
Hi Jagan,
On Wed 27 Apr 22, 17:22, Jagan Teki wrote:
> On Wed, Apr 27, 2022 at 12:29 PM Jagan Teki <jagan@amarulasolutions.com> wrote:
> >
> > On Thu, Apr 21, 2022 at 1:54 PM Maxime Ripard <maxime@cerno.tech> 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@linaro.org> 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.
> >
> > I think using the same existing helper and updating child support is
> > make sense, as there is a possibility to use the same host for child
> > and OF-graph bindings.
> >
> > I can see two possible solutions (as of now)
> >
> > 1. adding "dcs-child-type" bindings for child-based panel or bridge
> > 2. iterate child and skip those nodes other than panel or bridge. or
> > iterate sub-child to find it has a panel or bridge-like aux-bus (which
> > is indeed hard as this configuration seems not 'standard' i think )
> >
> > Any inputs?
>
> Checking aux-bus with the sub-node panel can be a possible check to
> look at it, any comments?
That looks very fragile and oddly specific. Also why base changes on the
original patch that you made?
With the follow-up fixes, we are checking the of graph first and only
considering child nodes if the of graph and remote are missing, so there isn't
really a need to be more specific in the child noise discrimination.
Actually I should also make a new version of "drm: of: Improve error handling in
bridge/panel detection" to also return -ENODEV if of_graph_get_remote_node
fails, so that it doesn't try to use the child node when the graph is defined
but not remote is defined.
Paul
> --- a/drivers/gpu/drm/drm_of.c
> +++ b/drivers/gpu/drm/drm_of.c
> @@ -244,6 +244,25 @@ int drm_of_find_panel_or_bridge(const struct
> device_node *np,
> if (panel)
> *panel = NULL;
>
> + /**
> + * 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;
> +
> + if (!(of_node_name_eq(remote, "aux-bus") &&
> + of_get_child_by_name(remote, "panel")))
> + continue;
> +
> + 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,
> @@ -254,6 +273,8 @@ int drm_of_find_panel_or_bridge(const struct
> device_node *np,
> return -ENODEV;
>
> remote = of_graph_get_remote_node(np, port, endpoint);
> +
> +of_find_panel_or_bridge:
> if (!remote)
> return -ENODEV;
>
> Jagan.
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-04-27 12:19 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-20 23:12 [PATCH 1/2] Revert "drm: of: Properly try all possible cases for bridge/panel detection" 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 [this message]
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
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=Ymk01GLqfIKoZtJQ@aptenodytes \
--to=paul.kocialkowski@bootlin.com \
--cc=airlied@linux.ie \
--cc=bjorn.andersson@linaro.org \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jagan@amarulasolutions.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maxime@cerno.tech \
--cc=michael@amarulasolutions.com \
--cc=robdclark@gmail.com \
--cc=robert.foss@linaro.org \
--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;
as well as URLs for NNTP newsgroup(s).