aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator (follow)
AgeCommit message (Collapse)AuthorFilesLines
2014-10-31regulator: Staticize 'regulator_states' arrayKrzysztof Kozlowski1-1/+1
The 'regulator_states' array is used only in this unit and it is not exported. Make it static. This also fixes following sparse warning: drivers/regulator/of_regulator.c:22:12: warning: symbol 'regulator_states' was not declared. Should it be static? Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-31regulator: max77686: Add suspend disable for some LDOsKrzysztof Kozlowski1-4/+8
Some LDOs of Maxim 77686 PMIC support disabling during system suspend (LDO{2,6,7,8,10,11,12,14,15,16}). This was already implemented as part of set_suspend_mode function. In that case the mode was one of: - disable, - normal mode, - low power mode. However there are no bindings for setting the mode during suspend. Add suspend disable for LDO regulators supporting this. Re-use existing max77686_buck_set_suspend_disable() function. This helps reducing energy consumption during system sleep. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-31regulator: max77802: Remove suspend_enableKrzysztof Kozlowski1-4/+0
The Maxim 77802 PMIC regulators do not have special enable configuration for suspend. The driver instead enabled them manually which is not a best way to deal with suspend. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-29regulator: of: Lower the severity of the error with no containerMark Brown1-1/+2
Description of regulators should generally be optional so if there is no DT node for the regulators container then we shouldn't print an error message. Lower the severity of the message to debug level (it might help someone work out what went wrong) and while we're at it say what we were looking for. Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28regulator: max77686: Store opmode non-shiftedKrzysztof Kozlowski1-15/+34
Introduce simple helper for calculating the shift for OPMODE field in registers. This allows storing the current value of opmode in non-shifted form and simplifies a little set_suspend_disable and enable functions. Additionally this will allow adding support LDOs to the existing set_suspend_disable function. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Suggested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28regulator: max77686: Replace hard-coded opmode values with definesKrzysztof Kozlowski1-7/+24
Add defines for regulator operating modes which should be more readable, especially if one does not have Maxim 77686 datasheet. The patch does not introduce any functional change. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Suggested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28regulator: max77686: Make regulator_desc array constKrzysztof Kozlowski1-1/+1
The regulator_register() expects array of 'regulator_desc' to be const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28regulator: s2mpa01: Make regulator_desc array constKrzysztof Kozlowski1-1/+1
The regulator_register() expects array of 'regulator_desc' to be const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28regulator: max77802: Make regulator_desc array constKrzysztof Kozlowski1-1/+1
The regulator_register() expects array of 'regulator_desc' to be const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28regulator: max77693: Make regulator_desc array constKrzysztof Kozlowski1-1/+1
The regulator_register() expects array of 'regulator_desc' to be const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-28regulator: dummy: Make regulator_desc array constKrzysztof Kozlowski1-1/+1
The regulator_register() expects array of 'regulator_desc' to be const. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-27regulator: max77802: fix a test in max77802_set_suspend_mode()Dan Carpenter1-1/+1
The original test triggers a static checker warning. Javier Martinez Canillas says that the "!" is a typo and should be removed. Fixes: 2e0eaa1aa008 ('regulator: max77802: Add set suspend mode for BUCKs and simplify code') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-27Merge remote-tracking branch 'regulator/fix/rk808' into regulator-linusMark Brown1-1/+1
2014-10-22regulator: of: Decrement refcount for suspend state nodesJavier Martinez Canillas1-0/+1
of_get_regulation_constraints() calls of_get_child_by_name() to find the regulator-state-{mem,disk} child nodes for each regulator. This function increments the device node reference counter but this is not decremented once the function is done using the node. Fix that by calling of_node_put() after finishing using the device node. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-22regulator: act8865: Add support to turn off all outputsRomain Perier1-0/+31
When the property "poweroff-source" is found in the devicetree, the function pm_power_off is defined. This function sends the rights bit fields to the global off control register. shutdown/poweroff commands are now supported for hardware components which use these PMU. Signed-off-by: Romain Perier <romain.perier@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: drop owner assignment from platform_driversWolfram Sang61-67/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20regulator: of: Add support for parsing regulator_state for suspend stateChanwoo Choi1-1/+38
The regulation_constraints structure includes specific field to support suspend state for global PMIC SUSPEND/HIBERNATE mode. This patch add support for parsing regulator_state for suspend state. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: sky81452: Remove module versionAxel Lin1-1/+0
The module version is unlikely to be updated, use kernel version should be enough. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: s2mps11: Don't zero allocated memory for external controlKrzysztof Kozlowski1-1/+1
The driver was allocating memory for storing GPIOs for external control with unnecessary GFP_ZERO flag. Then right after allocation it initialized memory to -EINVAL in loop. Skip the GFP_ZERO flag. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: rn5t618: Convert to new style DT parsingBeniamino Galvani1-47/+4
Use the simplified DT parsing method to remove some duplicated code. Since this is a MFD subdevice and its device object doesn't have an associated DT node, the configuration instance used to register the regulators has been changed to point to the parent device. Signed-off-by: Beniamino Galvani <b.galvani@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: rk808: Add support setting suspend voltageChris Zhong1-3/+54
support setting suspend voltage and disable regulator in suspend. Signed-off-by: Chris Zhong <zyw@rock-chips.com> Reviewed-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: max77802: Add header for operating modesJavier Martinez Canillas1-0/+1
Add a header file for the max77802 constants that could be shared between the regulator driver and Device Tree source files. Also, remove standby and off opmodes since only normal and low power are valid operating modes. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: max77802: Don't treat OFF as an operating modeJavier Martinez Canillas1-1/+2
The only operating modes that are supported by the regulators in the max77802 PMIC are Output ON (normal) and Output On in Low Power Mode. OFF was wrongly counted as an operating mode while is only a regulator status. Make clear in the code that OFF is not an operating mode. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: max77802: Add set suspend mode for BUCKs and simplify codeJavier Martinez Canillas1-47/+46
The max77802 PMIC has a special enable pin (PWRREQ) that can be used by the Application Processor (AP) to power down and up voltage rails. The max77802 PMIC regulators have 3 different enable control logics. Some regulators support to be configured on different operational mode during normal operation while others only support to be put in a Low Power Mode while the system has entered in sleep mode. Some regulators don't even support that configuration. The logics are the following: Enable Control Logic1 by PWRREQ (BUCK 2-4, LDO2, LDO4-19, LDO22, LDO35) ------------------------------- 0: Output OFF 1: Output ON/OFF (Controlled by PWRREQ) PWRREQ = HIGH (1): Output ON in Normal Mode PWRREQ = LOW (0): Output OFF 2: Output On with Low Power Mode (Controlled by PWRREQ) PWRREQ = HIGH (1) : Output ON in Normal Mode PWRREQ = LOW (0): Output ON in Low Power Mode 3: Output ON in Normal Mode Enable Control Logic2 by PWRREQ (LDO1, LDO20, LDO21) ------------------------------- 0: Output ON/OFF by ENx 1: Output ON in Low Power Mode 2: Output ON in Low Power Mode (Controlled by PWRREQ) PWRREQ = HIGH (1): Output ON in Normal Mode PWRREQ = LOW (0): Output ON in Low Power Mode 3: Output ON in Normal Mode Enable Control Logic3 by PWRREQ (LDO3) ------------------------------- 0 or 3: Output ON in Normal Mode 1: Output ON in Low Power Mode 2: Output ON in Low Power Mode (Controlled by PWRREQ) PWRREQ = HIGH (1): Output ON in Normal Mode PWRREQ = LOW (0): Output ON in Low Power Mode The driver only implemented .set_suspend_mode for the LDOs regulators but some BUCKs also support to be put in Low Power Mode on system wide suspend so they should be supported as well. Two different functions were used for the logic 1 and 2 but this is not necessary. Only normal and Low Power Mode are valid operational modes, OFF is not an mode but is a regulator state that is handled by .set_suspend_enable ad .set_suspend_disable. So the same .set_suspend_mode function can be used by all the regulators that support Output On with Low Power Mode by PWRREQ, making much simpler the code to set the suspend mode. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: max77802: Add .{get,set}_mode callbacksJavier Martinez Canillas1-0/+46
Some max77802 LDOs (1, 3, 20 and 21) support to be configured in Low Power Mode during system normal operation. Add function handlers for the .get_mode and .set_mode operations to set the mode on these LDOs. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: max77802: Split regulator operations for BUCKsJavier Martinez Canillas1-2/+17
Not all the max77802 BUCKs regulators have the same functionality, for example BUCKs 2-4 support the output to be configured as normal or Low Power Mode by the PWRREQ enable pin while the other BUCKs only support their output to be set ON or OFF by PWRREQ. As a preparation for adding a set_suspend_mode function handler for all the regulators that support Low Power Mode by PWRREQ, split the operations for BUCKs regulators. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: max77802: Add .set_suspend_{enable,disable} callbacksJavier Martinez Canillas1-10/+18
The max77802 PMIC has an enable pin (PWRREQ) that can be used to switch regulators ON and OFF automatically by the Application Processor when the system is leaving and entering sleep mode. Only the BUCKs regulators had a .set_suspend_disable function handler that used the enable pin to turn OFF the regulators during suspend. But most LDOs also support that functionality (besides 1, 3, 20 and 21) so rename the function to a more generic name and use the same function for the LDOs. Also add a .set_suspend_enable handler for all regulators and use the same function used for the .enable operation. Finally, don't treat output ON/OFF controlled by PWRREQ as an operating mode using the ambiguous MAX77802_OPMODE_STANDBY since it's not an opmode. Instead make it clear that is a control value to switch the regulator OFF by PWRREQ when the system is entering in a suspend state. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: Add ena_gpio_initialized to regulator_configMarkus Pargmann1-1/+2
Most drivers do not set the ena_gpio field of struct regulator_config before passing it to the regulator core. This is fine as long as the gpio identifier that is passed is a positive integer. But the gpio identifier 0 is also valid. So we are not able to decide wether we got a real gpio identifier or not based on a 0 in ena_gpio. To be able to decide if it is a valid gpio that got passed, this patch adds a ena_gpio_initialized field that should be set if was initialized with a correct value, either a gpio >= 0 or a negative error number. The core then checks if ena_gpio or ena_gpio_initialized before handling it as a gpio. This way we maintain backwards compatibility and fix the behaviour for gpio number 0. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: anatop: Fail on invalid voltage selectorMarkus Pargmann1-0/+5
A '0' voltage selector is invalid and can't be used with this driver. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-20regulator: anatop: Set default voltage selector for vddpuMarkus Pargmann1-0/+8
The code reads the default voltage selector from its register. If the bootloader disables the regulator, the default voltage selector will be 0 which results in faulty behaviour of this regulator driver. This patch sets a default voltage selector for vddpu if it is not set in the register. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2014-10-15Merge tag 'for-v3.18' of git://git.infradead.org/battery-2.6Linus Torvalds1-76/+4
Pull power supply and reset updates from Sebastian Reichel: - Initial support for the following chips * max77836 (charger) * max14577 (charger) * bq27742 (battery gauge) * ltc2952 (poweroff) * stih416 (restart) * syscon-reboot (restart) * gpio-restart (restart) - cleanup of power supply core - misc fixes in power supply and reset drivers * tag 'for-v3.18' of git://git.infradead.org/battery-2.6: (48 commits) power: ab8500_fg: Fix build warning Documentation: charger: max14577: Update the date of introducing ABI power: reset: corrections for simple syscon reboot driver Documentation: power: reset: Add documentation for generic SYSCON reboot driver power: reset: Add generic SYSCON register mapped reset bq27x00_battery: Fix flag reading for bq27742 power: reset: use restart_notifier mechanism for msm-poweroff power: Add simple gpio-restart driver power: reset: st: Provide DT bindings for ST's Power Reset driver power: reset: Add restart functionality for STiH41x platforms power: charger-manager: Fix NULL pointer exception with missing cm-fuel-gauge power: max14577: Fix circular config SYSFS dependency power: gpio-charger: do not use gpio value directly power: max8925: Use of_get_child_by_name power: max8925: Fix NULL ptr dereference on memory allocation failure bq27x00_battery: Add support to bq27742 Documentation: charger: max14577: Document exported sysfs entry devicetree: mfd: max14577: Add device tree bindings document power: max17040: Add ID for MAX77836 Fuel Gauge block charger: max14577: Configure battery-dependent settings from DTS and sysfs ... Conflicts: drivers/power/reset/Kconfig drivers/power/reset/Makefile
2014-10-07regulator: rk808: Fix min_uV for DCDC1 & DCDC2Chris Zhong1-1/+1
The min_uv in DCDC1 & DCDC2 should be 712.5mv Signed-off-by: Chris Zhong <zyw@rock-chips.com> Reviwed-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-30Merge remote-tracking branches 'regulator/topic/tps65217', 'regulator/topic/tps65910' and 'regulator/topic/voltage-ev' into regulator-nextMark Brown3-101/+89
2014-09-30Merge remote-tracking branches 'regulator/topic/rk808', 'regulator/topic/rn5t618' and 'regulator/topic/samsung' into regulator-nextMark Brown6-282/+673
2014-09-30Merge remote-tracking branches 'regulator/topic/max1586', 'regulator/topic/max77802' and 'regulator/topic/of' into regulator-nextMark Brown5-2/+685
2014-09-30Merge remote-tracking branches 'regulator/topic/drivers', 'regulator/topic/enable', 'regulator/topic/fan53555', 'regulator/topic/hi6421' and 'regulator/topic/isl9305' into regulator-nextMark Brown13-277/+2342
2014-09-30Merge remote-tracking branches 'regulator/topic/as3711', 'regulator/topic/axp20x', 'regulator/topic/bcm590xx' and 'regulator/topic/da9211' into regulator-nextMark Brown6-69/+190
2014-09-30Merge remote-tracking branches 'regulator/fix/da9211', 'regulator/fix/ltc3589' and 'regulator/fix/tps65023' into regulator-linusMark Brown3-4/+2
2014-09-30regulator: da9211: Fix a bug in update of mask bitJames Ban1-1/+1
This is a patch for fixing a bug about mask bit operation. Signed-off-by: James Ban <james.ban.opensource@diasemi.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-28Merge remote-tracking branch 'regulator/topic/sky81452' into regulator-driversMark Brown3-0/+142
Conflicts: drivers/regulator/Kconfig drivers/regulator/Makefile
2014-09-28Merge remote-tracking branch 'regulator/topic/pwm' into regulator-driversMark Brown4-197/+205
Conflicts: drivers/regulator/Kconfig
2014-09-28regulator: pwm-regulator: get voltage and duty table from dtsChris Zhong4-197/+205
rename st-pwm to pwm-regulator. And support getting voltage & duty table from device tree, other platforms can also use this driver without any modify. Signed-off-by: Chris Zhong <zyw@rock-chips.com> Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-26regulator: qcom_rpm: Fix FORCE_MODE_IS_2_BITS macroAxel Lin1-1/+1
Current code does not take the macro parameter, fix it. This is not a problem at this moment because the only user actually passes vreg to FORCE_MODE_IS_2_BITS(). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-26regulator: qcom_rpm: Don't explicitly initialise the first field of configAxel Lin1-1/+1
Doing so generates a warning as the first field is a pointer but we use 0 to initialize it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-26regulator: ltc3589: fix broken voltage transitionsSteffen Trumtrar1-0/+1
VCCR is used as a trigger to start voltage transitions, so we need to mark it volatile in order to make sure it gets written to hardware every time we set a new voltage. Fixes regulator voltage being stuck at the first voltage set after driver load. [lst: reworded commit message] Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
2014-09-24regulator/mfd: max14577: Export symbols for calculating charger currentKrzysztof Kozlowski1-76/+4
This patch prepares for changing the max14577 charger driver to allow configuring battery-dependent settings from DTS. The patch moves from regulator driver to MFD core driver and exports: - function for calculating register value for charger's current; - table of limits for chargers (MAX14577, MAX77836). Previously they were used only by the max14577 regulator driver. In next patch the charger driver will use them as well. Exporting them will reduce unnecessary code duplication. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Acked-by: Mark Brown <broonie@linaro.org> Acked-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-09-24regulator: qcom-rpm: Regulator driver for the Qualcomm RPMBjorn Andersson3-0/+811
Driver for regulators exposed by the Resource Power Manager (RPM) found in Qualcomm 8660, 8960 and 8064 based devices. Signed-off-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-22regulator: axp20x: Use parent device as regulator configuration deviceMaxime Ripard1-1/+1
The current device used for the regulator configuration is the child device created by the MFD driver. This means that it doesn't have any of_node pointing to it, and whenever we register the regulators, it will not look into the regulator supply in the DT, hence requiring to provide regulator aliases in the MFD driver. We can easily fix that by using the parent device in our configuration, which has a DT node associated to it, and will allow a DT lookup. Eventually, we will be able to remove the aliases in the MFD driver. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-18regulator: fan53555: Fix null pointer dereferenceAxel Lin1-1/+1
Set di->regulator before dereference it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-09-18regulator: fan53555: Fixup report wrong vendor messageAxel Lin1-2/+1
Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Mark Brown <broonie@kernel.org>