diff options
author | Laxman Dewangan <ldewangan@nvidia.com> | 2012-09-11 20:14:54 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-09-12 10:20:33 -0700 |
commit | c2970639a7ec5e3b22126a6534ee25e9b586acc7 (patch) | |
tree | e197b2f168b73416c9298b88e15b5cafb2725622 /drivers/regulator | |
parent | e0452d541d14352cb72a797d5c1639403b0da79c (diff) |
regulator: palmas: support for external control of regulator outputs
Add support to control different regulator output through
external control signal.
Change-Id: Id3b7d22bf113cb102163c6b97388530ca591e586
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: http://git-master/r/131452
Tested-by: Mallikarjun Kasoju <mkasoju@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/palmas-regulator.c | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index df025ebfecbb..a405ab796606 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c @@ -28,6 +28,7 @@ struct regs_info { u8 vsel_addr; u8 ctrl_addr; u8 tstep_addr; + int sleep_id; }; static const struct regs_info palmas_regs_info[] = { @@ -36,130 +37,156 @@ static const struct regs_info palmas_regs_info[] = { .vsel_addr = PALMAS_SMPS12_VOLTAGE, .ctrl_addr = PALMAS_SMPS12_CTRL, .tstep_addr = PALMAS_SMPS12_TSTEP, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS12, }, { .name = "SMPS123", .vsel_addr = PALMAS_SMPS12_VOLTAGE, .ctrl_addr = PALMAS_SMPS12_CTRL, .tstep_addr = PALMAS_SMPS12_TSTEP, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS12, }, { .name = "SMPS3", .vsel_addr = PALMAS_SMPS3_VOLTAGE, .ctrl_addr = PALMAS_SMPS3_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS3, }, { .name = "SMPS45", .vsel_addr = PALMAS_SMPS45_VOLTAGE, .ctrl_addr = PALMAS_SMPS45_CTRL, .tstep_addr = PALMAS_SMPS45_TSTEP, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS45, }, { .name = "SMPS457", .vsel_addr = PALMAS_SMPS45_VOLTAGE, .ctrl_addr = PALMAS_SMPS45_CTRL, .tstep_addr = PALMAS_SMPS45_TSTEP, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS45, }, { .name = "SMPS6", .vsel_addr = PALMAS_SMPS6_VOLTAGE, .ctrl_addr = PALMAS_SMPS6_CTRL, .tstep_addr = PALMAS_SMPS6_TSTEP, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS6, }, { .name = "SMPS7", .vsel_addr = PALMAS_SMPS7_VOLTAGE, .ctrl_addr = PALMAS_SMPS7_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS7, }, { .name = "SMPS8", .vsel_addr = PALMAS_SMPS8_VOLTAGE, .ctrl_addr = PALMAS_SMPS8_CTRL, .tstep_addr = PALMAS_SMPS8_TSTEP, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS8, }, { .name = "SMPS9", .vsel_addr = PALMAS_SMPS9_VOLTAGE, .ctrl_addr = PALMAS_SMPS9_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS9, }, { .name = "SMPS10", .ctrl_addr = PALMAS_SMPS10_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SMPS10, }, { .name = "LDO1", .vsel_addr = PALMAS_LDO1_VOLTAGE, .ctrl_addr = PALMAS_LDO1_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDO1, }, { .name = "LDO2", .vsel_addr = PALMAS_LDO2_VOLTAGE, .ctrl_addr = PALMAS_LDO2_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDO2, }, { .name = "LDO3", .vsel_addr = PALMAS_LDO3_VOLTAGE, .ctrl_addr = PALMAS_LDO3_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDO3, }, { .name = "LDO4", .vsel_addr = PALMAS_LDO4_VOLTAGE, .ctrl_addr = PALMAS_LDO4_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDO4, }, { .name = "LDO5", .vsel_addr = PALMAS_LDO5_VOLTAGE, .ctrl_addr = PALMAS_LDO5_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDO5, }, { .name = "LDO6", .vsel_addr = PALMAS_LDO6_VOLTAGE, .ctrl_addr = PALMAS_LDO6_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDO6, }, { .name = "LDO7", .vsel_addr = PALMAS_LDO7_VOLTAGE, .ctrl_addr = PALMAS_LDO7_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDO7, }, { .name = "LDO8", .vsel_addr = PALMAS_LDO8_VOLTAGE, .ctrl_addr = PALMAS_LDO8_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDO8, }, { .name = "LDO9", .vsel_addr = PALMAS_LDO9_VOLTAGE, .ctrl_addr = PALMAS_LDO9_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDO9, }, { .name = "LDOLN", .vsel_addr = PALMAS_LDOLN_VOLTAGE, .ctrl_addr = PALMAS_LDOLN_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDOLN, }, { .name = "LDOUSB", .vsel_addr = PALMAS_LDOUSB_VOLTAGE, .ctrl_addr = PALMAS_LDOUSB_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_LDOUSB, }, { .name = "REGEN1", .ctrl_addr = PALMAS_REGEN1_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_REGEN1, }, { .name = "REGEN2", .ctrl_addr = PALMAS_REGEN2_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_REGEN2, }, { .name = "REGEN3", .ctrl_addr = PALMAS_REGEN3_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_REGEN3, }, { .name = "SYSEN1", .ctrl_addr = PALMAS_SYSEN1_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SYSEN1, }, { .name = "SYSEN2", .ctrl_addr = PALMAS_SYSEN2_CTRL, + .sleep_id = PALMAS_SLEEP_REQSTR_ID_SYSEN2, }, }; @@ -677,6 +704,17 @@ static int palmas_smps_init(struct palmas *palmas, int id, if (ret) return ret; + if ((id != PALMAS_REG_SMPS10) && reg_init->roof_floor) { + int sleep_id = palmas_regs_info[id].sleep_id; + ret = palmas_ext_power_req_config(palmas, sleep_id, + reg_init->roof_floor, true); + if (ret < 0) { + dev_err(palmas->dev, + "Error in configuring external control\n"); + return ret; + } + } + if (palmas_regs_info[id].tstep_addr && reg_init->tstep) { addr = palmas_regs_info[id].tstep_addr; @@ -724,6 +762,18 @@ static int palmas_ldo_init(struct palmas *palmas, int id, if (ret) return ret; + if (reg_init->roof_floor) { + int sleep_id = palmas_regs_info[id].sleep_id; + + ret = palmas_ext_power_req_config(palmas, sleep_id, + reg_init->roof_floor, true); + if (ret < 0) { + dev_err(palmas->dev, + "Error in configuring external control\n"); + return ret; + } + } + return 0; } @@ -746,7 +796,21 @@ static int palmas_extreg_init(struct palmas *palmas, int id, reg &= ~PALMAS_REGEN1_CTRL_MODE_SLEEP; ret = palmas_resource_write(palmas, addr, reg); - return ret; + if (ret < 0) + return ret; + + if (reg_init->roof_floor) { + int sleep_id = palmas_regs_info[id].sleep_id; + + ret = palmas_ext_power_req_config(palmas, sleep_id, + reg_init->roof_floor, true); + if (ret < 0) { + dev_err(palmas->dev, + "Error in configuring external control\n"); + return ret; + } + } + return 0; } static __devinit int palmas_probe(struct platform_device *pdev) |