diff options
author | Mark Brown <broonie@sirena.org.uk> | 2013-04-27 21:13:47 -0400 |
---|---|---|
committer | Mark Brown <broonie@sirena.org.uk> | 2013-04-27 21:13:47 -0400 |
commit | 813dc1b086d230ad3fe8ccf7ef70a135d08c3b27 (patch) | |
tree | f2907c292f65d8c889cde9042d1e18d84eb157a5 /drivers/regulator | |
parent | 22a712b90ca5411cb37df82dfb50144c87175fb4 (diff) | |
parent | 46bcb006ae92cdd10c39eeaecf2ca4994026943a (diff) |
Merge remote-tracking branch 'regulator/topic/tps65023' into v3.9-rc8
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/tps65023-regulator.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/drivers/regulator/tps65023-regulator.c b/drivers/regulator/tps65023-regulator.c index 8d21cf3385e4..9d053e23e9eb 100644 --- a/drivers/regulator/tps65023-regulator.c +++ b/drivers/regulator/tps65023-regulator.c | |||
@@ -149,20 +149,15 @@ struct tps_driver_data { | |||
149 | static int tps65023_dcdc_get_voltage_sel(struct regulator_dev *dev) | 149 | static int tps65023_dcdc_get_voltage_sel(struct regulator_dev *dev) |
150 | { | 150 | { |
151 | struct tps_pmic *tps = rdev_get_drvdata(dev); | 151 | struct tps_pmic *tps = rdev_get_drvdata(dev); |
152 | int ret; | 152 | int dcdc = rdev_get_id(dev); |
153 | int data, dcdc = rdev_get_id(dev); | ||
154 | 153 | ||
155 | if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3) | 154 | if (dcdc < TPS65023_DCDC_1 || dcdc > TPS65023_DCDC_3) |
156 | return -EINVAL; | 155 | return -EINVAL; |
157 | 156 | ||
158 | if (dcdc == tps->core_regulator) { | 157 | if (dcdc != tps->core_regulator) |
159 | ret = regmap_read(tps->regmap, TPS65023_REG_DEF_CORE, &data); | ||
160 | if (ret != 0) | ||
161 | return ret; | ||
162 | data &= (tps->info[dcdc]->table_len - 1); | ||
163 | return data; | ||
164 | } else | ||
165 | return 0; | 158 | return 0; |
159 | |||
160 | return regulator_get_voltage_sel_regmap(dev); | ||
166 | } | 161 | } |
167 | 162 | ||
168 | static int tps65023_dcdc_set_voltage_sel(struct regulator_dev *dev, | 163 | static int tps65023_dcdc_set_voltage_sel(struct regulator_dev *dev, |
@@ -170,23 +165,11 @@ static int tps65023_dcdc_set_voltage_sel(struct regulator_dev *dev, | |||
170 | { | 165 | { |
171 | struct tps_pmic *tps = rdev_get_drvdata(dev); | 166 | struct tps_pmic *tps = rdev_get_drvdata(dev); |
172 | int dcdc = rdev_get_id(dev); | 167 | int dcdc = rdev_get_id(dev); |
173 | int ret; | ||
174 | 168 | ||
175 | if (dcdc != tps->core_regulator) | 169 | if (dcdc != tps->core_regulator) |
176 | return -EINVAL; | 170 | return -EINVAL; |
177 | 171 | ||
178 | ret = regmap_write(tps->regmap, TPS65023_REG_DEF_CORE, selector); | 172 | return regulator_set_voltage_sel_regmap(dev, selector); |
179 | if (ret) | ||
180 | goto out; | ||
181 | |||
182 | /* Tell the chip that we have changed the value in DEFCORE | ||
183 | * and its time to update the core voltage | ||
184 | */ | ||
185 | ret = regmap_update_bits(tps->regmap, TPS65023_REG_CON_CTRL2, | ||
186 | TPS65023_REG_CTRL2_GO, TPS65023_REG_CTRL2_GO); | ||
187 | |||
188 | out: | ||
189 | return ret; | ||
190 | } | 173 | } |
191 | 174 | ||
192 | /* Operations permitted on VDCDCx */ | 175 | /* Operations permitted on VDCDCx */ |
@@ -282,6 +265,10 @@ static int tps_65023_probe(struct i2c_client *client, | |||
282 | default: /* DCDCx */ | 265 | default: /* DCDCx */ |
283 | tps->desc[i].enable_mask = | 266 | tps->desc[i].enable_mask = |
284 | 1 << (TPS65023_NUM_REGULATOR - i); | 267 | 1 << (TPS65023_NUM_REGULATOR - i); |
268 | tps->desc[i].vsel_reg = TPS65023_REG_DEF_CORE; | ||
269 | tps->desc[i].vsel_mask = info->table_len - 1; | ||
270 | tps->desc[i].apply_reg = TPS65023_REG_CON_CTRL2; | ||
271 | tps->desc[i].apply_bit = TPS65023_REG_CTRL2_GO; | ||
285 | } | 272 | } |
286 | 273 | ||
287 | config.dev = &client->dev; | 274 | config.dev = &client->dev; |