aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator
AgeCommit message (Collapse)AuthorFilesLines
2015-08-29regulator: pfuze100: Remove unnecessary MODULE_ALIAS()Javier Martinez Canillas1-1/+0
The driver has a I2C device id table that is used to create the modaliases and also "pfuze100-regulator" is not a supported I2C id, so is never used. Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-28regulator: core: use debug level print in regulator_check_drmsArchit Taneja1-1/+1
When calling regulator_set_load, regulator_check_drms prints and returns an error if the regulator device's flag REGULATOR_CHANGE_DRMS isn't set. drms_uA_update, however, bails out without reporting an error. Replace the error print with a debug level print so that we don't get such prints when the underlying regulator doesn't support DRMS. Signed-off-by: Archit Taneja <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-25regulator: lp872x: handle error caseMilo Kim1-4/+7
If memory allocation gets failed on parsing the DT, then it returns error '-ENOMEM' explicitly. Then, the driver exists from the _probe(). Signed-off-by: Milo Kim <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-25regulator: lp872x: use the private data instead of updating I2C device ↵Milo Kim1-2/+5
platform data Currently, lp872x driver parses the DT and copies values into the 'cl->dev.platform_data' if 'of_node' exists. This may have architectural issue. Platform data is configurable through the DT or I2C board info inside the platform area. However, lp872x driver changes this configuration when it is loaded. The lp872x driver should get data from the platform side and use the private data, 'lp872x->pdata' instead of changing the original platform data. Signed-off-by: Milo Kim <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-25regulator: isl9305: Export OF module alias informationJavier Martinez Canillas1-0/+1
The I2C core always reports the MODALIAS uevent as "i2c:<modalias>" regardless of the mechanism that was used to register the device (i.e: OF or board code) and the table that is used later to match the driver with the device (i.e: I2C id table or OF match table). So drivers needs to export the I2C id table and this be built into the module or udev won't have the necessary information to autoload the needed driver module when the device is added. But this means that OF-only drivers needs to have both OF and I2C id tables that have to be kept in sync and also the dev node compatible manufacturer prefix is stripped when reporting the MODALIAS. Which can lead to issues if two vendors use the same I2C device name for example. To avoid the above, the I2C core behavior may be changed in the future to not require an SPI device table for OF-only drivers and report the OF module alias. So, it's better to also export the OF table even when is unused now to prevent breaking module loading when the core changes. Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-21regulators: max77693: register driver earlier to avoid deferred probeMarek Szyprowski1-1/+11
MAX77693 based regulators are used by USB gadget subsystem, which doesn't support deferred probe, so the driver should be registered before USB gadget drivers get probed. Signed-off-by: Marek Szyprowski <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-19regulator: qcom_smd: Set n_voltages for pm8941_lnldoAxel Lin1-0/+1
Just setting fixed_uV is not enough, the regulator core will also check n_voltages setting. The fixed_uV only works when n_voltages is 1. Signed-off-by: Axel Lin <[email protected]> Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-17regulator: core: Use IS_ERR_OR_NULL()Viresh Kumar1-1/+1
Use IS_ERR_OR_NULL() rather than open coding it. Signed-off-by: Viresh Kumar <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-17regulator: Regulator driver for the Qualcomm RPMBjorn Andersson3-0/+362
Driver for regulators exposed by the Resource Power Manager (RPM) found in devices based on Qualcomm 8974 and newer platforms. Signed-off-by: Bjorn Andersson <[email protected]> Acked-by: Andy Gross <[email protected]> Tested-by: Tim Bird <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-14regulator: core: Print at debug level on debugfs creation failureStephen Boyd1-1/+1
Failure to create a debugfs node is not an error, but we print a warning upon failure to create the node. Downgrade this to a debug printk so that we're quiet here. This allows multiple drivers to request a CPU's regulator so that CPUfreq and AVSish drivers can coexist. The downside of this approach is that whoever gets to debugfs first the others who come later to not have any debugfs attributes associated with them. Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-14regulator: pbias: Fix broken pbias disable functionalityKishon Vijay Abraham I1-0/+5
regulator_disable of pbias always writes '0' to the enable_reg. However actual disable value of pbias regulator is not always '0'. Fix it by populating the disable_val in pbias_reg_info for the various platforms and assign it to the disable_val of pbias regulator descriptor. This will be used by regulator_disable_regmap while disabling pbias regulator. Signed-off-by: Kishon Vijay Abraham I <[email protected]> Signed-off-by: Mark Brown <[email protected]> Cc: <[email protected]>
2015-08-13regulator: core: Spelling fixViresh Kumar1-1/+1
Trivial spell fix, s/succesfully/successfully. Signed-off-by: Viresh Kumar <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-12regulator: core: Use class device list for regulator_list in late initMark Brown1-51/+55
The regulator_list has exactly the same contents as the list that the driver core maintains of regulator_class members so is redundant. As a first step in converting over to use the class device list convert our iteration in late_initcall() to use the class device iterator. Signed-off-by: Mark Brown <[email protected]>
2015-08-12regulator: core: Move more deallocation into class unregisterMark Brown1-2/+3
We really ought to be using the class dvice lifetime management features more than we are rather than open coding them so take a step towards that by moving some of the simplest deallocations to the dev_release() function. Signed-off-by: Mark Brown <[email protected]>
2015-08-12regulator: core: Reduce rdev locking region when releasing regulatorMark Brown1-2/+3
When we release a regulator we need to remove references to it from the rdev which means locking the rdev. Currently we also free resources associated with the regulator inside the rdev lock but there is no need to do this, we can reduce the region the lock is held by restricting it to just actions that affect the rdev. Signed-off-by: Mark Brown <[email protected]>
2015-08-07regulator: core: Drop regulator_list_mutex when we're done with it on removeMark Brown1-1/+1
When removing a regulator we hold regulator_list_mutex in order to ensure the regualtor doesn't become removed again. However we only need to protect the list until we remove the regulator from the list so move the unlock earlier to reduce the locked region. Signed-off-by: Mark Brown <[email protected]>
2015-08-04regulator: axp20x: Add module aliasIan Campbell1-0/+1
This allows the module to be autoloaded. Together with 07949bf9c63c ("cpufreq: dt: allow driver to boot automatically") this is sufficient to allow a modular kernel (such as Debian's) to enable cpufreq on a Cubietruck. Signed-off-by: Ian Campbell <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-03regulator: mt6311: Trivial clean upAxel Lin1-7/+7
Make mt6311_buck_ops, mt6311_ldo_ops and mt6311_regulators const and remove unneeded error variable in mt6311_i2c_probe(). Signed-off-by: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-08-03regulator: mt6311: Modify the maximum voltage of buck.Henry Chen1-1/+1
The maximum voltage of buck should be 1.39375V. 1.39375V = 0.6V + 0.00625V * 127, 127 is the max_sel of linear range. Reported-by: Axel Lin <[email protected]> signed-off-by: Henry Chen <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-31regulator: fan53555: Export I2C module alias informationJavier Martinez Canillas1-0/+1
The I2C core always reports the MODALIAS uevent as "i2c:<client name" regardless if the driver was matched using the I2C id_table or the of_match_table. So the driver needs to export the I2C table and this be built into the module or udev won't have the necessary information to auto load the correct module when the device is added. Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-29regulator: max8973: Set VSEL regmap ops if DVS GPIO is not setMikko Perttunen1-0/+9
Use regmap helpers for get_voltage_sel and set_voltage_sel ops if the DVS GPIO is not set. The DVS GPIO allows on the fly selection of the VSEL register from two choices. However, if it is not set, the VSEL register will stay fixed and we can use the regmap ops. This allows use of the *hardware_vsel* regulator APIs. Signed-off-by: Mikko Perttunen <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-24regulator: qcom-spmi: Add vendor specific configurationStephen Boyd1-5/+195
Add support for over current protection (OCP), pin control selection, soft start strength, and auto-mode. Cc: <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-24Merge branch 'topic/ocp' of ↵Mark Brown2-0/+12
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-qcom-spmi
2015-07-24regulator: Add over current protection (OCP) supportStephen Boyd2-0/+12
Some regulators can automatically shut down when they detect an over current event. Add an op (set_over_current_protection) and a DT property + constraint to support this capability. Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-24Merge remote-tracking branches 'regulator/fix/88pm800', ↵Mark Brown4-7/+20
'regulator/fix/max8973', 'regulator/fix/s2mps11' and 'regulator/fix/supply' into regulator-linus
2015-07-24regulator: mt6311: Add support for mt6311 regulatorHenry Chen4-0/+255
Add regulator support for mt6311. It has 2 regulaotrs - Buck and LDO, provide the related buck/ldo voltage data to the driver, and creates the regulator_desc table. Supported operations for Buck are enabled/disabled and voltage change, only enabled/disabled for LDO. Signed-off-by: Henry Chen <[email protected]> Reviewed-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-23regulator: tps6586x: silence pointer-to-int-castDaniel Kurtz1-2/+2
of_regulator_match.driver_data is (void *). tps6586x uses it to store an anonymous enum value (those TPS6586X_ID_ values). Later, it tries to extract the ID by casting directly to an int, which is a no-no ([-Wpointer-to-int-cast]): drivers/regulator/tps6586x-regulator.c: In function 'tps6586x_parse_regulator_dt': drivers/regulator/tps6586x-regulator.c:430:8: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] id = (int)tps6586x_matches[i].driver_data; ^ Instead of casting to int, uintptr_t is better suited for receiving and comparing integers extracted from void *. This is especially true on 64-bit systems where sizeof(void *) != sizeof(int). Signed-off-by: Daniel Kurtz <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-21regulator: rk808: make better use of the gpiod APIUwe Kleine-König1-20/+12
The gpiod functions include variants for managed gpiod resources. Use it to simplify the remove function. As the driver handles a device node without a specification of dvs gpios just fine, additionally use the variant of gpiod_get exactly for this use case. This makes error checking more strict. As a third benefit this patch makes the driver use the flags parameter of gpiod_get* which will not be optional any more after 4.2 and so prevents a build failure when the respective gpiod commit is merged. Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-21regulator: rk808: add #include for gpiod functionsUwe Kleine-König1-0/+1
This fixes a build problem on mips found by the kbuild test robot: drivers/regulator/rk808-regulator.c: In function 'rk808_buck1_2_get_voltage_sel_regmap': drivers/regulator/rk808-regulator.c:97:2: error: implicit declaration of function 'gpiod_get_value' [-Werror=implicit-function-declaration] if (IS_ERR(gpio) || gpiod_get_value(gpio) == 0) ^ Fixes: bad47ad2eef3 ("regulator: rk808: fixed the overshoot when adjust voltage") Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-20regulator: rk808: fixed the overshoot when adjust voltageChris Zhong1-12/+207
There is a overshoot in DCDC1/DCDC2, we have 2 method to workaround: 1st is use dvs pin to switch the voltage between value in BUCKn_ON_VSEL and BUCKn_DVS_VSEL. If DVS pin is inactive, the voltage of DCDC1/DCDC2 are controlled by BUCKn_ON_VSEL, when we pull dvs1/dvs2 pin to active, they would be controlled by BUCKn_DVS_VSEL. In this case, the ramp rate is same as the value programmed in BUCKn_RATE, and the fastest rate is 10mv/us. 2nd method is gradual adjustment, adjust the voltage to a target value step by step via i2c, each step is set to 100 mA. If you write the voltage directly using an i2c write the rk808 will always ramp as fast as it possibly can, about 100mv/us. Signed-off-by: Chris Zhong <[email protected]> Reviewed-by: Doug Anderson <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-17Merge branch 'fix/88pm800' of ↵Mark Brown1-1/+1
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-88pm800 Conflicts: drivers/regulator/88pm800.c
2015-07-16regulator: Remove the max77843 driverKrzysztof Kozlowski3-212/+0
The max77693 regulator driver supports Maxim 77843 device so remove the max77843 driver. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-16regulator: max77693: Add support for MAX77843 deviceKrzysztof Kozlowski2-16/+117
The charger and safeout parts of MAX77843 are almost the same as MAX77693. From regulator point of view the only differences are the constraints and register values related to these constraints. Now the max77693 regulator driver can be used for MAX77843 device. Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-16drivers: max77843: Switch to common max77693 state containerKrzysztof Kozlowski1-2/+4
Switch to the same definition of state container as in MAX77693 drivers. This will allow usage of one regulator driver in both devices: MAX77693 and MAX77843. Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Lee Jones <[email protected]> Acked-by: Chanwoo Choi <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-16drivers: max77693: Move state container to common headerKrzysztof Kozlowski1-0/+1
This prepares for merging some of the drivers between max77693 and max77843 so the child MFD driver can be attached to any parent MFD main driver. Move the state container to common header file. Additionally add consistent 'i2c' prefixes to its members (of 'struct i2c_client' type). Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Sebastian Reichel <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Lee Jones <[email protected]> Acked-by: Chanwoo Choi <[email protected]> Acked-by: Jacek Anaszewski <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-16regulator: max77693: Support different register configurationsKrzysztof Kozlowski1-12/+27
Add support for different configurations of charger's registers so the same driver could be used on other devices (e.g. MAX77843). Signed-off-by: Krzysztof Kozlowski <[email protected]> Acked-by: Mark Brown <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-16regulator: core: Fix memory leak in regulator_resolve_supply()Javier Martinez Canillas1-1/+5
The regulator_resolve_supply() function calls set_supply() which in turn calls create_regulator() to allocate a supply regulator. If an error occurs after set_supply() succeeded, the allocated regulator has to be freed before propagating the error code. Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-16regulator: core: Increase refcount for regulator supply's moduleJavier Martinez Canillas1-0/+3
When a regulator is unregistered with regulator_unregister(), a call to regulator_put() is made for its input supply if there is one. This does a module_put() to decrement the refcount of the module that owns the supply but there isn't a corresponding try_module_get() in set_supply() to make the calls balanced. Signed-off-by: Javier Martinez Canillas <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-16regulator: 88pm800: Use regulator_nodes/of_match in the descriptorVaibhav Hiremath1-99/+44
This patch is add regulator_nodes/of_match in the regulator descriptor for using information from DT instead of specific codes. With this patch, driver gets simplified, - No need to maintain "struct of_regulator_match" table and call of_regulator_match() fn. - No need for pm800_regulator_dt_init() fn, as it was only used for of_regulator_match(). - probe() fn got simplified around regulator_config and regulator_desc initialization. Signed-off-by: Vaibhav Hiremath <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-16regulator: 88pm800: Update driver to use devm_regulator_register fnVaibhav Hiremath1-21/+6
This patch replaces standard regulator_register with devm_regulator_register() fn, as using devm_regulator_register() fn simplifies the driver return/exit path. As part of this update, patch also cleanups up all unnecessary changes which is result of this patch - - Remove _remove() fn, as devm_ variant takes care of it. - Remove pm800_regulators.regulators[] field, as it was only needed during cleanup, so we no longer need this. This also saved some amount of memory. Signed-off-by: Vaibhav Hiremath <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-16regulator: 88pm800: Fix indentation of assignments of data structuresVaibhav Hiremath1-34/+34
This patch makes code more clean from readability point of view, make all assignments of LDO, BUCk and regulator_ops structure at the same indentation. Signed-off-by: Vaibhav Hiremath <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-15regulator: core: Handle full constraints systems when resolving suppliesMark Brown1-3/+7
When resolving device supplies if we fail to look up the regulator we substitute in the dummy supply instead if the system has fully specified constraints. When resolving supplies for regulators we do not have the equivalent code and instead just directly use the regulator_dev_lookup() result causing spurious failures. This does not affect DT systems since we are able to detect missing mappings directly as part of regulator_dev_lookup() and so have appropriate handling in the DT specific code. Reported-by: Christian Hartmann <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-14regulator: drivers: Drop owner assignment from i2c_driverKrzysztof Kozlowski16-16/+0
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-14regulator: da9062: Drop owner assignment from platform_driverKrzysztof Kozlowski1-1/+0
platform_driver does not need to set an owner because platform_driver_register() will set it. Signed-off-by: Krzysztof Kozlowski <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-13regulator: da9211: support da9215James Ban3-23/+41
This is a patch for supporting da9215 buck converter. Signed-off-by: James Ban <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-13regulator: da9210: Add optional interrupt supportGeert Uytterhoeven1-0/+75
Add optional interrupt support to the da9210 regulator driver, to handle over-current, under- and over-voltage, and over-temperature events. Only the interrupt sources for which we handle events are unmasked, to avoid interrupts we cannot handle. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-10regulator: pwm-regulator: Fix ' comparison between signed and unsigned ↵Lee Jones1-1/+1
integer' warning drivers/regulator/pwm-regulator.c: In function ‘pwm_regulator_init_table’: drivers/regulator/pwm-regulator.c:171:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Lee Jones <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-10regulator: pwm-regulator: Fix 'used uninitialized' warningLee Jones1-1/+1
drivers/regulator/pwm-regulator.c: In function 'pwm_regulator_init_table': drivers/regulator/pwm-regulator.c:172:14: warning: 'length' is used uninitialized in this function [-Wuninitialized] if ((length < sizeof(*duty_cycle_table)) || ^ Reported-by: kbuild test robot <[email protected]> Signed-off-by: Lee Jones <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-10regulator: pwm-regulator: Fix 'unused-variable' warningLee Jones1-2/+0
drivers/regulator/pwm-regulator.c: In function 'pwm_regulator_init_continuous': drivers/regulator/pwm-regulator.c:202:22: warning: unused variable 'np' [-Wunused-variable] struct device_node *np = pdev->dev.of_node; ^ Reported-by: kbuild test robot <[email protected]> Signed-off-by: Lee Jones <[email protected]> Signed-off-by: Mark Brown <[email protected]>
2015-07-09regulator: 88pm800: fix LDO vsel_mask valueYi Zhang1-1/+1
As per datasheet, Except LDO2, all other LDO's use bit [3:0] for VOUT select. Current code uses wrong mask value of 0x1f, So this patch fixes it to use 0xf. Signed-off-by: Yi Zhang <[email protected]> [[email protected]: Updated changelog with more detailed description] Signed-off-by: Vaibhav Hiremath <[email protected]> Signed-off-by: Mark Brown <[email protected]>