From e3a700d8aae190e09fb06abe0ddd2e172a682508 Mon Sep 17 00:00:00 2001 From: "Milo(Woogyom) Kim" Date: Tue, 5 Feb 2013 18:09:56 +0900 Subject: leds-lp55xx: use lp55xx common init function - detect LP5521/5523 chip detection functions are replaced with lp55xx common function, lp55xx_detect_device(). Chip dependent address and values are configurable in each driver. In init function, chip detection is executed. Signed-off-by: Milo(Woogyom) Kim Signed-off-by: Bryan Wu --- drivers/leds/leds-lp5523.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) (limited to 'drivers/leds/leds-lp5523.c') diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 00547783db7..b3698e85d51 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c @@ -181,23 +181,6 @@ static int lp5523_read(struct i2c_client *client, u8 reg, u8 *buf) return 0; } -static int lp5523_detect(struct i2c_client *client) -{ - int ret; - u8 buf; - - ret = lp5523_write(client, LP5523_REG_ENABLE, LP5523_ENABLE); - if (ret) - return ret; - ret = lp5523_read(client, LP5523_REG_ENABLE, &buf); - if (ret) - return ret; - if (buf == 0x40) - return 0; - else - return -ENODEV; -} - static int lp5523_configure(struct i2c_client *client) { int ret = 0; @@ -907,10 +890,6 @@ static int lp5523_init_device(struct lp5523_chip *chip) struct i2c_client *client = chip->client; int ret; - ret = lp5523_detect(client); - if (ret) - goto err; - ret = lp5523_configure(client); if (ret < 0) { dev_err(&client->dev, "error configuring chip\n"); @@ -921,7 +900,6 @@ static int lp5523_init_device(struct lp5523_chip *chip) err_config: lp5523_deinit_device(chip); -err: return ret; } @@ -941,6 +919,10 @@ static struct lp55xx_device_config lp5523_cfg = { .addr = LP5523_REG_RESET, .val = LP5523_RESET, }, + .enable = { + .addr = LP5523_REG_ENABLE, + .val = LP5523_ENABLE, + }, }; static int lp5523_probe(struct i2c_client *client, -- cgit v1.2.3-70-g09d2