summaryrefslogtreecommitdiffstats
path: root/drivers/regulator
AgeCommit message (Collapse)AuthorFilesLines
2012-01-06regulator: set constraints.apply_uV to 0 in of_get_fixed_voltage_configRichard Zhao1-0/+1
Fix fixed regulator using DT failed to call regulator_register. of_get_regulator_init_data set apply_uV to 1, but fixed regulator doesn't need it. Set it back to 0. Signed-off-by: Richard Zhao <richard.zhao@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-06regulator: max8925: fix enabled/disabled judgement mistakeKevin Liu1-13/+20
Max8925 ldo status should be determined by two factors: 1. power up/down sequence selection(LDOCTL[4:2]). 2. i2c enable bit(LDOCTL[0]). Max8925 ldo support two types of power up/down sequence: 1. flexible sequence(LDOCTL[4:2] = 0~6). 2. i2c sequence(LDOCTL[4:2] = 7). With flexible sequence selected, the ldo is enabled during power up by default. With i2c sequence selected, the ldo is controlled by the i2c enable bit(LDOCTL[0]). Signed-off-by: Kevin Liu <kliu5@marvell.com> Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-03regulator: add regulator_bulk_force_disable functionDonggeun Kim1-0/+37
This patch allows consumers to forcibly disable multiple regulator clients in a single API call. Signed-off-by: Donggeun Kim <dg77.kim@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-02regulator: pass regulator_register of_node in fixed voltage driverRichard Zhao1-1/+2
regulator_get needs of_node to find right regulator. Signed-off-by: Richard Zhao <richard.zhao@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-02regulator: Enable supply regulator if child rail is enabled.Laxman Dewangan1-0/+8
During regulator_register, the rail is set on the provided machine constraints and if it is enabled then it is also require to enable the supply regulator. This will make sure that: 1. Proper reference count for supply regulator to be maintain. 2. Supply regulator should be enable when given rail is enabled. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-30regulator: mc13892: Convert to devm_kzalloc()Fabio Estevam1-3/+1
Convert mc13892-regulator driver to use devm_kzalloc(). Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-29regulator: mc13783: Convert to devm_kzalloc()Fabio Estevam1-4/+1
Convert mc13783-regulator driver to use devm_kzalloc(). Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-29regulator: Fix checking return value of create_regulatorAxel Lin1-3/+2
create_regulator() returns NULL on fail. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-29regulator: Fix the error handling if create_regulator failsAxel Lin1-0/+1
In the case of create_regulator() fails, goto the error path immediately. It does not make sense to update rdev->open_count if create_regulator fails. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-28regulator: Export regulator_is_supported_voltage()Mark Brown1-0/+1
It's part of the driver interface so should be available to modules. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-22regulator: mc13892: add device tree probe supportShawn Guo3-11/+109
It adds device tree probe support for mc13892-regulator driver. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-22regulator: mc13892: remove the unnecessary prefix from regulator nameShawn Guo1-3/+3
It's not really necessary to add a prefix 'MC13892__' for each mc13892 regulator name, since the chip must have been identified as mc13892 when we look at the regulator name. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-20regulator: Convert wm831x regulator drivers to devm_kzalloc()Mark Brown3-18/+9
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-20regulator: da9052: Staticize non-exported symbolsAxel Lin1-2/+2
da9052_regulator_info and da9053_regulator_info are not used outside this driver so no need to make the symbol global. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-17regulator: Replace kzalloc with devm_kzalloc and if-else with a switch-case ↵Ashish Jangam1-5/+11
for da9052-regulator Reported-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: David Dajun Chen <dchen@diasemi.com> Signed-off-by: Ashish Jangam <ashish.jangam@kpitcummins.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-15regulator: Update da9052-regulator for DT changesMark Brown1-1/+1
Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-15regulator: DA9052/53 Regulator supportAshish Jangam3-0/+608
The Dialog PMIC has below featured regulators:- DA9052-BC - 4 DVS Buck converters 0.5V - 3.6V upto 1Amp. DA9053-AA/BX - 4 DVS Buck converters 0.5V - 2.5V upto 3Amp. DA9052/53 - 10 Programmable LDO's High PSSR, 1% accuracy. This patch support all the DA9052 and Da9053 regulators. The output voltages are fully programmable via I2C or SPI interface. The platform data with regulation constraints is passed down from the board to the regulator. Signed-off-by: David Dajun Chen <dchen@diasemi.com> Signed-off-by: Ashish Jangam <ashish.jangam@kpitcummins.com> Tested-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-05Merge branch 'topic/dt' of ↵Mark Brown2-4/+8
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-next
2011-12-05regulator: pass device_node to of_get_regulator_init_data()Shawn Guo2-4/+5
It's not always true that the device_node of regulator can be found at dev->of_node at the time when of_get_regulator_init_data() is being called, because in some cases the regulator nodes in device tree do not have 'struct device' behind them until regulator_dev gets created for it by core function regulator_register(). The patch adds device_node as a new parameter to of_get_regulator_init_data(), so that caller can pass in the node of regulator directly. Signed-off-by: Shawn Guo <shawn.guo@linaro.org> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-12-05regulator: If a single voltage is set with device tree then set apply_uVMark Brown1-0/+3
Otherwise there is no way in the bindings to configure a fixed voltage via software. It seems reasonable to assume that if the binding explicitly specifies a voltage we want to actually use that voltage. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-30regulator: Allow regulators to register with no init_dataMark Brown1-18/+25
This allows read-only access to the device configuration which may be useful for diagnostics. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2011-11-28Merge remote-tracking branches 'regulator/topic/dt' and ↵Mark Brown1-2/+44
'regulator/for-linus' into regulator-next
2011-11-28regulator: twl: fix twl4030 support for smps regulatorsTero Kristo1-2/+44
SMPS regulator voltage control differs from the one of the LDO ones. Current TWL code was using LDO regulator ops for controlling the SMPS regulators, which fails. This was fixed fixed by adding separate regulator type which uses correct logic and calculations for the voltage levels. Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org
2011-11-28Merge remote-tracking branch 'regulator/for-linus' into regulator-nextMark Brown1-1/+1
2011-11-28regulator: fix use after free bugLothar Waßmann1-1/+1
This is caused by dereferencing 'rdev' after device_unregister() in the regulator_unregister() function. 'rdev' is freed by device_unregister(), so it must not be dereferenced after this call. [Edited commit message for legibility -- broonie] Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28Merge remote-tracking branch 'regulator/for-linus' into regulator-nextMark Brown1-1/+1
2011-11-28regulator: Convert virtual and userspace regulator consumer drivers to use ↵Axel Lin2-23/+2
module_platform_driver() This patch converts virtual and userspace regulator consumer drivers to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28regulator: aat2870: Remove a redundant bitwise and operationAxel Lin1-1/+1
The implementation in aat2870_update() already did the bitwise and operation against mask parameter. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-28regulator: aat2870: Fix the logic of checking if no id is matched in ↵Axel Lin1-1/+1
aat2870_get_regulator In current implementation, the pointer ri is not NULL if no id is matched. Fix it by checking i == ARRAY_SIZE(aat2870_regulators) if no id is matched. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@kernel.org
2011-11-27Merge remote-tracking branch 'regulator/topic/dt' into regulator-nextMark Brown1-1/+6
2011-11-27regulator: Avoid potential NULL dereference in reg_fixed_voltage_probe()Axel Lin1-1/+6
of_get_fixed_voltage_config() may return NULL, return -ENOMEM in this case so we don't dereference NULL pointer. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27Merge remote-tracking branch 'regulator/topic/dt' into regulator-nextMark Brown2-1/+7
2011-11-27regulator: Staticise of_get_fixed_voltage_config()Axel Lin1-1/+2
It is not used outside this driver so no need to make the symbol global. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27regulator: Checking return value of of_get_regulator_init_dataAxel Lin1-0/+3
of_get_regulator_init_data() may return NULL, thus check the return value to avoid NULL pointer dereference. Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-27regulator: export of_get_regulator_init_dataAxel Lin1-0/+2
of_get_regulator_init_data is called in drivers/regulator/fixed.c which could be a module. Export of_get_regulator_init_data to fix below build error: ERROR: "of_get_regulator_init_data" [drivers/regulator/fixed.ko] undefined! make[1]: *** [__modpost] Error 1 make: *** [modules] Error 2 Reported-by: Randy Dunlap <rdunlap@xenotime.net> Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-24Merge remote-tracking branch 'regulator/topic/dt' into regulator-nextMark Brown1-1/+1
2011-11-24regulator: Fix compile break due to missing arguments to regulator_registerRajendra Nayak1-1/+1
The commit 2c043bcbf287 ("regulator: pass additional of_node to regulator_register()") caused a compile break because it missed updating the regulator_register() call in gpio-regulator.c with the additional parameter (NULL). The compile break as reported by Stephen Rothwell with the x86_64 allmodconfig looked like this drivers/regulator/gpio-regulator.c: In function 'gpio_regulator_probe': drivers/regulator/gpio-regulator.c:287:8: error: too few arguments to function 'regulator_register' include/linux/regulator/driver.h:215:23: note: declared here Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23Merge remote-tracking branch 'regulator/topic/dt' into regulator-nextMark Brown41-56/+260
2011-11-23Merge branch 'for-linus' of ↵Mark Brown1-6/+8
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-next
2011-11-23regulator: map consumer regulator based on device treeRajendra Nayak1-12/+67
Device nodes in DT can associate themselves with one or more regulators/supply by providing a list of phandles (to regulator nodes) and corresponding supply names. For Example: devicenode: node@0x0 { ... ... vmmc-supply = <&regulator1>; vpll-supply = <&regulator2>; }; The driver would then do a regulator_get(dev, "vmmc"); to get regulator1 and do a regulator_get(dev, "vpll"); to get regulator2. of_get_regulator() extracts the regulator node for a given device, based on the supply name. Use it to look up the regulator for a given consumer from device tree, during a regulator_get(). If not found fallback and lookup through the regulator_map_list instead. Also, since the regulator dt nodes can use the same binding to associate with a parent regulator/supply, allow the drivers to specify a supply_name, which can then be used to lookup dt to find the parent phandle. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Acked-by: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: pass additional of_node to regulator_register()Rajendra Nayak39-44/+46
With device tree support for regulators, its needed that the regulator_dev->dev device has the right of_node attached. To be able to do this add an additional parameter to the regulator_register() api, wherein the dt-adapted driver can then pass this additional info onto the regulator core. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: adapt fixed regulator driver to dtRajendra Nayak1-0/+65
The fixed regulator driver uses of_get_fixed_voltage_config() to extract fixed_voltage_config structure contents from device tree. Also add documenation for additional bindings for fixed regulators that can be passed through dt. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: helper routine to extract regulator_init_dataRajendra Nayak2-0/+82
The helper routine is meant to be used by the regulator drivers to extract the regulator_init_data structure from the data that is passed from device tree. 'consumer_supplies' which is part of regulator_init_data is not extracted as the regulator consumer mappings are passed through DT differently, implemented in subsequent patches. Similarly the regulator<-->parent/supply mapping is handled in subsequent patches. Also add documentation for regulator bindings to be used to pass regulator_init_data struct information from device tree. Some of the regulator properties which are linux and board specific, are left out since its not clear if they can be in someway embedded into the kernel or passed in from DT. They will be revisited later. Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: TPS65910: Fix VDD1/2 voltage selector countAfzal Mohammed1-6/+8
Count of selector voltage is required for regulator_set_voltage to work via set_voltage_sel. VDD1/2 currently have it as zero, so regulator_set_voltage won't work for VDD1/2. Update count (n_voltages) for VDD1/2. Output Voltage = (step value * 12.5 mV + 562.5 mV) * gain With above expr, number of voltages that can be selected is step value count * gain count constant for gain count will be called VDD1_2_NUM_VOLT_COARSE existing constant for step value count is VDD1_2_NUM_VOLTS, use VDD1_2_NUM_VOLT_FINE instead to make clear that step value is not the only component in deciding selectable voltage count Signed-off-by: Afzal Mohammed <afzal@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: Don't create voltage sysfs entries if we can't read voltageMark Brown1-1/+2
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: Don't report zero volts for the fixed voltage regulatorMark Brown1-1/+4
If we don't know what voltage the regulator is set to return an error rather than reporting zero volts. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: TPS65910: Create an array for init dataKyle Manna1-3/+10
Create an array of fixed size for the platform to pass regulator initalization data through. Passing an array of pointers to init data also allows more flexible definition of init data as well as prevents reading past the end of the array should the platform define an incorrectly sized array. Signed-off-by: Kyle Manna <kyle.manna@fuel7.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: TPS65910: Move regulator defs to headerKyle Manna1-24/+0
Move the regulator defintions to the header so that platform board file can use them to configure specific regulators. Signed-off-by: Kyle Manna <kyle.manna@fuel7.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: max8649 Convert max8649 to use regmap apiJonghwan Choi2-100/+56
Signed-off-by: Jonghwan Choi <jhbird.choi@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23regulator: Use regmap_read/write(), regmap_update_bits functions directlyJonghwan Choi1-55/+32
Current driver had the regmapcalls within the bodies of the driver specific read/write fuctions. This patch removes the original read/write functions and makes the call sites use regmap directly. Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>