summaryrefslogtreecommitdiffstats
path: root/drivers/regulator/palmas-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-06-06 20:01:38 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-06-08 07:36:38 +0800
commitfedd89b1aafd6b2bf7c0b4009fd616a02484ae80 (patch)
tree50e89e70e885d2a42a5aa2c463ce0515b35db7f8 /drivers/regulator/palmas-regulator.c
parent999f0c7cb8e7c378bd1f3fcd56cf8dc5a30c83e4 (diff)
downloadtalos-obmc-linux-fedd89b1aafd6b2bf7c0b4009fd616a02484ae80.tar.gz
talos-obmc-linux-fedd89b1aafd6b2bf7c0b4009fd616a02484ae80.zip
regulator: palmas: Slightly code change for better readability
It's a little bit hard to read that the "else" case means id == PALMAS_REG_SMPS10. if (id != PALMAS_REG_SMPS10){ do something for the cases id != PALMAS_REG_SMPS10; } else { do something for the case id == PALMAS_REG_SMPS10; } This patch changes above syntax to switch statement. Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Graeme Gregory <gg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator/palmas-regulator.c')
-rw-r--r--drivers/regulator/palmas-regulator.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c
index 1a0924d81b2a..55267bbfcd9c 100644
--- a/drivers/regulator/palmas-regulator.c
+++ b/drivers/regulator/palmas-regulator.c
@@ -516,7 +516,15 @@ static int palmas_smps_init(struct palmas *palmas, int id,
if (ret)
return ret;
- if (id != PALMAS_REG_SMPS10) {
+ switch (id) {
+ case PALMAS_REG_SMPS10:
+ if (reg_init->mode_sleep) {
+ reg &= ~PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK;
+ reg |= reg_init->mode_sleep <<
+ PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT;
+ }
+ break;
+ default:
if (reg_init->warm_reset)
reg |= PALMAS_SMPS12_CTRL_WR_S;
@@ -528,14 +536,8 @@ static int palmas_smps_init(struct palmas *palmas, int id,
reg |= reg_init->mode_sleep <<
PALMAS_SMPS12_CTRL_MODE_SLEEP_SHIFT;
}
- } else {
- if (reg_init->mode_sleep) {
- reg &= ~PALMAS_SMPS10_CTRL_MODE_SLEEP_MASK;
- reg |= reg_init->mode_sleep <<
- PALMAS_SMPS10_CTRL_MODE_SLEEP_SHIFT;
- }
-
}
+
ret = palmas_smps_write(palmas, addr, reg);
if (ret)
return ret;
@@ -659,10 +661,8 @@ static __devinit int palmas_probe(struct platform_device *pdev)
pmic->desc[id].name = palmas_regs_info[id].name;
pmic->desc[id].id = id;
- if (id != PALMAS_REG_SMPS10) {
- pmic->desc[id].ops = &palmas_ops_smps;
- pmic->desc[id].n_voltages = PALMAS_SMPS_NUM_VOLTAGES;
- } else {
+ switch (id) {
+ case PALMAS_REG_SMPS10:
pmic->desc[id].n_voltages = PALMAS_SMPS10_NUM_VOLTAGES;
pmic->desc[id].ops = &palmas_ops_smps10;
pmic->desc[id].vsel_reg = PALMAS_SMPS10_CTRL;
@@ -671,6 +671,10 @@ static __devinit int palmas_probe(struct platform_device *pdev)
pmic->desc[id].enable_mask = SMPS10_BOOST_EN;
pmic->desc[id].min_uV = 3750000;
pmic->desc[id].uV_step = 1250000;
+ break;
+ default:
+ pmic->desc[id].ops = &palmas_ops_smps;
+ pmic->desc[id].n_voltages = PALMAS_SMPS_NUM_VOLTAGES;
}
pmic->desc[id].type = REGULATOR_VOLTAGE;
OpenPOWER on IntegriCloud