summaryrefslogtreecommitdiff
path: root/drivers/regulator (unfollow)
Commit message (Collapse)Author
2021-07-20regulator: da9052: Ensure enough delay time for .set_voltage_time_selAxel Lin
[ Upstream commit a336dc8f683e5be794186b5643cd34cb28dd2c53 ] Use DIV_ROUND_UP to prevent truncation by integer division issue. This ensures we return enough delay time. Also fix returning negative value when new_sel < old_sel. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20210618141412.4014912-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-03-03regulator: axp20x: Fix reference cout leakPan Bian
[ Upstream commit e78bf6be7edaacb39778f3a89416caddfc6c6d70 ] Decrements the reference count of device node and its child node. Fixes: dfe7a1b058bb ("regulator: AXP20x: Add support for regulators subsystem") Signed-off-by: Pan Bian <bianpan2016@163.com> Link: https://lore.kernel.org/r/20210120123313.107640-1-bianpan2016@163.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-11-24regulator: ti-abb: Fix array out of bound read access on the first transitionNishanth Menon
[ Upstream commit 2ba546ebe0ce2af47833d8912ced9b4a579f13cb ] At the start of driver initialization, we do not know what bias setting the bootloader has configured the system for and we only know for certain the very first time we do a transition. However, since the initial value of the comparison index is -EINVAL, this negative value results in an array out of bound access on the very first transition. Since we don't know what the setting is, we just set the bias configuration as there is nothing to compare against. This prevents the array out of bound access. NOTE: Even though we could use a more relaxed check of "< 0" the only valid values(ignoring cosmic ray induced bitflips) are -EINVAL, 0+. Fixes: 40b1936efebd ("regulator: Introduce TI Adaptive Body Bias(ABB) on-chip LDO driver") Link: https://lore.kernel.org/linux-mm/CA+G9fYuk4imvhyCN7D7T6PMDH6oNp6HDCRiTUKMQ6QXXjBa4ag@mail.gmail.com/ Reported-by: Naresh Kamboju <naresh.kamboju@linaro.org> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Nishanth Menon <nm@ti.com> Link: https://lore.kernel.org/r/20201118145009.10492-1-nm@ti.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-07-23Revert "regulator: qpnp-lcdb: Fix boolean check in qpnp_lcdb_init_bst"Michael Bestas
This reverts commit f59da8d5184939b7e5e994be68cf6d1f3fb9ec2e.
2020-05-21kernel: Fix build errors with LLVMSwetha Chikkaboraiah
This patch intends to fix compilation errors while building kernel with LLVM toolchain. Change-Id: I76c4f97d8a0efb44434d54fb07cae23b050d2003 Signed-off-by: Swetha Chikkaboraiah <schikk@codeaurora.org>
2020-05-10regulator: core: Rely on regulator_dev_release to free constraintsCharles Keepax
commit 6333ef46bbe514a8ece6c432aab6bcf8637b2d7c upstream. As we now free the constraints in regulator_dev_release we will still call free on the constraints pointer even if we went down an error path in regulator_register, because it is only allocated after the device_register. As such we no longer need to free rdev->constraints on the error paths, so this patch removes said frees. Fixes: 29f5f4860a8e ("regulator: core: Move more deallocation into class unregister") Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-02-28regulator: rk808: Lower log level on optional GPIOs being not availableMiquel Raynal
[ Upstream commit b8a039d37792067c1a380dc710361905724b9b2f ] RK808 can leverage a couple of GPIOs to tweak the ramp rate during DVS (Dynamic Voltage Scaling). These GPIOs are entirely optional but a dev_warn() appeared when cleaning this driver to use a more up-to-date gpiod API. At least reduce the log level to 'info' as it is totally fine to not populate these GPIO on a hardware design. This change is trivial but it is worth not polluting the logs during bringup phase by having real warnings and errors sorted out correctly. Fixes: a13eaf02e2d6 ("regulator: rk808: make better use of the gpiod API") Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20191203164709.11127-1-miquel.raynal@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-02-02regulator: qpnp-lcdb: Fix boolean check in qpnp_lcdb_init_bstNathan Chancellor
Clang warns: ../drivers/regulator/qpnp-lcdb-regulator.c:1675:17: warning: address of 'lcdb->bst.ps' will always evaluate to 'true' [-Wpointer-bool-conversion] &lcdb->bst.ps ? EN_PS_BIT : 0); ~~~~~~~~~~^~ ~ 1 warning generated. This matches msm-4.14. Fixes: 6da3d343b0e2 ("regulator: qpnp-lcdb: Add the QPNP LCDB regulator driver") Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2020-01-29regulator: wm831x-dcdc: Fix list of wm831x_dcdc_ilim from mA to uAAxel Lin
[ Upstream commit c25d47888f0fb3d836d68322d4aea2caf31a75a6 ] The wm831x_dcdc_ilim entries needs to be uA because it is used to compare with min_uA and max_uA. While at it also make the array const and change to use unsigned int. Fixes: e4ee831f949a ("regulator: Add WM831x DC-DC buck convertor support") Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-12regulator: rn5t618: fix module aliasesAndreas Kemnade
[ Upstream commit 62a1923cc8fe095912e6213ed5de27abbf1de77e ] platform device aliases were missing, preventing autoloading of module. Fixes: 811b700630ff ("regulator: rn5t618: add driver for Ricoh RN5T618 regulators") Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Link: https://lore.kernel.org/r/20191211221600.29438-1-andreas@kemnade.info Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-04regulator: max8907: Fix the usage of uninitialized variable in ↵Yizhuo
max8907_regulator_probe() [ Upstream commit 472b39c3d1bba0616eb0e9a8fa3ad0f56927c7d7 ] Inside function max8907_regulator_probe(), variable val could be uninitialized if regmap_read() fails. However, val is used later in the if statement to decide the content written to "pmic", which is potentially unsafe. Signed-off-by: Yizhuo <yzhai003@ucr.edu> Link: https://lore.kernel.org/r/20191003175813.16415-1-yzhai003@ucr.edu Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-05regulator: tps65910: fix a missing check of return valueKangjie Lu
[ Upstream commit cd07e3701fa6a4c68f8493ee1d12caa18d46ec6a ] tps65910_reg_set_bits() may fail. The fix checks if it fails, and if so, returns with its error code. Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-12-05drivers/regulator: fix a missing check of return valueKangjie Lu
[ Upstream commit 966e927bf8cc6a44f8b72582a1d6d3ffc73b12ad ] If palmas_smps_read() fails, we should not use the read data in "reg" which may contain random value. The fix inserts a check for the return value of palmas_smps_read(): If it fails, we return the error code upstream and stop using "reg". Signed-off-by: Kangjie Lu <kjlu@umn.edu> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-11-10regulator: pfuze100-regulator: Variable "val" in pfuze100_regulator_probe() ↵Yizhuo
could be uninitialized [ Upstream commit 1252b283141f03c3dffd139292c862cae10e174d ] In function pfuze100_regulator_probe(), variable "val" could be initialized if regmap_read() fails. However, "val" is used to decide the control flow later in the if statement, which is potentially unsafe. Signed-off-by: Yizhuo <yzhai003@ucr.edu> Link: https://lore.kernel.org/r/20190929170957.14775-1-yzhai003@ucr.edu Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-11-10regulator: ti-abb: Fix timeout in ti_abb_wait_txdone/ti_abb_clear_all_txdoneAxel Lin
[ Upstream commit f64db548799e0330897c3203680c2ee795ade518 ] ti_abb_wait_txdone() may return -ETIMEDOUT when ti_abb_check_txdone() returns true in the latest iteration of the while loop because the timeout value is abb->settling_time + 1. Similarly, ti_abb_clear_all_txdone() may return -ETIMEDOUT when ti_abb_check_txdone() returns false in the latest iteration of the while loop. Fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Nishanth Menon <nm@ti.com> Link: https://lore.kernel.org/r/20190929095848.21960-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-08-04regulator: s2mps11: Fix buck7 and buck8 wrong voltagesKrzysztof Kozlowski
commit 16da0eb5ab6ef2dd1d33431199126e63db9997cc upstream. On S2MPS11 device, the buck7 and buck8 regulator voltages start at 750 mV, not 600 mV. Using wrong minimal value caused shifting of these regulator values by 150 mV (e.g. buck7 usually configured to v1.35 V was reported as 1.2 V). On most of the boards these regulators are left in default state so this was only affecting reported voltage. However if any driver wanted to change them, then effectively it would set voltage 150 mV higher than intended. Cc: <stable@vger.kernel.org> Fixes: cb74685ecb39 ("regulator: s2mps11: Add samsung s2mps11 regulator driver") Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-27regulator: act8865: Fix act8600_sudcdc_voltage_ranges settingAxel Lin
[ Upstream commit f01a7beb6791f1c419424c1a6958b7d0a289c974 ] The act8600_sudcdc_voltage_ranges setting does not match the datasheet. The problems in below entry: REGULATOR_LINEAR_RANGE(19000000, 191, 255, 400000), 1. The off-by-one min_sel causes wrong volatage calculation. The min_sel should be 192. 2. According to the datasheet[1] Table 7. (on page 43): The selector 248 (0b11111000) ~ 255 (0b11111111) are 41.400V. Also fix off-by-one for ACT8600_SUDCDC_VOLTAGE_NUM. [1] https://active-semi.com/wp-content/uploads/ACT8600_Datasheet.pdf Fixes: df3a950e4e73 ("regulator: act8865: Add act8600 support") Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-03-23regulator: s2mpa01: Fix step values for some LDOsStuart Menefy
commit 28c4f730d2a44f2591cb104091da29a38dac49fe upstream. The step values for some of the LDOs appears to be incorrect, resulting in incorrect voltages (or at least, ones which are different from the Samsung 3.4 vendor kernel). Signed-off-by: Stuart Menefy <stuart.menefy@mathembedded.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-23regulator: s2mps11: Fix steps for buck7, buck8 and LDO35Krzysztof Kozlowski
commit 56b5d4ea778c1b0989c5cdb5406d4a488144c416 upstream. LDO35 uses 25 mV step, not 50 mV. Bucks 7 and 8 use 12.5 mV step instead of 6.25 mV. Wrong step caused over-voltage (LDO35) or under-voltage (buck7 and 8) if regulators were used (e.g. on Exynos5420 Arndale Octa board). Cc: <stable@vger.kernel.org> Fixes: cb74685ecb39 ("regulator: s2mps11: Add samsung s2mps11 regulator driver") Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-15regulator: qpnp-labibb: Don't handle LAB_VREG_OK in TTW mode for pmi8998Subbaraman Narayanamurthy
Currently for pmi8998, LAB_VREG_OK interrupt is handled to switch from PWM to PFM mode after a certain delay to improve efficiency. Also, PFM mode is kept disabled once the regulator is disabled. As per the hardware recommendation, keeping LAB in PWM mode is sufficient in particular when TTW mode is enabled. Hence do not register for LAB_VREG_OK interrupt in TTW mode so that this PWM <-> PFM mode transition will not be done. CRs-Fixed: 2179209 Change-Id: I499740d014a45e02b802d350248f8044a5b6596b Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org> Signed-off-by: Shilpa Suresh <sbsure@codeaurora.org>
2019-02-15regulator: qpnp-labibb: Add sysfs class to enable/disable the irqKiran Gunda
LAB/IBB interrupts need to be disabled and enabled during the entry and exit of the secure display use case respectively. Add sysfs property to allow the userspace to perform this operation To disable the interrupts: echo 1 > /sys/class/lcd_bias/secure_mode To enable the interrupts: echo 0 > /sys/class/lcd_bias/secure_mode Change-Id: Iddd5630c0ff6d3191f2cc0d45bd4e72b938728b0 Signed-off-by: Kiran Gunda <kgunda@codeaurora.org> Signed-off-by: Shilpa Suresh <sbsure@codeaurora.org>
2019-02-15regulator: qpnp-labibb: add TTW support for pmi8998Subbaraman Narayanamurthy
Add Tap To Wake (TTW) support for pmi8998 with the required configuration per the hardware documentation. CRs-Fixed: 2112943 Change-Id: Id733e16108d98efc6614e0f9eed3e11f677855e0 Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org> Signed-off-by: Shilpa Suresh <sbsure@codeaurora.org>
2018-09-11ARM: dts: msm: Add CPR support for SDM630 speed-bin 3Anirudh Ghayal
Add the CPR configuration of Speed-bin 3 for the power and performance cluster of SDM630. Change-Id: I6bf9a837ae941cf3ad9413da6e44821916acf197 Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
2018-08-06regulator: pfuze100: add .is_enable() for pfuze100_swb_regulator_opsAnson Huang
[ Upstream commit 0b01fd3d40fe6402e5fa3b491ef23109feb1aaa5 ] If is_enabled() is not defined, regulator core will assume this regulator is already enabled, then it can NOT be really enabled after disabled. Based on Li Jun's patch from the NXP kernel tree. Signed-off-by: Anson Huang <Anson.Huang@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-05regulator: qpnp-lcdb: Disable the SC irq only for PM660L V1.1 and belowKiran Gunda
PM660L v2.0 has the NCP power-on issue fixed. This allows enabling the short-circuit IRQ. Enable the same. Change-Id: I4c0523ef8c46dd9bac190d4ad69190ef777ef14b Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2018-06-22regulator: cpr3-hmss: Modify suspend/resume opsAtul Raut
Use device suspend/resume ops rather than platform device suspend/resume ops for cpr3-hmss and cpr3-mmss. Change-Id: I8e01ac3571760dbaa3b7eb410d7c0753a8217e4f Signed-off-by: Atul Raut <araut@codeaurora.org>
2018-05-30regulator: of: Add a missing 'of_node_put()' in an error handling path of ↵Christophe JAILLET
'of_regulator_match()' [ Upstream commit 30966861a7a2051457be8c49466887d78cc47e97 ] If an unlikely failure in 'of_get_regulator_init_data()' occurs, we must release the reference on the current 'child' node before returning. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-14regulator: cprh-kbss: Add speed-bin 4 support for sdm660Tirupathi Reddy
Update fuse combo count supported for sdm660 to 40. Change-Id: I9ee2c15792c3f006db5969be42bce19a4ebc180c Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2018-03-24regulator: anatop: set default voltage selector for pcieDong Aisheng
[ Upstream commit 9bf944548169f6153c3d3778cf983cb5db251a0e ] Set the initial voltage selector for vddpcie in case it's disabled by default. This fixes the below warning: 20c8000.anatop:regulator-vddpcie: Failed to read a valid default voltage selector. anatop_regulator: probe of 20c8000.anatop:regulator-vddpcie failed with error -22 Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Shawn Guo <shawnguo@kernel.org> Cc: Sascha Hauer <kernel@pengutronix.de> Cc: Robin Gong <yibin.gong@nxp.com> Cc: Richard Zhu <hongxing.zhu@nxp.com> Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-03-14regulator: kryo: fix return value for regulator_disableTirupathi Reddy
Remove uninitialized variable and return value 0 from regulator_disable(). Change-Id: I920819fbce14d1c6d5f7afac577002aa25b66a05 Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2017-11-02regulator: fan53555: fix I2C device idsGuillaume Tucker
commit fc1111b885437f374ed54aadda44d8b241ebd2a3 upstream. The device tree nodes all correctly describe the regulators as syr827 or syr828, but the I2C device id is currently set to the wildcard value of syr82x in the driver. This causes udev to fail to match the driver module with the modalias data from sysfs. Fix this by replacing the I2C device ids with ones that match the device tree descriptions, with syr827 and syr828. Tested on Firefly rk3288 board. The syr82x id was not used anywhere. Fixes: e80c47bd738b (regulator: fan53555: Export I2C module alias information) Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-02regulator: qpnp: fix voltage min/max constraints checkTirupathi Reddy
Fix voltage range selection logic used for voltage min/max constraints check. CRs-Fixed: 2136747 Change-Id: I80ab9ca583fda625ae2d9bd9e0c176a4b8c343db Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2017-10-24regulator: qpnp-labibb: Allow 0 ms for IBB PWRUP_DLY1 and PWRDN_DLY2Subbaraman Narayanamurthy
Currently, IBB PWRUP_DLY1 and PWRDN_DLY2 settings are configured only for values greater than 0. However, 0 ms (no delay) can be allowed by disabling EN_PWRUP_DLY1 or EN_PWRDN_DLY2 bits. Add support to allow this configuration. CRs-Fixed: 2125062 Change-Id: I8ef3b5522b8d4db6befb3fb1c2e58ea24c0f5ea0 Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2017-10-24regulator: qpnp-labibb: Fix LAB PS_CTL configuration for pmi8998Subbaraman Narayanamurthy
PMI8998 LAB pulse skip configuration is different from PMI8996 and earlier PMICs. Fix it by using the right configuration API to configure LAB PS_CTL along with supporting PM660A properly. Since the existing LAB PS configuration threshold for pmi8998 is incorrect in device tree, update it along with this change. Change-Id: I2686733867ec3e2909d0c071a5881d3d824c713e Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
2017-08-23ARM: dts: msm: Add speed-bin 3 for sdm660Tirupathi Reddy
Add speed-bin 3 support in cpr3 driver and device nodes for sdm660. CRs-Fixed: 2099889 Change-Id: Ied0da8ea6f9d787d0021716566080c37881b9558 Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2017-08-12regulator: qpnp-lcdb: Add headroom voltage for boostKiran Gunda
Increase the boost headroom to 200mV. Also add a device tree property to make the headroom configurable. Change-Id: Ibc932f191e64824ba948153a7ae80f109ffcdff9 Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2017-07-06regulator: core: fix a possible race in disable_work handlingTirupathi Reddy
A race condition between queueing and processing the disable_work instances results in having a work instance in the queue and the deferred_disables variable of regulator device structure having a value '0'. If no new regulator_disable_deferred() call later from clients, the deferred_disables variable value remains '0' and hits BUG() in regulator_disable_work() when the queued instance scheduled for processing the work. The race occurs as below: Core-0 Core-1 ..... /* deferred_disables = 2 */ ..... ..... /* disable_work is queued */ ..... ..... ..... regulator_disable_deferred: regulator_disable_work: mutex_lock(&rdev->mutex); ..... rdev->deferred_disables++; mutex_lock(&rdev->mutex); mutex_unlock(&rdev->mutex); ..... queue_delayed_work(...) count =rdev->deferred_disables; ..... rdev->deferred_disables = 0; ..... ..... ..... mutex_unlock(&rdev->mutex); ..... ..... ..... return; ..... ..... /* No new regulator_disable_deferred() calls from clients */ /* The newly queued instance is scheduled for processing */ ..... ..... regulator_disable_work: ..... mutex_lock(&rdev->mutex); BUG_ON(!rdev->deferred_disables); /* deferred_disables = 0 */ The race is fixed by removing the work instance that is queued while processing the previous queued instance. Cancel the newly queued instance from disable_work() handler just after reset the deferred_disables variable to value '0'. Also move the work queueing step before mutex_unlock in regulator_disable_deferred(). Also use mod_delayed_work() in the pace of queue_delayed_work() as queue_delayed_work() always uses the delay requested in the first call when multiple consumers call regulator_disable_deferred() close in time and does not guarantee the semantics of regulator_disable_deferred(). CRs-Fixed: 2064610 Change-Id: Iacaddc5e2f5c9998c4d038bdc10c4587cbf4812e Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2017-07-03regulator: core: remove some dead codeDan Carpenter
Originally queue_delayed_work() used to negative error codes or 0 and 1 on success depending if the work was queued or not. It caused a lot of bugs where people treated all non-zero returns as failures so we changed it to return bool instead in d4283e937861 ('workqueue: make queueing functions return bool'). Now it never returns failure. Checking for negative values causes a static checker warning since it is impossible based on the bool type. Change-Id: I49c875e09534795a8d5176773eb497f5404fcbe3 Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2017-06-16regulator: max20010: Add max20010 regulator driverTirupathi Reddy
The max20010 external buck supplies VDD_GFX for msm8996-auto boards. Add max20010 regulator device driver to program the necessary configuration as per the board specific requirements. CRs-Fixed: 2062515 Change-Id: I68ad73e0c7cff1a87d218dc4677801f9e0206db6 Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2017-06-05regulator: spm: check min/max voltages against HW configurationTirupathi Reddy
Regulator HW has the programmable voltage upper and lower limit registers and doesn't allow voltage set points outside the pre- configured voltage limits. Add a check in driver that throws an error if the SW specified voltage range is not within the pre- configured limits in HW. CRs-Fixed: 2044789 Change-Id: I3593ebf8e88824a0cfcb068686673a00051a11f0 Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2017-06-05regulator: spm-regulator: Add support for FTS426 type regulatorsTirupathi Reddy
Add support for PMIC FTSMPS 426 type regulators. These have a 4 mV step size and a voltage control scheme consisting of two 8-bit registers defining a 16-bit voltage set point in units of millivolts. Also address the mode register configuration differences between FTSMPS 426 type regulators and other regulators supported in spm-regulator driver file. CRs-Fixed: 2037603 Change-Id: Ide54c8c9dd8113ab4588979ec97915403b3ecab1 Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2017-06-05regulator: rpm-smd-regulator: add support for load based mode controlDavid Collins
Add support to request PWM or AUTO mode for BoB and SMPS type regulators based upon the aggregated consumer load current. This can be used in cases where a consumer needs to force PWM mode operation. CRs-Fixed: 2054771 Change-Id: Iaf4353fb60468c91f958a968d844b3c1c012e54c Signed-off-by: David Collins <collinsd@codeaurora.org> Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2017-05-31drivers: Warning fixes to disable CC_OPTIMIZE_FOR_SIZEPrasad Sodagudi
These are all driver changes needed for disablement of CONFIG_CC_OPTIMIZE_FOR_SIZE. CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE is enabled by default once CONFIG_CC_OPTIMIZE_FOR_SIZE is disabled. Change-Id: Ia46a1f24e8a082a29ea6151e41e6d3a85a05fd4f Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org> Signed-off-by: Sridhar Parasuram <sridhar@codeaurora.org>
2017-05-29regulator: qpnp: check min/max voltages against HW configurationTirupathi Reddy
Regulator HW has the programmable voltage upper and lower limit registers and doesn't allow voltage set points outside the pre- configured voltage limits. Add a check in driver that throws an error if the SW specified voltage range is not within the pre- configured limits in HW. CRs-Fixed: 2044789 Change-Id: I3ab791af3148b761cc5eec626bac8167ce11939d Signed-off-by: Tirupathi Reddy <tirupath@codeaurora.org>
2017-05-25regulator: tps65023: Fix inverted core enable logic.Richard Cochran
commit c90722b54a4f5e21ac59301ed9a6dbaa439bdb16 upstream. Commit 43530b69d758328d3ffe6ab98fd640463e8e3667 ("regulator: Use regmap_read/write(), regmap_update_bits functions directly") intended to replace working inline helper functions with standard regmap calls. However, it also inverted the set/clear logic of the "CORE ADJ Allowed" bit. That patch was clearly never tested, since without that bit cleared, the core VDCDC1 voltage output does not react to I2C configuration changes. This patch fixes the issue by clearing the bit as in the original, correct implementation. Note for stable back porting that, due to subsequent driver churn, this patch will not apply on every kernel version. Fixes: 43530b69d758 ("regulator: Use regmap_read/write(), regmap_update_bits functions directly") Signed-off-by: Richard Cochran <rcochran@linutronix.de> Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-23regulator: qpnp-labibb-regulator: Restart LAB/IBB after SC faultFenglin Wu
PBS will be triggered in PMIC hardware to disable LAB/IBB regulators when a SC(short circuit) error is happened. The regulators won't be restart in hardware and they will be kept disabled always after that. Restart LAB/IBB regulator in the software if SC IRQ is detected, but stop doing this if the SC IRQ had fired frequently. CRs-Fixed: 2002373 Change-Id: I5db2b70999d043395e070bc9d61015477455cce9 Signed-off-by: Fenglin Wu <fenglinw@codeaurora.org>
2017-05-04regulator: onsemi-ncp6335d: Add is_enabled API supportKiran Gunda
Without is_enabled function support, regualtor framework treats it as an always on regulator and does not invoke the regulator enable function call. Hence, add support for it. Also, define a parent supply ("vin") for the regulator. This parent can be used to pin-control the regulator. While at it, change the initcall level to subsys_init. so that the driver registers after the parent supply ("vin" - provided by fixed-regualtor). Change-Id: I93e870d2e4b89f7874c3e17be91bc417dadf1777 Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2017-05-03regulator: onsemi-ncp6335d: Fix compilation issuesKiran Gunda
Fix the compilation issue seen due to the regulator framework changes from 3.10 to 4.4 kernel. Also remove the redundant error messages during the memory allocation failures. Change-Id: I4887c2d3acaff562fb41e6c2eaeb2c1ef2c1bde5 Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2017-05-03drivers: regulator: Add snapshot of OnSemi NCP6335D regulatorAnirudh Ghayal
This is snapshot of the OnSemi NCP6335D driver as of msm-3.10 'commit 156ba1726643 ("regulator: onsemi-ncp6335d: Add i2c retry logic")'. Change-Id: I4cf0acd272fcf498462d4397385cd62f144eadf8 Signed-off-by: Kiran Gunda <kgunda@codeaurora.org>
2017-05-02regulator: core: Clear the supply pointer if enabling failsJon Hunter
commit 8e5356a73604f53da6a1e0756727cb8f9f7bba17 upstream. During the resolution of a regulator's supply, we may attempt to enable the supply if the regulator itself is already enabled. If enabling the supply fails, then we will call _regulator_put() for the supply. However, the pointer to the supply has not been cleared for the regulator and this will cause a crash if we then unregister the regulator and attempt to call regulator_put() a second time for the supply. Fix this by clearing the supply pointer if enabling the supply after fails when resolving the supply for a regulator. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>