diff options
author | Andrew Bresticker <abrestic@chromium.org> | 2013-12-26 22:48:46 +0100 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-01-06 19:09:36 +0100 |
commit | 762a8ee808972354ce4bca988309aa7fb63ed5ae (patch) | |
tree | 19fed2a02e18080a06aef61eae22131e3c494f1f /drivers/regulator/as3722-regulator.c | |
parent | regulator: as3722: Don't set min_uV/uV_step/linear_min_sel for linear_ranges (diff) | |
download | linux-762a8ee808972354ce4bca988309aa7fb63ed5ae.tar.xz linux-762a8ee808972354ce4bca988309aa7fb63ed5ae.zip |
regulator: as3722: detect SD0 low-voltage mode
SD0 may operate in low-voltage mode, with a minimum of 0.41V
and a maximum of 1.5V. This is indicated by bit 4 of FUSE7.
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Signed-off-by: Vince Hsu <vinceh@nvidia.com>
broonie.e6264@m.evernote.com
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/regulator/as3722-regulator.c')
-rw-r--r-- | drivers/regulator/as3722-regulator.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index fdb31371a232..3d7fbc21181d 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c @@ -99,7 +99,6 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD0_EXT_ENABLE_MASK, .control_reg = AS3722_SD0_CONTROL_REG, .mode_mask = AS3722_SD0_MODE_FAST, - .n_voltages = AS3722_SD0_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD1, @@ -112,7 +111,6 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD1_EXT_ENABLE_MASK, .control_reg = AS3722_SD1_CONTROL_REG, .mode_mask = AS3722_SD1_MODE_FAST, - .n_voltages = AS3722_SD0_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD2, @@ -181,7 +179,6 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD6_EXT_ENABLE_MASK, .control_reg = AS3722_SD6_CONTROL_REG, .mode_mask = AS3722_SD6_MODE_FAST, - .n_voltages = AS3722_SD0_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_LDO0, @@ -595,6 +592,22 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev, return as3722_update_bits(as3722, reg, mask, val); } +static bool as3722_sd0_is_low_voltage(struct as3722_regulators *as3722_regs) +{ + int err; + unsigned val; + + err = as3722_read(as3722_regs->as3722, AS3722_FUSE7_REG, &val); + if (err < 0) { + dev_err(as3722_regs->dev, "Reg 0x%02x read failed: %d\n", + AS3722_FUSE7_REG, err); + return false; + } + if (val & AS3722_FUSE7_SD0_LOW_VOLTAGE) + return true; + return false; +} + static const struct regulator_linear_range as3722_sd2345_ranges[] = { REGULATOR_LINEAR_RANGE(612500, 0x01, 0x40, 12500), REGULATOR_LINEAR_RANGE(1425000, 0x41, 0x70, 25000), @@ -820,7 +833,16 @@ static int as3722_regulator_probe(struct platform_device *pdev) ops = &as3722_sd016_extcntrl_ops; else ops = &as3722_sd016_ops; - as3722_regs->desc[id].min_uV = 610000; + if (id == AS3722_REGULATOR_ID_SD0 && + as3722_sd0_is_low_voltage(as3722_regs)) { + as3722_regs->desc[id].n_voltages = + AS3722_SD0_VSEL_LOW_VOL_MAX + 1; + as3722_regs->desc[id].min_uV = 410000; + } else { + as3722_regs->desc[id].n_voltages = + AS3722_SD0_VSEL_MAX + 1, + as3722_regs->desc[id].min_uV = 610000; + } as3722_regs->desc[id].uV_step = 10000; as3722_regs->desc[id].linear_min_sel = 1; break; |