summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/core.c
Commit message (Collapse)AuthorAgeFilesLines
...
* | regulator: core: Resolve supplies before disabling unused regulatorsJavier Martinez Canillas2017-02-161-0/+10
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | After commit 66d228a2bf03 ("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: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'regulator/topic/arizona', ↵Mark Brown2016-12-121-0/+33
|\ \ | | | | | | | | | 'regulator/topic/bypass', 'regulator/topic/error' and 'regulator/topic/fixed' into regulator-next
| | * regulator: core: Add new API to poll for error conditionsAxel Haslam2016-11-041-0/+33
| |/ | | | | | | | | | | | | | | | | | | | | | | 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: Axel Haslam <ahaslam@baylibre.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | Merge remote-tracking branch 'regulator/topic/core' into regulator-nextMark Brown2016-12-121-2/+3
|\ \
| * | regulator: core: add newline in debug messageDavid Lechner2016-12-051-1/+1
| | | | | | | | | | | | | | | | | | | | | This adds a trailing newline to a debug message. Signed-off-by: David Lechner <david@lechnology.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | regulator: core: Correct type of mode in regulator_mode_constrainCharles Keepax2016-11-301-1/+2
| |/ | | | | | | | | | | | | | | | | | | | | 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: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* / regulator: core: silence warning: "VDD1: ramp_delay not set"H. Nikolaus Schaller2016-10-281-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit 73e705bf81ce ("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: H. Nikolaus Schaller <hns@goldelico.com> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'regulator/topic/of', ↵Mark Brown2016-09-301-40/+72
|\ \ | | | | | | | | | 'regulator/topic/pv88080', 'regulator/topic/rk808', 'regulator/topic/set-voltage' and 'regulator/topic/tps65218' into regulator-next
| | * regulator: core: Add set_voltage_time opMatthias Kaehlcke2016-09-161-27/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * regulator: core: Don't skip set_voltage_time when ramp delay disabledMatthias Kaehlcke2016-09-161-6/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * regulator: core: Simplify error flow in _regulator_do_set_voltage()Matthias Kaehlcke2016-09-161-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * regulator: core: Use local ops variable in _regulator_do_set_voltage()Matthias Kaehlcke2016-09-141-10/+10
| |/ | | | | | | | | Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| |
| \
*-. \ Merge remote-tracking branches 'regulator/topic/bulk', ↵Mark Brown2016-09-301-22/+20Star
|\ \ \ | |_|/ |/| | | | | 'regulator/topic/dbx500', 'regulator/topic/hi6421', 'regulator/topic/load' and 'regulator/topic/ltc3676' into regulator-next
| | * regulator: core: don't return error with inadequate reasonJoonwoo Park2016-09-241-18/+18
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Joonwoo Park <joonwoop@codeaurora.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| * regulator: Remove support for optional supplies in the bulk APIBjorn Andersson2016-08-161-4/+2Star
|/ | | | | | | | | | 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 3ff3f518a135fa4592fe2817e9ac2cce1fa23dc2. Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
* regulator: Remove regulator_can_change_voltage()Mark Brown2016-06-091-27/+0Star
| | | | | | | | | | | | | | | | 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: Mark Brown <broonie@kernel.org>
*---. Merge remote-tracking branches 'regulator/topic/can-change', ↵Mark Brown2016-05-131-59/+83
|\ \ \ | | | | | | | | | | | | 'regulator/topic/constrain', 'regulator/topic/debugfs' and 'regulator/topic/doc' into regulator-next
| | | * regulator: core: Add debugfs to show constraint flagsRichard Fitzgerald2016-04-221-0/+52
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * regulator: refactor valid_ops_mask checking codeWEN Pingbo2016-04-251-59/+29Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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: WEN Pingbo <pingbo.wen@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * regulator: core: Log when we bring constraints into rangeMark Brown2016-03-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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: Mark Brown <broonie@kernel.org>
* | | Merge remote-tracking branch 'regulator/topic/supply' into regulator-nextMark Brown2016-05-131-26/+41
|\ \ \
| * | | regulator: core: Add early supply resolution for regulatorsJon Hunter2016-04-271-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | Merge branch 'topic/bypass' of ↵Mark Brown2016-04-271-0/+14
| |\ \ \ | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-supply
| * | | | regulator: core: Move registration of regulator deviceJon Hunter2016-04-221-15/+9Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | | Merge branch 'topic/sysfs-init' of ↵Mark Brown2016-04-221-10/+10
| |\ \ \ \ | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-supply
| | * | | | regulator: reorder initialization steps in regulator_register()Boris Brezillon2016-04-131-10/+10
| | | |/ / | | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Boris Brezillon <boris.brezillon@free-electrons.com> Reported-by: Stephen Barber <smbarber@chromium.org> Tested-by: Caesar Wang <wxt@rock-chips.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | | regulator: core: Clear the supply pointer if enabling failsJon Hunter2016-04-221-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During the resolution of a regulator's supply, we may attempt to enable the supply if the regulator itself is already enabled. If enabling the supply fails, then we will call _regulator_put() for the supply. However, the pointer to the supply has not been cleared for the regulator and this will cause a crash if we then unregister the regulator and attempt to call regulator_put() a second time for the supply. Fix this by clearing the supply pointer if enabling the supply after fails when resolving the supply for a regulator. Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | | regulator: core: Don't terminate supply resolution earlyJon Hunter2016-04-221-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | | | Merge remote-tracking branch 'regulator/topic/core' into regulator-nextMark Brown2016-05-131-3/+1Star
|\ \ \ \ \
| * | | | | regulator: core: remove lockdep assert from suspend_prepareTero Kristo2016-04-181-2/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Tero Kristo <t-kristo@ti.com> Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| * | | | | regulator: Remove unneded check for regulator supplyJavier Martinez Canillas2016-03-211-1/+1
| | |/ / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The regulator_resolve_supply() function checks if a supply has been associated with a regulator to avoid enabling it if that is not the case. But the supply was already looked up with regulator_resolve_supply() and set with set_supply() before the check and both return on error. So the fact that this statement has been reached means that neither of them failed and a supply must be associated with the regulator. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | | | Merge remote-tracking branch 'regulator/topic/bypass' into regulator-nextMark Brown2016-05-131-0/+14
|\ \ \ \ \ | | |_|/ / | |/| | |
| * | | | regulator: core: Use parent voltage from the supply when bypassedMark Brown2016-04-121-0/+14
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org> [treding@nvidia.com: return early for bypass mode] Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | | |
| \ \ \
*-. \ \ \ Merge remote-tracking branches 'regulator/fix/constrain' and ↵Mark Brown2016-05-131-11/+38
|\ \ \ \ \ | | | |/ / | | |/| / | | |_|/ | |/| | 'regulator/fix/defer' into regulator-linus
| | * | regulator: Fix deadlock during regulator registrationJon Hunter2016-03-301-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 5e3ca2b349b1 ("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: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | * | regulator: Try to resolve regulators supplies on registrationJavier Martinez Canillas2016-03-281-0/+9
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 6261b06de565 ("regulator: Defer lookup of supply to regulator_get") moved the regulator supplies lookup logic from the regulators registration to the regulators get time. Unfortunately, that changed the behavior of the regulator core since now a parent supply with a child regulator marked as always-on, won't be enabled unless a client driver attempts to get the child regulator during boot. This patch tries to resolve the parent supply for the already registered regulators each time that a new regulator is registered. So the regulators that have child regulators marked as always on will be enabled regardless if a driver gets the child regulator or not. That was the behavior before the mentioned commit, since parent supplies were looked up at regulator registration time instead of during child get. Since regulator_resolve_supply() checks for rdev->supply, most of the times it will be a no-op. Errors aren't checked to keep the possible out of order dependencies which was the motivation for the mentioned commit. Also, the supply being available will be enforced on regulator get anyways in case the resolve fails on regulators registration. Fixes: 6261b06de565 ("regulator: Defer lookup of supply to regulator_get") Suggested-by: Mark Brown <broonie@kernel.org> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: <stable@vger.kernel.org> # 4.1+
| * / regulator: core: Ensure we are at least in bounds for our constraintsMark Brown2016-03-271-7/+25
| |/ | | | | | | | | | | | | | | | | | | | | | | | | 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: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Tested-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | regulator: core: Fix locking of GPIO list on freeMark Brown2016-04-131-1/+1
| | | | | | | | | | | | | | | | | | 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: Mark Brown <broonie@kernel.org>
* | regulator: core: Remove duplicate copy of active-discharge parsingVladimir Zapolskiy2016-03-251-11/+0Star
|/ | | | | | | | | | | | | | | | Apparently due to a wrongly resolved merge conflict between two branches, which contained the same commit, the commit contents partially was added two times in a row. This change reverts the latter wrong inclusion of commit 909f7ee0b5f3 ("regulator: core: Add support for active-discharge configuration"). The first applied commit 670666b9e0af ("regulator: core: Add support for active-discharge configuration") is not touched. Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com> Cc: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
*-. Merge remote-tracking branches 'regulator/topic/ltc3589', ↵Mark Brown2016-03-131-0/+11
|\ \ | | | | | | | | | 'regulator/topic/max77620', 'regulator/topic/max77686', 'regulator/topic/max77802' and 'regulator/topic/maxim' into regulator-next
| | * regulator: core: Add support for active-discharge configurationLaxman Dewangan2016-03-021-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| | |
| \ \
| \ \
| \ \
*---. | | Merge remote-tracking branches 'regulator/topic/discharge', ↵Mark Brown2016-03-131-0/+11
|\ \ \| | | | |_|/ | |/| | | | | | 'regulator/topic/fan53555', 'regulator/topic/gpio', 'regulator/topic/hi655x' and 'regulator/topic/lp872x' into regulator-next
| * | | regulator: core: Add support for active-discharge configurationLaxman Dewangan2016-03-021-0/+11
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | 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: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | regulator: core: fix crash in error path of regulator_registerKrzysztof Adamski2016-02-251-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This problem was introduced by: commit daad134d6649 ("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: Krzysztof Adamski <krzysztof.adamski@tieto.com> Reported-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* | | Merge branch 'fix/core' of ↵Mark Brown2016-02-251-17/+12Star
|\ \ \ | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-core
| * | | regulator: core: Rely on regulator_dev_release to free constraintsCharles Keepax2016-01-271-17/+12Star
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As we now free the constraints in regulator_dev_release we will still call free on the constraints pointer even if we went down an error path in regulator_register, because it is only allocated after the device_register. As such we no longer need to free rdev->constraints on the error paths, so this patch removes said frees. Fixes: 29f5f4860a8e ("regulator: core: Move more deallocation into class unregister") Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* / / regulator: core: Request GPIO before creating sysfs entriesKrzysztof Adamski2016-02-221-10/+10
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Krzysztof Adamski <krzysztof.adamski@tieto.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| |
| \
*-. \ Merge remote-tracking branches 'regulator/topic/lp8788', ↵Mark Brown2016-01-121-2/+4
|\ \ \ | | |/ | |/| | | | 'regulator/topic/mt6311', 'regulator/topic/optional', 'regulator/topic/palmas' and 'regulator/topic/pv88060' into regulator-next
| | * regulator: Make bulk API support optional suppliesBjorn Andersson2015-11-171-2/+4
| |/ | | | | | | | | | | | | | | 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: Bjorn Andersson <bjorn.andersson@sonymobile.com> Signed-off-by: Mark Brown <broonie@kernel.org>
| |
| \
*-. \ Merge remote-tracking branches 'regulator/topic/const', ↵Mark Brown2016-01-121-1/+9
|\ \ \ | | |/ | |/| | | | 'regulator/topic/lm363x', 'regulator/topic/lockdep' and 'regulator/topic/lp872x' into regulator-next