From patchwork Wed Jun 17 13:42:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6626271 Return-Path: X-Original-To: patchwork-linux-arm@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 F05DA9F326 for ; Wed, 17 Jun 2015 13:49:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1F7F1205E6 for ; Wed, 17 Jun 2015 13:49:42 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2508C204AD for ; Wed, 17 Jun 2015 13:49:41 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5Dfy-0006Kr-H9; Wed, 17 Jun 2015 13:46:46 +0000 Received: from mail-wg0-x22c.google.com ([2a00:1450:400c:c00::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Z5Dct-0002pd-4I for linux-arm-kernel@lists.infradead.org; Wed, 17 Jun 2015 13:43:36 +0000 Received: by wgzl5 with SMTP id l5so37484549wgz.3 for ; Wed, 17 Jun 2015 06:43:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=KX2E3HCReSoErEneTBLUBr8BqBBDPlgU9iOGrDOSUHw=; b=KDmUHMGwgJqmUnTSmyIBhgjiHiQW9XvSygSqf1bNdEG0rdpd3LXgQ2mhdv9rS/4hd7 arJ5lOEq/h51Jcnw8JETWBnpe+rXhi1vAGmX8TxHDtcKmVmul3ghD/v/FDkqbB+xaPHh csqNdveIAG4LR8fTOqADN+ngkRcof5xtLU0Lo+O7VcFpQ5MqMGaWw+NEzT7HceLJSerh D9TKMfweZUMo+Wa961/2uvy5VyIV0+yKrfMC2UVsp+Epu1wfnHxSMDnVNHM9IB1DCVWm WSo6CkRoMcL1evQf+2gQ9ELH4+xAHjt5y88hUuYnwOewj40KEm0bxpfLCukHazmc5DuC kinQ== X-Received: by 10.180.107.138 with SMTP id hc10mr18029438wib.2.1434548592729; Wed, 17 Jun 2015 06:43:12 -0700 (PDT) Received: from cizrna.lan ([109.72.12.132]) by mx.google.com with ESMTPSA id v3sm6920361wja.31.2015.06.17.06.43.10 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Jun 2015 06:43:12 -0700 (PDT) From: Tomeu Vizoso To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 09/13] gpu: host1x: implement class.get_dependencies() Date: Wed, 17 Jun 2015 15:42:19 +0200 Message-Id: <1434548543-22949-10-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> References: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150617_064335_396003_EEA094F9 X-CRM114-Status: GOOD ( 12.07 ) X-Spam-Score: -0.7 (/) Cc: Mark Rutland , Krzysztof Kozlowski , Linus Walleij , Andrzej Hajda , Thierry Reding , Lv Zheng , Alexander Holler , Alexandre Courbot , Russell King , Pawel Moll , Stephen Warren , Robert Moore , Grant Likely , Len Brown , Arnd Bergmann , Ian Campbell , Rob Herring , =?UTF-8?q?Terje=20Bergstr=C3=B6m?= , Tomeu Vizoso , Greg Kroah-Hartman , Dmitry Torokhov , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Mark Brown , Kumar Gala , Javier Martinez Canillas X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.7 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 So others can find out dependencies of host1x clients, as specified in bindings/gpu/nvidia,tegra20-host1x.txt. Signed-off-by: Tomeu Vizoso --- drivers/gpu/host1x/dev.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c index 53d3d1d..c86ef88 100644 --- a/drivers/gpu/host1x/dev.c +++ b/drivers/gpu/host1x/dev.c @@ -212,10 +212,57 @@ static struct platform_driver tegra_host1x_driver = { .remove = host1x_remove, }; +static void add_dependency(struct fwnode_handle *fwnode, + const char *property, + struct list_head *list) +{ + struct fwnode_dependency *dep; + struct device_node *np; + + np = of_parse_phandle(of_node(fwnode), property, 0); + if (!np) + return; + + dep = kzalloc(sizeof(*dep), GFP_KERNEL); + if (!dep) + return; + + INIT_LIST_HEAD(&dep->dependency); + dep->fwnode = &np->fwnode; + + list_add_tail(&dep->dependency, list); +} + +struct list_head *host1x_get_dependencies(struct fwnode_handle *fwnode) +{ + struct list_head *list = NULL; + + list = kzalloc(sizeof(*list), GFP_KERNEL); + if (!list) + return NULL; + + INIT_LIST_HEAD(list); + + add_dependency(fwnode, "nvidia,dpaux", list); + add_dependency(fwnode, "nvidia,panel", list); + + return list; +} + +static struct class host1x_class = { + .name = "tegra-host1x", + + .get_dependencies = host1x_get_dependencies, +}; + static int __init tegra_host1x_init(void) { int err; + err = class_register(&host1x_class); + if (err < 0) + return err; + err = bus_register(&host1x_bus_type); if (err < 0) return err;