summaryrefslogtreecommitdiff
path: root/drivers/power/regulator
Commit message (Collapse)AuthorAgeLines
* regulator: fixed: obey startup delayJohn Keeping2016-09-06-0/+10
| | | | | | | | | | When enabling a fixed regulator, it may take some time to rise to the correct voltage. If we do not delay here then subsequent operations will fail. Signed-off-by: John Keeping <john@metanate.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* power: regulator: act8846: fix reading valuesJohn Keeping2016-08-12-2/+2
| | | | | | | | | The voltage and control registers need to be looked up from the value in driver_data. Adjust the get_value and get_enable functions to match the corresponding set_* functions. Signed-off-by: John Keeping <john@metanate.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: Convert users from dm_scan_fdt_node() to dm_scan_fdt_dev()Simon Glass2016-07-27-1/+1
| | | | | | | This new function is more convenient for callers, and handles pre-relocation situations automatically. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: Use uclass_first_device_err() where it is usefulSimon Glass2016-03-14-1/+1
| | | | | | Use this new function in places where it simplifies the code. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: power: Allow regulators to not implement all operationsSimon Glass2016-01-21-0/+2
| | | | | | | | Some regulators will not implement any operations (e.g. fixed regulators). This is not an error, so allow the autoset process to continue when one of these regulators is found. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: power: Tidy up debugging output and return valuesSimon Glass2016-01-21-1/+1
| | | | | | | | The currect PMIC debugging is a little confusing. Adjust it so that it is clear whether the operation succeeded or failed. Also, avoid creating a new error return value when a perfectly good one is already available. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: power: Allow regulators to be omitted from SPLSimon Glass2016-01-21-2/+11
| | | | | | | | For some boards the pmic interface is useful but the regulator interface (which comes with it) is too large. Allow them to be separated such that SPL can decide which it needs. Signed-off-by: Simon Glass <sjg@chromium.org>
* power: Add support for RK808 regulatorsSimon Glass2016-01-21-0/+311
| | | | | | | Add regulator support for the RK808 PMIC. It integrated 4 BUCKs and 8 LDOs all of which are supported by this driver. Signed-off-by: Simon Glass <sjg@chromium.org>
* power: regulator: max77686: Don't use switch() on boolsTom Rini2016-01-19-20/+8
| | | | | | | | | | | With gcc-5.3 we get a warning for using switch() on a bool type. Rewrite these sections as if/else and update the one section that was using 1/0 instead of true/false. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: regulator: add function device_get_supply_regulator()Przemyslaw Marczak2015-11-02-0/+7
| | | | | | | | | | | | Some devices are supplied by configurable regulator's output. But there was no function for getting it. This commit adds function, that allows for getting the supply device by it's phandle. The returned regulator device can be used with regulator uclass's API. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
* power: regulator: Add a driver for ACT8846 regulatorsSimon Glass2015-09-02-0/+165
| | | | | | | Add a full regulator driver for the ACT8846. This provides easy access to voltage and current settings for each regulator. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: pmic: max77686: Correct two typos in a commentSimon Glass2015-08-12-2/+2
| | | | | | These were pointed out in review but I missed them. Signed-off-by: Simon Glass <sjg@chromium.org>
* power: regulator: max77686 correct variable typePeng Fan2015-08-12-8/+8
| | | | | | | | | The return type of pmic_read and pmic_write is signed int, so correct variable 'ret' from type unsigned int to int. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Cc: Simon Glass <sjg@chromium.org> Cc: Przemyslaw Marczak <p.marczak@samsung.com>
* power: regulator: add pfuze100 supportPeng Fan2015-08-12-0/+577
| | | | | | | | | | | | | 1. Add new regulator driver pfuze100. * Introduce struct pfuze100_regulator_desc for maintaining info for one regulator. 2. Add new Kconfig entry DM_REGULATOR_PFUZE100 for pfuze100. 3. This driver intends to support PF100, PF200 and PF3000. 4. Add related macro definition in pfuze header file. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Cc: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org>
* power: regulator use node name when no regulator-namePeng Fan2015-08-12-1/+3
| | | | | | | | | If there is no property named 'regulator-name' for regulators, choose node name instead, but not directly return failure value. Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Cc: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org>
* dm: power: Don't return an error when regulators are not autosetSimon Glass2015-08-05-1/+3
| | | | | | | | | Not all regulators can be set up automatically. Adjust the code so that regulators_enable_boot_on() will return success when some are skipped. Only genuine errors are reported. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: pmic: max77686: Support all BUCK regulatorsSimon Glass2015-08-05-8/+10
| | | | | | | Add support for all BUCK regulators, now that the correct register is accessed for each. Signed-off-by: Simon Glass <sjg@chromium.org>
* dm: power: max77686: Correct BUCK register accessSimon Glass2015-08-05-3/+7
| | | | | | | | Some regulators use the wrong voltage register and thus it is not possible to control them. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: power: Add support for S5M8767 regulatorsSimon Glass2015-08-05-0/+279
| | | | | | | | | This PMIC is used with SoCs which need a combination of BUCKs and LDOs. The driver supports changing voltage and enabling/disabling each regulator. It supports the standard device tree binding and supports driver model. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: power: Add support for TPS65090 FETsSimon Glass2015-08-05-0/+149
| | | | | | | | | The TPS65090 has 7 FETs which are modelled as regulators. This allows them to be controlled by drivers easier, accessed through the 'regulator' command and used by other drivers. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: power: Use debug() for errors in regulator uclassSimon Glass2015-07-21-1/+1
| | | | | | | | | To reduce unnecessary code size in an uncommon code path, use debug() where possible(). The driver returns an error which indicates failure. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: power: Add a function to set up all regulatorsSimon Glass2015-07-21-0/+22
| | | | | | | | | The device tree provides information about which regulators should be on at boot, or always on. Use this to set them up automatically. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: pmic: Split output from functionSimon Glass2015-07-21-63/+35
| | | | | | | | | | | | | | | The regulator_autoset() function mixes printf() output and PMIC adjustment code. It provides a boolean to control the output. It is better to avoid missing logic and output, and this permits a smaller SPL code size. So split the output into a separate function. Also rename the function to have a by_name() suffix, since we would like to be able to pass a device when we know it, and thus avoid the name search. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* dm: power: Add regulator flags to centralise auto-set logicSimon Glass2015-07-21-0/+12
| | | | | | | | | Decide when the regulator is set up whether we want to auto-set the voltage or current. This avoids the complex logic spilling into the processing code. Signed-off-by: Simon Glass <sjg@chromium.org> Tested-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Przemyslaw Marczak <p.marczak@samsung.com>
* sandbox: add: sandbox PMIC device drivers: I2C emul, pmic, regulatorPrzemyslaw Marczak2015-05-14-0/+386
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds emulation of sandbox PMIC device, which includes: - PMIC I2C emulation driver - PMIC I/O driver (UCLASS_PMIC) - PMIC regulator driver (UCLASS_REGULATOR) The sandbox PMIC has 12 significant registers and 4 as padding to 16 bytes, which allows using 'i2c md' command with the default count (16). The sandbox PMIC provides regulators: - 2x BUCK - 2x LDO Each, with adjustable output: - Enable state - Voltage - Current limit (LDO1/BUCK1 only) - Operation mode (different for BUCK and LDO) Each attribute has it's own register, beside the enable state, which depends on operation mode. The header file: sandbox_pmic.h includes PMIC's default register values, which are set on i2c pmic emul driver's probe() method. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Tested on sandbox: Tested-by: Simon Glass <sjg@chromium.org>
* dm: regulator: uclass driver code cleanupPrzemyslaw Marczak2015-05-14-37/+69
| | | | | | | | | | | | | | | | | | | This cleanup includes: - remove of the preprocessor macros which pointed to long name functions - update of the names of some regulator uclass driver functions - cleanup of the function regulator_autoset() - reword of some comments of regulator uclass header file - regulator_get_by_platname: check error for uclass_find_* function calls - add function: regulator_name_is_unique - regulator post_bind(): check regulator name uniqueness - fix mistakes in: regulator/Kconfig - regulator.h: update comments - odroid u3: cleanup the regulator calls Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Simon Glass <sjg@chromium.org> Tested on sandbox: Tested-by: Simon Glass <sjg@chromium.org>
* dm: regulator: add fixed voltage regulator driverPrzemyslaw Marczak2015-05-14-0/+135
| | | | | | | | | | | | | | | | | | | | | | | | | This driver implements regulator operations for fixed Voltage/Current value regulators. beside the standard regulator constraints, which are put into the uclass platform data, a typical fixed regulator node provides few additional properties like: - gpio - gpio-open-drain - enable-active-high - startup-delay-us The only 'gpio' is used by this driver and is kept in structure of type 'fixed_regulator_platdata', as a device platform data (dev->platdata). The driver implements: - get_value - get_current - get_enable - set_enable The regulator calls and commands can be used for fixed-regulator devices, and the proper error will be returned for prohibited. Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: regulator: add max77686 regulator driverPrzemyslaw Marczak2015-05-14-0/+834
| | | | | | | | | | | | | | This commit adds support to MAX77686 regulator driver, based on a driver model regulator's API. It implements almost all regulator operations, beside those for setting and geting the Current value. For proper bind and operation it requires the MAX77686 PMIC driver. New file: drivers/power/regulator/max77686.c New config: CONFIG_DM_REGULATOR_MAX77686 Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Simon Glass <sjg@chromium.org>
* dm: regulator: add implementation of driver model regulator uclassPrzemyslaw Marczak2015-05-14-0/+325
This commit introduces the implementation of dm regulator API. Device tree support allows for auto binding. And by the basic uclass operations, it allows to driving the devices in a common way. For detailed informations, please look into the header file. Core files: - drivers/power/regulator-uclass.c - provides regulator common functions api - include/power/regulator.h - define all structures required by the regulator Changes: - new uclass-id: UCLASS_REGULATOR - new config: CONFIG_DM_REGULATOR Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Acked-by: Simon Glass <sjg@chromium.org>