lkml.org 
[lkml]   [2012]   [Jun]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/2 v2] regulator: extend the fixed dummy voltage regulator to accept voltage
Trivially extend the regulator_register_fixed() helper function to be even
more useful by letting it accept a voltage parameter. The original function
is provided as a wrapper macro.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
drivers/regulator/fixed-helper.c | 9 +++++----
include/linux/regulator/fixed.h | 10 ++++++----
2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/regulator/fixed-helper.c b/drivers/regulator/fixed-helper.c
index f66d9e8..d979ff0 100644
--- a/drivers/regulator/fixed-helper.c
+++ b/drivers/regulator/fixed-helper.c
@@ -22,13 +22,14 @@ static void regulator_fixed_release(struct device *dev)
}

/**
- * regulator_register_fixed - register a no-op fixed regulator
+ * regulator_register_fixed_volt - register a no-op fixed regulator
* @id: platform device id
* @supplies: consumers for this regulator
* @num_supplies: number of consumers
+ * @uv: voltage in microvolts
*/
-struct platform_device *regulator_register_fixed(int id,
- struct regulator_consumer_supply *supplies, int num_supplies)
+struct platform_device *regulator_register_fixed_volt(int id,
+ struct regulator_consumer_supply *supplies, int num_supplies, int uv)
{
struct fixed_regulator_data *data;

@@ -42,7 +43,7 @@ struct platform_device *regulator_register_fixed(int id,
snprintf(data->name, sizeof(FIXED_NAME), FIXED_BASE "-%d", id);

data->cfg.supply_name = data->name;
- data->cfg.microvolts = 0;
+ data->cfg.microvolts = uv;
data->cfg.gpio = -EINVAL;
data->cfg.enabled_at_boot = 1;
data->cfg.init_data = &data->init_data;
diff --git a/include/linux/regulator/fixed.h b/include/linux/regulator/fixed.h
index f83f744..1735f0a 100644
--- a/include/linux/regulator/fixed.h
+++ b/include/linux/regulator/fixed.h
@@ -58,14 +58,16 @@ struct fixed_voltage_config {
struct regulator_consumer_supply;

#if IS_ENABLED(CONFIG_REGULATOR)
-struct platform_device *regulator_register_fixed(int id,
- struct regulator_consumer_supply *supplies, int num_supplies);
+struct platform_device *regulator_register_fixed_volt(int id,
+ struct regulator_consumer_supply *supplies, int num_supplies, int uv);
#else
-static inline struct platform_device *regulator_register_fixed(int id,
- struct regulator_consumer_supply *supplies, int num_supplies)
+static inline struct platform_device *regulator_register_fixed_volt(int id,
+ struct regulator_consumer_supply *supplies, int num_supplies, int uv)
{
return NULL;
}
#endif

+#define regulator_register_fixed(id, s, ns) regulator_register_fixed_volt(id, s, ns, 0)
+
#endif
--
1.7.2.5


\
 
 \ /
  Last update: 2012-06-18 18:41    [W:0.207 / U:0.628 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site