[PATCH leds + devicetree 12/13] leds: tca6507: set registers to zero before LEDs/GPIOs registration

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The LED registering functions can internally call brightness changes. If
we zero the registers only after LEDs are registered, then the values
set by registration code are lost.

Therefore set chip's registers to zero before registering LEDs/GPIOs.

Signed-off-by: Marek Behún <marek.behun@xxxxxx>
Cc: NeilBrown <neilb@xxxxxxx>
Cc: Linus Walleij <linus.walleij@xxxxxxxxxx>
Cc: H. Nikolaus Schaller <hns@xxxxxxxxxxxxx>
---
 drivers/leds/leds-tca6507.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index e32e628f2e460..ad4af6b6e94c7 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -732,14 +732,14 @@ static int tca6507_probe(struct i2c_client *client,
 	spin_lock_init(&tca->lock);
 	i2c_set_clientdata(client, tca);
 
+	/* set all registers to known state - zero */
+	tca->reg_set = 0x7f;
+	tca6507_work(&tca->work);
+
 	err = tca6507_register_leds_and_gpios(dev, tca);
 	if (err)
 		return err;
 
-	/* set all registers to known state - zero */
-	tca->reg_set = 0x7f;
-	schedule_work(&tca->work);
-
 	return 0;
 }
 
-- 
2.26.2




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux