Commit graph

135148 commits

Author SHA1 Message Date
Axel Lin fa5a97bb0c regulator: Return microamps in wm8350_isink_get_current
The values in isink_cur array are microamps.
The regulator core expects get_current_limit callback to return microamps.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-28 12:44:13 +01:00
Axel Lin 3a744038b3 regulator: wm8350: Fix the logic to choose best current limit setting
Current implementation in get_isink_val actually choose the biggest current
limit setting falls within the specified range.
What we want is to choose the smallest current limit setting falls within the
specified range. Fix it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-28 12:44:07 +01:00
Axel Lin ed3be9a0e3 regulator: wm831x-isink: Fix the logic to choose best current limit setting
Current code in wm831x_isink_set_current actually set the current limit setting
smaller than specified range.

Fix the logic in wm831x_isink_set_current to choose the smallest current limit
setting falls within the specified range.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-28 12:44:07 +01:00
Axel Lin a171e782a9 regulator: wm831x-dcdc: Fix the logic to choose best current limit setting
Current code in wm831x_buckv_set_current_limit actually set the current limit
setting greater than specified range.

Fix the logic in wm831x_buckv_set_current_limit to choose the
smallest current limit setting falls within the specified range.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-28 12:44:07 +01:00
Ying-Chun Liu (PaulLiu) 2f2cc27f50 regulator: anatop: patching to device-tree property "reg".
Change "reg" to "anatop-reg-offset" due to there is a warning of handling no
size field in reg.

This patch also adds the missing device-tree binding documentation.

Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-28 11:52:10 +01:00
Axel Lin 9300928692 regulator: Do proper shift to set correct bit for DC[2|5]_HIB_MODE setting
DC[2|5]_HIB_MODE is BIT 12 of DCDC[2|5] Control register.
WM8350_DC2_HIB_MODE_ACTIVE/WM8350_DC2_HIB_MODE_DISABLE are defined as 1/0.
Thus we need to left shift WM8350_DC2_HIB_MODE_SHIFT bits.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-26 18:35:35 +01:00
Axel Lin eb4168158f regulator: Fix restoring pmic.dcdcx_hib_mode settings in wm8350_dcdc_set_suspend_enable
What we want is to restore wm8350->pmic.dcdcx_hib_mode settings to
WM8350_DCDCx_LOW_POWER registers. Current code also clears all other
bits of WM8350_DCDCx_LOW_POWER registers which is wrong.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-26 18:35:35 +01:00
Axel Lin 5777d9b34a regulator: Fix unbalanced lock/unlock in mc13892_regulator_probe error path
We do not hold a lock while registering regulator, thus should not call unlock
if regulator_register fails.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-26 18:32:11 +01:00
Axel Lin 09bf14b901 regulator: Fix set and get current limit for wm831x_buckv
WM831X_DC1_HC_THR_MASK is 0x0070.
We need to do proper shift for setting and getting current limit.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-26 18:31:34 +01:00
Axel Lin 51579137c5 regulator: tps6586x: Fix list minimal voltage setting for LDO0
According to the datasheet, LDO0 has minimal voltage 1.2V rather than 1.25V.

