diff options
| author | srinidhi kasagar <srinidhi.kasagar@stericsson.com> | 2011-10-10 14:58:44 +0530 |
|---|---|---|
| committer | Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> | 2011-10-19 07:33:28 +0200 |
| commit | 4102bc717694386654ac5fca367b95f2bbb7e3f7 (patch) | |
| tree | f0dd64df9c099be5f9d3def8c0e7095195d9079e /drivers/leds | |
| parent | 9b68acf1914c85b16300a29a5459e37d90935e44 (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.
ST-Ericsson ID: 361235
ST-Ericsson Linux next: in -mm tree
ST-Ericsson FOSS-OUT ID: Trivial
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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Change-Id:I964a2602d5e9ccb7cef944fb40dc1b9c57b4f62a
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32930
Reviewed-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
Tested-by: Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com>
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 cc1dc4817fa..6314d5fe76d 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -97,6 +97,9 @@ /* Status */ #define LP5521_EXT_CLK_USED 0x08 +/* default R channel current register value */ +#define LP5521_REG_R_CURR_DEFAULT 0xAF + struct lp5521_engine { int id; u8 mode; @@ -643,6 +646,7 @@ static int __devinit lp5521_probe(struct i2c_client *client, struct lp5521_chip *chip; struct lp5521_platform_data *pdata; int ret, i, led; + u8 buf; chip = kzalloc(sizeof(*chip), GFP_KERNEL); if (!chip) @@ -681,6 +685,20 @@ static int __devinit lp5521_probe(struct i2c_client *client, * Exact value is not available. 10 - 20ms * appears to be enough for reset. */ + + /* + * Make sure that the chip is reset by reading back the r channel + * current reg. This is dummy read is required on some platforms - + * otherwise further access to the R G B channels in the + * LP5521_REG_ENABLE register will not have any effect - strange! + */ + lp5521_read(client, LP5521_REG_R_CURRENT, &buf); + if (buf != LP5521_REG_R_CURR_DEFAULT) { + dev_err(&client->dev, "error in reseting chip\n"); + goto fail2; + } + usleep_range(10000, 20000); + ret = lp5521_detect(client); if (ret) { |
