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 <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index 0054778..b3698e8 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -181,23 +181,6 @@
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 @@
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 @@
err_config:
lp5523_deinit_device(chip);
-err:
return ret;
}
@@ -941,6 +919,10 @@
.addr = LP5523_REG_RESET,
.val = LP5523_RESET,
},
+ .enable = {
+ .addr = LP5523_REG_ENABLE,
+ .val = LP5523_ENABLE,
+ },
};
static int lp5523_probe(struct i2c_client *client,