Commit 424c3d4a authored by Liam Girdwood's avatar Liam Girdwood

Merge branch 'for-next' into for-linus

parents 02f8c6ae 88cda60e
This diff is collapsed.
...@@ -36,6 +36,29 @@ static struct regulator_desc dummy_desc = { ...@@ -36,6 +36,29 @@ static struct regulator_desc dummy_desc = {
.ops = &dummy_ops, .ops = &dummy_ops,
}; };
static int __devinit dummy_regulator_probe(struct platform_device *pdev)
{
int ret;
dummy_regulator_rdev = regulator_register(&dummy_desc, NULL,
&dummy_initdata, NULL);
if (IS_ERR(dummy_regulator_rdev)) {
ret = PTR_ERR(dummy_regulator_rdev);
pr_err("Failed to register regulator: %d\n", ret);
return ret;
}
return 0;
}
static struct platform_driver dummy_regulator_driver = {
.probe = dummy_regulator_probe,
.driver = {
.name = "reg-dummy",
.owner = THIS_MODULE,
},
};
static struct platform_device *dummy_pdev; static struct platform_device *dummy_pdev;
void __init regulator_dummy_init(void) void __init regulator_dummy_init(void)
...@@ -55,12 +78,9 @@ void __init regulator_dummy_init(void) ...@@ -55,12 +78,9 @@ void __init regulator_dummy_init(void)
return; return;
} }
dummy_regulator_rdev = regulator_register(&dummy_desc, NULL, ret = platform_driver_register(&dummy_regulator_driver);
&dummy_initdata, NULL); if (ret != 0) {
if (IS_ERR(dummy_regulator_rdev)) { pr_err("Failed to register dummy regulator driver: %d\n", ret);
ret = PTR_ERR(dummy_regulator_rdev);
pr_err("Failed to register regulator: %d\n", ret);
platform_device_unregister(dummy_pdev); platform_device_unregister(dummy_pdev);
return;
} }
} }
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#define TPS65911_REG_LDO7 11 #define TPS65911_REG_LDO7 11
#define TPS65911_REG_LDO8 12 #define TPS65911_REG_LDO8 12
#define TPS65910_NUM_REGULATOR 13
#define TPS65910_SUPPLY_STATE_ENABLED 0x1 #define TPS65910_SUPPLY_STATE_ENABLED 0x1
/* supported VIO voltages in milivolts */ /* supported VIO voltages in milivolts */
...@@ -264,11 +263,12 @@ static struct tps_info tps65911_regs[] = { ...@@ -264,11 +263,12 @@ static struct tps_info tps65911_regs[] = {
}; };
struct tps65910_reg { struct tps65910_reg {
struct regulator_desc desc[TPS65910_NUM_REGULATOR]; struct regulator_desc *desc;
struct tps65910 *mfd; struct tps65910 *mfd;
struct regulator_dev *rdev[TPS65910_NUM_REGULATOR]; struct regulator_dev **rdev;
struct tps_info *info[TPS65910_NUM_REGULATOR]; struct tps_info **info;
struct mutex mutex; struct mutex mutex;
int num_regulators;
int mode; int mode;
int (*get_ctrl_reg)(int); int (*get_ctrl_reg)(int);
}; };
...@@ -759,8 +759,13 @@ static int tps65910_list_voltage_dcdc(struct regulator_dev *dev, ...@@ -759,8 +759,13 @@ static int tps65910_list_voltage_dcdc(struct regulator_dev *dev,
mult = (selector / VDD1_2_NUM_VOLTS) + 1; mult = (selector / VDD1_2_NUM_VOLTS) + 1;
volt = VDD1_2_MIN_VOLT + volt = VDD1_2_MIN_VOLT +
(selector % VDD1_2_NUM_VOLTS) * VDD1_2_OFFSET; (selector % VDD1_2_NUM_VOLTS) * VDD1_2_OFFSET;
break;
case TPS65911_REG_VDDCTRL: case TPS65911_REG_VDDCTRL:
volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET); volt = VDDCTRL_MIN_VOLT + (selector * VDDCTRL_OFFSET);
break;
default:
BUG();
return -EINVAL;
} }
return volt * 100 * mult; return volt * 100 * mult;
...@@ -897,16 +902,42 @@ static __devinit int tps65910_probe(struct platform_device *pdev) ...@@ -897,16 +902,42 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
switch(tps65910_chip_id(tps65910)) { switch(tps65910_chip_id(tps65910)) {
case TPS65910: case TPS65910:
pmic->get_ctrl_reg = &tps65910_get_ctrl_register; pmic->get_ctrl_reg = &tps65910_get_ctrl_register;
pmic->num_regulators = ARRAY_SIZE(tps65910_regs);
info = tps65910_regs; info = tps65910_regs;
break;
case TPS65911: case TPS65911:
pmic->get_ctrl_reg = &tps65911_get_ctrl_register; pmic->get_ctrl_reg = &tps65911_get_ctrl_register;
pmic->num_regulators = ARRAY_SIZE(tps65911_regs);
info = tps65911_regs; info = tps65911_regs;
break;
default: default:
pr_err("Invalid tps chip version\n"); pr_err("Invalid tps chip version\n");
kfree(pmic);
return -ENODEV; return -ENODEV;
} }
for (i = 0; i < TPS65910_NUM_REGULATOR; i++, info++, reg_data++) { pmic->desc = kcalloc(pmic->num_regulators,
sizeof(struct regulator_desc), GFP_KERNEL);
if (!pmic->desc) {
err = -ENOMEM;
goto err_free_pmic;
}
pmic->info = kcalloc(pmic->num_regulators,
sizeof(struct tps_info *), GFP_KERNEL);
if (!pmic->info) {
err = -ENOMEM;
goto err_free_desc;
}
pmic->rdev = kcalloc(pmic->num_regulators,
sizeof(struct regulator_dev *), GFP_KERNEL);
if (!pmic->rdev) {
err = -ENOMEM;
goto err_free_info;
}
for (i = 0; i < pmic->num_regulators; i++, info++, reg_data++) {
/* Register the regulators */ /* Register the regulators */
pmic->info[i] = info; pmic->info[i] = info;
...@@ -938,7 +969,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev) ...@@ -938,7 +969,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
"failed to register %s regulator\n", "failed to register %s regulator\n",
pdev->name); pdev->name);
err = PTR_ERR(rdev); err = PTR_ERR(rdev);
goto err; goto err_unregister_regulator;
} }
/* Save regulator for cleanup */ /* Save regulator for cleanup */
...@@ -946,23 +977,31 @@ static __devinit int tps65910_probe(struct platform_device *pdev) ...@@ -946,23 +977,31 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
} }
return 0; return 0;
err: err_unregister_regulator:
while (--i >= 0) while (--i >= 0)
regulator_unregister(pmic->rdev[i]); regulator_unregister(pmic->rdev[i]);
kfree(pmic->rdev);
err_free_info:
kfree(pmic->info);
err_free_desc:
kfree(pmic->desc);
err_free_pmic:
kfree(pmic); kfree(pmic);
return err; return err;
} }
static int __devexit tps65910_remove(struct platform_device *pdev) static int __devexit tps65910_remove(struct platform_device *pdev)
{ {
struct tps65910_reg *tps65910_reg = platform_get_drvdata(pdev); struct tps65910_reg *pmic = platform_get_drvdata(pdev);
int i; int i;
for (i = 0; i < TPS65910_NUM_REGULATOR; i++) for (i = 0; i < pmic->num_regulators; i++)
regulator_unregister(tps65910_reg->rdev[i]); regulator_unregister(pmic->rdev[i]);
kfree(tps65910_reg); kfree(pmic->rdev);
kfree(pmic->info);
kfree(pmic->desc);
kfree(pmic);
return 0; return 0;
} }
......
...@@ -835,8 +835,8 @@ static struct regulator_ops twlsmps_ops = { ...@@ -835,8 +835,8 @@ static struct regulator_ops twlsmps_ops = {
remap_conf) \ remap_conf) \
TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \ TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \
remap_conf, TWL4030, twl4030fixed_ops) remap_conf, TWL4030, twl4030fixed_ops)
#define TWL6030_FIXED_LDO(label, offset, mVolts, num, turnon_delay) \ #define TWL6030_FIXED_LDO(label, offset, mVolts, turnon_delay) \
TWL_FIXED_LDO(label, offset, mVolts, num, turnon_delay, \ TWL_FIXED_LDO(label, offset, mVolts, 0x0, turnon_delay, \
0x0, TWL6030, twl6030fixed_ops) 0x0, TWL6030, twl6030fixed_ops)
#define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) { \ #define TWL4030_ADJUSTABLE_LDO(label, offset, num, turnon_delay, remap_conf) { \
...@@ -856,24 +856,22 @@ static struct regulator_ops twlsmps_ops = { ...@@ -856,24 +856,22 @@ static struct regulator_ops twlsmps_ops = {
}, \ }, \
} }
#define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts, num) { \ #define TWL6030_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \
.base = offset, \ .base = offset, \
.id = num, \
.min_mV = min_mVolts, \ .min_mV = min_mVolts, \
.max_mV = max_mVolts, \ .max_mV = max_mVolts, \
.desc = { \ .desc = { \
.name = #label, \ .name = #label, \
.id = TWL6030_REG_##label, \ .id = TWL6030_REG_##label, \
.n_voltages = (max_mVolts - min_mVolts)/100, \ .n_voltages = (max_mVolts - min_mVolts)/100 + 1, \
.ops = &twl6030ldo_ops, \ .ops = &twl6030ldo_ops, \
.type = REGULATOR_VOLTAGE, \ .type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \ .owner = THIS_MODULE, \
}, \ }, \
} }
#define TWL6025_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts, num) { \ #define TWL6025_ADJUSTABLE_LDO(label, offset, min_mVolts, max_mVolts) { \
.base = offset, \ .base = offset, \
.id = num, \
.min_mV = min_mVolts, \ .min_mV = min_mVolts, \
.max_mV = max_mVolts, \ .max_mV = max_mVolts, \
.desc = { \ .desc = { \
...@@ -903,9 +901,8 @@ static struct regulator_ops twlsmps_ops = { ...@@ -903,9 +901,8 @@ static struct regulator_ops twlsmps_ops = {
}, \ }, \
} }
#define TWL6030_FIXED_RESOURCE(label, offset, num, turnon_delay) { \ #define TWL6030_FIXED_RESOURCE(label, offset, turnon_delay) { \
.base = offset, \ .base = offset, \
.id = num, \
.delay = turnon_delay, \ .delay = turnon_delay, \
.desc = { \ .desc = { \
.name = #label, \ .name = #label, \
...@@ -916,9 +913,8 @@ static struct regulator_ops twlsmps_ops = { ...@@ -916,9 +913,8 @@ static struct regulator_ops twlsmps_ops = {
}, \ }, \
} }
#define TWL6025_ADJUSTABLE_SMPS(label, offset, num) { \ #define TWL6025_ADJUSTABLE_SMPS(label, offset) { \
.base = offset, \ .base = offset, \
.id = num, \
.min_mV = 600, \ .min_mV = 600, \
.max_mV = 2100, \ .max_mV = 2100, \
.desc = { \ .desc = { \
...@@ -961,32 +957,32 @@ static struct twlreg_info twl_regs[] = { ...@@ -961,32 +957,32 @@ static struct twlreg_info twl_regs[] = {
/* 6030 REG with base as PMC Slave Misc : 0x0030 */ /* 6030 REG with base as PMC Slave Misc : 0x0030 */
/* Turnon-delay and remap configuration values for 6030 are not /* Turnon-delay and remap configuration values for 6030 are not
verified since the specification is not public */ verified since the specification is not public */
TWL6030_ADJUSTABLE_LDO(VAUX1_6030, 0x54, 1000, 3300, 1), TWL6030_ADJUSTABLE_LDO(VAUX1_6030, 0x54, 1000, 3300),
TWL6030_ADJUSTABLE_LDO(VAUX2_6030, 0x58, 1000, 3300, 2), TWL6030_ADJUSTABLE_LDO(VAUX2_6030, 0x58, 1000, 3300),
TWL6030_ADJUSTABLE_LDO(VAUX3_6030, 0x5c, 1000, 3300, 3), TWL6030_ADJUSTABLE_LDO(VAUX3_6030, 0x5c, 1000, 3300),
TWL6030_ADJUSTABLE_LDO(VMMC, 0x68, 1000, 3300, 4), TWL6030_ADJUSTABLE_LDO(VMMC, 0x68, 1000, 3300),
TWL6030_ADJUSTABLE_LDO(VPP, 0x6c, 1000, 3300, 5), TWL6030_ADJUSTABLE_LDO(VPP, 0x6c, 1000, 3300),
TWL6030_ADJUSTABLE_LDO(VUSIM, 0x74, 1000, 3300, 7), TWL6030_ADJUSTABLE_LDO(VUSIM, 0x74, 1000, 3300),
TWL6030_FIXED_LDO(VANA, 0x50, 2100, 15, 0), TWL6030_FIXED_LDO(VANA, 0x50, 2100, 0),
TWL6030_FIXED_LDO(VCXIO, 0x60, 1800, 16, 0), TWL6030_FIXED_LDO(VCXIO, 0x60, 1800, 0),
TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 17, 0), TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 0),
TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 18, 0), TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 0),
TWL6030_FIXED_RESOURCE(CLK32KG, 0x8C, 48, 0), TWL6030_FIXED_RESOURCE(CLK32KG, 0x8C, 0),
/* 6025 are renamed compared to 6030 versions */ /* 6025 are renamed compared to 6030 versions */
TWL6025_ADJUSTABLE_LDO(LDO2, 0x54, 1000, 3300, 1), TWL6025_ADJUSTABLE_LDO(LDO2, 0x54, 1000, 3300),
TWL6025_ADJUSTABLE_LDO(LDO4, 0x58, 1000, 3300, 2), TWL6025_ADJUSTABLE_LDO(LDO4, 0x58, 1000, 3300),
TWL6025_ADJUSTABLE_LDO(LDO3, 0x5c, 1000, 3300, 3), TWL6025_ADJUSTABLE_LDO(LDO3, 0x5c, 1000, 3300),
TWL6025_ADJUSTABLE_LDO(LDO5, 0x68, 1000, 3300, 4), TWL6025_ADJUSTABLE_LDO(LDO5, 0x68, 1000, 3300),
TWL6025_ADJUSTABLE_LDO(LDO1, 0x6c, 1000, 3300, 5), TWL6025_ADJUSTABLE_LDO(LDO1, 0x6c, 1000, 3300),
TWL6025_ADJUSTABLE_LDO(LDO7, 0x74, 1000, 3300, 7), TWL6025_ADJUSTABLE_LDO(LDO7, 0x74, 1000, 3300),
TWL6025_ADJUSTABLE_LDO(LDO6, 0x60, 1000, 3300, 16), TWL6025_ADJUSTABLE_LDO(LDO6, 0x60, 1000, 3300),
TWL6025_ADJUSTABLE_LDO(LDOLN, 0x64, 1000, 3300, 17), TWL6025_ADJUSTABLE_LDO(LDOLN, 0x64, 1000, 3300),
TWL6025_ADJUSTABLE_LDO(LDOUSB, 0x70, 1000, 3300, 18), TWL6025_ADJUSTABLE_LDO(LDOUSB, 0x70, 1000, 3300),
TWL6025_ADJUSTABLE_SMPS(SMPS3, 0x34, 1), TWL6025_ADJUSTABLE_SMPS(SMPS3, 0x34),
TWL6025_ADJUSTABLE_SMPS(SMPS4, 0x10, 2), TWL6025_ADJUSTABLE_SMPS(SMPS4, 0x10),
TWL6025_ADJUSTABLE_SMPS(VIO, 0x16, 3), TWL6025_ADJUSTABLE_SMPS(VIO, 0x16),
}; };
static u8 twl_get_smps_offset(void) static u8 twl_get_smps_offset(void)
......
...@@ -267,23 +267,6 @@ static int wm831x_buckv_select_min_voltage(struct regulator_dev *rdev, ...@@ -267,23 +267,6 @@ static int wm831x_buckv_select_min_voltage(struct regulator_dev *rdev,
return vsel; return vsel;
} }
static int wm831x_buckv_select_max_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
u16 vsel;
if (max_uV < 600000 || max_uV > 1800000)
return -EINVAL;
vsel = ((max_uV - 600000) / 12500) + 8;
if (wm831x_buckv_list_voltage(rdev, vsel) < min_uV ||
wm831x_buckv_list_voltage(rdev, vsel) < max_uV)
return -EINVAL;
return vsel;
}
static int wm831x_buckv_set_dvs(struct regulator_dev *rdev, int state) static int wm831x_buckv_set_dvs(struct regulator_dev *rdev, int state)
{ {
struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev); struct wm831x_dcdc *dcdc = rdev_get_drvdata(rdev);
...@@ -338,28 +321,23 @@ static int wm831x_buckv_set_voltage(struct regulator_dev *rdev, ...@@ -338,28 +321,23 @@ static int wm831x_buckv_set_voltage(struct regulator_dev *rdev,
if (ret < 0) if (ret < 0)
return ret; return ret;
/* Set the high voltage as the DVS voltage. This is optimised /*
* for CPUfreq usage, most processors will keep the maximum * If this VSEL is higher than the last one we've seen then
* voltage constant and lower the minimum with the frequency. */ * remember it as the DVS VSEL. This is optimised for CPUfreq
vsel = wm831x_buckv_select_max_voltage(rdev, min_uV, max_uV); * usage where we want to get to the highest voltage very
if (vsel < 0) { * quickly.
/* This should never happen - at worst the same vsel */
* should be chosen */ if (vsel > dcdc->dvs_vsel) {
WARN_ON(vsel < 0); ret = wm831x_set_bits(wm831x, dvs_reg,
return 0; WM831X_DC1_DVS_VSEL_MASK,
dcdc->dvs_vsel);
if (ret == 0)
dcdc->dvs_vsel = vsel;
else
dev_warn(wm831x->dev,
"Failed to set DCDC DVS VSEL: %d\n", ret);
} }
/* Don't bother if it's the same VSEL we're already using */
if (vsel == dcdc->on_vsel)
return 0;
ret = wm831x_set_bits(wm831x, dvs_reg, WM831X_DC1_DVS_VSEL_MASK, vsel);
if (ret == 0)
dcdc->dvs_vsel = vsel;
else
dev_warn(wm831x->dev, "Failed to set DCDC DVS VSEL: %d\n",
ret);
return 0; return 0;
} }
...@@ -456,27 +434,6 @@ static __devinit void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc, ...@@ -456,27 +434,6 @@ static __devinit void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc,
if (!pdata || !pdata->dvs_gpio) if (!pdata || !pdata->dvs_gpio)
return; return;
switch (pdata->dvs_control_src) {
case 1:
ctrl = 2 << WM831X_DC1_DVS_SRC_SHIFT;
break;
case 2:
ctrl = 3 << WM831X_DC1_DVS_SRC_SHIFT;
break;
default:
dev_err(wm831x->dev, "Invalid DVS control source %d for %s\n",
pdata->dvs_control_src, dcdc->name);
return;
}
ret = wm831x_set_bits(wm831x, dcdc->base + WM831X_DCDC_DVS_CONTROL,
WM831X_DC1_DVS_SRC_MASK, ctrl);
if (ret < 0) {
dev_err(wm831x->dev, "Failed to set %s DVS source: %d\n",
dcdc->name, ret);
return;
}
ret = gpio_request(pdata->dvs_gpio, "DCDC DVS"); ret = gpio_request(pdata->dvs_gpio, "DCDC DVS");
if (ret < 0) { if (ret < 0) {
dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n", dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n",
...@@ -498,17 +455,57 @@ static __devinit void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc, ...@@ -498,17 +455,57 @@ static __devinit void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc,
} }
dcdc->dvs_gpio = pdata->dvs_gpio; dcdc->dvs_gpio = pdata->dvs_gpio;
switch (pdata->dvs_control_src) {
case 1:
ctrl = 2 << WM831X_DC1_DVS_SRC_SHIFT;
break;
case 2:
ctrl = 3 << WM831X_DC1_DVS_SRC_SHIFT;
break;
default:
dev_err(wm831x->dev, "Invalid DVS control source %d for %s\n",
pdata->dvs_control_src, dcdc->name);
return;
}
/* If DVS_VSEL is set to the minimum value then raise it to ON_VSEL
* to make bootstrapping a bit smoother.
*/
if (!dcdc->dvs_vsel) {
ret = wm831x_set_bits(wm831x,
dcdc->base + WM831X_DCDC_DVS_CONTROL,
WM831X_DC1_DVS_VSEL_MASK, dcdc->on_vsel);
if (ret == 0)
dcdc->dvs_vsel = dcdc->on_vsel;
else
dev_warn(wm831x->dev, "Failed to set DVS_VSEL: %d\n",
ret);
}
ret = wm831x_set_bits(wm831x, dcdc->base + WM831X_DCDC_DVS_CONTROL,
WM831X_DC1_DVS_SRC_MASK, ctrl);
if (ret < 0) {
dev_err(wm831x->dev, "Failed to set %s DVS source: %d\n",
dcdc->name, ret);
}
} }
static __devinit int wm831x_buckv_probe(struct platform_device *pdev) static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
{ {
struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
struct wm831x_pdata *pdata = wm831x->dev->platform_data; struct wm831x_pdata *pdata = wm831x->dev->platform_data;
int id = pdev->id % ARRAY_SIZE(pdata->dcdc); int id;
struct wm831x_dcdc *dcdc; struct wm831x_dcdc *dcdc;
struct resource *res; struct resource *res;
int ret, irq; int ret, irq;
if (pdata && pdata->wm831x_num)
id = (pdata->wm831x_num * 10) + 1;
else
id = 0;
id = pdev->id - id;
dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1); dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1);
if (pdata == NULL || pdata->dcdc[id] == NULL) if (pdata == NULL || pdata->dcdc[id] == NULL)
...@@ -545,7 +542,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev) ...@@ -545,7 +542,7 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev)
} }
dcdc->on_vsel = ret & WM831X_DC1_ON_VSEL_MASK; dcdc->on_vsel = ret & WM831X_DC1_ON_VSEL_MASK;
ret = wm831x_reg_read(wm831x, dcdc->base + WM831X_DCDC_ON_CONFIG); ret = wm831x_reg_read(wm831x, dcdc->base + WM831X_DCDC_DVS_CONTROL);
if (ret < 0) { if (ret < 0) {
dev_err(wm831x->dev, "Failed to read DVS VSEL: %d\n", ret); dev_err(wm831x->dev, "Failed to read DVS VSEL: %d\n", ret);
goto err; goto err;
...@@ -709,11 +706,17 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev) ...@@ -709,11 +706,17 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev)
{ {
struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
struct wm831x_pdata *pdata = wm831x->dev->platform_data; struct wm831x_pdata *pdata = wm831x->dev->platform_data;
int id = pdev->id % ARRAY_SIZE(pdata->dcdc); int id;
struct wm831x_dcdc *dcdc; struct wm831x_dcdc *dcdc;
struct resource *res; struct resource *res;
int ret, irq; int ret, irq;
if (pdata && pdata->wm831x_num)
id = (pdata->wm831x_num * 10) + 1;
else
id = 0;
id = pdev->id - id;
dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1); dev_dbg(&pdev->dev, "Probing DCDC%d\n", id + 1);
if (pdata == NULL || pdata->dcdc[id] == NULL) if (pdata == NULL || pdata->dcdc[id] == NULL)
...@@ -1046,3 +1049,4 @@ MODULE_DESCRIPTION("WM831x DC-DC convertor driver"); ...@@ -1046,3 +1049,4 @@ MODULE_DESCRIPTION("WM831x DC-DC convertor driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:wm831x-buckv"); MODULE_ALIAS("platform:wm831x-buckv");
MODULE_ALIAS("platform:wm831x-buckp"); MODULE_ALIAS("platform:wm831x-buckp");
MODULE_ALIAS("platform:wm831x-epe");
...@@ -310,11 +310,17 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev) ...@@ -310,11 +310,17 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
{ {
struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
struct wm831x_pdata *pdata = wm831x->dev->platform_data; struct wm831x_pdata *pdata = wm831x->dev->platform_data;
int id = pdev->id % ARRAY_SIZE(pdata->ldo); int id;
struct wm831x_ldo *ldo; struct wm831x_ldo *ldo;
struct resource *res; struct resource *res;
int ret, irq; int ret, irq;
if (pdata && pdata->wm831x_num)
id = (pdata->wm831x_num * 10) + 1;
else
id = 0;
id = pdev->id - id;
dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
if (pdata == NULL || pdata->ldo[id] == NULL) if (pdata == NULL || pdata->ldo[id] == NULL)
...@@ -574,11 +580,17 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev) ...@@ -574,11 +580,17 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
{ {
struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
struct wm831x_pdata *pdata = wm831x->dev->platform_data; struct wm831x_pdata *pdata = wm831x->dev->platform_data;
int id = pdev->id % ARRAY_SIZE(pdata->ldo); int id;
struct wm831x_ldo *ldo; struct wm831x_ldo *ldo;
struct resource *res; struct resource *res;
int ret, irq; int ret, irq;
if (pdata && pdata->wm831x_num)
id = (pdata->wm831x_num * 10) + 1;
else
id = 0;
id = pdev->id - id;
dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
if (pdata == NULL || pdata->ldo[id] == NULL) if (pdata == NULL || pdata->ldo[id] == NULL)
...@@ -764,11 +776,18 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev) ...@@ -764,11 +776,18 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
{ {
struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent);
struct wm831x_pdata *pdata = wm831x->dev->platform_data; struct wm831x_pdata *pdata = wm831x->dev->platform_data;
int id = pdev->id % ARRAY_SIZE(pdata->ldo); int id;
struct wm831x_ldo *ldo; struct wm831x_ldo *ldo;
struct resource *res; struct resource *res;
int ret; int ret;
if (pdata && pdata->wm831x_num)
id = (pdata->wm831x_num * 10) + 1;
else
id = 0;
id = pdev->id - id;
dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1); dev_dbg(&pdev->dev, "Probing LDO%d\n", id + 1);
if (pdata == NULL || pdata->ldo[id] == NULL) if (pdata == NULL || pdata->ldo[id] == NULL)
......
...@@ -43,7 +43,7 @@ static int wm8994_ldo_enable(struct regulator_dev *rdev) ...@@ -43,7 +43,7 @@ static int wm8994_ldo_enable(struct regulator_dev *rdev)
if (!ldo->enable) if (!ldo->enable)
return 0; return 0;
gpio_set_value(ldo->enable, 1); gpio_set_value_cansleep(ldo->enable, 1);
ldo->is_enabled = true; ldo->is_enabled = true;
return 0; return 0;
...@@ -57,7 +57,7 @@ static int wm8994_ldo_disable(struct regulator_dev *rdev) ...@@ -57,7 +57,7 @@ static int wm8994_ldo_disable(struct regulator_dev *rdev)
if (!ldo->enable) if (!ldo->enable)
return -EINVAL; return -EINVAL;
gpio_set_value(ldo->enable, 0); gpio_set_value_cansleep(ldo->enable, 0);
ldo->is_enabled = false; ldo->is_enabled = false;
return 0; return 0;
......
...@@ -122,6 +122,9 @@ struct regulator; ...@@ -122,6 +122,9 @@ struct regulator;
struct regulator_bulk_data { struct regulator_bulk_data {
const char *supply; const char *supply;
struct regulator *consumer; struct regulator *consumer;
/* Internal use */
int ret;
}; };
#if defined(CONFIG_REGULATOR) #if defined(CONFIG_REGULATOR)
......
...@@ -188,18 +188,16 @@ struct regulator_dev { ...@@ -188,18 +188,16 @@ struct regulator_dev {
/* lists we belong to */ /* lists we belong to */
struct list_head list; /* list of all regulators */ struct list_head list; /* list of all regulators */
struct list_head slist; /* list of supplied regulators */
/* lists we own */ /* lists we own */
struct list_head consumer_list; /* consumers we supply */ struct list_head consumer_list; /* consumers we supply */
struct list_head supply_list; /* regulators we supply */
struct blocking_notifier_head notifier; struct blocking_notifier_head notifier;
struct mutex mutex; /* consumer lock */ struct mutex mutex; /* consumer lock */
struct module *owner; struct module *owner;
struct device dev; struct device dev;
struct regulation_constraints *constraints; struct regulation_constraints *constraints;
struct regulator_dev *supply; /* for tree */ struct regulator *supply; /* for tree */
void *reg_data; /* regulator_dev data */ void *reg_data; /* regulator_dev data */
......
...@@ -226,11 +226,13 @@ static const char *aic3x_adc_hpf[] = ...@@ -226,11 +226,13 @@ static const char *aic3x_adc_hpf[] =
#define RDAC_ENUM 1 #define RDAC_ENUM 1
#define LHPCOM_ENUM 2 #define LHPCOM_ENUM 2
#define RHPCOM_ENUM 3 #define RHPCOM_ENUM 3
#define LINE1L_ENUM 4 #define LINE1L_2_L_ENUM 4
#define LINE1R_ENUM 5 #define LINE1L_2_R_ENUM 5
#define LINE2L_ENUM 6 #define LINE1R_2_L_ENUM 6
#define LINE2R_ENUM 7 #define LINE1R_2_R_ENUM 7
#define ADC_HPF_ENUM 8 #define LINE2L_ENUM 8
#define LINE2R_ENUM 9
#define ADC_HPF_ENUM 10
static const struct soc_enum aic3x_enum[] = { static const struct soc_enum aic3x_enum[] = {
SOC_ENUM_SINGLE(DAC_LINE_MUX, 6, 3, aic3x_left_dac_mux), SOC_ENUM_SINGLE(DAC_LINE_MUX, 6, 3, aic3x_left_dac_mux),
...@@ -238,6 +240,8 @@ static const struct soc_enum aic3x_enum[] = { ...@@ -238,6 +240,8 @@ static const struct soc_enum aic3x_enum[] = {
SOC_ENUM_SINGLE(HPLCOM_CFG, 4, 3, aic3x_left_hpcom_mux), SOC_ENUM_SINGLE(HPLCOM_CFG, 4, 3, aic3x_left_hpcom_mux),
SOC_ENUM_SINGLE(HPRCOM_CFG, 3, 5, aic3x_right_hpcom_mux), SOC_ENUM_SINGLE(HPRCOM_CFG, 3, 5, aic3x_right_hpcom_mux),
SOC_ENUM_SINGLE(LINE1L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), SOC_ENUM_SINGLE(LINE1L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux),
SOC_ENUM_SINGLE(LINE1L_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux),
SOC_ENUM_SINGLE(LINE1R_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux),
SOC_ENUM_SINGLE(LINE1R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), SOC_ENUM_SINGLE(LINE1R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux),
SOC_ENUM_SINGLE(LINE2L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux), SOC_ENUM_SINGLE(LINE2L_2_LADC_CTRL, 7, 2, aic3x_linein_mode_mux),
SOC_ENUM_SINGLE(LINE2R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux), SOC_ENUM_SINGLE(LINE2R_2_RADC_CTRL, 7, 2, aic3x_linein_mode_mux),
...@@ -490,12 +494,16 @@ static const struct snd_kcontrol_new aic3x_right_pga_mixer_controls[] = { ...@@ -490,12 +494,16 @@ static const struct snd_kcontrol_new aic3x_right_pga_mixer_controls[] = {
}; };
/* Left Line1 Mux */ /* Left Line1 Mux */
static const struct snd_kcontrol_new aic3x_left_line1_mux_controls = static const struct snd_kcontrol_new aic3x_left_line1l_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE1L_ENUM]); SOC_DAPM_ENUM("Route", aic3x_enum[LINE1L_2_L_ENUM]);
static const struct snd_kcontrol_new aic3x_right_line1l_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE1L_2_R_ENUM]);
/* Right Line1 Mux */ /* Right Line1 Mux */
static const struct snd_kcontrol_new aic3x_right_line1_mux_controls = static const struct snd_kcontrol_new aic3x_right_line1r_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE1R_ENUM]); SOC_DAPM_ENUM("Route", aic3x_enum[LINE1R_2_R_ENUM]);
static const struct snd_kcontrol_new aic3x_left_line1r_mux_controls =
SOC_DAPM_ENUM("Route", aic3x_enum[LINE1R_2_L_ENUM]);
/* Left Line2 Mux */ /* Left Line2 Mux */
static const struct snd_kcontrol_new aic3x_left_line2_mux_controls = static const struct snd_kcontrol_new aic3x_left_line2_mux_controls =
...@@ -535,9 +543,9 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { ...@@ -535,9 +543,9 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {
&aic3x_left_pga_mixer_controls[0], &aic3x_left_pga_mixer_controls[0],
ARRAY_SIZE(aic3x_left_pga_mixer_controls)), ARRAY_SIZE(aic3x_left_pga_mixer_controls)),
SND_SOC_DAPM_MUX("Left Line1L Mux", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MUX("Left Line1L Mux", SND_SOC_NOPM, 0, 0,
&aic3x_left_line1_mux_controls), &aic3x_left_line1l_mux_controls),
SND_SOC_DAPM_MUX("Left Line1R Mux", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MUX("Left Line1R Mux", SND_SOC_NOPM, 0, 0,
&aic3x_left_line1_mux_controls), &aic3x_left_line1r_mux_controls),
SND_SOC_DAPM_MUX("Left Line2L Mux", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MUX("Left Line2L Mux", SND_SOC_NOPM, 0, 0,
&aic3x_left_line2_mux_controls), &aic3x_left_line2_mux_controls),
...@@ -548,9 +556,9 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = { ...@@ -548,9 +556,9 @@ static const struct snd_soc_dapm_widget aic3x_dapm_widgets[] = {
&aic3x_right_pga_mixer_controls[0], &aic3x_right_pga_mixer_controls[0],
ARRAY_SIZE(aic3x_right_pga_mixer_controls)), ARRAY_SIZE(aic3x_right_pga_mixer_controls)),
SND_SOC_DAPM_MUX("Right Line1L Mux", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MUX("Right Line1L Mux", SND_SOC_NOPM, 0, 0,
&aic3x_right_line1_mux_controls), &aic3x_right_line1l_mux_controls),
SND_SOC_DAPM_MUX("Right Line1R Mux", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MUX("Right Line1R Mux", SND_SOC_NOPM, 0, 0,
&aic3x_right_line1_mux_controls), &aic3x_right_line1r_mux_controls),
SND_SOC_DAPM_MUX("Right Line2R Mux", SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MUX("Right Line2R Mux", SND_SOC_NOPM, 0, 0,
&aic3x_right_line2_mux_controls), &aic3x_right_line2_mux_controls),
......
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