summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max77802.c
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'driver-core-3.19-rc1' of ↵Linus Torvalds2014-12-151-1/+0Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core update from Greg KH: "Here's the set of driver core patches for 3.19-rc1. They are dominated by the removal of the .owner field in platform drivers. They touch a lot of files, but they are "simple" changes, just removing a line in a structure. Other than that, a few minor driver core and debugfs changes. There are some ath9k patches coming in through this tree that have been acked by the wireless maintainers as they relied on the debugfs changes. Everything has been in linux-next for a while" * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits) Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries" fs: debugfs: add forward declaration for struct device type firmware class: Deletion of an unnecessary check before the function call "vunmap" firmware loader: fix hung task warning dump devcoredump: provide a one-way disable function device: Add dev_<level>_once variants ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries ath: use seq_file api for ath9k debugfs files debugfs: add helper function to create device related seq_file drivers/base: cacheinfo: remove noisy error boot message Revert "core: platform: add warning if driver has no owner" drivers: base: support cpu cache information interface to userspace via sysfs drivers: base: add cpu_device_create to support per-cpu devices topology: replace custom attribute macros with standard DEVICE_ATTR* cpumask: factor out show_cpumap into separate helper function driver core: Fix unbalanced device reference in drivers_probe driver core: fix race with userland in device_add() sysfs/kernfs: make read requests on pre-alloc files use the buffer. sysfs/kernfs: allow attributes to request write buffer be pre-allocated. fs: sysfs: return EGBIG on write if offset is larger than file size ...
| * regulator: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0Star
| | | | | | | | | | | | | | 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>
* | regulator: max77802: Remove support for board filesKrzysztof Kozlowski2014-11-261-73/+19Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge tag 'v3.18-rc4' into regulator-max77802Mark Brown2014-11-261-1/+1
|\ \ | | | | | | | | | Linux 3.18-rc4
| * | regulator: max77802: zero-initialize regulator match tableJavier Martinez Canillas2014-11-031-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>
* | regulator: max77802: Fill regulator modes translation callbackJavier Martinez Canillas2014-11-261-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>
* | regulator: max77802: Don't ignore return value of current opmodeKrzysztof Kozlowski2014-11-041-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>
* | regulator: max77802: Use unsigned int for modes in max77802_map_mode()Javier Martinez Canillas2014-11-031-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>
* | regulator: max77802: Remove suspend_enableKrzysztof Kozlowski2014-10-311-4/+0Star
| | | | | | | | | | | | | | | | | | | | 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>
* | regulator: max77802: Make regulator_desc array constKrzysztof Kozlowski2014-10-281-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>
* | regulator: max77802: fix a test in max77802_set_suspend_mode()Dan Carpenter2014-10-271-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>
* | regulator: max77802: Add header for operating modesJavier Martinez Canillas2014-10-201-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>
* | regulator: max77802: Don't treat OFF as an operating modeJavier Martinez Canillas2014-10-201-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>
* | regulator: max77802: Add set suspend mode for BUCKs and simplify codeJavier Martinez Canillas2014-10-201-47/+46Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | regulator: max77802: Add .{get,set}_mode callbacksJavier Martinez Canillas2014-10-201-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>
* | regulator: max77802: Split regulator operations for BUCKsJavier Martinez Canillas2014-10-201-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>
* | regulator: max77802: Add .set_suspend_{enable,disable} callbacksJavier Martinez Canillas2014-10-201-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>
* regulator: max77802: Remove duplicate rdev_get_id() callAxel Lin2014-09-051-2/+2
| | | | | Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: max77802: set opmode to normal if off is read from hwJavier Martinez Canillas2014-08-271-1/+11
| | | | | | | | | | | | | | | | The max77802 driver reads the default operating mode (opmode) set for regulators when enabled from the hardware registers. But if a regulator is disabled and the system warm restarted, the hardware reports OFF as the opmode so the regulator is not enabled. Default to operating mode NORMAL if OFF is read from the hardware register. Reported-by: Yuvaraj Cd <yuvaraj.lkml@gmail.com> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Reviewed-by: Doug Anderson <dianders@chromium.org> Tested-by: Yuvaraj Kumar CD <yuvaraj.cd@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: max77802: Remove unused fields from struct max77802_regulator_prvAxel Lin2014-08-201-2/+0Star
| | | | | | | Both num_regulators and *rdev[MAX77802_REG_MAX] are not used, remove them. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
* regulator: Add driver for max77802 PMIC PMIC regulatorsJavier Martinez Canillas2014-08-181-0/+578
The MAX77802 PMIC has 10 high-efficiency Buck and 32 Low-dropout (LDO) regulators. This patch adds support for all these regulators found on the MAX77802 PMIC and is based on a driver added by Simon Glass to the Chrome OS kernel 3.8 tree. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Tested-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>