@@ -3642,36 +3642,19 @@ static int regulator_get_optimal_voltage(struct regulator_dev *rdev,
3642
3642
return done ;
3643
3643
}
3644
3644
3645
- static int regulator_balance_voltage (struct regulator_dev * rdev ,
3646
- suspend_state_t state )
3645
+ int regulator_do_balance_voltage (struct regulator_dev * rdev ,
3646
+ suspend_state_t state , bool skip_coupled )
3647
3647
{
3648
3648
struct regulator_dev * * c_rdevs ;
3649
3649
struct regulator_dev * best_rdev ;
3650
3650
struct coupling_desc * c_desc = & rdev -> coupling_desc ;
3651
- struct regulator_coupler * coupler = c_desc -> coupler ;
3652
3651
int i , ret , n_coupled , best_min_uV , best_max_uV , best_c_rdev ;
3653
3652
unsigned int delta , best_delta ;
3654
3653
unsigned long c_rdev_done = 0 ;
3655
3654
bool best_c_rdev_done ;
3656
3655
3657
3656
c_rdevs = c_desc -> coupled_rdevs ;
3658
- n_coupled = c_desc -> n_coupled ;
3659
-
3660
- /*
3661
- * If system is in a state other than PM_SUSPEND_ON, don't check
3662
- * other coupled regulators.
3663
- */
3664
- if (state != PM_SUSPEND_ON )
3665
- n_coupled = 1 ;
3666
-
3667
- if (c_desc -> n_resolved < n_coupled ) {
3668
- rdev_err (rdev , "Not all coupled regulators registered\n" );
3669
- return - EPERM ;
3670
- }
3671
-
3672
- /* Invoke custom balancer for customized couplers */
3673
- if (coupler && coupler -> balance_voltage )
3674
- return coupler -> balance_voltage (coupler , rdev , state );
3657
+ n_coupled = skip_coupled ? 1 : c_desc -> n_coupled ;
3675
3658
3676
3659
/*
3677
3660
* Find the best possible voltage change on each loop. Leave the loop
@@ -3742,6 +3725,32 @@ static int regulator_balance_voltage(struct regulator_dev *rdev,
3742
3725
return ret ;
3743
3726
}
3744
3727
3728
+ static int regulator_balance_voltage (struct regulator_dev * rdev ,
3729
+ suspend_state_t state )
3730
+ {
3731
+ struct coupling_desc * c_desc = & rdev -> coupling_desc ;
3732
+ struct regulator_coupler * coupler = c_desc -> coupler ;
3733
+ bool skip_coupled = false;
3734
+
3735
+ /*
3736
+ * If system is in a state other than PM_SUSPEND_ON, don't check
3737
+ * other coupled regulators.
3738
+ */
3739
+ if (state != PM_SUSPEND_ON )
3740
+ skip_coupled = true;
3741
+
3742
+ if (c_desc -> n_resolved < c_desc -> n_coupled ) {
3743
+ rdev_err (rdev , "Not all coupled regulators registered\n" );
3744
+ return - EPERM ;
3745
+ }
3746
+
3747
+ /* Invoke custom balancer for customized couplers */
3748
+ if (coupler && coupler -> balance_voltage )
3749
+ return coupler -> balance_voltage (coupler , rdev , state );
3750
+
3751
+ return regulator_do_balance_voltage (rdev , state , skip_coupled );
3752
+ }
3753
+
3745
3754
/**
3746
3755
* regulator_set_voltage - set regulator output voltage
3747
3756
* @regulator: regulator source
0 commit comments