Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4566604ioa; Wed, 27 Apr 2022 06:37:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwSLfIvmnlhkRlpQkLG/2uTcTF2x++9jyFHRGhPQzUHnREe3TGgdAoE8Ugp/Fa8qtwibt3x X-Received: by 2002:a63:2113:0:b0:399:2df0:ff07 with SMTP id h19-20020a632113000000b003992df0ff07mr23643421pgh.374.1651066673009; Wed, 27 Apr 2022 06:37:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651066673; cv=none; d=google.com; s=arc-20160816; b=b1jDGFXZQI/RRJwt91jfWsiQKGf/YXYqcxs4o2bv/qZ1dixk8VfuvVmfYblysDRDgC 41QOxl/eBktswzh7E05gCkYOyIbHwSdfSHqco3egp1TU2ZInb16Du5iI4pt1yVCiH8wf i1a94z1QVn9G8UpmFuYqWEp5hl2NL9uNPrRdN5Ssx+1wNMPzE8THmvWnrXITHoyMTMRA Se1qCtkHcJSvefhyFlymsObnz35FblcEe0eq8XcyAAnUP3+RwzVGi10musjtlWynE21h g5UePR2P5IHm7AK2Drb3jq6+dt9KMu9rYquM3MVKvY2hw6G8llDj4kEZyKuc6ZZioVW0 DghA== 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=Su4SNUgLAOnH+ELtx7e5nDvEvV06A4pfvyns2XMOpTE=; b=p0Kf5uyW8/ZKykQigdoIzXSYmsWi+du3omRtAD2dpujoqt+HsRIRE32dcCmD54ydYB H+Rkgi7k7m2ZpSDbLIRonYz//IATEJqHf0X9qxAXXZ/izcz2hN0I0WVgpxyjRH+XXQUC inBGFwdNoVIx3Z9AYEjccILr9e8nGX3M5ofR83RUdxPq4zhJp48P2aY6V57ypG/0Tszh yvrMYXC2Zpb72tPPm9KTrUT5EMtkEai75ZMla1/HanWYpT14/xKmM+mkKhVkkLGy549g GuZWVy/OupAJx+qqd0Uk5GRm8PARum81puUDytovbgDsTwvXgGLHyfv1akwryJdcodiM jAKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=Rkk+zeHE; 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 Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s18-20020a170902b19200b0015d48dbb5b3si1537640plr.335.2022.04.27.06.37.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 06: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 (test mode) header.i=@ideasonboard.com header.s=mail header.b=Rkk+zeHE; 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 04E1D38BD5; Wed, 27 Apr 2022 06:10:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235309AbiD0NNf (ORCPT + 99 others); Wed, 27 Apr 2022 09:13:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbiD0NNc (ORCPT ); Wed, 27 Apr 2022 09:13:32 -0400 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62B313808C0 for ; Wed, 27 Apr 2022 06:10:17 -0700 (PDT) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 538EC30B; Wed, 27 Apr 2022 15:10:14 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1651065014; bh=JAZobPiVE1XENl+KRj+bL9U8OuARgC0UTHGiOLvnliY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Rkk+zeHE00lUOzymjDjdK2IOD821KYy+66vwHkrktQxffDOOOmkHWhVCSTVOie9Lt 15T/IOFgSTWuxRfZgv533D1ISRlP2l/aVoPAmoZa6G+bFU45bAlH5F9nQOkObumo1V WFDG5fhV5/9V7Q72CtheDPei+LXoemy97EVem60A= Date: Wed, 27 Apr 2022 16:10:13 +0300 From: Laurent Pinchart To: Jagan Teki Cc: Maxime Ripard , Bjorn Andersson , Paul Kocialkowski , Michael Nazzareno Trimarchi , Maarten Lankhorst , Thomas Zimmermann , David Airlie , Daniel Vetter , Thierry Reding , Rob Clark , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Linus Walleij , Marek Szyprowski , Robert Foss Subject: Re: [PATCH 2/2] Revert "drm: of: Lookup if child node has panel or bridge" Message-ID: References: <20220420231230.58499-1-bjorn.andersson@linaro.org> <20220420231230.58499-2-bjorn.andersson@linaro.org> <20220421082358.ivpmtak3ednvddrc@houat> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: 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 On Wed, Apr 27, 2022 at 05:22:32PM +0530, Jagan Teki wrote: > On Wed, Apr 27, 2022 at 12:29 PM Jagan Teki wrote: > > On Thu, Apr 21, 2022 at 1:54 PM 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 > > > > 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? Can we stop piling hacks and move towards OF graph everywhere, please ? > --- 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; -- Regards, Laurent Pinchart