- 17 5月, 2018 9 次提交
-
-
由 Maciej Purski 提交于
On Odroid XU3/4 and other Exynos5422 based boards there is a case, that different devices on the board are supplied by different regulators with non-fixed voltages. If one of these devices temporarily requires higher voltage, there might occur a situation that the spread between two devices' voltages is so high, that there is a risk of changing 'high' and 'low' states on the interconnection between devices powered by those regulators. Introduce new function regulator_balance_voltage(), which keeps max_spread constraint fulfilled between a group of coupled regulators. It should be called if a regulator changes its voltage or after disabling or enabling. Disabled regulators should follow changes of the enabled ones, but their consumers' demands shouldn't be taken into account while calculating voltage of other coupled regulators. Find voltages, which are closest to suiting all the consumers' demands, while fulfilling max_spread constraint, keeping the following rules: - if one regulator is about to rise its voltage, rise others voltages in order to keep the max_spread - if a regulator, which has caused rising other regulators, is lowered, lower other regulators if possible - if one regulator is about to lower its voltage, but it hasn't caused rising other regulators, don't change its voltage if it breaks the max_spread Change regulators' voltages step by step, keeping max_spread constraint fulfilled all the time. Function regulator_get_optimal_voltage() should find the best possible change for the regulator, which doesn't break max_spread constraint. In function regulator_balance_voltage() optimize number of steps by finding highest voltage difference on each iteration. If a regulator, which is about to change its voltage, is not coupled, method regulator_get_optimal_voltage() should simply return the lowest voltage fulfilling consumers' demands. Coupling should be checked only if the system is in PM_SUSPEND_ON state. Signed-off-by: NMaciej Purski <m.purski@samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Maciej Purski 提交于
On Odroid XU3/4 and other Exynos5422 based boards there is a case, that different devices on the board are supplied by different regulators with non-fixed voltages. If one of these devices temporarily requires higher voltage, there might occur a situation that the spread between two devices' voltages is so high, that there is a risk of changing 'high' and 'low' states on the interconnection between devices powered by those regulators. Fill coupling descriptor with data obtained from DTS using previously defined of_functions. Fail to register a regulator, if some data inconsistency occurs. If some coupled regulators are not yet registered, don't fail to register, but try to resolve them in late init call. Signed-off-by: NMaciej Purski <m.purski@samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Maciej Purski 提交于
On Odroid XU3/4 and other Exynos5422 based boards there is a case, that different devices on the board are supplied by different regulators with non-fixed voltages. If one of these devices temporarily requires higher voltage, there might occur a situation that the spread between devices' voltages is so high, that there is a risk of changing 'high' and 'low' states on the interconnection between devices powered by those regulators. Add new structure "coupling_desc" to regulator_dev, which contains pointers to all coupled regulators including the owner of the structure, number of coupled regulators and counter of currently resolved regulators. Add of_functions to parse all data needed in regulator coupling. Provide method to check DTS data consistency. Check if each coupled regulator's max_spread is equal and if their lists of regulators match. Signed-off-by: NMaciej Purski <m.purski@samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Maciej Purski 提交于
Setting voltage, enabling/disabling regulators requires operations on all regulators related with the regulator being changed. Therefore, all of them should be locked for the whole operation. With the current locking implementation, adding additional dependency (regulators coupling) causes deadlocks in some cases. Introduce a possibility to attempt to lock a mutex multiple times by the same task without waiting on a mutex. This should handle all reasonable coupling-supplying combinations, especially when two coupled regulators share common supplies. The only situation that should be forbidden is simultaneous coupling and supplying between a pair of regulators. The idea is based on clk core. Signed-off-by: NMaciej Purski <m.purski@samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Linus Walleij 提交于
Instead of passing a global GPIO number for the enable GPIO, pass a descriptor looked up with the standard devm_gpiod_get_optional() call. This regulator supports passing platform data, but enable/sleep regulators are looked up from the device tree exclusively, so we can need not touch other files. Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Reviewed-by: NKrzysztof Kozlowski <krzk@kernel.org> Tested-by: NKrzysztof Kozlowski <krzk@kernel.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Linus Walleij 提交于
Instead of passing a global GPIO number, pass a descriptor looked up from the device tree configuration node. Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Reviewed-by: NKrzysztof Kozlowski <krzk@kernel.org> Tested-by: NKrzysztof Kozlowski <krzk@kernel.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Linus Walleij 提交于
Instead of passing a global GPIO number, pass a descriptor looked up with the standard devm_gpiod_get_optional() call. We have augmented the GPIO core to look up the regulator special GPIO "wlf,ldoena" in commit 6a537d48 "gpio: of: Support regulator nonstandard GPIO properties". Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Acked-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 David Collins 提交于
Add support for configuring the machine constraints valid_modes_mask element based on a list of allowed modes specified via a device tree property. Signed-off-by: NDavid Collins <collinsd@codeaurora.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Douglas Anderson 提交于
Regulators attached via RPMh on Qualcomm sdm845 apparently are write-only. Specifically you can send a request for a certain voltage but you can't read back to see what voltage you've requested. What this means is that at bootup we have absolutely no idea what voltage we could be at. As discussed in the patches to try to support the RPMh regulators [1], the fact that regulators are write-only means that its driver's get_voltage_sel() should return an error code if it's called before any calls to set_voltage_sel(). This causes problems in machine_constraints_voltage() when trying to apply the constraints. A proposed fix was to come up with an error code that could be returned by get_voltage_sel() which would cause the regulator framework to simply try setting the voltage with the current constraints. In this patch I propose the error code -ENOTRECOVERABLE. In errno.h this error is described as "State not recoverable". Though the error code was originally intended "for robust mutexes", the description of the error code seems to apply here because we can't read the state of the regulator. Also note that the only existing user of this error code in the regulator framework is tps65090-regulator.c which returns this error code from the enable() call (not get_voltage() or get_voltage_sel()), so there should be no existing regulators that might accidentally get the new behavior. (Side note is that tps65090 seems to interpret this error code to mean an error that you can't recover from rather than some data that can't be recovered). [1] https://patchwork.kernel.org/patch/10340897/Signed-off-by: NDouglas Anderson <dianders@chromium.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 09 5月, 2018 1 次提交
-
-
由 Ondrej Jirman 提交于
SY8106A is an I2C attached single output regulator made by Silergy Corp, which is used on several Allwinner H3/H5 SBCs to control the power supply of the ARM cores. Add a driver for it. Signed-off-by: NOndrej Jirman <megous@megous.com> [Icenowy: Change commit message, remove enable/disable code, add default ramp_delay, add comment for go bit, add code for fixed mode voltage] Signed-off-by: NIcenowy Zheng <icenowy@aosc.io> Reviewed-by: NChen-Yu Tsai <wens@csie.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 05 5月, 2018 1 次提交
-
-
由 Changbin Du 提交于
If device tree is not enabled, of_find_regulator_by_node() should have a dummy function since the function call is still there. This is to fix build error after CONFIG_NO_AUTO_INLINE is introduced. If this option is enabled, GCC will not auto-inline functions that are not explicitly marked as inline. In this case (no CONFIG_OF), the copmiler will report error in function regulator_dev_lookup(). W/O NO_AUTO_INLINE, function of_get_regulator() is auto-inlined and then the call to of_find_regulator_by_node() is optimized out since of_get_regulator() always return NULL. W/ NO_AUTO_INLINE, the return value of of_get_regulator() is a variable so the call to of_find_regulator_by_node() cannot be optimized out. So we need a stub of_find_regulator_by_node(). static struct regulator_dev *regulator_dev_lookup(struct device *dev, const char *supply) { struct regulator_dev *r = NULL; struct device_node *node; struct regulator_map *map; const char *devname = NULL; regulator_supply_alias(&dev, &supply); /* first do a dt based lookup */ if (dev && dev->of_node) { node = of_get_regulator(dev, supply); if (node) { r = of_find_regulator_by_node(node); if (r) return r; ... Signed-off-by: NChangbin Du <changbin.du@intel.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 24 4月, 2018 1 次提交
-
-
由 Geert Uytterhoeven 提交于
The BD9571MWV PMIC supports backup mode, which keeps one or more DDR rails powered while the main SoC is powered down. Which DDR rails are to be kept powered is board-specific, and controlled using the optional "rohm,ddr-backup-power" DT property. In the absence of this property, backup mode is not available. Backup mode can be enabled or disabled by the user using the standard "wakeup" virtual file in sysfs, e.g. to enable: echo enabled > /sys/devices/platform/soc/e60b0000.i2c/i2c-7/7-0030/bd9571mwv-regulator.2.auto/power/wakeup When the PMIC is configured for backup mode, the role of the accessory power switch changes from a power switch to a wake-up switch. Two types of switches (or signals) can be used: A. With a momentary power switch (or pulse signal), the PMIC is configured for backup mode in the PMIC driver's suspend callback, during system suspend. Backup mode is enabled by default, as there is no further impact during normal system operation. B. With a toggle power switch (or level signal), the following steps must be followed exactly: 1. Configure PMIC for backup mode, 2. Switch accessory power switch off, to prepare for system suspend, which is a manual step not controlled by software, 3. Suspend system. This mode is not yet supported by the driver. As the switch type is board-specific, and cannot be determined automatically, it is obtained from the presence of one of the "rohm,rstbmode-*" properties in DT. Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Acked-by: NLee Jones <lee.jones@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 23 4月, 2018 2 次提交
-
-
由 Jagan Teki 提交于
Like axp221, axp223, axp813 the axp803 is also supporting external regulator to drive the OTG VBus through N_VBUSEN PMIC pin. Add support for it. Signed-off-by: NJagan Teki <jagan@amarulasolutions.com> Reviewed-by: NRob Herring <robh@kernel.org> Reviewed-by: NChen-Yu Tsai <wens@csie.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Colin Ian King 提交于
It seems that the loop index i is not being incremented and hence potentially the while loop could spin forever. Fortunately with the data being used this does not appear to happen at the moment. Signed-off-by: NColin Ian King <colin.king@canonical.com> Acked-by: NCharles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 20 4月, 2018 2 次提交
-
-
由 Douglas Anderson 提交于
In of_get_regulation_constraints() we were taking the result of of_map_mode() (an unsigned int) and assigning it to an int. We were then checking whether this value was -EINVAL. Some implementers of of_map_mode() were returning -EINVAL (even though the return type of their function needed to be unsigned int) because they needed to signal an error back to of_get_regulation_constraints(). In general in the regulator framework the mode is always referred to as an unsigned int. While we could fix this to be a signed int (the highest value we store in there right now is 0x8), it's actually pretty clean to just define the regulator mode 0x0 (the lack of any bits set) as an invalid mode. Let's do that. Fixes: 5e5e3a42 ("regulator: of: Add support for parsing initial and suspend modes") Suggested-by: NJavier Martinez Canillas <javierm@redhat.com> Signed-off-by: NDouglas Anderson <dianders@chromium.org> Reviewed-by: NJavier Martinez Canillas <javierm@redhat.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 ryang 提交于
This version is exists in the Samsung Galaxy Tab 10.1 which is based on the Nvidia Tegra 2 board. The TPS658624 has the same SM2 voltage table as TPS658623. Signed-off-by: Nryang <decatf@gmail.com> Acked-by: NLee Jones <lee.jones@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 18 4月, 2018 1 次提交
-
-
由 Anson Huang 提交于
pfuze3000 datasheet(Rev.9.0) from: https://www.nxp.com/docs/en/data-sheet/PF3000.pdf updates sw1a's voltage range, the settings for 1.450V and 1.475V are replaced with 1.8V and 3.3V: 5b'11110 1.450 (SW1B), 1.8 (SW1A/SW1AB) 5b'11111 1.475 (SW1B), 3.3 (SW1A/SW1AB) the voltage calculation using steps is NOT available for sw1a now, use voltage table instead. Signed-off-by: NAnson Huang <Anson.Huang@nxp.com> Signed-off-by: NRobin Gong <yibin.gong@nxp.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 17 4月, 2018 2 次提交
-
-
由 Keerthy 提交于
Buck10 is a multi(dual) phase regulator. So as part of enabling it turn on the LP87565_BUCK_CTRL_1_FPWM_MP_0_2 bit which forces it to operate always in multiphase and forced-PWM operation mode. This helps improve the transient voltage response while switching OPP. Signed-off-by: NKeerthy <j-keerthy@ti.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Keerthy 提交于
The slew rate might need a +/- 15% margin as per the latest data manual: http://www.ti.com/lit/ds/snvsb22/snvsb22.pdf Hence take a conservative approach to program 85% of the original hardware slew rate so that the software accommodates the margin delay while voltage switching. Hence reduce the default ramp_delay populated in the descriptors also by 15%. Signed-off-by: NKeerthy <j-keerthy@ti.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 16 4月, 2018 1 次提交
-
-
由 Linus Walleij 提交于
The AB8540 was an evolved version of the AB8500, but it was never mass produced or put into products, only reference designs exist. The upstream support was never completed and it is unlikely that this will happen so drop the support for now to simplify maintenance of the AB8500. Cc: Loic Pallardy <loic.pallardy@st.com> Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 28 3月, 2018 1 次提交
-
-
由 Bjorn Andersson 提交于
Add the pm8998 and pmi8998 regulators as used in the MSM8998 platform. Signed-off-by: NBjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 22 3月, 2018 2 次提交
-
-
由 Mark Brown 提交于
Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Stephen Boyd 提交于
These seem to be leftovers from previous developments of the driver but they never got removed. Dropping them still allows the code to compile so everything must be fine. Signed-off-by: NStephen Boyd <swboyd@chromium.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 20 3月, 2018 1 次提交
-
-
由 Nicholas Lowell 提交于
When the label is empty, it causes missing information and limits diagnostics for instances such as 'cat /sys/kernel/debug/gpio' Setting the label to the regulator supply_name will point to the device using the gpio(s). Signed-off-by: NNicholas Lowell <nlowell@lexmark.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 15 3月, 2018 1 次提交
-
-
由 Christophe Jaillet 提交于
Re-order error handling code and gotos to avoid leaks in error handling paths. Fixes: 9f946099 ("regulator: gpio: fix parsing of gpio list") Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 09 3月, 2018 1 次提交
-
-
由 Alexander Monakov 提交于
This chip is found on Google Chromecast and Valve Steam Link devices. It provides two DC regulators with I2C voltage control, separate GPIO enable pins and one sleep mode pin. This driver does not expose GPIO functionality, but supports voltage control in 1.0-2.2V range, based on I2C register information given in Chromecast kernel driver by Jisheng Zhang. Cc: Jisheng Zhang <Jisheng.Zhang@synaptics.com> Signed-off-by: NAlexander Monakov <amonakov@ispras.ru> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 20 2月, 2018 1 次提交
-
-
由 Geert Uytterhoeven 提交于
When resuming from idle with the new suspend mode configuration support we go through the resume callbacks with a state of PM_SUSPEND_TO_IDLE which we don't have regulator constraints for, causing an error: dpm_run_callback(): regulator_resume_early+0x0/0x64 returns -22 PM: Device regulator.0 failed to resume early: error -22 Avoid this and similar errors by treating missing constraints as a noop. See also commit 57a0dd18 ("regulator: Fix suspend to idle"), which fixed the suspend part. Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 17 2月, 2018 3 次提交
-
-
由 Linus Walleij 提交于
This augments the DA9211 regulator driver to fetch its GPIO descriptors directly from the device tree using the newly exported devm_get_gpiod_from_child(). Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Linus Walleij 提交于
When setting up a fixed regulator on the DA9055, pass a descriptor instead of a global GPIO number. This facility is not used in the kernel so we can easily just say that this should be a descriptor if/when put to use. Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Acked-by: NLee Jones <lee.jones@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Linus Walleij 提交于
We are currently passing a GPIO number from the global GPIO numberspace into the regulator core for handling enable GPIOs. This is not good since it ties into the global GPIO numberspace and uses gpio_to_desc() to overcome this. Start supporting passing an already initialized GPIO descriptor to the core instead: leaf drivers pick their descriptors, associated directly with the device node (or from ACPI or from a board descriptor table) and use that directly without any roundtrip over the global GPIO numberspace. This looks messy since it adds a bunch of extra code in the core, but at the end of the patch series we will delete the handling of the GPIO number and only deal with descriptors so things end up neat. Signed-off-by: NLinus Walleij <linus.walleij@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 12 2月, 2018 1 次提交
-
-
由 Christophe JAILLET 提交于
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: NChristophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 08 2月, 2018 1 次提交
-
-
由 Fabrice Gasnier 提交于
stm32_vrefbuf_enable() wrongly checks VRR bit: 0 stands for not ready, 1 for ready. It currently checks the opposite. This makes enable routine to exit immediately without waiting for ready flag. Fixes: 0cdbf481 ("regulator: Add support for stm32-vrefbuf") Signed-off-by: NFabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: NMark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
-
- 30 1月, 2018 1 次提交
-
-
由 Mark Brown 提交于
When suspending to idle with the new suspend mode configuration support we go through the suspend callbacks with a state of PM_SUSPEND_TO_IDLE which we don't have regulator constraints for, causing an error. Avoid this and similar errors by treating missing constraints as a noop. Reported-by: NGeert Uytterhoeven <geert+renesas@glider.be> Tested-by: NGeert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 27 1月, 2018 1 次提交
-
-
由 Mark Brown 提交于
3d67fe95 (regulator: core: Refactor regulator_list_voltage()) missed one user of regulator_list_voltage(), update for that. Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 26 1月, 2018 6 次提交
-
-
由 Maciej Purski 提交于
Change _regulator_list_voltage() argument from regulator to regulator_dev in order to provide better separation of core layers. Allow calling _regulator_list_voltage() from functions, with regulator_dev argument. This refactoring is needed in order to implement setting voltage of coupled regulators. Signed-off-by: NMaciej Purski <m.purski@samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Maciej Purski 提交于
As of_find_regulator_by_node() is an of function it should be moved from core.c to of_regulator.c. It provides better separation of device tree functions from the core and allows other of_functions in of_regulator.c to resolve device_node to regulator_dev. This will be useful for implementation of parsing coupled regulators properties. Declare of_find_regulator_by_node() function in internal.h as well as regulator_class and dev_to_rdev(), as they are needed by of_find_regulator_by_node(). Signed-off-by: NMaciej Purski <m.purski@samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Chunyan Zhang 提交于
In this patch, consumers are allowed to set suspend voltage, and this actually just set the "uV" in constraint::regulator_state, when the regulator_suspend_late() was called by PM core through callback when the system is entering into suspend, the regulator device would act suspend activity then. And it assumes that if any consumer set suspend voltage, the regulator device should be enabled in the suspend state. And if the suspend voltage of a regulator device for all consumers was set zero, the regulator device would be off in the suspend state. This patch also provides a new function hook to regulator devices for resuming from suspend states. Signed-off-by: NChunyan Zhang <zhang.chunyan@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Chunyan Zhang 提交于
Regualtor suspend/resume functions should only be called by PM suspend core via registering dev_pm_ops, and regulator devices should implement the callback functions. Thus, any regulator consumer shouldn't call the regulator suspend/resume functions directly. In order to avoid compile errors, two empty functions with the same name still be left for the time being. Signed-off-by: NChunyan Zhang <zhang.chunyan@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Chunyan Zhang 提交于
The items "disabled" and "enabled" are a little redundant, since only one of them would be set to record if the regulator device should keep on or be switched to off in suspend states. So in this patch, the "disabled" was removed, only leave the "enabled": - enabled == 1 for regulator-on-in-suspend - enabled == 0 for regulator-off-in-suspend - enabled == -1 means do nothing when entering suspend mode. Signed-off-by: NChunyan Zhang <zhang.chunyan@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Chunyan Zhang 提交于
Some regulator consumers would like to make the regulator device keeping a voltage range output when the system entering into suspend states. Making regulator voltage be an array can allow consumers to set voltage for normal state as well as for suspend states through the same code. Signed-off-by: NChunyan Zhang <zhang.chunyan@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-