lkml.org 
[lkml]   [2018]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 01/11] regulator: core: add API to get voltage constraints
Date
From: Laxman Dewangan <ldewangan@nvidia.com>

Add API to get min/max rail voltage configured from platform for
given rails.

Changes to the commit message by
Peter De Schrijver <pdeschrijver@nvidia.com>

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
drivers/regulator/core.c | 31 +++++++++++++++++++++++++++++++
include/linux/regulator/consumer.h | 2 ++
2 files changed, 33 insertions(+)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index be767dd..c498774 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3246,6 +3246,37 @@ int regulator_get_voltage(struct regulator *regulator)
EXPORT_SYMBOL_GPL(regulator_get_voltage);

/**
+ * regulator_get_constraint_voltages - get platform specific constraint voltage,
+ * @regulator: regulator source
+ * @min_uV: Minimum microvolts.
+ * @max_uV: Maximum microvolts.
+ *
+ * This returns the current regulator voltage in uV.
+ *
+ * NOTE: If the regulator is disabled it will return the voltage value. This
+ * function should not be used to determine regulator state.
+ */
+
+int regulator_get_constraint_voltages(struct regulator *regulator,
+ int *min_uV, int *max_uV)
+{
+ struct regulator_dev *rdev = regulator->rdev;
+
+ if (rdev->desc && rdev->desc->fixed_uV && rdev->desc->n_voltages == 1) {
+ *min_uV = rdev->desc->fixed_uV;
+ *max_uV = rdev->desc->fixed_uV;
+ return 0;
+ }
+ if (rdev->constraints) {
+ *min_uV = rdev->constraints->min_uV;
+ *max_uV = rdev->constraints->max_uV;
+ return 0;
+ }
+ return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(regulator_get_constraint_voltages);
+
+/**
* regulator_set_current_limit - set regulator output current limit
* @regulator: regulator source
* @min_uA: Minimum supported current in uA
diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index df176d7..d3f495a 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -250,6 +250,8 @@ int regulator_is_supported_voltage(struct regulator *regulator,
int regulator_set_voltage_time(struct regulator *regulator,
int old_uV, int new_uV);
int regulator_get_voltage(struct regulator *regulator);
+int regulator_get_constraint_voltages(struct regulator *regulator,
+ int *min_uV, int *max_uV);
int regulator_sync_voltage(struct regulator *regulator);
int regulator_set_current_limit(struct regulator *regulator,
int min_uA, int max_uA);
--
1.9.1
\
 
 \ /
  Last update: 2018-02-06 17:38    [W:0.345 / U:1.612 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site