summaryrefslogtreecommitdiff
path: root/drivers/regulator/max8973-regulator.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-11regulator: max8973: Let core handle GPIO descriptorLinus Walleij1-1/+7
The probe path of this driver is a bit complex: sometimes the GPIO descriptor is passed to the regulator core, sometimes it is not. To handle it in a simple way: stick with the devm_* resource management and unhinge the GPIO descriptor devres handling right before passing it to the regulator core, if we pass it to the regulator core. Fixes: e7d2be696faa ("regulator: max8973: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-10-15regulator: Fetch enable gpiods nonexclusiveLinus Walleij1-0/+1
Since the core regulator code is treating GPIO descriptors as nonexclusive, i.e. it assumes that the enable GPIO line may be shared with several regulators, let's add the flag introduced for fixing this problem on fixed regulators to all drivers fetching GPIO descriptors to avoid possible regressions. Reported-by: Mark Brown <broonie@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2018-05-24regulator: max8973: Pass descriptor instead of GPIO numberLinus Walleij1-25/+29
Instead of passing a global GPIO number, pass a descriptor looked up with the standard devm_gpiod_get_optional() call. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-09-27thermal: Enhance thermal_zone_device_update for eventsSrinivas Pandruvada1-1/+2
Added one additional parameter to thermal_zone_device_update() to provide caller with an optional capability to specify reason. Currently this event is used by user space governor to trigger different processing based on event code. Also it saves an additional call to read temperature when the event is received. The following events are cuurently defined: - Unspecified event - New temperature sample - Trip point violated - Trip point changed - thermal device up and down - thermal device power capability changed Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2016-05-30regulator: max8973: Fix setting ramp delayAxel Lin1-10/+6
Current code can set ramp delay to a wrong setting that the return value from .set_voltage_time_sel is not enough for proper delay. Fix the logic in .set_ramp_delay and also remove unused ret_val variable. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2016-04-13regulator: max8973: add support for junction thermal warningLaxman Dewangan1-0/+97
The driver MAX8973 supports the driver for Maxim PMIC MAX77621. MAX77621 supports the junction temp warning at 120 degC and 140 degC which is configurable. It generates alert signal when junction temperature crosses these threshold. MAX77621 does not support the continuous temp monitoring of junction temperature. It just report whether junction temperature crossed the threshold or not. Add support to - Configure junction temp warning threshold via DT property to generate alert when it crosses the threshold. - Add support to interrupt the host from this device when alert occurred. - read the junction temp via thermal framework. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-08-30Merge remote-tracking branches 'regulator/topic/mt6311', ↵Mark Brown1-1/+0
'regulator/topic/ocp', 'regulator/topic/owner', 'regulator/topic/pfuze100' and 'regulator/topic/pwm' into regulator-next
2015-07-29regulator: max8973: Set VSEL regmap ops if DVS GPIO is not setMikko Perttunen1-0/+9
Use regmap helpers for get_voltage_sel and set_voltage_sel ops if the DVS GPIO is not set. The DVS GPIO allows on the fly selection of the VSEL register from two choices. However, if it is not set, the VSEL register will stay fixed and we can use the regmap ops. This allows use of the *hardware_vsel* regulator APIs. Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-14regulator: drivers: Drop owner assignment from i2c_driverKrzysztof Kozlowski1-1/+0
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07regulator: max8973: add support to configure ETR based on rail loadLaxman Dewangan1-0/+52
Add support to configure Enhanced Transient Response Enable (ETR) and Sensitivity Selection based on maximum current i.e. expected load on that rail. Maxim recommended as: - Enable ETR with high sensitivity (75mV/us) for 0 to 9A expected loads, - Enable ETR with low sensitivity (150mV/us) for 9A to 12A expected loads. - Disable ETR for expected load > 12A. These recommendation will be configured for MAX77621 when maximum load is provided through regulator constraint for maximum current from platform. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07regulator: max8973: add support to configure ETR from DTLaxman Dewangan1-0/+19
The MAX8973/MAX77621 feature an Enhanced Transient Response(ETR) circuit that is enabled through software. The enhanced transient response reduces the voltage droop during large load steps by temporarily allowing all three phases to fire in unison, slewing total inductor current faster than would normally be possible if all three phases continued to operate 120deg out of phase. The enhanced transient response detector features two selectable sensitivity settings, which select the output voltage slew rate during load transients that triggers the ETR circuit. The sensitivity of the ETR detector is set by the CKADV[1:0] bits in the CONTROL2 register. Add support to configure the ETR through platform data from DT. Update the DT binding document accordingly. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-07-07regulator: max8973: Fix up control flag option for bias controlLaxman Dewangan1-1/+1
The control flag for the bias control is MAX8973_CONTROL_BIAS_ENABLE rather than MAX8973_BIAS_ENABLE which is macro for the bits in register. Fix this typo. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-10regulator: max8973: Fix up ramp_delay for MAX8973_RAMP_25mV_PER_US caseAxel Lin1-1/+1
Fix trivial typo. Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-09regulator: max8973: add support for MAX77621Laxman Dewangan1-20/+84
Maxim MAX77621 device is high-efficiency, three-phase, DC-DC step-down switching regulator delivers peak output currents up to 16A. This device is extension of MAX8973 and compatible with the register definition. The MAX77621 has the SHUTDOWN pin which is EN pin on the MAX8973. On MAX77621, the SHUTDOWN pin (active low) reset device register to its POR/OTP value. The voltage output is enabled when SHUTDONW pin is HIGH and EN bit on VOUT register is HIGH. For MAX8973, VOUT is enabled when EN bit or EN pin is high. Add support of the MAX77621 device on max8973 regulator driver with following changes: - Make sure SHUTDOWN pin is set HIGH through GPIO calls if GPIO from AP connected to SHUTDOWN pin provided. - Enable/disable the rail through register access only. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-06-09regulator: max8973: configure ramp delay through callbackLaxman Dewangan1-16/+57
Regulator core framework support the configuration of ramp delay reading from platform specific regulator data via the regulator callback ops. Instead of reading regulator init data on driver and setting ramp delay, use the callback to achieve this. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-22regulator: max8973: add mechanism to enable/disable through GPIOLaxman Dewangan1-6/+23
MAX8973 supports the voltage output enable/disable through its EN pin. This EN pin can be connected through GPIO from host processor. Add support to provide GPIO number from platform/DT and if it is valid GPIO then enable external control default. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-22regulator: max8973: add DT parsing of platform specific parameterLaxman Dewangan1-20/+65
There are some platform specific parameter required to configure the device like enable external control, DVS gpio etc. Add DT parsing of such properties to make platform specific data. Update DT binding doc accordingly. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-22regulator: max8973: get rid of extra variable for gpio validityLaxman Dewangan1-6/+2
To find that dvs-gpio is valid or not, gpio API gpio_is_valid() can be directly used instead of intermediate variable. Removing the extra variable and using the gpio_is_valid(). Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-05-22regulator: max8973: make default/unset dvs gpio as invalid gpioLaxman Dewangan1-1/+1
If platform data has dvs-gpio value 0 as default/unset then make this as invalid gpio so that function gpio_is_valid() can return false on this case. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2015-04-27regulator: max8973: set startup time for rail based on BIAS controlLaxman Dewangan1-1/+5
In MAX8973, BIAS enable control bit is used for changing the startup time for voltage output. The startup delay is 240us (typ) when the BIASEN bit is set to 0. The startup delay is reduced to 20us (typ) when the BIASEN bit is set to 1. Pass the enable_time through regulator descriptor based on this flag. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-11-26regulator: of: Add regulator desc param to of_get_regulator_init_data()Javier Martinez Canillas1-1/+2
The of_get_regulator_init_data() function is used to extract the regulator init_data but information on how to extract certain data is defined in the static regulator descriptor (e.g: how to map the hardware operating modes). Add a const struct regulator_desc * parameter to the function signature so the parsing logic could use the information in the struct regulator_desc. of_get_regulator_init_data() relies on of_get_regulation_constraints() to actually extract the init_data so it has to pass the struct regulator_desc but that is modified on a later patch. Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Mark Brown <broonie@kernel.org>
2014-03-10regulator: max8973: Remove unused field from 'struct max8973_chip'Krzysztof Kozlowski1-2/+0
The 'struct regulator_dev *rdev' of 'struct max8973_chip' isn't used anywhere in the driver so it can be removed safely. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-19regulator: max8973: Remove redundant error messageSachin Kamat1-3/+1
kzalloc prints its own OOM message upon failure. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17regulator: max8973-regulator: Use devm_regulator_registerSachin Kamat1-10/+1
devm_* simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-30regulator: use dev_get_platdata()Jingoo Han1-1/+1
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-24regulator: max8973: initial DT supportGuennadi Liakhovetski1-12/+25
This patch adds primitive DT support to the max8973 regulator driver. None of the configuration parameters, supported in the platform data are yet available in DT, therefore no configuration is performed if booting with no platform data. This means, that DT instantiation can only be used on boards, where no run-time configuration of the chip is required. In such cases the driver can be used to scale its output voltage. In the future support for configuration parameters should be added. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-06-21regulators: max8973: fix multiple instance supportGuennadi Liakhovetski1-5/+7
Currently the max8973 regulator driver uses a single static struct of regulator operations for all chip instances, but can overwrite some of its members depending on configuration. This will affect all other MAX8973 instances on the system. This patch fixes this bug by allocating a separate copy of the struct for each chip instance. Signed-off-by: Guennadi Liakhovetski <g.liakhovetski+renesas@gmail.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-04-24regulator: max8973: Don't override control1 variable when set ramp delay bitsAxel Lin1-5/+5
Current code overrides control1 variable when setting ramp delay bits. Fix it by just setting ramp_delay bits. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-04Drivers: regulator: remove __dev* attributes.Greg Kroah-Hartman1-6/+6
CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, __devinitdata, __devinitconst, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <wfp5p@virginia.edu> Cc: Liam Girdwood <lrg@ti.com> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-23regulator: max8973: provide enable/disable if external control disabledLaxman Dewangan1-1/+1
If external control is enabled then do not provide regulator enable/disable apis. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-22regulator: max8973: Fix callback setting for max8973_dcdc_ops.enableAxel Lin1-1/+1
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-19regulator: max8973: add regulator driver supportLaxman Dewangan1-0/+505
The MAXIM MAX8973 high-efficiency, three phase, DC-DC step-down switching regulator delievers up to 9A of output current. Each phase operates at a 2MHz fixed frequency with a 120 deg shift from the adjacent phase, allowing the use of small magnetic component. Add regulator driver for this device. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>