Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp970620pxb; Fri, 22 Apr 2022 15:37:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfUjrIQofMBOykFQ1ffMoIsA4rPk+ZifwpzYz9fm0rNAB7TE2aRaAh/YRWz08sPXPCDxcF X-Received: by 2002:a17:902:b10c:b0:154:a3b5:b33a with SMTP id q12-20020a170902b10c00b00154a3b5b33amr6659337plr.3.1650667072269; Fri, 22 Apr 2022 15:37:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650667072; cv=none; d=google.com; s=arc-20160816; b=LFjMdZk3Qz1MKtTLCGntkCbMXk+k0WJzYDSvemf598L+jwGdc9zAhr4aLRslidqBfe oI1J9rCaDpcgGxq/RHuaMD9JrVyssaSZCrwxYNgVVjqo3AxwD2Rv0IIXvnsU5IP1WPVX sMVcDCVYYZVgAL8nj2UMPZVxU+8bFRMNdaxfjf0va1/Iko8tPr6m/qPE++1mcy60R482 nku/QB7mjdBMJ4XfenS8a+qsWYpMPhluN+g/4oJDrMYmIh8dtZTVz2vxLlxUZBR0CQ0j 98Gwygrvih81cD6kF2IrBPCQFgxAaedyEjzvvDUGfjullAsVNDjZ5rwUW5YFs2I292hp WAbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=auX3gqJ9RGHSlEjxZinnSR2NSKwIF6WVN5onY8r43Tw=; b=YmGDNv7WrDt6jZiS2Ovd0xAYO7yyUauLDmM5Ll/ja2PhQIlMKXOxo594PaVN0MszN/ CnCf69l3oESyEDY7pOJjoJIzRPSZTU0tDxi1kf/viJWd3qw8YsSSrHIkPVygXAcxuF0a MmpwJthWBeeJHpEhHMy/Yxt27769UwkIviASBfCOStA+RYPpCbJBpkGUnZv01+WFvzHx PQ7pCKvaYbLhsg453XMzDALwwKGeWCULKrGO21eY2x42Ei8bsXhFIYEy3k2rDOCM7wmv qIZzWKlGpI96Sn5bgoOsoAvmKb0WgC/lOkNsnBoER8JARVcKCN0j6txcl7cwm3DPcM3u K4MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=fQ89SzY9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u2-20020a170902e80200b00156b765043fsi9809754plg.389.2022.04.22.15.37.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 15:37:52 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=fQ89SzY9; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 353732715C1; Fri, 22 Apr 2022 13:25:11 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385618AbiDUHOq (ORCPT + 99 others); Thu, 21 Apr 2022 03:14:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385603AbiDUHOp (ORCPT ); Thu, 21 Apr 2022 03:14:45 -0400 Received: from relay6-d.mail.gandi.net (relay6-d.mail.gandi.net [217.70.183.198]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9938417057 for ; Thu, 21 Apr 2022 00:11:56 -0700 (PDT) Received: (Authenticated sender: paul.kocialkowski@bootlin.com) by mail.gandi.net (Postfix) with ESMTPSA id DBB0CC0004; Thu, 21 Apr 2022 07:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1650525114; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=auX3gqJ9RGHSlEjxZinnSR2NSKwIF6WVN5onY8r43Tw=; b=fQ89SzY9T2yawRq6xMz3v04rLQiHaJAaKKURUEMVZ/j5FGfFskv02t3pEkfACh/rPC2KKH mOpRrNcy3/0IRDB49yLkQMw/w0EnpmzjgM7sncY6yB0Z6TTsOeNH/QkFqHiCBM2ymtzJ+I v+8igLxThVX33sEBIddO3Qih8XLPGwbmRzCrCmyaT30wAcBIIO1qux8iiS4A4NbCB+BjLH emo5MtaxPG/3ADGsV6vniKWMaWUh9r9Wj5emSDXHJaWnhxQf9ce+0Xi6ScXI26cgbHYYQ+ I1uWQyw43A4ReI39BVDEjcjJgs7/lcUDQIw66/svPOssEembEZz3evxHprvrmQ== Date: Thu, 21 Apr 2022 09:11:52 +0200 From: Paul Kocialkowski To: Bjorn Andersson Cc: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Thierry Reding , Rob Clark , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] Revert "drm: of: Properly try all possible cases for bridge/panel detection" Message-ID: References: <20220420231230.58499-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="IGpprMjyZuptqbr8" Content-Disposition: inline In-Reply-To: <20220420231230.58499-1-bjorn.andersson@linaro.org> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --IGpprMjyZuptqbr8 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Bjorn, On Wed 20 Apr 22, 16:12, Bjorn Andersson wrote: > 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). >=20 > 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. >=20 > 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. >=20 > 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. >=20 > 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). >=20 > 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")'. >=20 > Signed-off-by: Bjorn Andersson Acked-by: Paul Kocialkowski Cheers, Paul > --- > drivers/gpu/drm/drm_of.c | 99 ++++++++++++++++++++-------------------- > 1 file changed, 49 insertions(+), 50 deletions(-) >=20 > 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_nod= e *node, > } > EXPORT_SYMBOL_GPL(drm_of_encoder_active_endpoint); > =20 > -static int find_panel_or_bridge(struct device_node *node, > - struct drm_panel **panel, > - struct drm_bridge **bridge) > -{ > - if (panel) { > - *panel =3D of_drm_find_panel(node); > - if (!IS_ERR(*panel)) > - return 0; > - > - /* Clear the panel pointer in case of error. */ > - *panel =3D NULL; > - } > - > - /* No panel found yet, check for a bridge next. */ > - if (bridge) { > - *bridge =3D 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 =3D -EPROBE_DEFER; > + struct device_node *remote; > =20 > if (!panel && !bridge) > return -EINVAL; > - > if (panel) > *panel =3D NULL; > - if (bridge) > - *bridge =3D NULL; > - > - /* Check for a graph on the device node first. */ > - if (of_graph_is_present(np)) { > - node =3D of_graph_get_remote_node(np, port, endpoint); > - if (node) { > - ret =3D find_panel_or_bridge(node, panel, bridge); > - of_node_put(node); > - > - if (!ret) > - return 0; > - } > - } > =20 > - /* 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; > =20 > - ret =3D 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 =3D of_graph_get_remote_node(np, port, endpoint); > + > +of_find_panel_or_bridge: > + if (!remote) > + return -ENODEV; > + > + if (panel) { > + *panel =3D of_drm_find_panel(remote); > + if (!IS_ERR(*panel)) > + ret =3D 0; > + else > + *panel =3D NULL; > + } > + > + /* No panel found yet, check for a bridge next. */ > + if (bridge) { > + if (ret) { > + *bridge =3D of_drm_find_bridge(remote); > + if (*bridge) > + ret =3D 0; > + } else { > + *bridge =3D NULL; > + } > =20 > - /* Stop at the first found occurrence. */ > - if (!ret) > - return 0; > } > =20 > - return -EPROBE_DEFER; > + of_node_put(remote); > + return ret; > } > EXPORT_SYMBOL_GPL(drm_of_find_panel_or_bridge); > =20 > --=20 > 2.35.1 >=20 --=20 Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com --IGpprMjyZuptqbr8 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEJZpWjZeIetVBefti3cLmz3+fv9EFAmJhA7gACgkQ3cLmz3+f v9F5eAf8DSn5rUoTVRvz8d54z0pmGXraRjFUR62/CJQXXJLdzU8zxT2HWXc4Cpig Y6sSCV7ZrdephXnxnj2wS2NxuQcYNuM9kVawdLAWOBc6a5K4qpkUqMyxsV22zO8D Fj/0DN87ca65SDepivE2ZPVEiZjmk1iUeRH+2d7VsMXsISzvXGuELwGAc8y0xoHj ZesxD9zK28YFffBJW3C3AcMYT7Cn81uAiLrb3g1YxtsPdIwbo+A1CNQ98OmC8LqB wAjckScXtdg5y9mA/CVdF/ny3PRqx2tGvD/4utOhfKUXDHomkYRIyuM6KJyxxXh3 a1Z5f3FSyq8Ksm7UcuurjwzcRm4DJg== =jIW0 -----END PGP SIGNATURE----- --IGpprMjyZuptqbr8--