- 30 3月, 2016 1 次提交
-
-
由 Mark Brown 提交于
This aids in debugging problems triggered by the regulator core applying its constraints, we could potentially crash immediately after updating the voltage if the constraints are buggy. Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 27 3月, 2016 1 次提交
-
-
由 Mark Brown 提交于
Currently we only attempt to set the voltage during constraints application if an exact voltage is specified. Extend this so that if the currently set voltage for the regulator is outside the bounds set in constraints we will move the voltage to the nearest constraint, raising to the minimum or lowering to the maximum as needed. This ensures that drivers can probe without the hardware being driven out of spec. Reported-by: NIvaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Tested-by: NIvaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 02 3月, 2016 2 次提交
-
-
由 Laxman Dewangan 提交于
Add support to enable/disable active discharge of regulator via machine constraints. This configuration is done when setting machine constraint during regulator register and if regulator driver implemented the callback ops. Signed-off-by: NLaxman Dewangan <ldewangan@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Laxman Dewangan 提交于
Add support to enable/disable active discharge of regulator via machine constraints. This configuration is done when setting machine constraint during regulator register and if regulator driver implemented the callback ops. Signed-off-by: NLaxman Dewangan <ldewangan@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 25 2月, 2016 1 次提交
-
-
由 Krzysztof Adamski 提交于
This problem was introduced by: commit daad134d ("regulator: core: Request GPIO before creating sysfs entries") The error path was not updated correctly after moving GPIO registration code and in case regulator_ena_gpio_free failed, device_unregister() was called even though device_register() was not yet called. This problem breaks the boot at least on all Tegra 32-bit devices. It will also crash each device that specifices GPIO that is unavaiable at regulator_register call. Here's error log I've got when forced GPIO to be invalid: [ 1.116612] usb-otg-vbus-reg: Failed to request enable GPIO10: -22 [ 1.122794] Unable to handle kernel NULL pointer dereference at virtual address 00000044 [ 1.130894] pgd = c0004000 [ 1.133598] [00000044] *pgd=00000000 [ 1.137205] Internal error: Oops: 5 [#1] SMP ARM and here's backtrace from KDB: Exception stack(0xef11fbd0 to 0xef11fc18) fbc0: 00000000 c0738a14 00000000 00000000 fbe0: c0b2a0b0 00000000 00000000 c0738a14 c0b5fdf8 00000001 ef7f6074 ef11fc4c fc00: ef11fc50 ef11fc20 c02a8344 c02a7f1c 60000013 ffffffff [<c010cee0>] (__dabt_svc) from [<c02a7f1c>] (kernfs_find_ns+0x18/0xf8) [<c02a7f1c>] (kernfs_find_ns) from [<c02a8344>] (kernfs_find_and_get_ns+0x40/0x58) [<c02a8344>] (kernfs_find_and_get_ns) from [<c02ac4a4>] (sysfs_unmerge_group+0x28/0x68) [<c02ac4a4>] (sysfs_unmerge_group) from [<c044389c>] (dpm_sysfs_remove+0x30/0x5c) [<c044389c>] (dpm_sysfs_remove) from [<c0436ba8>] (device_del+0x48/0x1f4) [<c0436ba8>] (device_del) from [<c0436d84>] (device_unregister+0x30/0x6c) [<c0436d84>] (device_unregister) from [<c0403910>] (regulator_register+0x6d0/0xdac) [<c0403910>] (regulator_register) from [<c04052d4>] (devm_regulator_register+0x50/0x84) [<c04052d4>] (devm_regulator_register) from [<c0406298>] (reg_fixed_voltage_probe+0x25c/0x3c0) [<c0406298>] (reg_fixed_voltage_probe) from [<c043d21c>] (platform_drv_probe+0x60/0xb0) [<c043d21c>] (platform_drv_probe) from [<c043b078>] (driver_probe_device+0x24c/0x440) [<c043b078>] (driver_probe_device) from [<c043b5e8>] (__device_attach_driver+0xc0/0x120) [<c043b5e8>] (__device_attach_driver) from [<c043901c>] (bus_for_each_drv+0x6c/0x98) [<c043901c>] (bus_for_each_drv) from [<c043ad20>] (__device_attach+0xac/0x138) [<c043ad20>] (__device_attach) from [<c043b664>] (device_initial_probe+0x1c/0x20) [<c043b664>] (device_initial_probe) from [<c043a074>] (bus_probe_device+0x94/0x9c) [<c043a074>] (bus_probe_device) from [<c043a610>] (deferred_probe_work_func+0x80/0xcc) [<c043a610>] (deferred_probe_work_func) from [<c01381d0>] (process_one_work+0x158/0x454) [<c01381d0>] (process_one_work) from [<c013854c>] (worker_thread+0x38/0x510) [<c013854c>] (worker_thread) from [<c013e154>] (kthread+0xe8/0x104) [<c013e154>] (kthread) from [<c0108638>] (ret_from_fork+0x14/0x3c) Signed-off-by: NKrzysztof Adamski <krzysztof.adamski@tieto.com> Reported-by: NJon Hunter <jonathanh@nvidia.com> Acked-by: NJon Hunter <jonathanh@nvidia.com> Tested-by: NJon Hunter <jonathanh@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 22 2月, 2016 1 次提交
-
-
由 Krzysztof Adamski 提交于
regulator_attr_is_visible (which is a .is_visible callback of regulator_dev_group attribute_grpup) checks rdev->ena_pin to decide if "status" file should be present in sysfs. This field is set at the end of regulator_ena_gpio_request so it has to be called before device_register() otherwise this test will always fail, causing "status" file to not be visible. Since regulator_attr_is_visible also tests for is_enabled() op, this problem is only visible for regulators that does not define this callback, like regulator-fixed.c. Signed-off-by: NKrzysztof Adamski <krzysztof.adamski@tieto.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 27 1月, 2016 1 次提交
-
-
由 Charles Keepax 提交于
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: 29f5f486 ("regulator: core: Move more deallocation into class unregister") Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 07 1月, 2016 1 次提交
-
-
由 Dan 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 d4283e93 ('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. Signed-off-by: NDan Carpenter <dan.carpenter@oracle.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 05 1月, 2016 1 次提交
-
-
由 Geliang Tang 提交于
Use dev_to_rdev() instead of open-coding it. Signed-off-by: NGeliang Tang <geliangtang@163.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 03 12月, 2015 2 次提交
-
-
由 Thierry Reding 提交于
Commit fa731ac7 ("regulator: core: avoid unused variable warning") introduced a subtle change in how supplies are locked. Where previously code was always locking the regulator of the current iteration, the new implementation only locks the regulator if it has a supply. For any given power tree that means that the root will never get locked. On the other hand the regulator_unlock_supply() will still release all the locks, which in turn causes the lock debugging code to warn about a mutex being unlocked which wasn't locked. Cc: Mark Brown <broonie@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Fixes: Fixes: fa731ac7 ("regulator: core: avoid unused variable warning") Signed-off-by: NThierry Reding <treding@nvidia.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Mark Brown 提交于
The latest workaround for the lockdep interface's not using the second argument of mutex_lock_nested() changed the loop missed locking the last regulator due to a thinko with the loop termination condition exiting one regulator too soon. Reported-by: NTyler Baker <tyler.baker@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 28 11月, 2015 1 次提交
-
-
由 Arnd Bergmann 提交于
As noticed by Geert Uytterhoeven, my patch to avoid a harmless build warning in regulator_lock_supply() was total crap and introduced a real bug: > [ BUG: bad unlock balance detected! ] > kworker/u4:0/6 is trying to release lock (&rdev->mutex) at: > [<c0247b84>] regulator_set_voltage+0x38/0x50 we still lock the regulator supplies, but not the actual regulators, so we are missing a lock, and the unlock is unbalanced. This rectifies it by first locking the regulator device itself before using the same loop as before to lock its supplies. Reported-by: NGeert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: NArnd Bergmann <arnd@arndb.de> Fixes: 716fec9d1965 ("[SUBMITTED] regulator: core: avoid unused variable warning") Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 21 11月, 2015 1 次提交
-
-
由 Arnd Bergmann 提交于
The second argument of the mutex_lock_nested() helper is only evaluated if CONFIG_DEBUG_LOCK_ALLOC is set. Otherwise we get this build warning for the new regulator_lock_supply function: drivers/regulator/core.c: In function 'regulator_lock_supply': drivers/regulator/core.c:142:6: warning: unused variable 'i' [-Wunused-variable] To avoid the warning, this restructures the code to make it both simpler and to move the 'i++' outside of the mutex_lock_nested call, where it is now always used and the variable is not flagged as unused. We had some discussion about changing mutex_lock_nested to an inline function, which would make the code do the right thing here, but in the end decided against it, in order to guarantee that mutex_lock_nested() does not introduced overhead without CONFIG_DEBUG_LOCK_ALLOC. Signed-off-by: NArnd Bergmann <arnd@arndb.de> Fixes: 9f01cd4a ("regulator: core: introduce function to lock regulators and its supplies") Link: http://permalink.gmane.org/gmane.linux.kernel/2068900Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 18 11月, 2015 1 次提交
-
-
由 Bjorn Andersson 提交于
Make it possible to use the bulk API with optional supplies, by allowing the consumer to marking supplies as optional in the regulator_bulk_data. Signed-off-by: NBjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 04 11月, 2015 1 次提交
-
-
由 Mark Brown 提交于
Since we need to read voltages of parents as part of setting supply voltages we need to be able to do get_voltage() internally without taking locks so reorganize the locking to take locks on the full tree on entry rather than as we recurse when called externally. Reported-by: NJohn Stultz <john.stultz@linaro.org> Tested-by: NJohn Stultz <john.stultz@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 22 10月, 2015 1 次提交
-
-
由 Sascha Hauer 提交于
Until now changing the voltage of a regulator only ever effected the regulator itself, but never its supplies. It's a common pattern though to put LDO regulators behind switching regulators. The switching regulators efficiently drop the input voltage but have a high ripple on their output. The output is then cleaned up by the LDOs. For higher energy efficiency the voltage drop at the LDOs should be minimized. For this scenario we need to propagate the voltage change to the supply regulators. Another scenario where voltage propagation is desired is a regulator which only consists of a switch and thus cannot regulate voltages itself. In this case we can pass setting voltages to the supply. This patch adds support for voltage propagation. We do voltage propagation when the current regulator has a minimum dropout voltage specified or if the current regulator lacks a get_voltage operation (indicating it's a switch and not a regulator). Changing the supply voltage must be done carefully. When we are increasing the current regulators output we must first increase the supply voltage and then the regulator itself. When we are decreasing the current regulators voltage we must decrease the supply voltage after changing the current regulators voltage. Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 20 10月, 2015 1 次提交
-
-
由 Sascha Hauer 提交于
_regulator_call_set_voltage has code to translate a minimum/maximum voltage pair into a selector. This code is useful for others aswell, so create a regulator_map_voltage function. Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 17 10月, 2015 1 次提交
-
-
由 Sascha Hauer 提交于
The unlocked version will be needed when we start propagating voltage changes to the supply regulators. Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 01 10月, 2015 3 次提交
-
-
由 Sascha Hauer 提交于
The unlocked version will be needed when we start propagating voltage changes to the supply regulators. Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Sascha Hauer 提交于
Each regulator_dev is locked with its own mutex. This is fine as long as only one regulator_dev is locked, but makes lockdep unhappy when we have to walk up the supply chain like it can happen in regulator_get_voltage: regulator_get_voltage -> mutex_lock(®ulator->rdev->mutex) -> _regulator_get_voltage(regulator->rdev) -> regulator_get_voltage(rdev->supply) -> mutex_lock(®ulator->rdev->mutex); This causes lockdep to issue a possible deadlock warning. There are at least two ways to work around this: - We can always lock the whole supply chain using the functions introduced with this patch. - We could store the current voltage in struct regulator_rdev so that we do not have to walk up the supply chain for the _regulator_get_voltage case. Anyway, regulator_lock_supply/regulator_unlock_supply will be needed once we allow regulator_set_voltage to optimize the supply voltages. Signed-off-by: NSascha Hauer <s.hauer@pengutronix.de> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Mark Brown 提交于
When resolving regulator-regulator supplies we ignore probe deferral returns from regulator_dev_lookup() (such as are generated for DT when we can see a supply is registered) and just fall back to the dummy regulator if there are full constraints (as is the case for DT). This means that probe deferral is broken for DT systems, fix that by paying attention to -EPROBE_DEFER return codes like we do -ENODEV. A further patch will simplify this further, this is a minimal fix for the specific issue. Fixes: 9f7e25ed (regulator: core: Handle full constraints systems when resolving supplies) Reported-by: NSascha Hauer <s.hauer@pengutronix.de> Tested-by: NSascha Hauer <s.hauer@pengutronix.de> Signed-off-by: NMark Brown <broonnie@kernel.org> Cc: stable@vger.kernel.org
-
- 22 9月, 2015 1 次提交
-
-
由 Tomeu Vizoso 提交于
As we are already registering a device with regulator_class for each regulator device, regulator_list is redundant and can be replaced with calls to class_find_device() and class_for_each_device(). Signed-off-by: NTomeu Vizoso <tomeu.vizoso@collabora.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 18 9月, 2015 1 次提交
-
-
由 Charles Keepax 提交于
The ret pointer passed to regulator_dev_lookup is only filled with a valid error code if regulator_dev_lookup returned NULL. Currently regulator_resolve_supply checks this ret value before it checks if a regulator was returned, this can result in valid regulator lookups being ignored. Fixes: 6261b06d ("regulator: Defer lookup of supply to regulator_get") Signed-off-by: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: NMark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
-
- 17 9月, 2015 1 次提交
-
-
由 Stephen Boyd 提交于
The same error print exists 4 times in the regulator core <rdev>: operation not allowed Unfortunately, seeing this in the dmesg is not very informative. Add what type of operation is not allowed to the message so that these errors are unique, hopefully pointing developers in the right direction <rdev>: drms operation not allowed <rdev>: voltage operation not allowed <rdev>: current operation not allowed <rdev>: mode operation not allowed Signed-off-by: NStephen Boyd <sboyd@codeaurora.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 02 9月, 2015 1 次提交
-
-
由 Sudip Mukherjee 提交于
We were checking rdev->supply for NULL after dereferencing it. Lets check for rdev->supply along with _regulator_is_enabled() and call regulator_enable() only if rdev->supply is not NULL. Signed-off-by: NSudip Mukherjee <sudip@vectorindia.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 29 8月, 2015 1 次提交
-
-
由 Archit Taneja 提交于
When calling regulator_set_load, regulator_check_drms prints and returns an error if the regulator device's flag REGULATOR_CHANGE_DRMS isn't set. drms_uA_update, however, bails out without reporting an error. Replace the error print with a debug level print so that we don't get such prints when the underlying regulator doesn't support DRMS. Signed-off-by: NArchit Taneja <architt@codeaurora.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 18 8月, 2015 1 次提交
-
-
由 Viresh Kumar 提交于
Use IS_ERR_OR_NULL() rather than open coding it. Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 15 8月, 2015 1 次提交
-
-
由 Stephen Boyd 提交于
Failure to create a debugfs node is not an error, but we print a warning upon failure to create the node. Downgrade this to a debug printk so that we're quiet here. This allows multiple drivers to request a CPU's regulator so that CPUfreq and AVSish drivers can coexist. The downside of this approach is that whoever gets to debugfs first the others who come later to not have any debugfs attributes associated with them. Signed-off-by: NStephen Boyd <sboyd@codeaurora.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 13 8月, 2015 1 次提交
-
-
由 Viresh Kumar 提交于
Trivial spell fix, s/succesfully/successfully. Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 12 8月, 2015 3 次提交
-
-
由 Mark Brown 提交于
The regulator_list has exactly the same contents as the list that the driver core maintains of regulator_class members so is redundant. As a first step in converting over to use the class device list convert our iteration in late_initcall() to use the class device iterator. Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Mark Brown 提交于
We really ought to be using the class dvice lifetime management features more than we are rather than open coding them so take a step towards that by moving some of the simplest deallocations to the dev_release() function. Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Mark Brown 提交于
When we release a regulator we need to remove references to it from the rdev which means locking the rdev. Currently we also free resources associated with the regulator inside the rdev lock but there is no need to do this, we can reduce the region the lock is held by restricting it to just actions that affect the rdev. Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 07 8月, 2015 1 次提交
-
-
由 Mark Brown 提交于
When removing a regulator we hold regulator_list_mutex in order to ensure the regualtor doesn't become removed again. However we only need to protect the list until we remove the regulator from the list so move the unlock earlier to reduce the locked region. Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 25 7月, 2015 1 次提交
-
-
由 Stephen Boyd 提交于
Some regulators can automatically shut down when they detect an over current event. Add an op (set_over_current_protection) and a DT property + constraint to support this capability. Signed-off-by: NStephen Boyd <sboyd@codeaurora.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 17 7月, 2015 2 次提交
-
-
由 Javier Martinez Canillas 提交于
The regulator_resolve_supply() function calls set_supply() which in turn calls create_regulator() to allocate a supply regulator. If an error occurs after set_supply() succeeded, the allocated regulator has to be freed before propagating the error code. Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Javier Martinez Canillas 提交于
When a regulator is unregistered with regulator_unregister(), a call to regulator_put() is made for its input supply if there is one. This does a module_put() to decrement the refcount of the module that owns the supply but there isn't a corresponding try_module_get() in set_supply() to make the calls balanced. Signed-off-by: NJavier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 15 7月, 2015 1 次提交
-
-
由 Mark Brown 提交于
When resolving device supplies if we fail to look up the regulator we substitute in the dummy supply instead if the system has fully specified constraints. When resolving supplies for regulators we do not have the equivalent code and instead just directly use the regulator_dev_lookup() result causing spurious failures. This does not affect DT systems since we are able to detect missing mappings directly as part of regulator_dev_lookup() and so have appropriate handling in the DT specific code. Reported-by: NChristian Hartmann <cornogle@googlemail.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 07 7月, 2015 1 次提交
-
-
由 Krzysztof Kozlowski 提交于
Add lockdep_assert_held_once() to functions explicitly mentioning that rdev or regulator_list mutex must be held. Using WARN_ONCE shouldn't pollute the dmesg to much. The patch (if CONFIG_LOCKDEP enabled) will show warnings in certain regulators calling regulator_notifier_call_chain() without rdev->mutex held. Signed-off-by: NKrzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: NMark Brown <broonie@kernel.org>
-
- 12 6月, 2015 2 次提交
-
-
由 Stephen Boyd 提交于
Some regulators can limit their input current (typically annotated as ilim). Add an op (set_input_current_limit) and a DT property + constraint to support this. Signed-off-by: NStephen Boyd <sboyd@codeaurora.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-
由 Stephen Boyd 提交于
Some regulators support a "soft start" feature where the voltage ramps up slowly when the regulator is enabled. Add an op (set_soft_start) and a DT property + constraint to support this. Signed-off-by: NStephen Boyd <sboyd@codeaurora.org> Signed-off-by: NMark Brown <broonie@kernel.org>
-