summaryrefslogtreecommitdiff
path: root/drivers/regulator
AgeCommit message (Collapse)AuthorFilesLines
2014-12-05regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeingSeung-Woo Kim1-0/+2
After freeing pin from regulator_ena_gpio_free, loop can access the pin. So this patch fixes not to access pin after freeing. Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-02regulator: sky81452: Modify Device Tree structureGyungoh Yoo1-36/+9
Signed-off-by: Gyungoh Yoo <jack.yoo@skyworksinc.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-12-01of: Rename "poweroff-source" property to "system-power-controller"Romain Perier1-1/+1
It reverts commit a4b4e0461ec5 ("of: Add standard property for poweroff capability"). As discussed on the mailing list, it makes more sense to rename back to the old established property name, without the vendor prefix. Problem being that the word "source" usually tends to be used for inputs and that is out of control of the OS. The poweroff capability is an output which simply turns the system-power off. Also, this property might be used by drivers which power-off the system and power back on subsequent RTC alarms. This seems to suggest to remove "poweroff" from the property name and to choose "system-power-controller" as the more generic name. This patchs adds the required renaming changes and defines an helper function which checks if this property is set. Signed-off-by: Romain Perier <romain.perier@gmail.com> Acked-by: Grant Likely <grant.likely@linaro.org> Acked-by: Johan Hovold <johan@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-26regulator: max77686: Remove support for board filesKrzysztof Kozlowski1-72/+19
The driver is used only on Exynos based boards with DTS support. Simplify the driver and remove dead (unused) entries in platform_data structure. Convert the driver to DTS-only version. Parse all regulators at once, not one-by-one. Remove dependency on data provided by max77686 MFD driver. Use new DT style parsing method for regulators init data. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-26Merge tag 'v3.18-rc4' into regulator-max77686Mark Brown8-8/+9
Linux 3.18-rc4
2014-11-26regulator: max77802: Remove support for board filesKrzysztof Kozlowski1-73/+19
The driver is used only on Exynos based boards with DTS support. Simplify the driver and remove dead (unused) entries in platform_data structure. Convert the driver to DTS-only version. Parse all regulators at once, not one-by-one. Remove dependency on data provided by max77686 MFD driver. Use new DT style parsing method for regulators init data. 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-11-26Merge tag 'v3.18-rc4' into regulator-max77802Mark Brown8-8/+9
Linux 3.18-rc4
2014-11-26regulator: max77802: Fill regulator modes translation callbackJavier Martinez Canillas1-0/+6
The max77802 PMIC regulators output can be configured in one of two modes: Output ON (normal) and Output ON in Low Power Mode. Some of the regulators support their operating mode to be changed on startup or by consumers when the system is running while others only support their operating mode to be changed while the system has entered in a suspend state. Use the max77802_map_mode() function to translate the device specific modes to the standard operating modes as used by the regulator core. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-26Merge branch 'topic/suspend' of ↵Mark Brown26-93/+199
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-max77802
2014-11-26regulator: of: Add support for parsing initial and suspend modesJavier Martinez Canillas1-2/+31
Some regulators support their operating mode to be changed on startup or by consumers when the system is running while others only support their operating mode to be changed while the system has entered in a suspend state. The regulator Device Tree binding documents a set of properties to configure the regulators operating modes from a FDT. This patch builds on (40e20d6 regulator: of: Add support for parsing regulator_state for suspend state) and adds support to parse those properties and fill the regulator constraints so the regulator core can call the right suspend handlers when the system enters into sleep. The modes are defined in the Device Tree using the hardware specific modes supported by the regulators. Regulator drivers have to define a translation function that is used to map the hardware specific modes to the standard ones. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-26regulator: of: Pass the regulator description in the match tableJavier Martinez Canillas1-1/+2
Drivers can use the of_regulator_match() function to parse the regulator init_data from DT. A match table is used to specify the name of the node containing the regulators, the device node and to return the init_data to the caller. But also the static regulator descriptor is needed to correctly extract some DT properties like the regulator initial and suspend modes. Use the match table to pass that information. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-26regulator: of: Add regulator desc param to of_get_regulator_init_data()Javier Martinez Canillas26-90/+124
The of_get_regulator_init_data() function is used to extract the regulator init_data but information on how to extract certain data is defined in the static regulator descriptor (e.g: how to map the hardware operating modes). Add a const struct regulator_desc * parameter to the function signature so the parsing logic could use the information in the struct regulator_desc. of_get_regulator_init_data() relies on of_get_regulation_constraints() to actually extract the init_data so it has to pass the struct regulator_desc but that is modified on a later patch. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-25regulator: s2mps11: Add support S2MPS13 regulator deviceChanwoo Choi2-8/+104
This patch adds S2MPS13 regulator device to existing S2MPS11 device driver. The S2MPS13 has just different number of regulators from S2MPS14. The S2MPS13 regulator device includes LDO[1-40] and BUCK[1-10]. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Acked-by: Sangbeom Kim <sbkim73@samsung.com> Acked-by: Mark Brown <broonie@kernel.org> Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
2014-11-24regulator: core: Add PRE_DISABLE notificationRichard Fitzgerald1-0/+16
Add a PRE_DISABLE notification so that consumers can use a notifier to run any steps required to prepare for the regulator being switched off. Since the regulator disable can fail an abort notification is also added. Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-21regulator: gpio: fix parsing of gpio listRichard Fitzgerald1-42/+51
The list of gpios is defined as optional but the code was failing to properly handle the case of no gpios, and also failing to check for errors reading the entry from the devicetree. This patch fixes the handling of optional gpios - this is a useful feature enabling the gpio-regulator to be used as a dummy variable voltage regulator without having to assign any real GPIO lines. Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-21regulator: rpm: add support for RPM-controller SMB208Josh Cartwright1-0/+19
The IPQ8064 reference boards make use of SMB208 regulators which are controlled by RPM. Implement support for these regulators in the RPM regulator driver. Signed-off-by: Josh Cartwright <joshc@codeaurora.org> Acked-by: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-21regulator: da9063: Do not transform local IRQ to virtualDmitry Lavnikevich1-11/+8
Call platform_get_irq_byname() already returns VIRQ instead of local IRQ. Passing this value to regmap_irq_get_virq() causes error which results in IRQ registration failure. This patch fixes such behaviour. Signed-off-by: Dmitry Lavnikevich <d.lavnikevich@sam-solutions.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-17regulator: sky81452: Modify dependent Kconfig symbolGyungoh Yoo1-1/+1
Signed-off-by: Gyungoh Yoo <jack.yoo@skyworksinc.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-14regulator: rt5033: Add RT5033 Regulator device driverBeomho Seo3-0/+132
This patch add device driver of Richtek RT5033 PMIC. The driver support multiple regulator like LDO and synchronous Buck. The integrated synchronous buck converter is designed to provide 0.6 A application with high efficiency. Two LDOs are integrated. One safe LDO is for 60mA and the other one LDO is for 150 mA. Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Signed-off-by: Beomho Seo <beomho.seo@samsung.com> Acked-by: Chanwoo Choi <cw00.choi@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-07regulator: tps65090: Fix gpio initializationMarkus Pargmann1-0/+3
The config is used for multiple regulators within a for loop. The config field is not cleared before it is used for the next item. To avoid any issues this patch adds a proper initialization for the config->ena_gpio field in case no gpio is available. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-07regulator: gpio: Use gpio_is_validMarkus Pargmann1-1/+1
Use gpio_is_valid instead of an explicit comparison with 0. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-07regulator: fixed: Use gpio_is_validMarkus Pargmann1-1/+1
Use gpio_is_valid instead of an explicit comparison with 0. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-07regulator: Set ena_gpio_initialized in regulator driversMarkus Pargmann8-4/+18
This patch sets ena_gpio_initialized for all drivers which set a ena_gpio from parsed DT properties. Drivers using pdata may get zero initialized pdata and therefore copy a 0 into the regulator_config ena_gpio field. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-05Merge remote-tracking branches 'regulator/fix/max1586', ↵Mark Brown6-6/+6
'regulator/fix/max77686', 'regulator/fix/max77693', 'regulator/fix/max77802', 'regulator/fix/max8860' and 'regulator/fix/s2mpa01' into regulator-linus
2014-11-05Merge remote-tracking branch 'regulator/fix/core' into regulator-linusMark Brown1-1/+2
2014-11-04regulator: max77802: Don't ignore return value of current opmodeKrzysztof Kozlowski1-1/+7
The return value of regmap_read() of current opmode for regulator was silently ignored and whatever happened to be in 'val' variable was used as new opmode. This could lead to using bogus opmode. Don't ignore what regmap_read() returns. If it fails just fall back to normal opmode. 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-11-04regulator: max77686: Initialize opmode explicitly to normal modeKrzysztof Kozlowski1-2/+1
Minor nit: Initialize the opmode for each regulator to normal mode in a readable explicit way. 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-11-04regulator: max77686: Consistently index opmode array by rdev idKrzysztof Kozlowski1-2/+4
Mixed indexes were used for array of opmodes in max77686_data structure: id of regulator and index of regulator_desc array. These indexes are exactly the same but the mixture may confuse. Use consistently the id of regulator. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-04Merge branch 'platform/remove_owner' of ↵Greg Kroah-Hartman61-67/+0
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux into driver-core-next Remove all .owner fields from platform drivers
2014-11-03regulator: max77802: Use unsigned int for modes in max77802_map_mode()Javier Martinez Canillas1-1/+1
All function dealing with operating modes use unsigned int for modes so change max77802_map_mode() function signature for consistency. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03regulator: s2mpa01: zero-initialize regulator match table arrayJavier Martinez Canillas1-1/+1
The struct of_regulator_match rmatch[] is declared as a non-static local variable so the structure members are not auto-initialized. Initialize the array at declaration time to avoid the structure members values to be indeterminate and have sane defaults instead. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03regulator: max8660: zero-initialize regulator match table arrayJavier Martinez Canillas1-1/+1
The struct of_regulator_match rmatch[] is declared as a non-static local variable so the structure members are not auto-initialized. Initialize the array at declaration time to avoid the structure members values to be indeterminate and have sane defaults instead. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03regulator: max77802: zero-initialize regulator match tableJavier Martinez Canillas1-1/+1
The struct of_regulator_match is declared as a non-static local variable so the structure members are not auto-initialized. Initialize the struct at declaration time to avoid the structure members values to be indeterminate and have sane defaults instead. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03regulator: max77686: zero-initialize regulator match tableJavier Martinez Canillas1-1/+1
The struct of_regulator_match is declared as a non-static local variable so the structure members are not auto-initialized. Initialize the struct at declaration time to avoid the structure members values to be indeterminate and have sane defaults instead. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03regulator: max1586: zero-initialize regulator match table arrayJavier Martinez Canillas1-1/+1
The struct of_regulator_match rmatch[] is declared as a non-static local variable so the structure members are not auto-initialized. Initialize the array at declaration time to avoid the structure members values to be indeterminate and have sane defaults instead. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03regulator: max77693: Fix use of uninitialized regulator configKrzysztof Kozlowski1-1/+1
Driver allocated on stack struct regulator_config but didn't initialize it fully. Few fields (driver_data, ena_gpio) were left untouched. This lead to using random ena_gpio values as GPIOs for max77693 regulators. On occasion these values could match real GPIO numbers leading to interfering with other drivers and to unsuccessful enable/disable of regulator. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Fixes: 80b022e29bfd ("regulator: max77693: Add max77693 regualtor driver.") Cc: <stable@vger.kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-03regulator: of: Add support for parsing microvolts for suspend stateDoug Anderson1-0/+4
Leverage all the work that was done in (40e20d6 regulator: of: Add support for parsing regulator_state for suspend state) and throw in the ability to set suspend microvolts from the device tree. Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Chris Zhong <zyw@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-10-31regulator: Lower priority of constraint loggingMark Brown1-1/+1
Some systems have very large numbers of regulators so the constraint logging done at startup can end up being a very big part of the boot output which is both verbose and slows things down if the console is a serial console. Lower to dev_dbg() instead, we may want to provide a boot parameter to raise this in future but for now people can edit the source. Signed-off-by: Mark Brown <broonie@kernel.org> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
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-29regulator: 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-29regulator: 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>