dect
/
linux-2.6
Archived
13
0
Fork 0
Commit Graph

25 Commits

Author SHA1 Message Date
Axel Lin 8fa25eda86 regulator: max8997: Properly handle gpio_request failure
Convert to devm_gpio_request to save a few error handling code.

This patch properly handle the gpio_request failure with -EBUSY, we should
return error rather than ommit the gpio_request failure with -EBUSY.

I think one of the reason we got -EBUSY is because current code does not free
gpios in max8997_pmic_remove(). So it got -EBUSY when reload the module.

Yest another reason is in current code if gpio_request() returns -EBUSY,
the rest of the code still calls gpio_direction_output to config buck125_gpios
and set gpio value in max8997_set_gpio().  This looks wrong to me.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-07-15 21:49:53 +01:00
Linus Torvalds ac1806572d regulator updates for 3.5
The major thing here is the addition of some helpers to factor code out
 of drivers, making a fair proportion of regulators much more just data
 rather than code which is nice.
 
 - Helpers in the core for regulators using regmap, providing generic
   implementations of the enable and voltage selection operations which
   just need data to describe them in the drivers.
 - Split out voltage mapping and voltage setting, allowing many more
   drivers to take advantage of the infrastructure for selectors.
 - Loads and loads of cleanups from Axel Lin once again, including many
   changes to take advantage of the above new framework features
 - New drivers for Ricoh RC5T583, TI TPS62362, TI TPS62363, TI TPS65913,
   TI TWL6035 and TI TWL6037.
 
 Some of the registration changes to support the core refactoring caused
 so many conflicts that eventually topic branches were abandoned for this
 release.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJPuhn4AAoJEBus8iNuMP3d6m4P/0gNiGbTwDlOgU/mPDyW2jJc
 xqvABzlOIQbI28/dgFYO/nA9YWW7VxpEaAPlkg4auk4wQ9tEyEjEqlOCfzymMetY
 0k6L4n8LqFsbMAeNQbFPbW7PpWp59oI97J9afJI4kEJmHmOlmlL9U82/TzUFfGrA
 yiPlzue+DotKB7FjsymLMbLyeFoiMSOIjVDk8OTs0u1EqeOo4nJG2ODLa+yGo+QW
 0yqQExEdIp28WXbkZQtmsOmj2V/uhkKAv2i2PDT2TmlduhNdCGxJsgZIiZCl1R4c
 vwirbfb+v93HAxvADdgj8eVdLJXQ0oItxr2ohKt8AgXIBrUJBsMkCQGvulZjRb+a
 /A/7Ea3o7HI+PQx4aIP0yGA/eBwbzo/cmBxU+KGzTA9Mov0fnK1kkUs6gfrYBdli
 U/TcMizDa1539BrKBIF2gmlRCKx8YD9ic27Zl1x4i5cgAP1gdYgdBYBybKHMpo2+
 9Xp1R9C8FvvgytIqJ3QQ34tRomZyQ5iUaIuIuAosoQ6iuF33EQ6I0FvHcIe74iOi
 zcu62ZPiuSwg1di9PrTERLcbrS81lvXpOWt5+EorzqoGXWzVIGoTh1F2kWEEMhaD
 Q6V5iE03VC0k3tj/MmtTiVkyhNkRElQDtekE9sfm15pdVnpu/+b+iicWJa7QFbZQ
 MybS0BBFQKhJXUDttKtS
 =UR7s
 -----END PGP SIGNATURE-----

Merge tag 'regulator-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator updates from Mark Brown:
 "The major thing here is the addition of some helpers to factor code
  out of drivers, making a fair proportion of regulators much more just
  data rather than code which is nice.

  - Helpers in the core for regulators using regmap, providing generic
    implementations of the enable and voltage selection operations which
    just need data to describe them in the drivers.
  - Split out voltage mapping and voltage setting, allowing many more
    drivers to take advantage of the infrastructure for selectors.
  - Loads and loads of cleanups from Axel Lin once again, including many
    changes to take advantage of the above new framework features
  - New drivers for Ricoh RC5T583, TI TPS62362, TI TPS62363, TI
    TPS65913, TI TWL6035 and TI TWL6037.

  Some of the registration changes to support the core refactoring
  caused so many conflicts that eventually topic branches were abandoned
  for this release."

