From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756630AbbFQNpG (ORCPT ); Wed, 17 Jun 2015 09:45:06 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:36854 "EHLO mail-wg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756276AbbFQNnO (ORCPT ); Wed, 17 Jun 2015 09:43:14 -0400 From: Tomeu Vizoso To: linux-arm-kernel@lists.infradead.org Cc: Tomeu Vizoso , Alexander Holler , Alexandre Courbot , Andrzej Hajda , Arnd Bergmann , Dmitry Torokhov , Grant Likely , Greg Kroah-Hartman , Ian Campbell , Javier Martinez Canillas , Krzysztof Kozlowski , Kumar Gala , Len Brown , Linus Walleij , linux-kernel@vger.kernel.org, Lv Zheng , Mark Brown , Mark Rutland , Pawel Moll , "Rafael J. Wysocki" , Robert Moore , Rob Herring , Russell King , Stephen Warren , =?UTF-8?q?Terje=20Bergstr=C3=B6m?= , Thierry Reding 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> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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; -- 2.4.1 From mboxrd@z Thu Jan 1 00:00:00 1970 From: tomeu.vizoso@collabora.com (Tomeu Vizoso) Date: Wed, 17 Jun 2015 15:42:19 +0200 Subject: [PATCH 09/13] gpu: host1x: implement class.get_dependencies() In-Reply-To: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> References: <1434548543-22949-1-git-send-email-tomeu.vizoso@collabora.com> Message-ID: <1434548543-22949-10-git-send-email-tomeu.vizoso@collabora.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org 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; -- 2.4.1