|
@@ -2655,6 +2655,47 @@ out:
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(regulator_suspend_prepare);
|
|
EXPORT_SYMBOL_GPL(regulator_suspend_prepare);
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * regulator_suspend_finish - resume regulators from system wide suspend
|
|
|
|
+ *
|
|
|
|
+ * Turn on regulators that might be turned off by regulator_suspend_prepare
|
|
|
|
+ * and that should be turned on according to the regulators properties.
|
|
|
|
+ */
|
|
|
|
+int regulator_suspend_finish(void)
|
|
|
|
+{
|
|
|
|
+ struct regulator_dev *rdev;
|
|
|
|
+ int ret = 0, error;
|
|
|
|
+
|
|
|
|
+ mutex_lock(®ulator_list_mutex);
|
|
|
|
+ list_for_each_entry(rdev, ®ulator_list, list) {
|
|
|
|
+ struct regulator_ops *ops = rdev->desc->ops;
|
|
|
|
+
|
|
|
|
+ mutex_lock(&rdev->mutex);
|
|
|
|
+ if ((rdev->use_count > 0 || rdev->constraints->always_on) &&
|
|
|
|
+ ops->enable) {
|
|
|
|
+ error = ops->enable(rdev);
|
|
|
|
+ if (error)
|
|
|
|
+ ret = error;
|
|
|
|
+ } else {
|
|
|
|
+ if (!has_full_constraints)
|
|
|
|
+ goto unlock;
|
|
|
|
+ if (!ops->disable)
|
|
|
|
+ goto unlock;
|
|
|
|
+ if (ops->is_enabled && !ops->is_enabled(rdev))
|
|
|
|
+ goto unlock;
|
|
|
|
+
|
|
|
|
+ error = ops->disable(rdev);
|
|
|
|
+ if (error)
|
|
|
|
+ ret = error;
|
|
|
|
+ }
|
|
|
|
+unlock:
|
|
|
|
+ mutex_unlock(&rdev->mutex);
|
|
|
|
+ }
|
|
|
|
+ mutex_unlock(®ulator_list_mutex);
|
|
|
|
+ return ret;
|
|
|
|
+}
|
|
|
|
+EXPORT_SYMBOL_GPL(regulator_suspend_finish);
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* regulator_has_full_constraints - the system has fully specified constraints
|
|
* regulator_has_full_constraints - the system has fully specified constraints
|
|
*
|
|
*
|