@@ -3012,6 +3012,47 @@ int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
30123012}
30133013EXPORT_SYMBOL_GPL (dev_pm_opp_adjust_voltage );
30143014
3015+ /**
3016+ * dev_pm_opp_sync_regulators() - Sync state of voltage regulators
3017+ * @dev: device for which we do this operation
3018+ *
3019+ * Sync voltage state of the OPP table regulators.
3020+ *
3021+ * Return: 0 on success or a negative error value.
3022+ */
3023+ int dev_pm_opp_sync_regulators (struct device * dev )
3024+ {
3025+ struct opp_table * opp_table ;
3026+ struct regulator * reg ;
3027+ int i , ret = 0 ;
3028+
3029+ /* Device may not have OPP table */
3030+ opp_table = _find_opp_table (dev );
3031+ if (IS_ERR (opp_table ))
3032+ return 0 ;
3033+
3034+ /* Regulator may not be required for the device */
3035+ if (unlikely (!opp_table -> regulators ))
3036+ goto put_table ;
3037+
3038+ /* Nothing to sync if voltage wasn't changed */
3039+ if (!opp_table -> enabled )
3040+ goto put_table ;
3041+
3042+ for (i = 0 ; i < opp_table -> regulator_count ; i ++ ) {
3043+ reg = opp_table -> regulators [i ];
3044+ ret = regulator_sync_voltage (reg );
3045+ if (ret )
3046+ break ;
3047+ }
3048+ put_table :
3049+ /* Drop reference taken by _find_opp_table() */
3050+ dev_pm_opp_put_opp_table (opp_table );
3051+
3052+ return ret ;
3053+ }
3054+ EXPORT_SYMBOL_GPL (dev_pm_opp_sync_regulators );
3055+
30153056/**
30163057 * dev_pm_opp_enable() - Enable a specific OPP
30173058 * @dev: device for which we do this operation
@@ -3135,44 +3176,3 @@ void dev_pm_opp_remove_table(struct device *dev)
31353176 dev_pm_opp_put_opp_table (opp_table );
31363177}
31373178EXPORT_SYMBOL_GPL (dev_pm_opp_remove_table );
3138-
3139- /**
3140- * dev_pm_opp_sync_regulators() - Sync state of voltage regulators
3141- * @dev: device for which we do this operation
3142- *
3143- * Sync voltage state of the OPP table regulators.
3144- *
3145- * Return: 0 on success or a negative error value.
3146- */
3147- int dev_pm_opp_sync_regulators (struct device * dev )
3148- {
3149- struct opp_table * opp_table ;
3150- struct regulator * reg ;
3151- int i , ret = 0 ;
3152-
3153- /* Device may not have OPP table */
3154- opp_table = _find_opp_table (dev );
3155- if (IS_ERR (opp_table ))
3156- return 0 ;
3157-
3158- /* Regulator may not be required for the device */
3159- if (unlikely (!opp_table -> regulators ))
3160- goto put_table ;
3161-
3162- /* Nothing to sync if voltage wasn't changed */
3163- if (!opp_table -> enabled )
3164- goto put_table ;
3165-
3166- for (i = 0 ; i < opp_table -> regulator_count ; i ++ ) {
3167- reg = opp_table -> regulators [i ];
3168- ret = regulator_sync_voltage (reg );
3169- if (ret )
3170- break ;
3171- }
3172- put_table :
3173- /* Drop reference taken by _find_opp_table() */
3174- dev_pm_opp_put_opp_table (opp_table );
3175-
3176- return ret ;
3177- }
3178- EXPORT_SYMBOL_GPL (dev_pm_opp_sync_regulators );
0 commit comments