aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/regulator (follow)
AgeCommit message (Collapse)AuthorFilesLines
2012-03-03regulator: provide a helper for registering a fixed regulatorSascha Hauer1-0/+13
Some devices require a regulator to work, but boards may not have a software controllable regulator for this device. Provide a helper function to make it simpler for these boards to register a fixed regulator as a dummy regulator. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-21regulator: Remove ifdefs for debugfs codeStephen Boyd1-2/+0
If CONFIG_DEBUG_FS=y debugfs functions will never return an ERR_PTR. Instead they'll return NULL. The intent is to remove ifdefs in calling code. Update the code to reflect this. We gain an extra dentry pointer per struct regulator and struct regulator_dev but that should be ok because most distros have debugfs compiled in anyway. Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-16regulator: fix wrong header name in descriptionKim, Milo1-2/+2
The 'mode' is defined in consumer.h. * patch base version : linux-3.2.4 Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-02-02regulator: Remove support for supplies specified by struct deviceMark Brown1-2/+0
This has been deprecated for a very long time now. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Liam Girdwood <lrg@ti.com>
2012-01-29regulator: Add devm_regulator_put in consumer.hAxel Lin1-1/+5
Commit d5ad34f7cb "regulator: Implement devm_regulator_free()" actually implements devm_regulator_put. Thus rename devm_regulator_free to devm_regulator_put. Also add empty devm_regulator_put for !CONFIG_REGULATOR Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-27regulator: Add empty devm_regulator_bulk_get for !CONFIG_REGULATORAxel Lin1-0/+6
This fixes below build error if CONFIG_REGULATOR is disabled. CC sound/soc/codecs/wm5100.o sound/soc/codecs/wm5100.c: In function ‘wm5100_i2c_probe’: sound/soc/codecs/wm5100.c:2462: error: implicit declaration of function ‘devm_regulator_bulk_get’ make[3]: *** [sound/soc/codecs/wm5100.o] Error 1 make[2]: *** [sound/soc/codecs] Error 2 make[1]: *** [sound/soc] Error 2 make: *** [sound] Error 2 Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-22regulator: Provide devm_regulator_bulk_get()Mark Brown1-0/+2
Allow drivers to benefit from both the bulk APIs and managed resources simultaneously. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-22regulator: Implement devm_regulator_free()Mark Brown1-0/+1
Allow consumers to free regulators allocated using devm_regulator_get() if they need to. This will not normally be required. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20regulator: Add devm_regulator_get()Stephen Boyd1-0/+9
Add a resource managed regulator_get() to simplify regulator usage in drivers. This allows driver authors to "get and forget" about their regulators by automatically calling regulator_put() when the driver is detached. [Fixed up a couple of coding style issues -- broonie] Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-20regulator: TPS62360: Add tps62360 regulator driverLaxman Dewangan1-0/+57
The regulator module consists of 1 DCDC. The output voltage is configurable and is meant for supply power to the core voltage of Soc. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-03regulator: add regulator_bulk_force_disable functionDonggeun Kim1-0/+8
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: add regulator_force_disable() definition for !CONFIG_REGULATORMyungJoo Ham1-0/+5
regulator_force_disable() was omitted in consumer.h for !CONFIG_REGULATOR case. 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>
2011-12-05regulator: pass device_node to of_get_regulator_init_data()Shawn Guo1-2/+4
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-11-23regulator: map consumer regulator based on device treeRajendra Nayak1-0/+2
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 Nayak1-1/+1
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: helper routine to extract regulator_init_dataRajendra Nayak1-0/+20
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-06Merge branch 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linuxLinus Torvalds1-0/+1
* 'modsplit-Oct31_2011' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: (230 commits) Revert "tracing: Include module.h in define_trace.h" irq: don't put module.h into irq.h for tracking irqgen modules. bluetooth: macroize two small inlines to avoid module.h ip_vs.h: fix implicit use of module_get/module_put from module.h nf_conntrack.h: fix up fallout from implicit moduleparam.h presence include: replace linux/module.h with "struct module" wherever possible include: convert various register fcns to macros to avoid include chaining crypto.h: remove unused crypto_tfm_alg_modname() inline uwb.h: fix implicit use of asm/page.h for PAGE_SIZE pm_runtime.h: explicitly requires notifier.h linux/dmaengine.h: fix implicit use of bitmap.h and asm/page.h miscdevice.h: fix up implicit use of lists and types stop_machine.h: fix implicit use of smp.h for smp_processor_id of: fix implicit use of errno.h in include/linux/of.h of_platform.h: delete needless include <linux/module.h> acpi: remove module.h include from platform/aclinux.h miscdevice.h: delete unnecessary inclusion of module.h device_cgroup.h: delete needless include <linux/module.h> net: sch_generic remove redundant use of <linux/module.h> net: inet_timewait_sock doesnt need <linux/module.h> ... Fix up trivial conflicts (other header files, and removal of the ab3550 mfd driver) in - drivers/media/dvb/frontends/dibx000_common.c - drivers/media/video/{mt9m111.c,ov6650.c} - drivers/mfd/ab3550-core.c - include/linux/dmaengine.h
2011-11-01Merge branch 'for-linus' of git://opensource.wolfsonmicro.com/regulatorLinus Torvalds2-1/+88
* 'for-linus' of git://opensource.wolfsonmicro.com/regulator: (22 commits) regulator: Constify constraints name regulator: Fix possible nullpointer dereference in regulator_enable() regulator: gpio-regulator add dependency on GENERIC_GPIO regulator: Add module.h include to gpio-regulator regulator: Add driver for gpio-controlled regulators regulator: remove duplicate REG_CTRL2 defines in tps65023 regulator: Clarify documentation for regulator-regulator supplies regulator: Fix some bitrot in the machine driver documentation regulator: tps65023: Added support for the similiar TPS65020 chip regulator: tps65023: Setting correct core regulator for tps65021 regulator: tps65023: Set missing bit for update core-voltage regulator: tps65023: Fixes i2c configuration issues regulator: Add debugfs file showing the supply map table regulator: tps6586x: add SMx slew rate setting regulator: tps65023: Fixes i2c configuration issues regulator: tps6507x: Remove num_voltages array regulator: max8952: removed unused mutex. regulator: fix regulator/consumer.h kernel-doc warning regulator: Ensure enough enable time for max8649 regulator: 88pm8607: Fix off-by-one value range checking in the case of no id is matched ...
2011-10-31regulator: Fix implicit use of notifier.h by driver.hPaul Gortmaker1-0/+1
This was implicitly appearing by way of module.h -- but when we fix that, we'll get this: In file included from drivers/regulator/dummy.c:21: include/linux/regulator/driver.h:197: error: field 'notifier' has incomplete type make[3]: *** [drivers/regulator/dummy.o] Error 1 Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-28Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/soundLinus Torvalds2-0/+10
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (549 commits) ALSA: hda - Fix ADC input-amp handling for Cx20549 codec ALSA: hda - Keep EAPD turned on for old Conexant chips ALSA: hda/realtek - Fix missing volume controls with ALC260 ASoC: wm8940: Properly set codec->dapm.bias_level ALSA: hda - Fix pin-config for ASUS W90V ALSA: hda - Fix surround/CLFE headphone and speaker pins order ALSA: hda - Fix typo ALSA: Update the sound git tree URL ALSA: HDA: Add new revision for ALC662 ASoC: max98095: Convert codec->hw_write to snd_soc_write ASoC: keep pointer to resource so it can be freed ASoC: sgtl5000: Fix wrong mask in some snd_soc_update_bits calls ASoC: wm8996: Fix wrong mask for setting WM8996_AIF_CLOCKING_2 ASoC: da7210: Add support for line out and DAC ASoC: da7210: Add support for DAPM ALSA: hda/realtek - Fix DAC assignments of multiple speakers ASoC: Use SGTL5000_LINREG_VDDD_MASK instead of hardcoded mask value ASoC: Set sgtl5000->ldo in ldo_regulator_register ASoC: wm8996: Use SND_SOC_DAPM_AIF_OUT for AIF2 Capture ASoC: wm8994: Use SND_SOC_DAPM_AIF_OUT for AIF3 Capture ...
2011-10-14regulator: Constify constraints nameMark Brown1-1/+1
There's no need for the API to modify it and having it const makes it easier to use with random strings the board code has. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-10-09regulator: Add driver for gpio-controlled regulatorsHeiko Stübner1-0/+87
This patch adds support for regulators that can be controlled via gpios. Examples for such regulators are the TI-tps65024x voltage regulators with 4 fixed and 1 runtime-switchable voltage regulators or the TI-bq240XX charger regulators. The number of controlling gpios is not limited, the mapping between voltage/current and target gpio state is done via the states map and the driver can be used for either voltage or current regulators. A mapping for a regulator with two GPIOs could look like: gpios = { { .gpio = GPIO1, .flags = GPIOF_OUT_INIT_HIGH, .label = "gpio name 1" }, { .gpio = GPIO2, .flags = GPIOF_OUT_INIT_LOW, .label = "gpio name 2" }, } The flags element of the gpios array determines the initial state of the gpio, set during probe. The initial state of the regulator is also calculated from these values states = { { .value = volt_or_cur1, .gpios = (0 << 1) | (0 << 0) }, { .value = volt_or_cur2, .gpios = (0 << 1) | (1 << 0) }, { .value = volt_or_cur3, .gpios = (1 << 1) | (0 << 0) }, { .value = volt_or_cur4, .gpios = (1 << 1) | (1 << 0) }, } The target-state for the n-th gpio is determined by the n-th bit in the bitfield of the target-value. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-09-14regulator: Implement deferred disable supportMark Brown2-0/+10
It is a reasonably common pattern for hardware to require some delay after being quiesced before the disable has finalised, especially in mixed signal devices. For example, an active discharge may be required to ensure that the circuit starts up again in a known state. Avoid having to implement such delays in the regulator API by providing regulator_deferred_disable() which will do a regulator_disable() a specified number of milliseconds after it is called. Due to the reference counting done on regulators a deferred disable can be cancelled by doing another regulator_enable(). Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@ti.com>
2011-09-08regulator: fix kernel-doc warning in consumer.hRandy Dunlap1-1/+1
Fix kernel-doc warning about internal/private data by marking it as "private:" so that kernel-doc will ignore it. Warning(include/linux/regulator/consumer.h:128): No description found for parameter 'ret' Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2011-08-08regulator: fix regulator/consumer.h kernel-doc warningRandy Dunlap1-1/+1
Fix kernel-doc warning about internal/private data by marking it as "private:" so that kernel-doc will ignore it. Warning(include/linux/regulator/consumer.h:128): No description found for parameter 'ret' Signed-off-by: Randy Dunlap <rdunlap@xenotime.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-06-09regulator: Refactor supply implementation to work as regular consumersMark Brown1-3/+1
Currently the regulator supply implementation is somewhat complex and fragile as it doesn't look like standard consumers but is instead a parallel implementation. This causes issues with locking and reference counting. Move the implementation over to using standard consumers to address this. Rather than only notifying the supply on the first enable/disable we do so every time the regulator is enabled or disabled, simplifying locking as we don't need to hold a lock on the consumer we are about to enable. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-30regulator: Do bulk enables of regulators in parallelMark Brown1-0/+3
In order to reduce the impact of ramp times rather than enabling the regulators for a device in series use async tasks to run the actual enables. This means that the delays which the enables implement can all run in parallel, though it does mean that the order in which the supplies come on may be unstable. For super bonus fun points if any of the regulators are shared between multiple supplies on the same device (as is rather likely) then this will test our locking. Note that in this case we only delay once for each physical regulator so the threads shouldn't block each other while delaying. It'd be even nicer if we could coalesce writes to a shared enable registers in PMICs but that's definitely future work, and it may also be useful and is certainly more achievable to optimise out the parallelism if none of the regulators implement ramp delays. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27regulator: Support voltage offsets to compensate for drops in systemMark Brown1-0/+4
Some systems, particularly physically large systems used for early prototyping, may experience substantial voltage drops between the regulator and the consumers as a result of long traces in the system. With these systems voltages may need to be set higher than requested in order to ensure reliable system operation. Allow systems to work around such hardware issues by allowing constraints to supply an offset to be applied to any requested and reported voltages. This is not ideal, especially since the voltage drop may be load dependant, but is sufficient for most affected systems, it is not expected to be used in production hardware. The offset is applied after all constraint processing so constraints should be specified in terms of consumer values not physically configured values. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27regulator: Remove supply_regulator_dev from machine configurationMark Brown1-3/+0
supply_regulator_dev (using a struct pointer) has been deprecated in favour of supply_regulator (using a regulator name) for quite a few releases now with a warning generated if it is used and there are no current in tree users so just remove the code. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-24mach-ux500: voltage domain regulators for DB8500Bengt Jonsson1-0/+45
The DB8500 has ePOD:s (electronic power domains) which are possible to switch on/off to deactivate silicon blocks on the DB8500 SoC by cutting their power without retention. We model these as simple regulators with one bit on/off settings. Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Signed-off-by: Sundar Iyer <sundar.iyer@stericsson.com> Signed-off-by: Jonas Aberg <jonas.aberg@stericsson.com> Signed-off-by: Virupax Sadashivpetimath <virupax.sadashivpetimath@stericsson.com> Signed-off-by: Martin Persson <martin.persson@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2011-03-26regulator: provide consumer interface for fall/rise timeLinus Walleij1-0/+2
This exposes the functionality for rise/fall fime when setting voltage to the consumers. Cc: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-26regulator: add set_voltage_time_sel infrastructureLinus Walleij1-2/+9
This makes it possible to set the stabilization time for voltage regulators in the same manner as enable_time(). The interface only supports regulators that implements fixed selectors. Cc: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-26regulator: initialization for ab8500 regulatorsBengt Jonsson1-2/+48
The regulators on the AB8500 have a lot of custom hardware control settings pertaining to 8 external signals, settings which are board-specific and need be provided from the platform at startup. Initialization added for regulators Vana, VextSupply1, VextSupply2, VextSupply3, Vaux1, Vaux2, Vaux3, VTVout, Vintcore12, Vaudio, Vdmic, Vamic1, Vamic2, VrefDDR. Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Reviewed-by: Rickard Andersson <rickard.andersson@stericsson.com> Reviewed-by: Jonas Aberg <jonas.aberg@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-26regulator: add support for USB voltage regulatorBengt Jonsson1-0/+1
Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-26Regulator: add suspend-finish API for regulator core.MyungJoo Ham1-0/+1
The regulator core had suspend-prepare that turns off the regulators when entering a system-wide suspend. However, it did not have suspend-finish that pairs with suspend-prepare and the regulator core has assumed that the regulator devices and their drivers support autonomous recover at resume. This patch adds regulator_suspend_finish that pairs with the previously-existed regulator_suspend_prepare. The function regulator_suspend_finish turns on the regulators that have always_on set or positive use_count so that we can reset the regulator states appropriately at resume. In regulator_suspend_finish, if has_full_constraints, it disables unnecessary regulators. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> -- Updates v3 comments corrected (Thanks to Igor) v2 disable unnecessary regulators (Thanks to Mark) Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-12regulator: Add initial per-regulator debugfs supportMark Brown1-2/+6
We only expose the use and open counts to userspace, providing a tiny bit of insight into what the API is up to. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-12regulator: Add API to re-apply voltage to hardwareMark Brown1-0/+1
When cooperating with an external control source the regulator setup may be changed underneath the API. Currently consumers can just redo the regulator_set_voltage() to restore a previously set configuration but provide an explicit API for doing this as optimsations in the regulator_set_voltage() implementation will shortly prevent that. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-12regulator: Provide a selector based set_voltage_sel() operationMark Brown1-0/+3
Many regulator drivers implement voltage setting by looping through a table of possible values, normally because the set of available voltages can't be mapped onto selectors with simple calcuation. Factor out these loops by providing a variant of set_voltage() which takes a selector rather than a voltage range as an argument and implementing a loop through the available selectors in the core. This is not going to be suitable for use with all devices as when the regulator voltage can be mapped onto selector values with a simple calculation the linear scan through the available values will be more expensive than just doing the calculation, especially for regulators that provide fine grained voltage control. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-12regulators: Moved define for number of regulators in ab8500Bengt Jonsson1-11/+13
The define for number of regulators is moved from ab8500-core to ab8500-regulator so that the regulator driver can be updated independently of ab8500-core. This also changes the platform configuration structure of ab8500-core so that it contains a pointer to the regulator_init_data array plus number of regulators instead of an fixed size array of pointers to regulator_init_data. Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com> Acked-by: Linus Walleij <linus.walleij@stericsson.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-12regulator: Allow drivers to report voltages as selectorsMark Brown1-0/+3
Since drivers already have to provide an API for translating selectors into voltages they may as well just report the selector values directly to the core API rather than implement the lookup themselves. The old interface is left in place for now, but may be removed in future. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-12regulator: Copy constraints from regulators when initialising themMark Brown1-1/+1
Currently the regulator API uses the constraints structure passed in to the core throughout the lifetime of the object. This means that it is not possible to mark the constraints as __initdata so if the kernel supports many boards the constraints for all of them are kept around throughout the lifetime of the system, consuming memory needlessly. By copying constraints that are actually used we allow the use of __initdata, saving memory when multiple boards are supported. This also means the constraints can be const. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-12regulator: Report actual configured voltage to set_voltage()Mark Brown1-1/+2
Change the interface used by set_voltage() to report the selected value to the regulator core in terms of a selector used by list_voltage(). This allows the regulator core to know the voltage that was chosen without having to do an explict get_voltage(), which would be much more expensive as it will generally access hardware. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-10-28regulator: Add option for machine drivers to enable the dummy regulatorMark Brown1-0/+5
Allow machine drivers to explicitly enable the use of the dummy regulator, enabling simpler support for systems with only a few specific supplies visible to software. It is strongly recommended that this is not used on systems with substantial software control over their PMICs, for maximum functionality constrints should be as fully specified as possible. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-10-28Regulator: LP3972 PMIC regulator driverAxel Lin1-0/+48
This patch adds regulator drivers for National Semiconductors LP3972 PMIC. This LP3972 PMIC controller has 3 DC/DC voltage converters and 5 low drop-out (LDO) regulators. LP3972 PMIC controller uses I2C interface. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-10-28MAX8952 PMIC Driver Initial ReleaseMyungJoo Ham1-0/+135
MAX8952 PMIC is used to provide voltage output between 770mV - 1400mV with DVS support. In this initial release, users can set voltages for four DVS modes, RAMP delay values, and SYNC frequency. Controlling FPWM/SYNC_MODE/Pull-Down/Ramp Modes and reading CHIP_ID is not supported in this release. If GPIO of EN is not valid in platform data, the driver assumes that it is always-on. If GPIO of VID0 or VID1 is invalid, the driver pulls down VID0 and VID1 to fix DVS mode as 0 and disables DVS support. We assume that V_OUT is capable to provide every voltage from 770mV to 1.40V in 10mV steps although the data sheet has some ambiguity on it. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> -- v2: - Style correction - Can accept platform_data with invalid GPIOs - Removed unnecessary features - Improved error handling Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-08-11ab8500-mfd: add regulator support to ab8500 mfd deviceSundar R Iyer1-0/+25
Acked-by: Linus Walleij <linus.walleij@stericsson.com> Acked-By: Mattias Wallin <mattias.wallin@stericsson.com> Acked-By: Bengt JONSSON <bengt.g.jonsson@stericsson.com> Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-07-28regulator: tps6507x: allow driver to use DEFDCDC{2,3}_HIGH registerAnuj Aggarwal1-0/+32
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> In TPS6507x, depending on the status of DEFDCDC{2,3} pin either DEFDCDC{2,3}_LOW or DEFDCDC{2,3}_HIGH register needs to be read or programmed to change the output voltage. The current driver assumes DEFDCDC{2,3} pins are always tied low and thus operates only on DEFDCDC{2,3}_LOW register. This need not always be the case (as is found on OMAP-L138 EVM). Unfortunately, software cannot read the status of DEFDCDC{2,3} pins. So, this information is passed through platform data depending on how the board is wired. Signed-off-by: Anuj Aggarwal <anuj.aggarwal@ti.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-05-25regulator: Allow regulator-regulator supplies to be specified by nameMark Brown1-2/+7
When one regulator supplies another allow the relationship to be specified using names rather than struct regulators, in a similar manner to that allowed for consumer supplies. This allows static configuration at compile time, reducing the need for dynamic init code. Also change the references to LINE supply to be system supply since line is sometimes used for actual supplies and therefore potentially confusing. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-04-19regulator: Let drivers know when they use the stub APIJean Delvare1-2/+6
Have the stub variant of regulator_get() return NULL, so that drivers can (but still don't have to) handle this case specifically. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Jerome Oufella <jerome.oufella@savoirfairelinux.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2010-03-03regulator: enable max8649 regulator driverHaojian Zhuang1-0/+44
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>