Commit 8b0cab14 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull regulator updates from Mark Brown:
 "A fairly quiet release again, a couple of relatively small new
  features and a bunch of driver specific work including yet more code
  elimination and fixes from Axel Lin.

   - Addidion of linear_min_sel for offsetting linear selectors in the
     helpers.
   - Support for continuous voltage ranges for regulators with extremely
     high resolution.
   - Drivers for AS3711, DA9055, MAX9873, TPS51632, TPS80031 and ARM
     vexpress."

Fix up trivial conflict (due to typo fix) in palmas-regulator.c

* tag 'regulator-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (80 commits)
  regulator: core: Fix logic to determinate if regulator can change voltage
  regulator: s5m8767: Fix to work even if no DVS gpio present
  regulator: s5m8767: Fix to read the first DVS register.
  regulator: s5m8767: Fix to work when platform registers less regulators
  regulator: gpio-regulator: gpio_set_value should use cansleep
  regulator: gpio-regulator: Fix logical error in for() loop
  regulator: anatop: Use regulator_[get|set]_voltage_sel_regmap
  regulator: anatop: Use linear_min_sel with linear mapping
  regulator: max1586: Implement get_voltage_sel callback
  regulator: lp8788-buck: Kill _gpio_request function
  regulator: tps80031: Convert tps80031_ldo_ops to linear_min_sel and list_voltage_linear
  regulator: lp8788-ldo: Remove val array in lp8788_config_ldo_enable_mode
  regulator: gpio-regulator: Add ifdef CONFIG_OF guard for regulator_gpio_of_match
  regulator: palmas: Convert palmas_ops_smps to regulator_[get|set]_voltage_sel_regmap
  regulator: palmas: Return raw register values as the selectors in [get|set]_voltage_sel
  regulators: add regulator_can_change_voltage() function
  regulator: tps51632: Ensure [base|max]_voltage_uV pdata settings are valid
  regulator: wm831x-dcdc: Add MODULE_ALIAS for wm831x-boostp
  regulator: wm831x-dcdc: Ensure selected voltage falls within requested range
  regulator: tps51632: Use linear_min_sel and regulator_[map|list]_voltage_linear
  ...
