diff options
author | Milo(Woogyom) Kim <milo.kim@ti.com> | 2013-02-05 10:08:49 +0100 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2013-02-07 00:59:27 +0100 |
commit | 48068d5de16c23c256c085b2cd3ff03bec393900 (patch) | |
tree | 08307d1f09040ef20677b15db0a21113a3ba7842 /drivers/leds/leds-lp5523.c | |
parent | leds-lp55xx: use lp55xx common init function - platform data (diff) | |
download | linux-48068d5de16c23c256c085b2cd3ff03bec393900.tar.xz linux-48068d5de16c23c256c085b2cd3ff03bec393900.zip |
leds-lp55xx: use lp55xx common init function - reset
LP5521/5523 reset device functions are moved to lp55xx common driver.
Value of register address and value are chip dependent.
Those are configured in each driver.
In init function, reset command is executed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-lp5523.c')
-rw-r--r-- | drivers/leds/leds-lp5523.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 8e602047ce35..00547783db77 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -87,6 +87,7 @@ #define LP5523_AUTO_CLK 0x02 #define LP5523_EN_LEDTEST 0x80 #define LP5523_LEDTEST_DONE 0x80 +#define LP5523_RESET 0xFF #define LP5523_DEFAULT_CURRENT 50 /* microAmps */ #define LP5523_PROGRAM_LENGTH 32 /* in bytes */ @@ -900,25 +901,12 @@ static void lp5523_unregister_leds(struct lp5523_chip *chip) } } -static void lp5523_reset_device(struct lp5523_chip *chip) -{ - struct i2c_client *client = chip->client; - - lp5523_write(client, LP5523_REG_RESET, 0xff); -} - static void lp5523_deinit_device(struct lp5523_chip *chip); static int lp5523_init_device(struct lp5523_chip *chip) { struct i2c_client *client = chip->client; int ret; - lp5523_reset_device(chip); - - usleep_range(10000, 20000); /* - * Exact value is not available. 10 - 20ms - * appears to be enough for reset. - */ ret = lp5523_detect(client); if (ret) goto err; @@ -947,6 +935,14 @@ static void lp5523_deinit_device(struct lp5523_chip *chip) pdata->release_resources(); } +/* Chip specific configurations */ +static struct lp55xx_device_config lp5523_cfg = { + .reset = { + .addr = LP5523_REG_RESET, + .val = LP5523_RESET, + }, +}; + static int lp5523_probe(struct i2c_client *client, const struct i2c_device_id *id) { @@ -972,6 +968,7 @@ static int lp5523_probe(struct i2c_client *client, chip->cl = client; chip->pdata = pdata; + chip->cfg = &lp5523_cfg; mutex_init(&chip->lock); |