diff options
Diffstat (limited to 'drivers/regulator/ab8500.c')
-rw-r--r-- | drivers/regulator/ab8500.c | 63 |
1 files changed, 51 insertions, 12 deletions
diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 2a15b6300e18..7d372b87b5dd 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c | |||
@@ -114,6 +114,12 @@ static int ab8500_regulator_enable(struct regulator_dev *rdev) | |||
114 | if (ret < 0) | 114 | if (ret < 0) |
115 | dev_err(rdev_get_dev(rdev), | 115 | dev_err(rdev_get_dev(rdev), |
116 | "couldn't set enable bits for regulator\n"); | 116 | "couldn't set enable bits for regulator\n"); |
117 | |||
118 | dev_vdbg(rdev_get_dev(rdev), | ||
119 | "%s-enable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", | ||
120 | info->desc.name, info->update_bank, info->update_reg, | ||
121 | info->update_mask, info->update_val_enable); | ||
122 | |||
117 | return ret; | 123 | return ret; |
118 | } | 124 | } |
119 | 125 | ||
@@ -133,6 +139,12 @@ static int ab8500_regulator_disable(struct regulator_dev *rdev) | |||
133 | if (ret < 0) | 139 | if (ret < 0) |
134 | dev_err(rdev_get_dev(rdev), | 140 | dev_err(rdev_get_dev(rdev), |
135 | "couldn't set disable bits for regulator\n"); | 141 | "couldn't set disable bits for regulator\n"); |
142 | |||
143 | dev_vdbg(rdev_get_dev(rdev), | ||
144 | "%s-disable (bank, reg, mask, value): 0x%x, 0x%x, 0x%x, 0x%x\n", | ||
145 | info->desc.name, info->update_bank, info->update_reg, | ||
146 | info->update_mask, 0x0); | ||
147 | |||
136 | return ret; | 148 | return ret; |
137 | } | 149 | } |
138 | 150 | ||
@@ -140,7 +152,7 @@ static int ab8500_regulator_is_enabled(struct regulator_dev *rdev) | |||
140 | { | 152 | { |
141 | int ret; | 153 | int ret; |
142 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); | 154 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
143 | u8 value; | 155 | u8 regval; |
144 | 156 | ||
145 | if (info == NULL) { | 157 | if (info == NULL) { |
146 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); | 158 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
@@ -148,14 +160,20 @@ static int ab8500_regulator_is_enabled(struct regulator_dev *rdev) | |||
148 | } | 160 | } |
149 | 161 | ||
150 | ret = abx500_get_register_interruptible(info->dev, | 162 | ret = abx500_get_register_interruptible(info->dev, |
151 | info->update_bank, info->update_reg, &value); | 163 | info->update_bank, info->update_reg, ®val); |
152 | if (ret < 0) { | 164 | if (ret < 0) { |
153 | dev_err(rdev_get_dev(rdev), | 165 | dev_err(rdev_get_dev(rdev), |
154 | "couldn't read 0x%x register\n", info->update_reg); | 166 | "couldn't read 0x%x register\n", info->update_reg); |
155 | return ret; | 167 | return ret; |
156 | } | 168 | } |
157 | 169 | ||
158 | if (value & info->update_mask) | 170 | dev_vdbg(rdev_get_dev(rdev), |
171 | "%s-is_enabled (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," | ||
172 | " 0x%x\n", | ||
173 | info->desc.name, info->update_bank, info->update_reg, | ||
174 | info->update_mask, regval); | ||
175 | |||
176 | if (regval & info->update_mask) | ||
159 | return true; | 177 | return true; |
160 | else | 178 | else |
161 | return false; | 179 | return false; |
@@ -182,29 +200,35 @@ static int ab8500_list_voltage(struct regulator_dev *rdev, unsigned selector) | |||
182 | 200 | ||
183 | static int ab8500_regulator_get_voltage(struct regulator_dev *rdev) | 201 | static int ab8500_regulator_get_voltage(struct regulator_dev *rdev) |
184 | { | 202 | { |
185 | int ret; | 203 | int ret, val; |
186 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); | 204 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
187 | u8 value; | 205 | u8 regval; |
188 | 206 | ||
189 | if (info == NULL) { | 207 | if (info == NULL) { |
190 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); | 208 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
191 | return -EINVAL; | 209 | return -EINVAL; |
192 | } | 210 | } |
193 | 211 | ||
194 | ret = abx500_get_register_interruptible(info->dev, info->voltage_bank, | 212 | ret = abx500_get_register_interruptible(info->dev, |
195 | info->voltage_reg, &value); | 213 | info->voltage_bank, info->voltage_reg, ®val); |
196 | if (ret < 0) { | 214 | if (ret < 0) { |
197 | dev_err(rdev_get_dev(rdev), | 215 | dev_err(rdev_get_dev(rdev), |
198 | "couldn't read voltage reg for regulator\n"); | 216 | "couldn't read voltage reg for regulator\n"); |
199 | return ret; | 217 | return ret; |
200 | } | 218 | } |
201 | 219 | ||
220 | dev_vdbg(rdev_get_dev(rdev), | ||
221 | "%s-get_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," | ||
222 | " 0x%x\n", | ||
223 | info->desc.name, info->voltage_bank, info->voltage_reg, | ||
224 | info->voltage_mask, regval); | ||
225 | |||
202 | /* vintcore has a different layout */ | 226 | /* vintcore has a different layout */ |
203 | value &= info->voltage_mask; | 227 | val = regval & info->voltage_mask; |
204 | if (info->desc.id == AB8500_LDO_INTCORE) | 228 | if (info->desc.id == AB8500_LDO_INTCORE) |
205 | ret = info->voltages[value >> 0x3]; | 229 | ret = info->voltages[val >> 0x3]; |
206 | else | 230 | else |
207 | ret = info->voltages[value]; | 231 | ret = info->voltages[val]; |
208 | 232 | ||
209 | return ret; | 233 | return ret; |
210 | } | 234 | } |
@@ -231,6 +255,7 @@ static int ab8500_regulator_set_voltage(struct regulator_dev *rdev, | |||
231 | { | 255 | { |
232 | int ret; | 256 | int ret; |
233 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); | 257 | struct ab8500_regulator_info *info = rdev_get_drvdata(rdev); |
258 | u8 regval; | ||
234 | 259 | ||
235 | if (info == NULL) { | 260 | if (info == NULL) { |
236 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); | 261 | dev_err(rdev_get_dev(rdev), "regulator info null pointer\n"); |
@@ -248,13 +273,20 @@ static int ab8500_regulator_set_voltage(struct regulator_dev *rdev, | |||
248 | *selector = ret; | 273 | *selector = ret; |
249 | 274 | ||
250 | /* set the registers for the request */ | 275 | /* set the registers for the request */ |
276 | regval = (u8)ret; | ||
251 | ret = abx500_mask_and_set_register_interruptible(info->dev, | 277 | ret = abx500_mask_and_set_register_interruptible(info->dev, |
252 | info->voltage_bank, info->voltage_reg, | 278 | info->voltage_bank, info->voltage_reg, |
253 | info->voltage_mask, (u8)ret); | 279 | info->voltage_mask, regval); |
254 | if (ret < 0) | 280 | if (ret < 0) |
255 | dev_err(rdev_get_dev(rdev), | 281 | dev_err(rdev_get_dev(rdev), |
256 | "couldn't set voltage reg for regulator\n"); | 282 | "couldn't set voltage reg for regulator\n"); |
257 | 283 | ||
284 | dev_vdbg(rdev_get_dev(rdev), | ||
285 | "%s-set_voltage (bank, reg, mask, value): 0x%x, 0x%x, 0x%x," | ||
286 | " 0x%x\n", | ||
287 | info->desc.name, info->voltage_bank, info->voltage_reg, | ||
288 | info->voltage_mask, regval); | ||
289 | |||
258 | return ret; | 290 | return ret; |
259 | } | 291 | } |
260 | 292 | ||
@@ -418,6 +450,9 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) | |||
418 | } | 450 | } |
419 | return err; | 451 | return err; |
420 | } | 452 | } |
453 | |||
454 | dev_vdbg(rdev_get_dev(info->regulator), | ||
455 | "%s-probed\n", info->desc.name); | ||
421 | } | 456 | } |
422 | 457 | ||
423 | return 0; | 458 | return 0; |
@@ -430,6 +465,10 @@ static __devexit int ab8500_regulator_remove(struct platform_device *pdev) | |||
430 | for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { | 465 | for (i = 0; i < ARRAY_SIZE(ab8500_regulator_info); i++) { |
431 | struct ab8500_regulator_info *info = NULL; | 466 | struct ab8500_regulator_info *info = NULL; |
432 | info = &ab8500_regulator_info[i]; | 467 | info = &ab8500_regulator_info[i]; |
468 | |||
469 | dev_vdbg(rdev_get_dev(info->regulator), | ||
470 | "%s-remove\n", info->desc.name); | ||
471 | |||
433 | regulator_unregister(info->regulator); | 472 | regulator_unregister(info->regulator); |
434 | } | 473 | } |
435 | 474 | ||