* tag 'regulator-3.5' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (227 commits)
  regulator: tps65910: use of_node of matched regulator being register
  regulator: tps65910: dt: support when "regulators" node found
  regulator: tps65910: add error message in case of failure
  regulator: tps62360: dt: initialize of_node param for regulator register.
  regulator: tps65910: use devm_* for memory allocation
  regulator: tps65910: use small letter for regulator names
  mfd: tpx6586x:  Depend on regulator
  regulator: regulator for Palmas Kconfig
  regulator: regulator driver for Palmas series chips
  regulator: Enable Device Tree for the db8500-prcmu regulator driver
  regulator: db8500-prcmu: Separate regulator registration from probe
  regulator: ab3100: Use regulator_map_voltage_iterate()
  regulator: tps65217: Convert to set_voltage_sel and map_voltage
  regulator: Enable the ab8500 for Device Tree
  regulator: ab8500: Split up probe() into manageable pieces
  regulator: max8925: Remove check_range function and max_uV from struct rc5t583_regulator_info
  regulator: max8649: Remove unused check_range() function
  regulator: rc5t583: Remove max_uV from struct rc5t583_regulator_info
  regulator: da9052: Convert to set_voltage_sel and map_voltage
  regulator: max8952: Use devm_kzalloc
  ...
2012-05-21 16:49:16 -07:00
Axel Lin 8ae5767ba1 regulator: max8997: Convert ot use devm_kzalloc
Also simplify the error handling to start unwind from the place
regulator_register fails.

No need to check rdev[i] is NULL or not before calling regulator_unregister.
regulator_unregister is safe if rdev is NULL,

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:20:26 +01:00
Axel Lin 6c9eeb0f5c regulator: Remove unneeded 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.

For the drivers that don't need the delay, don't need to include linux/delay.h.
This patch removes the unneeded include of linux/delay.h in regulator drivers.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:20:26 +01:00
Axel Lin 23b7d09a3f regulator: max8997: Remove empty set_suspend_enable callback implementation
Since commit 8ac0e95 "regulator: core: Support setting suspend_[mode|voltage]
if set_suspend_[en|dis]able is NULL", now the regulator core can properly
handle the case set_suspend_enable callback is NULL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:20:25 +01:00
Axel Lin c245c087c5 regulator: max8997: Remove is_enabled callback implementation for max8997_charger_fixedstate_ops
If is_enabled callback is not implemented, the core assumes that the regulator
is on.

This is simpler than having a hack to retrun 1 in max8997_reg_is_enabled() if
max8997_get_enable_register() returns -EINVAL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-23 13:20:24 +01:00
Axel Lin 62bc4d4a70 regulator: Convert max8997 to set_voltage_time_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-17 15:25:10 +01:00
Axel Lin 9e96b3a7ad regulator: Convert max8997 to get_voltage_sel
Also rename get_current_limit and set_current_limit callbacks
to max8997_get_current_limit and max8997_set_current_limit for
better readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-17 15:25:10 +01:00
Axel Lin f55205f4d4 regulator: Fix the logic to ensure new voltage setting in valid range
I think this is a typo.
To ensure new voltage setting won't greater than desc->max,
the equation should be desc->min + desc->step * new_val <= desc->max.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
2012-04-17 15:17:11 +01:00
Axel Lin 2358b7763e regulator: max8997: Use simple equation to get selector
It's more efficient to get the best selector by simple equation.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-10 10:14:01 +01:00
Axel Lin 0fa310ccab regulator: max8997: Remove n_bits from struct voltage_map_desc
The n_bits is only used in max8997_get_voltage_proper_val to check the valid
range for variable i.

Current code already ensures min_vol never greater than desc->max,
which means the variable i always in the valid range:
0 .. (desc->max - desc->min)/desc->step.

