From patchwork Mon Feb 22 14:14:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Keeping X-Patchwork-Id: 8376831 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0F2129F372 for ; Mon, 22 Feb 2016 14:15:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2F6BC20515 for ; Mon, 22 Feb 2016 14:15:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id BA8C520511 for ; Mon, 22 Feb 2016 14:14:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB0476E1E7; Mon, 22 Feb 2016 14:14:56 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from metanate.com (dougal.metanate.com [90.155.101.14]) by gabe.freedesktop.org (Postfix) with ESMTPS id A93626E1E7 for ; Mon, 22 Feb 2016 14:14:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=simple/simple; d=metanate.com; s=stronger; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Subject:Cc:To:From:Date; bh=IJFnz7X0Qew+NzVfCC1GOw5NvuYpS5VmoFSCu2qUoFs=; b=d6UZsTZF7FVgbFYiACiYOr2o0E4pimlsWhhKUt0Ri3pXsefoKHcHElDYU330LYblSjU9uvvl4pe24wd2ybQ4ls1fXUbKDXM25Tnskaf4j77Wu1Uk1VR/YM+DSN3laDG05PAEwQLBndulu9hcYtsQAMMVzWdbLvdKPdYrJyVhvRA8DdufSuNFFrIrWDkf2MONTJN7gbUseIIjK8s+5cIP256EX/OUX25DFu8Iz4VK9Mp8jt9kISJO0ael50W95NV2oAVBVRYtrNGLsExa4nMqZ866/kBTT7RNrVtK3RQCX7IMKOyj5jvdUYE7iAZbP+K06JjZu0/qYDT/j+Dq3XGByQ==; Received: from brian ([192.168.88.1] helo=localhost.localdomain) by shrek.metanate.com with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.83_RC2) (envelope-from ) id 1aXrG5-0004Ct-F2; Mon, 22 Feb 2016 14:14:41 +0000 Date: Mon, 22 Feb 2016 14:14:38 +0000 From: John Keeping To: devicetree@vger.kernel.org Subject: Disabling graph endpoints in device trees Message-ID: <20160222141438.79de430c.john@metanate.com> Organization: Metanate Ltd X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; x86_64-unknown-linux-gnu) MIME-Version: 1.0 Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Rob Herring , Grant Likely , Frank Rowand X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, Is there a reason why endpoints in a device tree graph can't be disabled? 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). -- >8 -- -- 8< -- Thanks, John 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"));