aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp5521.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/leds/leds-lp5521.c')
-rw-r--r--drivers/leds/leds-lp5521.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 124ce80fa115..e1f1dfcd1547 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -98,6 +98,9 @@
98/* Pattern Mode */ 98/* Pattern Mode */
99#define PATTERN_OFF 0 99#define PATTERN_OFF 0
100 100
101/* Reset register value */
102#define LP5521_RESET 0xFF
103
101struct lp5521_engine { 104struct lp5521_engine {
102 int id; 105 int id;
103 u8 mode; 106 u8 mode;
@@ -709,26 +712,12 @@ static void lp5521_unregister_sysfs(struct i2c_client *client)
709 &lp5521_led_attribute_group); 712 &lp5521_led_attribute_group);
710} 713}
711 714
712static void lp5521_reset_device(struct lp5521_chip *chip)
713{
714 struct i2c_client *client = chip->client;
715
716 lp5521_write(client, LP5521_REG_RESET, 0xff);
717}
718
719static void lp5521_deinit_device(struct lp5521_chip *chip); 715static void lp5521_deinit_device(struct lp5521_chip *chip);
720static int lp5521_init_device(struct lp5521_chip *chip) 716static int lp5521_init_device(struct lp5521_chip *chip)
721{ 717{
722 struct i2c_client *client = chip->client; 718 struct i2c_client *client = chip->client;
723 int ret; 719 int ret;
724 720
725 lp5521_reset_device(chip);
726
727 usleep_range(10000, 20000); /*
728 * Exact value is not available. 10 - 20ms
729 * appears to be enough for reset.
730 */
731
732 ret = lp5521_detect(client); 721 ret = lp5521_detect(client);
733 if (ret) { 722 if (ret) {
734 dev_err(&client->dev, "Chip not found\n"); 723 dev_err(&client->dev, "Chip not found\n");
@@ -856,6 +845,14 @@ static void lp5521_unregister_leds(struct lp5521_chip *chip)
856 } 845 }
857} 846}
858 847
848/* Chip specific configurations */
849static struct lp55xx_device_config lp5521_cfg = {
850 .reset = {
851 .addr = LP5521_REG_RESET,
852 .val = LP5521_RESET,
853 },
854};
855
859static int lp5521_probe(struct i2c_client *client, 856static int lp5521_probe(struct i2c_client *client,
860 const struct i2c_device_id *id) 857 const struct i2c_device_id *id)
861{ 858{
@@ -881,6 +878,7 @@ static int lp5521_probe(struct i2c_client *client,
881 878
882 chip->cl = client; 879 chip->cl = client;
883 chip->pdata = pdata; 880 chip->pdata = pdata;
881 chip->cfg = &lp5521_cfg;
884 882
885 mutex_init(&chip->lock); 883 mutex_init(&chip->lock);
886 884