diff options
author | Milo(Woogyom) Kim <milo.kim@ti.com> | 2013-02-05 04:09:56 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2013-02-06 18:59:27 -0500 |
commit | e3a700d8aae190e09fb06abe0ddd2e172a682508 (patch) | |
tree | 3cc952ab61cfb1219f2a43a5e0e738dd2fd7ae10 /drivers/leds/leds-lp5523.c | |
parent | 48068d5de16c23c256c085b2cd3ff03bec393900 (diff) |
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>
Diffstat (limited to 'drivers/leds/leds-lp5523.c')
-rw-r--r-- | drivers/leds/leds-lp5523.c | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index 00547783db77..b3698e85d51f 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) | |||
181 | return 0; | 181 | return 0; |
182 | } | 182 | } |
183 | 183 | ||
184 | static int lp5523_detect(struct i2c_client *client) | ||
185 | { | ||
186 | int ret; | ||
187 | u8 buf; | ||
188 | |||
189 | ret = lp5523_write(client, LP5523_REG_ENABLE, LP5523_ENABLE); | ||
190 | if (ret) | ||
191 | return ret; | ||
192 | ret = lp5523_read(client, LP5523_REG_ENABLE, &buf); | ||
193 | if (ret) | ||
194 | return ret; | ||
195 | if (buf == 0x40) | ||
196 | return 0; | ||
197 | else | ||
198 | return -ENODEV; | ||
199 | } | ||
200 | |||
201 | static int lp5523_configure(struct i2c_client *client) | 184 | static int lp5523_configure(struct i2c_client *client) |
202 | { | 185 | { |
203 | int ret = 0; | 186 | int ret = 0; |
@@ -907,10 +890,6 @@ static int lp5523_init_device(struct lp5523_chip *chip) | |||
907 | struct i2c_client *client = chip->client; | 890 | struct i2c_client *client = chip->client; |
908 | int ret; | 891 | int ret; |
909 | 892 | ||
910 | ret = lp5523_detect(client); | ||
911 | if (ret) | ||
912 | goto err; | ||
913 | |||
914 | ret = lp5523_configure(client); | 893 | ret = lp5523_configure(client); |
915 | if (ret < 0) { | 894 | if (ret < 0) { |
916 | dev_err(&client->dev, "error configuring chip\n"); | 895 | dev_err(&client->dev, "error configuring chip\n"); |
@@ -921,7 +900,6 @@ static int lp5523_init_device(struct lp5523_chip *chip) | |||
921 | 900 | ||
922 | err_config: | 901 | err_config: |
923 | lp5523_deinit_device(chip); | 902 | lp5523_deinit_device(chip); |
924 | err: | ||
925 | return ret; | 903 | return ret; |
926 | } | 904 | } |
927 | 905 | ||
@@ -941,6 +919,10 @@ static struct lp55xx_device_config lp5523_cfg = { | |||
941 | .addr = LP5523_REG_RESET, | 919 | .addr = LP5523_REG_RESET, |
942 | .val = LP5523_RESET, | 920 | .val = LP5523_RESET, |
943 | }, | 921 | }, |
922 | .enable = { | ||
923 | .addr = LP5523_REG_ENABLE, | ||
924 | .val = LP5523_ENABLE, | ||
925 | }, | ||
944 | }; | 926 | }; |
945 | 927 | ||
946 | static int lp5523_probe(struct i2c_client *client, | 928 | static int lp5523_probe(struct i2c_client *client, |