Table 3-39. VLDO0[2:0] Settings
VLDOx[2:0] VOUT (V) VLDOx[2:0] VOUT (V)
000        1.20     100        2.70
001        1.50     101        2.85
010        1.80     110        3.10
011        2.50     111        3.30

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-26 11:55:29 +01:00
Mark Brown 4992fa1fd4 TWL specific changes, cross-merged with OMAP due to arch/arm wanting to
use the new ability to override the voltage set and get operations to
 support the in-CPU voltage management.  The other changes are minor
 fixes, the addition of a few new regulators and device tree support.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.11 (GNU/Linux)
 
 iQIcBAABAgAGBQJPXQiBAAoJEBus8iNuMP3dhiMP/2z1ImskdfEg+nT43nX4qjge
 MFiHzynz13X4VvOB3+rE0OsBmTjRdjpZzsND3g673D6RuT2mfSAj270AbsJ9bZNR
 Fz8c/RAv2LWG5GKNCB8cWFoxVxk7xhrpE31a6JYV10HBhxmg/6ESaKs63W6MKWQk
 NSfQdE2PujrCIYBwqCYP4knk+Gx4R5GBMol8hXjIkmcSPCnZ71/o6UMu0OsJ6e37
 LKwkBT8zY72HhmBrWNmHXrH94dCYv9XjTtOfjhF97+UAFAuVcztXUq4ZKFNUPuNN
 QLAftkoKPXbSUpqvmmMCJQcNUMvpEGFh42JLZO1S8HN5Mb5+CPE2oS62QNtbrbrV
 cwxpWUse823qJSHXwCWS4ai9M3fO/1tWEfo4nWauKyAgXLV/udF0nBVnSjv72Agg
 cJsmVNOdwLUb89izD2Q05gvObfzPLxjFrGMTHZ1p+h5rgIdQq6ttx4yoZIlmUMqy
 eBFWofYRbxS3UDVteBNZGuAb5AMFuMPrlmluTGWftY41d8mgFLyreNoFReEbeiDP
 ZRpulqoOll1KYdTwg3BbgfS/x8FsSdtH8LBP2BIsmZ6q7hG7CEoG/OOk4ex4vuMx
 AgUV8uRfQ7HjW5NkAX6kOvm3IH6yUOq7uysifKvs+iBRjT2kP0iw3OThdImHDetq
 kjIFEOq+og9NNJ7fLFAB
 =EHNp
 -----END PGP SIGNATURE-----

Merge tag 'topic/twl' into regulator-next

TWL specific changes, cross-merged with OMAP due to arch/arm wanting to
use the new ability to override the voltage set and get operations to
support the in-CPU voltage management.  The other changes are minor
fixes, the addition of a few new regulators and device tree support.
2012-03-19 17:17:32 +00:00
Mark Brown 115e4bfd5b Merge remote-tracking branch 'regulator/topic/supply' into regulator-next 2012-03-18 21:39:19 +00:00
Mark Brown c02f935f5f Merge remote-tracking branches 'regulator/topic/devm' and 'regulator/topic/stub' into regulator-next 2012-03-18 21:38:28 +00:00
Mark Brown c592c761a3 Merge remote-tracking branch 'regulator/topic/stub' into regulator-next 2012-03-18 21:38:20 +00:00
Mark Brown 63236f4038 Merge remote-tracking branch 'regulator/topic/drivers' into regulator-next 2012-03-18 21:37:37 +00:00
Rajendra Nayak 16fbcc3b11 regulator: Fix up a confusing dev_warn when DT lookup fails
of_parse_phandle() returns NULL either if the property name
itself does not exist or if it (exists and) does not
reference a valid phandle.
Giving out a warn like the one below (that the property references
an invalid phandle) can be confusing when the property itself
does not exist in the node.
Fix it with a more sensible message and make it a dev_dbg instead
of a dev_warn.

Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-16 19:26:09 +00:00
Axel Lin ca61a7bfcd regulator: Convert tps6507x to set_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 14:13:17 +00:00
Axel Lin f2933d3331 regulator: Refactor tps6507x to use one tps6507x_pmic_ops for all LDOs and DCDCs
All the callback functions implementation for DCDCx and LDOx are very similar,
I think it is ok to use one tps6507x_pmic_ops for all LDOs and DCDCs.
This refactor removes a couple of duplicated code.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 14:13:17 +00:00
Axel Lin 0a41685fd5 regulator: Make s5m8767_get_voltage_register always return correct register
Check s5m8767->buck[2|3|4]_gpiodvs status in s5m8767_get_voltage_register
and return correct register accordingly.

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-03-14 14:10:41 +00:00
Axel Lin 6c4efe2474 regulator: s5m8767: Check pdata->buck[2|3|4]_gpiodvs earlier
If we need to ensure only one of the buck[2|3|4]_gpiodvs can be specificed,
check them earlier.

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-03-14 14:10:30 +00:00
Laxman Dewangan 18039e0f16 regulator: tps65910: Provide settling time for DCDC voltage change
Settling time is require when there is dcdc rail's voltage change.
Returning proper delay time for dcdc voltage change to settle down
the output voltage to new value.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 12:37:41 +00:00
Ying-Chun Liu (PaulLiu) e3e5aff714 regulator: Add Anatop regulator driver
Anatop is an integrated regulator inside i.MX6 SoC.
There are 3 digital regulators which controls PU, CORE (ARM), and SOC.
And 3 analog regulators which controls 1P1, 2P5, 3P0 (USB).
This patch adds the Anatop regulator driver.

