summaryrefslogtreecommitdiff
path: root/drivers/regulator
AgeCommit message (Collapse)Author
2012-07-08mfd: Register db8500-prcmu devices using the newly DT:ed MFD APILee Jones
Now the MFD API is Device Tree aware we can use it for platform registration again, even when booting with DT enabled. To aid in Device Node pointer allocation we provide each cell with the associative compatible string. Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-07-06regulator: max77686: Initialise rmatch.of_node to NULL.Yadwinder Singh Brar
Now of_regulator_match() returns without finding the match if match->of_node is not NULL. Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-06regulator: tps65910: add support for input supplyLaxman Dewangan
There is multiple voltage input pins on device which takes the voltage input for different voltage regulator. Support to configure the voltage input supplied by different regulator for each regulators. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-06regulator: core: Mark all DT based boards as having full constraintsMark Brown
Since DT doesn't provide an idiomatic mechanism for enabling full constraints and since it's much more natural with DT to provide them just assume that a DT enabled system has full constraints. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-07-05regulator: fixed: dt: support for input supplyLaxman Dewangan
Add support for input supply in DT parsing of node. The input supply will be provided by the property "vin-supply" in the regulator node. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-05regulator: max77686: Add device tree support.Yadwinder Singh Brar
This patch device tree support for regulator driver. It uses the parent (mfd's) DT node to parse the regulator data for max77686. Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-05regulator: ab3100: Use rdev_get_drvdata() rather than use reg->reg_data driectlyAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-05regulator: ab3100: Set enable enable_time in regulator_descAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-05regulator: core: remove sysfs entry properly in regulator_putShawn Guo
With changes introduced by commit 222cc7b (regulator: core: Allow multiple requests of a single supply mapping) on create_regulator, regulator_put needs a corresponding update on sysfs entry removing. Also regulator->dev still needs to get assigned in create_regulator, otherwise, sysfs_remove_link call in regulator_put will get bypassed. Reported-by: Fabio Estevam <festevam@gmail.com> Tested-by: Dong Aisheng <dong.aisheng@linaro.org> Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-04regulator: arizona-micsupp: Force regulated mode until we have API supportMark Brown
It's almost certainly what the user would expect. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-04regulator: ad5398: Fix min/max current limit boundary checkingAxel Lin
It is ok to request current limit with min_uA < chip->min_uA and max_uA > chip->max_uA. We need to set min_uA = chip->min_uA if (min_uA < chip->min_uA), this ensures the equation to calcuate selator does not return negative number. Also set max_uA = chip->max_uA if (max_uA > chip->max_uA), as suggested by Sonic. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-04regulator: twl: Set enable enable_time in regulator_descAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-04regulator: gpio-regulator: Use core GPIO enable supportAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-04regulator: gpio-regulator: Set enable enable_time in regulator_descAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-04regulator: tps65910: Set enable enable_time in regulator_descAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: arizona-ldo1: Implement GPIO enable supportMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: wm8994: Use core GPIO enable supportMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: fixed: Use core GPIO enable supportMark Brown
This is essentially the code that was factored out into the core when the feature was implemented. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: core: Add core support for GPIO controlled enable linesMark Brown
It is very common for regulators to support having their enable signal controlled by a GPIO. Since there are a bunch of fiddly things to get right like handling the operations when the enable signal is tied to a rail and it's just replicated code add support for this to the core. Drivers should set ena_gpio in their config if they have a GPIO control, using ena_gpio_flags to specify any flags (including GPIOF_OUT_INIT_ for the initial state) and ena_gpio_invert if the GPIO is active low. The core will then override any enable and disable operations the driver has and instead control the specified GPIO. This will in the future also allow us to further extend the core by identifying when several enable signals have been tied together and handling this properly. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: core: Factor out enable and disable operations some moreMark Brown
Create new _regulator_do_enable() and _regulator_do_disable() operations which deal with the mechanics of performing the enable and disable, partly to cut down on the levels of indentation and partly to support some future work. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: wm831x-ldo: Specify enable time for alive LDOMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: wm8994: Set enable_time in descriptorMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: fixed: Set enable enable_time in regulator_descMark Brown
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: core: Allow fixed enable_time to be set in the regulator_descMark Brown
Many regulators have a fixed specification for their enable time. Allow this to be set in the regulator_desc as a number to save them having to implement an explicit operation. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: core: Check that the selector from map_voltage() is validMark Brown
Lots of regulator drivers have checks in their map_voltage() functions to verify that the result of the mapping is in the range originally specified. Factor these out in the core and provide a bit of extra defensiveness for other drivers by doing the check in the core. Since we're now doing a list_voltage() earlier move the current mapping back to a voltage out into the set_voltage() call to save redoing it. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: core: Support fixed voltages in regulator_is_supported_voltage()Mark Brown
Currently regulator_is_supported_voltage() works by enumerating the set of voltages which can be set by the regulator but the checks we're doing to impose constraints mean that if we can't vary the voltage we'll not report any voltages as supported even though the regulator is actually set at that voltage. We could fix the voltage listing but this would mean that list_voltage() could end up going to the hardware to get the current voltage which isn't expected (it's supposed to be very cheap) so instead special case things when we can't change the voltage and compare the requested range against the current voltage. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: Fix recursive mutex lockdep warningStephen Boyd
A recursive lockdep warning occurs if you call regulator_set_optimum_mode() on a regulator with a supply because there is no nesting annotation for the rdev->mutex. To avoid this warning, get the supply's load before locking the regulator's mutex to avoid grabbing the same class of lock twice. ============================================= [ INFO: possible recursive locking detected ] 3.4.0 #3257 Tainted: G W --------------------------------------------- swapper/0/1 is trying to acquire lock: (&rdev->mutex){+.+.+.}, at: [<c036e9e0>] regulator_get_voltage+0x18/0x38 but task is already holding lock: (&rdev->mutex){+.+.+.}, at: [<c036ef38>] regulator_set_optimum_mode+0x24/0x224 other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&rdev->mutex); lock(&rdev->mutex); *** DEADLOCK *** May be due to missing lock nesting notation 3 locks held by swapper/0/1: #0: (&__lockdep_no_validate__){......}, at: [<c03dbb48>] __driver_attach+0x40/0x8c #1: (&__lockdep_no_validate__){......}, at: [<c03dbb58>] __driver_attach+0x50/0x8c #2: (&rdev->mutex){+.+.+.}, at: [<c036ef38>] regulator_set_optimum_mode+0x24/0x224 stack backtrace: [<c001521c>] (unwind_backtrace+0x0/0x12c) from [<c00cc4d4>] (validate_chain+0x760/0x1080) [<c00cc4d4>] (validate_chain+0x760/0x1080) from [<c00cd744>] (__lock_acquire+0x950/0xa10) [<c00cd744>] (__lock_acquire+0x950/0xa10) from [<c00cd990>] (lock_acquire+0x18c/0x1e8) [<c00cd990>] (lock_acquire+0x18c/0x1e8) from [<c080c248>] (mutex_lock_nested+0x68/0x3c4) [<c080c248>] (mutex_lock_nested+0x68/0x3c4) from [<c036e9e0>] (regulator_get_voltage+0x18/0x38) [<c036e9e0>] (regulator_get_voltage+0x18/0x38) from [<c036efb8>] (regulator_set_optimum_mode+0xa4/0x224) ... Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: dt: regulator match by regulator-compatibleLaxman Dewangan
Match the device's regulators with the property of "regulator-compatible" of each regulator node. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Stephen Warren <swarren@wwwdotorg.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-03regulator: tps65217: Fix voltage boundary checking in tps65217_pmic_map_voltageAxel Lin
It is ok to request voltage with min_uV < tps->info[rid]->min_uV and max_uV > tps->info[rid]->max_uV. The equation we used in uv_to_vsel() does not allow min_uV < tps->info[rid]->min_uV, otherwise it returns negative selector. So we need to set min_uV = tps->info[rid]->min_uV if min_uV < tps->info[rid]->min_uV. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: AnilKumar Ch <anilkumar@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-02regulator: tps62360: Convert to regulator_set_voltage_time_sel()Axel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-02regulator: tps65217: invalid if checkAlan Cox
This permits the setting of bogus values because the invalidity check is itself invalid. Reported-by: dcb314@hotmail.com Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-02regulator: tps6524x: Convert fixed ilimsel to table basedAxel Lin
This patch refactors the code to get rid of the fixed_ilimsel and FIXED_ILIMSEL flag usage, and convert all the fixed ilimsel to table based (with one entry in the table). We can differentiate fixed ilimsel by checking info->n_ilimsels == 1, thus FIXED_ILIMSEL flag can be removed. This change makes the logic of the code simpler as all the ilimsels are table based now. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-02regulator: tps6524x: Convert to regulator_list_voltage_table()Axel Lin
This patch adds fixed_5000000_voltage table for fixed voltage, so we can convert regulator_ops to regulator_list_voltage_table. We can differentiate fixed voltage by checking rdev->desc->n_voltages == 1, thus remove the FIXED_VOLTAGE flag usage. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-02Merge tag 'v3.5-rc5' into regulator-driversMark Brown
Linux 3.5-rc5 collides with further development. Conflicts: drivers/regulator/tps65023-regulator.c
2012-07-01regulator: fixed: support deferred probe for DT GPIOsStephen Warren
of_get_named_gpio() needs the driver hosting the GPIO that the DT property references to have been probed. Detect this specific failure, and defer the probe of the whole regulator until this API can complete. Signed-off-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-01regulator: tps65217: Convert LDO1 to use regulator_list_voltage_tableAxel Lin
Convert tps65217_pmic_ldo1_ops to use regulator_list_voltage_table. We have n_voltages and volt_table settings in regulator_desc, so we don't need the table and table_len fields in struct tps_info. Thus remove them from struct tps_info. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-27regulator: core: Remove unused get_device_regulatorFabio Estevam
commit 222cc7b1 (regulator: core: Allow multiple requests of a single supply mapping) removed the usage of get_device_regulator(). Remove the function definition too amd get rid of the following warning: drivers/regulator/core.c:112:26: warning: 'get_device_regulator' defined but not used [-Wunused-function] Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-26regulator: core: Allow multiple requests of a single supply mappingMark Brown
Sometimes it may be useful to allow a device to request a supply multiple times, for example in order to allow framework management of some uses of the supply with some additional driver specific management or in order to allow multiple children of an MFD to work with the supply. Currently this is not possible due to the creation of Solve this by removing the requested_uA entry (we have no current users of this feature anyway) and ignoring errors creating the symlink to the consumer. We should do something nicer than this as this causes sysfs to spew enormous warnings but it allows users to run for now. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2012-06-26regulator: core: Check for failed voltage sets before checking for delayMark Brown
There is no need to consider waiting for the voltage to ramp if we didn't manage to set it and looking at the return value is going to be cheaper than is_enabled(). Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-26regulator: s5m8767: Convert to regulator_list_voltage_linearAxel Lin
In current code, .list_voltage and .set_voltage_sel callbacks for BUCK7 and BUCK8 return -EINVAL. This patch adds s5m8767_buck78_ops for BUCK7 and BUCK8 which does not set .list_voltage, .get_voltage_sel and .set_voltage_sel. ( This has the same effect of returning -EINVAL in the callbacks) Then for all the users of s5m8767_list_voltage, we don't need to worry about the case reg_voltage_map[reg_id] is NULL. So we can convert s5m8767_list_voltage to regulator_list_voltage_linear. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-26regulator: arizona-micsupp: Fix choosing selector in arizona_micsupp_map_voltageAxel Lin
If min_uV is in the range of: 3250001~3269999, current code uses the equation: selector = DIV_ROUND_UP(min_uV - 1700000, 50000); Then selector will be 32. Then arizona_micsupp_list_voltage returns -EINVAL for this case which is wrong. This patch fixes this issue: If min_uV > 3200000, selector should be ARIZONA_MICSUPP_MAX_SELECTOR. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-25regulator: Add driver for Arizona LDO1Mark Brown
Arizona class devices feature an integrated LDO which is intended to supply the digital core for the device. Provide a driver offering minimal control of this regulator. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-25regulator: Modify ramp_delay value for s5m8767aSangbeom Kim
As s5m8767a is revisioned, ramp_delay register is changed. 5mV/uS, 10mV/uS, 25mV/uS, 50mV/uS, 100mV/uS ramp delay can be selected. Signed-off-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-25Merge tag 'v3.5-rc4' into regulator-driversMark Brown
Linux 3.5-rc4 contains patches which conflict with some of the development work.
2012-06-24regulator: rc5t583: Use regulator_set_voltage_time_sel()Axel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-23regulator: Use list_voltage() to get voltage in regulator_set_voltage_time_selAxel Lin
With this change, regulator_set_voltage_time_sel() can be more generic and not limited to linear and table based mapping now. One side-effect of this change is that list_voltage() must be implemented. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-23regulator: max8998: Convert to set_voltage_sel and regulator_map_voltage_linearAxel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-23regulator: max8998: Convert to regulator_list_voltage_linear()Axel Lin
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-23regulator: tps62360: Remove chip_id and voltage_base from struct tps62360_chipAxel Lin
The chip_id is not used. The voltage_base is not necessary, set base voltage to tps->desc.min_uV instead. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-23regulator: palmas: fix regmap offsets for enable/disableGraeme Gregory
I forgot to apply the offsets for the regmap helper functions for enable/disable on SMPS10 and the LDO regulators. This means regulators will not enable/disable correctly. Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk> Tested-by: Sebastien Guiriec <s-guiriec@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>