Commit graph

38 commits

Author SHA1 Message Date
Krzysztof Kozlowski
011703835f regulator: s2mps11: Move DTS parsing code to separate function
Refactor code for parsing DTS to increase a little code readability. The
behaviour should not change.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-14 22:12:42 +01:00
Axel Lin
b96244fad9 regulator: s2mps11: Don't check enable_shift before setting enable ramp rate
Current code misses updating the register when enable_shift is 0.
e.g. S2MPS11_BUCK9_RAMP_SHIFT and S2MPS11_BUCK6_RAMP_EN_SHIFT are 0.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-04-02 20:53:16 +01:00
Mark Brown
7b836485d4 Merge remote-tracking branches 'regulator/topic/max8973', 'regulator/topic/max8997', 'regulator/topic/max8998', 'regulator/topic/mc13xxx', 'regulator/topic/pfuze100', 'regulator/topic/rc5t583' and 'regulator/topic/s2mps11' into regulator-next 2014-03-26 16:58:11 +00:00
Mark Brown
29dbdcf316 Merge remote-tracking branch 'regulator/topic/core' into regulator-next 2014-03-26 16:57:44 +00:00
Sachin Kamat
991acaf629 regulator: s2mps11: Add missing of_node_put
Add of_node_put to decrement the ref count.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-19 13:11:07 +00:00
Sachin Kamat
14256f734e regulator: s2mps11: Use of_get_child_by_name
of_find_node_by_name walks the allnodes list, and can thus walk
outside of the parent node. Use of_get_child_by_name instead.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-19 13:11:07 +00:00
Krzysztof Kozlowski
05be09bb5e regulator: s2mps11: Add set_suspend_disable for S2MPS14
S2MPS14 regulators support suspend mode where their status is controlled
by PWREN coming from SoC. This patch implements the set_suspend_disable
for S2MPS14 regulators.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-19 13:02:51 +00:00
Krzysztof Kozlowski
15f77300c9 regulator: s2mps11: Add support for S2MPS14 regulators
Add support for S2MPS14 PMIC regulators to s2mps11 driver. The S2MPS14
has fewer BUCK-s and LDO-s than S2MPS11. It also does not support
controlling the BUCK ramp delay.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <lgirdwood@gmail.com>
Reviewed-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-19 13:02:51 +00:00
Krzysztof Kozlowski
0f4cc28295 regulator: s2mps11: Fix section mismatch
Remove __initconst from regulator_desc array because this array is used
during probe and s2mps11_pmic_probe() is not in __init section. However
still select the number of supported regulators according to device ID
so the driver will be ready for adding support for S2MPS14 device.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-04 11:01:57 +08:00
Krzysztof Kozlowski
3e80f95bfc regulator: s2mps11: Copy supported regulators from initconst
Add __initconst to 'regulator_desc' array with supported regulators.
During probe choose how many and which regulators will be supported
according to device ID. Then copy the 'regulator_desc' array to
allocated memory so the regulator core can use it.

Additionally allocate array of of_regulator_match() dynamically (based
on number of regulators) instead of allocation on the stack.

This is needed for supporting different devices in s2mps11
driver and actually prepares the regulator driver for supporting the
S2MPS14 device.

Code for supporting the S2MPS14 device will add its own array of
'regulator_desc' (also marked as __initconst). This way memory footprint
of the driver will be reduced (approximately 'regulators_desc' array for
S2MPS11 occupies 5 kB on 32-bit ARM, for S2MPS14 will occupy 3 kB).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Cc: Yadwinder Singh Brar <yadi.brar01@gmail.com>
Reviewed-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-03 10:08:55 +08:00
Krzysztof Kozlowski
219ef031de regulator: s2mps11: Constify regulator_desc array
Constify the regulator_desc 'regulators' array.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-03 10:08:55 +08:00
Krzysztof Kozlowski
3119525203 regulator: s2mps11: Don't store registered regulators in state container
Regulators registered by devm_regulator_register() do not have to be
stored in state container because they are never dereferenced later.
The array of regulator_dev can be safely removed from state container.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-03-03 10:08:54 +08:00
Thiago Farina
d55efa4d9b regulator: Make use of rdev_get_id() function where possible.
Signed-off-by: Thiago Farina <tfarina@chromium.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-02-03 12:29:25 +00:00
Krzysztof Kozlowski
54820f5802 regulator: s2mps11: Fix NULL pointer of_node value when using platform data
When platform_data is used for regulator (of_node of sec-core MFD device
is NULL) the config.of_node for regulator is not initialized. This NULL
value of config.of_node is later stored during regulator_register().
Thus any call by regulator consumers to of_get_regulator() will fail on
of_parse_phandle() returning NULL.