parents fd62c545 4ffc45c3
GPIO controlled regulators
Required properties:
- compatible : Must be "regulator-gpio".
- states : Selection of available voltages and GPIO configs.
if there are no states, then use a fixed regulator
Optional properties:
- enable-gpio : GPIO to use to enable/disable the regulator.
- gpios : GPIO group used to control voltage.
- startup-delay-us : Startup time in microseconds.
- enable-active-high : Polarity of GPIO is active high (default is low).
Any property defined as part of the core regulator binding defined in
regulator.txt can also be used.
Example:
mmciv: gpio-regulator {
compatible = "regulator-gpio";
regulator-name = "mmci-gpio-supply";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <2600000>;
regulator-boot-on;
enable-gpio = <&gpio0 23 0x4>;
gpios = <&gpio0 24 0x4
&gpio0 25 0x4>;
states = <1800000 0x3
2200000 0x2
2600000 0x1
2900000 0x0>;
startup-delay-us = <100000>;
enable-active-high;
};
Max8925 Voltage regulators
Required nodes:
-nodes:
- SDV1 for SDV SDV1
- SDV2 for SDV SDV2
- SDV3 for SDV SDV3
- LDO1 for LDO LDO1
- LDO2 for LDO LDO2
- LDO3 for LDO LDO3
- LDO4 for LDO LDO4
- LDO5 for LDO LDO5
- LDO6 for LDO LDO6
- LDO7 for LDO LDO7
- LDO8 for LDO LDO8
- LDO9 for LDO LDO9
- LDO10 for LDO LDO10
- LDO11 for LDO LDO11
- LDO12 for LDO LDO12
- LDO13 for LDO LDO13
- LDO14 for LDO LDO14
- LDO15 for LDO LDO15
- LDO16 for LDO LDO16
- LDO17 for LDO LDO17
- LDO18 for LDO LDO18
- LDO19 for LDO LDO19
- LDO20 for LDO LDO20
Optional properties:
- Any optional property defined in bindings/regulator/regulator.txt
Example:
SDV1 {
regulator-min-microvolt = <637500>;
regulator-max-microvolt = <1425000>;
regulator-boot-on;
regulator-always-on;
};
* Maxim MAX8997 Voltage and Current Regulator
The Maxim MAX8997 is a multi-function device which includes volatage and
current regulators, rtc, charger controller and other sub-blocks. It is
interfaced to the host controller using a i2c interface. Each sub-block is
addressed by the host system using different i2c slave address. This document
describes the bindings for 'pmic' sub-block of max8997.
Required properties:
- compatible: Should be "maxim,max8997-pmic".
- reg: Specifies the i2c slave address of the pmic block. It should be 0x66.
- max8997,pmic-buck1-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
units for buck1 when changing voltage using gpio dvs. Refer to [1] below
for additional information.
- max8997,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
units for buck2 when changing voltage using gpio dvs. Refer to [1] below
for additional information.
- max8997,pmic-buck5-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
units for buck5 when changing voltage using gpio dvs. Refer to [1] below
for additional information.
[1] If none of the 'max8997,pmic-buck[1/2/5]-uses-gpio-dvs' optional
property is specified, the 'max8997,pmic-buck[1/2/5]-dvs-voltage'
property should specify atleast one voltage level (which would be a
safe operating voltage).
If either of the 'max8997,pmic-buck[1/2/5]-uses-gpio-dvs' optional
property is specified, then all the eigth voltage values for the
'max8997,pmic-buck[1/2/5]-dvs-voltage' should be specified.
Optional properties:
- interrupt-parent: Specifies the phandle of the interrupt controller to which
the interrupts from max8997 are delivered to.
- interrupts: Interrupt specifiers for two interrupt sources.
- First interrupt specifier is for 'irq1' interrupt.
- Second interrupt specifier is for 'alert' interrupt.
- max8997,pmic-buck1-uses-gpio-dvs: 'buck1' can be controlled by gpio dvs.
- max8997,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs.
- max8997,pmic-buck5-uses-gpio-dvs: 'buck5' can be controlled by gpio dvs.
Additional properties required if either of the optional properties are used:
- max8997,pmic-ignore-gpiodvs-side-effect: When GPIO-DVS mode is used for
multiple bucks, changing the voltage value of one of the bucks may affect
that of another buck, which is the side effect of the change (set_voltage).
Use this property to ignore such side effects and change the voltage.
- max8997,pmic-buck125-default-dvs-idx: Default voltage setting selected from
the possible 8 options selectable by the dvs gpios. The value of this
property should be between 0 and 7. If not specified or if out of range, the
default value of this property is set to 0.
- max8997,pmic-buck125-dvs-gpios: GPIO specifiers for three host gpio's used
for dvs. The format of the gpio specifier depends in the gpio controller.
Regulators: The regulators of max8997 that have to be instantiated should be
included in a sub-node named 'regulators'. Regulator nodes included in this
sub-node should be of the format as listed below.
regulator_name {
standard regulator bindings here
};
The following are the names of the regulators that the max8997 pmic block
supports. Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
as per the datasheet of max8997.
- LDOn
- valid values for n are 1 to 18 and 21
- Example: LDO0, LD01, LDO2, LDO21
- BUCKn
- valid values for n are 1 to 7.
- Example: BUCK1, BUCK2, BUCK3, BUCK7
- ENVICHG: Battery Charging Current Monitor Output. This is a fixed
voltage type regulator
- ESAFEOUT1: (ldo19)
- ESAFEOUT2: (ld020)
- CHARGER_CV: main battery charger voltage control
- CHARGER: main battery charger current control
- CHARGER_TOPOFF: end of charge current threshold level
The bindings inside the regulator nodes use the standard regulator bindings
which are documented elsewhere.
Example:
max8997_pmic@66 {
compatible = "maxim,max8997-pmic";
interrupt-parent = <&wakeup_eint>;
reg = <0x66>;
interrupts = <4 0>, <3 0>;
max8997,pmic-buck1-uses-gpio-dvs;
max8997,pmic-buck2-uses-gpio-dvs;
max8997,pmic-buck5-uses-gpio-dvs;
max8997,pmic-ignore-gpiodvs-side-effect;
max8997,pmic-buck125-default-dvs-idx = <0>;
max8997,pmic-buck125-dvs-gpios = <&gpx0 0 1 0 0>, /* SET1 */
<&gpx0 1 1 0 0>, /* SET2 */
<&gpx0 2 1 0 0>; /* SET3 */
max8997,pmic-buck1-dvs-voltage = <1350000>, <1300000>,
<1250000>, <1200000>,
<1150000>, <1100000>,
<1000000>, <950000>;
max8997,pmic-buck2-dvs-voltage = <1100000>, <1100000>,
<1100000>, <1100000>,
<1000000>, <1000000>,
<1000000>, <1000000>;
max8997,pmic-buck5-dvs-voltage = <1200000>, <1200000>,
<1200000>, <1200000>,
<1200000>, <1200000>,
<1200000>, <1200000>;
regulators {
ldo1_reg: LDO1 {
regulator-name = "VDD_ABB_3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
ldo2_reg: LDO2 {
regulator-name = "VDD_ALIVE_1.1V";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-always-on;
};
buck1_reg: BUCK1 {
regulator-name = "VDD_ARM_1.2V";
regulator-min-microvolt = <950000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-boot-on;
};
};
};
Versatile Express voltage regulators
------------------------------------
Requires node properties:
- "compatible" value: "arm,vexpress-volt"
- "arm,vexpress-sysreg,func" when controlled via vexpress-sysreg
(see Documentation/devicetree/bindings/arm/vexpress-sysreg.txt
for more details)
Required regulator properties:
- "regulator-name"
- "regulator-always-on"
Optional regulator properties:
- "regulator-min-microvolt"
- "regulator-max-microvolt"
See Documentation/devicetree/bindings/regulator/regulator.txt
for more details about the regulator properties.
When no "regulator-[min|max]-microvolt" properties are defined,
the device is treated as fixed (or rather "read-only") regulator.
Example:
volt@0 {
compatible = "arm,vexpress-volt";
arm,vexpress-sysreg,func = <2 0>;
regulator-name = "Cores";
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <1050000>;
regulator-always-on;
};
...@@ -211,7 +211,6 @@ config MFD_TPS6586X ...@@ -211,7 +211,6 @@ config MFD_TPS6586X
depends on I2C=y && GENERIC_HARDIRQS depends on I2C=y && GENERIC_HARDIRQS
select MFD_CORE select MFD_CORE
select REGMAP_I2C select REGMAP_I2C
depends on REGULATOR
help help
If you say yes here you get support for the TPS6586X series of If you say yes here you get support for the TPS6586X series of
Power Management chips. Power Management chips.
......
...@@ -21,8 +21,10 @@ ...@@ -21,8 +21,10 @@
* This driver is based on max8998.c * This driver is based on max8998.c
*/ */
#include <linux/err.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/of_irq.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -47,6 +49,13 @@ static struct mfd_cell max8997_devs[] = { ...@@ -47,6 +49,13 @@ static struct mfd_cell max8997_devs[] = {
{ .name = "max8997-led", .id = 2 }, { .name = "max8997-led", .id = 2 },
}; };
#ifdef CONFIG_OF
static struct of_device_id __devinitdata max8997_pmic_dt_match[] = {
{ .compatible = "maxim,max8997-pmic", .data = TYPE_MAX8997 },
{},
};
#endif
int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest) int max8997_read_reg(struct i2c_client *i2c, u8 reg, u8 *dest)
{ {
struct max8997_dev *max8997 = i2c_get_clientdata(i2c); struct max8997_dev *max8997 = i2c_get_clientdata(i2c);
...@@ -123,6 +132,58 @@ int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask) ...@@ -123,6 +132,58 @@ int max8997_update_reg(struct i2c_client *i2c, u8 reg, u8 val, u8 mask)
} }
EXPORT_SYMBOL_GPL(max8997_update_reg); EXPORT_SYMBOL_GPL(max8997_update_reg);
#ifdef CONFIG_OF
/*
* Only the common platform data elements for max8997 are parsed here from the
* device tree. Other sub-modules of max8997 such as pmic, rtc and others have
* to parse their own platform data elements from device tree.
*
* The max8997 platform data structure is instantiated here and the drivers for
* the sub-modules need not instantiate another instance while parsing their
* platform data.
*/
static struct max8997_platform_data *max8997_i2c_parse_dt_pdata(
struct device *dev)
{
struct max8997_platform_data *pd;
pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL);
if (!pd) {
dev_err(dev, "could not allocate memory for pdata\n");
return ERR_PTR(-ENOMEM);
}
pd->ono = irq_of_parse_and_map(dev->of_node, 1);
/*
* ToDo: the 'wakeup' member in the platform data is more of a linux
* specfic information. Hence, there is no binding for that yet and
* not parsed here.
*/
return pd;
}
#else
static struct max8997_platform_data *max8997_i2c_parse_dt_pdata(
struct device *dev)
{
return 0;
}
#endif
static inline int max8997_i2c_get_driver_data(struct i2c_client *i2c,
const struct i2c_device_id *id)
{
#ifdef CONFIG_OF
if (i2c->dev.of_node) {
const struct of_device_id *match;
match = of_match_node(max8997_pmic_dt_match, i2c->dev.of_node);
return (int)match->data;
}
#endif
return (int)id->driver_data;
}
static int max8997_i2c_probe(struct i2c_client *i2c, static int max8997_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
...@@ -137,12 +198,21 @@ static int max8997_i2c_probe(struct i2c_client *i2c, ...@@ -137,12 +198,21 @@ static int max8997_i2c_probe(struct i2c_client *i2c,
i2c_set_clientdata(i2c, max8997); i2c_set_clientdata(i2c, max8997);
max8997->dev = &i2c->dev; max8997->dev = &i2c->dev;
max8997->i2c = i2c; max8997->i2c = i2c;
max8997->type = id->driver_data; max8997->type = max8997_i2c_get_driver_data(i2c, id);
max8997->irq = i2c->irq; max8997->irq = i2c->irq;
if (max8997->dev->of_node) {
pdata = max8997_i2c_parse_dt_pdata(max8997->dev);
if (IS_ERR(pdata)) {
ret = PTR_ERR(pdata);
goto err;
}
}
if (!pdata) if (!pdata)
goto err; goto err;
max8997->pdata = pdata;
max8997->ono = pdata->ono; max8997->ono = pdata->ono;
mutex_init(&max8997->iolock); mutex_init(&max8997->iolock);
...@@ -434,6 +504,7 @@ static struct i2c_driver max8997_i2c_driver = { ...@@ -434,6 +504,7 @@ static struct i2c_driver max8997_i2c_driver = {
.name = "max8997", .name = "max8997",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &max8997_pm, .pm = &max8997_pm,
.of_match_table = of_match_ptr(max8997_pmic_dt_match),
}, },
.probe = max8997_i2c_probe, .probe = max8997_i2c_probe,
.remove = max8997_i2c_remove, .remove = max8997_i2c_remove,
......
...@@ -24,8 +24,6 @@ ...@@ -24,8 +24,6 @@
#include <linux/err.h> #include <linux/err.h>
#include <linux/i2c.h> #include <linux/i2c.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/machine.h>
#include <linux/mfd/core.h> #include <linux/mfd/core.h>
#include <linux/mfd/tps6586x.h> #include <linux/mfd/tps6586x.h>
...@@ -98,6 +96,9 @@ static struct mfd_cell tps6586x_cell[] = { ...@@ -98,6 +96,9 @@ static struct mfd_cell tps6586x_cell[] = {
{ {
.name = "tps6586x-gpio", .name = "tps6586x-gpio",
}, },
{
.name = "tps6586x-pmic",
},
{ {
.name = "tps6586x-rtc", .name = "tps6586x-rtc",
}, },
...@@ -350,80 +351,19 @@ static int tps6586x_add_subdevs(struct tps6586x *tps6586x, ...@@ -350,80 +351,19 @@ static int tps6586x_add_subdevs(struct tps6586x *tps6586x,
} }
#ifdef CONFIG_OF #ifdef CONFIG_OF
static struct of_regulator_match tps6586x_matches[] = {
{ .name = "sys", .driver_data = (void *)TPS6586X_ID_SYS },
{ .name = "sm0", .driver_data = (void *)TPS6586X_ID_SM_0 },
{ .name = "sm1", .driver_data = (void *)TPS6586X_ID_SM_1 },
{ .name = "sm2", .driver_data = (void *)TPS6586X_ID_SM_2 },
{ .name = "ldo0", .driver_data = (void *)TPS6586X_ID_LDO_0 },
{ .name = "ldo1", .driver_data = (void *)TPS6586X_ID_LDO_1 },
{ .name = "ldo2", .driver_data = (void *)TPS6586X_ID_LDO_2 },
{ .name = "ldo3", .driver_data = (void *)TPS6586X_ID_LDO_3 },
{ .name = "ldo4", .driver_data = (void *)TPS6586X_ID_LDO_4 },
{ .name = "ldo5", .driver_data = (void *)TPS6586X_ID_LDO_5 },
{ .name = "ldo6", .driver_data = (void *)TPS6586X_ID_LDO_6 },
{ .name = "ldo7", .driver_data = (void *)TPS6586X_ID_LDO_7 },
{ .name = "ldo8", .driver_data = (void *)TPS6586X_ID_LDO_8 },
{ .name = "ldo9", .driver_data = (void *)TPS6586X_ID_LDO_9 },
{ .name = "ldo_rtc", .driver_data = (void *)TPS6586X_ID_LDO_RTC },
};
static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *client) static struct tps6586x_platform_data *tps6586x_parse_dt(struct i2c_client *client)
{ {
const unsigned int num = ARRAY_SIZE(tps6586x_matches);
struct device_node *np = client->dev.of_node; struct device_node *np = client->dev.of_node;
struct tps6586x_platform_data *pdata; struct tps6586x_platform_data *pdata;
struct tps6586x_subdev_info *devs;
struct device_node *regs;
const char *sys_rail_name = NULL;
unsigned int count;
unsigned int i, j;
int err;
regs = of_find_node_by_name(np, "regulators");
if (!regs)
return NULL;
err = of_regulator_match(&client->dev, regs, tps6586x_matches, num);
if (err < 0) {
of_node_put(regs);
return NULL;
}
of_node_put(regs);
count = err;
devs = devm_kzalloc(&client->dev, count * sizeof(*devs), GFP_KERNEL);
if (!devs)
return NULL;
for (i = 0, j = 0; i < num && j < count; i++) {
struct regulator_init_data *reg_idata;
if (!tps6586x_matches[i].init_data)
continue;
reg_idata = tps6586x_matches[i].init_data;
devs[j].name = "tps6586x-regulator";
devs[j].platform_data = tps6586x_matches[i].init_data;
devs[j].id = (int)tps6586x_matches[i].driver_data;
if (devs[j].id == TPS6586X_ID_SYS)
sys_rail_name = reg_idata->constraints.name;
if ((devs[j].id == TPS6586X_ID_LDO_5) ||
(devs[j].id == TPS6586X_ID_LDO_RTC))
reg_idata->supply_regulator = sys_rail_name;
devs[j].of_node = tps6586x_matches[i].of_node;
j++;
}
pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) if (!pdata) {
dev_err(&client->dev, "Memory allocation failed\n");
return NULL; return NULL;
}
pdata->num_subdevs = count; pdata->num_subdevs = 0;
pdata->subdevs = devs; pdata->subdevs = NULL;
pdata->gpio_base = -1; pdata->gpio_base = -1;
pdata->irq_base = -1; pdata->irq_base = -1;
pdata->pm_off = of_property_read_bool(np, "ti,system-power-controller"); pdata->pm_off = of_property_read_bool(np, "ti,system-power-controller");
......
...@@ -258,6 +258,7 @@ static const struct reg_default wm5102_reg_default[] = { ...@@ -258,6 +258,7 @@ static const struct reg_default wm5102_reg_default[] = {
{ 0x00000154, 0x0000 }, /* R340 - Rate Estimator 3 */ { 0x00000154, 0x0000 }, /* R340 - Rate Estimator 3 */
{ 0x00000155, 0x0000 }, /* R341 - Rate Estimator 4 */ { 0x00000155, 0x0000 }, /* R341 - Rate Estimator 4 */
{ 0x00000156, 0x0000 }, /* R342 - Rate Estimator 5 */ { 0x00000156, 0x0000 }, /* R342 - Rate Estimator 5 */
{ 0x00000161, 0x0000 }, /* R353 - Dynamic Frequency Scaling 1 */
{ 0x00000171, 0x0000 }, /* R369 - FLL1 Control 1 */ { 0x00000171, 0x0000 }, /* R369 - FLL1 Control 1 */
{ 0x00000172, 0x0008 }, /* R370 - FLL1 Control 2 */ { 0x00000172, 0x0008 }, /* R370 - FLL1 Control 2 */
{ 0x00000173, 0x0018 }, /* R371 - FLL1 Control 3 */ { 0x00000173, 0x0018 }, /* R371 - FLL1 Control 3 */
...@@ -1047,6 +1048,7 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg) ...@@ -1047,6 +1048,7 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_RATE_ESTIMATOR_3: case ARIZONA_RATE_ESTIMATOR_3:
case ARIZONA_RATE_ESTIMATOR_4: case ARIZONA_RATE_ESTIMATOR_4:
case ARIZONA_RATE_ESTIMATOR_5: case ARIZONA_RATE_ESTIMATOR_5:
case ARIZONA_DYNAMIC_FREQUENCY_SCALING_1:
case ARIZONA_FLL1_CONTROL_1: case ARIZONA_FLL1_CONTROL_1:
case ARIZONA_FLL1_CONTROL_2: case ARIZONA_FLL1_CONTROL_2:
case ARIZONA_FLL1_CONTROL_3: case ARIZONA_FLL1_CONTROL_3:
...@@ -1079,6 +1081,7 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg) ...@@ -1079,6 +1081,7 @@ static bool wm5102_readable_register(struct device *dev, unsigned int reg)
case ARIZONA_FLL2_GPIO_CLOCK: case ARIZONA_FLL2_GPIO_CLOCK:
case ARIZONA_MIC_CHARGE_PUMP_1: case ARIZONA_MIC_CHARGE_PUMP_1:
case ARIZONA_LDO1_CONTROL_1: case ARIZONA_LDO1_CONTROL_1:
case ARIZONA_LDO1_CONTROL_2:
case ARIZONA_LDO2_CONTROL_1: case ARIZONA_LDO2_CONTROL_1:
case ARIZONA_MIC_BIAS_CTRL_1: case ARIZONA_MIC_BIAS_CTRL_1:
case ARIZONA_MIC_BIAS_CTRL_2: case ARIZONA_MIC_BIAS_CTRL_2:
......
...@@ -394,7 +394,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev, ...@@ -394,7 +394,7 @@ static int pm8607_regulator_dt_init(struct platform_device *pdev,
#define pm8607_regulator_dt_init(x, y, z) (-1) #define pm8607_regulator_dt_init(x, y, z) (-1)
#endif #endif
static int __devinit pm8607_regulator_probe(struct platform_device *pdev) static int pm8607_regulator_probe(struct platform_device *pdev)
{ {
struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
struct pm8607_regulator_info *info = NULL; struct pm8607_regulator_info *info = NULL;
...@@ -454,7 +454,7 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev) ...@@ -454,7 +454,7 @@ static int __devinit pm8607_regulator_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit pm8607_regulator_remove(struct platform_device *pdev) static int pm8607_regulator_remove(struct platform_device *pdev)
{ {
struct pm8607_regulator_info *info = platform_get_drvdata(pdev); struct pm8607_regulator_info *info = platform_get_drvdata(pdev);
...@@ -481,7 +481,7 @@ static struct platform_driver pm8607_regulator_driver = { ...@@ -481,7 +481,7 @@ static struct platform_driver pm8607_regulator_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = pm8607_regulator_probe, .probe = pm8607_regulator_probe,
.remove = __devexit_p(pm8607_regulator_remove), .remove = pm8607_regulator_remove,
.id_table = pm8607_regulator_driver_ids, .id_table = pm8607_regulator_driver_ids,
}; };
......
...@@ -109,6 +109,16 @@ config REGULATOR_DA9052 ...@@ -109,6 +109,16 @@ config REGULATOR_DA9052
This driver supports the voltage regulators of DA9052-BC and This driver supports the voltage regulators of DA9052-BC and
DA9053-AA/Bx PMIC. DA9053-AA/Bx PMIC.
config REGULATOR_DA9055
tristate "Dialog Semiconductor DA9055 regulators"
depends on MFD_DA9055
help
Say y here to support the BUCKs and LDOs regulators found on
Dialog Semiconductor DA9055 PMIC.
This driver can also be built as a module. If so, the module
will be called da9055-regulator.
config REGULATOR_FAN53555 config REGULATOR_FAN53555
tristate "Fairchild FAN53555 Regulator" tristate "Fairchild FAN53555 Regulator"
depends on I2C depends on I2C
...@@ -204,6 +214,16 @@ config REGULATOR_MAX8952 ...@@ -204,6 +214,16 @@ config REGULATOR_MAX8952
via I2C bus. Maxim 8952 has one voltage output and supports 4 DVS via I2C bus. Maxim 8952 has one voltage output and supports 4 DVS
modes ranging from 0.77V to 1.40V by 0.01V steps. modes ranging from 0.77V to 1.40V by 0.01V steps.
config REGULATOR_MAX8973
tristate "Maxim MAX8973 voltage regulator "
depends on I2C
select REGMAP_I2C
help
The MAXIM MAX8973 high-efficiency. three phase, DC-DC step-down
switching regulator delievers up to 9A of output current. Each
phase operates at a 2MHz fixed frequency with a 120 deg shift
from the adjacent phase, allowing the use of small magnetic component.
config REGULATOR_MAX8997 config REGULATOR_MAX8997
tristate "Maxim 8997/8966 regulator" tristate "Maxim 8997/8966 regulator"
depends on MFD_MAX8997 depends on MFD_MAX8997
...@@ -335,6 +355,17 @@ config REGULATOR_PALMAS ...@@ -335,6 +355,17 @@ config REGULATOR_PALMAS
on the muxing. This is handled automatically in the driver by on the muxing. This is handled automatically in the driver by
reading the mux info from OTP. reading the mux info from OTP.
config REGULATOR_TPS51632
tristate "TI TPS51632 Power Regulator"
depends on I2C
select REGMAP_I2C
help
This driver supports TPS51632 voltage regulator chip.
The TPS51632 is 3-2-1 Phase D-Cap+ Step Down Driverless Controller
with Serial VID control and DVFS.
The voltage output can be configure through I2C interface or PWM
interface.
config REGULATOR_TPS6105X config REGULATOR_TPS6105X
tristate "TI TPS6105X Power regulators" tristate "TI TPS6105X Power regulators"
depends on TPS6105X depends on TPS6105X
...@@ -415,6 +446,15 @@ config REGULATOR_TPS65912 ...@@ -415,6 +446,15 @@ config REGULATOR_TPS65912
help help
This driver supports TPS65912 voltage regulator chip. This driver supports TPS65912 voltage regulator chip.
config REGULATOR_TPS80031
tristate "TI TPS80031/TPS80032 power regualtor driver"
depends on MFD_TPS80031
help
TPS80031/ TPS80032 Fully Integrated Power Management with Power
Path and Battery Charger. It has 5 configurable step-down
converters, 11 general purpose LDOs, VBUS generator and digital
output to control regulators.
config REGULATOR_TWL4030 config REGULATOR_TWL4030
bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC" bool "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC"
depends on TWL4030_CORE depends on TWL4030_CORE
...@@ -422,6 +462,13 @@ config REGULATOR_TWL4030 ...@@ -422,6 +462,13 @@ config REGULATOR_TWL4030
This driver supports the voltage regulators provided by This driver supports the voltage regulators provided by
this family of companion chips. this family of companion chips.
config REGULATOR_VEXPRESS
tristate "Versatile Express regulators"
depends on VEXPRESS_CONFIG
help
This driver provides support for voltage regulators available
on the ARM Ltd's Versatile Express platform.
config REGULATOR_WM831X config REGULATOR_WM831X
tristate "Wolfson Microelectronics WM831x PMIC regulators" tristate "Wolfson Microelectronics WM831x PMIC regulators"
depends on MFD_WM831X depends on MFD_WM831X
...@@ -450,5 +497,12 @@ config REGULATOR_WM8994 ...@@ -450,5 +497,12 @@ config REGULATOR_WM8994
This driver provides support for the voltage regulators on the This driver provides support for the voltage regulators on the
WM8994 CODEC. WM8994 CODEC.
config REGULATOR_AS3711
tristate "AS3711 PMIC"
depends on MFD_AS3711
help
This driver provides support for the voltage regulators on the
AS3711 PMIC
endif endif
...@@ -16,8 +16,10 @@ obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o ...@@ -16,8 +16,10 @@ obj-$(CONFIG_REGULATOR_AB8500) += ab8500.o
obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o
obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o
obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o
obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o
obj-$(CONFIG_REGULATOR_DA903X) += da903x.o obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o
obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o obj-$(CONFIG_REGULATOR_DBX500_PRCMU) += dbx500-prcmu.o
obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o obj-$(CONFIG_REGULATOR_DB8500_PRCMU) += db8500-prcmu.o
obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o obj-$(CONFIG_REGULATOR_FAN53555) += fan53555.o
...@@ -34,6 +36,7 @@ obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o ...@@ -34,6 +36,7 @@ obj-$(CONFIG_REGULATOR_MAX8660) += max8660.o
obj-$(CONFIG_REGULATOR_MAX8907) += max8907-regulator.o obj-$(CONFIG_REGULATOR_MAX8907) += max8907-regulator.o
obj-$(CONFIG_REGULATOR_MAX8925) += max8925-regulator.o obj-$(CONFIG_REGULATOR_MAX8925) += max8925-regulator.o
obj-$(CONFIG_REGULATOR_MAX8952) += max8952.o obj-$(CONFIG_REGULATOR_MAX8952) += max8952.o
obj-$(CONFIG_REGULATOR_MAX8973) += max8973-regulator.o
obj-$(CONFIG_REGULATOR_MAX8997) += max8997.o obj-$(CONFIG_REGULATOR_MAX8997) += max8997.o
obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o
obj-$(CONFIG_REGULATOR_MAX77686) += max77686.o obj-$(CONFIG_REGULATOR_MAX77686) += max77686.o
...@@ -41,6 +44,7 @@ obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o ...@@ -41,6 +44,7 @@ obj-$(CONFIG_REGULATOR_MC13783) += mc13783-regulator.o
obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o obj-$(CONFIG_REGULATOR_MC13892) += mc13892-regulator.o
obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o obj-$(CONFIG_REGULATOR_MC13XXX_CORE) += mc13xxx-regulator-core.o
obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o obj-$(CONFIG_REGULATOR_PALMAS) += palmas-regulator.o
obj-$(CONFIG_REGULATOR_TPS51632) += tps51632-regulator.o
obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o obj-$(CONFIG_REGULATOR_PCAP) += pcap-regulator.o
obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o obj-$(CONFIG_REGULATOR_PCF50633) += pcf50633-regulator.o
obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o obj-$(CONFIG_REGULATOR_RC5T583) += rc5t583-regulator.o
...@@ -56,7 +60,9 @@ obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o ...@@ -56,7 +60,9 @@ obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o
obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o
obj-$(CONFIG_REGULATOR_VEXPRESS) += vexpress.o
obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o
obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o
obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o
......
...@@ -187,7 +187,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev) ...@@ -187,7 +187,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit aat2870_regulator_remove(struct platform_device *pdev) static int aat2870_regulator_remove(struct platform_device *pdev)
{ {
struct regulator_dev *rdev = platform_get_drvdata(pdev); struct regulator_dev *rdev = platform_get_drvdata(pdev);
...@@ -201,7 +201,7 @@ static struct platform_driver aat2870_regulator_driver = { ...@@ -201,7 +201,7 @@ static struct platform_driver aat2870_regulator_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = aat2870_regulator_probe, .probe = aat2870_regulator_probe,
.remove = __devexit_p(aat2870_regulator_remove), .remove = aat2870_regulator_remove,
}; };
static int __init aat2870_regulator_init(void) static int __init aat2870_regulator_init(void)
......
...@@ -494,7 +494,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = { ...@@ -494,7 +494,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = {
* for all the different regulators. * for all the different regulators.
*/ */
static int __devinit ab3100_regulators_probe(struct platform_device *pdev) static int ab3100_regulators_probe(struct platform_device *pdev)
{ {
struct ab3100_platform_data *plfdata = pdev->dev.platform_data; struct ab3100_platform_data *plfdata = pdev->dev.platform_data;
struct regulator_config config = { }; struct regulator_config config = { };
...@@ -571,7 +571,7 @@ static int __devinit ab3100_regulators_probe(struct platform_device *pdev) ...@@ -571,7 +571,7 @@ static int __devinit ab3100_regulators_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit ab3100_regulators_remove(struct platform_device *pdev) static int ab3100_regulators_remove(struct platform_device *pdev)
{ {
int i; int i;
...@@ -589,7 +589,7 @@ static struct platform_driver ab3100_regulators_driver = { ...@@ -589,7 +589,7 @@ static struct platform_driver ab3100_regulators_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = ab3100_regulators_probe, .probe = ab3100_regulators_probe,
.remove = __devexit_p(ab3100_regulators_remove), .remove = ab3100_regulators_remove,
}; };
static __init int ab3100_regulators_init(void) static __init int ab3100_regulators_init(void)
......
...@@ -641,7 +641,7 @@ static struct ab8500_reg_init ab8500_reg_init[] = { ...@@ -641,7 +641,7 @@ static struct ab8500_reg_init ab8500_reg_init[] = {
REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16), REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x16),
}; };
static __devinit int static int
ab8500_regulator_init_registers(struct platform_device *pdev, int id, int value) ab8500_regulator_init_registers(struct platform_device *pdev, int id, int value)
{ {
int err; int err;
...@@ -676,7 +676,7 @@ ab8500_regulator_init_registers(struct platform_device *pdev, int id, int value) ...@@ -676,7 +676,7 @@ ab8500_regulator_init_registers(struct platform_device *pdev, int id, int value)
return 0; return 0;
} }
static __devinit int ab8500_regulator_register(struct platform_device *pdev, static int ab8500_regulator_register(struct platform_device *pdev,
struct regulator_init_data *init_data, struct regulator_init_data *init_data,
int id, int id,
struct device_node *np) struct device_node *np)
...@@ -735,7 +735,7 @@ static struct of_regulator_match ab8500_regulator_matches[] = { ...@@ -735,7 +735,7 @@ static struct of_regulator_match ab8500_regulator_matches[] = {
{ .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, }, { .name = "ab8500_ldo_ana", .driver_data = (void *) AB8500_LDO_ANA, },
}; };
static __devinit int static int
ab8500_regulator_of_probe(struct platform_device *pdev, struct device_node *np) ab8500_regulator_of_probe(struct platform_device *pdev, struct device_node *np)
{ {
int err, i; int err, i;
...@@ -751,7 +751,7 @@ ab8500_regulator_of_probe(struct platform_device *pdev, struct device_node *np) ...@@ -751,7 +751,7 @@ ab8500_regulator_of_probe(struct platform_device *pdev, struct device_node *np)
return 0; return 0;
} }
static __devinit int ab8500_regulator_probe(struct platform_device *pdev) static int ab8500_regulator_probe(struct platform_device *pdev)
{ {
struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent);
struct ab8500_platform_data *pdata; struct ab8500_platform_data *pdata;
...@@ -817,7 +817,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) ...@@ -817,7 +817,7 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev)
return 0; return 0;
} }
static __devexit int ab8500_regulator_remove(struct platform_device *pdev) static int ab8500_regulator_remove(struct platform_device *pdev)
{ {
int i; int i;
...@@ -836,7 +836,7 @@ static __devexit int ab8500_regulator_remove(struct platform_device *pdev) ...@@ -836,7 +836,7 @@ static __devexit int ab8500_regulator_remove(struct platform_device *pdev)
static struct platform_driver ab8500_regulator_driver = { static struct platform_driver ab8500_regulator_driver = {
.probe = ab8500_regulator_probe, .probe = ab8500_regulator_probe,
.remove = __devexit_p(ab8500_regulator_remove), .remove = ab8500_regulator_remove,
.driver = { .driver = {
.name = "ab8500-regulator", .name = "ab8500-regulator",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -211,7 +211,7 @@ static const struct i2c_device_id ad5398_id[] = { ...@@ -211,7 +211,7 @@ static const struct i2c_device_id ad5398_id[] = {
}; };
MODULE_DEVICE_TABLE(i2c, ad5398_id); MODULE_DEVICE_TABLE(i2c, ad5398_id);
static int __devinit ad5398_probe(struct i2c_client *client, static int ad5398_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct regulator_init_data *init_data = client->dev.platform_data; struct regulator_init_data *init_data = client->dev.platform_data;
...@@ -256,7 +256,7 @@ static int __devinit ad5398_probe(struct i2c_client *client, ...@@ -256,7 +256,7 @@ static int __devinit ad5398_probe(struct i2c_client *client,
return ret; return ret;
} }
static int __devexit ad5398_remove(struct i2c_client *client) static int ad5398_remove(struct i2c_client *client)
{ {
struct ad5398_chip_info *chip = i2c_get_clientdata(client); struct ad5398_chip_info *chip = i2c_get_clientdata(client);
...@@ -266,7 +266,7 @@ static int __devexit ad5398_remove(struct i2c_client *client) ...@@ -266,7 +266,7 @@ static int __devexit ad5398_remove(struct i2c_client *client)
static struct i2c_driver ad5398_driver = { static struct i2c_driver ad5398_driver = {
.probe = ad5398_probe, .probe = ad5398_probe,
.remove = __devexit_p(ad5398_remove), .remove = ad5398_remove,
.driver = { .driver = {
.name = "ad5398", .name = "ad5398",
}, },
......
...@@ -48,36 +48,21 @@ static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg, ...@@ -48,36 +48,21 @@ static int anatop_regmap_set_voltage_sel(struct regulator_dev *reg,
unsigned selector) unsigned selector)
{ {
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
u32 val, mask;
if (!anatop_reg->control_reg) if (!anatop_reg->control_reg)
return -ENOTSUPP; return -ENOTSUPP;
val = anatop_reg->min_bit_val + selector; return regulator_set_voltage_sel_regmap(reg, selector);
dev_dbg(&reg->dev, "%s: calculated val %d\n", __func__, val);
mask = ((1 << anatop_reg->vol_bit_width) - 1) <<
anatop_reg->vol_bit_shift;
val <<= anatop_reg->vol_bit_shift;
regmap_update_bits(anatop_reg->anatop, anatop_reg->control_reg,
mask, val);
return 0;
} }
static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg) static int anatop_regmap_get_voltage_sel(struct regulator_dev *reg)
{ {
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
u32 val, mask;
if (!anatop_reg->control_reg) if (!anatop_reg->control_reg)
return -ENOTSUPP; return -ENOTSUPP;
regmap_read(anatop_reg->anatop, anatop_reg->control_reg, &val); return regulator_get_voltage_sel_regmap(reg);
mask = ((1 << anatop_reg->vol_bit_width) - 1) <<
anatop_reg->vol_bit_shift;
val = (val & mask) >> anatop_reg->vol_bit_shift;
return val - anatop_reg->min_bit_val;
} }
static struct regulator_ops anatop_rops = { static struct regulator_ops anatop_rops = {
...@@ -87,7 +72,7 @@ static struct regulator_ops anatop_rops = { ...@@ -87,7 +72,7 @@ static struct regulator_ops anatop_rops = {
.map_voltage = regulator_map_voltage_linear, .map_voltage = regulator_map_voltage_linear,
}; };
static int __devinit anatop_regulator_probe(struct platform_device *pdev) static int anatop_regulator_probe(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct device_node *np = dev->of_node; struct device_node *np = dev->of_node;
...@@ -158,15 +143,20 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev) ...@@ -158,15 +143,20 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev)
goto anatop_probe_end; goto anatop_probe_end;
} }
rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) rdesc->n_voltages = (sreg->max_voltage - sreg->min_voltage) / 25000 + 1
/ 25000 + 1; + sreg->min_bit_val;
rdesc->min_uV = sreg->min_voltage; rdesc->min_uV = sreg->min_voltage;
rdesc->uV_step = 25000; rdesc->uV_step = 25000;
rdesc->linear_min_sel = sreg->min_bit_val;
rdesc->vsel_reg = sreg->control_reg;
rdesc->vsel_mask = ((1 << sreg->vol_bit_width) - 1) <<
sreg->vol_bit_shift;
config.dev = &pdev->dev; config.dev = &pdev->dev;
config.init_data = initdata; config.init_data = initdata;
config.driver_data = sreg; config.driver_data = sreg;
config.of_node = pdev->dev.of_node; config.of_node = pdev->dev.of_node;
config.regmap = sreg->anatop;
/* register regulator */ /* register regulator */
rdev = regulator_register(rdesc, &config); rdev = regulator_register(rdesc, &config);
...@@ -186,7 +176,7 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev) ...@@ -186,7 +176,7 @@ static int __devinit anatop_regulator_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit anatop_regulator_remove(struct platform_device *pdev) static int anatop_regulator_remove(struct platform_device *pdev)
{ {
struct regulator_dev *rdev = platform_get_drvdata(pdev); struct regulator_dev *rdev = platform_get_drvdata(pdev);
struct anatop_regulator *sreg = rdev_get_drvdata(rdev); struct anatop_regulator *sreg = rdev_get_drvdata(rdev);
...@@ -210,7 +200,7 @@ static struct platform_driver anatop_regulator_driver = { ...@@ -210,7 +200,7 @@ static struct platform_driver anatop_regulator_driver = {
.of_match_table = of_anatop_regulator_match_tbl, .of_match_table = of_anatop_regulator_match_tbl,
}, },
.probe = anatop_regulator_probe, .probe = anatop_regulator_probe,
.remove = __devexit_p(anatop_regulator_remove), .remove = anatop_regulator_remove,
}; };
static int __init anatop_regulator_init(void) static int __init anatop_regulator_init(void)
......
...@@ -34,6 +34,108 @@ struct arizona_ldo1 { ...@@ -34,6 +34,108 @@ struct arizona_ldo1 {
struct regulator_init_data init_data; struct regulator_init_data init_data;
}; };
static int arizona_ldo1_hc_list_voltage(struct regulator_dev *rdev,
unsigned int selector)
{
if (selector >= rdev->desc->n_voltages)
return -EINVAL;
if (selector == rdev->desc->n_voltages - 1)
return 1800000;
else
return rdev->desc->min_uV + (rdev->desc->uV_step * selector);
}
static int arizona_ldo1_hc_map_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
int sel;
sel = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step);
if (sel >= rdev->desc->n_voltages)
sel = rdev->desc->n_voltages - 1;
return sel;
}
static int arizona_ldo1_hc_set_voltage_sel(struct regulator_dev *rdev,
unsigned sel)
{
struct arizona_ldo1 *ldo = rdev_get_drvdata(rdev);
struct regmap *regmap = ldo->arizona->regmap;
unsigned int val;
int ret;
if (sel == rdev->desc->n_voltages - 1)
val = ARIZONA_LDO1_HI_PWR;
else
val = 0;
ret = regmap_update_bits(regmap, ARIZONA_LDO1_CONTROL_2,
ARIZONA_LDO1_HI_PWR, val);
if (ret != 0)
return ret;
ret = regmap_update_bits(regmap, ARIZONA_DYNAMIC_FREQUENCY_SCALING_1,
ARIZONA_SUBSYS_MAX_FREQ, val);
if (ret != 0)
return ret;
if (val)
return 0;
val = sel << ARIZONA_LDO1_VSEL_SHIFT;
return regmap_update_bits(regmap, ARIZONA_LDO1_CONTROL_1,
ARIZONA_LDO1_VSEL_MASK, val);
}
static int arizona_ldo1_hc_get_voltage_sel(struct regulator_dev *rdev)
{
struct arizona_ldo1 *ldo = rdev_get_drvdata(rdev);
struct regmap *regmap = ldo->arizona->regmap;
unsigned int val;
int ret;
ret = regmap_read(regmap, ARIZONA_LDO1_CONTROL_2, &val);
if (ret != 0)
return ret;
if (val & ARIZONA_LDO1_HI_PWR)
return rdev->desc->n_voltages - 1;
ret = regmap_read(regmap, ARIZONA_LDO1_CONTROL_1, &val);
if (ret != 0)
return ret;
return (val & ARIZONA_LDO1_VSEL_MASK) >> ARIZONA_LDO1_VSEL_SHIFT;
}
static struct regulator_ops arizona_ldo1_hc_ops = {
.list_voltage = arizona_ldo1_hc_list_voltage,
.map_voltage = arizona_ldo1_hc_map_voltage,
.get_voltage_sel = arizona_ldo1_hc_get_voltage_sel,
.set_voltage_sel = arizona_ldo1_hc_set_voltage_sel,
.get_bypass = regulator_get_bypass_regmap,
.set_bypass = regulator_set_bypass_regmap,
};
static const struct regulator_desc arizona_ldo1_hc = {
.name = "LDO1",
.supply_name = "LDOVDD",
.type = REGULATOR_VOLTAGE,
.ops = &arizona_ldo1_hc_ops,
.bypass_reg = ARIZONA_LDO1_CONTROL_1,
.bypass_mask = ARIZONA_LDO1_BYPASS,
.min_uV = 900000,
.uV_step = 50000,
.n_voltages = 8,
.enable_time = 500,
.owner = THIS_MODULE,
};
static struct regulator_ops arizona_ldo1_ops = { static struct regulator_ops arizona_ldo1_ops = {
.list_voltage = regulator_list_voltage_linear, .list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear, .map_voltage = regulator_map_voltage_linear,
...@@ -55,11 +157,22 @@ static const struct regulator_desc arizona_ldo1 = { ...@@ -55,11 +157,22 @@ static const struct regulator_desc arizona_ldo1 = {
.bypass_mask = ARIZONA_LDO1_BYPASS, .bypass_mask = ARIZONA_LDO1_BYPASS,
.min_uV = 900000, .min_uV = 900000,
.uV_step = 50000, .uV_step = 50000,
.n_voltages = 6, .n_voltages = 7,
.enable_time = 500,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static const struct regulator_init_data arizona_ldo1_dvfs = {
.constraints = {
.min_uV = 1200000,
.max_uV = 1800000,
.valid_ops_mask = REGULATOR_CHANGE_STATUS |
REGULATOR_CHANGE_VOLTAGE,
},
.num_consumer_supplies = 1,
};
static const struct regulator_init_data arizona_ldo1_default = { static const struct regulator_init_data arizona_ldo1_default = {
.constraints = { .constraints = {
.valid_ops_mask = REGULATOR_CHANGE_STATUS, .valid_ops_mask = REGULATOR_CHANGE_STATUS,
...@@ -67,9 +180,10 @@ static const struct regulator_init_data arizona_ldo1_default = { ...@@ -67,9 +180,10 @@ static const struct regulator_init_data arizona_ldo1_default = {
.num_consumer_supplies = 1, .num_consumer_supplies = 1,
}; };
static __devinit int arizona_ldo1_probe(struct platform_device *pdev) static int arizona_ldo1_probe(struct platform_device *pdev)
{ {
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
const struct regulator_desc *desc;
struct regulator_config config = { }; struct regulator_config config = { };
struct arizona_ldo1 *ldo1; struct arizona_ldo1 *ldo1;
int ret; int ret;
...@@ -87,7 +201,17 @@ static __devinit int arizona_ldo1_probe(struct platform_device *pdev) ...@@ -87,7 +201,17 @@ static __devinit int arizona_ldo1_probe(struct platform_device *pdev)
* default init_data for it. This will be overridden with * default init_data for it. This will be overridden with
* platform data if provided. * platform data if provided.
*/ */
ldo1->init_data = arizona_ldo1_default; switch (arizona->type) {
case WM5102:
desc = &arizona_ldo1_hc;
ldo1->init_data = arizona_ldo1_dvfs;
break;
default:
desc = &arizona_ldo1;
ldo1->init_data = arizona_ldo1_default;
break;
}
ldo1->init_data.consumer_supplies = &ldo1->supply; ldo1->init_data.consumer_supplies = &ldo1->supply;
ldo1->supply.supply = "DCVDD"; ldo1->supply.supply = "DCVDD";
ldo1->supply.dev_name = dev_name(arizona->dev); ldo1->supply.dev_name = dev_name(arizona->dev);
...@@ -102,7 +226,7 @@ static __devinit int arizona_ldo1_probe(struct platform_device *pdev) ...@@ -102,7 +226,7 @@ static __devinit int arizona_ldo1_probe(struct platform_device *pdev)
else else
config.init_data = &ldo1->init_data; config.init_data = &ldo1->init_data;
ldo1->regulator = regulator_register(&arizona_ldo1, &config); ldo1->regulator = regulator_register(desc, &config);
if (IS_ERR(ldo1->regulator)) { if (IS_ERR(ldo1->regulator)) {
ret = PTR_ERR(ldo1->regulator); ret = PTR_ERR(ldo1->regulator);
dev_err(arizona->dev, "Failed to register LDO1 supply: %d\n", dev_err(arizona->dev, "Failed to register LDO1 supply: %d\n",
...@@ -115,7 +239,7 @@ static __devinit int arizona_ldo1_probe(struct platform_device *pdev) ...@@ -115,7 +239,7 @@ static __devinit int arizona_ldo1_probe(struct platform_device *pdev)
return 0; return 0;
} }
static __devexit int arizona_ldo1_remove(struct platform_device *pdev) static int arizona_ldo1_remove(struct platform_device *pdev)
{ {
struct arizona_ldo1 *ldo1 = platform_get_drvdata(pdev); struct arizona_ldo1 *ldo1 = platform_get_drvdata(pdev);
...@@ -126,7 +250,7 @@ static __devexit int arizona_ldo1_remove(struct platform_device *pdev) ...@@ -126,7 +250,7 @@ static __devexit int arizona_ldo1_remove(struct platform_device *pdev)
static struct platform_driver arizona_ldo1_driver = { static struct platform_driver arizona_ldo1_driver = {
.probe = arizona_ldo1_probe, .probe = arizona_ldo1_probe,
.remove = __devexit_p(arizona_ldo1_remove), .remove = arizona_ldo1_remove,
.driver = { .driver = {
.name = "arizona-ldo1", .name = "arizona-ldo1",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -101,6 +101,8 @@ static const struct regulator_desc arizona_micsupp = { ...@@ -101,6 +101,8 @@ static const struct regulator_desc arizona_micsupp = {
.bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1, .bypass_reg = ARIZONA_MIC_CHARGE_PUMP_1,
.bypass_mask = ARIZONA_CPMIC_BYPASS, .bypass_mask = ARIZONA_CPMIC_BYPASS,
.enable_time = 3000,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
...@@ -115,7 +117,7 @@ static const struct regulator_init_data arizona_micsupp_default = { ...@@ -115,7 +117,7 @@ static const struct regulator_init_data arizona_micsupp_default = {
.num_consumer_supplies = 1, .num_consumer_supplies = 1,
}; };
static __devinit int arizona_micsupp_probe(struct platform_device *pdev) static int arizona_micsupp_probe(struct platform_device *pdev)
{ {
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
struct regulator_config config = { }; struct regulator_config config = { };
...@@ -166,7 +168,7 @@ static __devinit int arizona_micsupp_probe(struct platform_device *pdev) ...@@ -166,7 +168,7 @@ static __devinit int arizona_micsupp_probe(struct platform_device *pdev)
return 0; return 0;
} }
static __devexit int arizona_micsupp_remove(struct platform_device *pdev) static int arizona_micsupp_remove(struct platform_device *pdev)
{ {
struct arizona_micsupp *micsupp = platform_get_drvdata(pdev); struct arizona_micsupp *micsupp = platform_get_drvdata(pdev);
...@@ -177,7 +179,7 @@ static __devexit int arizona_micsupp_remove(struct platform_device *pdev) ...@@ -177,7 +179,7 @@ static __devexit int arizona_micsupp_remove(struct platform_device *pdev)
static struct platform_driver arizona_micsupp_driver = { static struct platform_driver arizona_micsupp_driver = {
.probe = arizona_micsupp_probe, .probe = arizona_micsupp_probe,
.remove = __devexit_p(arizona_micsupp_remove), .remove = arizona_micsupp_remove,
.driver = { .driver = {
.name = "arizona-micsupp", .name = "arizona-micsupp",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
This diff is collapsed.
...@@ -199,8 +199,11 @@ static int regulator_check_consumers(struct regulator_dev *rdev, ...@@ -199,8 +199,11 @@ static int regulator_check_consumers(struct regulator_dev *rdev,
*min_uV = regulator->min_uV; *min_uV = regulator->min_uV;
} }
if (*min_uV > *max_uV) if (*min_uV > *max_uV) {
dev_err(regulator->dev, "Restricting voltage, %u-%uuV\n",
regulator->min_uV, regulator->max_uV);
return -EINVAL; return -EINVAL;
}
return 0; return 0;
} }
...@@ -880,7 +883,9 @@ static int machine_constraints_voltage(struct regulator_dev *rdev, ...@@ -880,7 +883,9 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
/* final: [min_uV..max_uV] valid iff constraints valid */ /* final: [min_uV..max_uV] valid iff constraints valid */
if (max_uV < min_uV) { if (max_uV < min_uV) {
rdev_err(rdev, "unsupportable voltage constraints\n"); rdev_err(rdev,
"unsupportable voltage constraints %u-%uuV\n",
min_uV, max_uV);
return -EINVAL; return -EINVAL;
} }
...@@ -1866,6 +1871,28 @@ int regulator_is_enabled(struct regulator *regulator) ...@@ -1866,6 +1871,28 @@ int regulator_is_enabled(struct regulator *regulator)
} }
EXPORT_SYMBOL_GPL(regulator_is_enabled); EXPORT_SYMBOL_GPL(regulator_is_enabled);
/**
* regulator_can_change_voltage - check if regulator can change voltage
* @regulator: regulator source
*
* Returns positive if the regulator driver backing the source/client
* can change its voltage, false otherwise. Usefull for detecting fixed
* or dummy regulators and disabling voltage change logic in the client
* driver.
*/
int regulator_can_change_voltage(struct regulator *regulator)
{
struct regulator_dev *rdev = regulator->rdev;
if (rdev->constraints &&
rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE &&
(rdev->desc->n_voltages - rdev->desc->linear_min_sel) > 1)
return 1;
return 0;
}
EXPORT_SYMBOL_GPL(regulator_can_change_voltage);
/** /**
* regulator_count_voltages - count regulator_list_voltage() selectors * regulator_count_voltages - count regulator_list_voltage() selectors
* @regulator: regulator source * @regulator: regulator source
...@@ -1897,6 +1924,10 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev, ...@@ -1897,6 +1924,10 @@ int regulator_list_voltage_linear(struct regulator_dev *rdev,
{ {
if (selector >= rdev->desc->n_voltages) if (selector >= rdev->desc->n_voltages)
return -EINVAL; return -EINVAL;
if (selector < rdev->desc->linear_min_sel)
return 0;
selector -= rdev->desc->linear_min_sel;
return rdev->desc->min_uV + (rdev->desc->uV_step * selector); return rdev->desc->min_uV + (rdev->desc->uV_step * selector);
} }
...@@ -1985,6 +2016,11 @@ int regulator_is_supported_voltage(struct regulator *regulator, ...@@ -1985,6 +2016,11 @@ int regulator_is_supported_voltage(struct regulator *regulator,
return ret; return ret;
} }
/* Any voltage within constrains range is fine? */
if (rdev->desc->continuous_voltage_range)
return min_uV >= rdev->constraints->min_uV &&
max_uV <= rdev->constraints->max_uV;
ret = regulator_count_voltages(regulator); ret = regulator_count_voltages(regulator);
if (ret < 0) if (ret < 0)
return ret; return ret;
...@@ -2120,6 +2156,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev, ...@@ -2120,6 +2156,8 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
if (ret < 0) if (ret < 0)
return ret; return ret;
ret += rdev->desc->linear_min_sel;
/* Map back into a voltage to verify we're still in bounds */ /* Map back into a voltage to verify we're still in bounds */
voltage = rdev->desc->ops->list_voltage(rdev, ret); voltage = rdev->desc->ops->list_voltage(rdev, ret);
if (voltage < min_uV || voltage > max_uV) if (voltage < min_uV || voltage > max_uV)
......
...@@ -460,7 +460,7 @@ static inline struct da903x_regulator_info *find_regulator_info(int id) ...@@ -460,7 +460,7 @@ static inline struct da903x_regulator_info *find_regulator_info(int id)
return NULL; return NULL;
} }
static int __devinit da903x_regulator_probe(struct platform_device *pdev) static int da903x_regulator_probe(struct platform_device *pdev)
{ {
struct da903x_regulator_info *ri = NULL; struct da903x_regulator_info *ri = NULL;
struct regulator_dev *rdev; struct regulator_dev *rdev;
...@@ -499,7 +499,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev) ...@@ -499,7 +499,7 @@ static int __devinit da903x_regulator_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit da903x_regulator_remove(struct platform_device *pdev) static int da903x_regulator_remove(struct platform_device *pdev)
{ {
struct regulator_dev *rdev = platform_get_drvdata(pdev); struct regulator_dev *rdev = platform_get_drvdata(pdev);
...@@ -513,7 +513,7 @@ static struct platform_driver da903x_regulator_driver = { ...@@ -513,7 +513,7 @@ static struct platform_driver da903x_regulator_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = da903x_regulator_probe, .probe = da903x_regulator_probe,
.remove = __devexit_p(da903x_regulator_remove), .remove = da903x_regulator_remove,
}; };
static int __init da903x_regulator_init(void) static int __init da903x_regulator_init(void)
......
...@@ -129,17 +129,17 @@ static int da9052_dcdc_set_current_limit(struct regulator_dev *rdev, int min_uA, ...@@ -129,17 +129,17 @@ static int da9052_dcdc_set_current_limit(struct regulator_dev *rdev, int min_uA,
else if (offset == 0) else if (offset == 0)
row = 1; row = 1;
if (min_uA > da9052_current_limits[row][DA9052_MAX_UA] ||
max_uA < da9052_current_limits[row][DA9052_MIN_UA])
return -EINVAL;
for (i = DA9052_CURRENT_RANGE - 1; i >= 0; i--) { for (i = DA9052_CURRENT_RANGE - 1; i >= 0; i--) {
if (da9052_current_limits[row][i] <= max_uA) { if ((min_uA <= da9052_current_limits[row][i]) &&
(da9052_current_limits[row][i] <= max_uA)) {
reg_val = i; reg_val = i;
break; break;
} }
} }
if (i < 0)
return -EINVAL;
/* Determine the even or odd position of the buck current limit /* Determine the even or odd position of the buck current limit
* register field * register field
*/ */
...@@ -365,7 +365,7 @@ static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id, ...@@ -365,7 +365,7 @@ static inline struct da9052_regulator_info *find_regulator_info(u8 chip_id,
return NULL; return NULL;
} }
static int __devinit da9052_regulator_probe(struct platform_device *pdev) static int da9052_regulator_probe(struct platform_device *pdev)
{ {
struct regulator_config config = { }; struct regulator_config config = { };
struct da9052_regulator *regulator; struct da9052_regulator *regulator;
...@@ -430,7 +430,7 @@ static int __devinit da9052_regulator_probe(struct platform_device *pdev) ...@@ -430,7 +430,7 @@ static int __devinit da9052_regulator_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit da9052_regulator_remove(struct platform_device *pdev) static int da9052_regulator_remove(struct platform_device *pdev)
{ {
struct da9052_regulator *regulator = platform_get_drvdata(pdev); struct da9052_regulator *regulator = platform_get_drvdata(pdev);
...@@ -440,7 +440,7 @@ static int __devexit da9052_regulator_remove(struct platform_device *pdev) ...@@ -440,7 +440,7 @@ static int __devexit da9052_regulator_remove(struct platform_device *pdev)
static struct platform_driver da9052_regulator_driver = { static struct platform_driver da9052_regulator_driver = {
.probe = da9052_regulator_probe, .probe = da9052_regulator_probe,
.remove = __devexit_p(da9052_regulator_remove), .remove = da9052_regulator_remove,
.driver = { .driver = {
.name = "da9052-regulator", .name = "da9052-regulator",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
This diff is collapsed.
...@@ -412,7 +412,7 @@ dbx500_regulator_info[DB8500_NUM_REGULATORS] = { ...@@ -412,7 +412,7 @@ dbx500_regulator_info[DB8500_NUM_REGULATORS] = {
}, },
}; };
static __devinit int db8500_regulator_register(struct platform_device *pdev, static int db8500_regulator_register(struct platform_device *pdev,
struct regulator_init_data *init_data, struct regulator_init_data *init_data,
int id, int id,
struct device_node *np) struct device_node *np)
...@@ -474,7 +474,7 @@ static struct of_regulator_match db8500_regulator_matches[] = { ...@@ -474,7 +474,7 @@ static struct of_regulator_match db8500_regulator_matches[] = {
{ .name = "db8500_esram34_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34RET, }, { .name = "db8500_esram34_ret", .driver_data = (void *) DB8500_REGULATOR_SWITCH_ESRAM34RET, },
}; };
static __devinit int static int
db8500_regulator_of_probe(struct platform_device *pdev, db8500_regulator_of_probe(struct platform_device *pdev,
struct device_node *np) struct device_node *np)
{ {
...@@ -491,7 +491,7 @@ db8500_regulator_of_probe(struct platform_device *pdev, ...@@ -491,7 +491,7 @@ db8500_regulator_of_probe(struct platform_device *pdev,
return 0; return 0;
} }
static int __devinit db8500_regulator_probe(struct platform_device *pdev) static int db8500_regulator_probe(struct platform_device *pdev)
{ {
struct regulator_init_data *db8500_init_data = struct regulator_init_data *db8500_init_data =
dev_get_platdata(&pdev->dev); dev_get_platdata(&pdev->dev);
......
...@@ -173,7 +173,7 @@ int __attribute__((weak)) dbx500_regulator_testcase( ...@@ -173,7 +173,7 @@ int __attribute__((weak)) dbx500_regulator_testcase(
return 0; return 0;
} }
int __devinit int
ux500_regulator_debug_init(struct platform_device *pdev, ux500_regulator_debug_init(struct platform_device *pdev,
struct dbx500_regulator_info *regulator_info, struct dbx500_regulator_info *regulator_info,
int num_regulators) int num_regulators)
...@@ -230,7 +230,7 @@ ux500_regulator_debug_init(struct platform_device *pdev, ...@@ -230,7 +230,7 @@ ux500_regulator_debug_init(struct platform_device *pdev,
return -ENOMEM; return -ENOMEM;
} }
int __devexit ux500_regulator_debug_exit(void) int ux500_regulator_debug_exit(void)
{ {
debugfs_remove_recursive(rdebug.dir); debugfs_remove_recursive(rdebug.dir);
kfree(rdebug.state_after_suspend); kfree(rdebug.state_after_suspend);
......
...@@ -37,7 +37,7 @@ static struct regulator_desc dummy_desc = { ...@@ -37,7 +37,7 @@ static struct regulator_desc dummy_desc = {
.ops = &dummy_ops, .ops = &dummy_ops,
}; };
static int __devinit dummy_regulator_probe(struct platform_device *pdev) static int dummy_regulator_probe(struct platform_device *pdev)
{ {
struct regulator_config config = { }; struct regulator_config config = { };
int ret; int ret;
......
...@@ -230,7 +230,7 @@ static struct regmap_config fan53555_regmap_config = { ...@@ -230,7 +230,7 @@ static struct regmap_config fan53555_regmap_config = {
.val_bits = 8, .val_bits = 8,
}; };
static int __devinit fan53555_regulator_probe(struct i2c_client *client, static int fan53555_regulator_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct fan53555_device_info *di; struct fan53555_device_info *di;
...@@ -293,7 +293,7 @@ static int __devinit fan53555_regulator_probe(struct i2c_client *client, ...@@ -293,7 +293,7 @@ static int __devinit fan53555_regulator_probe(struct i2c_client *client,
} }
static int __devexit fan53555_regulator_remove(struct i2c_client *client) static int fan53555_regulator_remove(struct i2c_client *client)
{ {
struct fan53555_device_info *di = i2c_get_clientdata(client); struct fan53555_device_info *di = i2c_get_clientdata(client);
...@@ -311,7 +311,7 @@ static struct i2c_driver fan53555_regulator_driver = { ...@@ -311,7 +311,7 @@ static struct i2c_driver fan53555_regulator_driver = {
.name = "fan53555-regulator", .name = "fan53555-regulator",
}, },
.probe = fan53555_regulator_probe, .probe = fan53555_regulator_probe,
.remove = __devexit_p(fan53555_regulator_remove), .remove = fan53555_regulator_remove,
.id_table = fan53555_id, .id_table = fan53555_id,
}; };
......
...@@ -134,7 +134,7 @@ static struct regulator_ops fixed_voltage_ops = { ...@@ -134,7 +134,7 @@ static struct regulator_ops fixed_voltage_ops = {
.list_voltage = fixed_voltage_list_voltage, .list_voltage = fixed_voltage_list_voltage,
}; };
static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) static int reg_fixed_voltage_probe(struct platform_device *pdev)
{ {
struct fixed_voltage_config *config; struct fixed_voltage_config *config;
struct fixed_voltage_data *drvdata; struct fixed_voltage_data *drvdata;
...@@ -234,7 +234,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev) ...@@ -234,7 +234,7 @@ static int __devinit reg_fixed_voltage_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit reg_fixed_voltage_remove(struct platform_device *pdev) static int reg_fixed_voltage_remove(struct platform_device *pdev)
{ {
struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev); struct fixed_voltage_data *drvdata = platform_get_drvdata(pdev);
...@@ -255,7 +255,7 @@ MODULE_DEVICE_TABLE(of, fixed_of_match); ...@@ -255,7 +255,7 @@ MODULE_DEVICE_TABLE(of, fixed_of_match);
static struct platform_driver regulator_fixed_voltage_driver = { static struct platform_driver regulator_fixed_voltage_driver = {
.probe = reg_fixed_voltage_probe, .probe = reg_fixed_voltage_probe,
.remove = __devexit_p(reg_fixed_voltage_remove), .remove = reg_fixed_voltage_remove,
.driver = { .driver = {
.name = "reg-fixed-voltage", .name = "reg-fixed-voltage",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -28,9 +28,12 @@ ...@@ -28,9 +28,12 @@
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/regulator/driver.h> #include <linux/regulator/driver.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regulator/gpio-regulator.h> #include <linux/regulator/gpio-regulator.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
struct gpio_regulator_data { struct gpio_regulator_data {
struct regulator_desc desc; struct regulator_desc desc;
...@@ -79,7 +82,7 @@ static int gpio_regulator_set_voltage(struct regulator_dev *dev, ...@@ -79,7 +82,7 @@ static int gpio_regulator_set_voltage(struct regulator_dev *dev,
for (ptr = 0; ptr < data->nr_gpios; ptr++) { for (ptr = 0; ptr < data->nr_gpios; ptr++) {
state = (target & (1 << ptr)) >> ptr; state = (target & (1 << ptr)) >> ptr;
gpio_set_value(data->gpios[ptr].gpio, state); gpio_set_value_cansleep(data->gpios[ptr].gpio, state);
} }
data->state = target; data->state = target;
...@@ -116,7 +119,7 @@ static int gpio_regulator_set_current_limit(struct regulator_dev *dev, ...@@ -116,7 +119,7 @@ static int gpio_regulator_set_current_limit(struct regulator_dev *dev,
for (ptr = 0; ptr < data->nr_gpios; ptr++) { for (ptr = 0; ptr < data->nr_gpios; ptr++) {
state = (target & (1 << ptr)) >> ptr; state = (target & (1 << ptr)) >> ptr;
gpio_set_value(data->gpios[ptr].gpio, state); gpio_set_value_cansleep(data->gpios[ptr].gpio, state);
} }
data->state = target; data->state = target;
...@@ -129,18 +132,108 @@ static struct regulator_ops gpio_regulator_voltage_ops = { ...@@ -129,18 +132,108 @@ static struct regulator_ops gpio_regulator_voltage_ops = {
.list_voltage = gpio_regulator_list_voltage, .list_voltage = gpio_regulator_list_voltage,
}; };
struct gpio_regulator_config *
of_get_gpio_regulator_config(struct device *dev, struct device_node *np)
{
struct gpio_regulator_config *config;
struct property *prop;
const char *regtype;
int proplen, gpio, i;
config = devm_kzalloc(dev,
sizeof(struct gpio_regulator_config),
GFP_KERNEL);
if (!config)
return ERR_PTR(-ENOMEM);
config->init_data = of_get_regulator_init_data(dev, np);
if (!config->init_data)
return ERR_PTR(-EINVAL);
config->supply_name = config->init_data->constraints.name;
if (of_property_read_bool(np, "enable-active-high"))
config->enable_high = true;
if (of_property_read_bool(np, "enable-at-boot"))
config->enabled_at_boot = true;
of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
config->enable_gpio = of_get_named_gpio(np, "enable-gpio", 0);
/* Fetch GPIOs. */
for (i = 0; ; i++)
if (of_get_named_gpio(np, "gpios", i) < 0)
break;
config->nr_gpios = i;
config->gpios = devm_kzalloc(dev,
sizeof(struct gpio) * config->nr_gpios,
GFP_KERNEL);
if (!config->gpios)
return ERR_PTR(-ENOMEM);
for (i = 0; i < config->nr_gpios; i++) {
gpio = of_get_named_gpio(np, "gpios", i);
if (gpio < 0)
break;
config->gpios[i].gpio = gpio;
}
/* Fetch states. */
prop = of_find_property(np, "states", NULL);
if (!prop) {
dev_err(dev, "No 'states' property found\n");
return ERR_PTR(-EINVAL);
}
proplen = prop->length / sizeof(int);
config->states = devm_kzalloc(dev,
sizeof(struct gpio_regulator_state)
* (proplen / 2),
GFP_KERNEL);
if (!config->states)
return ERR_PTR(-ENOMEM);
for (i = 0; i < proplen / 2; i++) {
config->states[i].value =
be32_to_cpup((int *)prop->value + (i * 2));
config->states[i].gpios =
be32_to_cpup((int *)prop->value + (i * 2 + 1));
}
config->nr_states = i;
of_property_read_string(np, "regulator-type", &regtype);
if (!strncmp("voltage", regtype, 7))
config->type = REGULATOR_VOLTAGE;
else if (!strncmp("current", regtype, 7))
config->type = REGULATOR_CURRENT;
return config;
}
static struct regulator_ops gpio_regulator_current_ops = { static struct regulator_ops gpio_regulator_current_ops = {
.get_current_limit = gpio_regulator_get_value, .get_current_limit = gpio_regulator_get_value,
.set_current_limit = gpio_regulator_set_current_limit, .set_current_limit = gpio_regulator_set_current_limit,
}; };
static int __devinit gpio_regulator_probe(struct platform_device *pdev) static int gpio_regulator_probe(struct platform_device *pdev)
{ {
struct gpio_regulator_config *config = pdev->dev.platform_data; struct gpio_regulator_config *config = pdev->dev.platform_data;
struct device_node *np = pdev->dev.of_node;
struct gpio_regulator_data *drvdata; struct gpio_regulator_data *drvdata;
struct regulator_config cfg = { }; struct regulator_config cfg = { };
int ptr, ret, state; int ptr, ret, state;
if (np) {
config = of_get_gpio_regulator_config(&pdev->dev, np);
if (IS_ERR(config))
return PTR_ERR(config);
}
drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data), drvdata = devm_kzalloc(&pdev->dev, sizeof(struct gpio_regulator_data),
GFP_KERNEL); GFP_KERNEL);
if (drvdata == NULL) { if (drvdata == NULL) {
...@@ -215,6 +308,7 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev) ...@@ -215,6 +308,7 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev)
cfg.dev = &pdev->dev; cfg.dev = &pdev->dev;
cfg.init_data = config->init_data; cfg.init_data = config->init_data;
cfg.driver_data = drvdata; cfg.driver_data = drvdata;
cfg.of_node = np;
if (config->enable_gpio >= 0) if (config->enable_gpio >= 0)
cfg.ena_gpio = config->enable_gpio; cfg.ena_gpio = config->enable_gpio;
...@@ -254,7 +348,7 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev) ...@@ -254,7 +348,7 @@ static int __devinit gpio_regulator_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit gpio_regulator_remove(struct platform_device *pdev) static int gpio_regulator_remove(struct platform_device *pdev)
{ {
struct gpio_regulator_data *drvdata = platform_get_drvdata(pdev); struct gpio_regulator_data *drvdata = platform_get_drvdata(pdev);
...@@ -270,12 +364,20 @@ static int __devexit gpio_regulator_remove(struct platform_device *pdev) ...@@ -270,12 +364,20 @@ static int __devexit gpio_regulator_remove(struct platform_device *pdev)
return 0; return 0;
} }
#if defined(CONFIG_OF)
static const struct of_device_id regulator_gpio_of_match[] __devinitconst = {
{ .compatible = "regulator-gpio", },
{},
};
#endif
static struct platform_driver gpio_regulator_driver = { static struct platform_driver gpio_regulator_driver = {
.probe = gpio_regulator_probe, .probe = gpio_regulator_probe,
.remove = __devexit_p(gpio_regulator_remove), .remove = gpio_regulator_remove,
.driver = { .driver = {
.name = "gpio-regulator", .name = "gpio-regulator",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.of_match_table = of_match_ptr(regulator_gpio_of_match),
}, },
}; };
......
...@@ -106,7 +106,7 @@ static const struct regulator_desc isl_rd[] = { ...@@ -106,7 +106,7 @@ static const struct regulator_desc isl_rd[] = {
}, },
}; };
static int __devinit isl6271a_probe(struct i2c_client *i2c, static int isl6271a_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct regulator_config config = { }; struct regulator_config config = { };
...@@ -151,7 +151,7 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c, ...@@ -151,7 +151,7 @@ static int __devinit isl6271a_probe(struct i2c_client *i2c,
return err; return err;
} }
static int __devexit isl6271a_remove(struct i2c_client *i2c) static int isl6271a_remove(struct i2c_client *i2c)
{ {
struct isl_pmic *pmic = i2c_get_clientdata(i2c); struct isl_pmic *pmic = i2c_get_clientdata(i2c);
int i; int i;
...@@ -174,7 +174,7 @@ static struct i2c_driver isl6271a_i2c_driver = { ...@@ -174,7 +174,7 @@ static struct i2c_driver isl6271a_i2c_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = isl6271a_probe, .probe = isl6271a_probe,
.remove = __devexit_p(isl6271a_remove), .remove = isl6271a_remove,
.id_table = isl6271a_id, .id_table = isl6271a_id,
}; };
......
...@@ -386,7 +386,7 @@ static int lp3971_set_bits(struct lp3971 *lp3971, u8 reg, u16 mask, u16 val) ...@@ -386,7 +386,7 @@ static int lp3971_set_bits(struct lp3971 *lp3971, u8 reg, u16 mask, u16 val)
return ret; return ret;
} }
static int __devinit setup_regulators(struct lp3971 *lp3971, static int setup_regulators(struct lp3971 *lp3971,
struct lp3971_platform_data *pdata) struct lp3971_platform_data *pdata)
{ {
int i, err; int i, err;
...@@ -429,7 +429,7 @@ static int __devinit setup_regulators(struct lp3971 *lp3971, ...@@ -429,7 +429,7 @@ static int __devinit setup_regulators(struct lp3971 *lp3971,
return err; return err;
} }
static int __devinit lp3971_i2c_probe(struct i2c_client *i2c, static int lp3971_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct lp3971 *lp3971; struct lp3971 *lp3971;
...@@ -472,7 +472,7 @@ static int __devinit lp3971_i2c_probe(struct i2c_client *i2c, ...@@ -472,7 +472,7 @@ static int __devinit lp3971_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
static int __devexit lp3971_i2c_remove(struct i2c_client *i2c) static int lp3971_i2c_remove(struct i2c_client *i2c)
{ {
struct lp3971 *lp3971 = i2c_get_clientdata(i2c); struct lp3971 *lp3971 = i2c_get_clientdata(i2c);
int i; int i;
...@@ -498,7 +498,7 @@ static struct i2c_driver lp3971_i2c_driver = { ...@@ -498,7 +498,7 @@ static struct i2c_driver lp3971_i2c_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = lp3971_i2c_probe, .probe = lp3971_i2c_probe,
.remove = __devexit_p(lp3971_i2c_remove), .remove = lp3971_i2c_remove,
.id_table = lp3971_i2c_id, .id_table = lp3971_i2c_id,
}; };
......
...@@ -481,7 +481,7 @@ static const struct regulator_desc regulators[] = { ...@@ -481,7 +481,7 @@ static const struct regulator_desc regulators[] = {
}, },
}; };
static int __devinit setup_regulators(struct lp3972 *lp3972, static int setup_regulators(struct lp3972 *lp3972,
struct lp3972_platform_data *pdata) struct lp3972_platform_data *pdata)
{ {
int i, err; int i, err;
...@@ -523,7 +523,7 @@ static int __devinit setup_regulators(struct lp3972 *lp3972, ...@@ -523,7 +523,7 @@ static int __devinit setup_regulators(struct lp3972 *lp3972,
return err; return err;
} }
static int __devinit lp3972_i2c_probe(struct i2c_client *i2c, static int lp3972_i2c_probe(struct i2c_client *i2c,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct lp3972 *lp3972; struct lp3972 *lp3972;
...@@ -569,7 +569,7 @@ static int __devinit lp3972_i2c_probe(struct i2c_client *i2c, ...@@ -569,7 +569,7 @@ static int __devinit lp3972_i2c_probe(struct i2c_client *i2c,
return ret; return ret;
} }
static int __devexit lp3972_i2c_remove(struct i2c_client *i2c) static int lp3972_i2c_remove(struct i2c_client *i2c)
{ {
struct lp3972 *lp3972 = i2c_get_clientdata(i2c); struct lp3972 *lp3972 = i2c_get_clientdata(i2c);
int i; int i;
...@@ -594,7 +594,7 @@ static struct i2c_driver lp3972_i2c_driver = { ...@@ -594,7 +594,7 @@ static struct i2c_driver lp3972_i2c_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = lp3972_i2c_probe, .probe = lp3972_i2c_probe,
.remove = __devexit_p(lp3972_i2c_remove), .remove = lp3972_i2c_remove,
.id_table = lp3972_i2c_id, .id_table = lp3972_i2c_id,
}; };
......
...@@ -893,7 +893,7 @@ static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id) ...@@ -893,7 +893,7 @@ static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id)
return ret; return ret;
} }
static int __devexit lp872x_remove(struct i2c_client *cl) static int lp872x_remove(struct i2c_client *cl)
{ {
struct lp872x *lp = i2c_get_clientdata(cl); struct lp872x *lp = i2c_get_clientdata(cl);
...@@ -914,7 +914,7 @@ static struct i2c_driver lp872x_driver = { ...@@ -914,7 +914,7 @@ static struct i2c_driver lp872x_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = lp872x_probe, .probe = lp872x_probe,
.remove = __devexit_p(lp872x_remove), .remove = lp872x_remove,
.id_table = lp872x_ids, .id_table = lp872x_ids,
}; };
......
...@@ -429,18 +429,6 @@ static struct regulator_desc lp8788_buck_desc[] = { ...@@ -429,18 +429,6 @@ static struct regulator_desc lp8788_buck_desc[] = {
}, },
}; };
static int _gpio_request(struct lp8788_buck *buck, int gpio, char *name)
{
struct device *dev = buck->lp->dev;
if (!gpio_is_valid(gpio)) {
dev_err(dev, "invalid gpio: %d\n", gpio);
return -EINVAL;
}
return devm_gpio_request_one(dev, gpio, DVS_LOW, name);
}
static int lp8788_dvs_gpio_request(struct lp8788_buck *buck, static int lp8788_dvs_gpio_request(struct lp8788_buck *buck,
enum lp8788_buck_id id) enum lp8788_buck_id id)
{ {
...@@ -452,7 +440,8 @@ static int lp8788_dvs_gpio_request(struct lp8788_buck *buck, ...@@ -452,7 +440,8 @@ static int lp8788_dvs_gpio_request(struct lp8788_buck *buck,
switch (id) { switch (id) {
case BUCK1: case BUCK1:
gpio = pdata->buck1_dvs->gpio; gpio = pdata->buck1_dvs->gpio;
ret = _gpio_request(buck, gpio, b1_name); ret = devm_gpio_request_one(buck->lp->dev, gpio, DVS_LOW,
b1_name);
if (ret) if (ret)
return ret; return ret;
...@@ -461,7 +450,8 @@ static int lp8788_dvs_gpio_request(struct lp8788_buck *buck, ...@@ -461,7 +450,8 @@ static int lp8788_dvs_gpio_request(struct lp8788_buck *buck,
case BUCK2: case BUCK2:
for (i = 0 ; i < LP8788_NUM_BUCK2_DVS ; i++) { for (i = 0 ; i < LP8788_NUM_BUCK2_DVS ; i++) {
gpio = pdata->buck2_dvs->gpio[i]; gpio = pdata->buck2_dvs->gpio[i];
ret = _gpio_request(buck, gpio, b2_name[i]); ret = devm_gpio_request_one(buck->lp->dev, gpio,
DVS_LOW, b2_name[i]);
if (ret) if (ret)
return ret; return ret;
} }
...@@ -504,7 +494,7 @@ static int lp8788_init_dvs(struct lp8788_buck *buck, enum lp8788_buck_id id) ...@@ -504,7 +494,7 @@ static int lp8788_init_dvs(struct lp8788_buck *buck, enum lp8788_buck_id id)
default_dvs_mode[id]); default_dvs_mode[id]);
} }
static __devinit int lp8788_buck_probe(struct platform_device *pdev) static int lp8788_buck_probe(struct platform_device *pdev)
{ {
struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent);
int id = pdev->id; int id = pdev->id;
...@@ -542,7 +532,7 @@ static __devinit int lp8788_buck_probe(struct platform_device *pdev) ...@@ -542,7 +532,7 @@ static __devinit int lp8788_buck_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit lp8788_buck_remove(struct platform_device *pdev) static int lp8788_buck_remove(struct platform_device *pdev)
{ {
struct lp8788_buck *buck = platform_get_drvdata(pdev); struct lp8788_buck *buck = platform_get_drvdata(pdev);
...@@ -554,7 +544,7 @@ static int __devexit lp8788_buck_remove(struct platform_device *pdev) ...@@ -554,7 +544,7 @@ static int __devexit lp8788_buck_remove(struct platform_device *pdev)
static struct platform_driver lp8788_buck_driver = { static struct platform_driver lp8788_buck_driver = {
.probe = lp8788_buck_probe, .probe = lp8788_buck_probe,
.remove = __devexit_p(lp8788_buck_remove), .remove = lp8788_buck_remove,
.driver = { .driver = {
.name = LP8788_DEV_BUCK, .name = LP8788_DEV_BUCK,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -126,7 +126,7 @@ struct lp8788_ldo { ...@@ -126,7 +126,7 @@ struct lp8788_ldo {
}; };
/* DLDO 1, 2, 3, 9 voltage table */ /* DLDO 1, 2, 3, 9 voltage table */
const int lp8788_dldo1239_vtbl[] = { static const int lp8788_dldo1239_vtbl[] = {
1800000, 1900000, 2000000, 2100000, 2200000, 2300000, 2400000, 2500000, 1800000, 1900000, 2000000, 2100000, 2200000, 2300000, 2400000, 2500000,
2600000, 2700000, 2800000, 2900000, 3000000, 2850000, 2850000, 2850000, 2600000, 2700000, 2800000, 2900000, 3000000, 2850000, 2850000, 2850000,
2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000, 2850000,
...@@ -662,14 +662,6 @@ static int lp8788_config_ldo_enable_mode(struct lp8788_ldo *ldo, ...@@ -662,14 +662,6 @@ static int lp8788_config_ldo_enable_mode(struct lp8788_ldo *ldo,
[EN_DLDO7] = LP8788_EN_SEL_DLDO7_M, [EN_DLDO7] = LP8788_EN_SEL_DLDO7_M,
[EN_DLDO911] = LP8788_EN_SEL_DLDO911_M, [EN_DLDO911] = LP8788_EN_SEL_DLDO911_M,
}; };
u8 val[] = {
[EN_ALDO1] = 0 << 5,
[EN_ALDO234] = 0 << 4,
[EN_ALDO5] = 0 << 3,
[EN_ALDO7] = 0 << 2,
[EN_DLDO7] = 0 << 1,
[EN_DLDO911] = 0 << 0,
};
switch (id) { switch (id) {
case DLDO7: case DLDO7:
...@@ -708,11 +700,10 @@ static int lp8788_config_ldo_enable_mode(struct lp8788_ldo *ldo, ...@@ -708,11 +700,10 @@ static int lp8788_config_ldo_enable_mode(struct lp8788_ldo *ldo,
return ret; return ret;
set_default_ldo_enable_mode: set_default_ldo_enable_mode:
return lp8788_update_bits(lp, LP8788_EN_SEL, en_mask[enable_id], return lp8788_update_bits(lp, LP8788_EN_SEL, en_mask[enable_id], 0);
val[enable_id]);
} }
static __devinit int lp8788_dldo_probe(struct platform_device *pdev) static int lp8788_dldo_probe(struct platform_device *pdev)
{ {
struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent);
int id = pdev->id; int id = pdev->id;
...@@ -749,7 +740,7 @@ static __devinit int lp8788_dldo_probe(struct platform_device *pdev) ...@@ -749,7 +740,7 @@ static __devinit int lp8788_dldo_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit lp8788_dldo_remove(struct platform_device *pdev) static int lp8788_dldo_remove(struct platform_device *pdev)
{ {
struct lp8788_ldo *ldo = platform_get_drvdata(pdev); struct lp8788_ldo *ldo = platform_get_drvdata(pdev);
...@@ -761,14 +752,14 @@ static int __devexit lp8788_dldo_remove(struct platform_device *pdev) ...@@ -761,14 +752,14 @@ static int __devexit lp8788_dldo_remove(struct platform_device *pdev)
static struct platform_driver lp8788_dldo_driver = { static struct platform_driver lp8788_dldo_driver = {
.probe = lp8788_dldo_probe, .probe = lp8788_dldo_probe,
.remove = __devexit_p(lp8788_dldo_remove), .remove = lp8788_dldo_remove,
.driver = { .driver = {
.name = LP8788_DEV_DLDO, .name = LP8788_DEV_DLDO,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
}; };
static __devinit int lp8788_aldo_probe(struct platform_device *pdev) static int lp8788_aldo_probe(struct platform_device *pdev)
{ {
struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent);
int id = pdev->id; int id = pdev->id;
...@@ -805,7 +796,7 @@ static __devinit int lp8788_aldo_probe(struct platform_device *pdev) ...@@ -805,7 +796,7 @@ static __devinit int lp8788_aldo_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit lp8788_aldo_remove(struct platform_device *pdev) static int lp8788_aldo_remove(struct platform_device *pdev)
{ {
struct lp8788_ldo *ldo = platform_get_drvdata(pdev); struct lp8788_ldo *ldo = platform_get_drvdata(pdev);
...@@ -817,7 +808,7 @@ static int __devexit lp8788_aldo_remove(struct platform_device *pdev) ...@@ -817,7 +808,7 @@ static int __devexit lp8788_aldo_remove(struct platform_device *pdev)
static struct platform_driver lp8788_aldo_driver = { static struct platform_driver lp8788_aldo_driver = {
.probe = lp8788_aldo_probe, .probe = lp8788_aldo_probe,
.remove = __devexit_p(lp8788_aldo_remove), .remove = lp8788_aldo_remove,
.driver = { .driver = {
.name = LP8788_DEV_ALDO, .name = LP8788_DEV_ALDO,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -44,6 +44,9 @@ struct max1586_data { ...@@ -44,6 +44,9 @@ struct max1586_data {
unsigned int min_uV; unsigned int min_uV;
unsigned int max_uV; unsigned int max_uV;
unsigned int v3_curr_sel;
unsigned int v6_curr_sel;
struct regulator_dev *rdev[0]; struct regulator_dev *rdev[0];
}; };
...@@ -63,31 +66,60 @@ static int v6_voltages_uv[] = { 1, 1800000, 2500000, 3000000 }; ...@@ -63,31 +66,60 @@ static int v6_voltages_uv[] = { 1, 1800000, 2500000, 3000000 };
* R24 and R25=100kOhm as described in the data sheet. * R24 and R25=100kOhm as described in the data sheet.
* The gain is approximately: 1 + R24/R25 + R24/185.5kOhm * The gain is approximately: 1 + R24/R25 + R24/185.5kOhm
*/ */
static int max1586_v3_get_voltage_sel(struct regulator_dev *rdev)
{
struct max1586_data *max1586 = rdev_get_drvdata(rdev);
return max1586->v3_curr_sel;
}
static int max1586_v3_set_voltage_sel(struct regulator_dev *rdev, static int max1586_v3_set_voltage_sel(struct regulator_dev *rdev,
unsigned selector) unsigned selector)
{ {
struct max1586_data *max1586 = rdev_get_drvdata(rdev); struct max1586_data *max1586 = rdev_get_drvdata(rdev);
struct i2c_client *client = max1586->client; struct i2c_client *client = max1586->client;
int ret;
u8 v3_prog; u8 v3_prog;
dev_dbg(&client->dev, "changing voltage v3 to %dmv\n", dev_dbg(&client->dev, "changing voltage v3 to %dmv\n",
regulator_list_voltage_linear(rdev, selector) / 1000); regulator_list_voltage_linear(rdev, selector) / 1000);
v3_prog = I2C_V3_SELECT | (u8) selector; v3_prog = I2C_V3_SELECT | (u8) selector;
return i2c_smbus_write_byte(client, v3_prog); ret = i2c_smbus_write_byte(client, v3_prog);
if (ret)
return ret;
max1586->v3_curr_sel = selector;
return 0;
}
static int max1586_v6_get_voltage_sel(struct regulator_dev *rdev)
{
struct max1586_data *max1586 = rdev_get_drvdata(rdev);
return max1586->v6_curr_sel;
} }
static int max1586_v6_set_voltage_sel(struct regulator_dev *rdev, static int max1586_v6_set_voltage_sel(struct regulator_dev *rdev,
unsigned int selector) unsigned int selector)
{ {
struct i2c_client *client = rdev_get_drvdata(rdev); struct max1586_data *max1586 = rdev_get_drvdata(rdev);
struct i2c_client *client = max1586->client;
u8 v6_prog; u8 v6_prog;
int ret;
dev_dbg(&client->dev, "changing voltage v6 to %dmv\n", dev_dbg(&client->dev, "changing voltage v6 to %dmv\n",
rdev->desc->volt_table[selector] / 1000); rdev->desc->volt_table[selector] / 1000);
v6_prog = I2C_V6_SELECT | (u8) selector; v6_prog = I2C_V6_SELECT | (u8) selector;
return i2c_smbus_write_byte(client, v6_prog); ret = i2c_smbus_write_byte(client, v6_prog);
if (ret)
return ret;
max1586->v6_curr_sel = selector;
return 0;
} }
/* /*
...@@ -95,12 +127,14 @@ static int max1586_v6_set_voltage_sel(struct regulator_dev *rdev, ...@@ -95,12 +127,14 @@ static int max1586_v6_set_voltage_sel(struct regulator_dev *rdev,
* the set up value. * the set up value.
*/ */
static struct regulator_ops max1586_v3_ops = { static struct regulator_ops max1586_v3_ops = {
.get_voltage_sel = max1586_v3_get_voltage_sel,
.set_voltage_sel = max1586_v3_set_voltage_sel, .set_voltage_sel = max1586_v3_set_voltage_sel,
.list_voltage = regulator_list_voltage_linear, .list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear, .map_voltage = regulator_map_voltage_linear,
}; };
static struct regulator_ops max1586_v6_ops = { static struct regulator_ops max1586_v6_ops = {
.get_voltage_sel = max1586_v6_get_voltage_sel,
.set_voltage_sel = max1586_v6_set_voltage_sel, .set_voltage_sel = max1586_v6_set_voltage_sel,
.list_voltage = regulator_list_voltage_table, .list_voltage = regulator_list_voltage_table,
}; };
...@@ -125,7 +159,7 @@ static struct regulator_desc max1586_reg[] = { ...@@ -125,7 +159,7 @@ static struct regulator_desc max1586_reg[] = {
}, },
}; };
static int __devinit max1586_pmic_probe(struct i2c_client *client, static int max1586_pmic_probe(struct i2c_client *client,
const struct i2c_device_id *i2c_id) const struct i2c_device_id *i2c_id)
{ {
struct regulator_dev **rdev; struct regulator_dev **rdev;
...@@ -148,6 +182,10 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client, ...@@ -148,6 +182,10 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
max1586->min_uV = MAX1586_V3_MIN_UV / 1000 * pdata->v3_gain / 1000; max1586->min_uV = MAX1586_V3_MIN_UV / 1000 * pdata->v3_gain / 1000;
max1586->max_uV = MAX1586_V3_MAX_UV / 1000 * pdata->v3_gain / 1000; max1586->max_uV = MAX1586_V3_MAX_UV / 1000 * pdata->v3_gain / 1000;
/* Set curr_sel to default voltage on power-up */
max1586->v3_curr_sel = 24; /* 1.3V */
max1586->v6_curr_sel = 0;
rdev = max1586->rdev; rdev = max1586->rdev;
for (i = 0; i < pdata->num_subdevs && i <= MAX1586_V6; i++) { for (i = 0; i < pdata->num_subdevs && i <= MAX1586_V6; i++) {
id = pdata->subdevs[i].id; id = pdata->subdevs[i].id;
...@@ -188,7 +226,7 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client, ...@@ -188,7 +226,7 @@ static int __devinit max1586_pmic_probe(struct i2c_client *client,
return ret; return ret;
} }
static int __devexit max1586_pmic_remove(struct i2c_client *client) static int max1586_pmic_remove(struct i2c_client *client)
{ {
struct max1586_data *max1586 = i2c_get_clientdata(client); struct max1586_data *max1586 = i2c_get_clientdata(client);
int i; int i;
...@@ -207,7 +245,7 @@ MODULE_DEVICE_TABLE(i2c, max1586_id); ...@@ -207,7 +245,7 @@ MODULE_DEVICE_TABLE(i2c, max1586_id);
static struct i2c_driver max1586_pmic_driver = { static struct i2c_driver max1586_pmic_driver = {
.probe = max1586_pmic_probe, .probe = max1586_pmic_probe,
.remove = __devexit_p(max1586_pmic_remove), .remove = max1586_pmic_remove,
.driver = { .driver = {
.name = "max1586", .name = "max1586",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -67,8 +67,94 @@ enum max77686_ramp_rate { ...@@ -67,8 +67,94 @@ enum max77686_ramp_rate {
struct max77686_data { struct max77686_data {
struct regulator_dev *rdev[MAX77686_REGULATORS]; struct regulator_dev *rdev[MAX77686_REGULATORS];
unsigned int opmode[MAX77686_REGULATORS];
}; };
/* Some BUCKS supports Normal[ON/OFF] mode during suspend */
static int max77686_buck_set_suspend_disable(struct regulator_dev *rdev)
{
unsigned int val;
struct max77686_data *max77686 = rdev_get_drvdata(rdev);
if (rdev->desc->id == MAX77686_BUCK1)
val = 0x1;
else
val = 0x1 << MAX77686_OPMODE_BUCK234_SHIFT;
max77686->opmode[rdev->desc->id] = val;
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask,
val);
}
/* Some LDOs supports [LPM/Normal]ON mode during suspend state */
static int max77686_set_suspend_mode(struct regulator_dev *rdev,
unsigned int mode)
{
struct max77686_data *max77686 = rdev_get_drvdata(rdev);
unsigned int val;
/* BUCK[5-9] doesn't support this feature */
if (rdev->desc->id >= MAX77686_BUCK5)
return 0;
switch (mode) {
case REGULATOR_MODE_IDLE: /* ON in LP Mode */
val = 0x2 << MAX77686_OPMODE_SHIFT;
break;
case REGULATOR_MODE_NORMAL: /* ON in Normal Mode */
val = 0x3 << MAX77686_OPMODE_SHIFT;
break;
default:
pr_warn("%s: regulator_suspend_mode : 0x%x not supported\n",
rdev->desc->name, mode);
return -EINVAL;
}
max77686->opmode[rdev->desc->id] = val;
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask,
val);
}
/* Some LDOs supports LPM-ON/OFF/Normal-ON mode during suspend state */
static int max77686_ldo_set_suspend_mode(struct regulator_dev *rdev,
unsigned int mode)
{
unsigned int val;
struct max77686_data *max77686 = rdev_get_drvdata(rdev);
switch (mode) {
case REGULATOR_MODE_STANDBY: /* switch off */
val = 0x1 << MAX77686_OPMODE_SHIFT;
break;
case REGULATOR_MODE_IDLE: /* ON in LP Mode */
val = 0x2 << MAX77686_OPMODE_SHIFT;
break;
case REGULATOR_MODE_NORMAL: /* ON in Normal Mode */
val = 0x3 << MAX77686_OPMODE_SHIFT;
break;
default:
pr_warn("%s: regulator_suspend_mode : 0x%x not supported\n",
rdev->desc->name, mode);
return -EINVAL;
}
max77686->opmode[rdev->desc->id] = val;
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask,
val);
}
static int max77686_enable(struct regulator_dev *rdev)
{
struct max77686_data *max77686 = rdev_get_drvdata(rdev);
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask,
max77686->opmode[rdev->desc->id]);
}
static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) static int max77686_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay)
{ {
unsigned int ramp_value = RAMP_RATE_NO_CTRL; unsigned int ramp_value = RAMP_RATE_NO_CTRL;
...@@ -98,23 +184,49 @@ static struct regulator_ops max77686_ops = { ...@@ -98,23 +184,49 @@ static struct regulator_ops max77686_ops = {
.list_voltage = regulator_list_voltage_linear, .list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear, .map_voltage = regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap, .is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap, .enable = max77686_enable,
.disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_suspend_mode = max77686_set_suspend_mode,
};
static struct regulator_ops max77686_ldo_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
.enable = max77686_enable,
.disable = regulator_disable_regmap, .disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel, .set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_suspend_mode = max77686_ldo_set_suspend_mode,
};
static struct regulator_ops max77686_buck1_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap,
.enable = max77686_enable,
.disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_suspend_disable = max77686_buck_set_suspend_disable,
}; };
static struct regulator_ops max77686_buck_dvs_ops = { static struct regulator_ops max77686_buck_dvs_ops = {
.list_voltage = regulator_list_voltage_linear, .list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear, .map_voltage = regulator_map_voltage_linear,
.is_enabled = regulator_is_enabled_regmap, .is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap, .enable = max77686_enable,
.disable = regulator_disable_regmap, .disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = regulator_set_voltage_time_sel, .set_voltage_time_sel = regulator_set_voltage_time_sel,
.set_ramp_delay = max77686_set_ramp_delay, .set_ramp_delay = max77686_set_ramp_delay,
.set_suspend_disable = max77686_buck_set_suspend_disable,
}; };
#define regulator_desc_ldo(num) { \ #define regulator_desc_ldo(num) { \
...@@ -133,7 +245,39 @@ static struct regulator_ops max77686_buck_dvs_ops = { ...@@ -133,7 +245,39 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.enable_mask = MAX77686_OPMODE_MASK \ .enable_mask = MAX77686_OPMODE_MASK \
<< MAX77686_OPMODE_SHIFT, \ << MAX77686_OPMODE_SHIFT, \
} }
#define regulator_desc_lpm_ldo(num) { \
.name = "LDO"#num, \
.id = MAX77686_LDO##num, \
.ops = &max77686_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = MAX77686_LDO_MINUV, \
.uV_step = MAX77686_LDO_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \
.n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.vsel_mask = MAX77686_VSEL_MASK, \
.enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.enable_mask = MAX77686_OPMODE_MASK \
<< MAX77686_OPMODE_SHIFT, \
}
#define regulator_desc_ldo_low(num) { \ #define regulator_desc_ldo_low(num) { \
.name = "LDO"#num, \
.id = MAX77686_LDO##num, \
.ops = &max77686_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.min_uV = MAX77686_LDO_LOW_MINUV, \
.uV_step = MAX77686_LDO_LOW_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \
.n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.vsel_mask = MAX77686_VSEL_MASK, \
.enable_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.enable_mask = MAX77686_OPMODE_MASK \
<< MAX77686_OPMODE_SHIFT, \
}
#define regulator_desc_ldo1_low(num) { \
.name = "LDO"#num, \ .name = "LDO"#num, \
.id = MAX77686_LDO##num, \ .id = MAX77686_LDO##num, \
.ops = &max77686_ops, \ .ops = &max77686_ops, \
...@@ -167,7 +311,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { ...@@ -167,7 +311,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
#define regulator_desc_buck1(num) { \ #define regulator_desc_buck1(num) { \
.name = "BUCK"#num, \ .name = "BUCK"#num, \
.id = MAX77686_BUCK##num, \ .id = MAX77686_BUCK##num, \
.ops = &max77686_ops, \ .ops = &max77686_buck1_ops, \
.type = REGULATOR_VOLTAGE, \ .type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \ .owner = THIS_MODULE, \
.min_uV = MAX77686_BUCK_MINUV, \ .min_uV = MAX77686_BUCK_MINUV, \
...@@ -197,7 +341,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { ...@@ -197,7 +341,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
} }
static struct regulator_desc regulators[] = { static struct regulator_desc regulators[] = {
regulator_desc_ldo_low(1), regulator_desc_ldo1_low(1),
regulator_desc_ldo_low(2), regulator_desc_ldo_low(2),
regulator_desc_ldo(3), regulator_desc_ldo(3),
regulator_desc_ldo(4), regulator_desc_ldo(4),
...@@ -206,13 +350,13 @@ static struct regulator_desc regulators[] = { ...@@ -206,13 +350,13 @@ static struct regulator_desc regulators[] = {
regulator_desc_ldo_low(7), regulator_desc_ldo_low(7),
regulator_desc_ldo_low(8), regulator_desc_ldo_low(8),
regulator_desc_ldo(9), regulator_desc_ldo(9),
regulator_desc_ldo(10), regulator_desc_lpm_ldo(10),
regulator_desc_ldo(11), regulator_desc_lpm_ldo(11),
regulator_desc_ldo(12), regulator_desc_lpm_ldo(12),
regulator_desc_ldo(13), regulator_desc_ldo(13),
regulator_desc_ldo(14), regulator_desc_lpm_ldo(14),
regulator_desc_ldo_low(15), regulator_desc_ldo_low(15),
regulator_desc_ldo(16), regulator_desc_lpm_ldo(16),
regulator_desc_ldo(17), regulator_desc_ldo(17),
regulator_desc_ldo(18), regulator_desc_ldo(18),
regulator_desc_ldo(19), regulator_desc_ldo(19),
...@@ -280,7 +424,7 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev, ...@@ -280,7 +424,7 @@ static int max77686_pmic_dt_parse_pdata(struct max77686_dev *iodev,
} }
#endif /* CONFIG_OF */ #endif /* CONFIG_OF */
static __devinit int max77686_pmic_probe(struct platform_device *pdev) static int max77686_pmic_probe(struct platform_device *pdev)
{ {
struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct max77686_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct max77686_platform_data *pdata = dev_get_platdata(iodev->dev); struct max77686_platform_data *pdata = dev_get_platdata(iodev->dev);
...@@ -314,12 +458,14 @@ static __devinit int max77686_pmic_probe(struct platform_device *pdev) ...@@ -314,12 +458,14 @@ static __devinit int max77686_pmic_probe(struct platform_device *pdev)
config.dev = &pdev->dev; config.dev = &pdev->dev;
config.regmap = iodev->regmap; config.regmap = iodev->regmap;
config.driver_data = max77686;
platform_set_drvdata(pdev, max77686); platform_set_drvdata(pdev, max77686);
for (i = 0; i < MAX77686_REGULATORS; i++) { for (i = 0; i < MAX77686_REGULATORS; i++) {
config.init_data = pdata->regulators[i].initdata; config.init_data = pdata->regulators[i].initdata;
config.of_node = pdata->regulators[i].of_node; config.of_node = pdata->regulators[i].of_node;
max77686->opmode[i] = regulators[i].enable_mask;
max77686->rdev[i] = regulator_register(&regulators[i], &config); max77686->rdev[i] = regulator_register(&regulators[i], &config);
if (IS_ERR(max77686->rdev[i])) { if (IS_ERR(max77686->rdev[i])) {
ret = PTR_ERR(max77686->rdev[i]); ret = PTR_ERR(max77686->rdev[i]);
...@@ -337,7 +483,7 @@ static __devinit int max77686_pmic_probe(struct platform_device *pdev) ...@@ -337,7 +483,7 @@ static __devinit int max77686_pmic_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit max77686_pmic_remove(struct platform_device *pdev) static int max77686_pmic_remove(struct platform_device *pdev)
{ {
struct max77686_data *max77686 = platform_get_drvdata(pdev); struct max77686_data *max77686 = platform_get_drvdata(pdev);
int i; int i;
...@@ -360,7 +506,7 @@ static struct platform_driver max77686_pmic_driver = { ...@@ -360,7 +506,7 @@ static struct platform_driver max77686_pmic_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = max77686_pmic_probe, .probe = max77686_pmic_probe,
.remove = __devexit_p(max77686_pmic_remove), .remove = max77686_pmic_remove,
.id_table = max77686_pmic_id, .id_table = max77686_pmic_id,
}; };
......
...@@ -176,7 +176,7 @@ static struct regmap_config max8649_regmap_config = { ...@@ -176,7 +176,7 @@ static struct regmap_config max8649_regmap_config = {
.val_bits = 8, .val_bits = 8,
}; };
static int __devinit max8649_regulator_probe(struct i2c_client *client, static int max8649_regulator_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct max8649_platform_data *pdata = client->dev.platform_data; struct max8649_platform_data *pdata = client->dev.platform_data;
...@@ -271,7 +271,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client, ...@@ -271,7 +271,7 @@ static int __devinit max8649_regulator_probe(struct i2c_client *client,
return 0; return 0;
} }
static int __devexit max8649_regulator_remove(struct i2c_client *client) static int max8649_regulator_remove(struct i2c_client *client)
{ {
struct max8649_regulator_info *info = i2c_get_clientdata(client); struct max8649_regulator_info *info = i2c_get_clientdata(client);
...@@ -291,7 +291,7 @@ MODULE_DEVICE_TABLE(i2c, max8649_id); ...@@ -291,7 +291,7 @@ MODULE_DEVICE_TABLE(i2c, max8649_id);
static struct i2c_driver max8649_driver = { static struct i2c_driver max8649_driver = {
.probe = max8649_regulator_probe, .probe = max8649_regulator_probe,
.remove = __devexit_p(max8649_regulator_remove), .remove = max8649_regulator_remove,
.driver = { .driver = {
.name = "max8649", .name = "max8649",
}, },
......
...@@ -305,7 +305,7 @@ static const struct regulator_desc max8660_reg[] = { ...@@ -305,7 +305,7 @@ static const struct regulator_desc max8660_reg[] = {
}, },
}; };
static int __devinit max8660_probe(struct i2c_client *client, static int max8660_probe(struct i2c_client *client,
const struct i2c_device_id *i2c_id) const struct i2c_device_id *i2c_id)
{ {
struct regulator_dev **rdev; struct regulator_dev **rdev;
...@@ -420,7 +420,7 @@ static int __devinit max8660_probe(struct i2c_client *client, ...@@ -420,7 +420,7 @@ static int __devinit max8660_probe(struct i2c_client *client,
return ret; return ret;
} }
static int __devexit max8660_remove(struct i2c_client *client) static int max8660_remove(struct i2c_client *client)
{ {
struct max8660 *max8660 = i2c_get_clientdata(client); struct max8660 *max8660 = i2c_get_clientdata(client);
int i; int i;
...@@ -440,7 +440,7 @@ MODULE_DEVICE_TABLE(i2c, max8660_id); ...@@ -440,7 +440,7 @@ MODULE_DEVICE_TABLE(i2c, max8660_id);
static struct i2c_driver max8660_driver = { static struct i2c_driver max8660_driver = {
.probe = max8660_probe, .probe = max8660_probe,
.remove = __devexit_p(max8660_remove), .remove = max8660_remove,
.driver = { .driver = {
.name = "max8660", .name = "max8660",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
...@@ -275,7 +275,7 @@ static inline struct device_node *match_of_node(int index) ...@@ -275,7 +275,7 @@ static inline struct device_node *match_of_node(int index)
} }
#endif #endif
static __devinit int max8907_regulator_probe(struct platform_device *pdev) static int max8907_regulator_probe(struct platform_device *pdev)
{ {
struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent); struct max8907 *max8907 = dev_get_drvdata(pdev->dev.parent);
struct max8907_platform_data *pdata = dev_get_platdata(max8907->dev); struct max8907_platform_data *pdata = dev_get_platdata(max8907->dev);
...@@ -368,7 +368,7 @@ static __devinit int max8907_regulator_probe(struct platform_device *pdev) ...@@ -368,7 +368,7 @@ static __devinit int max8907_regulator_probe(struct platform_device *pdev)
return ret; return ret;
} }
static __devexit int max8907_regulator_remove(struct platform_device *pdev) static int max8907_regulator_remove(struct platform_device *pdev)
{ {
struct max8907_regulator *pmic = platform_get_drvdata(pdev); struct max8907_regulator *pmic = platform_get_drvdata(pdev);
int i; int i;
...@@ -385,7 +385,7 @@ static struct platform_driver max8907_regulator_driver = { ...@@ -385,7 +385,7 @@ static struct platform_driver max8907_regulator_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = max8907_regulator_probe, .probe = max8907_regulator_probe,
.remove = __devexit_p(max8907_regulator_remove), .remove = max8907_regulator_remove,
}; };
static int __init max8907_regulator_init(void) static int __init max8907_regulator_init(void)
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <linux/regulator/driver.h> #include <linux/regulator/driver.h>
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/mfd/max8925.h> #include <linux/mfd/max8925.h>
#include <linux/of.h>
#include <linux/regulator/of_regulator.h>
#define SD1_DVM_VMIN 850000 #define SD1_DVM_VMIN 850000
#define SD1_DVM_VMAX 1000000 #define SD1_DVM_VMAX 1000000
...@@ -187,6 +189,34 @@ static struct regulator_ops max8925_regulator_ldo_ops = { ...@@ -187,6 +189,34 @@ static struct regulator_ops max8925_regulator_ldo_ops = {
.enable_reg = MAX8925_LDOCTL##_id, \ .enable_reg = MAX8925_LDOCTL##_id, \
} }
#ifdef CONFIG_OF
static struct of_regulator_match max8925_regulator_matches[] = {
{ .name = "SDV1",},
{ .name = "SDV2",},
{ .name = "SDV3",},
{ .name = "LDO1",},
{ .name = "LDO2",},
{ .name = "LDO3",},
{ .name = "LDO4",},
{ .name = "LDO5",},
{ .name = "LDO6",},
{ .name = "LDO7",},
{ .name = "LDO8",},
{ .name = "LDO9",},
{ .name = "LDO10",},
{ .name = "LDO11",},
{ .name = "LDO12",},
{ .name = "LDO13",},
{ .name = "LDO14",},
{ .name = "LDO15",},
{ .name = "LDO16",},
{ .name = "LDO17",},
{ .name = "LDO18",},
{ .name = "LDO19",},
{ .name = "LDO20",},
};
#endif
static struct max8925_regulator_info max8925_regulator_info[] = { static struct max8925_regulator_info max8925_regulator_info[] = {
MAX8925_SDV(1, 637.5, 1425, 12.5), MAX8925_SDV(1, 637.5, 1425, 12.5),
MAX8925_SDV(2, 650, 2225, 25), MAX8925_SDV(2, 650, 2225, 25),
...@@ -214,7 +244,37 @@ static struct max8925_regulator_info max8925_regulator_info[] = { ...@@ -214,7 +244,37 @@ static struct max8925_regulator_info max8925_regulator_info[] = {
MAX8925_LDO(20, 750, 3900, 50), MAX8925_LDO(20, 750, 3900, 50),
}; };
static int __devinit max8925_regulator_probe(struct platform_device *pdev) #ifdef CONFIG_OF
static int max8925_regulator_dt_init(struct platform_device *pdev,
struct max8925_regulator_info *info,
struct regulator_config *config,
int ridx)
{
struct device_node *nproot, *np;
int rcount;
nproot = pdev->dev.parent->of_node;
if (!nproot)
return -ENODEV;
np = of_find_node_by_name(nproot, "regulators");
if (!np) {
dev_err(&pdev->dev, "failed to find regulators node\n");
return -ENODEV;
}
rcount = of_regulator_match(&pdev->dev, np,
&max8925_regulator_matches[ridx], 1);
if (rcount < 0)
return -ENODEV;
config->init_data = max8925_regulator_matches[ridx].init_data;
config->of_node = max8925_regulator_matches[ridx].of_node;
return 0;
}
#else
#define max8925_regulator_dt_init(w, x, y, z) (-1)
#endif
static int max8925_regulator_probe(struct platform_device *pdev)
{ {
struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent); struct max8925_chip *chip = dev_get_drvdata(pdev->dev.parent);
struct regulator_init_data *pdata = pdev->dev.platform_data; struct regulator_init_data *pdata = pdev->dev.platform_data;
...@@ -222,7 +282,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) ...@@ -222,7 +282,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev)
struct max8925_regulator_info *ri; struct max8925_regulator_info *ri;
struct resource *res; struct resource *res;
struct regulator_dev *rdev; struct regulator_dev *rdev;
int i; int i, regulator_idx;
res = platform_get_resource(pdev, IORESOURCE_REG, 0); res = platform_get_resource(pdev, IORESOURCE_REG, 0);
if (!res) { if (!res) {
...@@ -231,9 +291,12 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) ...@@ -231,9 +291,12 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev)
} }
for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) { for (i = 0; i < ARRAY_SIZE(max8925_regulator_info); i++) {
ri = &max8925_regulator_info[i]; ri = &max8925_regulator_info[i];
if (ri->vol_reg == res->start) if (ri->vol_reg == res->start) {
regulator_idx = i;
break; break;
}
} }
if (i == ARRAY_SIZE(max8925_regulator_info)) { if (i == ARRAY_SIZE(max8925_regulator_info)) {
dev_err(&pdev->dev, "Failed to find regulator %llu\n", dev_err(&pdev->dev, "Failed to find regulator %llu\n",
(unsigned long long)res->start); (unsigned long long)res->start);
...@@ -243,9 +306,12 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) ...@@ -243,9 +306,12 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev)
ri->chip = chip; ri->chip = chip;
config.dev = &pdev->dev; config.dev = &pdev->dev;
config.init_data = pdata;
config.driver_data = ri; config.driver_data = ri;
if (max8925_regulator_dt_init(pdev, ri, &config, regulator_idx))
if (pdata)
config.init_data = pdata;
rdev = regulator_register(&ri->desc, &config); rdev = regulator_register(&ri->desc, &config);
if (IS_ERR(rdev)) { if (IS_ERR(rdev)) {
dev_err(&pdev->dev, "failed to register regulator %s\n", dev_err(&pdev->dev, "failed to register regulator %s\n",
...@@ -257,7 +323,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev) ...@@ -257,7 +323,7 @@ static int __devinit max8925_regulator_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit max8925_regulator_remove(struct platform_device *pdev) static int max8925_regulator_remove(struct platform_device *pdev)
{ {
struct regulator_dev *rdev = platform_get_drvdata(pdev); struct regulator_dev *rdev = platform_get_drvdata(pdev);
...@@ -273,7 +339,7 @@ static struct platform_driver max8925_regulator_driver = { ...@@ -273,7 +339,7 @@ static struct platform_driver max8925_regulator_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = max8925_regulator_probe, .probe = max8925_regulator_probe,
.remove = __devexit_p(max8925_regulator_remove), .remove = max8925_regulator_remove,
}; };
static int __init max8925_regulator_init(void) static int __init max8925_regulator_init(void)
......
...@@ -126,7 +126,7 @@ static const struct regulator_desc regulator = { ...@@ -126,7 +126,7 @@ static const struct regulator_desc regulator = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
static int __devinit max8952_pmic_probe(struct i2c_client *client, static int max8952_pmic_probe(struct i2c_client *client,
const struct i2c_device_id *i2c_id) const struct i2c_device_id *i2c_id)
{ {
struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent); struct i2c_adapter *adapter = to_i2c_adapter(client->dev.parent);
...@@ -247,7 +247,7 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client, ...@@ -247,7 +247,7 @@ static int __devinit max8952_pmic_probe(struct i2c_client *client,
return 0; return 0;
} }
static int __devexit max8952_pmic_remove(struct i2c_client *client) static int max8952_pmic_remove(struct i2c_client *client)
{ {
struct max8952_data *max8952 = i2c_get_clientdata(client); struct max8952_data *max8952 = i2c_get_clientdata(client);
struct max8952_platform_data *pdata = max8952->pdata; struct max8952_platform_data *pdata = max8952->pdata;
...@@ -268,7 +268,7 @@ MODULE_DEVICE_TABLE(i2c, max8952_ids); ...@@ -268,7 +268,7 @@ MODULE_DEVICE_TABLE(i2c, max8952_ids);
static struct i2c_driver max8952_pmic_driver = { static struct i2c_driver max8952_pmic_driver = {
.probe = max8952_pmic_probe, .probe = max8952_pmic_probe,
.remove = __devexit_p(max8952_pmic_remove), .remove = max8952_pmic_remove,
.driver = { .driver = {
.name = "max8952", .name = "max8952",
}, },
......
This diff is collapsed.
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/bug.h> #include <linux/bug.h>
#include <linux/err.h> #include <linux/err.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <linux/of_gpio.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -31,6 +32,7 @@ ...@@ -31,6 +32,7 @@
#include <linux/regulator/machine.h> #include <linux/regulator/machine.h>
#include <linux/mfd/max8997.h> #include <linux/mfd/max8997.h>
#include <linux/mfd/max8997-private.h> #include <linux/mfd/max8997-private.h>
#include <linux/regulator/of_regulator.h>
struct max8997_data { struct max8997_data {
struct device *dev; struct device *dev;
...@@ -933,22 +935,163 @@ static struct regulator_desc regulators[] = { ...@@ -933,22 +935,163 @@ static struct regulator_desc regulators[] = {
max8997_charger_fixedstate_ops), max8997_charger_fixedstate_ops),
}; };
static __devinit int max8997_pmic_probe(struct platform_device *pdev) #ifdef CONFIG_OF
static int max8997_pmic_dt_parse_dvs_gpio(struct max8997_dev *iodev,
struct max8997_platform_data *pdata,
struct device_node *pmic_np)
{
int i, gpio;
for (i = 0; i < 3; i++) {
gpio = of_get_named_gpio(pmic_np,
"max8997,pmic-buck125-dvs-gpios", i);
if (!gpio_is_valid(gpio)) {
dev_err(iodev->dev, "invalid gpio[%d]: %d\n", i, gpio);
return -EINVAL;
}
pdata->buck125_gpios[i] = gpio;
}
return 0;
}
static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev,
struct max8997_platform_data *pdata)
{
struct device_node *pmic_np, *regulators_np, *reg_np;
struct max8997_regulator_data *rdata;
unsigned int i, dvs_voltage_nr = 1, ret;
pmic_np = iodev->dev->of_node;
if (!pmic_np) {
dev_err(iodev->dev, "could not find pmic sub-node\n");
return -ENODEV;
}
regulators_np = of_find_node_by_name(pmic_np, "regulators");
if (!regulators_np) {
dev_err(iodev->dev, "could not find regulators sub-node\n");
return -EINVAL;
}
/* count the number of regulators to be supported in pmic */
pdata->num_regulators = 0;
for_each_child_of_node(regulators_np, reg_np)
pdata->num_regulators++;
rdata = devm_kzalloc(iodev->dev, sizeof(*rdata) *
pdata->num_regulators, GFP_KERNEL);
if (!rdata) {
dev_err(iodev->dev, "could not allocate memory for "
"regulator data\n");
return -ENOMEM;
}
pdata->regulators = rdata;
for_each_child_of_node(regulators_np, reg_np) {
for (i = 0; i < ARRAY_SIZE(regulators); i++)
if (!of_node_cmp(reg_np->name, regulators[i].name))
break;
if (i == ARRAY_SIZE(regulators)) {
dev_warn(iodev->dev, "don't know how to configure "
"regulator %s\n", reg_np->name);
continue;
}
rdata->id = i;
rdata->initdata = of_get_regulator_init_data(
iodev->dev, reg_np);
rdata->reg_node = reg_np;
rdata++;
}
if (of_get_property(pmic_np, "max8997,pmic-buck1-uses-gpio-dvs", NULL))
pdata->buck1_gpiodvs = true;
if (of_get_property(pmic_np, "max8997,pmic-buck2-uses-gpio-dvs", NULL))
pdata->buck2_gpiodvs = true;
if (of_get_property(pmic_np, "max8997,pmic-buck5-uses-gpio-dvs", NULL))
pdata->buck5_gpiodvs = true;
if (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs ||
pdata->buck5_gpiodvs) {
ret = max8997_pmic_dt_parse_dvs_gpio(iodev, pdata, pmic_np);
if (ret)
return -EINVAL;
if (of_property_read_u32(pmic_np,
"max8997,pmic-buck125-default-dvs-idx",
&pdata->buck125_default_idx)) {
pdata->buck125_default_idx = 0;
} else {
if (pdata->buck125_default_idx >= 8) {
pdata->buck125_default_idx = 0;
dev_info(iodev->dev, "invalid value for "
"default dvs index, using 0 instead\n");
}
}
if (of_get_property(pmic_np,
"max8997,pmic-ignore-gpiodvs-side-effect", NULL))
pdata->ignore_gpiodvs_side_effect = true;
dvs_voltage_nr = 8;
}
if (of_property_read_u32_array(pmic_np,
"max8997,pmic-buck1-dvs-voltage",
pdata->buck1_voltage, dvs_voltage_nr)) {
dev_err(iodev->dev, "buck1 voltages not specified\n");
return -EINVAL;
}
if (of_property_read_u32_array(pmic_np,
"max8997,pmic-buck2-dvs-voltage",
pdata->buck2_voltage, dvs_voltage_nr)) {
dev_err(iodev->dev, "buck2 voltages not specified\n");
return -EINVAL;
}
if (of_property_read_u32_array(pmic_np,
"max8997,pmic-buck5-dvs-voltage",
pdata->buck5_voltage, dvs_voltage_nr)) {
dev_err(iodev->dev, "buck5 voltages not specified\n");
return -EINVAL;
}
return 0;
}
#else
static int max8997_pmic_dt_parse_pdata(struct max8997_dev *iodev,
struct max8997_platform_data *pdata)
{
return 0;
}
#endif /* CONFIG_OF */
static int max8997_pmic_probe(struct platform_device *pdev)
{ {
struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct max8997_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct max8997_platform_data *pdata = dev_get_platdata(iodev->dev); struct max8997_platform_data *pdata = iodev->pdata;
struct regulator_config config = { }; struct regulator_config config = { };
struct regulator_dev **rdev; struct regulator_dev **rdev;
struct max8997_data *max8997; struct max8997_data *max8997;
struct i2c_client *i2c; struct i2c_client *i2c;
int i, ret, size; int i, ret, size, nr_dvs;
u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0; u8 max_buck1 = 0, max_buck2 = 0, max_buck5 = 0;
if (!pdata) { if (IS_ERR_OR_NULL(pdata)) {
dev_err(pdev->dev.parent, "No platform init data supplied.\n"); dev_err(pdev->dev.parent, "No platform init data supplied.\n");
return -ENODEV; return -ENODEV;
} }
if (iodev->dev->of_node) {
ret = max8997_pmic_dt_parse_pdata(iodev, pdata);
if (ret)
return ret;
}
max8997 = devm_kzalloc(&pdev->dev, sizeof(struct max8997_data), max8997 = devm_kzalloc(&pdev->dev, sizeof(struct max8997_data),
GFP_KERNEL); GFP_KERNEL);
if (!max8997) if (!max8997)
...@@ -973,7 +1116,10 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) ...@@ -973,7 +1116,10 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
memcpy(max8997->buck125_gpios, pdata->buck125_gpios, sizeof(int) * 3); memcpy(max8997->buck125_gpios, pdata->buck125_gpios, sizeof(int) * 3);
max8997->ignore_gpiodvs_side_effect = pdata->ignore_gpiodvs_side_effect; max8997->ignore_gpiodvs_side_effect = pdata->ignore_gpiodvs_side_effect;
for (i = 0; i < 8; i++) { nr_dvs = (pdata->buck1_gpiodvs || pdata->buck2_gpiodvs ||
pdata->buck5_gpiodvs) ? 8 : 1;
for (i = 0; i < nr_dvs; i++) {
max8997->buck1_vol[i] = ret = max8997->buck1_vol[i] = ret =
max8997_get_voltage_proper_val( max8997_get_voltage_proper_val(
&buck1245_voltage_map_desc, &buck1245_voltage_map_desc,
...@@ -1019,6 +1165,19 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) ...@@ -1019,6 +1165,19 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
max_buck5, 0x3f); max_buck5, 0x3f);
} }
/* Initialize all the DVS related BUCK registers */
for (i = 0; i < nr_dvs; i++) {
max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i,
max8997->buck1_vol[i],
0x3f);
max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS1 + i,
max8997->buck2_vol[i],
0x3f);
max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS1 + i,
max8997->buck5_vol[i],
0x3f);
}
/* /*
* If buck 1, 2, and 5 do not care DVS GPIO settings, ignore them. * If buck 1, 2, and 5 do not care DVS GPIO settings, ignore them.
* If at least one of them cares, set gpios. * If at least one of them cares, set gpios.
...@@ -1068,19 +1227,6 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) ...@@ -1068,19 +1227,6 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
max8997_update_reg(i2c, MAX8997_REG_BUCK5CTRL, (pdata->buck5_gpiodvs) ? max8997_update_reg(i2c, MAX8997_REG_BUCK5CTRL, (pdata->buck5_gpiodvs) ?
(1 << 1) : (0 << 1), 1 << 1); (1 << 1) : (0 << 1), 1 << 1);
/* Initialize all the DVS related BUCK registers */
for (i = 0; i < 8; i++) {
max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS1 + i,
max8997->buck1_vol[i],
0x3f);
max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS1 + i,
max8997->buck2_vol[i],
0x3f);
max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS1 + i,
max8997->buck5_vol[i],
0x3f);
}
/* Misc Settings */ /* Misc Settings */
max8997->ramp_delay = 10; /* set 10mV/us, which is the default */ max8997->ramp_delay = 10; /* set 10mV/us, which is the default */
max8997_write_reg(i2c, MAX8997_REG_BUCKRAMP, (0xf << 4) | 0x9); max8997_write_reg(i2c, MAX8997_REG_BUCKRAMP, (0xf << 4) | 0x9);
...@@ -1101,6 +1247,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) ...@@ -1101,6 +1247,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
config.dev = max8997->dev; config.dev = max8997->dev;
config.init_data = pdata->regulators[i].initdata; config.init_data = pdata->regulators[i].initdata;
config.driver_data = max8997; config.driver_data = max8997;
config.of_node = pdata->regulators[i].reg_node;
rdev[i] = regulator_register(&regulators[id], &config); rdev[i] = regulator_register(&regulators[id], &config);
if (IS_ERR(rdev[i])) { if (IS_ERR(rdev[i])) {
...@@ -1120,7 +1267,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev) ...@@ -1120,7 +1267,7 @@ static __devinit int max8997_pmic_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit max8997_pmic_remove(struct platform_device *pdev) static int max8997_pmic_remove(struct platform_device *pdev)
{ {
struct max8997_data *max8997 = platform_get_drvdata(pdev); struct max8997_data *max8997 = platform_get_drvdata(pdev);
struct regulator_dev **rdev = max8997->rdev; struct regulator_dev **rdev = max8997->rdev;
...@@ -1143,7 +1290,7 @@ static struct platform_driver max8997_pmic_driver = { ...@@ -1143,7 +1290,7 @@ static struct platform_driver max8997_pmic_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = max8997_pmic_probe, .probe = max8997_pmic_probe,
.remove = __devexit_p(max8997_pmic_remove), .remove = max8997_pmic_remove,
.id_table = max8997_pmic_id, .id_table = max8997_pmic_id,
}; };
......
...@@ -633,7 +633,7 @@ static struct regulator_desc regulators[] = { ...@@ -633,7 +633,7 @@ static struct regulator_desc regulators[] = {
} }
}; };
static __devinit int max8998_pmic_probe(struct platform_device *pdev) static int max8998_pmic_probe(struct platform_device *pdev)
{ {
struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct max8998_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct max8998_platform_data *pdata = dev_get_platdata(iodev->dev); struct max8998_platform_data *pdata = dev_get_platdata(iodev->dev);
...@@ -818,7 +818,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev) ...@@ -818,7 +818,7 @@ static __devinit int max8998_pmic_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit max8998_pmic_remove(struct platform_device *pdev) static int max8998_pmic_remove(struct platform_device *pdev)
{ {
struct max8998_data *max8998 = platform_get_drvdata(pdev); struct max8998_data *max8998 = platform_get_drvdata(pdev);
struct regulator_dev **rdev = max8998->rdev; struct regulator_dev **rdev = max8998->rdev;
...@@ -842,7 +842,7 @@ static struct platform_driver max8998_pmic_driver = { ...@@ -842,7 +842,7 @@ static struct platform_driver max8998_pmic_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = max8998_pmic_probe, .probe = max8998_pmic_probe,
.remove = __devexit_p(max8998_pmic_remove), .remove = max8998_pmic_remove,
.id_table = max8998_pmic_id, .id_table = max8998_pmic_id,
}; };
......
...@@ -392,7 +392,7 @@ static struct regulator_ops mc13783_gpo_regulator_ops = { ...@@ -392,7 +392,7 @@ static struct regulator_ops mc13783_gpo_regulator_ops = {
.set_voltage = mc13xxx_fixed_regulator_set_voltage, .set_voltage = mc13xxx_fixed_regulator_set_voltage,
}; };
static int __devinit mc13783_regulator_probe(struct platform_device *pdev) static int mc13783_regulator_probe(struct platform_device *pdev)
{ {
struct mc13xxx_regulator_priv *priv; struct mc13xxx_regulator_priv *priv;
struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent); struct mc13xxx *mc13783 = dev_get_drvdata(pdev->dev.parent);
...@@ -445,7 +445,7 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev) ...@@ -445,7 +445,7 @@ static int __devinit mc13783_regulator_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit mc13783_regulator_remove(struct platform_device *pdev) static int mc13783_regulator_remove(struct platform_device *pdev)
{ {
struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev);
struct mc13xxx_regulator_platform_data *pdata = struct mc13xxx_regulator_platform_data *pdata =
...@@ -465,7 +465,7 @@ static struct platform_driver mc13783_regulator_driver = { ...@@ -465,7 +465,7 @@ static struct platform_driver mc13783_regulator_driver = {
.name = "mc13783-regulator", .name = "mc13783-regulator",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.remove = __devexit_p(mc13783_regulator_remove), .remove = mc13783_regulator_remove,
.probe = mc13783_regulator_probe, .probe = mc13783_regulator_probe,
}; };
......
...@@ -486,7 +486,7 @@ static unsigned int mc13892_vcam_get_mode(struct regulator_dev *rdev) ...@@ -486,7 +486,7 @@ static unsigned int mc13892_vcam_get_mode(struct regulator_dev *rdev)
} }
static int __devinit mc13892_regulator_probe(struct platform_device *pdev) static int mc13892_regulator_probe(struct platform_device *pdev)
{ {
struct mc13xxx_regulator_priv *priv; struct mc13xxx_regulator_priv *priv;
struct mc13xxx *mc13892 = dev_get_drvdata(pdev->dev.parent); struct mc13xxx *mc13892 = dev_get_drvdata(pdev->dev.parent);
...@@ -588,7 +588,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev) ...@@ -588,7 +588,7 @@ static int __devinit mc13892_regulator_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit mc13892_regulator_remove(struct platform_device *pdev) static int mc13892_regulator_remove(struct platform_device *pdev)
{ {
struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev);
int i; int i;
...@@ -606,7 +606,7 @@ static struct platform_driver mc13892_regulator_driver = { ...@@ -606,7 +606,7 @@ static struct platform_driver mc13892_regulator_driver = {
.name = "mc13892-regulator", .name = "mc13892-regulator",
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.remove = __devexit_p(mc13892_regulator_remove), .remove = mc13892_regulator_remove,
.probe = mc13892_regulator_probe, .probe = mc13892_regulator_probe,
}; };
......
...@@ -162,7 +162,7 @@ struct regulator_ops mc13xxx_fixed_regulator_ops = { ...@@ -162,7 +162,7 @@ struct regulator_ops mc13xxx_fixed_regulator_ops = {
EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_ops); EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_ops);
#ifdef CONFIG_OF #ifdef CONFIG_OF
int __devinit mc13xxx_get_num_regulators_dt(struct platform_device *pdev) int mc13xxx_get_num_regulators_dt(struct platform_device *pdev)
{ {
struct device_node *parent, *child; struct device_node *parent, *child;
int num = 0; int num = 0;
...@@ -179,7 +179,7 @@ int __devinit mc13xxx_get_num_regulators_dt(struct platform_device *pdev) ...@@ -179,7 +179,7 @@ int __devinit mc13xxx_get_num_regulators_dt(struct platform_device *pdev)
} }
EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt); EXPORT_SYMBOL_GPL(mc13xxx_get_num_regulators_dt);
struct mc13xxx_regulator_init_data * __devinit mc13xxx_parse_regulators_dt( struct mc13xxx_regulator_init_data *mc13xxx_parse_regulators_dt(
struct platform_device *pdev, struct mc13xxx_regulator *regulators, struct platform_device *pdev, struct mc13xxx_regulator *regulators,
int num_regulators) int num_regulators)
{ {
......
...@@ -309,68 +309,22 @@ static int palmas_list_voltage_smps(struct regulator_dev *dev, ...@@ -309,68 +309,22 @@ static int palmas_list_voltage_smps(struct regulator_dev *dev,
int id = rdev_get_id(dev); int id = rdev_get_id(dev);
int mult = 1; int mult = 1;
if (!selector)
return 0;
/* Read the multiplier set in VSEL register to return /* Read the multiplier set in VSEL register to return
* the correct voltage. * the correct voltage.
*/ */
if (pmic->range[id]) if (pmic->range[id])
mult = 2; mult = 2;
/* Voltage is (0.49V + (selector * 0.01V)) * RANGE if (selector == 0)
* as defined in data sheet. RANGE is either x1 or x2 return 0;
*/ else if (selector < 6)
return (490000 + (selector * 10000)) * mult; return 500000 * mult;
} else
/* Voltage is linear mapping starting from selector 6,
static int palmas_get_voltage_smps_sel(struct regulator_dev *dev) * volt = (0.49V + ((selector - 5) * 0.01V)) * RANGE
{ * RANGE is either x1 or x2
struct palmas_pmic *pmic = rdev_get_drvdata(dev); */
int id = rdev_get_id(dev); return (490000 + ((selector - 5) * 10000)) * mult;
int selector;
unsigned int reg;
unsigned int addr;
addr = palmas_regs_info[id].vsel_addr;
palmas_smps_read(pmic->palmas, addr, &reg);
selector = reg & PALMAS_SMPS12_VOLTAGE_VSEL_MASK;
/* Adjust selector to match list_voltage ranges */
if ((selector > 0) && (selector < 6))
selector = 6;
if (!selector)
selector = 5;
if (selector > 121)
selector = 121;
selector -= 5;
return selector;
}
static int palmas_set_voltage_smps_sel(struct regulator_dev *dev,
unsigned selector)
{
struct palmas_pmic *pmic = rdev_get_drvdata(dev);
int id = rdev_get_id(dev);
unsigned int reg = 0;
unsigned int addr;
addr = palmas_regs_info[id].vsel_addr;
/* Make sure we don't change the value of RANGE */
if (pmic->range[id])
reg |= PALMAS_SMPS12_VOLTAGE_RANGE;
/* Adjust the linux selector into range used in VSEL register */
if (selector)
reg |= selector + 5;
palmas_smps_write(pmic->palmas, addr, reg);
return 0;
} }
static int palmas_map_voltage_smps(struct regulator_dev *rdev, static int palmas_map_voltage_smps(struct regulator_dev *rdev,
...@@ -386,11 +340,11 @@ static int palmas_map_voltage_smps(struct regulator_dev *rdev, ...@@ -386,11 +340,11 @@ static int palmas_map_voltage_smps(struct regulator_dev *rdev,
if (pmic->range[id]) { /* RANGE is x2 */ if (pmic->range[id]) { /* RANGE is x2 */
if (min_uV < 1000000) if (min_uV < 1000000)
min_uV = 1000000; min_uV = 1000000;
ret = DIV_ROUND_UP(min_uV - 1000000, 20000) + 1; ret = DIV_ROUND_UP(min_uV - 1000000, 20000) + 6;
} else { /* RANGE is x1 */ } else { /* RANGE is x1 */
if (min_uV < 500000) if (min_uV < 500000)
min_uV = 500000; min_uV = 500000;
ret = DIV_ROUND_UP(min_uV - 500000, 10000) + 1; ret = DIV_ROUND_UP(min_uV - 500000, 10000) + 6;
} }
/* Map back into a voltage to verify we're still in bounds */ /* Map back into a voltage to verify we're still in bounds */
...@@ -407,8 +361,8 @@ static struct regulator_ops palmas_ops_smps = { ...@@ -407,8 +361,8 @@ static struct regulator_ops palmas_ops_smps = {
.disable = palmas_disable_smps, .disable = palmas_disable_smps,
.set_mode = palmas_set_mode_smps, .set_mode = palmas_set_mode_smps,
.get_mode = palmas_get_mode_smps, .get_mode = palmas_get_mode_smps,
.get_voltage_sel = palmas_get_voltage_smps_sel, .get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = palmas_set_voltage_smps_sel, .set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = palmas_list_voltage_smps, .list_voltage = palmas_list_voltage_smps,
.map_voltage = palmas_map_voltage_smps, .map_voltage = palmas_map_voltage_smps,
}; };
...@@ -436,44 +390,14 @@ static int palmas_is_enabled_ldo(struct regulator_dev *dev) ...@@ -436,44 +390,14 @@ static int palmas_is_enabled_ldo(struct regulator_dev *dev)
return !!(reg); return !!(reg);
} }
static int palmas_list_voltage_ldo(struct regulator_dev *dev,
unsigned selector)
{
if (!selector)
return 0;
/* voltage is 0.85V + (selector * 0.05v) */
return 850000 + (selector * 50000);
}
static int palmas_map_voltage_ldo(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
int ret, voltage;
if (min_uV == 0)
return 0;
if (min_uV < 900000)
min_uV = 900000;
ret = DIV_ROUND_UP(min_uV - 900000, 50000) + 1;
/* Map back into a voltage to verify we're still in bounds */
voltage = palmas_list_voltage_ldo(rdev, ret);
if (voltage < min_uV || voltage > max_uV)
return -EINVAL;
return ret;
}
static struct regulator_ops palmas_ops_ldo = { static struct regulator_ops palmas_ops_ldo = {
.is_enabled = palmas_is_enabled_ldo, .is_enabled = palmas_is_enabled_ldo,
.enable = regulator_enable_regmap, .enable = regulator_enable_regmap,
.disable = regulator_disable_regmap, .disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = palmas_list_voltage_ldo, .list_voltage = regulator_list_voltage_linear,
.map_voltage = palmas_map_voltage_ldo, .map_voltage = regulator_map_voltage_linear,
}; };
/* /*
...@@ -595,7 +519,7 @@ static struct of_regulator_match palmas_matches[] = { ...@@ -595,7 +519,7 @@ static struct of_regulator_match palmas_matches[] = {
{ .name = "ldousb", }, { .name = "ldousb", },
}; };
static void __devinit palmas_dt_to_pdata(struct device *dev, static void palmas_dt_to_pdata(struct device *dev,
struct device_node *node, struct device_node *node,
struct palmas_pmic_platform_data *pdata) struct palmas_pmic_platform_data *pdata)
{ {
...@@ -663,7 +587,7 @@ static void __devinit palmas_dt_to_pdata(struct device *dev, ...@@ -663,7 +587,7 @@ static void __devinit palmas_dt_to_pdata(struct device *dev,
} }
static __devinit int palmas_probe(struct platform_device *pdev) static int palmas_probe(struct platform_device *pdev)
{ {
struct palmas *palmas = dev_get_drvdata(pdev->dev.parent); struct palmas *palmas = dev_get_drvdata(pdev->dev.parent);
struct palmas_pmic_platform_data *pdata = pdev->dev.platform_data; struct palmas_pmic_platform_data *pdata = pdev->dev.platform_data;
...@@ -733,6 +657,14 @@ static __devinit int palmas_probe(struct platform_device *pdev) ...@@ -733,6 +657,14 @@ static __devinit int palmas_probe(struct platform_device *pdev)
continue; continue;
} }
/* Initialise sleep/init values from platform data */
if (pdata && pdata->reg_init[id]) {
reg_init = pdata->reg_init[id];
ret = palmas_smps_init(palmas, id, reg_init);
if (ret)
goto err_unregister_regulator;
}
/* Register the regulators */ /* Register the regulators */
pmic->desc[id].name = palmas_regs_info[id].name; pmic->desc[id].name = palmas_regs_info[id].name;
pmic->desc[id].id = id; pmic->desc[id].id = id;
...@@ -753,29 +685,11 @@ static __devinit int palmas_probe(struct platform_device *pdev) ...@@ -753,29 +685,11 @@ static __devinit int palmas_probe(struct platform_device *pdev)
pmic->desc[id].uV_step = 1250000; pmic->desc[id].uV_step = 1250000;
break; break;
default: default:
pmic->desc[id].ops = &palmas_ops_smps; /*
pmic->desc[id].n_voltages = PALMAS_SMPS_NUM_VOLTAGES; * Read and store the RANGE bit for later use
} * This must be done before regulator is probed,
* otherwise we error in probe with unsupportable ranges.
pmic->desc[id].type = REGULATOR_VOLTAGE; */
pmic->desc[id].owner = THIS_MODULE;
/* Initialise sleep/init values from platform data */
if (pdata) {
reg_init = pdata->reg_init[id];
if (reg_init) {
ret = palmas_smps_init(palmas, id, reg_init);
if (ret)
goto err_unregister_regulator;
}
}
/*
* read and store the RANGE bit for later use
* This must be done before regulator is probed otherwise
* we error in probe with unsupportable ranges.
*/
if (id != PALMAS_REG_SMPS10) {
addr = palmas_regs_info[id].vsel_addr; addr = palmas_regs_info[id].vsel_addr;
ret = palmas_smps_read(pmic->palmas, addr, &reg); ret = palmas_smps_read(pmic->palmas, addr, &reg);
...@@ -783,8 +697,19 @@ static __devinit int palmas_probe(struct platform_device *pdev) ...@@ -783,8 +697,19 @@ static __devinit int palmas_probe(struct platform_device *pdev)
goto err_unregister_regulator; goto err_unregister_regulator;
if (reg & PALMAS_SMPS12_VOLTAGE_RANGE) if (reg & PALMAS_SMPS12_VOLTAGE_RANGE)
pmic->range[id] = 1; pmic->range[id] = 1;
pmic->desc[id].ops = &palmas_ops_smps;
pmic->desc[id].n_voltages = PALMAS_SMPS_NUM_VOLTAGES;
pmic->desc[id].vsel_reg =
PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
palmas_regs_info[id].vsel_addr);
pmic->desc[id].vsel_mask =
PALMAS_SMPS12_VOLTAGE_VSEL_MASK;
} }
pmic->desc[id].type = REGULATOR_VOLTAGE;
pmic->desc[id].owner = THIS_MODULE;
if (pdata) if (pdata)
config.init_data = pdata->reg_data[id]; config.init_data = pdata->reg_data[id];
else else
...@@ -821,6 +746,9 @@ static __devinit int palmas_probe(struct platform_device *pdev) ...@@ -821,6 +746,9 @@ static __devinit int palmas_probe(struct platform_device *pdev)
pmic->desc[id].type = REGULATOR_VOLTAGE; pmic->desc[id].type = REGULATOR_VOLTAGE;
pmic->desc[id].owner = THIS_MODULE; pmic->desc[id].owner = THIS_MODULE;
pmic->desc[id].min_uV = 900000;
pmic->desc[id].uV_step = 50000;
pmic->desc[id].linear_min_sel = 1;
pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE, pmic->desc[id].vsel_reg = PALMAS_BASE_TO_REG(PALMAS_LDO_BASE,
palmas_regs_info[id].vsel_addr); palmas_regs_info[id].vsel_addr);
pmic->desc[id].vsel_mask = PALMAS_LDO1_VOLTAGE_VSEL_MASK; pmic->desc[id].vsel_mask = PALMAS_LDO1_VOLTAGE_VSEL_MASK;
...@@ -868,7 +796,7 @@ static __devinit int palmas_probe(struct platform_device *pdev) ...@@ -868,7 +796,7 @@ static __devinit int palmas_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit palmas_remove(struct platform_device *pdev) static int palmas_remove(struct platform_device *pdev)
{ {
struct palmas_pmic *pmic = platform_get_drvdata(pdev); struct palmas_pmic *pmic = platform_get_drvdata(pdev);
int id; int id;
...@@ -890,7 +818,7 @@ static struct platform_driver palmas_driver = { ...@@ -890,7 +818,7 @@ static struct platform_driver palmas_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = palmas_probe, .probe = palmas_probe,
.remove = __devexit_p(palmas_remove), .remove = palmas_remove,
}; };
static int __init palmas_init(void) static int __init palmas_init(void)
......
...@@ -236,7 +236,7 @@ static const struct regulator_desc pcap_regulators[] = { ...@@ -236,7 +236,7 @@ static const struct regulator_desc pcap_regulators[] = {
VREG(VAUX4), VREG(VSIM), VREG(VSIM2), VREG(VVIB), VREG(SW1), VREG(SW2), VREG(VAUX4), VREG(VSIM), VREG(VSIM2), VREG(VVIB), VREG(SW1), VREG(SW2),
}; };
static int __devinit pcap_regulator_probe(struct platform_device *pdev) static int pcap_regulator_probe(struct platform_device *pdev)
{ {
struct regulator_dev *rdev; struct regulator_dev *rdev;
void *pcap = dev_get_drvdata(pdev->dev.parent); void *pcap = dev_get_drvdata(pdev->dev.parent);
...@@ -255,7 +255,7 @@ static int __devinit pcap_regulator_probe(struct platform_device *pdev) ...@@ -255,7 +255,7 @@ static int __devinit pcap_regulator_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit pcap_regulator_remove(struct platform_device *pdev) static int pcap_regulator_remove(struct platform_device *pdev)
{ {
struct regulator_dev *rdev = platform_get_drvdata(pdev); struct regulator_dev *rdev = platform_get_drvdata(pdev);
...@@ -271,7 +271,7 @@ static struct platform_driver pcap_regulator_driver = { ...@@ -271,7 +271,7 @@ static struct platform_driver pcap_regulator_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = pcap_regulator_probe, .probe = pcap_regulator_probe,
.remove = __devexit_p(pcap_regulator_remove), .remove = pcap_regulator_remove,
}; };
static int __init pcap_regulator_init(void) static int __init pcap_regulator_init(void)
......
...@@ -24,12 +24,15 @@ ...@@ -24,12 +24,15 @@
#include <linux/mfd/pcf50633/core.h> #include <linux/mfd/pcf50633/core.h>
#include <linux/mfd/pcf50633/pmic.h> #include <linux/mfd/pcf50633/pmic.h>
#define PCF50633_REGULATOR(_name, _id, _n) \ #define PCF50633_REGULATOR(_name, _id, _min_uV, _uV_step, _min_sel, _n) \
{ \ { \
.name = _name, \ .name = _name, \
.id = PCF50633_REGULATOR_##_id, \ .id = PCF50633_REGULATOR_##_id, \
.ops = &pcf50633_regulator_ops, \ .ops = &pcf50633_regulator_ops, \
.n_voltages = _n, \ .n_voltages = _n, \
.min_uV = _min_uV, \
.uV_step = _uV_step, \
.linear_min_sel = _min_sel, \
.type = REGULATOR_VOLTAGE, \ .type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \ .owner = THIS_MODULE, \
.vsel_reg = PCF50633_REG_##_id##OUT, \ .vsel_reg = PCF50633_REG_##_id##OUT, \
...@@ -38,165 +41,42 @@ ...@@ -38,165 +41,42 @@
.enable_mask = PCF50633_REGULATOR_ON, \ .enable_mask = PCF50633_REGULATOR_ON, \
} }
/* Bits from voltage value */
static u8 auto_voltage_bits(unsigned int millivolts)
{
if (millivolts < 1800)
return 0x2f;
if (millivolts > 3800)
return 0xff;
millivolts -= 625;
return millivolts / 25;
}
static u8 down_voltage_bits(unsigned int millivolts)
{
if (millivolts < 625)
return 0;
else if (millivolts > 3000)
return 0xff;
millivolts -= 625;
return millivolts / 25;
}
static u8 ldo_voltage_bits(unsigned int millivolts)
{
if (millivolts < 900)
return 0;
else if (millivolts > 3600)
return 0x1f;
millivolts -= 900;
return millivolts / 100;
}
/* Obtain voltage value from bits */
static unsigned int auto_voltage_value(u8 bits)
{
/* AUTOOUT: 00000000 to 00101110 are reserved.
* Return 0 for bits in reserved range, which means this selector code
* can't be used on this system */
if (bits < 0x2f)
return 0;
return 625 + (bits * 25);
}
static unsigned int down_voltage_value(u8 bits)
{
return 625 + (bits * 25);
}
static unsigned int ldo_voltage_value(u8 bits)
{
bits &= 0x1f;
return 900 + (bits * 100);
}
static int pcf50633_regulator_map_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
struct pcf50633 *pcf;
int regulator_id, millivolts;
u8 volt_bits;
pcf = rdev_get_drvdata(rdev);
regulator_id = rdev_get_id(rdev);
if (regulator_id >= PCF50633_NUM_REGULATORS)
return -EINVAL;
millivolts = min_uV / 1000;
switch (regulator_id) {
case PCF50633_REGULATOR_AUTO:
volt_bits = auto_voltage_bits(millivolts);
break;
case PCF50633_REGULATOR_DOWN1:
case PCF50633_REGULATOR_DOWN2:
volt_bits = down_voltage_bits(millivolts);
break;
case PCF50633_REGULATOR_LDO1:
case PCF50633_REGULATOR_LDO2:
case PCF50633_REGULATOR_LDO3:
case PCF50633_REGULATOR_LDO4:
case PCF50633_REGULATOR_LDO5:
case PCF50633_REGULATOR_LDO6:
case PCF50633_REGULATOR_HCLDO:
case PCF50633_REGULATOR_MEMLDO:
volt_bits = ldo_voltage_bits(millivolts);
break;
default:
return -EINVAL;
}
return volt_bits;
}
static int pcf50633_regulator_list_voltage(struct regulator_dev *rdev,
unsigned int index)
{
int regulator_id = rdev_get_id(rdev);
int millivolts;
switch (regulator_id) {
case PCF50633_REGULATOR_AUTO:
millivolts = auto_voltage_value(index);
break;
case PCF50633_REGULATOR_DOWN1:
case PCF50633_REGULATOR_DOWN2:
millivolts = down_voltage_value(index);
break;
case PCF50633_REGULATOR_LDO1:
case PCF50633_REGULATOR_LDO2:
case PCF50633_REGULATOR_LDO3:
case PCF50633_REGULATOR_LDO4:
case PCF50633_REGULATOR_LDO5:
case PCF50633_REGULATOR_LDO6:
case PCF50633_REGULATOR_HCLDO:
case PCF50633_REGULATOR_MEMLDO:
millivolts = ldo_voltage_value(index);
break;
default:
return -EINVAL;
}
return millivolts * 1000;
}
static struct regulator_ops pcf50633_regulator_ops = { static struct regulator_ops pcf50633_regulator_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap, .get_voltage_sel = regulator_get_voltage_sel_regmap,
.list_voltage = pcf50633_regulator_list_voltage, .list_voltage = regulator_list_voltage_linear,
.map_voltage = pcf50633_regulator_map_voltage, .map_voltage = regulator_map_voltage_linear,
.enable = regulator_enable_regmap, .enable = regulator_enable_regmap,
.disable = regulator_disable_regmap, .disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap, .is_enabled = regulator_is_enabled_regmap,
}; };
static const struct regulator_desc regulators[] = { static const struct regulator_desc regulators[] = {
[PCF50633_REGULATOR_AUTO] = PCF50633_REGULATOR("auto", AUTO, 128), [PCF50633_REGULATOR_AUTO] =
[PCF50633_REGULATOR_DOWN1] = PCF50633_REGULATOR("down1", DOWN1, 96), PCF50633_REGULATOR("auto", AUTO, 1800000, 25000, 0x2f, 128),
[PCF50633_REGULATOR_DOWN2] = PCF50633_REGULATOR("down2", DOWN2, 96), [PCF50633_REGULATOR_DOWN1] =
[PCF50633_REGULATOR_LDO1] = PCF50633_REGULATOR("ldo1", LDO1, 28), PCF50633_REGULATOR("down1", DOWN1, 625000, 25000, 0, 96),
[PCF50633_REGULATOR_LDO2] = PCF50633_REGULATOR("ldo2", LDO2, 28), [PCF50633_REGULATOR_DOWN2] =
[PCF50633_REGULATOR_LDO3] = PCF50633_REGULATOR("ldo3", LDO3, 28), PCF50633_REGULATOR("down2", DOWN2, 625000, 25000, 0, 96),
[PCF50633_REGULATOR_LDO4] = PCF50633_REGULATOR("ldo4", LDO4, 28), [PCF50633_REGULATOR_LDO1] =
[PCF50633_REGULATOR_LDO5] = PCF50633_REGULATOR("ldo5", LDO5, 28), PCF50633_REGULATOR("ldo1", LDO1, 900000, 100000, 0, 28),
[PCF50633_REGULATOR_LDO6] = PCF50633_REGULATOR("ldo6", LDO6, 28), [PCF50633_REGULATOR_LDO2] =
[PCF50633_REGULATOR_HCLDO] = PCF50633_REGULATOR("hcldo", HCLDO, 28), PCF50633_REGULATOR("ldo2", LDO2, 900000, 100000, 0, 28),
[PCF50633_REGULATOR_MEMLDO] = PCF50633_REGULATOR("memldo", MEMLDO, 28), [PCF50633_REGULATOR_LDO3] =
PCF50633_REGULATOR("ldo3", LDO3, 900000, 100000, 0, 28),
[PCF50633_REGULATOR_LDO4] =
PCF50633_REGULATOR("ldo4", LDO4, 900000, 100000, 0, 28),
[PCF50633_REGULATOR_LDO5] =
PCF50633_REGULATOR("ldo5", LDO5, 900000, 100000, 0, 28),
[PCF50633_REGULATOR_LDO6] =
PCF50633_REGULATOR("ldo6", LDO6, 900000, 100000, 0, 28),
[PCF50633_REGULATOR_HCLDO] =
PCF50633_REGULATOR("hcldo", HCLDO, 900000, 100000, 0, 28),
[PCF50633_REGULATOR_MEMLDO] =
PCF50633_REGULATOR("memldo", MEMLDO, 900000, 100000, 0, 28),
}; };
static int __devinit pcf50633_regulator_probe(struct platform_device *pdev) static int pcf50633_regulator_probe(struct platform_device *pdev)
{ {
struct regulator_dev *rdev; struct regulator_dev *rdev;
struct pcf50633 *pcf; struct pcf50633 *pcf;
...@@ -222,7 +102,7 @@ static int __devinit pcf50633_regulator_probe(struct platform_device *pdev) ...@@ -222,7 +102,7 @@ static int __devinit pcf50633_regulator_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit pcf50633_regulator_remove(struct platform_device *pdev) static int pcf50633_regulator_remove(struct platform_device *pdev)
{ {
struct regulator_dev *rdev = platform_get_drvdata(pdev); struct regulator_dev *rdev = platform_get_drvdata(pdev);
...@@ -237,7 +117,7 @@ static struct platform_driver pcf50633_regulator_driver = { ...@@ -237,7 +117,7 @@ static struct platform_driver pcf50633_regulator_driver = {
.name = "pcf50633-regltr", .name = "pcf50633-regltr",
}, },
.probe = pcf50633_regulator_probe, .probe = pcf50633_regulator_probe,
.remove = __devexit_p(pcf50633_regulator_remove), .remove = pcf50633_regulator_remove,
}; };
static int __init pcf50633_regulator_init(void) static int __init pcf50633_regulator_init(void)
......
...@@ -119,7 +119,7 @@ static struct rc5t583_regulator_info rc5t583_reg_info[RC5T583_REGULATOR_MAX] = { ...@@ -119,7 +119,7 @@ static struct rc5t583_regulator_info rc5t583_reg_info[RC5T583_REGULATOR_MAX] = {
RC5T583_REG(LDO9, LDOEN1, 1, LDODIS1, 1, 0x7F, 900, 3400, 25000, 133), RC5T583_REG(LDO9, LDOEN1, 1, LDODIS1, 1, 0x7F, 900, 3400, 25000, 133),
}; };
static int __devinit rc5t583_regulator_probe(struct platform_device *pdev) static int rc5t583_regulator_probe(struct platform_device *pdev)
{ {
struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent); struct rc5t583 *rc5t583 = dev_get_drvdata(pdev->dev.parent);
struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev); struct rc5t583_platform_data *pdata = dev_get_platdata(rc5t583->dev);
...@@ -198,7 +198,7 @@ static int __devinit rc5t583_regulator_probe(struct platform_device *pdev) ...@@ -198,7 +198,7 @@ static int __devinit rc5t583_regulator_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit rc5t583_regulator_remove(struct platform_device *pdev) static int rc5t583_regulator_remove(struct platform_device *pdev)
{ {
struct rc5t583_regulator *regs = platform_get_drvdata(pdev); struct rc5t583_regulator *regs = platform_get_drvdata(pdev);
int id; int id;
...@@ -214,7 +214,7 @@ static struct platform_driver rc5t583_regulator_driver = { ...@@ -214,7 +214,7 @@ static struct platform_driver rc5t583_regulator_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = rc5t583_regulator_probe, .probe = rc5t583_regulator_probe,
.remove = __devexit_p(rc5t583_regulator_remove), .remove = rc5t583_regulator_remove,
}; };
static int __init rc5t583_regulator_init(void) static int __init rc5t583_regulator_init(void)
......
...@@ -231,7 +231,7 @@ static struct regulator_desc regulators[] = { ...@@ -231,7 +231,7 @@ static struct regulator_desc regulators[] = {
regulator_desc_buck10, regulator_desc_buck10,
}; };
static __devinit int s2mps11_pmic_probe(struct platform_device *pdev) static int s2mps11_pmic_probe(struct platform_device *pdev)
{ {
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); struct sec_platform_data *pdata = dev_get_platdata(iodev->dev);
...@@ -269,16 +269,16 @@ static __devinit int s2mps11_pmic_probe(struct platform_device *pdev) ...@@ -269,16 +269,16 @@ static __devinit int s2mps11_pmic_probe(struct platform_device *pdev)
if (ramp_enable) { if (ramp_enable) {
if (s2mps11->buck2_ramp) if (s2mps11->buck2_ramp)
ramp_reg |= get_ramp_delay(s2mps11->ramp_delay2) >> 6; ramp_reg |= get_ramp_delay(s2mps11->ramp_delay2) << 6;
if (s2mps11->buck3_ramp || s2mps11->buck4_ramp) if (s2mps11->buck3_ramp || s2mps11->buck4_ramp)
ramp_reg |= get_ramp_delay(s2mps11->ramp_delay34) >> 4; ramp_reg |= get_ramp_delay(s2mps11->ramp_delay34) << 4;
sec_reg_write(iodev, S2MPS11_REG_RAMP, ramp_reg | ramp_enable); sec_reg_write(iodev, S2MPS11_REG_RAMP, ramp_reg | ramp_enable);
} }
ramp_reg &= 0x00; ramp_reg &= 0x00;
ramp_reg |= get_ramp_delay(s2mps11->ramp_delay5) >> 6; ramp_reg |= get_ramp_delay(s2mps11->ramp_delay5) << 6;
ramp_reg |= get_ramp_delay(s2mps11->ramp_delay16) >> 4; ramp_reg |= get_ramp_delay(s2mps11->ramp_delay16) << 4;
ramp_reg |= get_ramp_delay(s2mps11->ramp_delay7810) >> 2; ramp_reg |= get_ramp_delay(s2mps11->ramp_delay7810) << 2;
ramp_reg |= get_ramp_delay(s2mps11->ramp_delay9); ramp_reg |= get_ramp_delay(s2mps11->ramp_delay9);
sec_reg_write(iodev, S2MPS11_REG_RAMP_BUCK, ramp_reg); sec_reg_write(iodev, S2MPS11_REG_RAMP_BUCK, ramp_reg);
...@@ -307,7 +307,7 @@ static __devinit int s2mps11_pmic_probe(struct platform_device *pdev) ...@@ -307,7 +307,7 @@ static __devinit int s2mps11_pmic_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit s2mps11_pmic_remove(struct platform_device *pdev) static int s2mps11_pmic_remove(struct platform_device *pdev)
{ {
struct s2mps11_info *s2mps11 = platform_get_drvdata(pdev); struct s2mps11_info *s2mps11 = platform_get_drvdata(pdev);
int i; int i;
...@@ -330,7 +330,7 @@ static struct platform_driver s2mps11_pmic_driver = { ...@@ -330,7 +330,7 @@ static struct platform_driver s2mps11_pmic_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = s2mps11_pmic_probe, .probe = s2mps11_pmic_probe,
.remove = __devexit_p(s2mps11_pmic_remove), .remove = s2mps11_pmic_remove,
.id_table = s2mps11_pmic_id, .id_table = s2mps11_pmic_id,
}; };
......
...@@ -168,7 +168,7 @@ static unsigned int s5m8767_opmode_reg[][4] = { ...@@ -168,7 +168,7 @@ static unsigned int s5m8767_opmode_reg[][4] = {
static int s5m8767_get_register(struct regulator_dev *rdev, int *reg, static int s5m8767_get_register(struct regulator_dev *rdev, int *reg,
int *enable_ctrl) int *enable_ctrl)
{ {
int reg_id = rdev_get_id(rdev); int i, reg_id = rdev_get_id(rdev);
unsigned int mode; unsigned int mode;
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev); struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
...@@ -195,8 +195,17 @@ static int s5m8767_get_register(struct regulator_dev *rdev, int *reg, ...@@ -195,8 +195,17 @@ static int s5m8767_get_register(struct regulator_dev *rdev, int *reg,
return -EINVAL; return -EINVAL;
} }
mode = s5m8767->opmode[reg_id].mode; for (i = 0; i < s5m8767->num_regulators; i++) {
*enable_ctrl = s5m8767_opmode_reg[reg_id][mode] << S5M8767_ENCTRL_SHIFT; if (s5m8767->opmode[i].id == reg_id) {
mode = s5m8767->opmode[i].mode;
break;
}
}
if (i < s5m8767->num_regulators)
*enable_ctrl =
s5m8767_opmode_reg[reg_id][mode] << S5M8767_ENCTRL_SHIFT;
return 0; return 0;
} }
...@@ -263,17 +272,17 @@ static int s5m8767_get_voltage_register(struct regulator_dev *rdev, int *_reg) ...@@ -263,17 +272,17 @@ static int s5m8767_get_voltage_register(struct regulator_dev *rdev, int *_reg)
reg = S5M8767_REG_BUCK1CTRL2; reg = S5M8767_REG_BUCK1CTRL2;
break; break;
case S5M8767_BUCK2: case S5M8767_BUCK2:
reg = S5M8767_REG_BUCK2DVS2; reg = S5M8767_REG_BUCK2DVS1;
if (s5m8767->buck2_gpiodvs) if (s5m8767->buck2_gpiodvs)
reg += s5m8767->buck_gpioindex; reg += s5m8767->buck_gpioindex;
break; break;
case S5M8767_BUCK3: case S5M8767_BUCK3:
reg = S5M8767_REG_BUCK3DVS2; reg = S5M8767_REG_BUCK3DVS1;
if (s5m8767->buck3_gpiodvs) if (s5m8767->buck3_gpiodvs)
reg += s5m8767->buck_gpioindex; reg += s5m8767->buck_gpioindex;
break; break;
case S5M8767_BUCK4: case S5M8767_BUCK4:
reg = S5M8767_REG_BUCK4DVS2; reg = S5M8767_REG_BUCK4DVS1;
if (s5m8767->buck4_gpiodvs) if (s5m8767->buck4_gpiodvs)
reg += s5m8767->buck_gpioindex; reg += s5m8767->buck_gpioindex;
break; break;
...@@ -499,7 +508,7 @@ static struct regulator_desc regulators[] = { ...@@ -499,7 +508,7 @@ static struct regulator_desc regulators[] = {
s5m8767_regulator_desc(BUCK9), s5m8767_regulator_desc(BUCK9),
}; };
static __devinit int s5m8767_pmic_probe(struct platform_device *pdev) static int s5m8767_pmic_probe(struct platform_device *pdev)
{ {
struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent);
struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); struct sec_platform_data *pdata = dev_get_platdata(iodev->dev);
...@@ -547,7 +556,7 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev) ...@@ -547,7 +556,7 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev)
rdev = s5m8767->rdev; rdev = s5m8767->rdev;
s5m8767->dev = &pdev->dev; s5m8767->dev = &pdev->dev;
s5m8767->iodev = iodev; s5m8767->iodev = iodev;
s5m8767->num_regulators = S5M8767_REG_MAX - 2; s5m8767->num_regulators = pdata->num_regulators;
platform_set_drvdata(pdev, s5m8767); platform_set_drvdata(pdev, s5m8767);
s5m8767->buck_gpioindex = pdata->buck_default_idx; s5m8767->buck_gpioindex = pdata->buck_default_idx;
...@@ -617,9 +626,16 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev) ...@@ -617,9 +626,16 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev)
} }
} }
if (gpio_is_valid(pdata->buck_gpios[0]) && if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
gpio_is_valid(pdata->buck_gpios[1]) && pdata->buck4_gpiodvs) {
gpio_is_valid(pdata->buck_gpios[2])) {
if (!gpio_is_valid(pdata->buck_gpios[0]) ||
!gpio_is_valid(pdata->buck_gpios[1]) ||
!gpio_is_valid(pdata->buck_gpios[2])) {
dev_err(&pdev->dev, "GPIO NOT VALID\n");
return -EINVAL;
}
ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[0], ret = devm_gpio_request(&pdev->dev, pdata->buck_gpios[0],
"S5M8767 SET1"); "S5M8767 SET1");
if (ret) if (ret)
...@@ -644,10 +660,6 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev) ...@@ -644,10 +660,6 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev)
/* SET3 GPIO */ /* SET3 GPIO */
gpio_direction_output(pdata->buck_gpios[2], gpio_direction_output(pdata->buck_gpios[2],
(s5m8767->buck_gpioindex >> 0) & 0x1); (s5m8767->buck_gpioindex >> 0) & 0x1);
} else {
dev_err(&pdev->dev, "GPIO NOT VALID\n");
ret = -EINVAL;
return ret;
} }
ret = devm_gpio_request(&pdev->dev, pdata->buck_ds[0], "S5M8767 DS2"); ret = devm_gpio_request(&pdev->dev, pdata->buck_ds[0], "S5M8767 DS2");
...@@ -773,7 +785,7 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev) ...@@ -773,7 +785,7 @@ static __devinit int s5m8767_pmic_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit s5m8767_pmic_remove(struct platform_device *pdev) static int s5m8767_pmic_remove(struct platform_device *pdev)
{ {
struct s5m8767_info *s5m8767 = platform_get_drvdata(pdev); struct s5m8767_info *s5m8767 = platform_get_drvdata(pdev);
struct regulator_dev **rdev = s5m8767->rdev; struct regulator_dev **rdev = s5m8767->rdev;
...@@ -798,7 +810,7 @@ static struct platform_driver s5m8767_pmic_driver = { ...@@ -798,7 +810,7 @@ static struct platform_driver s5m8767_pmic_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = s5m8767_pmic_probe, .probe = s5m8767_pmic_probe,
.remove = __devexit_p(s5m8767_pmic_remove), .remove = s5m8767_pmic_remove,
.id_table = s5m8767_pmic_id, .id_table = s5m8767_pmic_id,
}; };
......
This diff is collapsed.
...@@ -127,7 +127,7 @@ static const struct regulator_desc tps6105x_regulator_desc = { ...@@ -127,7 +127,7 @@ static const struct regulator_desc tps6105x_regulator_desc = {
/* /*
* Registers the chip as a voltage regulator * Registers the chip as a voltage regulator
*/ */
static int __devinit tps6105x_regulator_probe(struct platform_device *pdev) static int tps6105x_regulator_probe(struct platform_device *pdev)
{ {
struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev); struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev);
struct tps6105x_platform_data *pdata = tps6105x->pdata; struct tps6105x_platform_data *pdata = tps6105x->pdata;
...@@ -159,7 +159,7 @@ static int __devinit tps6105x_regulator_probe(struct platform_device *pdev) ...@@ -159,7 +159,7 @@ static int __devinit tps6105x_regulator_probe(struct platform_device *pdev)
return 0; return 0;
} }
static int __devexit tps6105x_regulator_remove(struct platform_device *pdev) static int tps6105x_regulator_remove(struct platform_device *pdev)
{ {
struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev); struct tps6105x *tps6105x = dev_get_platdata(&pdev->dev);
regulator_unregister(tps6105x->regulator); regulator_unregister(tps6105x->regulator);
...@@ -172,7 +172,7 @@ static struct platform_driver tps6105x_regulator_driver = { ...@@ -172,7 +172,7 @@ static struct platform_driver tps6105x_regulator_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = tps6105x_regulator_probe, .probe = tps6105x_regulator_probe,
.remove = __devexit_p(tps6105x_regulator_remove), .remove = tps6105x_regulator_remove,
}; };
static __init int tps6105x_regulator_init(void) static __init int tps6105x_regulator_init(void)
......
...@@ -243,7 +243,7 @@ static struct regulator_ops tps62360_dcdc_ops = { ...@@ -243,7 +243,7 @@ static struct regulator_ops tps62360_dcdc_ops = {
.get_mode = tps62360_get_mode, .get_mode = tps62360_get_mode,
}; };
static int __devinit tps62360_init_dcdc(struct tps62360_chip *tps, static int tps62360_init_dcdc(struct tps62360_chip *tps,
struct tps62360_regulator_platform_data *pdata) struct tps62360_regulator_platform_data *pdata)
{ {
int ret; int ret;
...@@ -339,7 +339,7 @@ static const struct of_device_id tps62360_of_match[] = { ...@@ -339,7 +339,7 @@ static const struct of_device_id tps62360_of_match[] = {
MODULE_DEVICE_TABLE(of, tps62360_of_match); MODULE_DEVICE_TABLE(of, tps62360_of_match);
#endif #endif
static int __devinit tps62360_probe(struct i2c_client *client, static int tps62360_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
struct regulator_config config = { }; struct regulator_config config = { };
...@@ -490,7 +490,7 @@ static int __devinit tps62360_probe(struct i2c_client *client, ...@@ -490,7 +490,7 @@ static int __devinit tps62360_probe(struct i2c_client *client,
* *
* Unregister TPS driver as an i2c client device driver * Unregister TPS driver as an i2c client device driver
*/ */
static int __devexit tps62360_remove(struct i2c_client *client) static int tps62360_remove(struct i2c_client *client)
{ {
struct tps62360_chip *tps = i2c_get_clientdata(client); struct tps62360_chip *tps = i2c_get_clientdata(client);
...@@ -531,7 +531,7 @@ static struct i2c_driver tps62360_i2c_driver = { ...@@ -531,7 +531,7 @@ static struct i2c_driver tps62360_i2c_driver = {
.of_match_table = of_match_ptr(tps62360_of_match), .of_match_table = of_match_ptr(tps62360_of_match),
}, },
.probe = tps62360_probe, .probe = tps62360_probe,
.remove = __devexit_p(tps62360_remove), .remove = tps62360_remove,
.shutdown = tps62360_shutdown, .shutdown = tps62360_shutdown,
.id_table = tps62360_id, .id_table = tps62360_id,
}; };
......
...@@ -219,7 +219,7 @@ static struct regmap_config tps65023_regmap_config = { ...@@ -219,7 +219,7 @@ static struct regmap_config tps65023_regmap_config = {
.val_bits = 8, .val_bits = 8,
}; };
static int __devinit tps_65023_probe(struct i2c_client *client, static int tps_65023_probe(struct i2c_client *client,
const struct i2c_device_id *id) const struct i2c_device_id *id)
{ {
const struct tps_driver_data *drv_data = (void *)id->driver_data; const struct tps_driver_data *drv_data = (void *)id->driver_data;
...@@ -319,7 +319,7 @@ static int __devinit tps_65023_probe(struct i2c_client *client, ...@@ -319,7 +319,7 @@ static int __devinit tps_65023_probe(struct i2c_client *client,
return error; return error;
} }
static int __devexit tps_65023_remove(struct i2c_client *client) static int tps_65023_remove(struct i2c_client *client)
{ {
struct tps_pmic *tps = i2c_get_clientdata(client); struct tps_pmic *tps = i2c_get_clientdata(client);
int i; int i;
...@@ -446,7 +446,7 @@ static struct i2c_driver tps_65023_i2c_driver = { ...@@ -446,7 +446,7 @@ static struct i2c_driver tps_65023_i2c_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = tps_65023_probe, .probe = tps_65023_probe,
.remove = __devexit_p(tps_65023_remove), .remove = tps_65023_remove,
.id_table = tps_65023_id, .id_table = tps_65023_id,
}; };
......
...@@ -356,7 +356,7 @@ static struct regulator_ops tps6507x_pmic_ops = { ...@@ -356,7 +356,7 @@ static struct regulator_ops tps6507x_pmic_ops = {
.list_voltage = regulator_list_voltage_table, .list_voltage = regulator_list_voltage_table,
}; };
static __devinit int tps6507x_pmic_probe(struct platform_device *pdev) static int tps6507x_pmic_probe(struct platform_device *pdev)
{ {
struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent); struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent);
struct tps_info *info = &tps6507x_pmic_regs[0]; struct tps_info *info = &tps6507x_pmic_regs[0];
...@@ -439,7 +439,7 @@ static __devinit int tps6507x_pmic_probe(struct platform_device *pdev) ...@@ -439,7 +439,7 @@ static __devinit int tps6507x_pmic_probe(struct platform_device *pdev)
return error; return error;
} }
static int __devexit tps6507x_pmic_remove(struct platform_device *pdev) static int tps6507x_pmic_remove(struct platform_device *pdev)
{ {
struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev); struct tps6507x_dev *tps6507x_dev = platform_get_drvdata(pdev);
struct tps6507x_pmic *tps = tps6507x_dev->pmic; struct tps6507x_pmic *tps = tps6507x_dev->pmic;
...@@ -456,7 +456,7 @@ static struct platform_driver tps6507x_pmic_driver = { ...@@ -456,7 +456,7 @@ static struct platform_driver tps6507x_pmic_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
}, },
.probe = tps6507x_pmic_probe, .probe = tps6507x_pmic_probe,
.remove = __devexit_p(tps6507x_pmic_remove), .remove = tps6507x_pmic_remove,
}; };
static int __init tps6507x_pmic_init(void) static int __init tps6507x_pmic_init(void)
......
This diff is collapsed.
...@@ -332,7 +332,7 @@ static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev) ...@@ -332,7 +332,7 @@ static struct tps65217_board *tps65217_parse_dt(struct platform_device *pdev)
} }
#endif #endif
static int __devinit tps65217_regulator_probe(struct platform_device *pdev) static int tps65217_regulator_probe(struct platform_device *pdev)
{ {
struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent); struct tps65217 *tps = dev_get_drvdata(pdev->dev.parent);
struct tps65217_board *pdata = dev_get_platdata(tps->dev); struct tps65217_board *pdata = dev_get_platdata(tps->dev);
...@@ -397,7 +397,7 @@ static int __devinit tps65217_regulator_probe(struct platform_device *pdev) ...@@ -397,7 +397,7 @@ static int __devinit tps65217_regulator_probe(struct platform_device *pdev)
return ret; return ret;
} }
static int __devexit tps65217_regulator_remove(struct platform_device *pdev) static int tps65217_regulator_remove(struct platform_device *pdev)
{ {
struct tps65217 *tps = platform_get_drvdata(pdev); struct tps65217 *tps = platform_get_drvdata(pdev);
unsigned int i; unsigned int i;
...@@ -415,7 +415,7 @@ static struct platform_driver tps65217_regulator_driver = { ...@@ -415,7 +415,7 @@ static struct platform_driver tps65217_regulator_driver = {
.name = "tps65217-pmic", .name = "tps65217-pmic",
}, },
.probe = tps65217_regulator_probe, .probe = tps65217_regulator_probe,
.remove = __devexit_p(tps65217_regulator_remove), .remove = tps65217_regulator_remove,
}; };
static int __init tps65217_regulator_init(void) static int __init tps65217_regulator_init(void)
......
...@@ -592,7 +592,7 @@ static int pmic_remove(struct spi_device *spi) ...@@ -592,7 +592,7 @@ static int pmic_remove(struct spi_device *spi)
return 0; return 0;
} }
static int __devinit pmic_probe(struct spi_device *spi) static int pmic_probe(struct spi_device *spi)
{ {
struct tps6524x *hw; struct tps6524x *hw;
struct device *dev = &spi->dev; struct device *dev = &spi->dev;
...@@ -649,7 +649,7 @@ static int __devinit pmic_probe(struct spi_device *spi) ...@@ -649,7 +649,7 @@ static int __devinit pmic_probe(struct spi_device *spi)
static struct spi_driver pmic_driver = { static struct spi_driver pmic_driver = {
.probe = pmic_probe, .probe = pmic_probe,
.remove = __devexit_p(pmic_remove), .remove = pmic_remove,
.driver = { .driver = {
.name = "tps6524x", .name = "tps6524x",
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -316,6 +316,7 @@ enum max8997_irq { ...@@ -316,6 +316,7 @@ enum max8997_irq {
#define MAX8997_NUM_GPIO 12 #define MAX8997_NUM_GPIO 12
struct max8997_dev { struct max8997_dev {
struct device *dev; struct device *dev;
struct max8997_platform_data *pdata;
struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */ struct i2c_client *i2c; /* 0xcc / PMIC, Battery Control, and FLASH */
struct i2c_client *rtc; /* slave addr 0x0c */ struct i2c_client *rtc; /* slave addr 0x0c */
struct i2c_client *haptic; /* slave addr 0x90 */ struct i2c_client *haptic; /* slave addr 0x90 */
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment