devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: "Rafael J. Wysocki" <rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org>,
	Len Brown <len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Pavel Machek <pavel-+ZI9xUNit7I@public.gmane.org>,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Kevin Hilman <khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Alan Stern
	<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
	Greg Kroah-Hartman
	<gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>,
	Daniel Lezcano
	<daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Tomasz Figa <tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Linus Walleij
	<linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	Simon Horman <horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org>,
	Magnus Damm <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Ben Dooks <ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org>,
	Kukjin Kim <kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>,
	Stephen Boyd <sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	Philipp Zabel
	<philipp.zabel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Subject: [PATCH 21/24] ARM: ux500: Initial support for power domains
Date: Tue, 10 Jun 2014 12:51:34 +0200	[thread overview]
Message-ID: <1402397497-26737-22-git-send-email-ulf.hansson@linaro.org> (raw)
In-Reply-To: <1402397497-26737-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>

The ux500 SoC uses the generic power domain and requires the domains to
be specified through DT.

Currently the callbacks for handling power gating are empty functions
which shall be implemented once each device are handled properly from a
runtime PM perspective.

Cc: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Tomasz Figa <tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
---
 arch/arm/mach-ux500/Makefile     |    1 +
 arch/arm/mach-ux500/pm.c         |    4 ++
 arch/arm/mach-ux500/pm_domains.c |   77 ++++++++++++++++++++++++++++++++++++++
 arch/arm/mach-ux500/pm_domains.h |   17 +++++++++
 4 files changed, 99 insertions(+)
 create mode 100644 arch/arm/mach-ux500/pm_domains.c
 create mode 100644 arch/arm/mach-ux500/pm_domains.h

diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile
index 9741de95..4418a50 100644
--- a/arch/arm/mach-ux500/Makefile
+++ b/arch/arm/mach-ux500/Makefile
@@ -9,5 +9,6 @@ obj-$(CONFIG_MACH_MOP500)	+= board-mop500-regulators.o \
 				board-mop500-audio.o
 obj-$(CONFIG_SMP)		+= platsmp.o headsmp.o
 obj-$(CONFIG_HOTPLUG_CPU)	+= hotplug.o
+obj-$(CONFIG_PM_GENERIC_DOMAINS) += pm_domains.o
 
 CFLAGS_hotplug.o		+= -march=armv7-a
diff --git a/arch/arm/mach-ux500/pm.c b/arch/arm/mach-ux500/pm.c
index b80a9a2..2cb587b 100644
--- a/arch/arm/mach-ux500/pm.c
+++ b/arch/arm/mach-ux500/pm.c
@@ -17,6 +17,7 @@
 #include <linux/platform_data/arm-ux500-pm.h>
 
 #include "db8500-regs.h"
+#include "pm_domains.h"
 
 /* ARM WFI Standby signal register */
 #define PRCM_ARM_WFI_STANDBY    (prcmu_base + 0x130)
@@ -191,4 +192,7 @@ void __init ux500_pm_init(u32 phy_base, u32 size)
 
 	/* Set up ux500 suspend callbacks. */
 	suspend_set_ops(UX500_SUSPEND_OPS);
+
+	/* Initialize ux500 power domains */
+	ux500_pm_domains_init();
 }
