All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/11] ARM: mach-shmobile: add a temporary macro to define fixed voltage regulators
@ 2012-06-20  8:01 Guennadi Liakhovetski
  2012-06-20  9:48 ` Mark Brown
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Guennadi Liakhovetski @ 2012-06-20  8:01 UTC (permalink / raw)
  To: linux-sh

Providing fixed voltage permanently "on" regulators with different voltages
shares a lot of identical code. It will be eliminated, once the
regulator_register_fixed_volt() function becomes available. Until then we
introduce a macro to define such regulators. This helps reduce the amount
of added code in each platform file and keeps copy-paste errors to the
minumum.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 arch/arm/mach-shmobile/include/mach/regulator.h |   34 +++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/mach-shmobile/include/mach/regulator.h

diff --git a/arch/arm/mach-shmobile/include/mach/regulator.h b/arch/arm/mach-shmobile/include/mach/regulator.h
new file mode 100644
index 0000000..fe74995
--- /dev/null
+++ b/arch/arm/mach-shmobile/include/mach/regulator.h
@@ -0,0 +1,34 @@
+/*
+ * Temporary header until regulator_register_fixed_volt() is available.
+ * Licensed under GPLv2, see COPYING for details.
+ */
+
+#ifndef ASM_REGULATOR_H
+#define ASM_REGULATOR_H
+
+#include <linux/regulator/driver.h>
+#include <linux/regulator/fixed.h>
+#include <linux/regulator/machine.h>
+
+#define REGULATOR_FIXED(s, rid, v)					\
+static struct regulator_init_data fixed_power_init_data_ ## rid = {	\
+	.num_consumer_supplies  = ARRAY_SIZE(s),			\
+	.consumer_supplies      = (s),					\
+	.constraints.always_on	= 1,					\
+};									\
+static struct fixed_voltage_config fixed_power_info_ ## rid = {		\
+	.supply_name = "Fixed #" # rid,					\
+	.microvolts = (v),						\
+	.gpio = -EINVAL,						\
+	.init_data = &fixed_power_init_data_ ## rid,			\
+	.enabled_at_boot = 1,						\
+};									\
+static struct platform_device fixed_power_ ## rid = {			\
+	.name = "reg-fixed-voltage",					\
+	.id   = (rid),							\
+	.dev  = {							\
+		.platform_data = &fixed_power_info_ ## rid,		\
+	},								\
+}
+
+#endif
-- 
1.7.2.5


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

end of thread, other threads:[~2012-06-25 21:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-20  8:01 [PATCH 01/11] ARM: mach-shmobile: add a temporary macro to define fixed voltage regulators Guennadi Liakhovetski
2012-06-20  9:48 ` Mark Brown
2012-06-20 12:18 ` Guennadi Liakhovetski
2012-06-21 11:42 ` Rafael J. Wysocki
2012-06-25 21:09 ` Rafael J. Wysocki
2012-06-25 21:24 ` Guennadi Liakhovetski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.