aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pm_opp.h
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2022-07-04 13:45:08 +0530
committerViresh Kumar <viresh.kumar@linaro.org>2022-07-08 11:27:49 +0530
commitaee3352f6ecf8cfad1f1ee5838cfc4d37c6b8f75 (patch)
tree9563cb20adcf0ebb8d6587f50558972cdc94bbad /include/linux/pm_opp.h
parentOPP: Migrate set-prop-name helper API to use set-config helpers (diff)
downloadlinux-dev-aee3352f6ecf8cfad1f1ee5838cfc4d37c6b8f75.tar.xz
linux-dev-aee3352f6ecf8cfad1f1ee5838cfc4d37c6b8f75.zip
OPP: Add support for config_regulators() helper
Extend the dev_pm_opp_set_config() interface to allow adding config_regulators() helpers. This helper will be called to set the voltages of the regulators from the regular path in _set_opp(), while we are trying to change the OPP. This will eventually replace the custom set_opp() helper. Tested-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'include/linux/pm_opp.h')
-rw-r--r--include/linux/pm_opp.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
index f995ca1406e8..9f2f9a792a19 100644
--- a/include/linux/pm_opp.h
+++ b/include/linux/pm_opp.h
@@ -90,11 +90,16 @@ struct dev_pm_set_opp_data {
struct device *dev;
};
+typedef int (*config_regulators_t)(struct device *dev,
+ struct dev_pm_opp *old_opp, struct dev_pm_opp *new_opp,
+ struct regulator **regulators, unsigned int count);
+
/**
* struct dev_pm_opp_config - Device OPP configuration values
* @clk_names: Clk names, NULL terminated array, max 1 clock for now.
* @prop_name: Name to postfix to properties.
* @set_opp: Custom set OPP helper.
+ * @config_regulators: Custom set regulator helper.
* @supported_hw: Array of hierarchy of versions to match.
* @supported_hw_count: Number of elements in the array.
* @regulator_names: Array of pointers to the names of the regulator, NULL terminated.
@@ -109,6 +114,7 @@ struct dev_pm_opp_config {
const char * const *clk_names;
const char *prop_name;
int (*set_opp)(struct dev_pm_set_opp_data *data);
+ config_regulators_t config_regulators;
const unsigned int *supported_hw;
unsigned int supported_hw_count;
const char * const *regulator_names;
@@ -613,6 +619,22 @@ static inline void dev_pm_opp_unregister_set_opp_helper(int token)
dev_pm_opp_clear_config(token);
}
+/* config-regulators helpers */
+static inline int dev_pm_opp_set_config_regulators(struct device *dev,
+ config_regulators_t helper)
+{
+ struct dev_pm_opp_config config = {
+ .config_regulators = helper,
+ };
+
+ return dev_pm_opp_set_config(dev, &config);
+}
+
+static inline void dev_pm_opp_put_config_regulators(int token)
+{
+ dev_pm_opp_clear_config(token);
+}
+
/* genpd helpers */
static inline int dev_pm_opp_attach_genpd(struct device *dev,
const char * const *names,