diff --git a/arch/arm/mach-ux500/pm_domains.c b/arch/arm/mach-ux500/pm_domains.c
new file mode 100644
index 0000000..dbc115b
--- /dev/null
+++ b/arch/arm/mach-ux500/pm_domains.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2014 Linaro Ltd.
+ *
+ * Author: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
+ * License terms: GNU General Public License (GPL) version 2
+ *
+ * Implements power domains as generic power domains for ux500.
+ */
+#include <linux/printk.h>
+#include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/of.h>
+#include <linux/pm_domain.h>
+
+#include <dt-bindings/arm/ux500_pm_domains.h>
+#include "pm_domains.h"
+
+static int pd_power_off(struct generic_pm_domain *domain)
+{
+	/*
+	 * Handle the gating of the power domain regulator here.
+	 * Drivers/subsystems operating the devices in the power domain needs
+	 * to handle register context save/restore to be able to enable power
+	 * domain gating/ungating.
+	 */
+	return 0;
+}
+
+static int pd_power_on(struct generic_pm_domain *domain)
+{
+	/*
+	 * Handle the ungating of the power domain regulator here.
+	 * Drivers/subsystems operating the devices in the power domain needs
+	 * to handle register context save/restore to be able to enable power
+	 * domain gating/ungating.
+	 */
+	return 0;
+}
+
+static struct generic_pm_domain ux500_pm_domain_vape = {
+	.name = "VAPE",
+	.power_off = pd_power_off,
+	.power_on = pd_power_on,
+};
+
+static struct generic_pm_domain *ux500_pm_domains[NR_DOMAINS] = {
+	[DOMAIN_VAPE] = &ux500_pm_domain_vape,
+};
+
+static struct of_device_id ux500_pm_domain_matches[] = {
+	{ .compatible = "stericsson,ux500-pm-domains", },
+	{ },
+};
+
+int __init ux500_pm_domains_init(void)
+{
+	struct device_node *np;
+	struct genpd_onecell_data *genpd_data;
+	int i;
+
+	np = of_find_matching_node(NULL, ux500_pm_domain_matches);
+	if (!np)
+		return -ENODEV;
+
+	genpd_data = kzalloc(sizeof(*genpd_data), GFP_KERNEL);
+	if (!genpd_data)
+		return -ENOMEM;
+
+	genpd_data->domain_num = ARRAY_SIZE(ux500_pm_domains);
+	genpd_data->domains = ux500_pm_domains;
+
+	for (i = 0; i < ARRAY_SIZE(ux500_pm_domains); ++i)
+		pm_genpd_init(ux500_pm_domains[i], NULL, false);
+
+	of_genpd_add_provider(np, of_genpd_xlate_onecell, genpd_data);
+	return 0;
+}
diff --git a/arch/arm/mach-ux500/pm_domains.h b/arch/arm/mach-ux500/pm_domains.h
new file mode 100644
index 0000000..263d3ba
--- /dev/null
+++ b/arch/arm/mach-ux500/pm_domains.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright (C) 2014 Linaro Ltd.
+ *
+ * Author: Ulf Hansson <ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
+ * License terms: GNU General Public License (GPL) version 2
+ */
+
+#ifndef __MACH_UX500_PM_DOMAINS_H
+#define __MACH_UX500_PM_DOMAINS_H
+
+#ifdef CONFIG_PM_GENERIC_DOMAINS
+extern int __init ux500_pm_domains_init(void);
+#else
+static inline int ux500_pm_domains_init(void) { return 0; }
+#endif
+
+#endif
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-06-10 10:51 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-10 10:51 [PATCH 00/24] PM / Domains: Generic OF-based support and cleanups Ulf Hansson
2014-06-10 10:51 ` [PATCH 01/24] base: power: Add generic OF-based power domain look-up Ulf Hansson
2014-06-10 10:51 ` [PATCH 02/24] drivercore: Bind/unbind power domain on probe/remove Ulf Hansson
2014-06-10 12:11   ` Rafael J. Wysocki
2014-06-10 12:53     ` Ulf Hansson
2014-06-10 21:27       ` Rafael J. Wysocki
2014-06-10 21:27         ` Greg Kroah-Hartman
2014-06-10 21:42           ` Tomasz Figa
2014-06-10 22:15             ` Ulf Hansson
2014-06-11  0:18             ` Rafael J. Wysocki
2014-06-12 16:39               ` Mark Brown
2014-06-12 19:33                 ` Rafael Wysocki
2014-06-11 18:16             ` Kevin Hilman
2014-06-11 18:19               ` Tomasz Figa
2014-06-10 10:51 ` [PATCH 03/24] ARM: exynos: Move to generic power domain bindings Ulf Hansson
2014-06-10 10:51 ` [PATCH 04/24] PM / Domains: Ignore callbacks for subsys generic_pm_domain_data Ulf Hansson
2014-06-10 10:51 ` [PATCH 05/24] PM / Domains: Remove the pm_genpd_add|remove_callbacks APIs Ulf Hansson
2014-06-10 10:51 ` [PATCH 06/24] PM / Domains: Remove system PM callbacks from gpd_dev_ops Ulf Hansson
2014-06-10 10:51 ` [PATCH 07/24] ARM: shmobile: Drop dev_irq_safe from r8a7779 genpd config Ulf Hansson
2014-06-11 18:13   ` Kevin Hilman
2014-06-11 20:34     ` Ulf Hansson
2014-06-10 10:51 ` [PATCH 08/24] ARM: shmobile: Drop dev_irq_safe from R-mobile " Ulf Hansson
2014-06-10 10:51 ` [PATCH 09/24] PM / Domains: Remove dev_irq_safe from " Ulf Hansson
2014-06-10 10:51 ` [PATCH 10/24] PM / Domains: Remove redundant check for CONFIG_PM Ulf Hansson
2014-06-10 10:51 ` [PATCH 11/24] PM / Domains: Remove legacy API for adding devices through DT Ulf Hansson
2014-06-10 10:51 ` [PATCH 12/24] PM / Domains: Remove pm_genpd_syscore_switch() API Ulf Hansson
2014-06-10 10:51 ` [PATCH 13/24] PM / Domains: Remove genpd_queue_power_off_work() API Ulf Hansson
2014-06-10 10:51 ` [PATCH 14/24] PM / Domains: Add late_initcall to disable unused domains Ulf Hansson
2014-06-10 10:51 ` [PATCH 15/24] ARM: exynos: Leave disabling of unused pm domains to genpd Ulf Hansson
2014-06-10 10:51 ` [PATCH 16/24] ARM: s3c64xx: " Ulf Hansson
     [not found] ` <1402397497-26737-1-git-send-email-ulf.hansson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2014-06-10 10:51   ` [PATCH 17/24] drivers: sh: " Ulf Hansson
2014-06-10 10:51   ` Ulf Hansson [this message]
2014-06-10 10:51 ` [PATCH 18/24] PM / Domains: Remove default_stop_ok() API Ulf Hansson
2014-06-10 10:51 ` [PATCH 19/24] dt: bindings: ux500: Add documentation for power domains Ulf Hansson
2014-06-11 18:20   ` Kevin Hilman
2014-06-12 10:26     ` Pavel Machek
2014-06-10 10:51 ` [PATCH 20/24] dt: bindings: ux500: Add header for power domains specifiers Ulf Hansson
2014-06-11 18:19   ` Kevin Hilman
2014-06-10 10:51 ` [PATCH 22/24] ARM: ux500: Enable Kconfig for the generic power domain Ulf Hansson
2014-06-10 10:51 ` [PATCH 23/24] ARM: ux500: Add DT node for ux500 power domains Ulf Hansson
2014-06-10 10:51 ` [PATCH 24/24] ARM: ux500: Add sdi[n] devices to VAPE power domain Ulf Hansson
2014-06-11 18:23 ` [PATCH 00/24] PM / Domains: Generic OF-based support and cleanups Kevin Hilman
2014-06-11 18:32   ` Rafael J. Wysocki
2014-06-11 20:21     ` Ulf Hansson
2014-08-22 12:15 ` Geert Uytterhoeven
2014-08-22 15:56   ` Ulf Hansson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1402397497-26737-22-git-send-email-ulf.hansson@linaro.org \
    --to=ulf.hansson-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=ben-linux-elnMNo+KYs3YtjvyW6yDsg@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=daniel.lezcano-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \
    --cc=horms-/R6kz+dDXgpPR4JQBCEnsQ@public.gmane.org \
    --cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=khilman-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=pavel-+ZI9xUNit7I@public.gmane.org \
    --cc=philipp.zabel-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=rjw-LthD3rsA81gm4RdzfppkhA@public.gmane.org \
    --cc=sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    --cc=tomasz.figa-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).