Skip to content

Commit

Permalink
drivers/leds/leds-lp5521.c: perform SW reset before detection
Browse files Browse the repository at this point in the history
Chip detection may fail if the chip is in some odd state for example after
system restart.  Chip doesn't have HW reset line.

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>
  • Loading branch information
Samu Onkalo authored and Linus Torvalds committed Nov 24, 2010
1 parent 2e4840e commit 95ea8ee
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions drivers/leds/leds-lp5521.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,6 @@ static int lp5521_configure(struct i2c_client *client,

lp5521_init_engine(chip, attr_group);

lp5521_write(client, LP5521_REG_RESET, 0xff);

usleep_range(10000, 20000); /*
* Exact value is not available. 10 - 20ms
* appears to be enough for reset.
*/

/* Set all PWMs to direct control mode */
ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F);

Expand Down Expand Up @@ -716,6 +709,11 @@ static int lp5521_probe(struct i2c_client *client,
usleep_range(1000, 2000); /* 500us abs min. */
}

lp5521_write(client, LP5521_REG_RESET, 0xff);
usleep_range(10000, 20000); /*
* Exact value is not available. 10 - 20ms
* appears to be enough for reset.
*/
ret = lp5521_detect(client);

if (ret) {
Expand Down

0 comments on commit 95ea8ee

Please sign in to comment.