@@ -70,10 +70,11 @@ static int s2mps11_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
70
70
unsigned int new_selector )
71
71
{
72
72
struct s2mps11_info * s2mps11 = rdev_get_drvdata (rdev );
73
+ int rdev_id = rdev_get_id (rdev );
73
74
unsigned int ramp_delay = 0 ;
74
75
int old_volt , new_volt ;
75
76
76
- switch (rdev_get_id ( rdev ) ) {
77
+ switch (rdev_id ) {
77
78
case S2MPS11_BUCK2 :
78
79
ramp_delay = s2mps11 -> ramp_delay2 ;
79
80
break ;
@@ -111,9 +112,10 @@ static int s2mps11_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
111
112
struct s2mps11_info * s2mps11 = rdev_get_drvdata (rdev );
112
113
unsigned int ramp_val , ramp_shift , ramp_reg = S2MPS11_REG_RAMP_BUCK ;
113
114
unsigned int ramp_enable = 1 , enable_shift = 0 ;
115
+ int rdev_id = rdev_get_id (rdev );
114
116
int ret ;
115
117
116
- switch (rdev_get_id ( rdev ) ) {
118
+ switch (rdev_id ) {
117
119
case S2MPS11_BUCK1 :
118
120
if (ramp_delay > s2mps11 -> ramp_delay16 )
119
121
s2mps11 -> ramp_delay16 = ramp_delay ;
@@ -203,9 +205,8 @@ static int s2mps11_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
203
205
goto ramp_disable ;
204
206
205
207
/* Ramp delay can be enabled/disabled only for buck[2346] */
206
- if ((rdev_get_id (rdev ) >= S2MPS11_BUCK2 &&
207
- rdev_get_id (rdev ) <= S2MPS11_BUCK4 ) ||
208
- rdev_get_id (rdev ) == S2MPS11_BUCK6 ) {
208
+ if ((rdev_id >= S2MPS11_BUCK2 && rdev_id <= S2MPS11_BUCK4 ) ||
209
+ rdev_id == S2MPS11_BUCK6 ) {
209
210
ret = regmap_update_bits (rdev -> regmap , S2MPS11_REG_RAMP ,
210
211
1 << enable_shift , 1 << enable_shift );
211
212
if (ret ) {
@@ -503,20 +504,21 @@ static const struct regulator_desc s2mps13_regulators[] = {
503
504
static int s2mps14_regulator_enable (struct regulator_dev * rdev )
504
505
{
505
506
struct s2mps11_info * s2mps11 = rdev_get_drvdata (rdev );
507
+ int rdev_id = rdev_get_id (rdev );
506
508
unsigned int val ;
507
509
508
510
switch (s2mps11 -> dev_type ) {
509
511
case S2MPS13X :
510
512
case S2MPS14X :
511
- if (test_bit (rdev_get_id ( rdev ) , s2mps11 -> suspend_state ))
513
+ if (test_bit (rdev_id , s2mps11 -> suspend_state ))
512
514
val = S2MPS14_ENABLE_SUSPEND ;
513
- else if (s2mps11 -> ext_control_gpiod [rdev_get_id ( rdev ) ])
515
+ else if (s2mps11 -> ext_control_gpiod [rdev_id ])
514
516
val = S2MPS14_ENABLE_EXT_CONTROL ;
515
517
else
516
518
val = rdev -> desc -> enable_mask ;
517
519
break ;
518
520
case S2MPU02 :
519
- if (test_bit (rdev_get_id ( rdev ) , s2mps11 -> suspend_state ))
521
+ if (test_bit (rdev_id , s2mps11 -> suspend_state ))
520
522
val = S2MPU02_ENABLE_SUSPEND ;
521
523
else
522
524
val = rdev -> desc -> enable_mask ;
@@ -570,7 +572,7 @@ static int s2mps14_regulator_set_suspend_disable(struct regulator_dev *rdev)
570
572
if (ret < 0 )
571
573
return ret ;
572
574
573
- set_bit (rdev_get_id ( rdev ) , s2mps11 -> suspend_state );
575
+ set_bit (rdev_id , s2mps11 -> suspend_state );
574
576
/*
575
577
* Don't enable suspend mode if regulator is already disabled because
576
578
* this would effectively for a short time turn on the regulator after
@@ -856,8 +858,9 @@ static int s2mps11_pmic_dt_parse(struct platform_device *pdev,
856
858
static int s2mpu02_set_ramp_delay (struct regulator_dev * rdev , int ramp_delay )
857
859
{
858
860
unsigned int ramp_val , ramp_shift , ramp_reg ;
861
+ int rdev_id = rdev_get_id (rdev );
859
862
860
- switch (rdev_get_id ( rdev ) ) {
863
+ switch (rdev_id ) {
861
864
case S2MPU02_BUCK1 :
862
865
ramp_shift = S2MPU02_BUCK1_RAMP_SHIFT ;
863
866
break ;
0 commit comments