aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-03-23 18:02:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-03-23 19:58:35 -0400
commitcea694ca3d0894ee97482be1f22b822dc948c66f (patch)
treed3226e8a303246ab9d9a407f350e7a963b4a5a1c
parent1a1278da5ccef255075c03dccc567d46e162c674 (diff)
drivers/leds/leds-lm3530.c: move the code setting gen_config to one place
Improve the readability by moving the code setting gen_config to one place. [akpm@linux-foundation.org: fix some patch skew] Signed-off-by: Axel Lin <axel.lin@gmail.com> Cc: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com> Cc: "Milo(Woogyom) Kim" <milo.kim@ti.com> Cc: Richard Purdie <rpurdie@rpsys.net> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/leds/leds-lm3530.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/leds/leds-lm3530.c b/drivers/leds/leds-lm3530.c
index 9f49d9550e88..968fd5fef4fc 100644
--- a/drivers/leds/leds-lm3530.c
+++ b/drivers/leds/leds-lm3530.c
@@ -160,9 +160,16 @@ static int lm3530_init_registers(struct lm3530_data *drvdata)
160 gen_config = (pdata->brt_ramp_law << LM3530_RAMP_LAW_SHIFT) | 160 gen_config = (pdata->brt_ramp_law << LM3530_RAMP_LAW_SHIFT) |
161 ((pdata->max_current & 7) << LM3530_MAX_CURR_SHIFT); 161 ((pdata->max_current & 7) << LM3530_MAX_CURR_SHIFT);
162 162
163 if (drvdata->mode == LM3530_BL_MODE_MANUAL || 163 switch (drvdata->mode) {
164 drvdata->mode == LM3530_BL_MODE_ALS) 164 case LM3530_BL_MODE_MANUAL:
165 gen_config |= (LM3530_ENABLE_I2C); 165 case LM3530_BL_MODE_ALS:
166 gen_config |= LM3530_ENABLE_I2C;
167 break;
168 case LM3530_BL_MODE_PWM:
169 gen_config |= LM3530_ENABLE_PWM | LM3530_ENABLE_PWM_SIMPLE |
170 (pdata->pwm_pol_hi << LM3530_PWM_POL_SHIFT);
171 break;
172 }
166 173
167 if (drvdata->mode == LM3530_BL_MODE_ALS) { 174 if (drvdata->mode == LM3530_BL_MODE_ALS) {
168 if (pdata->als_vmax == 0) { 175 if (pdata->als_vmax == 0) {
@@ -196,11 +203,6 @@ static int lm3530_init_registers(struct lm3530_data *drvdata)
196 203
197 } 204 }
198 205
199 if (drvdata->mode == LM3530_BL_MODE_PWM)
200 gen_config |= (LM3530_ENABLE_PWM) |
201 (pdata->pwm_pol_hi << LM3530_PWM_POL_SHIFT) |
202 (LM3530_ENABLE_PWM_SIMPLE);
203
204 brt_ramp = (pdata->brt_ramp_fall << LM3530_BRT_RAMP_FALL_SHIFT) | 206 brt_ramp = (pdata->brt_ramp_fall << LM3530_BRT_RAMP_FALL_SHIFT) |
205 (pdata->brt_ramp_rise << LM3530_BRT_RAMP_RISE_SHIFT); 207 (pdata->brt_ramp_rise << LM3530_BRT_RAMP_RISE_SHIFT);
206 208