In this case (using platform_data and parent's driver of_node is NULL)
set the config.of_node to reg_node from platform_data.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2014-01-31 16:52:03 +00:00
Mark Brown
07b1980848 Merge remote-tracking branches 'regulator/topic/s2mps11', 'regulator/topic/s5m8767', 'regulator/topic/stw481x-vmmc', 'regulator/topic/tps51632', 'regulator/topic/tps62360', 'regulator/topic/tps65910', 'regulator/topic/twl' and 'regulator/topic/wm831x' into regulator-linus 2014-01-23 12:01:31 +00:00
Sachin Kamat
699b36973d regulator: s2mps11: Clean up redundant code
BUCK 3 and 4 share the same ramp delay. Hence make it a fall through
case instead of duplicating the code.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-30 11:56:32 +00:00
Krzysztof Kozlowski
1b1ccee1e8 mfd: s2mps11: Fix build after regmap field rename in sec-core.c
Fix building of s2mps11 regulator and clock drivers after renaming
regmap field in struct sec_pmic_dev in commit:
 - "mfd/rtc: s5m: Fix register updating by adding regmap for RTC"

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-12-16 11:30:39 +00:00
Sachin Kamat
d55cd794d6 regulator: s2mps11: Use devm_regulator_register
Commit e398b51a ("regulator: s2mps11: Convert to devm_regulator_register()")
intended to do this conversion. However the actual conversion to devm_* got
missed out. Fix this.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:28:40 +01:00
Mark Brown
b707a27445 regulator: s2mps11: Convert to devm_regulator_register()
Signed-off-by: Mark Brown <broonie@linaro.org>
Acked-by: Sangbeom Kim <sbkim73@samsung.com>
2013-09-17 00:27:54 +01:00
Axel Lin
f8f1d48be3 regulator: s2mps11: Fix setting ramp_delay
Current code has wrong mask and val arguments for updating ramp_delay. Fix it.
Also ensure the return value of get_ramp_delay() won't greater than 3 because
the mask field for ramp_val only takes 2 bits.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-13 11:17:58 +01:00
Axel Lin
80853304cd regulator: s2mps11: Fix wrong arguments for regmap_update_bits() call
Current code calls regmap_update_bits() with mask and val arguments swapped.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-08-13 11:17:58 +01:00
Yadwinder Singh Brar
6c683c9299 regulator: s2mps11: Convert driver completely to use set_ramp_delay callback
Since now we have ramp_delay and ramp_disable as standard regulator
constraints and DT part using it so this patch removes legacy part i.e. getting
ramp_delayxx and ramp_enable from pdata since it can be passed as
standard regulator constraints.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 18:56:20 +01:00
Yadwinder Singh Brar
a50c6b3255 regulator: s2mps11: Add DT support
This patch adds DT support for parsing regulators constraints for parent(mfd)
node and moves some common intialising code out of loop while registering.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 18:56:19 +01:00
Yadwinder Singh Brar
939c02777a regulator: s2mps11: Implement set_ramp_rate callback for bucks
Implementing set_ramp_rate() and using standard constraints for getting
ramp_delay and ramp_disable, instead of getting it as s2mps11 specific data
through platform data, makes driver more compliant with framework and reduces
the complexity for adding DT support.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 18:31:12 +01:00
Yadwinder Singh Brar
1e1598ed04 regulator: s2mps11: Implement set_voltage_time_sel() ops for bucks
Currently driver uses local struct s2mps11_info to store ramp rate for bucks
whic its getting through platform data, so instead of using regulator
constraints it should use s2mps11_info to calculate ramp delay.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-15 11:28:25 +01:00
Yadwinder Singh Brar
90068348b7 regulator: s2mps11: Convert ramp rate to uV/us and set default ramp rate
This patch makes driver to use uV/us as units of ramp_delay. It makes driver
in compliance with regulator framework and make ramp rate precise.

This patch also sets default ramp rate in regulator descriptor which can be
used in case if case ramp rate is not set in regulator constraints.

Signed-off-by: Yadwinder Singh Brar <yadi.brar@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-03 18:51:40 +01:00
Axel Lin
1586bb4a92 regulator: Remove unnecessary include of linux/delay.h from regulator drivers
All the drivers that need delay for the regulator voltage output voltage to
stabilize after being enabled or after being set to a new value has been
converted to implement enable_time and set_voltage_time_sel callbacks.
Then regulator core will take care of the necessary delay.

This patch removes the unneeded include of linux/delay.h in regulator drivers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Cc: Daniel Jeong <daniel.jeong@ti.com>
Cc: Sangbeom Kim <sbkim73@samsung.com>
Cc: Chiwoong Byun <woong.byun@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2013-05-12 18:39:51 +04:00
Alim Akhtar
c76edd52bf regulator: s2mps11: fix incorrect register for buck10
For BUCK10 the control registers are wrongly set as buck9 control register
This patch corrects the control registers for buck10

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2013-01-31 14:45:11 +08:00
Mark Brown
86caa905f3 Merge remote-tracking branch 'regulator/topic/s2mps11' into regulator-next 2012-12-10 12:43:19 +09:00
Sangbeom Kim
f7ebaaeb0b regulator: s2mps11: Fix ramp delay value shift operation
This patch fix the abnormal ramp delay setting.
The shift operation was wrong.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2012-11-27 20:24:15 +00:00
Bill Pemberton
8dc995f56e regulator: remove use of __devexit
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-20 10:53:38 +09:00
Bill Pemberton
a5023574d1 regulator: remove use of __devinit
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-20 10:31:26 +09:00
Bill Pemberton
5eb9f2b963 regulator: remove use of __devexit_p
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-11-20 10:31:19 +09:00
Axel Lin
ad46ed14ca regulator: s2mps11: Use array to save pointer to rdev
The number of regulator is known at compile time, use array to save pointer to
rdev makes the code simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-08-28 11:00:15 -07:00
Axel Lin
c06eed397a regulator: s2mps11: Use sec_reg_write rather than sec_reg_update when mask is 0xff
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-12 18:07:11 +01:00
Axel Lin
232b250475 regulator: s2mps11: Fix wrong setting for config.dev
Currently s2mps11->iodev, s2mps11->dev and config.dev point to NULL.
This patch fixes the settings for config.dev.
Current code does not need the *dev and *iodev of struct s2mps11_info,
so remove them.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-12 18:06:48 +01:00
Axel Lin
2693fcab1a regulator: s2mps11: Fixup missing commas
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-12 18:06:35 +01:00
Sangbeom Kim
cb74685ecb regulator: s2mps11: Add samsung s2mps11 regulator driver
This patch add Samsung S2MPS11 regulator driver.
The S2MPS11 can support 10 Bucks and 38 LDOs and RTC.
Especially, S2MPS11 is designed for high performance
Samsung application processor.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-11 15:32:40 +01:00