Thus we can remove the checking (i >= (1 << desc->n_bits) and then remove
n_bits from struct voltage_map_desc.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-10 10:14:01 +01:00
Mark Brown c172708d38 regulator: core: Use a struct to pass in regulator runtime configuration
Rather than adding new arguments to regulator_register() every time we
want to add a new bit of dynamic information at runtime change the function
to take these via a struct. By doing this we avoid needing to do further
changes like the recent addition of device tree support which required each
regulator driver to be updated to take an additional parameter.

The regulator_desc which should (mostly) be static data is still passed
separately as most drivers are able to configure this statically at build
time.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-09 12:37:09 +01:00
Axel Lin 4533f80ef8 regulator: Add MAX8997_VOLTAGE_REGULATOR and MAX8997_CURRENT_REGULATOR macros
MAX8997_VOLTAGE_REGULATOR macro has _name and _ops parameters so we can use it
for all regulators with REGULATOR_VOLTAGE type.
The MAX8997_VOLTAGE_REGULATOR now replaces regulator_desc_ldo and
regulator_desc_buck macros.

MAX8997_CURRENT_REGULATOR is for CHARGER and CHARGER_TOPOFF.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:33 +01:00
Axel Lin 6f43c3809e regulator: Make max8997_get_voltage_register always return correct register
Check max8997->buck[1|2|5]_gpiodvs status in max8997_get_voltage_register
and return correct register accordingly.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-01 11:59:32 +01:00
Axel Lin b3e1348e27 regulator: Kill max8997_get_rid function
Use rdev_get_id() directly.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-03-11 20:48:46 +00:00
Karol Lewandowski e371ceb89f regulator: max8997: Avoid spaces in regulator names
max8997-pmic instantiated from device tree uses names, not numerical
ids to distinguish between outputs.

Replace spaces with underscores in said names to make it possible to
describe these outputs as regulators in DTS.

Signed-off-by: Karol Lewandowski <k.lewandowsk@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-01-24 20:00:33 +00:00
Rajendra Nayak 2c043bcbf2 regulator: pass additional of_node to regulator_register()
With device tree support for regulators, its needed that the
regulator_dev->dev device has the right of_node attached.
To be able to do this add an additional parameter to the
regulator_register() api, wherein the dt-adapted driver can
then pass this additional info onto the regulator core.

Signed-off-by: Rajendra Nayak <rnayak@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2011-11-23 18:47:04 +00:00
Paul Gortmaker 65602c32ee regulator: Add module.h to drivers/regulator users as required
Another group of drivers that are taking advantage of the implicit
presence of module.h -- and will break when we pull the carpet out
from under them during a cleanup.  Fix 'em now.

Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
2011-10-31 19:32:15 -04:00
Donggeun Kim 6ff325a2d8 regulator: max8997: Fix setting inappropriate value for ramp_delay variable
The ramp_delay variable can be set lower than the desired value.
This patch fixes it.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: KyungMin Park <kyungmin.park@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-08 19:14:58 +01:00
MyungJoo Ham 6e0414a5c8 regulator: max8997: remove dependency on platform_data pointer
The platform_data (pdata) may be pointing to __initdata section, which
may be free'd from the memory. The dependency on pdata in non-init
functions is removed in this patch to allow platform to declare
__initdata for platform data.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-08 19:14:57 +01:00
Tushar Behera dbb48e7c3d regulator: MAX8997: Fix for divide by zero error
Currently, ramp_delay variable is used uninitialzed in
max8997_set_voltage_ldobuck which gets called through
regulator_register calls.

To fix the problem, in max8997_pmic_probe, ramp_delay initialization
code is moved before calls to regulator_register.

Cc: Liam Girdwood <lrg@ti.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-07-08 19:14:57 +01:00
Axel Lin ecb9c4f595 regulator: Remove MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros
In current implementation, the original macro implementation assumes the caller
pass the parameter starting from 1 (to match the register names in datasheet).
Thus we have unneeded plus one then minus one operations
when using MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros.

This patch removes these macros to avoid unneeded plus one then minus one operations
without reducing readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:10 +01:00
Jonghwan Choi afdaaafe8e regulator: max8997: remove useless code
fix unreachable code.

Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-05-27 10:49:09 +01:00
Axel Lin a51b907b2e regulator: Add MODULE_DEVICE_TABLE to max8997 and max8998
The device table is required to load modules based on modaliases.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: MyungJoo Ham <myungjoo.ham@smasung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-03-27 11:47:25 +01:00
MyungJoo Ham bd6ca2cf50 regulator: MAX8997/8966 support
This patch supports PMIC/Regulator part of MAX8997/MAX8966 MFD.
In this initial release, selecting voltages or current-limit
and switching on/off the regulators are supported.

Controlling voltages for DVS with GPIOs is not implemented fully
and requires more considerations: it controls multiple bucks (selection
of 1, 2, and 5) at the same time with SET1~3 gpios. Thus, when DVS-GPIO
is activated, we lose the ability to control the voltage of a single
buck regulator independently; i.e., contolling a buck affects other two
bucks. Therefore, using the conventional regulator framework directly
might be problematic. However, in this driver, we try to choose
a setting without such side effect of affecting other regulators and
then try to choose a setting with the minimum side effect (the sum of
voltage changes in other regulators).

On the other hand, controlling all the three bucks simultenously based
on the voltage set table may help build cpufreq and similar system
more robust; i.e., all the three voltages are consistent every time
without glitches during transition.

Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2011-03-23 10:42:07 +01:00