- 14 6月, 2017 1 次提交
-
-
由 Charles Keepax 提交于
Currently, when looking up a regulator supply, the regulator name takes priority over the consumer mappings. As there are a lot of regulator names that are in fairly common use (VDD, MICVDD, etc.) this can easily lead to obtaining the wrong supply, when a system contains two regulators that share a name. The explicit consumer mappings contain much less ambiguity as they specify both a name and a consumer device. As such prioritise those if one exists and only fall back to the regulator name if there are no matching explicit mappings. Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 15 4月, 2017 2 次提交
-
-
由 Mark Brown 提交于
Rather than just not resolving the supply when there is explicitly no supply mapping fall through and allow a dummy supply to be substituted. This fixes issues with constant retries reported by Dong Aisheng. Signed-off-by: NMark Brown <broonie@kernel.org> Tested-by: NDong Aisheng <aisheng.dong@nxp.com> Reviewed-by: NDong Aisheng <aisheng.dong@nxp.com>
-
由 Mark Brown 提交于
When we are propagating voltage changes to parent regulators don't bother if the parent does not have permission to change voltages. This simplifies error checking in the function for cases where the regulator lacks some of the voltage operations. Reported-by: NDong Aisheng <aisheng.dong@nxp.com> Tested-by: NDong Aisheng <aisheng.dong@nxp.com> Reviewed-by: NDong Aisheng <aisheng.dong@nxp.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 06 4月, 2017 1 次提交
-
-
由 Laxman Dewangan 提交于
Some regulators (some PWM regulators) have the voltage transition non-linear i.e. exponentially. On such cases, the settling time for voltage transition can not be presented in the voltage-ramp-delay. Add new property for non-linear voltage transition and handle this in getting the voltage settling time. Signed-off-by: NLaxman Dewangan <ldewangan@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 29 3月, 2017 2 次提交
-
-
由 Matthias Kaehlcke 提交于
Commit 26988efe ("regulator: core: Allow to get voltage count and list from parent") introduces the propagation of the parent voltage count and list for regulators that don't provide this information themselves. The goal is to support simple switch regulators, however as a side effect normal continuous regulators can leak details of their supplies and provide consumers with inconsistent information. Limit the propagation of the voltage count and list to switch regulators. Fixes: 26988efe ("regulator: core: Allow to get voltage count and list from parent") Signed-off-by: NMatthias Kaehlcke <mka@chromium.org> Reviewed-by: NJavier Martinez Canillas <javier@osg.samsung.com> Tested-by: NJavier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Tamara Diaconita 提交于
Remove the description for the non-existing 'ret' to fix the build warning: ./drivers/regulator/core.c:1467: warning: Excess function parameter 'ret' description in 'regulator_dev_lookup'. The description found for the return value is: @ret: 0 on success, -ENODEV if lookup fails permanently, -EPROBE_DEFER if lookup could succeed in the future. Signed-off-by: NTamara Diaconita <diaconita.tamara@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 25 3月, 2017 1 次提交
-
-
由 Harald Geyer 提交于
This is useful for devices, which need some time to start up, to help the drivers track how long the supply has been up already. Ie whether it can safely talk to the HW or needs to wait. Signed-off-by: NHarald Geyer <harald@ccbib.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 17 3月, 2017 1 次提交
-
-
由 Stephen Boyd 提交于
The supply_name member of struct regulator can be const as we don't change it in the regulator core. Furthermore, when we copy the supply name we can use kstrdup_const() here to avoid a copy if the name is in the ro data section. Signed-off-by: NStephen Boyd <sboyd@codeaurora.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 07 3月, 2017 1 次提交
-
-
由 Bartosz Golaszewski 提交于
When creating the link to the device sysfs entry, the regulator core calls scnprintf() and then checks if the returned value is greater or equal than the buffer size. The former can never happen as scnprintf() returns the number of bytes that were actually written to the buffer, not the bytes that *would* have been written. Use the right function in this case: snprintf(). Signed-off-by: NBartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 17 2月, 2017 1 次提交
-
-
由 Javier Martinez Canillas 提交于
After commit 66d228a2 ("regulator: core: Don't use regulators as supplies until the parent is bound"), input supplies aren't resolved if the input supplies parent device has not been bound. This prevent regulators to hold an invalid reference if its supply parent device driver probe is deferred. But this causes issues on some boards where a PMIC's regulator use as input supply a regulator from another PMIC whose driver is registered after the driver for the former. In this case the regulators for the first PMIC will fail to resolve input supplies on regulators registration (since the other PMIC wasn't probed yet). And when the core attempts to resolve again latter when the other PMIC registers its own regulators, it will fail again since the parent device isn't bound yet. This will cause some parent supplies to never be resolved and wrongly be disabled on boot due taking them as unused. To solve this problem, also attempt to resolve the pending regulators input supplies before disabling the unused regulators. Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 16 2月, 2017 1 次提交
-
-
由 Leonard Crestez 提交于
It is allowed to call regulator_get with a NULL dev argument (_regulator_get explicitly checks for it) but this causes an error later when printing /sys/kernel/debug/regulator_summary. Fix this by explicitly handling "deviceless" consumers in the debugfs code. Signed-off-by: NLeonard Crestez <leonard.crestez@nxp.com> Signed-off-by: NMark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
-
- 09 2月, 2017 1 次提交
-
-
由 Dmitry Torokhov 提交于
The code in _regulator_get() got a bit confusing over time, with control flow jumping to a label from couple of places. Let's untangle it a bit by doing the following: 1. Make handling of missing supplies and substituting them with dummy regulators more explicit: - check if we not have full constraints and refuse considering dummy regulators with appropriate message; - use "switch (get_type)" to handle different types of request explicitly as well. "Normal" requests will get dummies, exclusive will not and will notify user about that; optional will fail silently. 2. Stop jumping to a label in the middle of the function but instead have proper conditional flow. I believe jumps should be reserved for error handling, breaking from inner loop, or restarting a loop, but not for implementing normal conditional flow. Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 06 2月, 2017 1 次提交
-
-
由 Dmitry Torokhov 提交于
Instead of returning both regulator_dev structure as return value and auxiliary error code in 'ret' argument, let's switch to using ERR_PTR encoded values. This makes it more obvious what is going on at call sites. Also, let's not unlock the mutex in the middle of a loop, but rather break out and have single unlock path. Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 04 2月, 2017 4 次提交
-
-
由 Dmitry Torokhov 提交于
"re-enable" was misspelled as "reename". Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Dmitry Torokhov 提交于
There is no need to have two loops there, we can store error for subsequent reporting. Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Dmitry Torokhov 提交于
Instead of separate "exclusive" and "allow_dummy" arguments, that formed 3 valid combinations (normal, exclusive and optional) and an invalid one, let's accept explicit "get_type", like we did in devm-managed code. Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Dmitry Torokhov 提交于
There is no point in assigning value to 'ret' before calling regulator_dev_lookup() as it will clobber 'ret' anyway. Also, let's explicitly return -PROBE_DEFER when try_module_get() fails, instead of relying that earlier initialization of "regulator" carries correct value. Signed-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 13 1月, 2017 1 次提交
-
-
由 Jon Hunter 提交于
When regulators are successfully registered, we check to see if the regulator is a supply for any other registered regulator and if so add the new regulator as the supply for the existing regulator(s). Some devices, such as Power Management ICs, may register a series of regulators when probed and there are cases where one of the regulators may fail to register and defer the probing of the parent device. In this case any successfully registered regulators would be unregistered so that they can be re-registered at some time later when the probe is attempted again. However, if one of the regulators that was registered was added as a supply to another registered regulator (that did not belong to the same parent device), then this supply regulator was unregister again because the parent device is probe deferred, then a regulator could be holding an invalid reference to a supply regulator that has been unregistered. This will lead to a system crash if that regulator is then used. Although it would be possible to check when unregistering a regulator if any other regulator in the system is using it as a supply, it still may not be possible to remove it as a supply if this other regulator is in use. Therefore, fix this by preventing any regulator from adding another regulator as a supply if the parent device for the supply regulator has not been bound and if the parent device for the supply and the regulator are different. This will allow a parent device that is registering regulators to be probe deferred and ensure that none of the regulators it has registered are used as supplies for any other regulator from another device. Signed-off-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 05 12月, 2016 1 次提交
-
-
由 David Lechner 提交于
This adds a trailing newline to a debug message. Signed-off-by: NDavid Lechner <david@lechnology.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 01 12月, 2016 1 次提交
-
-
由 Charles Keepax 提交于
Every function handling the mode within the regulator core uses an unsigned int for mode, except for regulator_mode_constrain. This patch changes the type of mode within regulator_mode_constrain which fixes several instances where we are passing pointers to unsigned ints then treating them as an int within this function. Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 05 11月, 2016 1 次提交
-
-
由 Axel Haslam 提交于
Regulator consumers can receive event notifications when errors are reported to the driver, but currently, there is no way for a regulator consumer to know when the error is over. To allow a regulator consumer to poll for error conditions add a new API: regulator_get_error_flags. Signed-off-by: NAxel Haslam <ahaslam@baylibre.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 29 10月, 2016 1 次提交
-
-
由 H. Nikolaus Schaller 提交于
commit 73e705bf ("regulator: core: Add set_voltage_time op") introduced a new rdev_warn() if the ramp_delay is 0. Apparently, on omap3/twl4030 platforms with dynamic voltage management this results in non-ending spurious messages like [ 511.143066] VDD1: ramp_delay not set [ 511.662322] VDD1: ramp_delay not set [ 513.903625] VDD1: ramp_delay not set [ 514.222198] VDD1: ramp_delay not set [ 517.062835] VDD1: ramp_delay not set [ 517.382568] VDD1: ramp_delay not set [ 520.142791] VDD1: ramp_delay not set [ 520.502593] VDD1: ramp_delay not set [ 523.062896] VDD1: ramp_delay not set [ 523.362701] VDD1: ramp_delay not set [ 526.143035] VDD1: ramp_delay not set I have observed this on GTA04 while it is reported to occur on N900 as well: https://bugzilla.kernel.org/show_bug.cgi?id=178371 This patch makes the warning appear only in debugging mode. Signed-off-by: NH. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 25 9月, 2016 1 次提交
-
-
由 Joonwoo Park 提交于
drms_uA_update() always returns failure when it cannot find regulator's input voltage. But if hardware supports load configuration with ops->set_load() and the input regulator isn't specified with valid reason such as the input regulator is battery, not finding input voltage is normal so such case should not return with an error. Avoid such inadequate error return by checking input/output voltages only when drms_uA_update() is about to configure load with enum based ops->set_mode(). Cc: Liam Girdwood <lgirdwood@gmail.com> Cc: Mark Brown <broonie@kernel.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: linux-kernel@vger.kernel.org Signed-off-by: NJoonwoo Park <joonwoop@codeaurora.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 17 9月, 2016 3 次提交
-
-
由 Matthias Kaehlcke 提交于
The new op is analogous to set_voltage_time_sel. It can be used by regulators which don't have a table of discrete voltages. The function returns the time for the regulator output voltage to stabilize after being set to a new value, in microseconds. If the op is not set a default implementation is used to calculate the delay. This change also removes the ramp_delay calculation in the PWM regulator, since the driver now uses the core code for the calculation of the delay. Signed-off-by: NMatthias Kaehlcke <mka@chromium.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Matthias Kaehlcke 提交于
The current code assumes that only the ramp_delay is used to determine the time needed for the voltage to stabilize. This may be true for the calculation done by regulator_set_voltage_time_sel(), however regulators can implement their own set_voltage_time_sel() op which would be skipped if no ramp delay is specified. Remove the check in _regulator_do_set_voltage(), the functions calculating the ramp delay return 0 anyway when the ramp delay is not configured. Signed-off-by: NMatthias Kaehlcke <mka@chromium.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Matthias Kaehlcke 提交于
If the voltage can not be set jump to the end of the function. This avoids having to check for an error multiple times and eliminates one level of nesting in a follow-up change. Signed-off-by: NMatthias Kaehlcke <mka@chromium.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 15 9月, 2016 1 次提交
-
-
由 Matthias Kaehlcke 提交于
Signed-off-by: NMatthias Kaehlcke <mka@chromium.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 17 8月, 2016 1 次提交
-
-
由 Bjorn Andersson 提交于
The patch was based on my missinterpretation of the API and only accidentally worked for me. Let's clean it out to not confuse others. This reverts commit 3ff3f518. Signed-off-by: NBjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 09 6月, 2016 1 次提交
-
-
由 Mark Brown 提交于
There is little obvious use case for a regualtor driver to know if it is possible to vary voltages at all by itself. If a consumer needs to limit what voltages it tries to set based on the system configuration then it will need to enumerate the possible voltages, and without that even if it is possible to change voltages that doesn't mean that constraints or other consumers will allow whatever change the driver is trying to do at a given time. It doesn't even indicate if _set_voltage() calls will work as noop _set_voltage() calls return success. There were no users of this API that weren't abusing it and now they're all gone so remove the API. Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 27 4月, 2016 1 次提交
-
-
由 Jon Hunter 提交于
The call to set_machine_constraints() in regulator_register(), will attempt to get the voltage for the regulator. If a regulator is in bypass will fail to get the voltage (ie. it's bypass voltage) and hence register the regulator, because the supply for the regulator has not been resolved yet. To fix this, add a call to regulator_resolve_supply() before we call set_machine_constraints(). If the call to regulator_resolve_supply() fails, rather than returning an error at this point, allow the registration of the regulator to continue because for some regulators resolving the supply at this point may not be necessary and it will be resolved later as more regulators are added. Furthermore, if the supply is still not resolved for a bypassed regulator, this will be detected when we attempt to get the voltage for the regulator and an error will be propagated at this point. If a bypassed regulator does not have a supply when we attempt to get the voltage, rather than returing -EINVAL, return -EPROBE_DEFER instead to allow the registration of the regulator to be deferred and tried again later. Please note that regulator_resolve_supply() will call regulator_dev_lookup() which may acquire the regulator_list_mutex. To avoid any deadlocks we cannot hold the regulator_list_mutex when calling regulator_resolve_supply(). Therefore, rather than holding the lock around a large portion of the registration code, just hold the lock when aquiring any GPIOs and setting up supplies because these sections may add entries to the regulator_map_list and regulator_ena_gpio_list, respectively. Signed-off-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 26 4月, 2016 1 次提交
-
-
由 WEN Pingbo 提交于
To make the code more compat and centralized, this patch add a unified function - regulator_ops_is_valid. So we can add some extra checking code easily later. Signed-off-by: NWEN Pingbo <pingbo.wen@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 22 4月, 2016 4 次提交
-
-
由 Jon Hunter 提交于
The public functions to acquire a regulator, such as regulator_get(), internally look-up the regulator from the list of regulators that have been registered with the regulator device class. The registration of a new regulator with the regulator device class happens before the regulator has been completely setup. Therefore, it is possible that the regulator could be acquired before it has been setup successfully. To avoid this move the device registration of the regulator to the end of the regulator setup and update the error exit path accordingly. Signed-off-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Jon Hunter 提交于
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: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Jon Hunter 提交于
The function regulator_register_resolve_supply() is called from the context of class_for_each_dev() (during the regulator registration) to resolve any supplies added. regulator_register_resolve_supply() will return an error if a regulator's supply cannot be resolved and this will terminate the loop in class_for_each_dev(). This means that we will not attempt to resolve any other supplies after one has failed. Hence, this may delay the resolution of other regulator supplies until the failing one itself can be resolved. Rather than terminating the loop early, don't return an error code and keep attempting to resolve any other supplies for regulators that have been registered. Signed-off-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Richard Fitzgerald 提交于
There are debugfs entries for voltage and current, but not for the constraint flags. It's useful for debugging to be able to see what these flags are so this patch adds a new debugfs file. We can't use debugfs_create_bool for this because the flags are bitfields, so as this needs a special read callback they have been collected into a single file that lists all the flags. Signed-off-by: NRichard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 19 4月, 2016 1 次提交
-
-
由 Tero Kristo 提交于
suspend_prepare can be called during regulator init time also, where the mutex is not locked yet. This causes a false lockdep warning. To avoid the problem, remove the lockdep assertion from the function causing the issue. An alternative would be to lock the mutex during init, but this would cause other problems (some APIs used during init will attempt to lock the mutex also, causing deadlock.) Signed-off-by: NTero Kristo <t-kristo@ti.com> Reported-by: NTomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 13 4月, 2016 2 次提交
-
-
由 Mark Brown 提交于
When we acquire a shareable enable GPIO on probe we do so with the regulator_list_mutex held. However when we release the GPIOs we do this immediately after dropping the mutex meaning that the list could become corrupted. Move the release into the locked region to avoid this. Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Boris Brezillon 提交于
device_register() is calling ->get_voltage() as part of it's sysfs attribute initialization process, and this functions might need to know the regulator constraints to return a valid value. This is at least true for the pwm regulator driver (when operating in continuous mode) which needs to know the minimum and maximum voltage values to calculate the current voltage: min_uV + (((max_uV - min_uV) * dutycycle) / 100); Move device_register() after set_machine_constraints() to make sure those constraints are correctly initialized when ->get_voltage() is called. Signed-off-by: NBoris Brezillon <boris.brezillon@free-electrons.com> Reported-by: NStephen Barber <smbarber@chromium.org> Tested-by: NCaesar Wang <wxt@rock-chips.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 12 4月, 2016 1 次提交
-
-
由 Mark Brown 提交于
When a regulator is in bypass mode it is functioning as a switch returning the voltage set in the regulator will not give the voltage being output by the regulator as it's just passing through its supply. This means that when we are getting the voltage from a regulator we should check to see if it is in bypass mode and if it is we should report the voltage from the supply rather than that which is set on the regulator. Reported-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org> [treding@nvidia.com: return early for bypass mode] Signed-off-by: NThierry Reding <treding@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 31 3月, 2016 1 次提交
-
-
由 Jon Hunter 提交于
Commit 5e3ca2b3 ("regulator: Try to resolve regulators supplies on registration") added a call to regulator_resolve_supply() within regulator_register() where the regulator_list_mutex is held. This causes a deadlock to occur on the Tegra114 Dalmore board when the palmas PMIC is registered because regulator_register_resolve_supply() calls regulator_dev_lookup() which may try to acquire the regulator_list_mutex again. Fix this by releasing the mutex before calling regulator_register_resolve_supply() and update the error exit path to ensure the mutex is released on an error. [Made commit message more legible -- broonie] Signed-off-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-