aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/palmas-regulator.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2013-10-24Merge remote-tracking branch 'regulator/topic/palmas' into regulator-nextMark Brown1-7/+159
2013-10-24Merge remote-tracking branch 'regulator/topic/alias' into regulator-nextMark Brown1-30/+12
2013-10-07regulator: palmas: get regulators node from parent node onlyLaxman Dewangan1-1/+1
The device tree binding of Palmas regulator driver says as: palmas_pmis { compatible = "ti,palmas-pmic"; ... regulators { ... } }; In this "regulators" subnode is expected to be part of parent node, not the outside of parent node. Hence to get the regulator node, the correct call is of_get_child_by_name() rather than of_find_node_by_name() which actually searches the "regulators" node from the parent node to end of DTS file. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17regulator: palmas: Remove wrong comment for the equation calculating num_voltagesAxel Lin1-6/+0
Current equation on the comment is wrong. For linear mapping starting from 0, the equation is (maxV-minV)/stepV + 1. Since the linear mapping for PALMAS is not all starting from 0, the equation on the comment is not useful and misleading. Thus remove it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17Merge remote-tracking branch 'regulator/topic/devm' into regulator-palmasMark Brown1-30/+12
Conflicts: drivers/regulator/palmas-regulator.c
2013-09-17regulator: palmas: configure enable time for LDOsLaxman Dewangan1-0/+6
As per datasheet (Referred TPS65913), the on-time for LDO is 500micro second. If LDO6 is in vibrator mode then the on-time is 2000us. Set the enable_time on regulator descriptor accordingly. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17regulator: palmas: add support for external control of railsLaxman Dewangan1-6/+158
Palmas rails like LDOs, SMPSs, REGENs, SYSENs can be enable and disable by register programming through I2C communication as well as it can be enable/disable with the external control input ENABLE1, ENABLE2 and NSLEEP. Add support for configuring these rails to be controlled by external control inputs. This is require to configure the rail's control register as well as configuration of resource register. Provide the external input names through parameter "roof-floor". Updated the DT binding document to details different value of the roof-floor. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17regulator: palmas: Drop regulator_unregister while using devm_regulator_registerAxel Lin1-3/+1
Commmit af40a94aba "regulator: palmas: Use devm_regulator_register" missed removing a regulator_unregister() call if palmas_extreg_init falis. Fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17regulator: palmas: Use devm_regulator_registerSachin Kamat1-27/+11
devm_* simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-10regulator: palmas: configure enable time for LDOsLaxman Dewangan1-0/+6
As per datasheet (Referred TPS65913), the on-time for LDO is 500micro second. If LDO6 is in vibrator mode then the on-time is 2000us. Set the enable_time on regulator descriptor accordingly. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-04regulator: palmas: fix the n_voltages for smps to 122Laxman Dewangan1-1/+1
With the following change --------- commit ad02e846878ca35e9d3fa584be8ee770e9e14fce Author: Axel Lin <axel.lin@ingics.com> regulator: palmas: Return raw register values as the selectors in [get|set]_voltage_sel Don't adjust the selector in [get|set]_voltage_sel, fix it in list_voltage() instead. For smps*(except smps10), the vsel reg-value and voltage mapping as below: ---------- The list_voltage() takes the true value of selector which is programmed in the register. As per smsp voltage table reg-value volt (uV) ( Assume RANGE is x1 ) 0 0 1 500000 2 500000 3 500000 4 500000 5 500000 6 500000 (0.49V + 1 * 0.01V) * RANGE 7 510000 (0.49V + 2 * 0.01V) * RANGE 8 520000 (0.49V + 3 * 0.01V) * RANGE 9 530000 (0.49V + 4 * 0.01V) * RANGE .... 121 1650000 (0.49V + 116 * 0.1) * RANGE Hence making n_voltages for smps to 122. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-01Merge remote-tracking branch 'regulator/topic/palmas' into regulator-nextMark Brown1-6/+24
2013-08-12regulator: palmas: model SMPS10 as two regulatorsKishon Vijay Abraham I1-6/+24
SMPS10 has two outputs OUT1 and OUT2 and have one input IN1. SMPS10-OUT2 is connected to SMPS10-IN1 and can be configured either in BOOST mode or BYPASS mode. regulator_enable of SMPS10-OUT2 configures it in BOOST mode. For BYPASS mode regulator_allow_bypass() API can be used. SMPS10-OUT1 is connected to SMPS10-OUT2 and can be enabled using regulator_enable(). [ axel.lin@ingics.com : Simplify regulator_desc setting for SMPS10_[OUT1|OUT2] Signed-off-by: J Keerthy <j-keerthy@ti.com> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Axel Lin <axel.lin@ingics.com> 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-27regulator: palmas: Add TPS659038 supportJ Keerthy1-0/+1
Add TPS659038 support. Signed-off-by: J Keerthy <j-keerthy@ti.com> Acked-by: Mark Brown <broonie@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-06-20mfd: palmas: Add SMPS10_BOOST featureJ Keerthy1-0/+3
The SMPS10 regulator is not presesnt in all the variants of the PALMAS PMIC family. Hence adding a feature to distingush between them. Signed-off-by: J Keerthy <j-keerthy@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2013-05-30regulator: palmas: Fix "enable_reg" to point to the correct reg for SMPS10Kishon Vijay Abraham I1-1/+1
regulator_enable_regmap() uses enable_reg to enable the regulator. But enable_reg for smps10 points to SMPS10_STATUS which is a read-only register. Fixed the same by having enable_reg set to SMPS10_CTRL. Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
2013-05-30regulator: palmas: Fix incorrect conditionSachin Kamat1-1/+1
Since 'id' cannot take two values at the same time, the condition should probably be an OR (||) instead of AND (&&). Introduced by commit 28d1e8cd67 ("regulator: palma: add ramp delay support through regulator constraints"). Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-28Merge remote-tracking branch 'regulator/topic/palmas' into v3.9-rc8Mark Brown1-60/+305
2013-04-22regulator: palmas: Fix off-by-one for ramp_delay and register value mappingAxel Lin1-2/+2
Datasheet says: Time Step (TSTEP) selection, when changing the output voltage, the new value is reached through successive voltage steps (if not bypassed). The equivalent programmable slew rate of the output voltage is: TSTEP[1:0]: 00 Jump (no slope control) TSTEP[1:0]: 01 10mV/us TSTEP[1:0]: 10 5mV/us (default) TSTEP[1:0]: 11 2.5mV/us 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-04-22regulator: palmas: Add missing ctrl_addr setting for SMPS10Axel Lin1-0/+1
The ctrl_addr setting for SMPS10 is missed, thus palmas_smps_init() read/write wrong register for SMPS10 in current code. Fix it. 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-04-19regulator: palmas: Don't update tstep register for SMPS3 and SMPS7Axel Lin1-0/+7
SMPS3 and SMPS7 do not have tstep_addr setting, so current code actually writes 0 to smps12_ctl (offset is 0) register when set_ramp_delay callback is called for SMPS3 and SMPS7. 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-04-18regulator: palmas: Fix min_uV for LDO8 tracking modeAxel Lin1-0/+1
When SMPS45 is set to off and LDO8 tracking is enabled, the output voltage can be set from 0.45 to 1.65 V. Thus set min_uV to be 450000. 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-04-18regulator: palmas: preserve modes of rails during enable/disableLaxman Dewangan1-7/+23
The Palma device like TPS65913 have the mode mask which is also used for enable/disable the rails. The mode bits are defined as 00: OFF 01: AUTO 10: ECO 11: Forced PWM and modes are set accordingly as REGULATOR_MODE_NORMAL: AUTO REGULATOR_MODE_IDLE: ECO REGULATOR_MODE_FAST: PWM Two issue observed: 1. If client calls following sequence: regulator_enable(), regulator_set_mode(FAST), regulator_disable() and again the regulator_enable() then the mode is reset to NORMAL inplace of keeping the mode as FAST. Fixing this by storing the current mode configured by client and restoring modes when enable() is called after disable(). 2. In following sequence, the regulator get enabled: regulator_disable() regulator_set_mode(FAST), Fixing this by updating new mode in register only if it is enabled. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-18regulator: palma: add ramp delay support through regulator constraintsLaxman Dewangan1-15/+78
Currently Palma regulator driver support the ramp delay through rail specific platform data. As regulator framework support the configuration of ramp delay through regulator constraint, using the framework method and removing the platform specific data approach. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17regulator: palmas: add support for LDO8 tracking modeLaxman Dewangan1-0/+53
LDO8 of Palma device like tps65913 support the tracking mode on which LDO8 track the SMPS45 voltage when SMPS45 is ON and use the LDO8.VOLTAGE_SEL register when SMPS45 is OFF. On track mode, the steps of voltage change for LDO8 is 25mV where in non-tracking mode it is 50mV. Set the steps accordingly. Number of voltage count is still same for both the cases. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17regulator: palmas: support for external regulator through control outputsLaxman Dewangan1-12/+83
Palmas device have control outputs like REGEN1, REGEN2, REGEN3, SYSEN1 and SYSEN2. These control outputs can be used for controlling external voltage switches to enabled/disable voltage outputs. Add support of these control outputs through regulator framework. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-04-17regulator: palmas: clear sleep bits if not selectedLaxman Dewangan1-6/+12
Clear the sleep/warm reset bits when it is not selected through regulator platform data. This will make sure that configuration is inline with the platform data regardless of boot/POR configuration. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Acked-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-28regulator: palmas: add input supply namesLaxman Dewangan1-0/+24
Palmas regulator support the different input supply pins for each of the rails. Fill the regulator info data with their input supply pin names. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-25regulator: palmas remove palmas-charger option from DT bindingsIan Lartey1-1/+0
Signed-off-by: Ian Lartey <ian@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-20regulator: palmas: rename probe/remove callback functionsLaxman Dewangan1-4/+4
When palmas regulator probe creates stack dump during initialization due to some crash, it prints the call trace as follows: [3.166321] [<c028fa20>] (_regmap_read+0x5c/0xa8) from [<c028fab0>] (regmap_read+0x44/0x5c) [3.174669] [<c028fab0>] (regmap_read+0x44/0x5c) from [<c023062c>] (palmas_probe+0x240/0x7d0) [3.183193] [<c023062c>] (palmas_probe+0x240/0x7d0) from [<c0284064>] (platform_drv_probe+0x14/0x18) [3.192322] [<c0284064>] (platform_drv_probe+0x14/0x18) from [<c0282ee4>] (driver_probe_device+0x104/0x214) [3.202055] [<c0282ee4>] (driver_probe_device+0x104/0x214) from [<c028167c>] (bus_for_each_drv+0x5c/0x88) The palmas_probe is current name but it helps on debugging if the function name is more appropriate to the sub-module name. Renaming the palmas_probe() to palmas_regulator_probe() and palmas_remove() to palams_regulator_remove(). Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-12regulator: palmas: Use of_property_read_bool to read "ti,warm-reset" DT propertyAxel Lin1-2/+2
It does not make sense to assign return value of of_property_read_u32() to pdata->reg_init[idx]->warm_reset. Use of_property_read_bool() to read "ti,warm-reset" DT property instead which will return correct setting for pdata->reg_init[idx]->warm_reset. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-08regulator: palmas correct dt parsingGraeme Gregory1-16/+20
Fix the DT parsing to agree with the bindings document. Some small changes to the value names and also fix the handling of boolean values. They were previously using prop = 1/0, now just use of_property_read_bool calls. Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-04regulator: palmas: Change the DT node property names to follow the conventionJ Keerthy1-4/+4
DT node properties should not have "_". Replacing them by "-". Signed-off-by: J Keerthy <j-keerthy@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-03-01regulator: palmas: fix number of SMPS voltagesGraeme Gregory1-1/+2
Number of voltages for SMPS regulators was off by one. Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Ian Lartey <ian@slimlogic.co.uk> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-02-19Merge remote-tracking branch 'regulator/topic/palmas' into regulator-nextMark Brown1-5/+0
2013-02-04regulator: palmas: Remove a redundant setting for warm_resetAxel Lin1-5/+0
Current code read "ti,warm_reset" of property twice, and set pdata->reg_init[idx]->warm_reset twice. Read and set it once is enough. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-30regulator: Add missing of_node_put()Axel Lin1-0/+2
of_find_node_by_name() returns a node pointer with refcount incremented, use of_node_put() on it when done. of_find_node_by_name() will call of_node_put() against from parameter, thus we also need to call of_node_get(from) before calling of_find_node_by_name(). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-01-03Drivers: regulator: remove __dev* attributes.Greg Kroah-Hartman1-1/+1
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-12-10Merge remote-tracking branch 'regulator/topic/palmas' into regulator-nextMark Brown1-83/+38
2012-12-10Merge remote-tracking branch 'regulator/topic/min' into regulator-nextMark Brown1-32/+5
2012-12-06regulator: palmas: Convert palmas_ops_smps to regulator_[get|set]_voltage_sel_regmapAxel Lin1-61/+26
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-12-06regulator: palmas: Return raw register values as the selectors in [get|set]_voltage_selAxel Lin1-24/+14
Don't adjust the selector in [get|set]_voltage_sel, fix it in list_voltage() instead. For smps*(except smps10), the vsel reg-value and voltage mapping as below: reg-value volt (uV) ( Assume RANGE is x1 ) 0 0 1 500000 2 500000 3 500000 4 500000 5 500000 6 500000 (0.49V + 1 * 0.01V) * RANGE 7 510000 (0.49V + 2 * 0.01V) * RANGE 8 520000 (0.49V + 3 * 0.01V) * RANGE 9 530000 (0.49V + 4 * 0.01V) * RANGE .... The linear mapping is start from selector 6. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-27regulator: palmas: Use linear_min_sel and regulator_[map|list]_voltage_linearAxel Lin1-32/+5
Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20regulator: remove use of __devexitBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20regulator: remove use of __devinitBill Pemberton1-2/+2
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-11-20regulator: remove use of __devexit_pBill Pemberton1-1/+1
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-10-05Merge tag 'mfd-3.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6Linus Torvalds1-8/+119
Pull MFD changes from Samuel Ortiz: "MFD bits for the 3.7 merge window. As usual we have a few new drivers: - TI LP8788 - TI OMAP USB TLL - Maxim MAX8907 - SMSC ECE1099 - Dialog Semiconductor DA9055 - A simpler syscon driver that allow us to get rid of the anatop one. Drivers are also gradually getting Device Tree and IRQ domain support. The following drivers got DT support: - palmas, 88pm860x, tc3589x and twl4030-audio And those ones now use the IRQ domain APIs: - 88pm860x, tc3589x, db8500_prcmu Also some other interesting changes: - Intel's ICH LPC now supports Lynx Point - TI's twl4030-audio added a GPO child - tps6527 enabled its backlight subdevice - The twl6030 pwm driver moved to the new PWM subsystem And finally a bunch of cleanup and casual fixes for mc13xxx, 88pm860x, palmas, ab8500, wm8994, wm5110, max8907 and the tps65xxx family." Fix up various annoying conflicts: the DT and IRQ domain support came in twice and was already in 3.6. And then it was apparently rebased. Guys, DON'T REBASE! * tag 'mfd-3.7-1' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (89 commits) ARM: dts: Enable 88pm860x pmic mfd: 88pm860x: Move gpadc init into touch mfd: 88pm860x: Device tree support mfd: 88pm860x: Use irqdomain mfd: smsc: Add support for smsc gpio io/keypad driver backlight: tps65217_bl: Add missing platform_set_drvdata in tps65217_bl_probe mfd: DA9055 core driver mfd: tps65910: Add alarm interrupt of TPS65910 RTC to mfd device list mfd: wm5110: Add register patches for revision B mfd: wm5110: Disable control interface error report for WM5110 rev B mfd: max8907: Remove regulator-compatible from DT docs backlight: Add TPS65217 WLED driver mfd: Add backlight as subdevice to the tps65217 mfd: Provide the PRCMU with its own IRQ domain mfd: Fix max8907 sparse warning mfd: Add lp8788 mfd driver mfd: dbx500: Provide a more accurate smp_twd clock mfd: rc5t583: Fix warning messages regulator: palmas: Add DT support mfd: palmas: Change regulator defns to better suite DT ...
2012-09-23regulator: palmas: Add DT supportGraeme Gregory1-8/+119
Add DT support to palmas regulator. This involved a little change to the platform data structure. Regulator information can now come from platform data or DT. Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2012-08-28regulator: palmas: Convert palmas_ops_ldo to [get|set]_voltage_sel_regmapAxel Lin1-40/+5
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>