leds-lp5521.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /*
  2. * LP5521 LED chip driver.
  3. *
  4. * Copyright (C) 2010 Nokia Corporation
  5. * Copyright (C) 2012 Texas Instruments
  6. *
  7. * Contact: Samu Onkalo <samu.p.onkalo@nokia.com>
  8. * Milo(Woogyom) Kim <milo.kim@ti.com>
  9. *
  10. * This program is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU General Public License
  12. * version 2 as published by the Free Software Foundation.
  13. *
  14. * This program is distributed in the hope that it will be useful, but
  15. * WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  22. * 02110-1301 USA
  23. */
  24. #include <linux/delay.h>
  25. #include <linux/firmware.h>
  26. #include <linux/i2c.h>
  27. #include <linux/init.h>
  28. #include <linux/leds.h>
  29. #include <linux/module.h>
  30. #include <linux/mutex.h>
  31. #include <linux/platform_data/leds-lp55xx.h>
  32. #include <linux/slab.h>
  33. #include <linux/of.h>
  34. #include "leds-lp55xx-common.h"
  35. #define LP5521_PROGRAM_LENGTH 32
  36. #define LP5521_MAX_LEDS 3
  37. #define LP5521_CMD_DIRECT 0x3F
  38. /* Registers */
  39. #define LP5521_REG_ENABLE 0x00
  40. #define LP5521_REG_OP_MODE 0x01
  41. #define LP5521_REG_R_PWM 0x02
  42. #define LP5521_REG_G_PWM 0x03
  43. #define LP5521_REG_B_PWM 0x04
  44. #define LP5521_REG_R_CURRENT 0x05
  45. #define LP5521_REG_G_CURRENT 0x06
  46. #define LP5521_REG_B_CURRENT 0x07
  47. #define LP5521_REG_CONFIG 0x08
  48. #define LP5521_REG_STATUS 0x0C
  49. #define LP5521_REG_RESET 0x0D
  50. #define LP5521_REG_R_PROG_MEM 0x10
  51. #define LP5521_REG_G_PROG_MEM 0x30
  52. #define LP5521_REG_B_PROG_MEM 0x50
  53. /* Base register to set LED current */
  54. #define LP5521_REG_LED_CURRENT_BASE LP5521_REG_R_CURRENT
  55. /* Base register to set the brightness */
  56. #define LP5521_REG_LED_PWM_BASE LP5521_REG_R_PWM
  57. /* Bits in ENABLE register */
  58. #define LP5521_MASTER_ENABLE 0x40 /* Chip master enable */
  59. #define LP5521_LOGARITHMIC_PWM 0x80 /* Logarithmic PWM adjustment */
  60. #define LP5521_EXEC_RUN 0x2A
  61. #define LP5521_ENABLE_DEFAULT \
  62. (LP5521_MASTER_ENABLE | LP5521_LOGARITHMIC_PWM)
  63. #define LP5521_ENABLE_RUN_PROGRAM \
  64. (LP5521_ENABLE_DEFAULT | LP5521_EXEC_RUN)
  65. /* CONFIG register */
  66. #define LP5521_PWM_HF 0x40 /* PWM: 0 = 256Hz, 1 = 558Hz */
  67. #define LP5521_PWRSAVE_EN 0x20 /* 1 = Power save mode */
  68. #define LP5521_CP_MODE_OFF 0 /* Charge pump (CP) off */
  69. #define LP5521_CP_MODE_BYPASS 8 /* CP forced to bypass mode */
  70. #define LP5521_CP_MODE_1X5 0x10 /* CP forced to 1.5x mode */
  71. #define LP5521_CP_MODE_AUTO 0x18 /* Automatic mode selection */
  72. #define LP5521_R_TO_BATT 0x04 /* R out: 0 = CP, 1 = Vbat */
  73. #define LP5521_CLK_INT 0x01 /* Internal clock */
  74. #define LP5521_DEFAULT_CFG \
  75. (LP5521_PWM_HF | LP5521_PWRSAVE_EN | LP5521_CP_MODE_AUTO)
  76. /* Status */
  77. #define LP5521_EXT_CLK_USED 0x08
  78. /* default R channel current register value */
  79. #define LP5521_REG_R_CURR_DEFAULT 0xAF
  80. /* Reset register value */
  81. #define LP5521_RESET 0xFF
  82. /* Program Memory Operations */
  83. #define LP5521_MODE_R_M 0x30 /* Operation Mode Register */
  84. #define LP5521_MODE_G_M 0x0C
  85. #define LP5521_MODE_B_M 0x03
  86. #define LP5521_LOAD_R 0x10
  87. #define LP5521_LOAD_G 0x04
  88. #define LP5521_LOAD_B 0x01
  89. #define LP5521_R_IS_LOADING(mode) \
  90. ((mode & LP5521_MODE_R_M) == LP5521_LOAD_R)
  91. #define LP5521_G_IS_LOADING(mode) \
  92. ((mode & LP5521_MODE_G_M) == LP5521_LOAD_G)
  93. #define LP5521_B_IS_LOADING(mode) \
  94. ((mode & LP5521_MODE_B_M) == LP5521_LOAD_B)
  95. #define LP5521_EXEC_R_M 0x30 /* Enable Register */
  96. #define LP5521_EXEC_G_M 0x0C
  97. #define LP5521_EXEC_B_M 0x03
  98. #define LP5521_EXEC_M 0x3F
  99. #define LP5521_RUN_R 0x20
  100. #define LP5521_RUN_G 0x08
  101. #define LP5521_RUN_B 0x02
  102. static inline void lp5521_wait_opmode_done(void)
  103. {
  104. /* operation mode change needs to be longer than 153 us */
  105. usleep_range(200, 300);
  106. }
  107. static inline void lp5521_wait_enable_done(void)
  108. {
  109. /* it takes more 488 us to update ENABLE register */
  110. usleep_range(500, 600);
  111. }
  112. static void lp5521_set_led_current(struct lp55xx_led *led, u8 led_current)
  113. {
  114. led->led_current = led_current;
  115. lp55xx_write(led->chip, LP5521_REG_LED_CURRENT_BASE + led->chan_nr,
  116. led_current);
  117. }
  118. static void lp5521_load_engine(struct lp55xx_chip *chip)
  119. {
  120. enum lp55xx_engine_index idx = chip->engine_idx;
  121. u8 mask[] = {
  122. [LP55XX_ENGINE_1] = LP5521_MODE_R_M,
  123. [LP55XX_ENGINE_2] = LP5521_MODE_G_M,
  124. [LP55XX_ENGINE_3] = LP5521_MODE_B_M,
  125. };
  126. u8 val[] = {
  127. [LP55XX_ENGINE_1] = LP5521_LOAD_R,
  128. [LP55XX_ENGINE_2] = LP5521_LOAD_G,
  129. [LP55XX_ENGINE_3] = LP5521_LOAD_B,
  130. };
  131. lp55xx_update_bits(chip, LP5521_REG_OP_MODE, mask[idx], val[idx]);
  132. lp5521_wait_opmode_done();
  133. }
  134. static void lp5521_stop_engine(struct lp55xx_chip *chip)
  135. {
  136. lp55xx_write(chip, LP5521_REG_OP_MODE, 0);
  137. lp5521_wait_opmode_done();
  138. }
  139. static void lp5521_run_engine(struct lp55xx_chip *chip, bool start)
  140. {
  141. int ret;
  142. u8 mode;
  143. u8 exec;
  144. /* stop engine */
  145. if (!start) {
  146. lp5521_stop_engine(chip);
  147. lp55xx_write(chip, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT);
  148. lp5521_wait_opmode_done();
  149. return;
  150. }
  151. /*
  152. * To run the engine,
  153. * operation mode and enable register should updated at the same time
  154. */
  155. ret = lp55xx_read(chip, LP5521_REG_OP_MODE, &mode);
  156. if (ret)
  157. return;
  158. ret = lp55xx_read(chip, LP5521_REG_ENABLE, &exec);
  159. if (ret)
  160. return;
  161. /* change operation mode to RUN only when each engine is loading */
  162. if (LP5521_R_IS_LOADING(mode)) {
  163. mode = (mode & ~LP5521_MODE_R_M) | LP5521_RUN_R;
  164. exec = (exec & ~LP5521_EXEC_R_M) | LP5521_RUN_R;
  165. }
  166. if (LP5521_G_IS_LOADING(mode)) {
  167. mode = (mode & ~LP5521_MODE_G_M) | LP5521_RUN_G;
  168. exec = (exec & ~LP5521_EXEC_G_M) | LP5521_RUN_G;
  169. }
  170. if (LP5521_B_IS_LOADING(mode)) {
  171. mode = (mode & ~LP5521_MODE_B_M) | LP5521_RUN_B;
  172. exec = (exec & ~LP5521_EXEC_B_M) | LP5521_RUN_B;
  173. }
  174. lp55xx_write(chip, LP5521_REG_OP_MODE, mode);
  175. lp5521_wait_opmode_done();
  176. lp55xx_update_bits(chip, LP5521_REG_ENABLE, LP5521_EXEC_M, exec);
  177. lp5521_wait_enable_done();
  178. }
  179. static int lp5521_update_program_memory(struct lp55xx_chip *chip,
  180. const u8 *data, size_t size)
  181. {
  182. enum lp55xx_engine_index idx = chip->engine_idx;
  183. u8 pattern[LP5521_PROGRAM_LENGTH] = {0};
  184. u8 addr[] = {
  185. [LP55XX_ENGINE_1] = LP5521_REG_R_PROG_MEM,
  186. [LP55XX_ENGINE_2] = LP5521_REG_G_PROG_MEM,
  187. [LP55XX_ENGINE_3] = LP5521_REG_B_PROG_MEM,
  188. };
  189. unsigned cmd;
  190. char c[3];
  191. int program_size;
  192. int nrchars;
  193. int offset = 0;
  194. int ret;
  195. int i;
  196. /* clear program memory before updating */
  197. for (i = 0; i < LP5521_PROGRAM_LENGTH; i++)
  198. lp55xx_write(chip, addr[idx] + i, 0);
  199. i = 0;
  200. while ((offset < size - 1) && (i < LP5521_PROGRAM_LENGTH)) {
  201. /* separate sscanfs because length is working only for %s */
  202. ret = sscanf(data + offset, "%2s%n ", c, &nrchars);
  203. if (ret != 1)
  204. goto err;
  205. ret = sscanf(c, "%2x", &cmd);
  206. if (ret != 1)
  207. goto err;
  208. pattern[i] = (u8)cmd;
  209. offset += nrchars;
  210. i++;
  211. }
  212. /* Each instruction is 16bit long. Check that length is even */
  213. if (i % 2)
  214. goto err;
  215. program_size = i;
  216. mutex_lock(&chip->lock);
  217. for (i = 0; i < program_size; i++) {
  218. ret = lp55xx_write(chip, addr[idx] + i, pattern[i]);
  219. if (ret) {
  220. mutex_unlock(&chip->lock);
  221. return -EINVAL;
  222. }
  223. }
  224. mutex_unlock(&chip->lock);
  225. return size;
  226. err:
  227. dev_err(&chip->cl->dev, "wrong pattern format\n");
  228. return -EINVAL;
  229. }
  230. static void lp5521_firmware_loaded(struct lp55xx_chip *chip)
  231. {
  232. const struct firmware *fw = chip->fw;
  233. if (fw->size > LP5521_PROGRAM_LENGTH) {
  234. dev_err(&chip->cl->dev, "firmware data size overflow: %zu\n",
  235. fw->size);
  236. return;
  237. }
  238. /*
  239. * Program momery sequence
  240. * 1) set engine mode to "LOAD"
  241. * 2) write firmware data into program memory
  242. */
  243. lp5521_load_engine(chip);
  244. lp5521_update_program_memory(chip, fw->data, fw->size);
  245. }
  246. static int lp5521_post_init_device(struct lp55xx_chip *chip)
  247. {
  248. int ret;
  249. u8 val;
  250. /*
  251. * Make sure that the chip is reset by reading back the r channel
  252. * current reg. This is dummy read is required on some platforms -
  253. * otherwise further access to the R G B channels in the
  254. * LP5521_REG_ENABLE register will not have any effect - strange!
  255. */
  256. ret = lp55xx_read(chip, LP5521_REG_R_CURRENT, &val);
  257. if (ret) {
  258. dev_err(&chip->cl->dev, "error in resetting chip\n");
  259. return ret;
  260. }
  261. if (val != LP5521_REG_R_CURR_DEFAULT) {
  262. dev_err(&chip->cl->dev,
  263. "unexpected data in register (expected 0x%x got 0x%x)\n",
  264. LP5521_REG_R_CURR_DEFAULT, val);
  265. ret = -EINVAL;
  266. return ret;
  267. }
  268. usleep_range(10000, 20000);
  269. /* Set all PWMs to direct control mode */
  270. ret = lp55xx_write(chip, LP5521_REG_OP_MODE, LP5521_CMD_DIRECT);
  271. /* Update configuration for the clock setting */
  272. val = LP5521_DEFAULT_CFG;
  273. if (!lp55xx_is_extclk_used(chip))
  274. val |= LP5521_CLK_INT;
  275. ret = lp55xx_write(chip, LP5521_REG_CONFIG, val);
  276. if (ret)
  277. return ret;
  278. /* Initialize all channels PWM to zero -> leds off */
  279. lp55xx_write(chip, LP5521_REG_R_PWM, 0);
  280. lp55xx_write(chip, LP5521_REG_G_PWM, 0);
  281. lp55xx_write(chip, LP5521_REG_B_PWM, 0);
  282. /* Set engines are set to run state when OP_MODE enables engines */
  283. ret = lp55xx_write(chip, LP5521_REG_ENABLE, LP5521_ENABLE_RUN_PROGRAM);
  284. if (ret)
  285. return ret;
  286. lp5521_wait_enable_done();
  287. return 0;
  288. }
  289. static int lp5521_run_selftest(struct lp55xx_chip *chip, char *buf)
  290. {
  291. struct lp55xx_platform_data *pdata = chip->pdata;
  292. int ret;
  293. u8 status;
  294. ret = lp55xx_read(chip, LP5521_REG_STATUS, &status);
  295. if (ret < 0)
  296. return ret;
  297. if (pdata->clock_mode != LP55XX_CLOCK_EXT)
  298. return 0;
  299. /* Check that ext clock is really in use if requested */
  300. if ((status & LP5521_EXT_CLK_USED) == 0)
  301. return -EIO;
  302. return 0;
  303. }
  304. static void lp5521_led_brightness_work(struct work_struct *work)
  305. {
  306. struct lp55xx_led *led = container_of(work, struct lp55xx_led,
  307. brightness_work);
  308. struct lp55xx_chip *chip = led->chip;
  309. mutex_lock(&chip->lock);
  310. lp55xx_write(chip, LP5521_REG_LED_PWM_BASE + led->chan_nr,
  311. led->brightness);
  312. mutex_unlock(&chip->lock);
  313. }
  314. static ssize_t show_engine_mode(struct device *dev,
  315. struct device_attribute *attr,
  316. char *buf, int nr)
  317. {
  318. struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
  319. struct lp55xx_chip *chip = led->chip;
  320. enum lp55xx_engine_mode mode = chip->engines[nr - 1].mode;
  321. switch (mode) {
  322. case LP55XX_ENGINE_RUN:
  323. return sprintf(buf, "run\n");
  324. case LP55XX_ENGINE_LOAD:
  325. return sprintf(buf, "load\n");
  326. case LP55XX_ENGINE_DISABLED:
  327. default:
  328. return sprintf(buf, "disabled\n");
  329. }
  330. }
  331. show_mode(1)
  332. show_mode(2)
  333. show_mode(3)
  334. static ssize_t store_engine_mode(struct device *dev,
  335. struct device_attribute *attr,
  336. const char *buf, size_t len, int nr)
  337. {
  338. struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
  339. struct lp55xx_chip *chip = led->chip;
  340. struct lp55xx_engine *engine = &chip->engines[nr - 1];
  341. mutex_lock(&chip->lock);
  342. chip->engine_idx = nr;
  343. if (!strncmp(buf, "run", 3)) {
  344. lp5521_run_engine(chip, true);
  345. engine->mode = LP55XX_ENGINE_RUN;
  346. } else if (!strncmp(buf, "load", 4)) {
  347. lp5521_stop_engine(chip);
  348. lp5521_load_engine(chip);
  349. engine->mode = LP55XX_ENGINE_LOAD;
  350. } else if (!strncmp(buf, "disabled", 8)) {
  351. lp5521_stop_engine(chip);
  352. engine->mode = LP55XX_ENGINE_DISABLED;
  353. }
  354. mutex_unlock(&chip->lock);
  355. return len;
  356. }
  357. store_mode(1)
  358. store_mode(2)
  359. store_mode(3)
  360. static ssize_t store_engine_load(struct device *dev,
  361. struct device_attribute *attr,
  362. const char *buf, size_t len, int nr)
  363. {
  364. struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
  365. struct lp55xx_chip *chip = led->chip;
  366. mutex_lock(&chip->lock);
  367. chip->engine_idx = nr;
  368. lp5521_load_engine(chip);
  369. mutex_unlock(&chip->lock);
  370. return lp5521_update_program_memory(chip, buf, len);
  371. }
  372. store_load(1)
  373. store_load(2)
  374. store_load(3)
  375. static ssize_t lp5521_selftest(struct device *dev,
  376. struct device_attribute *attr,
  377. char *buf)
  378. {
  379. struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
  380. struct lp55xx_chip *chip = led->chip;
  381. int ret;
  382. mutex_lock(&chip->lock);
  383. ret = lp5521_run_selftest(chip, buf);
  384. mutex_unlock(&chip->lock);
  385. return scnprintf(buf, PAGE_SIZE, "%s\n", ret ? "FAIL" : "OK");
  386. }
  387. /* device attributes */
  388. static LP55XX_DEV_ATTR_RW(engine1_mode, show_engine1_mode, store_engine1_mode);
  389. static LP55XX_DEV_ATTR_RW(engine2_mode, show_engine2_mode, store_engine2_mode);
  390. static LP55XX_DEV_ATTR_RW(engine3_mode, show_engine3_mode, store_engine3_mode);
  391. static LP55XX_DEV_ATTR_WO(engine1_load, store_engine1_load);
  392. static LP55XX_DEV_ATTR_WO(engine2_load, store_engine2_load);
  393. static LP55XX_DEV_ATTR_WO(engine3_load, store_engine3_load);
  394. static LP55XX_DEV_ATTR_RO(selftest, lp5521_selftest);
  395. static struct attribute *lp5521_attributes[] = {
  396. &dev_attr_engine1_mode.attr,
  397. &dev_attr_engine2_mode.attr,
  398. &dev_attr_engine3_mode.attr,
  399. &dev_attr_engine1_load.attr,
  400. &dev_attr_engine2_load.attr,
  401. &dev_attr_engine3_load.attr,
  402. &dev_attr_selftest.attr,
  403. NULL
  404. };
  405. static const struct attribute_group lp5521_group = {
  406. .attrs = lp5521_attributes,
  407. };
  408. /* Chip specific configurations */
  409. static struct lp55xx_device_config lp5521_cfg = {
  410. .reset = {
  411. .addr = LP5521_REG_RESET,
  412. .val = LP5521_RESET,
  413. },
  414. .enable = {
  415. .addr = LP5521_REG_ENABLE,
  416. .val = LP5521_ENABLE_DEFAULT,
  417. },
  418. .max_channel = LP5521_MAX_LEDS,
  419. .post_init_device = lp5521_post_init_device,
  420. .brightness_work_fn = lp5521_led_brightness_work,
  421. .set_led_current = lp5521_set_led_current,
  422. .firmware_cb = lp5521_firmware_loaded,
  423. .run_engine = lp5521_run_engine,
  424. .dev_attr_group = &lp5521_group,
  425. };
  426. static int lp5521_probe(struct i2c_client *client,
  427. const struct i2c_device_id *id)
  428. {
  429. int ret;
  430. struct lp55xx_chip *chip;
  431. struct lp55xx_led *led;
  432. struct lp55xx_platform_data *pdata;
  433. struct device_node *np = client->dev.of_node;
  434. if (!dev_get_platdata(&client->dev)) {
  435. if (np) {
  436. ret = lp55xx_of_populate_pdata(&client->dev, np);
  437. if (ret < 0)
  438. return ret;
  439. } else {
  440. dev_err(&client->dev, "no platform data\n");
  441. return -EINVAL;
  442. }
  443. }
  444. pdata = dev_get_platdata(&client->dev);
  445. chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
  446. if (!chip)
  447. return -ENOMEM;
  448. led = devm_kzalloc(&client->dev,
  449. sizeof(*led) * pdata->num_channels, GFP_KERNEL);
  450. if (!led)
  451. return -ENOMEM;
  452. chip->cl = client;
  453. chip->pdata = pdata;
  454. chip->cfg = &lp5521_cfg;
  455. mutex_init(&chip->lock);
  456. i2c_set_clientdata(client, led);
  457. ret = lp55xx_init_device(chip);
  458. if (ret)
  459. goto err_init;
  460. dev_info(&client->dev, "%s programmable led chip found\n", id->name);
  461. ret = lp55xx_register_leds(led, chip);
  462. if (ret)
  463. goto err_register_leds;
  464. ret = lp55xx_register_sysfs(chip);
  465. if (ret) {
  466. dev_err(&client->dev, "registering sysfs failed\n");
  467. goto err_register_sysfs;
  468. }
  469. return 0;
  470. err_register_sysfs:
  471. lp55xx_unregister_leds(led, chip);
  472. err_register_leds:
  473. lp55xx_deinit_device(chip);
  474. err_init:
  475. return ret;
  476. }
  477. static int lp5521_remove(struct i2c_client *client)
  478. {
  479. struct lp55xx_led *led = i2c_get_clientdata(client);
  480. struct lp55xx_chip *chip = led->chip;
  481. lp5521_stop_engine(chip);
  482. lp55xx_unregister_sysfs(chip);
  483. lp55xx_unregister_leds(led, chip);
  484. lp55xx_deinit_device(chip);
  485. return 0;
  486. }
  487. static const struct i2c_device_id lp5521_id[] = {
  488. { "lp5521", 0 }, /* Three channel chip */
  489. { }
  490. };
  491. MODULE_DEVICE_TABLE(i2c, lp5521_id);
  492. #ifdef CONFIG_OF
  493. static const struct of_device_id of_lp5521_leds_match[] = {
  494. { .compatible = "national,lp5521", },
  495. {},
  496. };
  497. MODULE_DEVICE_TABLE(of, of_lp5521_leds_match);
  498. #endif
  499. static struct i2c_driver lp5521_driver = {
  500. .driver = {
  501. .name = "lp5521",
  502. .of_match_table = of_match_ptr(of_lp5521_leds_match),
  503. },
  504. .probe = lp5521_probe,
  505. .remove = lp5521_remove,
  506. .id_table = lp5521_id,
  507. };
  508. module_i2c_driver(lp5521_driver);
  509. MODULE_AUTHOR("Mathias Nyman, Yuri Zaporozhets, Samu Onkalo");
  510. MODULE_AUTHOR("Milo Kim <milo.kim@ti.com>");
  511. MODULE_DESCRIPTION("LP5521 LED engine");
  512. MODULE_LICENSE("GPL v2");