diff options
author | Milo(Woogyom) Kim <milo.kim@ti.com> | 2013-02-05 04:57:36 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2013-02-06 18:59:27 -0500 |
commit | ffbdccdbbaee814963a09d25b1cc598cfe131366 (patch) | |
tree | ed487c6e89fb106fd7de798d166ee4342efac85e /drivers/leds/leds-lp5523.c | |
parent | e3a700d8aae190e09fb06abe0ddd2e172a682508 (diff) |
leds-lp55xx: use lp55xx common init function - post int
LP5521/5523 chip configuration is replaced with lp55xx common function,
lp55xx_post_init_device().
Name change:
lp5521/5523_configure() to lp5521/5523_post_init_device()
These are called in init function.
Register access function
Argument type is changed from 'i2c_client' to 'lp55xx_chip'.
Use exported R/W functions of lp55xx common driver.
Temporary variables in lp5521/5523_init_device()
These functions will be removed but temporary variables are needed for
blocking build warnings - incompatible pointer.
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 | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index b3698e85d51f..110565b066e2 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c | |||
@@ -181,18 +181,18 @@ 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_configure(struct i2c_client *client) | 184 | static int lp5523_post_init_device(struct lp55xx_chip *chip) |
185 | { | 185 | { |
186 | int ret = 0; | 186 | int ret; |
187 | 187 | ||
188 | ret = lp5523_write(client, LP5523_REG_ENABLE, LP5523_ENABLE); | 188 | ret = lp55xx_write(chip, LP5523_REG_ENABLE, LP5523_ENABLE); |
189 | if (ret) | 189 | if (ret) |
190 | return ret; | 190 | return ret; |
191 | 191 | ||
192 | /* Chip startup time is 500 us, 1 - 2 ms gives some margin */ | 192 | /* Chip startup time is 500 us, 1 - 2 ms gives some margin */ |
193 | usleep_range(1000, 2000); | 193 | usleep_range(1000, 2000); |
194 | 194 | ||
195 | ret = lp5523_write(client, LP5523_REG_CONFIG, | 195 | ret = lp55xx_write(chip, LP5523_REG_CONFIG, |
196 | LP5523_AUTO_INC | LP5523_PWR_SAVE | | 196 | LP5523_AUTO_INC | LP5523_PWR_SAVE | |
197 | LP5523_CP_AUTO | LP5523_AUTO_CLK | | 197 | LP5523_CP_AUTO | LP5523_AUTO_CLK | |
198 | LP5523_PWM_PWR_SAVE); | 198 | LP5523_PWM_PWR_SAVE); |
@@ -200,11 +200,11 @@ static int lp5523_configure(struct i2c_client *client) | |||
200 | return ret; | 200 | return ret; |
201 | 201 | ||
202 | /* turn on all leds */ | 202 | /* turn on all leds */ |
203 | ret = lp5523_write(client, LP5523_REG_ENABLE_LEDS_MSB, 0x01); | 203 | ret = lp55xx_write(chip, LP5523_REG_ENABLE_LEDS_MSB, 0x01); |
204 | if (ret) | 204 | if (ret) |
205 | return ret; | 205 | return ret; |
206 | 206 | ||
207 | return lp5523_write(client, LP5523_REG_ENABLE_LEDS_LSB, 0xff); | 207 | return lp55xx_write(chip, LP5523_REG_ENABLE_LEDS_LSB, 0xff); |
208 | } | 208 | } |
209 | 209 | ||
210 | static int lp5523_set_engine_mode(struct lp5523_engine *engine, u8 mode) | 210 | static int lp5523_set_engine_mode(struct lp5523_engine *engine, u8 mode) |
@@ -888,9 +888,10 @@ static void lp5523_deinit_device(struct lp5523_chip *chip); | |||
888 | static int lp5523_init_device(struct lp5523_chip *chip) | 888 | static int lp5523_init_device(struct lp5523_chip *chip) |
889 | { | 889 | { |
890 | struct i2c_client *client = chip->client; | 890 | struct i2c_client *client = chip->client; |
891 | struct lp55xx_chip *temp; | ||
891 | int ret; | 892 | int ret; |
892 | 893 | ||
893 | ret = lp5523_configure(client); | 894 | ret = lp5523_post_init_device(temp); |
894 | if (ret < 0) { | 895 | if (ret < 0) { |
895 | dev_err(&client->dev, "error configuring chip\n"); | 896 | dev_err(&client->dev, "error configuring chip\n"); |
896 | goto err_config; | 897 | goto err_config; |
@@ -923,6 +924,7 @@ static struct lp55xx_device_config lp5523_cfg = { | |||
923 | .addr = LP5523_REG_ENABLE, | 924 | .addr = LP5523_REG_ENABLE, |
924 | .val = LP5523_ENABLE, | 925 | .val = LP5523_ENABLE, |
925 | }, | 926 | }, |
927 | .post_init_device = lp5523_post_init_device, | ||
926 | }; | 928 | }; |
927 | 929 | ||
928 | static int lp5523_probe(struct i2c_client *client, | 930 | static int lp5523_probe(struct i2c_client *client, |