@@ -71,18 +71,17 @@ struct tps65086_regulator {
71
71
unsigned int decay_mask ;
72
72
};
73
73
74
- static const struct regulator_linear_range tps65086_buck126_10mv_ranges [] = {
74
+ static const struct regulator_linear_range tps65086_10mv_ranges [] = {
75
75
REGULATOR_LINEAR_RANGE (0 , 0x0 , 0x0 , 0 ),
76
76
REGULATOR_LINEAR_RANGE (410000 , 0x1 , 0x7F , 10000 ),
77
77
};
78
78
79
79
static const struct regulator_linear_range tps65086_buck126_25mv_ranges [] = {
80
- REGULATOR_LINEAR_RANGE (0 , 0x0 , 0x0 , 0 ),
81
- REGULATOR_LINEAR_RANGE (1000000 , 0x1 , 0x18 , 0 ),
80
+ REGULATOR_LINEAR_RANGE (1000000 , 0x0 , 0x18 , 0 ),
82
81
REGULATOR_LINEAR_RANGE (1025000 , 0x19 , 0x7F , 25000 ),
83
82
};
84
83
85
- static const struct regulator_linear_range tps65086_buck345_ranges [] = {
84
+ static const struct regulator_linear_range tps65086_buck345_25mv_ranges [] = {
86
85
REGULATOR_LINEAR_RANGE (0 , 0x0 , 0x0 , 0 ),
87
86
REGULATOR_LINEAR_RANGE (425000 , 0x1 , 0x7F , 25000 ),
88
87
};
@@ -125,27 +124,27 @@ static int tps65086_of_parse_cb(struct device_node *dev,
125
124
static struct tps65086_regulator regulators [] = {
126
125
TPS65086_REGULATOR ("BUCK1" , "buck1" , BUCK1 , 0x80 , TPS65086_BUCK1CTRL ,
127
126
BUCK_VID_MASK , TPS65086_BUCK123CTRL , BIT (0 ),
128
- tps65086_buck126_10mv_ranges , TPS65086_BUCK1CTRL ,
127
+ tps65086_10mv_ranges , TPS65086_BUCK1CTRL ,
129
128
BIT (0 )),
130
129
TPS65086_REGULATOR ("BUCK2" , "buck2" , BUCK2 , 0x80 , TPS65086_BUCK2CTRL ,
131
130
BUCK_VID_MASK , TPS65086_BUCK123CTRL , BIT (1 ),
132
- tps65086_buck126_10mv_ranges , TPS65086_BUCK2CTRL ,
131
+ tps65086_10mv_ranges , TPS65086_BUCK2CTRL ,
133
132
BIT (0 )),
134
133
TPS65086_REGULATOR ("BUCK3" , "buck3" , BUCK3 , 0x80 , TPS65086_BUCK3VID ,
135
134
BUCK_VID_MASK , TPS65086_BUCK123CTRL , BIT (2 ),
136
- tps65086_buck345_ranges , TPS65086_BUCK3DECAY ,
135
+ tps65086_10mv_ranges , TPS65086_BUCK3DECAY ,
137
136
BIT (0 )),
138
137
TPS65086_REGULATOR ("BUCK4" , "buck4" , BUCK4 , 0x80 , TPS65086_BUCK4VID ,
139
138
BUCK_VID_MASK , TPS65086_BUCK4CTRL , BIT (0 ),
140
- tps65086_buck345_ranges , TPS65086_BUCK4VID ,
139
+ tps65086_10mv_ranges , TPS65086_BUCK4VID ,
141
140
BIT (0 )),
142
141
TPS65086_REGULATOR ("BUCK5" , "buck5" , BUCK5 , 0x80 , TPS65086_BUCK5VID ,
143
142
BUCK_VID_MASK , TPS65086_BUCK5CTRL , BIT (0 ),
144
- tps65086_buck345_ranges , TPS65086_BUCK5CTRL ,
143
+ tps65086_10mv_ranges , TPS65086_BUCK5CTRL ,
145
144
BIT (0 )),
146
145
TPS65086_REGULATOR ("BUCK6" , "buck6" , BUCK6 , 0x80 , TPS65086_BUCK6VID ,
147
146
BUCK_VID_MASK , TPS65086_BUCK6CTRL , BIT (0 ),
148
- tps65086_buck126_10mv_ranges , TPS65086_BUCK6CTRL ,
147
+ tps65086_10mv_ranges , TPS65086_BUCK6CTRL ,
149
148
BIT (0 )),
150
149
TPS65086_REGULATOR ("LDOA1" , "ldoa1" , LDOA1 , 0xF , TPS65086_LDOA1CTRL ,
151
150
VDOA1_VID_MASK , TPS65086_LDOA1CTRL , BIT (0 ),
@@ -162,31 +161,34 @@ static struct tps65086_regulator regulators[] = {
162
161
TPS65086_SWITCH ("VTT" , "vtt" , VTT , TPS65086_SWVTT_EN , BIT (4 )),
163
162
};
164
163
165
- static inline bool has_25mv_mode (int id )
166
- {
167
- switch (id ) {
168
- case BUCK1 :
169
- case BUCK2 :
170
- case BUCK6 :
171
- return true;
172
- default :
173
- return false;
174
- }
175
- }
176
-
177
164
static int tps65086_of_parse_cb (struct device_node * dev ,
178
165
const struct regulator_desc * desc ,
179
166
struct regulator_config * config )
180
167
{
181
168
int ret ;
182
169
183
170
/* Check for 25mV step mode */
184
- if (has_25mv_mode (desc -> id ) &&
185
- of_property_read_bool (config -> of_node , "ti,regulator-step-size-25mv" )) {
186
- regulators [desc -> id ].desc .linear_ranges =
171
+ if (of_property_read_bool (config -> of_node , "ti,regulator-step-size-25mv" )) {
172
+ switch (desc -> id ) {
173
+ case BUCK1 :
174
+ case BUCK2 :
175
+ case BUCK6 :
176
+ regulators [desc -> id ].desc .linear_ranges =
187
177
tps65086_buck126_25mv_ranges ;
188
- regulators [desc -> id ].desc .n_linear_ranges =
178
+ regulators [desc -> id ].desc .n_linear_ranges =
189
179
ARRAY_SIZE (tps65086_buck126_25mv_ranges );
180
+ break ;
181
+ case BUCK3 :
182
+ case BUCK4 :
183
+ case BUCK5 :
184
+ regulators [desc -> id ].desc .linear_ranges =
185
+ tps65086_buck345_25mv_ranges ;
186
+ regulators [desc -> id ].desc .n_linear_ranges =
187
+ ARRAY_SIZE (tps65086_buck345_25mv_ranges );
188
+ break ;
189
+ default :
190
+ dev_warn (config -> dev , "25mV step mode only valid for BUCK regulators\n" );
191
+ }
190
192
}
191
193
192
194
/* Check for decay mode */
0 commit comments