diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-11 07:44:17 -0500 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-12-11 07:44:17 -0500 |
| commit | b17fc86cc5e8fbfd1d18765f6463d1989c59f9c6 (patch) | |
| tree | 8e0b967c8b63ecf085b762d9c9b1015f063e5759 | |
| parent | d1e7de3007c6e34c5e6d5e1b707b5aba4a1cd57f (diff) | |
| parent | e1b0144f9997d3d52c46785143699d82dd525f1d (diff) | |
Merge branch 'topic/min' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-change
| -rw-r--r-- | drivers/regulator/Kconfig | 21 | ||||
| -rw-r--r-- | drivers/regulator/Makefile | 2 | ||||
| -rw-r--r-- | drivers/regulator/anatop-regulator.c | 28 | ||||
| -rw-r--r-- | drivers/regulator/core.c | 6 | ||||
| -rw-r--r-- | drivers/regulator/da9055-regulator.c | 644 | ||||
| -rw-r--r-- | drivers/regulator/palmas-regulator.c | 37 | ||||
| -rw-r--r-- | drivers/regulator/pcf50633-regulator.c | 176 | ||||
| -rw-r--r-- | drivers/regulator/tps51632-regulator.c | 327 | ||||
| -rw-r--r-- | include/linux/mfd/da9055/pdata.h | 27 | ||||
| -rw-r--r-- | include/linux/regulator/driver.h | 2 | ||||
| -rw-r--r-- | include/linux/regulator/tps51632-regulator.h | 47 |
11 files changed, 1115 insertions, 202 deletions
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 67d47b59a66d..10b1edc89621 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
| @@ -109,6 +109,16 @@ config REGULATOR_DA9052 | |||
| 109 | This driver supports the voltage regulators of DA9052-BC and | 109 | This driver supports the voltage regulators of DA9052-BC and |
| 110 | DA9053-AA/Bx PMIC. | 110 | DA9053-AA/Bx PMIC. |
| 111 | 111 | ||
| 112 | config REGULATOR_DA9055 | ||
| 113 | tristate "Dialog Semiconductor DA9055 regulators" | ||
| 114 | depends on MFD_DA9055 | ||
| 115 | help | ||
| 116 | Say y here to support the BUCKs and LDOs regulators found on | ||
| 117 | Dialog Semiconductor DA9055 PMIC. | ||
| 118 | |||
| 119 | This driver can also be built as a module. If so, the module | ||
| 120 | will be called da9055-regulator. | ||
| 121 | |||
| 112 | config REGULATOR_FAN53555 | 122 | config REGULATOR_FAN53555 |
| 113 | tristate "Fairchild FAN53555 Regulator" | 123 | tristate "Fairchild FAN53555 Regulator" |
| 114 | depends on I2C | 124 | depends on I2C |
| @@ -335,6 +345,17 @@ config REGULATOR_PALMAS | |||
| 335 | on the muxing. This is handled automatically in the driver by | 345 | on the muxing. This is handled automatically in the driver by |
| 336 | reading the mux info from OTP. | 346 | reading the mux info from OTP. |
| 337 | 347 | ||
| 348 | config REGULATOR_TPS51632 | ||
| 349 | tristate "TI TPS51632 Power Regulator" | ||
| 350 | depends on I2C | ||
| 351 | select REGMAP_I2C | ||
| 352 | help | ||
| 353 | This driver supports TPS51632 voltage regulator chip. | ||
| 354 | The TPS51632 is 3-2-1 Phase D-Cap+ Step Down Driverless Controller | ||
| 355 | with Serial VID control and DVFS. | ||
| 356 | The voltage output can be configure through I2C interface or PWM | ||
| 357 | interface. | ||
| 358 | |||
| 338 | config REGULATOR_TPS6105X | 359 | config REGULATOR_TPS6105X |
| 339 | tristate "TI TPS6105X Power regulators" | 360 | tristate "TI TPS6105X Power regulators" |
| 340 | depends on TPS6105X | 361 | depends on TPS6105X |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index e431eed8a878..bdaca617e2f2 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
| @@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o | |||
| 18 | obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o | 18 | obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o |
| 19 | obj-$(CONFIG_REGULATOR_DA903X) += da903x.o | 19 | obj-$(CONFIG_REGULATOR_DA903X) += da903x.o |
| 20 | obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o | 20 | obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o |
| 21 | obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o | ||
| 21 | obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o | 22 | obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o |
| 22 | obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o | 23 | obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o |
| 23 | obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o | 24 | obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o |
| @@ -41,6 +42,7 @@ obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o | |||
| 41 | obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o | 42 | obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o |
| 42 | obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o | 43 | obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o |
| 43 | obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o | 44 | obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o |
| 45 | obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o | ||
| 44 | obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o | 46 | obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o |
| 45 | obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o | 47 | obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o |
| 46 | obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o | 48 | obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o |
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 1af97686f444..b6182e17b0dc 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
| @@ -48,36 +48,21 @@ static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg, | |||
| 48 | unsigned selector) | 48 | unsigned selector) |
| 49 | { | 49 | { |
| 50 | struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); | 50 | struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); |
| 51 | u32 val, mask; | ||
| 52 | 51 | ||
| 53 | if (!anatop_reg->control_reg) | 52 | if (!anatop_reg->control_reg) |
| 54 | return -ENOTSUPP; | 53 | return -ENOTSUPP; |
| 55 | 54 | ||
| 56 | val = anatop_reg->min_bit_val + selector; | 55 | return regulator_set_voltage_sel_regmap(reg, selector); |
| 57 | dev_dbg(®->dev, "%s: calculated val %d\n", __func__, val); | ||
| 58 | mask = ((1 << anatop_reg->vol_bit_width) - 1) << | ||
| 59 | anatop_reg->vol_bit_shift; | ||
| 60 | val <<= anatop_reg->vol_bit_shift; | ||
| 61 | regmap_update_bits(anatop_reg->anatop, anatop_reg->control_reg, | ||
| 62 | mask, val); | ||
| 63 | |||
| 64 | return 0; | ||
| 65 | } | 56 | } |
| 66 | 57 | ||
| 67 | static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg) | 58 | static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg) |
| 68 | { | 59 | { |
| 69 | struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); | 60 | struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); |
| 70 | u32 val, mask; | ||
| 71 | 61 | ||
| 72 | if (!anatop_reg->control_reg) | 62 | if (!anatop_reg->control_reg) |
| 73 | return -ENOTSUPP; | 63 | return -ENOTSUPP; |
| 74 | 64 | ||
| 75 | regmap_read(anatop_reg->anatop, anatop_reg->control_reg, &val); | 65 | return regulator_get_voltage_sel_regmap(reg); |
| 76 | mask = ((1 << anatop_reg->vol_bit_width) - 1) << | ||
| 77 | anatop_reg->vol_bit_shift; | ||
| 78 | val = (val & mask) >> anatop_reg->vol_bit_shift; | ||
| 79 | |||
| 80 | return val - anatop_reg->min_bit_val; | ||
| 81 | } | 66 | } |
| 82 | 67 | ||
| 83 | static struct regulator_ops anatop_rops = { | 68 | static struct regulator_ops anatop_rops = { |
| @@ -158,15 +143,20 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev) | |||
| 158 | goto anatop_probe_end; | 143 | goto anatop_probe_end; |
| 159 | } | 144 | } |
| 160 | 145 | ||
| 161 | rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) | 146 | rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) / 25000 + 1 |
| 162 | / 25000 + 1; | 147 | + sreg->min_bit_val; |
| 163 | rdesc->min_uV = sreg->min_voltage; | 148 | rdesc->min_uV = sreg->min_voltage; |
| 164 | rdesc->uV_step = 25000; | 149 | rdesc->uV_step = 25000; |
| 150 | rdesc->linear_min_sel = sreg->min_bit_val; | ||
| 151 | rdesc->vsel_reg = sreg->control_reg; | ||
| 152 | rdesc->vsel_mask = ((1 << sreg->vol_bit_width) - 1) << | ||
| 153 | sreg->vol_bit_shift; | ||
| 165 | 154 | ||
| 166 | config.dev = &pdev->dev; | 155 | config.dev = &pdev->dev; |
| 167 | config.init_data = initdata; | 156 | config.init_data = initdata; |
| 168 | config.driver_data = sreg; | 157 | config.driver_data = sreg; |
| 169 | config.of_node = pdev->dev.of_node; | 158 | config.of_node = pdev->dev.of_node; |
| 159 | config.regmap = sreg->anatop; | ||
| 170 | 160 | ||
| 171 | /* register regulator */ | 161 | /* register regulator */ |
| 172 | rdev = regulator_register(rdesc, &config); | 162 | rdev = regulator_register(rdesc, &config); |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 59e08633372a..1c8ff8ce5c57 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
| @@ -1919,6 +1919,10 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev, | |||
| 1919 | { | 1919 | { |
| 1920 | if (selector >= rdev->desc->n_voltages) | 1920 | if (selector >= rdev->desc->n_voltages) |
| 1921 | return -EINVAL; | 1921 | return -EINVAL; |
| 1922 | if (selector < rdev->desc->linear_min_sel) | ||
| 1923 | return 0; | ||
| 1924 | |||
| 1925 | selector -= rdev->desc->linear_min_sel; | ||
| 1922 | 1926 | ||
| 1923 | return rdev->desc->min_uV + (rdev->desc->uV_step * selector); | 1927 | return rdev->desc->min_uV + (rdev->desc->uV_step * selector); |
| 1924 | } | 1928 | } |
| @@ -2142,6 +2146,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev, | |||
| 2142 | if (ret < 0) | 2146 | if (ret < 0) |
| 2143 | return ret; | 2147 | return ret; |
| 2144 | 2148 | ||
| 2149 | ret += rdev->desc->linear_min_sel; | ||
| 2150 | |||
| 2145 | /* Map back into a voltage to verify we're still in bounds */ | 2151 | /* Map back into a voltage to verify we're still in bounds */ |
| 2146 | voltage = rdev->desc->ops->list_voltage(rdev, ret); | 2152 | voltage = rdev->desc->ops->list_voltage(rdev, ret); |
| 2147 | if (voltage < min_uV || voltage > max_uV) | 2153 | if (voltage < min_uV || voltage > max_uV) |
