aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds
diff options
context:
space:
mode:
authorSamu Onkalo <samu.p.onkalo@nokia.com>2010-11-24 15:57:03 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2010-11-24 16:50:42 -0500
commit09c76b0f6e8fcd78f2d194acb1f07e41789cc29b (patch)
treebd6ab243f68b1cbda8e0d460dcb77ece72044a55 /drivers/leds
parent87dbf6234d965851e7e13cbe80ad439f5fcb99c8 (diff)
drivers/leds/leds-lp5521.c: adjust delays and add comments to them
Delays were little bit too long. Adjust delay times and add some comments to them. Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com> Cc: Richard Purdie <rpurdie@rpsys.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/leds')
-rw-r--r--drivers/leds/leds-lp5521.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index fe69e5229a57..963c014be0bf 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -196,14 +196,17 @@ static int lp5521_load_program(struct lp5521_engine *eng, const u8 *pattern)
196 196
197 /* move current engine to direct mode and remember the state */ 197 /* move current engine to direct mode and remember the state */
198 ret = lp5521_set_engine_mode(eng, LP5521_CMD_DIRECT); 198 ret = lp5521_set_engine_mode(eng, LP5521_CMD_DIRECT);
199 usleep_range(1000, 10000); 199 /* Mode change requires min 500 us delay. 1 - 2 ms with margin */
200 usleep_range(1000, 2000);
200 ret |= lp5521_read(client, LP5521_REG_OP_MODE, &mode); 201 ret |= lp5521_read(client, LP5521_REG_OP_MODE, &mode);
201 202
202 /* For loading, all the engines to load mode */ 203 /* For loading, all the engines to load mode */
203 lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT); 204 lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT);
204 usleep_range(1000, 10000); 205 /* Mode change requires min 500 us delay. 1 - 2 ms with margin */
206 usleep_range(1000, 2000);
205 lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_LOAD); 207 lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_LOAD);
206 usleep_range(1000, 10000); 208 /* Mode change requires min 500 us delay. 1 - 2 ms with margin */
209 usleep_range(1000, 2000);
207 210
208 addr = LP5521_PROG_MEM_BASE + eng->prog_page * LP5521_PROG_MEM_SIZE; 211 addr = LP5521_PROG_MEM_BASE + eng->prog_page * LP5521_PROG_MEM_SIZE;
209 i2c_smbus_write_i2c_block_data(client, 212 i2c_smbus_write_i2c_block_data(client,
@@ -244,7 +247,10 @@ static int lp5521_configure(struct i2c_client *client,
244 247
245 lp5521_write(client, LP5521_REG_RESET, 0xff); 248 lp5521_write(client, LP5521_REG_RESET, 0xff);
246 249
247 usleep_range(10000, 20000); 250 usleep_range(10000, 20000); /*
251 * Exact value is not available. 10 - 20ms
252 * appears to be enough for reset.
253 */
248 254
249 /* Set all PWMs to direct control mode */ 255 /* Set all PWMs to direct control mode */
250 ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F); 256 ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F);
@@ -262,8 +268,8 @@ static int lp5521_configure(struct i2c_client *client,
262 ret |= lp5521_write(client, LP5521_REG_ENABLE, 268 ret |= lp5521_write(client, LP5521_REG_ENABLE,
263 LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM | 269 LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM |
264 LP5521_EXEC_RUN); 270 LP5521_EXEC_RUN);
265 /* enable takes 500us */ 271 /* enable takes 500us. 1 - 2 ms leaves some margin */
266 usleep_range(500, 20000); 272 usleep_range(1000, 2000);
267 273
268 return ret; 274 return ret;
269} 275}
@@ -316,7 +322,8 @@ static int lp5521_detect(struct i2c_client *client)
316 LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM); 322 LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM);
317 if (ret) 323 if (ret)
318 return ret; 324 return ret;
319 usleep_range(1000, 10000); 325 /* enable takes 500us. 1 - 2 ms leaves some margin */
326 usleep_range(1000, 2000);
320 ret = lp5521_read(client, LP5521_REG_ENABLE, &buf); 327 ret = lp5521_read(client, LP5521_REG_ENABLE, &buf);
321 if (ret) 328 if (ret)
322 return ret; 329 return ret;
@@ -704,9 +711,9 @@ static int lp5521_probe(struct i2c_client *client,
704 711
705 if (pdata->enable) { 712 if (pdata->enable) {
706 pdata->enable(0); 713 pdata->enable(0);
707 usleep_range(1000, 10000); 714 usleep_range(1000, 2000); /* Keep enable down at least 1ms */
708 pdata->enable(1); 715 pdata->enable(1);
709 usleep_range(1000, 10000); /* Spec says min 500us */ 716 usleep_range(1000, 2000); /* 500us abs min. */
710 } 717 }
711 718
712 ret = lp5521_detect(client); 719 ret = lp5521_detect(client);