Commit Graph

1264 Commits

Author SHA1 Message Date
Mark Brown
e6120461e5 Merge remote-tracking branch 'regulator/topic/palmas' into regulator-next 2012-12-10 12:43:17 +09:00
Mark Brown
adca48f7c6 Merge remote-tracking branch 'regulator/topic/min' into regulator-next 2012-12-10 12:43:00 +09:00
Mark Brown
9e21867073 Merge remote-tracking branch 'regulator/topic/max8997' into regulator-next 2012-12-10 12:43:00 +09:00
Mark Brown
f675649e70 Merge remote-tracking branch 'regulator/topic/max8973' into regulator-next 2012-12-10 12:42:59 +09:00
Mark Brown
9199addf4f Merge remote-tracking branch 'regulator/topic/max77686' into regulator-next 2012-12-10 12:42:58 +09:00
Mark Brown
0d2cff8b67 Merge remote-tracking branch 'regulator/topic/max1586' into regulator-next 2012-12-10 12:42:58 +09:00
Mark Brown
a8bfb69e77 Merge remote-tracking branch 'regulator/topic/lp8788' into regulator-next 2012-12-10 12:42:57 +09:00
Mark Brown
bdb7e45507 Merge remote-tracking branch 'regulator/topic/log' into regulator-next 2012-12-10 12:42:56 +09:00
Mark Brown
1f9cc5f771 Merge remote-tracking branch 'regulator/topic/hotplug' into regulator-next 2012-12-10 12:42:55 +09:00
Mark Brown
207f30894a Merge remote-tracking branch 'regulator/topic/gpio' into regulator-next 2012-12-10 12:42:54 +09:00
Mark Brown
db58e0270c Merge remote-tracking branch 'regulator/topic/da9055' into regulator-next 2012-12-10 12:42:53 +09:00
Mark Brown
4e62cce2b6 Merge remote-tracking branch 'regulator/topic/da9052' into regulator-next 2012-12-10 12:42:53 +09:00
Mark Brown
6234427eb8 Merge remote-tracking branch 'regulator/topic/change' into regulator-next 2012-12-10 12:42:52 +09:00
Mark Brown
b0e5997ef4 Merge remote-tracking branch 'regulator/topic/as3711' into regulator-next 2012-12-10 12:42:51 +09:00
Mark Brown
7cac646816 Merge remote-tracking branch 'regulator/topic/arizona' into regulator-next 2012-12-10 12:42:51 +09:00
Axel Lin
e1b0144f99 regulator: anatop: Use regulator_[get|set]_voltage_sel_regmap
Call regulator_[get|set]_voltage_sel_regmap instead of open code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Ying-Chun Liu <paulliu@debian.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10 12:38:59 +09:00
Axel Lin
985884db50 regulator: anatop: Use linear_min_sel with linear mapping
By setting linear_min_sel to anatop_reg->min_bit_val, we can avoid
adjust the anatop_reg->min_bit_val offset in [set|get]_voltage_sel.

With this chance we can refactor this driver to use
regulator_[get|set]_voltage_sel_regmap.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Ying-Chun Liu <paulliu@debian.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10 12:38:09 +09:00
Axel Lin
4efd9dfecb regulator: max1586: Implement get_voltage_sel callback
This is required since commit f7df20ec32
"regulator: core: Use list_voltage() to read single voltage regulators",
otherwise _regulator_get_voltage returns rdev->desc->ops->list_voltage(rdev, 0).

The Maxim 1586 controls V3 and V6 voltages, but offers no way of reading back
the set up value. Thus this patch caches the setting when setting new voltage.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10 12:23:56 +09:00
Axel Lin
131a5b9d82 regulator: lp8788-buck: Kill _gpio_request function
Simply use devm_gpio_request_one() instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-10 12:18:43 +09:00
Axel Lin
40b5aa8f0d regulator: lp8788-ldo: Remove val array in lp8788_config_ldo_enable_mode
To clear the mask bit, setting data argument to be 0 with proper mask setting
for lp8788_update_bits. We don't need the var array here.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-07 14:24:13 +09:00
Axel Lin
ec4f7b88b4 regulator: gpio-regulator: Add ifdef CONFIG_OF guard for regulator_gpio_of_match
Use of_match_ptr and add ifdef CONFIG_OF guard for regulator_gpio_of_match.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-06 15:22:52 +09:00
Axel Lin
bdc4baaceb regulator: palmas: Convert palmas_ops_smps to regulator_[get|set]_voltage_sel_regmap
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-06 15:20:53 +09:00
Axel Lin
ad02e84687 regulator: palmas: Return raw register values as the selectors in [get|set]_voltage_sel
Don't adjust the selector in [get|set]_voltage_sel, fix it in list_voltage() instead.

