From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752412AbcBVQMh (ORCPT ); Mon, 22 Feb 2016 11:12:37 -0500 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:54824 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751119AbcBVQMf (ORCPT ); Mon, 22 Feb 2016 11:12:35 -0500 Message-ID: <1456157547.5148.44.camel@pengutronix.de> Subject: Re: Disabling graph endpoints in device trees From: Philipp Zabel To: John Keeping Cc: devicetree@vger.kernel.org, Rob Herring , Frank Rowand , Grant Likely , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Date: Mon, 22 Feb 2016 17:12:27 +0100 In-Reply-To: <20160222141438.79de430c.john@metanate.com> References: <20160222141438.79de430c.john@metanate.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:96de:80ff:fec2:9969 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi John, Am Montag, den 22.02.2016, 14:14 +0000 schrieb John Keeping: > Hi, > > Is there a reason why endpoints in a device tree graph can't be > disabled? You can always remove them using /delete-node/, which also has the advantage of reminding you not to leave a single dangling endpoint. > I would like to be able to force the use of a particular CRTC for > certain outputs even though the hardware is capable of connecting any > CRTC to any output. In this case I need to be able to support a wide > range of frequencies for external HDMI monitors so I will configure one > of the CRTCs to be able to generate these while the other will be tied > into a limited set of clock rates as a result of the overall system > clock setup. > > Currently this can only be achieved by removing the endpoints from the > base SoC .dtsi file but it feels like it should be possible to add > 'status = "disabled"' to the nodes in the board-specific .dts in order > to disable undesirable configurations. > > I tested the change below and it behaves exactly as I want, but I don't > claim to understand all of the users of these functions to know if it > will break something else (hence this isn't a formal patch). I don't know that any driver depends on being able to parse disabled endpoints, but given the above I'm not sure that keeping disabled endpoints in the device tree is a useful feature. Disabling ports makes more sense to me. It should be documented in Documentation/devicetree/bindings/graph.txt though. > -- >8 -- > diff --git a/drivers/of/base.c b/drivers/of/base.c > index 017dd94..1e56b91 100644 > --- a/drivers/of/base.c > +++ b/drivers/of/base.c > @@ -2143,7 +2143,7 @@ struct device_node *of_graph_get_port_by_id(struct device_node *parent, u32 id) > if (node) > parent = node; > > - for_each_child_of_node(parent, port) { > + for_each_available_child_of_node(parent, port) { > u32 port_id = 0; > > if (of_node_cmp(port->name, "port") != 0) > @@ -2209,7 +2209,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, > * getting the next child. If the previous endpoint is NULL this > * will return the first child. > */ > - endpoint = of_get_next_child(port, prev); > + endpoint = of_get_next_available_child(port, prev); > if (endpoint) { > of_node_put(port); > return endpoint; > @@ -2219,7 +2219,7 @@ struct device_node *of_graph_get_next_endpoint(const struct device_node *parent, > prev = NULL; > > do { > - port = of_get_next_child(parent, port); > + port = of_get_next_available_child(parent, port); > if (!port) > return NULL; > } while (of_node_cmp(port->name, "port")); > -- 8< -- > > > Thanks, > John best regards Philipp