diff options
author | Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> | 2011-10-31 20:12:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-31 20:30:55 -0400 |
commit | b3c49c05b737887443c894c66635ae68dcdf0027 (patch) | |
tree | d2810d450aa00651620dfa160f74b6c8a066f6e4 /drivers/leds | |
parent | 488bc35bf40df89d37486c1826b178a2fba36ce7 (diff) |
drivers/leds/leds-lp5521.c: check if reset is successful
Make sure that the reset is successful by issuing a dummy read to R
channel current register and check its default value. On some platforms,
without this dummy read, any further access to {R/G/B}_EXEC will not have
any impact.
[akpm@linux-foundation.org: fix up code comment]
Signed-off-by: srinidhi kasagar <srinidhi.kasagar@stericsson.com>
Tested-by: Naga Radhesh <naga.radheshy@stericsson.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Richard Purdie <richard.purdie@linuxfoundation.org>
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.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 16f281b8c2d0..cb641f1b3342 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c | |||
@@ -97,6 +97,9 @@ | |||
97 | /* Status */ | 97 | /* Status */ |
98 | #define LP5521_EXT_CLK_USED 0x08 | 98 | #define LP5521_EXT_CLK_USED 0x08 |
99 | 99 | ||
100 | /* default R channel current register value */ | ||
101 | #define LP5521_REG_R_CURR_DEFAULT 0xAF | ||
102 | |||
100 | struct lp5521_engine { | 103 | struct lp5521_engine { |
101 | int id; | 104 | int id; |
102 | u8 mode; | 105 | u8 mode; |
@@ -643,6 +646,7 @@ static int __devinit lp5521_probe(struct i2c_client *client, | |||
643 | struct lp5521_chip *chip; | 646 | struct lp5521_chip *chip; |
644 | struct lp5521_platform_data *pdata; | 647 | struct lp5521_platform_data *pdata; |
645 | int ret, i, led; | 648 | int ret, i, led; |
649 | u8 buf; | ||
646 | 650 | ||
647 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); | 651 | chip = kzalloc(sizeof(*chip), GFP_KERNEL); |
648 | if (!chip) | 652 | if (!chip) |
@@ -681,6 +685,20 @@ static int __devinit lp5521_probe(struct i2c_client *client, | |||
681 | * Exact value is not available. 10 - 20ms | 685 | * Exact value is not available. 10 - 20ms |
682 | * appears to be enough for reset. | 686 | * appears to be enough for reset. |
683 | */ | 687 | */ |
688 | |||
689 | /* | ||
690 | * Make sure that the chip is reset by reading back the r channel | ||
691 | * current reg. This is dummy read is required on some platforms - | ||
692 | * otherwise further access to the R G B channels in the | ||
693 | * LP5521_REG_ENABLE register will not have any effect - strange! | ||
694 | */ | ||
695 | lp5521_read(client, LP5521_REG_R_CURRENT, &buf); | ||
696 | if (buf != LP5521_REG_R_CURR_DEFAULT) { | ||
697 | dev_err(&client->dev, "error in reseting chip\n"); | ||
698 | goto fail2; | ||
699 | } | ||
700 | usleep_range(10000, 20000); | ||
701 | |||
684 | ret = lp5521_detect(client); | 702 | ret = lp5521_detect(client); |
685 | 703 | ||
686 | if (ret) { | 704 | if (ret) { |