For smps*(except smps10), the vsel reg-value and voltage mapping as below:

reg-value       volt (uV) ( Assume RANGE is x1 )
0               0
1               500000
2               500000
3               500000
4               500000
5               500000
6               500000 (0.49V + 1 * 0.01V) * RANGE
7               510000 (0.49V + 2 * 0.01V) * RANGE
8               520000 (0.49V + 3 * 0.01V) * RANGE
9               530000 (0.49V + 4 * 0.01V) * RANGE
....

The linear mapping is start from selector 6.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-06 15:20:52 +09:00
Marek Szyprowski
d1e7de3007 regulators: add regulator_can_change_voltage() function
Introduce a regulator_can_change_voltage() function for the subsytems or
drivers which might check if applying voltage change is possible and use
special workaround code when the driver is used with fixed regulators or
regulators with disabled ability to change the voltage.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-06 15:13:34 +09:00
Mark Brown
5d6e6ffc40 Merge branch 'topic/tps51632' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-min
Conflicts:
	drivers/regulator/tps51632-regulator.c
2012-11-28 19:24:48 +00:00
Axel Lin
bd0ec7c1e5 regulator: tps51632: Use linear_min_sel and regulator_[map|list]_voltage_linear
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-28 19:21:32 +00:00
Axel Lin
05cf34c1af regulator: pcf50633: Use linear_min_sel and regulator_[map|list]_voltage_linear
This driver can be converted to use linear_min_sel and
regulator_[map|list]_voltage_linear.

Below shows the equation (from Datasheet) for each LDOs.

For AUTOOUT:
        VO(prog) = 0.625 + auto_out x 0.025 V; e.g.
        (00000000 to 00101110: reserved)
        00101111: 1.8 V (min)
        01010011: 2.7 V
        01101010: 3.275 V
        01101011: 3.300 V
        01101100: 3.325 V
        01111111 : 3.800 V (max)

        The linear mapping start from 0x2f selector.

        Thus we convert this equation to:
        VO(prog) = 1.8 + (selector - linear_min_sel) x 0.025 V
        (min_uV = 1800000, uV_step = 25000, linear_min_sel = 0x2f)

For DOWNxOUT:
        VO(prog) = 0.625 + downx_out x 0.025 V; e.g.
        00000000 : 0.625 V (min)
        00010111 : 1.200 V
        00101111 : 1.800 V
        01011111 : 3.000 V (max)

For xLDOOUT:
        VO(prog) = 0.9 + xldo_out x 0.1 V; e.g.
        00000: 0.9 V
        00001: 1.0 V
        11000 : 3.3 V
        11011 : 3.6 V

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-28 19:21:00 +00:00
Mark Brown
9507281855 regulator: arizona-micsupp: Add ramp time information
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-28 17:48:01 +00:00
Mark Brown
fff15bef48 regulator: core: Say what unsupportable voltage constraints are
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-28 17:47:35 +00:00
Mark Brown
dd8004af2b regulator: core: Log when a device causes a voltage constraint fail
Helps with figuring out when things went wrong.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-28 17:47:18 +00:00
Mark Brown
73ee29460e regulator: arizona-ldo1: Support 1.8V mode
Some Arizona device support a 1.8V output mode. Enable this in the driver.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-28 17:30:36 +00:00
Mark Brown
8a7f0c61c0 regulator: arizona-ldo1: Add additional top voltage
The number of voltage slots supported by the LDO is 7, not 6.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-28 17:30:33 +00:00
Mark Brown
55a18aef2e regulator: arizona-ldo1: Support DVFS in default constraints
Some Arizona devices such as the WM5102 can use DVFS on their digital core,
for these devices allow the voltage range to vary in the default setup.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-28 17:30:07 +00:00
Mark Brown
86a1450118 regulator: arizona-ldo1: Add enable time
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-28 17:30:05 +00:00
Axel Lin
7a4beda0c6 regulator: as3711: Fix the logic in as3711_sel_check
Below equation means the "voltage" is the "smallest" voltage within specific
range.

ret = DIV_ROUND_UP(min - bottom) / step;
voltage = ret * step + bottom;

If we do try 1 down when (voltage > max), new voltage is then less than min
voltage. Which means the new voltage is not in the requested voltage range.

