devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH v2 1/4] regulator: Add helper function to get "poweroff-source" property
@ 2014-10-07 19:45 Romain Perier
       [not found] ` <1412711104-15902-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Romain Perier @ 2014-10-07 19:45 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA
  Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, lgirdwood-Re5JQEeQqe8AvxtiuMwx3w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA, heiko-4mtYJXux2i+zQB+pC5nmwQ,
	sameo-VuQAYsv1563Yd54FQh9/CA, lee.jones-QSEj5FYQhm4dnm+yROfE0A,
	grant.likely-QSEj5FYQhm4dnm+yROfE0A, robh-DgEjT+Ai2ygdnm+yROfE0A,
	sre-DgEjT+Ai2ygdnm+yROfE0A, dbaryshkov-Re5JQEeQqe8AvxtiuMwx3w,
	dwmw2-wEGCiKHe2LqWVfeAwA7xHQ, anton-9xeibp6oKSgdnm+yROfE0A,
	ldewangan-DDmLM1+adcrQT0dZR+AlfA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA

Several drivers create their own devicetree property when they register
poweroff capabilities. This is for example the case for mfd, regulator
or power drivers which define "vendor,system-power-controller" property.
This patch adds support for a standard property "poweroff-source"
which marks the device as able to shutdown the system.

Signed-off-by: Romain Perier <romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/regulator/of_regulator.c       | 12 ++++++++++++
 include/linux/regulator/of_regulator.h |  6 ++++++
 2 files changed, 18 insertions(+)

diff --git a/drivers/regulator/of_regulator.c b/drivers/regulator/of_regulator.c
index 7a51814..8b898e6 100644
--- a/drivers/regulator/of_regulator.c
+++ b/drivers/regulator/of_regulator.c
@@ -240,3 +240,15 @@ struct regulator_init_data *regulator_of_get_init_data(struct device *dev,
 
 	return init_data;
 }
+
+/**
+ * is_system_poweroff_source - Tells if poweroff-source is found for device_node
+ * @np: Pointer to the given device_node
+ *
+ * return true if present false otherwise
+ */
+bool is_system_poweroff_source(const struct device_node *np)
+{
+	return of_property_read_bool(np, "poweroff-source");
+}
+EXPORT_SYMBOL_GPL(is_system_poweroff_source);
diff --git a/include/linux/regulator/of_regulator.h b/include/linux/regulator/of_regulator.h
index f921796..9d8fbb2 100644
--- a/include/linux/regulator/of_regulator.h
+++ b/include/linux/regulator/of_regulator.h
@@ -20,6 +20,7 @@ extern struct regulator_init_data
 extern int of_regulator_match(struct device *dev, struct device_node *node,
 			      struct of_regulator_match *matches,
 			      unsigned int num_matches);
+extern bool is_system_poweroff_source(const struct device_node *np);
 #else
 static inline struct regulator_init_data
 	*of_get_regulator_init_data(struct device *dev,
@@ -35,6 +36,11 @@ static inline int of_regulator_match(struct device *dev,
 {
 	return 0;
 }
+
+static inline bool is_system_poweroff_source(const struct device_node *np)
+{
+	return false;
+}
 #endif /* CONFIG_OF */
 
 #endif /* __LINUX_OF_REG_H */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-10-13 13:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-07 19:45 [RFC PATCH v2 1/4] regulator: Add helper function to get "poweroff-source" property Romain Perier
     [not found] ` <1412711104-15902-1-git-send-email-romain.perier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-10-07 19:43   ` PERIER Romain
2014-10-10 11:47     ` Grant Likely
     [not found]       ` <CACxGe6vmBSgGpJgJ51Ki5KbQO65GDw3kSGSxnswYMfE8OGj9gw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-10 11:53         ` Mark Brown
2014-10-10 12:29         ` PERIER Romain
     [not found]           ` <CABgxDoKo8RkM3etK7Yu+8vHQSWs-53wnZujF_QvXR0GJAwBfoA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-10-11 13:51             ` Grant Likely
2014-10-10 12:33       ` Heiko Stübner
2014-10-07 19:45 ` [RFC PATCH v2 2/4] regulator: act8865: Add support to turn off all outputs Romain Perier
2014-10-13 13:16   ` Mark Brown
2014-10-07 19:45 ` [RFC PATCH v1 3/4] ARM: dts: rockchip: Enable power off in pmic for Radxa Rock Romain Perier
2014-10-07 19:45 ` [RFC PATCH v1 4/4] dt-bindings: Document the property poweroff-source for act8865 regulator Romain Perier
2014-10-13 13:17   ` Mark Brown
2014-10-13 13:54     ` PERIER Romain
2014-10-13 13:12 ` [RFC PATCH v2 1/4] regulator: Add helper function to get "poweroff-source" property Mark Brown

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).