leds-lp5523.c (e3a700d8aae190e09fb06abe0ddd2e172a682508) | leds-lp5523.c (ffbdccdbbaee814963a09d25b1cc598cfe131366) |
---|---|
1/* 2 * lp5523.c - LP5523 LED Driver 3 * 4 * Copyright (C) 2010 Nokia Corporation 5 * 6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com> 7 * 8 * This program is free software; you can redistribute it and/or --- 167 unchanged lines hidden (view full) --- 176 177 if (ret < 0) 178 return ret; 179 180 *buf = ret; 181 return 0; 182} 183 | 1/* 2 * lp5523.c - LP5523 LED Driver 3 * 4 * Copyright (C) 2010 Nokia Corporation 5 * 6 * Contact: Samu Onkalo <samu.p.onkalo@nokia.com> 7 * 8 * This program is free software; you can redistribute it and/or --- 167 unchanged lines hidden (view full) --- 176 177 if (ret < 0) 178 return ret; 179 180 *buf = ret; 181 return 0; 182} 183 |
184static int lp5523_configure(struct i2c_client *client) | 184static 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) 190 return ret; 191 192 /* Chip startup time is 500 us, 1 - 2 ms gives some margin */ 193 usleep_range(1000, 2000); 194 | 189 if (ret) 190 return ret; 191 192 /* Chip startup time is 500 us, 1 - 2 ms gives some margin */ 193 usleep_range(1000, 2000); 194 |
195 ret = lp5523_write(client, LP5523_REG_CONFIG, | 195 ret = lp55xx_write(chip, LP5523_REG_CONFIG, |
196 LP5523_AUTO_INC | LP5523_PWR_SAVE | 197 LP5523_CP_AUTO | LP5523_AUTO_CLK | 198 LP5523_PWM_PWR_SAVE); 199 if (ret) 200 return ret; 201 202 /* turn on all leds */ | 196 LP5523_AUTO_INC | LP5523_PWR_SAVE | 197 LP5523_CP_AUTO | LP5523_AUTO_CLK | 198 LP5523_PWM_PWR_SAVE); 199 if (ret) 200 return ret; 201 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) 205 return ret; 206 | 204 if (ret) 205 return ret; 206 |
207 return lp5523_write(client, LP5523_REG_ENABLE_LEDS_LSB, 0xff); | 207 return lp55xx_write(chip, LP5523_REG_ENABLE_LEDS_LSB, 0xff); |
208} 209 210static int lp5523_set_engine_mode(struct lp5523_engine *engine, u8 mode) 211{ 212 struct lp5523_chip *chip = engine_to_lp5523(engine); 213 struct i2c_client *client = chip->client; 214 int ret; 215 u8 engine_state; --- 667 unchanged lines hidden (view full) --- 883 flush_work(&chip->leds[i].brightness_work); 884 } 885} 886 887static void lp5523_deinit_device(struct lp5523_chip *chip); 888static int lp5523_init_device(struct lp5523_chip *chip) 889{ 890 struct i2c_client *client = chip->client; | 208} 209 210static int lp5523_set_engine_mode(struct lp5523_engine *engine, u8 mode) 211{ 212 struct lp5523_chip *chip = engine_to_lp5523(engine); 213 struct i2c_client *client = chip->client; 214 int ret; 215 u8 engine_state; --- 667 unchanged lines hidden (view full) --- 883 flush_work(&chip->leds[i].brightness_work); 884 } 885} 886 887static void lp5523_deinit_device(struct lp5523_chip *chip); 888static int lp5523_init_device(struct lp5523_chip *chip) 889{ 890 struct i2c_client *client = chip->client; |
891 struct lp55xx_chip *temp; |
|
891 int ret; 892 | 892 int ret; 893 |
893 ret = lp5523_configure(client); | 894 ret = lp5523_post_init_device(temp); |
894 if (ret < 0) { 895 dev_err(&client->dev, "error configuring chip\n"); 896 goto err_config; 897 } 898 899 return 0; 900 901err_config: --- 16 unchanged lines hidden (view full) --- 918 .reset = { 919 .addr = LP5523_REG_RESET, 920 .val = LP5523_RESET, 921 }, 922 .enable = { 923 .addr = LP5523_REG_ENABLE, 924 .val = LP5523_ENABLE, 925 }, | 895 if (ret < 0) { 896 dev_err(&client->dev, "error configuring chip\n"); 897 goto err_config; 898 } 899 900 return 0; 901 902err_config: --- 16 unchanged lines hidden (view full) --- 919 .reset = { 920 .addr = LP5523_REG_RESET, 921 .val = LP5523_RESET, 922 }, 923 .enable = { 924 .addr = LP5523_REG_ENABLE, 925 .val = LP5523_ENABLE, 926 }, |
927 .post_init_device = lp5523_post_init_device, |
|
926}; 927 928static int lp5523_probe(struct i2c_client *client, 929 const struct i2c_device_id *id) 930{ 931 struct lp5523_chip *old_chip = NULL; 932 int ret, i; 933 struct lp55xx_chip *chip; --- 95 unchanged lines hidden --- | 928}; 929 930static int lp5523_probe(struct i2c_client *client, 931 const struct i2c_device_id *id) 932{ 933 struct lp5523_chip *old_chip = NULL; 934 int ret, i; 935 struct lp55xx_chip *chip; --- 95 unchanged lines hidden --- |