aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/pcf50633-regulator.c22
1 files changed, 6 insertions, 16 deletions
diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c
index 6db46c632f13..c05b5d12b2ca 100644
--- a/drivers/regulator/pcf50633-regulator.c
+++ b/drivers/regulator/pcf50633-regulator.c
@@ -52,7 +52,7 @@ static const u8 pcf50633_regulator_registers[PCF50633_NUM_REGULATORS] = {
52static u8 auto_voltage_bits(unsigned int millivolts) 52static u8 auto_voltage_bits(unsigned int millivolts)
53{ 53{
54 if (millivolts < 1800) 54 if (millivolts < 1800)
55 return 0; 55 return 0x2f;
56 if (millivolts > 3800) 56 if (millivolts > 3800)
57 return 0xff; 57 return 0xff;
58 58
@@ -87,6 +87,9 @@ static u8 ldo_voltage_bits(unsigned int millivolts)
87/* Obtain voltage value from bits */ 87/* Obtain voltage value from bits */
88static unsigned int auto_voltage_value(u8 bits) 88static unsigned int auto_voltage_value(u8 bits)
89{ 89{
90 /* AUTOOUT: 00000000 to 00101110 are reserved.
91 * Return 0 for bits in reserved range, which means this selector code
92 * can't be used on this system */
90 if (bits < 0x2f) 93 if (bits < 0x2f)
91 return 0; 94 return 0;
92 95
@@ -208,20 +211,7 @@ static int pcf50633_regulator_get_voltage(struct regulator_dev *rdev)
208static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, 211static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev,
209 unsigned int index) 212 unsigned int index)
210{ 213{
211 struct pcf50633 *pcf; 214 int regulator_id = rdev_get_id(rdev);
212 int regulator_id;
213
214 pcf = rdev_get_drvdata(rdev);
215
216 regulator_id = rdev_get_id(rdev);
217
218 switch (regulator_id) {
219 case PCF50633_REGULATOR_AUTO:
220 index += 0x2f;
221 break;
222 default:
223 break;
224 }
225 215
226 return pcf50633_regulator_voltage_value(regulator_id, index); 216 return pcf50633_regulator_voltage_value(regulator_id, index);
227} 217}
@@ -287,7 +277,7 @@ static struct regulator_ops pcf50633_regulator_ops = {
287 277
288static struct regulator_desc regulators[] = { 278static struct regulator_desc regulators[] = {
289 [PCF50633_REGULATOR_AUTO] = 279 [PCF50633_REGULATOR_AUTO] =
290 PCF50633_REGULATOR("auto", PCF50633_REGULATOR_AUTO, 81), 280 PCF50633_REGULATOR("auto", PCF50633_REGULATOR_AUTO, 128),
291 [PCF50633_REGULATOR_DOWN1] = 281 [PCF50633_REGULATOR_DOWN1] =
292 PCF50633_REGULATOR("down1", PCF50633_REGULATOR_DOWN1, 96), 282 PCF50633_REGULATOR("down1", PCF50633_REGULATOR_DOWN1, 96),
293 [PCF50633_REGULATOR_DOWN2] = 283 [PCF50633_REGULATOR_DOWN2] =