diff options
author | Axel Lin <axel.lin@gmail.com> | 2012-04-17 22:51:59 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-04-23 08:19:51 -0400 |
commit | 98667b4362c5fc2d6e200644a4003bb0e881f726 (patch) | |
tree | 130a0f977749350f31f2067ef909aadd72efb005 /drivers/regulator/pcf50633-regulator.c | |
parent | 0d481f74ab6aa94b0900138525b14e7e2af8e3b1 (diff) |
regulator: pcf50633: Use regulator_get_voltage_sel_regmap()
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/pcf50633-regulator.c')
-rw-r--r-- | drivers/regulator/pcf50633-regulator.c | 37 |
1 files changed, 4 insertions, 33 deletions
diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c index 5887505699d2..3c9d14c0017b 100644 --- a/drivers/regulator/pcf50633-regulator.c +++ b/drivers/regulator/pcf50633-regulator.c | |||
@@ -32,24 +32,12 @@ | |||
32 | .n_voltages = _n, \ | 32 | .n_voltages = _n, \ |
33 | .type = REGULATOR_VOLTAGE, \ | 33 | .type = REGULATOR_VOLTAGE, \ |
34 | .owner = THIS_MODULE, \ | 34 | .owner = THIS_MODULE, \ |
35 | .vsel_reg = PCF50633_REG_##_id##OUT, \ | ||
36 | .vsel_mask = 0xff, \ | ||
35 | .enable_reg = PCF50633_REG_##_id##OUT + 1, \ | 37 | .enable_reg = PCF50633_REG_##_id##OUT + 1, \ |
36 | .enable_mask = PCF50633_REGULATOR_ON, \ | 38 | .enable_mask = PCF50633_REGULATOR_ON, \ |
37 | } | 39 | } |
38 | 40 | ||
39 | static const u8 pcf50633_regulator_registers[PCF50633_NUM_REGULATORS] = { | ||
40 | [PCF50633_REGULATOR_AUTO] = PCF50633_REG_AUTOOUT, | ||
41 | [PCF50633_REGULATOR_DOWN1] = PCF50633_REG_DOWN1OUT, | ||
42 | [PCF50633_REGULATOR_DOWN2] = PCF50633_REG_DOWN2OUT, | ||
43 | [PCF50633_REGULATOR_MEMLDO] = PCF50633_REG_MEMLDOOUT, | ||
44 | [PCF50633_REGULATOR_LDO1] = PCF50633_REG_LDO1OUT, | ||
45 | [PCF50633_REGULATOR_LDO2] = PCF50633_REG_LDO2OUT, | ||
46 | [PCF50633_REGULATOR_LDO3] = PCF50633_REG_LDO3OUT, | ||
47 | [PCF50633_REGULATOR_LDO4] = PCF50633_REG_LDO4OUT, | ||
48 | [PCF50633_REGULATOR_LDO5] = PCF50633_REG_LDO5OUT, | ||
49 | [PCF50633_REGULATOR_LDO6] = PCF50633_REG_LDO6OUT, | ||
50 | [PCF50633_REGULATOR_HCLDO] = PCF50633_REG_HCLDOOUT, | ||
51 | }; | ||
52 | |||
53 | /* Bits from voltage value */ | 41 | /* Bits from voltage value */ |
54 | static u8 auto_voltage_bits(unsigned int millivolts) | 42 | static u8 auto_voltage_bits(unsigned int millivolts) |
55 | { | 43 | { |
@@ -128,7 +116,7 @@ static int pcf50633_regulator_set_voltage(struct regulator_dev *rdev, | |||
128 | 116 | ||
129 | millivolts = min_uV / 1000; | 117 | millivolts = min_uV / 1000; |
130 | 118 | ||
131 | regnr = pcf50633_regulator_registers[regulator_id]; | 119 | regnr = rdev->desc->vsel_reg; |
132 | 120 | ||
133 | switch (regulator_id) { | 121 | switch (regulator_id) { |
134 | case PCF50633_REGULATOR_AUTO: | 122 | case PCF50633_REGULATOR_AUTO: |
@@ -159,23 +147,6 @@ static int pcf50633_regulator_set_voltage(struct regulator_dev *rdev, | |||
159 | return pcf50633_reg_write(pcf, regnr, volt_bits); | 147 | return pcf50633_reg_write(pcf, regnr, volt_bits); |
160 | } | 148 | } |
161 | 149 | ||
162 | static int pcf50633_regulator_get_voltage_sel(struct regulator_dev *rdev) | ||
163 | { | ||
164 | struct pcf50633 *pcf; | ||
165 | int regulator_id; | ||
166 | u8 regnr; | ||
167 | |||
168 | pcf = rdev_get_drvdata(rdev); | ||
169 | |||
170 | regulator_id = rdev_get_id(rdev); | ||
171 | if (regulator_id >= PCF50633_NUM_REGULATORS) | ||
172 | return -EINVAL; | ||
173 | |||
174 | regnr = pcf50633_regulator_registers[regulator_id]; | ||
175 | |||
176 | return pcf50633_reg_read(pcf, regnr); | ||
177 | } | ||
178 | |||
179 | static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, | 150 | static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, |
180 | unsigned int index) | 151 | unsigned int index) |
181 | { | 152 | { |
@@ -212,7 +183,7 @@ static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev, | |||
212 | 183 | ||
213 | static struct regulator_ops pcf50633_regulator_ops = { | 184 | static struct regulator_ops pcf50633_regulator_ops = { |
214 | .set_voltage = pcf50633_regulator_set_voltage, | 185 | .set_voltage = pcf50633_regulator_set_voltage, |
215 | .get_voltage_sel = pcf50633_regulator_get_voltage_sel, | 186 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
216 | .list_voltage = pcf50633_regulator_list_voltage, | 187 | .list_voltage = pcf50633_regulator_list_voltage, |
217 | .enable = regulator_enable_regmap, | 188 | .enable = regulator_enable_regmap, |
218 | .disable = regulator_disable_regmap, | 189 | .disable = regulator_disable_regmap, |