This patch also includes below cleanups:
- Use DIV_ROUND_UP
- rename variable 'ret' to 'sel' for better readability because as3711_sel_check
  returns the selector.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:25:18 +00:00
Axel Lin
16ed9f0701 regulator: as3711: Fix valid min_uV/max_UV checking in as3711_bound_check
Below cases are supposed to be valid:

min_uV == max_uV == info->max_uV
min_uV == max_uV == rdev->desc->min_uV

Don't return -EINVAL for above cases.

This patch also includes below cleanups:
- Use rdev_get_drvdata(rdev) instead of rdev->reg_data.
- Remove unnecessary WARN_ON, it looks pointless.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:25:13 +00:00
Axel Lin
1e369bcd03 regulator: da9052: Ensure setting current limit within specific range
Checking da9052_current_limits[row][i] <= max_uA is not enough, it is possible
da9052_current_limits[row][i] may less than the requested min_uA.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:22:53 +00:00
Axel Lin
f509fd46c1 regulator: da9055: Select maximum current in specific range for set_current_limit
Selecting the minimal value is only true for voltage regulators.
For current regulators the maximum in the given range should be
selected instead.

This issue was reported by Heiko Stuebner for gpio-regulator driver [1],
and the conclusion is to select the max current for current regulators [2].

[1] https://lkml.org/lkml/2012/8/5/162
[2] https://lkml.org/lkml/2012/8/6/183

This patch also ensures da9055_buck_set_current_limit return -EINVAL when the
supported current limit does not meet the request range.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:21:26 +00:00
Axel Lin
9997f3ffbb regulator: tps51632: Fix writing to wrong register when enable_pwm_dvfs is set
When tps->enable_pwm_dvfs is true, write to TPS51632_VOLTAGE_BASE_REG rather
than TPS51632_VOLTAGE_SELECT_REG.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:17:01 +00:00
Axel Lin
6b1f8a4566 regulator: da9055: Use linear_min_sel and regulator_[map|list]_voltage_linear
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:11:19 +00:00
Mark Brown
5979b2a35f Merge branches 'topic/da9055' and 'topic/tps51632' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-min 2012-11-27 20:08:14 +00:00
Axel Lin
9119ff6af5 regulator: palmas: Use linear_min_sel and regulator_[map|list]_voltage_linear
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:07:40 +00:00
Axel Lin
33234e791d regulator: core: Allow specific minimal selector for starting linear mapping
Some drivers (at least 3 drivers) have such variant of linear mapping that
the first few selectors are invalid and the reset are linear mapping.
Let's support this case in core.

This patch adds linear_min_sel in struct regulator_desc,
so we can allow specific minimal selector for starting linear mapping.
Then extends regulator_[map|list]_voltage_linear() to support this feature.

Note that for selectors less than min_linear_index, we need count them to
n_voltages so regulator_list_voltage() won't fail while checking the boundary
for selector before calling list_voltage callback.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:07:40 +00:00
Mark Brown
b87d07b13c Merge branch 'topic/hotplug' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-max8997
Conflicts:
	drivers/regulator/max8997.c
2012-11-27 20:06:08 +00:00
Thomas Abraham
77b71b370e regulator: add device tree support for max8997
Add device tree based discovery support for max8997.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27 20:05:36 +00:00
Thomas Abraham
068a8c8239 regulator: max8997: limit the number of dvs registers programmed in non-dvs mode
In case the gpio based volatage selection mode is not used for either of
buck 1/2/5, then only the BUCKxDVS1 register need to be programmed. So
determine whether dvs mode is used and limit the loop count appropriately.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-24 18:57:04 +01:00
Thomas Abraham
11ec7bf001 regulator: max8997: reorder buck1/2/5 dvs setup code
The BUCKxDVSx register programming is now moved prior to setting up of the
gpio based dvs mode. This will ensure that all the BUCKxDVSx registers
are programmed with appropriate voltage values before the gpio based dvs
mode is selected for buck1/2/5.

Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Reviewed-by: Tomasz Figa <t.figa@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-24 18:56:32 +01:00
Laxman Dewangan
56968658ff regulator: max8973: provide enable/disable if external control disabled
If external control is enabled then do not provide regulator
enable/disable apis.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-23 21:16:35 +09:00
Guennadi Liakhovetski
f1e64f9026 regulator: add a regulator driver for the AS3711 PMIC
This driver supports the 4 DCDC and 8 LDO regulators on the AS3711 PMIC.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-23 21:14:40 +09:00
Axel Lin
e05f70c268 regulator: max8973: Fix callback setting for max8973_dcdc_ops.enable
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-22 11:07:10 +09:00