|
@@ -1725,6 +1725,61 @@ int regulator_disable_deferred(struct regulator *regulator, int ms)
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(regulator_disable_deferred);
|
|
|
|
|
|
+/**
|
|
|
+ * regulator_is_enabled_regmap - standard is_enabled() for regmap users
|
|
|
+ *
|
|
|
+ * @rdev: regulator to operate on
|
|
|
+ *
|
|
|
+ * Regulators that use regmap for their register I/O can set the
|
|
|
+ * enable_reg and enable_mask fields in their descriptor and then use
|
|
|
+ * this as their is_enabled operation, saving some code.
|
|
|
+ */
|
|
|
+int regulator_is_enabled_regmap(struct regulator_dev *rdev)
|
|
|
+{
|
|
|
+ unsigned int val;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ ret = regmap_read(rdev->regmap, rdev->desc->enable_reg, &val);
|
|
|
+ if (ret != 0)
|
|
|
+ return ret;
|
|
|
+
|
|
|
+ return (val & rdev->desc->enable_mask) != 0;
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(regulator_is_enabled_regmap);
|
|
|
+
|
|
|
+/**
|
|
|
+ * regulator_enable_regmap - standard enable() for regmap users
|
|
|
+ *
|
|
|
+ * @rdev: regulator to operate on
|
|
|
+ *
|
|
|
+ * Regulators that use regmap for their register I/O can set the
|
|
|
+ * enable_reg and enable_mask fields in their descriptor and then use
|
|
|
+ * this as their enable() operation, saving some code.
|
|
|
+ */
|
|
|
+int regulator_enable_regmap(struct regulator_dev *rdev)
|
|
|
+{
|
|
|
+ return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
|
|
|
+ rdev->desc->enable_mask,
|
|
|
+ rdev->desc->enable_mask);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(regulator_enable_regmap);
|
|
|
+
|
|
|
+/**
|
|
|
+ * regulator_disable_regmap - standard disable() for regmap users
|
|
|
+ *
|
|
|
+ * @rdev: regulator to operate on
|
|
|
+ *
|
|
|
+ * Regulators that use regmap for their register I/O can set the
|
|
|
+ * enable_reg and enable_mask fields in their descriptor and then use
|
|
|
+ * this as their disable() operation, saving some code.
|
|
|
+ */
|
|
|
+int regulator_disable_regmap(struct regulator_dev *rdev)
|
|
|
+{
|
|
|
+ return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
|
|
|
+ rdev->desc->enable_mask, 0);
|
|
|
+}
|
|
|
+EXPORT_SYMBOL_GPL(regulator_disable_regmap);
|
|
|
+
|
|
|
static int _regulator_is_enabled(struct regulator_dev *rdev)
|
|
|
{
|
|
|
/* If we don't know then assume that the regulator is always on */
|