summaryrefslogtreecommitdiff
path: root/drivers/regulator
AgeCommit message (Collapse)Author
2019-09-17Merge tag 'leds-for-5.4-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds Pull LED updates from Jacek Anaszewski: "In this cycle we've finally managed to contribute the patch set sorting out LED naming issues. Besides that there are many changes scattered among various LED class drivers and triggers. LED naming related improvements: - add new 'function' and 'color' fwnode properties and deprecate 'label' property which has been frequently abused for conveying vendor specific names that have been available in sysfs anyway - introduce a set of standard LED_FUNCTION* definitions - introduce a set of standard LED_COLOR_ID* definitions - add a new {devm_}led_classdev_register_ext() API with the capability of automatic LED name composition basing on the properties available in the passed fwnode; the function is backwards compatible in a sense that it uses 'label' data, if present in the fwnode, for creating LED name - add tools/leds/get_led_device_info.sh script for retrieving LED vendor, product and bus names, if applicable; it also performs basic validation of an LED name - update following drivers and their DT bindings to use the new LED registration API: - leds-an30259a, leds-gpio, leds-as3645a, leds-aat1290, leds-cr0014114, leds-lm3601x, leds-lm3692x, leds-lp8860, leds-lt3593, leds-sc27xx-blt Other LED class improvements: - replace {devm_}led_classdev_register() macros with inlines - allow to call led_classdev_unregister() unconditionally - switch to use fwnode instead of be stuck with OF one LED triggers improvements: - led-triggers: - fix dereferencing of null pointer - fix a memory leak bug - ledtrig-gpio: - GPIO 0 is valid Drop superseeded apu2/3 support from leds-apu since for apu2+ a newer, more complete driver exists, based on a generic driver for the AMD SOCs gpio-controller, supporting LEDs as well other devices: - drop profile field from priv data - drop iosize field from priv data - drop enum_apu_led_platform_types - drop superseeded apu2/3 led support - add pr_fmt prefix for better log output - fix error message on probing failure Other misc fixes and improvements to existing LED class drivers: - leds-ns2, leds-max77650: - add of_node_put() before return - leds-pwm, leds-is31fl32xx: - use struct_size() helper - leds-lm3697, leds-lm36274, leds-lm3532: - switch to use fwnode_property_count_uXX() - leds-lm3532: - fix brightness control for i2c mode - change the define for the fs current register - fixes for the driver for stability - add full scale current configuration - dt: Add property for full scale current. - avoid potentially unpaired regulator calls - move static keyword to the front of declarations - fix optional led-max-microamp prop error handling - leds-max77650: - add of_node_put() before return - add MODULE_ALIAS() - Switch to fwnode property API - leds-as3645a: - fix misuse of strlcpy - leds-netxbig: - add of_node_put() in netxbig_leds_get_of_pdata() - remove legacy board-file support - leds-is31fl319x: - simplify getting the adapter of a client - leds-ti-lmu-common: - fix coccinelle issue - move static keyword to the front of declaration - leds-syscon: - use resource managed variant of device register - leds-ktd2692: - fix a typo in the name of a constant - leds-lp5562: - allow firmware files up to the maximum length - leds-an30259a: - fix typo - leds-pca953x: - include the right header" * tag 'leds-for-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds: (72 commits) leds: lm3532: Fix optional led-max-microamp prop error handling led: triggers: Fix dereferencing of null pointer leds: ti-lmu-common: Move static keyword to the front of declaration leds: lm3532: Move static keyword to the front of declarations leds: trigger: gpio: GPIO 0 is valid leds: pwm: Use struct_size() helper leds: is31fl32xx: Use struct_size() helper leds: ti-lmu-common: Fix coccinelle issue in TI LMU leds: lm3532: Avoid potentially unpaired regulator calls leds: syscon: Use resource managed variant of device register leds: Replace {devm_}led_classdev_register() macros with inlines leds: Allow to call led_classdev_unregister() unconditionally leds: lm3532: Add full scale current configuration dt: lm3532: Add property for full scale current. leds: lm3532: Fixes for the driver for stability leds: lm3532: Change the define for the fs current register leds: lm3532: Fix brightness control for i2c mode leds: Switch to use fwnode instead of be stuck with OF one leds: max77650: Switch to fwnode property API led: triggers: Fix a memory leak bug ...
2019-09-11regulator: core: Fix error return for /sys accessH. Nikolaus Schaller
regulator_uV_show() is missing error handling if regulator_get_voltage_rdev() returns negative values. Instead it prints the errno as a string, e.g. -EINVAL as "-22" which could be interpreted as -22 µV. We also do not need to hold the lock while converting the integer to a string. Reported-by: Adam Ford <aford173@gmail.com> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Tested-by: Adam Ford <aford173@gmail.com> Link: https://lore.kernel.org/r/f37f2a1276efcb34cf3b7f1a25481175be048806.1568143348.git.hns@goldelico.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-11regulator: da9211: fix obtaining "enable" GPIODmitry Torokhov
This fixes 11da04af0d3b, as devm_gpiod_get_from_of_node() does not do translation "con-id" -> "con-id-gpios" that our bindings expects, and therefore it was wrong to change connection ID to be simply "enable" when moving to using devm_gpiod_get_from_of_node(). Fixes: 11da04af0d3b ("regulator: da9211: Pass descriptors instead of GPIO numbers") Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Link: https://lore.kernel.org/r/20190910170246.GA56792@dtor-ws Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-11regulator: max77686: fix obtaining "maxim,ena" GPIODmitry Torokhov
This fixes 96392c3d8ca4, as devm_gpiod_get_from_of_node() does not do translation "con-id" -> "con-id-gpios" that our bindings expects, and therefore it was wrong to change connection ID to be simply "maxim,ena" when moving to using devm_gpiod_get_from_of_node(). Fixes: 96392c3d8ca4 ("regulator: max77686: Pass descriptor instead of GPIO number") Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Link: https://lore.kernel.org/r/20190910170050.GA55530@dtor-ws Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-10regulator: uniphier: Add Pro5 USB3 VBUS supportKunihiko Hayashi
Pro5 SoC has same scheme of USB3 VBUS as Pro4, so the data for Pro5 is equivalent to Pro4. Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com> Link: https://lore.kernel.org/r/1568080304-1572-1-git-send-email-hayashi.kunihiko@socionext.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-10regulator: fixed: add possibility to enable by clockPhilippe Schenker
This commit adds the possibility to choose the compatible "regulator-fixed-clock" in devicetree. This is a special regulator-fixed that has to have a clock, from which the regulator gets switched on and off. Signed-off-by: Philippe Schenker <philippe.schenker@toradex.com> Link: https://lore.kernel.org/r/20190910062103.39641-2-philippe.schenker@toradex.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-10regulator: s2mps11: Consistently use local variableKrzysztof Kozlowski
The value under 's2mps11->ext_control_gpiod[i]' is assigned to local variable and used in probe in one place before. Use it consistently later so code will be easier to read. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Link: https://lore.kernel.org/r/20190909155723.24734-1-krzk@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-09regulator: lp87565: Simplify lp87565_buck_set_ramp_delayAxel Lin
Use rdev->regmap/&rdev->dev instead of lp87565->regmap/lp87565->dev. In additional, the lp87565->dev actually is the parent mfd device, so the dev_err message is misleading here with lp87565->dev. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20190908035720.17748-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-09regulator: slg51000: use devm_gpiod_get_optional() in probeDmitry Torokhov
The CS GPIO line is clearly optional GPIO (and marked as such in the binding document) and we should handle it accordingly. The current code treats all errors as meaning that there is no GPIO defined, which is wrong, as it does not handle deferrals raised by the underlying code properly, nor does it recognize non-existing GPIO from any other initialization error. As far as I can see the only reason the driver, unlike all others, is using OF-specific devm_gpiod_get_from_of_node() so that it can assign a custom label to the selected GPIO line. Given that noone else needs that, it should not be doing that either. Let's switch to using more appropriate devm_gpiod_get_optional(). Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Link: https://lore.kernel.org/r/20190904214200.GA66118@dtor-ws Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-09Merge branch 'regulator-5.3' into regulator-5.4Mark Brown
2019-09-09regulator: lp8788-ldo: make array en_mask static const, makes object smallerColin Ian King
Don't populate the array en_mask on the stack but instead make it static const. Makes the object code smaller by 87 bytes. Before: text data bss dec hex filename 12967 3408 0 16375 3ff7 drivers/regulator/lp8788-ldo.o After: text data bss dec hex filename 12816 3472 0 16288 3fa0 drivers/regulator/lp8788-ldo.o (gcc version 9.2.1, amd64) Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20190906130632.6709-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-05regulator: tps65132: Stop parsing DT when gpio is not foundGuido Günther
In case of a missing (optional) gpio don't fall through up to "ti,active-discharge-time-us" due to devm_fwnode_get_index_gpiod_from_child() returning NULL (since gpiod_get_from_of_node() returned NULL) but rather indicate success as intended. This makes the driver probe correctly when e.g. only the enable gpio is given. Signed-off-by: Guido Günther <agx@sigxcpu.org> Link: https://lore.kernel.org/r/363bd50cc7c60daa57d614a341d1fd649f05194c.1567625660.git.agx@sigxcpu.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-09-04regulator: Defer init completion for a while after late_initcallMark Brown
The kernel has no way of knowing when we have finished instantiating drivers, between deferred probe and systems that build key drivers as modules we might be doing this long after userspace has booted. This has always been a bit of an issue with regulator_init_complete since it can power off hardware that's not had it's driver loaded which can result in user visible effects, the main case is powering off displays. Practically speaking it's not been an issue in real systems since most systems that use the regulator API are embedded and build in key drivers anyway but with Arm laptops coming on the market it's becoming more of an issue so let's do something about it. In the absence of any better idea just defer the powering off for 30s after late_initcall(), this is obviously a hack but it should mask the issue for now and it's no more arbitrary than late_initcall() itself. Ideally we'd have some heuristics to detect if we're on an affected system and tune or skip the delay appropriately, and there may be some need for a command line option to be added. Link: https://lore.kernel.org/r/20190904124250.25844-1-broonie@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org> Tested-by: Lee Jones <lee.jones@linaro.org> Cc: stable@vger.kernel.org
2019-09-02regulator: provide regulator_bulk_set_supply_names()Bartosz Golaszewski
There are many regulator consumers who - before using the regulator bulk functions - set the supply names in regulator_bulk_data using a for loop. Let's provide a simple helper in the consumer API that allows users to do the same with a single function call. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Link: https://lore.kernel.org/r/20190830071740.4267-2-brgl@bgdev.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-30regulator: sy8824x: add prefixes to BUCK_EN and MODE macrosJisheng Zhang
Add prefixes to BUCK_EN and MODE macros to namespace them. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20190829143927.395d0385@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-30regulator: sy8824x: use c++style for the comment block near SPDXJisheng Zhang
Update the entire comment block to be C++ style so it looks consistent. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20190829143749.4b42bc65@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-30regulator: mt6358: Add BROKEN dependency while waiting for MFD to mergeMark Brown
The mt6358 driver was merged in error, it depends on an existing MFD rather than a newly added one and needs updates to that driver. Disable the build until those are merged. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-28regulator: mt6358: Add support for MT6358 regulatorHsin-Hsiung Wang
The MT6358 is a regulator found on boards based on MediaTek MT8183 and probably other SoCs. It is a so called pmic and connects as a slave to SoC using SPI, wrapped inside the pmic-wrapper. Signed-off-by: Hsin-Hsiung Wang <hsin-hsiung.wang@mediatek.com> Link: https://lore.kernel.org/r/1566531931-9772-8-git-send-email-hsin-hsiung.wang@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-27regulator: sy8824x: add SY20278 supportJisheng Zhang
The differences between SY8824C and SY20278 are different regs for mode/enable. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20190827163830.2c94f29b@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-27regulator: sy8824x: add SY20276 supportJisheng Zhang
The differences between SY8824C and SY20276 are different vsel_min, vsel_step, vsel_count and regs for mode/enable. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20190827163721.1947f7a0@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-27regulator: sy8824x: add SY8824E supportJisheng Zhang
The only difference between SY8824E and SY8824C/D is the vsel_min. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20190827163537.52023c4e@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-27regulator: add support for SY8824C regulatorJisheng Zhang
SY8824C is an I2C attached single output regulator made by Silergy Corp, which is used on several Synaptics berlin platforms to control the power supply of the ARM cores. Add a driver for it. Signed-off-by: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Link: https://lore.kernel.org/r/20190827163418.1a32fc48@xhacker.debian Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-15regulator: act8865: operating mode and suspend state supportRaag Jadav
Implement ->set_mode(), ->get_mode() and ->set_suspend_xx() hooks for act8865 with unlocked expert registers. Based on work done by Borris Brezillon on [1]. [1] https://www.spinics.net/lists/kernel/msg2942960.html Signed-off-by: Raag Jadav <raagjadav@gmail.com> Link: https://lore.kernel.org/r/1565721176-8955-2-git-send-email-raagjadav@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-15regulator: core: Add label to collate of_node_put() statementsNishka Dasgupta
In function of_get_child_regulator(), the loop for_each_child_of_node() contains two mid-loop return statements, each preceded by a statement putting child. In order to reduce this repetition, create a new label, err_node_put, that puts child and then returns the required value; edit the mid-loop return blocks to instead go to this new label. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Link: https://lore.kernel.org/r/20190815053704.32156-1-nishkadg.linux@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-15regulator: max8660: remove redundant assignment of variable retColin Ian King
Variable ret is initialized to a value that is never read before a return statement and hence can be removed. Remove it. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <colin.king@canonical.com> Link: https://lore.kernel.org/r/20190813133114.14931-1-colin.king@canonical.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-15regulator: twl: voltage lists for vdd1/2 on twl4030Andreas Kemnade
_opp_supported_by_regulators() wrongly ignored errors from regulator_is_supported_voltage(), so it considered errors as success. Since commit 498209445124 ("regulator: core: simplify return value on suported_voltage") regulator_is_supported_voltage() returns a real boolean, so errors make _opp_supported_by_regulators() return false. That reveals a problem with the declaration of the VDD1/2 regulators on twl4030. The VDD1/VDD2 regulators on twl4030 are neither defined with voltage lists nor with the continuous flag set, so regulator_is_supported_voltage() returns false and an error before above mentioned commit (which was considered success) The result is that after the above mentioned commit cpufreq does not work properly e.g. dm3730. [ 2.490997] core: _opp_supported_by_regulators: OPP minuV: 1012500 maxuV: 1012500, not supported by regulator [ 2.501617] cpu cpu0: _opp_add: OPP not supported by regulators (300000000) [ 2.509246] core: _opp_supported_by_regulators: OPP minuV: 1200000 maxuV: 1200000, not supported by regulator [ 2.519775] cpu cpu0: _opp_add: OPP not supported by regulators (600000000) [ 2.527313] core: _opp_supported_by_regulators: OPP minuV: 1325000 maxuV: 1325000, not supported by regulator [ 2.537750] cpu cpu0: _opp_add: OPP not supported by regulators (800000000) The patch fixes declaration of VDD1/2 regulators by adding proper voltage lists. Fixes: 498209445124 ("regulator: core: simplify return value on suported_voltage") Cc: stable@vger.kernel.org Signed-off-by: Andreas Kemnade <andreas@kemnade.info> Tested-by: Adam Ford <aford173@gmail.com> #logicpd-torpedo-37xx-devkit Link: https://lore.kernel.org/r/20190814214319.24087-1-andreas@kemnade.info Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-13regulator: act8945a-regulator: fix ldo register addresses in set_mode hookRaag Jadav
According to ACT8945A datasheet[1], operating modes for ldos are controlled by BIT(5) of their respective _CTRL registers. [1] https://active-semi.com/wp-content/uploads/ACT8945A_Datasheet.pdf Fixes: 7482d6ecc68e ("regulator: act8945a-regulator: Implement PM functionalities") Signed-off-by: Raag Jadav <raagjadav@gmail.com> Link: https://lore.kernel.org/r/1565635194-5816-1-git-send-email-raagjadav@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-09regulator: twl6030: workaround the VMMC reset behaviorGregory CLEMENT
During reset the VMMC regulator doesn't reach 0V and only drops to 1.8V, furthermore the pulse width is under 200us whereas the SD specification expect 1ms. The WR_S bit allows the TWL6030 to no reset at all the VMMC during warm reset and keep the current voltage. Thanks to this workaround the SD card doesn't reach a undefined reset stage. Actually this behavior is available for all the LDO regulator, so the driver will also allow to use it with any of these regulator. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Link: https://lore.kernel.org/r/20190725094542.16547-4-gregory.clement@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-09regulator: twl6030: use variable for device nodeGregory CLEMENT
Instead of refering the full pdev->dev.of_node use a local variable. Signed-off-by: Gregory CLEMENT <gregory.clement@bootlin.com> Link: https://lore.kernel.org/r/20190725094542.16547-3-gregory.clement@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-09regulator: qcom-rpmh: Update PMIC modes for PMIC5Vinod Koul
Add the PMIC5 modes and use them pmic5 ldo and smps Signed-off-by: Vinod Koul <vkoul@kernel.org> Link: https://lore.kernel.org/r/20190809073616.1235-4-vkoul@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-09regulator: qcom-rpmh: Fix pmic5_bob voltage countVinod Koul
pmic5_bob voltages count is 136 [0,135] so update it Signed-off-by: Vinod Koul <vkoul@kernel.org> Link: https://lore.kernel.org/r/20190809073616.1235-3-vkoul@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-09regulator: qcom-rpmh: Sort the compatiblesVinod Koul
It helps to keep sorted order for compatibles, so sort them Suggested-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Vinod Koul <vkoul@kernel.org> Link: https://lore.kernel.org/r/20190809073616.1235-2-vkoul@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-08regulator: act8865: Fix build error without CONFIG_POWER_SUPPLYYueHaibing
Building without CONFIG_POWER_SUPPLY will fail: drivers/regulator/act8865-regulator.o: In function `act8865_pmic_probe': act8865-regulator.c:(.text+0x357): undefined reference to `devm_power_supply_register' drivers/regulator/act8865-regulator.o: In function `act8600_charger_get_property': act8865-regulator.c:(.text+0x3f1): undefined reference to `power_supply_get_drvdata' Add POWER_SUPPLY dependency to Kconfig. Reported-by: Hulk Robot <hulkci@huawei.com> Fixes: 2d09a79bf637 ("regulator: act8865: Add support for act8600 charger") Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20190807133822.67124-1-yuehaibing@huawei.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-08regulator: qcom-rpmh: Add support for SM8150Vinod Koul
Add support from RPMH regulators found in SM8150 platform Signed-off-by: Vinod Koul <vkoul@kernel.org> Link: https://lore.kernel.org/r/20190808093343.5600-2-vkoul@kernel.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-08regulator: slg51000: Fix a couple NULL vs IS_ERR() checksDan Carpenter
The devm_gpiod_get_from_of_node() function never returns NULL, it returns error pointers on error. Fixes: a867bde3dd03 ("regulator: slg51000: add slg51000 regulator driver") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Link: https://lore.kernel.org/r/20190808103335.GD30506@mwanda Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-05regulator: core: Add of_node_put() before returnNishka Dasgupta
Each iteration of for_each_child_of_node puts the previous node, but in the case of a return from the middle of the loop, there is no put, thus causing a memory leak. Hence add an of_node_put before the return in two places. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Link: https://lore.kernel.org/r/20190804162023.5673-1-nishkadg.linux@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-02regulator: Remove dev_err() usage after platform_get_irq()Stephen Boyd
We don't need dev_err() messages when platform_get_irq() fails now that platform_get_irq() prints an error message itself when something goes wrong. Let's remove these prints with a simple semantic patch. // <smpl> @@ expression ret; struct platform_device *E; @@ ret = ( platform_get_irq(E, ...) | platform_get_irq_byname(E, ...) ); if ( \( ret < 0 \| ret <= 0 \) ) { ( -if (ret != -EPROBE_DEFER) -{ ... -dev_err(...); -... } | ... -dev_err(...); ) ... } // </smpl> While we're here, remove braces on if statements that only have one statement (manually). Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Stephen Boyd <swboyd@chromium.org> Link: https://lore.kernel.org/r/20190730181557.90391-38-swboyd@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
2019-08-01regulator: of: Add of_node_put() before return in functionNishka Dasgupta
The local variable search in regulator_of_get_init_node takes the value returned by either of_get_child_by_name or of_node_get, both of which get a node. If this node is not put before returning, it could cause a memory leak. Hence put search before a mid-loop return statement. Issue found with Coccinelle. Signed-off-by: Nishka Dasgupta <nishkadg.linux@gmail.com> Link: https://lore.kernel.org/r/20190724083231.10276-1-nishkadg.linux@gmail.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-30drivers: Introduce device lookup variants by of_nodeSuzuki K Poulose
Introduce wrappers for {bus/driver/class}_find_device() to locate devices by its of_node. Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <maxime.ripard@bootlin.com> Cc: dri-devel@lists.freedesktop.org Cc: David Airlie <airlied@linux.ie> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: devicetree@vger.kernel.org Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Frank Rowand <frowand.list@gmail.com> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: linux-i2c@vger.kernel.org Cc: linux-rockchip@lists.infradead.org Cc: linux-spi@vger.kernel.org Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Takashi Iwai <tiwai@suse.com> Cc: Alan Tull <atull@kernel.org> Cc: linux-fpga@vger.kernel.org Cc: Peter Rosin <peda@axentia.se> Cc: Florian Fainelli <f.fainelli@gmail.com> Cc: Heiner Kallweit <hkallweit1@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Thor Thayer <thor.thayer@linux.intel.com> Cc: Jiri Slaby <jslaby@suse.com> Cc: Andrew Lunn <andrew@lunn.ch> Cc: Peter Rosin <peda@axentia.se> Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Wolfram Sang <wsa@the-dreams.de> # I2C part Acked-by: Moritz Fischer <mdf@kernel.org> # For FPGA part Acked-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20190723221838.12024-3-suzuki.poulose@arm.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-07-25regulator: act8865: fix ptr_ret.cocci warningskbuild test robot
drivers/regulator/act8865-regulator.c:447:8-14: WARNING: PTR_ERR_OR_ZERO can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci Fixes: 2d09a79bf637 ("regulator: act8865: Add support for act8600 charger") CC: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: kbuild test robot <lkp@intel.com> Link: https://lore.kernel.org/r/20190724092236.witxtfmubun25l2t@1905cc33b6dd Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-24regulator: lp87565: Fix probe failure for "ti,lp87565"Axel Lin
The "ti,lp87565" compatible string is still in of_lp87565_match_table, but current code will return -EINVAL because lp87565->dev_type is unknown. This was working in earlier kernel versions, so fix it. Fixes: 7ee63bd74750 ("regulator: lp87565: Add 4-phase lp87561 regulator support") Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20190711113517.26077-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-24Merge tag 'v5.3-rc1' into regulator-5.3Mark Brown
Linus 5.3-rc1
2019-07-23regulator: act8865: support regulator-pull-down propertyMichał Mirosław
AC8865 has internal 1.5k pull-down resistor that can be enabled when LDO is shut down. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/d7338f0dfcac63eb958a6b5e42e2d540b3d3f54a.1563898936.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23regulator: act8865: rename fixed LDO opsMichał Mirosław
Rename act8865_ldo_ops to act8865_fixed_ldo_ops to make room for variable-output LDO ops change. Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl> Link: https://lore.kernel.org/r/12b1fe419e93dfe663990009bf1b2fbf630e9934.1563898936.git.mirq-linux@rere.qmqm.pl Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23regulator: stm32-booster: Remove .min_uV and .list_voltage for fixed regulatorAxel Lin
Setting .n_voltages = 1 and .fixed_uV is enough for fixed regulator, remove the redundant .min_uV and .list_voltage settings. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com> Link: https://lore.kernel.org/r/20190723014102.25103-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-23regulator: act8865: Add support for act8600 chargerMaarten ter Huurne
This provides a way to monitor battery charge status via the power supply subsystem. Signed-off-by: Maarten ter Huurne <maarten@treewalker.org> Signed-off-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20190723011418.29143-1-paul@crapouillou.net Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-22regulator: rk808: Return REGULATOR_MODE_INVALID for invalid modeAxel Lin
-EINVAL is not a valid return value for .of_map_mode, return REGULATOR_MODE_INVALID instead. Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20190711122138.5221-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-22regulator: lm363x: Fix n_voltages setting for lm36274Axel Lin
According to the datasheet http://www.ti.com/lit/ds/symlink/lm36274.pdf: Table 23. VPOS Bias Register Field Descriptions VPOS[5:0]: VPOS voltage (50-mV steps): VPOS = 4 V + (Code × 50 mV), 6.5 V max 000000 = 4 V 000001 = 4.05 V : 011110 = 5.5 V (Default) : 110010 = 6.5 V 110011 to 111111 map to 6.5 V So the LM36274_LDO_VSEL_MAX should be 0b110010 (0x32). The valid selectors are 0 ... LM36274_LDO_VSEL_MAX, n_voltages should be LM36274_LDO_VSEL_MAX + 1. Similarly, the n_voltages should be LM36274_BOOST_VSEL_MAX + 1 for LM36274_BOOST. Fixes: bff5e8071533 ("regulator: lm363x: Add support for LM36274") Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20190626132632.32629-2-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-22regulator: lm363x: Fix off-by-one n_voltages for lm3632 ldo_vpos/ldo_vnegAxel Lin
According to the datasheet https://www.ti.com/lit/ds/symlink/lm3632a.pdf Table 20. VPOS Bias Register Field Descriptions VPOS[5:0] Sets the Positive Display Bias (LDO) Voltage (50 mV per step) 000000: 4 V 000001: 4.05 V 000010: 4.1 V .................... 011101: 5.45 V 011110: 5.5 V (Default) 011111: 5.55 V .................... 100111: 5.95 V 101000: 6 V Note: Codes 101001 to 111111 map to 6 V The LM3632_LDO_VSEL_MAX should be 0b101000 (0x28), so the maximum voltage can match the datasheet. Fixes: 3a8d1a73a037 ("regulator: add LM363X driver") Signed-off-by: Axel Lin <axel.lin@ingics.com> Link: https://lore.kernel.org/r/20190626132632.32629-1-axel.lin@ingics.com Signed-off-by: Mark Brown <broonie@kernel.org>
2019-07-16regulator: axp20x: fix DCDC5 and DCDC6 for AXP803Jernej Skrabec
Refactoring of axp20x driver introduced a bug in AXP803's DCDC6 regulator definition. AXP803_DCDC6_1120mV_STEPS was obtained by subtracting 0x47 and 0x33. This should be 0x14 (hex) and not 14 (dec). Refactoring also carried over a bug in DCDC5 regulator definition. Number of possible voltages must be for 1 bigger than maximum valid voltage index, because 0 is also valid and it means lowest voltage. Fixes: 1dbe0ccb0631 ("regulator: axp20x-regulator: add support for AXP803") Fixes: db4a555f7c4c ("regulator: axp20x: use defines for masks") Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Link: https://lore.kernel.org/r/20190713090717.347-3-jernej.skrabec@siol.net Signed-off-by: Mark Brown <broonie@kernel.org>