Signed-off-by: Nancy Chen <Nancy.Chen@freescale.com>
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Reviewed-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 12:37:35 +00:00
Axel Lin c567556e75 regulator: Simplify implementation of tps65912_get_voltage_dcdc
Call tps65912_get_sel_register instead of duplicating the same code.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 12:37:23 +00:00
Axel Lin 831c986f5d regulator: Use tps65912_set_voltage_sel for both DCDCx and LDOx
commit 42b5ef "regulator: tps65912: Use simple equations to get register address"
uses tps65912_get_sel_register to replace tps65912_get_dcdc_sel_register
and tps65912_get_ldo_sel_register.

Now tps65912_set_voltage_dcdc_sel and tps65912_set_voltage_ldo_sel has exactly
the same implementation. Merge them to tps65912_set_voltage_sel function.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-14 12:37:22 +00:00
Laxman Dewangan 0651eed5e0 regulator: tps65910: Provide settling time for enabling rails
There is settling time for each rails when it is switched to
ON. Implementing enable time for returning proper settling time
of regulator rails when it is enabled.
Filling the on-time for each rail as per tps65910/tps65911
datasheets.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-13 23:22:45 +00:00
Axel Lin 5db6d09a2b regulator: max8925: Use DIV_ROUND_UP macro
Use DIV_ROUND_UP macro for better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-13 23:19:40 +00:00
Axel Lin 42b5efe4f9 regulator: tps65912: Use simple equations to get register address
The address of ctrl and sel registers can be calculated by simple equations.
This patch simplifies the implementation in tps65912_get_ctrl_register and
implements tps65912_get_sel_register to replace tps65912_get_dcdc_sel_register
and tps65912_get_ldo_sel_register.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-13 23:19:34 +00:00
Axel Lin 585993932c regulator: Fix the logic of tps65910_get_mode
We actually clear LDO_ST_ON_BIT for standby mode in tps65910_set_mode.
Fix the logic in tps65910_get_mode.

Supply state (EEPROM bits):
ST[1:0] = 00 : Off
ST[1:0] = 01 : On high power (ACTIVE)
ST[1:0] = 10 : Off
ST[1:0] = 11 : On low power (SLEEP)

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-13 23:18:03 +00:00
Axel Lin fc56911bc6 regulator: Merge tps65217_pmic_ldo234_ops and tps65217_pmic_dcdc_ops to tps65217_pmic_ops
Most callback functions implementation for tps65217_pmic_ldo234_ops and
tps65217_pmic_dcdc_ops are the same except the rid range checking.

This patch uses tps65217_pmic_ops for all DCDCx, LDO2, LDO3, and LDO4.
And rework tps65217_pmic_set_voltage to make it can be called for
DCDCx, LDO2, LDO3, and LDO4.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-12 10:50:46 +00:00
Axel Lin dce7304f4b regulator: Use DIV_ROUND_CLOSEST in wm8350_isink_get_current
DIV_ROUND_CLOSEST performs the computation (x + d/2)/d with better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-12 10:48:18 +00:00
Axel Lin 85c5d86d0e regulator: Use array to store dcdc_range settings for tps65912
Then we can use the regulator id as array index to access the array.
This change makes the code simpler.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:35 +00:00
Axel Lin 5b5e977ce7 regulator: Rename s5m8767_convert_voltage to s5m8767_convert_voltage_to_sel
This function finds the smallest voltage that falls within the specified range,
and then returns the selector. This rename makes the intention more clear.

