leds-lp5521.c (c3a68ebfcd22abc186f2328149732c801449b297) leds-lp5521.c (9ce7cb170f97f83a78dc948bf7d25690f15e1328)
1/*
2 * LP5521 LED chip 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

--- 21 unchanged lines hidden (view full) ---

30#include <linux/ctype.h>
31#include <linux/spinlock.h>
32#include <linux/wait.h>
33#include <linux/leds.h>
34#include <linux/leds-lp5521.h>
35#include <linux/workqueue.h>
36#include <linux/slab.h>
37#include <linux/platform_data/leds-lp55xx.h>
1/*
2 * LP5521 LED chip 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

--- 21 unchanged lines hidden (view full) ---

30#include <linux/ctype.h>
31#include <linux/spinlock.h>
32#include <linux/wait.h>
33#include <linux/leds.h>
34#include <linux/leds-lp5521.h>
35#include <linux/workqueue.h>
36#include <linux/slab.h>
37#include <linux/platform_data/leds-lp55xx.h>
38#include <linux/firmware.h>
38
39#include "leds-lp55xx-common.h"
40
41#define LP5521_PROGRAM_LENGTH 32 /* in bytes */
42
43#define LP5521_MAX_LEDS 3 /* Maximum number of LEDs */
44#define LP5521_MAX_ENGINES 3 /* Maximum number of engines */
45

--- 50 unchanged lines hidden (view full) ---

96#define LP5521_REG_R_CURR_DEFAULT 0xAF
97
98/* Pattern Mode */
99#define PATTERN_OFF 0
100
101/* Reset register value */
102#define LP5521_RESET 0xFF
103
39
40#include "leds-lp55xx-common.h"
41
42#define LP5521_PROGRAM_LENGTH 32 /* in bytes */
43
44#define LP5521_MAX_LEDS 3 /* Maximum number of LEDs */
45#define LP5521_MAX_ENGINES 3 /* Maximum number of engines */
46

--- 50 unchanged lines hidden (view full) ---

