* [PATCH] drivers/leds/leds-lp5521.c: check if reset is successful
@ 2011-10-10 11:30 Srinidhi KASAGAR
2011-10-18 9:59 ` Srinidhi KASAGAR
2011-10-18 21:10 ` Andrew Morton
0 siblings, 2 replies; 4+ messages in thread
From: Srinidhi KASAGAR @ 2011-10-10 11:30 UTC (permalink / raw)
To: rpurdie; +Cc: linux-kernel, linus.walleij, srinidhi kasagar
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.
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>
---
drivers/leds/leds-lp5521.c | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 9fc122c..91a2928 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,21 @@ 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
+ * r channel current reg. This is a dummy read, otherwise
+ * in some platforms, access to R G B channel program
+ * execution mode to 'Run' in LP5521_REG_ENABLE register
+ * will not have any affect - 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) {
--
1.7.4.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] drivers/leds/leds-lp5521.c: check if reset is successful
2011-10-10 11:30 [PATCH] drivers/leds/leds-lp5521.c: check if reset is successful Srinidhi KASAGAR
@ 2011-10-18 9:59 ` Srinidhi KASAGAR
2011-10-18 21:10 ` Andrew Morton
1 sibling, 0 replies; 4+ messages in thread
From: Srinidhi KASAGAR @ 2011-10-18 9:59 UTC (permalink / raw)
To: rpurdie; +Cc: linux-kernel, linus.walleij
Richard,
Did you get a chance to look at this patch?
srinidhi
> -----Original Message-----
> From: Srinidhi KASAGAR
> Sent: Monday, October 10, 2011 5:00 PM
> To: rpurdie@rpsys.net
> Cc: linux-kernel@vger.kernel.org; linus.walleij@linaro.org; Srinidhi
> KASAGAR
> Subject: [PATCH] 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.
>
> 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>
> ---
> drivers/leds/leds-lp5521.c | 19 +++++++++++++++++++
> 1 files changed, 19 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
> index 9fc122c..91a2928 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,21 @@ 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
> + * r channel current reg. This is a dummy read, otherwise
> + * in some platforms, access to R G B channel program
> + * execution mode to 'Run' in LP5521_REG_ENABLE register
> + * will not have any affect - 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) {
> --
> 1.7.4.3
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/leds/leds-lp5521.c: check if reset is successful
2011-10-10 11:30 [PATCH] drivers/leds/leds-lp5521.c: check if reset is successful Srinidhi KASAGAR
2011-10-18 9:59 ` Srinidhi KASAGAR
@ 2011-10-18 21:10 ` Andrew Morton
2011-10-19 4:33 ` Srinidhi KASAGAR
1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2011-10-18 21:10 UTC (permalink / raw)
To: Srinidhi KASAGAR; +Cc: rpurdie, linux-kernel, linus.walleij
On Mon, 10 Oct 2011 17:00:02 +0530
Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> wrote:
> 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.
>
> ...
>
> @@ -681,6 +685,21 @@ 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
> + * r channel current reg. This is a dummy read, otherwise
> + * in some platforms, access to R G B channel program
> + * execution mode to 'Run' in LP5521_REG_ENABLE register
> + * will not have any affect - 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);
Sorry, but I found that comment very hard to follow.
Is this version accurate and complete?
/*
* Make sure that the chip is reset by reading back the r channel
* current reg. This 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!
*/
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] drivers/leds/leds-lp5521.c: check if reset is successful
2011-10-18 21:10 ` Andrew Morton
@ 2011-10-19 4:33 ` Srinidhi KASAGAR
0 siblings, 0 replies; 4+ messages in thread
From: Srinidhi KASAGAR @ 2011-10-19 4:33 UTC (permalink / raw)
To: Andrew Morton; +Cc: rpurdie, linux-kernel, linus.walleij
> -----Original Message-----
> From: Andrew Morton [mailto:akpm00@gmail.com] On Behalf Of Andrew
> Morton
> Sent: Wednesday, October 19, 2011 2:41 AM
> To: Srinidhi KASAGAR
> Cc: rpurdie@rpsys.net; linux-kernel@vger.kernel.org;
> linus.walleij@linaro.org
> Subject: Re: [PATCH] drivers/leds/leds-lp5521.c: check if reset is
> successful
>
> On Mon, 10 Oct 2011 17:00:02 +0530
> Srinidhi KASAGAR <srinidhi.kasagar@stericsson.com> wrote:
>
> > 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.
> >
> > ...
> >
> > @@ -681,6 +685,21 @@ 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
> > + * r channel current reg. This is a dummy read, otherwise
> > + * in some platforms, access to R G B channel program
> > + * execution mode to 'Run' in LP5521_REG_ENABLE register
> > + * will not have any affect - 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);
>
> Sorry, but I found that comment very hard to follow.
>
> Is this version accurate and complete?
>
> /*
> * Make sure that the chip is reset by reading back the r channel
> * current reg. This 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!
> */
That should be ok.
Thanks Andrew.
Srinidhi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-10-19 4:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-10 11:30 [PATCH] drivers/leds/leds-lp5521.c: check if reset is successful Srinidhi KASAGAR
2011-10-18 9:59 ` Srinidhi KASAGAR
2011-10-18 21:10 ` Andrew Morton
2011-10-19 4:33 ` Srinidhi KASAGAR
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®