Also remove unneeded local variables min_vol and max_vol in s5m8767_set_voltage
and s5m8767_set_voltage_buck.

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-03-11 20:49:35 +00:00
Axel Lin 4d984d1cd8 regulator: tps6524x: Remove unneeded comment for N_REGULATORS
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:34 +00:00
Axel Lin 94732b97c3 regulator: Rename set_voltage_sel callback function name to *_sel
This change improves readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:33 +00:00
Sangbeom Kim 0f8b9c7744 regulator: Fix s5m8767_set_voltage_time_sel calculation value
In the s5m8767_set_voltage_time_sel function, divisor unit is wrong.
ramp_delay is usec unit. So 1000 should be multiplied.

Signed-off-by: Sangbeom Kim <sbkim73@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:29 +00:00
Thierry Reding 394ee3d5be regulator: tps6586x: fix typo in debug message
Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:29 +00:00
Laxman Dewangan f30b0716fe regulator: tps65910: Sleep off rails when ext sleep configured
Keep the rails OFF in sleep mode only when the rails are
controlled by external sleep control.
The devices tps65910 and tps65911, both has the sleep input.
The tps65911's sleep input is not same as tps65910's EN3 and hence
taking care of SLEEP input as separate external sleep control input.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:49:28 +00:00
Axel Lin 844775ef98 regulator: Simplify the implementation of tps65912_get_voltage_dcdc
Call tps65912_list_voltage_dcdc instead of duplicating the same code.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:55 +00:00
Axel Lin 21c9e5f19e regulator: max8649: Use DIV_ROUND_UP macro to calculate selector
Use DIV_ROUND_UP macro for better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:54 +00:00
Axel Lin f08f5de54f regulator: Silence error message in max8998_pmic_probe
This looks like a mistakenly committed debug logging.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:54 +00:00
Axel Lin 535bca2037 regulator: Remove unused i2c variable in s5m8767_pmic_probe
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-03-11 20:48:53 +00:00
Axel Lin 2fe4e0259d regulator: tps65217: Use DIV_ROUND_UP macro to calculate selector
Use DIV_ROUND_UP macro for better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:52 +00:00
Axel Lin ae76e8307f regulator: da903x: Use DIV_ROUND_UP macro to calculate selector
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:52 +00:00
Axel Lin e9a15c8cad regulator: wm8400: Use DIV_ROUND_UP macro to calculate selector
Use DIV_ROUND_UP macro for better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:51 +00:00
Sascha Hauer 1c37f8a838 regulator fixed: Do not report enumaratable voltages if there are none
If used as a dummy voltage provider the fixed regulator should
not set n_voltages to make the core accept the device.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:51 +00:00
Axel Lin ab353c2375 regulator: max8660: Use DIV_ROUND_UP macro to calculate selector
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:50 +00:00
Axel Lin 7d530d32b0 regulator: max1586: Use DIV_ROUND_UP macro to calculate selector
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:49 +00:00
Axel Lin 8148ed6e66 regulator: ad5398: Use DIV_ROUND_UP macro to calculate selector
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:49 +00:00
Axel Lin b21bcd1ada regulator: Add a pointer to aat2870_data in struct aat2870_regulator
The reason we add *pdev in struct aat2870_regulator is to use it
to get a pointer to struct aat2870_data.
Save a pointer to struct aat2870_data instead of pdev in struct
aat2870_regulator, this change makes the intention more clear.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Jin Park <jinyoungp@nvidia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:48 +00:00
Axel Lin 48ee1160a4 regulator: Simplify the code to get selector in isl6271a_set_voltage
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:47 +00:00