Commit Graph

39 Commits

Author SHA1 Message Date
Julia Lawall 71242b49a0 regulator: da9*: constify regulator_ops structures
The regulator_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Mark Brown <broonie@kernel.org>
2015-12-22 23:59:57 +00:00
Wolfram Sang 6c794b2654 regulator: drop owner assignment from platform_drivers
A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-10-20 16:21:29 +02:00
Mark Brown 4c35c8676f Merge remote-tracking branch 'regulator/topic/linear' into regulator-next 2013-10-24 11:11:37 +01:00
Axel Lin 8828bae464 regulator: Add REGULATOR_LINEAR_RANGE macro
Add REGULATOR_LINEAR_RANGE macro and convert regulator drivers to use it.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-11 12:49:16 +01:00
Axel Lin e277e65680 regulator: Remove max_uV from struct regulator_linear_range
linear ranges means each range has linear voltage settings.
So we can calculate max_uV for each linear range in regulator core rather than
set the max_uV field in drivers.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-10-11 12:49:12 +01:00
Axel Lin 4e8d79355d regulator: da903x: Convert to devm_regulator_register
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-09-17 00:27:56 +01:00
Mark Brown 6979380d85 Merge remote-tracking branch 'regulator/topic/max8660' into regulator-next 2013-09-01 13:50:16 +01:00
Jingoo Han dff91d0b72 regulator: use dev_get_platdata()
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-07-30 12:24:20 +01:00
Axel Lin 550bf89366 regulator: da903x: Convert da9034 ldo12 to use linear ranges
The voltage table of da9034 LDO12 is:
1700000, 1750000, 1800000, 1850000, 1900000, 1950000, 2000000, 2050000
2700000, 2750000, 2800000, 2850000, 2900000, 2950000, 3000000, 3050000

The voltage table is composed of two linear ranges:
for selector 0 ... 7:
        volt = 1700000 + 50000 * selector
for selector: 8 ... 15:
        volt = 2700000 + 50000 * (selector - 8)

This patch converts da9034 LDO12 to use newly introduced helpers for multiple
linear ranges.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
2013-07-28 13:41:52 +01: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 ee3ed6effd regulator: da903x: Don't read/write to DA9030_INVAL/DA9034_INVAL address
For fixed voltage, DA9030_LDO13 and DA9034_LDO5, the info->vol_reg is
DA9030_INVAL/DA9034_INVAL.
It does not make sense to read/write to DA9030_INVAL/DA9034_INVAL address.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-06-08 07:29:47 +08:00
Axel Lin bae5e9c33f regulator: da903x: Kill da903x_[get|set]_[ldo12|ldo14]_voltage_sel() functions
Now the implementation of da903x_set_voltage_sel, da9030_set_ldo14_voltage_sel,
and da9034_set_ldo12_voltage_sel are exactly the same.

da903x_get_voltage_sel, da9030_get_ldo14_voltage_sel and
da9034_get_ldo12_voltage_sel are exactly the same.

So we can use da903x_[get|set]_voltage_sel and kill other functions.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-15 18:32:57 +01:00
Axel Lin c972a02948 regulator: da903x: Convert to set_voltage_sel and map_voltage
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-15 18:32:57 +01:00
Axel Lin 70b4e7862d regulator: da903x: Convert to regulator_list_voltage_linear()
Use regulator_list_voltage_linear() to replace da903x_list_voltage().

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-15 18:32:57 +01:00
Axel Lin 9447f35a1e regulator: da903x: Convert to get_voltage_sel
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-12 11:12:41 +01:00
Axel Lin d4eb56a162 regulator: da903x: Fix list voltage for da9030 ldo14
da903x_list_voltage does not return correct voltage for da9030 ldo14.
Implement da9030_list_ldo14_voltage to return correct voltage for da9030 ldo14.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-05-12 11:12:41 +01:00
Axel Lin fe53d18def regulator: Fix a typo in da903x.c
Fix below build errors which is introduced by commit c172708
"regulator: core: Use a struct to pass in regulator runtime configuration".

  CC      drivers/regulator/da903x.o
