2012-11-14 07:47:38

by Mark Brown

[permalink] [raw]
Subject: [PATCH] regulator: core: Add regulator_is_supported_voltage_tol()

If consumers wish to set voltages based on a tolerance it stands to reason
that they will also want to query for support in the same manner.

Signed-off-by: Mark Brown <[email protected]>
---
include/linux/regulator/consumer.h | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h
index 07838c9..528e32a 100644
--- a/include/linux/regulator/consumer.h
+++ b/include/linux/regulator/consumer.h
@@ -367,4 +367,12 @@ static inline int regulator_set_voltage_tol(struct regulator *regulator,
new_uV - tol_uV, new_uV + tol_uV);
}

+static inline int regulator_is_supported_voltage_tol(struct regulator *regulator,
+ int target_uV, int tol_uV)
+{
+ return regulator_is_supported_voltage(regulator,
+ target_uV - tol_uV,
+ target_uV + tol_uV);
+}
+
#endif
--
1.7.10.4


2012-11-14 10:08:32

by Liam Girdwood

[permalink] [raw]
Subject: Re: [PATCH] regulator: core: Add regulator_is_supported_voltage_tol()

On 14/11/12 07:47, Mark Brown wrote:
> If consumers wish to set voltages based on a tolerance it stands to reason
> that they will also want to query for support in the same manner.
>
> Signed-off-by: Mark Brown <[email protected]>

Acked-by: Liam Girdwood <[email protected]>