From patchwork Mon Mar 3 16:02:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 3755401 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 8E0109F38E for ; Mon, 3 Mar 2014 16:05:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 91B2C203DA for ; Mon, 3 Mar 2014 16:05:50 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (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 776E720397 for ; Mon, 3 Mar 2014 16:05:49 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKVLN-0000VD-7Z; Mon, 03 Mar 2014 16:03:54 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKVL3-0003rz-3Z; Mon, 03 Mar 2014 16:03:33 +0000 Received: from mail-ea0-x235.google.com ([2a00:1450:4013:c01::235]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WKVKV-0003j0-B1 for linux-arm-kernel@lists.infradead.org; Mon, 03 Mar 2014 16:03:03 +0000 Received: by mail-ea0-f181.google.com with SMTP id k10so4655840eaj.12 for ; Mon, 03 Mar 2014 08:02:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Esw/2aDgDvIIC0UELNcJynIxG4uR/QzbTH09RxwogNs=; b=b5SSkHBu79nr/Saq84ug32khFyoWiSwDpGuFWLy0cafsFPc8Oqs0LwgiLMaOrL1+lA Wu/JdkMtwdbA5htD8mWyrYGStUxJhhhfQEyKwO8/EEQcZeO7WdFo5/5CMAhGp8YWvWIU C5fipNJ11aiS2j3P8zemAUpqhySZJftiLHCP+VQSy3hMbhWxC5AjOGFn6iu8dhaagC9F phHzeRVgs3FRJLxYII3iBjMmPKFilwezEm79/2+rmWt2SSsUoazhItX3xhvexez8tQ82 WfSTm3L9ctL9ouKW3QyIVCrWKy8slrLDJs8A7TRPblYJzg1L3sipGHp8o+FtrsLS8PDd fbLg== X-Received: by 10.14.1.68 with SMTP id 44mr41087274eec.0.1393862557465; Mon, 03 Mar 2014 08:02:37 -0800 (PST) Received: from flatron.tomeq (87-207-52-162.dynamic.chello.pl. [87.207.52.162]) by mx.google.com with ESMTPSA id y51sm51430597eeu.0.2014.03.03.08.02.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 03 Mar 2014 08:02:36 -0800 (PST) From: Tomasz Figa To: linux-pm@vger.kernel.org Subject: [PATCH v2 03/11] ARM: exynos: Move to generic power domain bindings Date: Mon, 3 Mar 2014 17:02:08 +0100 Message-Id: <1393862536-9842-4-git-send-email-tomasz.figa@gmail.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1393862536-9842-1-git-send-email-tomasz.figa@gmail.com> References: <1393862536-9842-1-git-send-email-tomasz.figa@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140303_110259_740774_FC801E77 X-CRM114-Status: GOOD ( 17.69 ) X-Spam-Score: 1.0 (+) Cc: Mark Rutland , Ulf Hansson , Stephen Warren , Len Brown , Stephen Boyd , Tomasz Figa , Tomasz Figa , Pavel Machek , Kukjin Kim , Marek Szyprowski , linux-samsung-soc@vger.kernel.org, Russell King , Bartlomiej Zolnierkiewicz , Lorenzo Pieralisi , devicetree@vger.kernel.org, Pawel Moll , Ian Campbell , Rob Herring , linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Mark Brown , Kumar Gala X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 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=-1.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, KHOP_BIG_TO_CC, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=no 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 This patch moves Exynos power domain code to use the new generic power domain look-up framework introduced by previous patch, allowing the new code to be compiled with CONFIG_ARCH_EXYNOS selected as well. Signed-off-by: Tomasz Figa --- .../bindings/arm/exynos/power_domain.txt | 12 ++-- arch/arm/mach-exynos/pm_domains.c | 80 +--------------------- kernel/power/Kconfig | 2 +- 3 files changed, 7 insertions(+), 87 deletions(-) diff --git a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt index 5216b41..60f26a8 100644 --- a/Documentation/devicetree/bindings/arm/exynos/power_domain.txt +++ b/Documentation/devicetree/bindings/arm/exynos/power_domain.txt @@ -8,6 +8,8 @@ Required Properties: * samsung,exynos4210-pd - for exynos4210 type power domain. - reg: physical base address of the controller and length of memory mapped region. +- #power-domain-cells: number of cells in power domain specifier; + must be 0. Node of a device using power domains must have a samsung,power-domain property defined with a phandle to respective power domain. @@ -17,12 +19,8 @@ Example: lcd0: power-domain-lcd0 { compatible = "samsung,exynos4210-pd"; reg = <0x10023C00 0x10>; + #power-domain-cells = <0>; }; -Example of the node using power domain: - - node { - /* ... */ - samsung,power-domain = <&lcd0>; - /* ... */ - }; +See Documentation/devicetree/bindings/power/power_domain.txt for description +of consumer-side bindings. diff --git a/arch/arm/mach-exynos/pm_domains.c b/arch/arm/mach-exynos/pm_domains.c index 8fd2488..48ee6c9 100644 --- a/arch/arm/mach-exynos/pm_domains.c +++ b/arch/arm/mach-exynos/pm_domains.c @@ -75,78 +75,6 @@ static int exynos_pd_power_off(struct generic_pm_domain *domain) return exynos_pd_power(domain, false); } -static void exynos_add_device_to_domain(struct exynos_pm_domain *pd, - struct device *dev) -{ - int ret; - - dev_dbg(dev, "adding to power domain %s\n", pd->pd.name); - - while (1) { - ret = pm_genpd_add_device(&pd->pd, dev); - if (ret != -EAGAIN) - break; - cond_resched(); - } - - pm_genpd_dev_need_restore(dev, true); -} - -static void exynos_remove_device_from_domain(struct device *dev) -{ - struct generic_pm_domain *genpd = dev_to_genpd(dev); - int ret; - - dev_dbg(dev, "removing from power domain %s\n", genpd->name); - - while (1) { - ret = pm_genpd_remove_device(genpd, dev); - if (ret != -EAGAIN) - break; - cond_resched(); - } -} - -static void exynos_read_domain_from_dt(struct device *dev) -{ - struct platform_device *pd_pdev; - struct exynos_pm_domain *pd; - struct device_node *node; - - node = of_parse_phandle(dev->of_node, "samsung,power-domain", 0); - if (!node) - return; - pd_pdev = of_find_device_by_node(node); - if (!pd_pdev) - return; - pd = platform_get_drvdata(pd_pdev); - exynos_add_device_to_domain(pd, dev); -} - -static int exynos_pm_notifier_call(struct notifier_block *nb, - unsigned long event, void *data) -{ - struct device *dev = data; - - switch (event) { - case BUS_NOTIFY_BIND_DRIVER: - if (dev->of_node) - exynos_read_domain_from_dt(dev); - - break; - - case BUS_NOTIFY_UNBOUND_DRIVER: - exynos_remove_device_from_domain(dev); - - break; - } - return NOTIFY_DONE; -} - -static struct notifier_block platform_nb = { - .notifier_call = exynos_pm_notifier_call, -}; - static __init int exynos4_pm_init_power_domain(void) { struct platform_device *pdev; @@ -156,8 +84,6 @@ static __init int exynos4_pm_init_power_domain(void) struct exynos_pm_domain *pd; int on; - pdev = of_find_device_by_node(np); - pd = kzalloc(sizeof(*pd), GFP_KERNEL); if (!pd) { pr_err("%s: failed to allocate memory for domain\n", @@ -170,17 +96,13 @@ static __init int exynos4_pm_init_power_domain(void) pd->base = of_iomap(np, 0); pd->pd.power_off = exynos_pd_power_off; pd->pd.power_on = exynos_pd_power_on; - pd->pd.of_node = np; - - platform_set_drvdata(pdev, pd); on = __raw_readl(pd->base + 0x4) & S5P_INT_LOCAL_PWR_EN; pm_genpd_init(&pd->pd, NULL, !on); + of_genpd_add_provider(np, of_genpd_xlate_simple, &pd->pd); } - bus_register_notifier(&platform_bus_type, &platform_nb); - return 0; } arch_initcall(exynos4_pm_init_power_domain); diff --git a/kernel/power/Kconfig b/kernel/power/Kconfig index 45aa98e..b17588c 100644 --- a/kernel/power/Kconfig +++ b/kernel/power/Kconfig @@ -308,7 +308,7 @@ config PM_GENERIC_DOMAINS_RUNTIME config PM_GENERIC_DOMAINS_OF def_bool y - depends on PM_GENERIC_DOMAINS && OF && !ARCH_EXYNOS + depends on PM_GENERIC_DOMAINS && OF config CPU_PM bool