diff options
| author | Wenyou Yang <wenyou.yang@atmel.com> | 2015-09-30 03:25:49 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2015-10-02 12:53:24 -0400 |
| commit | c86dc03e54ce15aac623125d92faac005f94267b (patch) | |
| tree | 54ca87dbb503defe9527d70b6f96a4c3581c07f2 | |
| parent | 6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff) | |
regulator: act8865: support output voltage by VSET2[] bits
For the step-down DC/DC regulators, the output voltage is
selectable by setting VSEL pin that when VSEL is low, output
voltage is programmed by VSET1[] bits, and when VSEL is high,
output voltage is programmed by VSET2[] bits.
The DT property "active-semi,vsel-high" is used to specify
the VSEL pin at high on the board.
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Ludovic Desroches <ludovic.desroches@atmel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | drivers/regulator/act8865-regulator.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/regulator/act8865-regulator.c b/drivers/regulator/act8865-regulator.c index 896db168e4bd..f8d4cd3d1397 100644 --- a/drivers/regulator/act8865-regulator.c +++ b/drivers/regulator/act8865-regulator.c | |||
| @@ -261,6 +261,16 @@ static const struct regulator_desc act8865_regulators[] = { | |||
| 261 | ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"), | 261 | ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"), |
| 262 | }; | 262 | }; |
| 263 | 263 | ||
| 264 | static const struct regulator_desc act8865_alt_regulators[] = { | ||
| 265 | ACT88xx_REG("DCDC_REG1", ACT8865, DCDC1, VSET2, "vp1"), | ||
| 266 | ACT88xx_REG("DCDC_REG2", ACT8865, DCDC2, VSET2, "vp2"), | ||
| 267 | ACT88xx_REG("DCDC_REG3", ACT8865, DCDC3, VSET2, "vp3"), | ||
| 268 | ACT88xx_REG("LDO_REG1", ACT8865, LDO1, VSET, "inl45"), | ||
| 269 | ACT88xx_REG("LDO_REG2", ACT8865, LDO2, VSET, "inl45"), | ||
| 270 | ACT88xx_REG("LDO_REG3", ACT8865, LDO3, VSET, "inl67"), | ||
| 271 | ACT88xx_REG("LDO_REG4", ACT8865, LDO4, VSET, "inl67"), | ||
| 272 | }; | ||
| 273 | |||
| 264 | #ifdef CONFIG_OF | 274 | #ifdef CONFIG_OF |
| 265 | static const struct of_device_id act8865_dt_ids[] = { | 275 | static const struct of_device_id act8865_dt_ids[] = { |
| 266 | { .compatible = "active-semi,act8600", .data = (void *)ACT8600 }, | 276 | { .compatible = "active-semi,act8600", .data = (void *)ACT8600 }, |
| @@ -413,6 +423,7 @@ static int act8865_pmic_probe(struct i2c_client *client, | |||
| 413 | struct act8865 *act8865; | 423 | struct act8865 *act8865; |
| 414 | unsigned long type; | 424 | unsigned long type; |
| 415 | int off_reg, off_mask; | 425 | int off_reg, off_mask; |
| 426 | int voltage_select = 0; | ||
| 416 | 427 | ||
| 417 | pdata = dev_get_platdata(dev); | 428 | pdata = dev_get_platdata(dev); |
| 418 | 429 | ||
| @@ -424,6 +435,10 @@ static int act8865_pmic_probe(struct i2c_client *client, | |||
| 424 | return -ENODEV; | 435 | return -ENODEV; |
| 425 | 436 | ||
| 426 | type = (unsigned long) id->data; | 437 | type = (unsigned long) id->data; |
| 438 | |||
| 439 | voltage_select = !!of_get_property(dev->of_node, | ||
| 440 | "active-semi,vsel-high", | ||
| 441 | NULL); | ||
| 427 | } else { | 442 | } else { |
| 428 | type = i2c_id->driver_data; | 443 | type = i2c_id->driver_data; |
| 429 | } | 444 | } |
| @@ -442,8 +457,13 @@ static int act8865_pmic_probe(struct i2c_client *client, | |||
| 442 | off_mask = ACT8846_OFF_SYSMASK; | 457 | off_mask = ACT8846_OFF_SYSMASK; |
| 443 | break; | 458 | break; |
| 444 | case ACT8865: | 459 | case ACT8865: |
| 445 | regulators = act8865_regulators; | 460 | if (voltage_select) { |
| 446 | num_regulators = ARRAY_SIZE(act8865_regulators); | 461 | regulators = act8865_alt_regulators; |
| 462 | num_regulators = ARRAY_SIZE(act8865_alt_regulators); | ||
| 463 | } else { | ||
| 464 | regulators = act8865_regulators; | ||
| 465 | num_regulators = ARRAY_SIZE(act8865_regulators); | ||
| 466 | } | ||
| 447 | off_reg = ACT8865_SYS_CTRL; | 467 | off_reg = ACT8865_SYS_CTRL; |
| 448 | off_mask = ACT8865_MSTROFF; | 468 | off_mask = ACT8865_MSTROFF; |
| 449 | break; | 469 | break; |
