diff options
author | Samu Onkalo <samu.p.onkalo@nokia.com> | 2010-11-24 15:57:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-24 16:50:43 -0500 |
commit | 95ea8eec341c1fc881407c96114de7e4173c1b7c (patch) | |
tree | caaa74d24e34d07ec74c7879ad30446878662e0d | |
parent | 2e4840edb7c485211993919a6a50d93c108198b8 (diff) |
drivers/leds/leds-lp5521.c: perform SW reset before detection
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>
-rw-r--r-- | drivers/leds/leds-lp5521.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 963c014be0bf..33facd0c45d1 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c | |||
@@ -245,13 +245,6 @@ static int lp5521_configure(struct i2c_client *client, | |||
245 | 245 | ||
246 | lp5521_init_engine(chip, attr_group); | 246 | lp5521_init_engine(chip, attr_group); |
247 | 247 | ||
248 | lp5521_write(client, LP5521_REG_RESET, 0xff); | ||
249 | |||
250 | usleep_range(10000, 20000); /* | ||
251 | * Exact value is not available. 10 - 20ms | ||
252 | * appears to be enough for reset. | ||
253 | */ | ||
254 | |||
255 | /* Set all PWMs to direct control mode */ | 248 | /* Set all PWMs to direct control mode */ |
256 | ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F); | 249 | ret = lp5521_write(client, LP5521_REG_OP_MODE, 0x3F); |
257 | 250 | ||
@@ -716,6 +709,11 @@ static int lp5521_probe(struct i2c_client *client, | |||
716 | usleep_range(1000, 2000); /* 500us abs min. */ | 709 | usleep_range(1000, 2000); /* 500us abs min. */ |
717 | } | 710 | } |
718 | 711 | ||
712 | lp5521_write(client, LP5521_REG_RESET, 0xff); | ||
713 | usleep_range(10000, 20000); /* | ||
714 | * Exact value is not available. 10 - 20ms | ||
715 | * appears to be enough for reset. | ||
716 | */ | ||
719 | ret = lp5521_detect(client); | 717 | ret = lp5521_detect(client); |
720 | 718 | ||
721 | if (ret) { | 719 | if (ret) { |