97#define LP5521_REG_R_CURR_DEFAULT 0xAF
98
99/* Pattern Mode */
100#define PATTERN_OFF 0
101
102/* Reset register value */
103#define LP5521_RESET 0xFF
104
104struct lp5521_engine {
105 int id;
106 u8 mode;
107 u8 prog_page;
108 u8 engine_mask;
109};
105/* Program Memory Operations */
106#define LP5521_MODE_R_M 0x30 /* Operation Mode Register */
107#define LP5521_MODE_G_M 0x0C
108#define LP5521_MODE_B_M 0x03
109#define LP5521_LOAD_R 0x10
110#define LP5521_LOAD_G 0x04
111#define LP5521_LOAD_B 0x01
110
112
113#define LP5521_R_IS_LOADING(mode) \
114 ((mode & LP5521_MODE_R_M) == LP5521_LOAD_R)
115#define LP5521_G_IS_LOADING(mode) \
116 ((mode & LP5521_MODE_G_M) == LP5521_LOAD_G)
117#define LP5521_B_IS_LOADING(mode) \
118 ((mode & LP5521_MODE_B_M) == LP5521_LOAD_B)
119
120#define LP5521_EXEC_R_M 0x30 /* Enable Register */
121#define LP5521_EXEC_G_M 0x0C
122#define LP5521_EXEC_B_M 0x03
123#define LP5521_EXEC_M 0x3F
124#define LP5521_RUN_R 0x20
125#define LP5521_RUN_G 0x08
126#define LP5521_RUN_B 0x02
127
111struct lp5521_led {
112 int id;
113 u8 chan_nr;
114 u8 led_current;
115 u8 max_current;
116 struct led_classdev cdev;
117 struct work_struct brightness_work;
118 u8 brightness;
119};
120
121struct lp5521_chip {
122 struct lp5521_platform_data *pdata;
123 struct mutex lock; /* Serialize control */
124 struct i2c_client *client;
128struct lp5521_led {
129 int id;
130 u8 chan_nr;
131 u8 led_current;
132 u8 max_current;
133 struct led_classdev cdev;
134 struct work_struct brightness_work;
135 u8 brightness;
136};
137
138struct lp5521_chip {
139 struct lp5521_platform_data *pdata;
140 struct mutex lock; /* Serialize control */
141 struct i2c_client *client;
125 struct lp5521_engine engines[LP5521_MAX_ENGINES];
126 struct lp5521_led leds[LP5521_MAX_LEDS];
127 u8 num_channels;
128 u8 num_leds;
129};
130
142 struct lp5521_led leds[LP5521_MAX_LEDS];
143 u8 num_channels;
144 u8 num_leds;
145};
146
147static inline void lp5521_wait_opmode_done(void)
148{
149 /* operation mode change needs to be longer than 153 us */
150 usleep_range(200, 300);
151}
152
131static inline void lp5521_wait_enable_done(void)
132{
133 /* it takes more 488 us to update ENABLE register */
134 usleep_range(500, 600);
135}
136
137static void lp5521_set_led_current(struct lp55xx_led *led, u8 led_current)
138{
139 led->led_current = led_current;
140 lp55xx_write(led->chip, LP5521_REG_LED_CURRENT_BASE + led->chan_nr,
141 led_current);
142}
143
153static inline void lp5521_wait_enable_done(void)
154{
155 /* it takes more 488 us to update ENABLE register */
156 usleep_range(500, 600);
157}
158
159static void lp5521_set_led_current(struct lp55xx_led *led, u8 led_current)
160{
161 led->led_current = led_current;
162 lp55xx_write(led->chip, LP5521_REG_LED_CURRENT_BASE + led->chan_nr,
163 led_current);
164}
165
144static inline struct lp5521_led *cdev_to_led(struct led_classdev *cdev)
145{
146 return container_of(cdev, struct lp5521_led, cdev);
147}
148
149static inline struct lp5521_chip *engine_to_lp5521(struct lp5521_engine *engine)
150{
151 return container_of(engine, struct lp5521_chip,
152 engines[engine->id - 1]);
153}
154
155static inline struct lp5521_chip *led_to_lp5521(struct lp5521_led *led)
156{
157 return container_of(led, struct lp5521_chip,
158 leds[led->id]);
159}
160
161static inline int lp5521_write(struct i2c_client *client, u8 reg, u8 value)
162{
163 return i2c_smbus_write_byte_data(client, reg, value);
164}
165
166static int lp5521_read(struct i2c_client *client, u8 reg, u8 *buf)
167{
168 s32 ret;
169
170 ret = i2c_smbus_read_byte_data(client, reg);
171 if (ret < 0)
172 return ret;
173
174 *buf = ret;
175 return 0;
176}
177
166static inline int lp5521_write(struct i2c_client *client, u8 reg, u8 value)
167{
168 return i2c_smbus_write_byte_data(client, reg, value);
169}
170
171static int lp5521_read(struct i2c_client *client, u8 reg, u8 *buf)
172{
173 s32 ret;
174
175 ret = i2c_smbus_read_byte_data(client, reg);
176 if (ret < 0)
177 return ret;
178
179 *buf = ret;
180 return 0;
181}
182
178static int lp5521_set_engine_mode(struct lp5521_engine *engine, u8 mode)
183static void lp5521_load_engine(struct lp55xx_chip *chip)
179{
184{
180 struct lp5521_chip *chip = engine_to_lp5521(engine);
181 struct i2c_client *client = chip->client;
182 int ret;
183 u8 engine_state;
185 enum lp55xx_engine_index idx = chip->engine_idx;
186 u8 mask[] = {
187 [LP55XX_ENGINE_1] = LP5521_MODE_R_M,
188 [LP55XX_ENGINE_2] = LP5521_MODE_G_M,
189 [LP55XX_ENGINE_3] = LP5521_MODE_B_M,
190 };
184
191
185 /* Only transition between RUN and DIRECT mode are handled here */
186 if (mode == LP5521_CMD_LOAD)
187 return 0;
192 u8 val[] = {
193 [LP55XX_ENGINE_1] = LP5521_LOAD_R,
194 [LP55XX_ENGINE_2] = LP5521_LOAD_G,
195 [LP55XX_ENGINE_3] = LP5521_LOAD_B,
196 };
188
197
189 if (mode == LP5521_CMD_DISABLED)
190 mode = LP5521_CMD_DIRECT;
198 lp55xx_update_bits(chip, LP5521_REG_OP_MODE, mask[idx], val[idx]);
191
199
192 ret = lp5521_read(client, LP5521_REG_OP_MODE, &engine_state);
193 if (ret < 0)
194 return ret;
200 lp5521_wait_opmode_done();
201}
195
202
196 /* set mode only for this engine */
197 engine_state &= ~(engine->engine_mask);
198 mode &= engine->engine_mask;
199 engine_state |= mode;
200 return lp5521_write(client, LP5521_REG_OP_MODE, engine_state);
203static void lp5521_stop_engine(struct lp55xx_chip *chip)
204{
205 lp55xx_write(chip, LP5521_REG_OP_MODE, 0);
206 lp5521_wait_opmode_done();
201}
202
207}
208
203static int lp5521_load_program(struct lp5521_engine *eng, const u8 *pattern)
209static void lp5521_run_engine(struct lp55xx_chip *chip, bool start)
204{
210{
205 struct lp5521_chip *chip = engine_to_lp5521(eng);
206 struct i2c_client *client = chip->client;
207 int ret;
211 int ret;
208 int addr;
209 u8 mode;
212 u8 mode;
213 u8 exec;
210
214
211 /* move current engine to direct mode and remember the state */
212 ret = lp5521_set_engine_mode(eng, LP5521_CMD_DIRECT);
215 /* stop engine */
216 if (!start) {
217 lp5521_stop_engine(chip);
218 lp55xx_write(chip, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT);
219 lp5521_wait_opmode_done();
220 return;
221 }
222
223 /*
224 * To run the engine,
225 * operation mode and enable register should updated at the same time
226 */
227
228 ret = lp55xx_read(chip, LP5521_REG_OP_MODE, &mode);
213 if (ret)
229 if (ret)
214 return ret;
230 return;
215
231
216 /* Mode change requires min 500 us delay. 1 - 2 ms with margin */
217 usleep_range(1000, 2000);
218 ret = lp5521_read(client, LP5521_REG_OP_MODE, &mode);
232 ret = lp55xx_read(chip, LP5521_REG_ENABLE, &exec);
219 if (ret)
233 if (ret)
220 return ret;
234 return;
221
235
222 /* For loading, all the engines to load mode */
223 lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT);
224 /* Mode change requires min 500 us delay. 1 - 2 ms with margin */
225 usleep_range(1000, 2000);
226 lp5521_write(client, LP5521_REG_OP_MODE, LP5521_CMD_LOAD);
227 /* Mode change requires min 500 us delay. 1 - 2 ms with margin */
228 usleep_range(1000, 2000);
236 /* change operation mode to RUN only when each engine is loading */
237 if (LP5521_R_IS_LOADING(mode)) {
238 mode = (mode & ~LP5521_MODE_R_M) | LP5521_RUN_R;
239 exec = (exec & ~LP5521_EXEC_R_M) | LP5521_RUN_R;
240 }
229
241
230 addr = LP5521_PROG_MEM_BASE + eng->prog_page * LP5521_PROG_MEM_SIZE;
231 i2c_smbus_write_i2c_block_data(client,
232 addr,
233 LP5521_PROG_MEM_SIZE,
234 pattern);
242 if (LP5521_G_IS_LOADING(mode)) {
243 mode = (mode & ~LP5521_MODE_G_M) | LP5521_RUN_G;
244 exec = (exec & ~LP5521_EXEC_G_M) | LP5521_RUN_G;
245 }
235
246
236 return lp5521_write(client, LP5521_REG_OP_MODE, mode);
247 if (LP5521_B_IS_LOADING(mode)) {
248 mode = (mode & ~LP5521_MODE_B_M) | LP5521_RUN_B;
249 exec = (exec & ~LP5521_EXEC_B_M) | LP5521_RUN_B;
250 }
251
252 lp55xx_write(chip, LP5521_REG_OP_MODE, mode);
253 lp5521_wait_opmode_done();
254
255 lp55xx_update_bits(chip, LP5521_REG_ENABLE, LP5521_EXEC_M, exec);
256 lp5521_wait_enable_done();
237}
238
257}
258
259static int lp5521_update_program_memory(struct lp55xx_chip *chip,
260 const u8 *data, size_t size)
261{
262 enum lp55xx_engine_index idx = chip->engine_idx;
263 u8 pattern[LP5521_PROGRAM_LENGTH] = {0};
264 u8 addr[] = {
265 [LP55XX_ENGINE_1] = LP5521_REG_R_PROG_MEM,
266 [LP55XX_ENGINE_2] = LP5521_REG_G_PROG_MEM,
267 [LP55XX_ENGINE_3] = LP5521_REG_B_PROG_MEM,
268 };
269 unsigned cmd;
270 char c[3];
271 int program_size;
272 int nrchars;
273 int offset = 0;
274 int ret;
275 int i;
276
277 /* clear program memory before updating */
278 for (i = 0; i < LP5521_PROGRAM_LENGTH; i++)
279 lp55xx_write(chip, addr[idx] + i, 0);
280
281 i = 0;
282 while ((offset < size - 1) && (i < LP5521_PROGRAM_LENGTH)) {
283 /* separate sscanfs because length is working only for %s */
284 ret = sscanf(data + offset, "%2s%n ", c, &nrchars);
285 if (ret != 1)
286 goto err;
287
288 ret = sscanf(c, "%2x", &cmd);
289 if (ret != 1)
290 goto err;
291
292 pattern[i] = (u8)cmd;
293 offset += nrchars;
294 i++;
295 }
296
297 /* Each instruction is 16bit long. Check that length is even */
298 if (i % 2)
299 goto err;
300
301 program_size = i;
302 for (i = 0; i < program_size; i++)
303 lp55xx_write(chip, addr[idx] + i, pattern[i]);
304
305 return 0;
306
307err:
308 dev_err(&chip->cl->dev, "wrong pattern format\n");
309 return -EINVAL;
310}
311
312static void lp5521_firmware_loaded(struct lp55xx_chip *chip)
313{
314 const struct firmware *fw = chip->fw;
315
316 if (fw->size > LP5521_PROGRAM_LENGTH) {
317 dev_err(&chip->cl->dev, "firmware data size overflow: %zu\n",
318 fw->size);
319 return;
320 }
321
322 /*
323 * Program momery sequence
324 * 1) set engine mode to "LOAD"
325 * 2) write firmware data into program memory
326 */
327
328 lp5521_load_engine(chip);
329 lp5521_update_program_memory(chip, fw->data, fw->size);
330}
331
239static int lp5521_post_init_device(struct lp55xx_chip *chip)
240{
241 int ret;
242 u8 val;
243
244 /*
245 * Make sure that the chip is reset by reading back the r channel
246 * current reg. This is dummy read is required on some platforms -

--- 61 unchanged lines hidden (view full) ---

308 struct lp55xx_chip *chip = led->chip;
309
310 mutex_lock(&chip->lock);
311 lp55xx_write(chip, LP5521_REG_LED_PWM_BASE + led->chan_nr,
312 led->brightness);
313 mutex_unlock(&chip->lock);
314}
315
332static int lp5521_post_init_device(struct lp55xx_chip *chip)
333{
334 int ret;
335 u8 val;
336
337 /*
338 * Make sure that the chip is reset by reading back the r channel
339 * current reg. This is dummy read is required on some platforms -

--- 61 unchanged lines hidden (view full) ---

401 struct lp55xx_chip *chip = led->chip;
402
403 mutex_lock(&chip->lock);
404 lp55xx_write(chip, LP5521_REG_LED_PWM_BASE + led->chan_nr,
405 led->brightness);
406 mutex_unlock(&chip->lock);
407}
408
316/* Set engine mode and create appropriate sysfs attributes, if required. */
317static int lp5521_set_mode(struct lp5521_engine *engine, u8 mode)
318{
319 int ret = 0;
320
321 /* if in that mode already do nothing, except for run */
322 if (mode == engine->mode && mode != LP5521_CMD_RUN)
323 return 0;
324
325 if (mode == LP5521_CMD_RUN) {
326 ret = lp5521_set_engine_mode(engine, LP5521_CMD_RUN);
327 } else if (mode == LP5521_CMD_LOAD) {
328 lp5521_set_engine_mode(engine, LP5521_CMD_DISABLED);
329 lp5521_set_engine_mode(engine, LP5521_CMD_LOAD);
330 } else if (mode == LP5521_CMD_DISABLED) {
331 lp5521_set_engine_mode(engine, LP5521_CMD_DISABLED);
332 }
333
334 engine->mode = mode;
335
336 return ret;
337}
338
339static int lp5521_do_store_load(struct lp5521_engine *engine,
340 const char *buf, size_t len)
341{
342 struct lp5521_chip *chip = engine_to_lp5521(engine);
343 struct i2c_client *client = chip->client;
344 int ret, nrchars, offset = 0, i = 0;
345 char c[3];
346 unsigned cmd;
347 u8 pattern[LP5521_PROGRAM_LENGTH] = {0};
348
349 while ((offset < len - 1) && (i < LP5521_PROGRAM_LENGTH)) {
350 /* separate sscanfs because length is working only for %s */
351 ret = sscanf(buf + offset, "%2s%n ", c, &nrchars);
352 if (ret != 2)
353 goto fail;
354 ret = sscanf(c, "%2x", &cmd);
355 if (ret != 1)
356 goto fail;
357 pattern[i] = (u8)cmd;
358
359 offset += nrchars;
360 i++;
361 }
362
363 /* Each instruction is 16bit long. Check that length is even */
364 if (i % 2)
365 goto fail;
366
367 mutex_lock(&chip->lock);
368 if (engine->mode == LP5521_CMD_LOAD)
369 ret = lp5521_load_program(engine, pattern);
370 else
371 ret = -EINVAL;
372 mutex_unlock(&chip->lock);
373
374 if (ret) {
375 dev_err(&client->dev, "failed loading pattern\n");
376 return ret;
377 }
378
379 return len;
380fail:
381 dev_err(&client->dev, "wrong pattern format\n");
382 return -EINVAL;
383}
384
385static ssize_t store_engine_load(struct device *dev,
386 struct device_attribute *attr,
387 const char *buf, size_t len, int nr)
388{
389 struct i2c_client *client = to_i2c_client(dev);
390 struct lp5521_chip *chip = i2c_get_clientdata(client);
391 return lp5521_do_store_load(&chip->engines[nr - 1], buf, len);
392}
393
394#define store_load(nr) \
395static ssize_t store_engine##nr##_load(struct device *dev, \
396 struct device_attribute *attr, \
397 const char *buf, size_t len) \
398{ \
399 return store_engine_load(dev, attr, buf, len, nr); \
400}
401store_load(1)
402store_load(2)
403store_load(3)
404
405static ssize_t show_engine_mode(struct device *dev,
406 struct device_attribute *attr,
407 char *buf, int nr)
408{
409 struct i2c_client *client = to_i2c_client(dev);
410 struct lp5521_chip *chip = i2c_get_clientdata(client);
411 switch (chip->engines[nr - 1].mode) {
412 case LP5521_CMD_RUN:
413 return sprintf(buf, "run\n");
414 case LP5521_CMD_LOAD:
415 return sprintf(buf, "load\n");
416 case LP5521_CMD_DISABLED:
417 return sprintf(buf, "disabled\n");
418 default:
419 return sprintf(buf, "disabled\n");
420 }
421}
422
423#define show_mode(nr) \
424static ssize_t show_engine##nr##_mode(struct device *dev, \
425 struct device_attribute *attr, \
426 char *buf) \
427{ \
428 return show_engine_mode(dev, attr, buf, nr); \
429}
430show_mode(1)
431show_mode(2)
432show_mode(3)
433
434static ssize_t store_engine_mode(struct device *dev,
435 struct device_attribute *attr,
436 const char *buf, size_t len, int nr)
437{
438 struct i2c_client *client = to_i2c_client(dev);
439 struct lp5521_chip *chip = i2c_get_clientdata(client);
440 struct lp5521_engine *engine = &chip->engines[nr - 1];
441 mutex_lock(&chip->lock);
442
443 if (!strncmp(buf, "run", 3))
444 lp5521_set_mode(engine, LP5521_CMD_RUN);
445 else if (!strncmp(buf, "load", 4))
446 lp5521_set_mode(engine, LP5521_CMD_LOAD);
447 else if (!strncmp(buf, "disabled", 8))
448 lp5521_set_mode(engine, LP5521_CMD_DISABLED);
449
450 mutex_unlock(&chip->lock);
451 return len;
452}
453
454#define store_mode(nr) \
455static ssize_t store_engine##nr##_mode(struct device *dev, \
456 struct device_attribute *attr, \
457 const char *buf, size_t len) \
458{ \
459 return store_engine_mode(dev, attr, buf, len, nr); \
460}
461store_mode(1)
462store_mode(2)
463store_mode(3)
464
465static ssize_t lp5521_selftest(struct device *dev,
466 struct device_attribute *attr,
467 char *buf)
468{
469 struct i2c_client *client = to_i2c_client(dev);
470 struct lp5521_chip *chip = i2c_get_clientdata(client);
471 int ret;
472

--- 72 unchanged lines hidden (view full) ---

545 ptn->b, ptn->size_b);
546
547 lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_RUN);
548 usleep_range(1000, 2000);
549 lp5521_write(cl, LP5521_REG_ENABLE, LP5521_ENABLE_RUN_PROGRAM);
550 }
551}
552
409static ssize_t lp5521_selftest(struct device *dev,
410 struct device_attribute *attr,
411 char *buf)
412{
413 struct i2c_client *client = to_i2c_client(dev);
414 struct lp5521_chip *chip = i2c_get_clientdata(client);
415 int ret;
416

--- 72 unchanged lines hidden (view full) ---

489 ptn->b, ptn->size_b);
490
491 lp5521_write(cl, LP5521_REG_OP_MODE, LP5521_CMD_RUN);
492 usleep_range(1000, 2000);
493 lp5521_write(cl, LP5521_REG_ENABLE, LP5521_ENABLE_RUN_PROGRAM);
494 }
495}
496
553static ssize_t store_led_pattern(struct device *dev,
554 struct device_attribute *attr,
555 const char *buf, size_t len)
556{
557 struct lp5521_chip *chip = i2c_get_clientdata(to_i2c_client(dev));
558 unsigned long val;
559 int ret;
560
561 ret = kstrtoul(buf, 16, &val);
562 if (ret)
563 return ret;
564
565 lp5521_run_led_pattern(val, chip);
566
567 return len;
568}
569
570/* device attributes */
497/* device attributes */
571static DEVICE_ATTR(engine1_mode, S_IRUGO | S_IWUSR,
572 show_engine1_mode, store_engine1_mode);
573static DEVICE_ATTR(engine2_mode, S_IRUGO | S_IWUSR,
574 show_engine2_mode, store_engine2_mode);
575static DEVICE_ATTR(engine3_mode, S_IRUGO | S_IWUSR,
576 show_engine3_mode, store_engine3_mode);
577static DEVICE_ATTR(engine1_load, S_IWUSR, NULL, store_engine1_load);
578static DEVICE_ATTR(engine2_load, S_IWUSR, NULL, store_engine2_load);
579static DEVICE_ATTR(engine3_load, S_IWUSR, NULL, store_engine3_load);
580static DEVICE_ATTR(selftest, S_IRUGO, lp5521_selftest, NULL);
498static DEVICE_ATTR(selftest, S_IRUGO, lp5521_selftest, NULL);
581static DEVICE_ATTR(led_pattern, S_IWUSR, NULL, store_led_pattern);
582
583static struct attribute *lp5521_attributes[] = {
499
500static struct attribute *lp5521_attributes[] = {
584 &dev_attr_engine1_mode.attr,
585 &dev_attr_engine2_mode.attr,
586 &dev_attr_engine3_mode.attr,
587 &dev_attr_selftest.attr,
501 &dev_attr_selftest.attr,
588 &dev_attr_engine1_load.attr,
589 &dev_attr_engine2_load.attr,
590 &dev_attr_engine3_load.attr,
591 &dev_attr_led_pattern.attr,
592 NULL
593};
594
595static const struct attribute_group lp5521_group = {
596 .attrs = lp5521_attributes,
597};
598
599static int lp5521_register_sysfs(struct i2c_client *client)

--- 18 unchanged lines hidden (view full) ---

618 .enable = {
619 .addr = LP5521_REG_ENABLE,
620 .val = LP5521_ENABLE_DEFAULT,
621 },
622 .max_channel = LP5521_MAX_LEDS,
623 .post_init_device = lp5521_post_init_device,
624 .brightness_work_fn = lp5521_led_brightness_work,
625 .set_led_current = lp5521_set_led_current,
502 NULL
503};
504
505static const struct attribute_group lp5521_group = {
506 .attrs = lp5521_attributes,
507};
508
509static int lp5521_register_sysfs(struct i2c_client *client)

--- 18 unchanged lines hidden (view full) ---

528 .enable = {
529 .addr = LP5521_REG_ENABLE,
530 .val = LP5521_ENABLE_DEFAULT,
531 },
532 .max_channel = LP5521_MAX_LEDS,
533 .post_init_device = lp5521_post_init_device,
534 .brightness_work_fn = lp5521_led_brightness_work,
535 .set_led_current = lp5521_set_led_current,
536 .firmware_cb = lp5521_firmware_loaded,
537 .run_engine = lp5521_run_engine,
626};
627
628static int lp5521_probe(struct i2c_client *client,
629 const struct i2c_device_id *id)
630{
631 int ret;
632 struct lp55xx_chip *chip;
633 struct lp55xx_led *led;

--- 83 unchanged lines hidden ---
538};
539
540static int lp5521_probe(struct i2c_client *client,
541 const struct i2c_device_id *id)
542{
543 int ret;
544 struct lp55xx_chip *chip;
545 struct lp55xx_led *led;

--- 83 unchanged lines hidden ---