drivers/regulator/da903x.c: In function 'da903x_regulator_probe':
drivers/regulator/da903x.c:541: error: 'conifg' undeclared (first use in this function)
drivers/regulator/da903x.c:541: error: (Each undeclared identifier is reported only once
drivers/regulator/da903x.c:541: error: for each function it appears in.)
make[2]: *** [drivers/regulator/da903x.o] Error 1
make[1]: *** [drivers/regulator] Error 2
make: *** [drivers] Error 2

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
2012-04-10 09:52:53 +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 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
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
Mark Brown 3a93f2a9f4 regulator: Report actual configured voltage to set_voltage()
Change the interface used by set_voltage() to report the selected value
to the regulator core in terms of a selector used by list_voltage().
This allows the regulator core to know the voltage that was chosen
without having to do an explict get_voltage(), which would be much more
expensive as it will generally access hardware.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2011-01-12 14:32:59 +00:00
Roel Kluin 495353a3f7 regulator: keep index within bounds in da9034_get_ldo12_voltage()
If selector equals ARRAY_SIZE(da9034_ldo12_data), that is one too
large already.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-12-17 10:27:25 +00:00
Haojian Zhuang 55c1d7c60d regulator: fix voltage range in da9034 ldo12
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:58:23 +01:00
Roel Kluin 656d0498ea regulator: fix calculation of voltage range in da9034_set_ldo12_voltage()
For val to be greater than 7 or less than 20 is logically always true.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Liam Girdwood <lrg@slimlogic.co.uk>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:44 +01:00
Mike Rapoport c6db182822 regulator: da903x: consolidate DA903[045]_DVC macros
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:39 +01:00
Haojian Zhuang c1b60873ca regulator: support list voltage in da903x
Make da903x driver to list voltage and count voltage.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:38 +01:00
Haojian Zhuang e88267e164 regulator: replace ADTV1 register by ADTV2 in da903x
In PXA3xx SoC family, V_CORE power doamin is supplied by BUCK1 that is
controller by ADTV1 or ADTV2 register.

By default, v1 and v2 has the same copy. If v1 or v2 is updated, the last
value that is written to either register takes effect. It means that v1
and v2 has different copy. And the actual voltage output is determinated
by last update on either register.

DA9034/35 is binded with PXA3xx SoC family. While SoC is scaling OP or
entering/exiting lower power mode, SoC needs to change voltage of V_CORE
power doamin. In order to be efficient, POWER I2C (hardcode) mode could
be enabled in SoC. In this mode, SoC will control v2 register directly.

In original DA903x driver, software will only read regulator data from v1
register. But SoC controls v2 register directly. It results that v1 and v2
isn't synchronized. Wrong data will be read from v1 register. So access v2
register in da903x driver instead.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:37 +01:00
Haojian Zhuang fc4f42e7fb regulator: support da9030 BUCK in da903x driver
Support the operation of DA9030 BUCK2 in da903x driver.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Acked-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:37 +01:00
Haojian Zhuang 0198d1163b regulator: add buck3 in da903x driver
BUCK3 is the new component in DA9035. So there're three BUCKs in DA9035.
And there're two BUCKs in DA9034.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-09-22 13:32:37 +01:00
Mark Brown 5a1b22beef regulator: Move regulator drivers to subsys_initcall()
Regulators need to be available early in init in order to allow them
to be available for consumers when requested. This is generally done
by registering them at subsys_initcall() time but not all regulator
drivers have done that. Convert these drivers to do so in order to
mimimise future support.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-06-15 11:18:23 +01:00
Mike Frysinger 5b4662f098 regulator: da903x: add missing __devexit_p()
The remove function uses __devexit, so the .remove assignment needs
__devexit_p() to fix a build error with hotplug disabled.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
CC: Liam Girdwood <lrg@slimlogic.co.uk>
CC: Mike Rapoport <mike@compulab.co.il>
CC: Eric Miao <eric.miao@marvell.com>
Acked-by: Eric Miao <eric.y.miao@gmail.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-05-18 11:21:10 +01:00
Mark Brown 0527100fd1 regulator: Pass regulator init data as explict argument when registering
Rather than having the regulator init data read from the platform_data
member of the struct device that is registered for the regulator make
the init data an explict argument passed in when registering. This
allows drivers to use the platform data for their own purposes if they
wish.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-03-31 09:56:21 +01:00
Mike Rapoport 961869048b regulator: da903x: make da903x_is_enabled return 0 or 1
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-01-08 20:10:31 +00:00
Mike Rapoport 471d8d49a7 regulator: da903x: add '\n' to error messages
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2009-01-08 20:10:31 +00:00
Jonathan Cameron 1841c0f2bf regulator: da903x regulator bug fix
Changes the device registration part of the probe function to supply the
regulator device rather than its parent (the mfd device) as this caused
problems when the regulator core attempted to find constraints associated
with the regulators.

Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
2008-10-30 15:31:35 +00:00
Eric Miao 129eef96c9 da903x: add regulator support for DA9030/DA9034
Signed-off-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Liam Girdwood <lrg@kernel.org>
2008-10-13 21:51:57 +01:00