leds-lp5562.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /*
  2. * LP5562 LED driver
  3. *
  4. * Copyright (C) 2013 Texas Instruments
  5. *
  6. * Author: Milo(Woogyom) Kim <milo.kim@ti.com>
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #include <linux/delay.h>
  13. #include <linux/firmware.h>
  14. #include <linux/i2c.h>
  15. #include <linux/leds.h>
  16. #include <linux/module.h>
  17. #include <linux/mutex.h>
  18. #include <linux/of.h>
  19. #include <linux/platform_data/leds-lp55xx.h>
  20. #include <linux/slab.h>
  21. #include "leds-lp55xx-common.h"
  22. #define LP5562_PROGRAM_LENGTH 32
  23. #define LP5562_MAX_LEDS 4
  24. /* ENABLE Register 00h */
  25. #define LP5562_REG_ENABLE 0x00
  26. #define LP5562_EXEC_ENG1_M 0x30
  27. #define LP5562_EXEC_ENG2_M 0x0C
  28. #define LP5562_EXEC_ENG3_M 0x03
  29. #define LP5562_EXEC_M 0x3F
  30. #define LP5562_MASTER_ENABLE 0x40 /* Chip master enable */
  31. #define LP5562_LOGARITHMIC_PWM 0x80 /* Logarithmic PWM adjustment */
  32. #define LP5562_EXEC_RUN 0x2A
  33. #define LP5562_ENABLE_DEFAULT \
  34. (LP5562_MASTER_ENABLE | LP5562_LOGARITHMIC_PWM)
  35. #define LP5562_ENABLE_RUN_PROGRAM \
  36. (LP5562_ENABLE_DEFAULT | LP5562_EXEC_RUN)
  37. /* OPMODE Register 01h */
  38. #define LP5562_REG_OP_MODE 0x01
  39. #define LP5562_MODE_ENG1_M 0x30
  40. #define LP5562_MODE_ENG2_M 0x0C
  41. #define LP5562_MODE_ENG3_M 0x03
  42. #define LP5562_LOAD_ENG1 0x10
  43. #define LP5562_LOAD_ENG2 0x04
  44. #define LP5562_LOAD_ENG3 0x01
  45. #define LP5562_RUN_ENG1 0x20
  46. #define LP5562_RUN_ENG2 0x08
  47. #define LP5562_RUN_ENG3 0x02
  48. #define LP5562_ENG1_IS_LOADING(mode) \
  49. ((mode & LP5562_MODE_ENG1_M) == LP5562_LOAD_ENG1)
  50. #define LP5562_ENG2_IS_LOADING(mode) \
  51. ((mode & LP5562_MODE_ENG2_M) == LP5562_LOAD_ENG2)
  52. #define LP5562_ENG3_IS_LOADING(mode) \
  53. ((mode & LP5562_MODE_ENG3_M) == LP5562_LOAD_ENG3)
  54. /* BRIGHTNESS Registers */
  55. #define LP5562_REG_R_PWM 0x04
  56. #define LP5562_REG_G_PWM 0x03
  57. #define LP5562_REG_B_PWM 0x02
  58. #define LP5562_REG_W_PWM 0x0E
  59. /* CURRENT Registers */
  60. #define LP5562_REG_R_CURRENT 0x07
  61. #define LP5562_REG_G_CURRENT 0x06
  62. #define LP5562_REG_B_CURRENT 0x05
  63. #define LP5562_REG_W_CURRENT 0x0F
  64. /* CONFIG Register 08h */
  65. #define LP5562_REG_CONFIG 0x08
  66. #define LP5562_PWM_HF 0x40
  67. #define LP5562_PWRSAVE_EN 0x20
  68. #define LP5562_CLK_INT 0x01 /* Internal clock */
  69. #define LP5562_DEFAULT_CFG (LP5562_PWM_HF | LP5562_PWRSAVE_EN)
  70. /* RESET Register 0Dh */
  71. #define LP5562_REG_RESET 0x0D
  72. #define LP5562_RESET 0xFF
  73. /* PROGRAM ENGINE Registers */
  74. #define LP5562_REG_PROG_MEM_ENG1 0x10
  75. #define LP5562_REG_PROG_MEM_ENG2 0x30
  76. #define LP5562_REG_PROG_MEM_ENG3 0x50
  77. /* LEDMAP Register 70h */
  78. #define LP5562_REG_ENG_SEL 0x70
  79. #define LP5562_ENG_SEL_PWM 0
  80. #define LP5562_ENG_FOR_RGB_M 0x3F
  81. #define LP5562_ENG_SEL_RGB 0x1B /* R:ENG1, G:ENG2, B:ENG3 */
  82. #define LP5562_ENG_FOR_W_M 0xC0
  83. #define LP5562_ENG1_FOR_W 0x40 /* W:ENG1 */
  84. #define LP5562_ENG2_FOR_W 0x80 /* W:ENG2 */
  85. #define LP5562_ENG3_FOR_W 0xC0 /* W:ENG3 */
  86. /* Program Commands */
  87. #define LP5562_CMD_DISABLE 0x00
  88. #define LP5562_CMD_LOAD 0x15
  89. #define LP5562_CMD_RUN 0x2A
  90. #define LP5562_CMD_DIRECT 0x3F
  91. #define LP5562_PATTERN_OFF 0
  92. static inline void lp5562_wait_opmode_done(void)
  93. {
  94. /* operation mode change needs to be longer than 153 us */
  95. usleep_range(200, 300);
  96. }
  97. static inline void lp5562_wait_enable_done(void)
  98. {
  99. /* it takes more 488 us to update ENABLE register */
  100. usleep_range(500, 600);
  101. }
  102. static void lp5562_set_led_current(struct lp55xx_led *led, u8 led_current)
  103. {
  104. u8 addr[] = {
  105. LP5562_REG_R_CURRENT,
  106. LP5562_REG_G_CURRENT,
  107. LP5562_REG_B_CURRENT,
  108. LP5562_REG_W_CURRENT,
  109. };
  110. led->led_current = led_current;
  111. lp55xx_write(led->chip, addr[led->chan_nr], led_current);
  112. }
  113. static void lp5562_load_engine(struct lp55xx_chip *chip)
  114. {
  115. enum lp55xx_engine_index idx = chip->engine_idx;
  116. u8 mask[] = {
  117. [LP55XX_ENGINE_1] = LP5562_MODE_ENG1_M,
  118. [LP55XX_ENGINE_2] = LP5562_MODE_ENG2_M,
  119. [LP55XX_ENGINE_3] = LP5562_MODE_ENG3_M,
  120. };
  121. u8 val[] = {
  122. [LP55XX_ENGINE_1] = LP5562_LOAD_ENG1,
  123. [LP55XX_ENGINE_2] = LP5562_LOAD_ENG2,
  124. [LP55XX_ENGINE_3] = LP5562_LOAD_ENG3,
  125. };
  126. lp55xx_update_bits(chip, LP5562_REG_OP_MODE, mask[idx], val[idx]);
  127. lp5562_wait_opmode_done();
  128. }
  129. static void lp5562_stop_engine(struct lp55xx_chip *chip)
  130. {
  131. lp55xx_write(chip, LP5562_REG_OP_MODE, LP5562_CMD_DISABLE);
  132. lp5562_wait_opmode_done();
  133. }
  134. static void lp5562_run_engine(struct lp55xx_chip *chip, bool start)
  135. {
  136. int ret;
  137. u8 mode;
  138. u8 exec;
  139. /* stop engine */
  140. if (!start) {
  141. lp55xx_write(chip, LP5562_REG_ENABLE, LP5562_ENABLE_DEFAULT);
  142. lp5562_wait_enable_done();
  143. lp5562_stop_engine(chip);
  144. lp55xx_write(chip, LP5562_REG_ENG_SEL, LP5562_ENG_SEL_PWM);
  145. lp55xx_write(chip, LP5562_REG_OP_MODE, LP5562_CMD_DIRECT);
  146. lp5562_wait_opmode_done();
  147. return;
  148. }
  149. /*
  150. * To run the engine,
  151. * operation mode and enable register should updated at the same time
  152. */
  153. ret = lp55xx_read(chip, LP5562_REG_OP_MODE, &mode);
  154. if (ret)
  155. return;
  156. ret = lp55xx_read(chip, LP5562_REG_ENABLE, &exec);
  157. if (ret)
  158. return;
  159. /* change operation mode to RUN only when each engine is loading */
  160. if (LP5562_ENG1_IS_LOADING(mode)) {
  161. mode = (mode & ~LP5562_MODE_ENG1_M) | LP5562_RUN_ENG1;
  162. exec = (exec & ~LP5562_EXEC_ENG1_M) | LP5562_RUN_ENG1;
  163. }
  164. if (LP5562_ENG2_IS_LOADING(mode)) {
  165. mode = (mode & ~LP5562_MODE_ENG2_M) | LP5562_RUN_ENG2;
  166. exec = (exec & ~LP5562_EXEC_ENG2_M) | LP5562_RUN_ENG2;
  167. }
  168. if (LP5562_ENG3_IS_LOADING(mode)) {
  169. mode = (mode & ~LP5562_MODE_ENG3_M) | LP5562_RUN_ENG3;
  170. exec = (exec & ~LP5562_EXEC_ENG3_M) | LP5562_RUN_ENG3;
  171. }
  172. lp55xx_write(chip, LP5562_REG_OP_MODE, mode);
  173. lp5562_wait_opmode_done();
  174. lp55xx_update_bits(chip, LP5562_REG_ENABLE, LP5562_EXEC_M, exec);
  175. lp5562_wait_enable_done();
  176. }
  177. static int lp5562_update_firmware(struct lp55xx_chip *chip,
  178. const u8 *data, size_t size)
  179. {
  180. enum lp55xx_engine_index idx = chip->engine_idx;
  181. u8 pattern[LP5562_PROGRAM_LENGTH] = {0};
  182. u8 addr[] = {
  183. [LP55XX_ENGINE_1] = LP5562_REG_PROG_MEM_ENG1,
  184. [LP55XX_ENGINE_2] = LP5562_REG_PROG_MEM_ENG2,
  185. [LP55XX_ENGINE_3] = LP5562_REG_PROG_MEM_ENG3,
  186. };
  187. unsigned cmd;
  188. char c[3];
  189. int program_size;
  190. int nrchars;
  191. int offset = 0;
  192. int ret;
  193. int i;
  194. /* clear program memory before updating */
  195. for (i = 0; i < LP5562_PROGRAM_LENGTH; i++)
  196. lp55xx_write(chip, addr[idx] + i, 0);
  197. i = 0;
  198. while ((offset < size - 1) && (i < LP5562_PROGRAM_LENGTH)) {
  199. /* separate sscanfs because length is working only for %s */
  200. ret = sscanf(data + offset, "%2s%n ", c, &nrchars);
  201. if (ret != 1)
  202. goto err;
  203. ret = sscanf(c, "%2x", &cmd);
  204. if (ret != 1)
  205. goto err;
  206. pattern[i] = (u8)cmd;
  207. offset += nrchars;
  208. i++;
  209. }
  210. /* Each instruction is 16bit long. Check that length is even */
  211. if (i % 2)
  212. goto err;
  213. program_size = i;
  214. for (i = 0; i < program_size; i++)
  215. lp55xx_write(chip, addr[idx] + i, pattern[i]);
  216. return 0;
  217. err:
  218. dev_err(&chip->cl->dev, "wrong pattern format\n");
  219. return -EINVAL;
  220. }
  221. static void lp5562_firmware_loaded(struct lp55xx_chip *chip)
  222. {
  223. const struct firmware *fw = chip->fw;
  224. if (fw->size > LP5562_PROGRAM_LENGTH) {
  225. dev_err(&chip->cl->dev, "firmware data size overflow: %zu\n",
  226. fw->size);
  227. return;
  228. }
  229. /*
  230. * Program momery sequence
  231. * 1) set engine mode to "LOAD"
  232. * 2) write firmware data into program memory
  233. */
  234. lp5562_load_engine(chip);
  235. lp5562_update_firmware(chip, fw->data, fw->size);
  236. }
  237. static int lp5562_post_init_device(struct lp55xx_chip *chip)
  238. {
  239. int ret;
  240. u8 cfg = LP5562_DEFAULT_CFG;
  241. /* Set all PWMs to direct control mode */
  242. ret = lp55xx_write(chip, LP5562_REG_OP_MODE, LP5562_CMD_DIRECT);
  243. if (ret)
  244. return ret;
  245. lp5562_wait_opmode_done();
  246. /* Update configuration for the clock setting */
  247. if (!lp55xx_is_extclk_used(chip))
  248. cfg |= LP5562_CLK_INT;
  249. ret = lp55xx_write(chip, LP5562_REG_CONFIG, cfg);
  250. if (ret)
  251. return ret;
  252. /* Initialize all channels PWM to zero -> leds off */
  253. lp55xx_write(chip, LP5562_REG_R_PWM, 0);
  254. lp55xx_write(chip, LP5562_REG_G_PWM, 0);
  255. lp55xx_write(chip, LP5562_REG_B_PWM, 0);
  256. lp55xx_write(chip, LP5562_REG_W_PWM, 0);
  257. /* Set LED map as register PWM by default */
  258. lp55xx_write(chip, LP5562_REG_ENG_SEL, LP5562_ENG_SEL_PWM);
  259. return 0;
  260. }
  261. static void lp5562_led_brightness_work(struct work_struct *work)
  262. {
  263. struct lp55xx_led *led = container_of(work, struct lp55xx_led,
  264. brightness_work);
  265. struct lp55xx_chip *chip = led->chip;
  266. u8 addr[] = {
  267. LP5562_REG_R_PWM,
  268. LP5562_REG_G_PWM,
  269. LP5562_REG_B_PWM,
  270. LP5562_REG_W_PWM,
  271. };
  272. mutex_lock(&chip->lock);
  273. lp55xx_write(chip, addr[led->chan_nr], led->brightness);
  274. mutex_unlock(&chip->lock);
  275. }
  276. static void lp5562_write_program_memory(struct lp55xx_chip *chip,
  277. u8 base, const u8 *rgb, int size)
  278. {
  279. int i;
  280. if (!rgb || size <= 0)
  281. return;
  282. for (i = 0; i < size; i++)
  283. lp55xx_write(chip, base + i, *(rgb + i));
  284. lp55xx_write(chip, base + i, 0);
  285. lp55xx_write(chip, base + i + 1, 0);
  286. }
  287. /* check the size of program count */
  288. static inline bool _is_pc_overflow(struct lp55xx_predef_pattern *ptn)
  289. {
  290. return ptn->size_r >= LP5562_PROGRAM_LENGTH ||
  291. ptn->size_g >= LP5562_PROGRAM_LENGTH ||
  292. ptn->size_b >= LP5562_PROGRAM_LENGTH;
  293. }
  294. static int lp5562_run_predef_led_pattern(struct lp55xx_chip *chip, int mode)
  295. {
  296. struct lp55xx_predef_pattern *ptn;
  297. int i;
  298. if (mode == LP5562_PATTERN_OFF) {
  299. lp5562_run_engine(chip, false);
  300. return 0;
  301. }
  302. ptn = chip->pdata->patterns + (mode - 1);
  303. if (!ptn || _is_pc_overflow(ptn)) {
  304. dev_err(&chip->cl->dev, "invalid pattern data\n");
  305. return -EINVAL;
  306. }
  307. lp5562_stop_engine(chip);
  308. /* Set LED map as RGB */
  309. lp55xx_write(chip, LP5562_REG_ENG_SEL, LP5562_ENG_SEL_RGB);
  310. /* Load engines */
  311. for (i = LP55XX_ENGINE_1; i <= LP55XX_ENGINE_3; i++) {
  312. chip->engine_idx = i;
  313. lp5562_load_engine(chip);
  314. }
  315. /* Clear program registers */
  316. lp55xx_write(chip, LP5562_REG_PROG_MEM_ENG1, 0);
  317. lp55xx_write(chip, LP5562_REG_PROG_MEM_ENG1 + 1, 0);
  318. lp55xx_write(chip, LP5562_REG_PROG_MEM_ENG2, 0);
  319. lp55xx_write(chip, LP5562_REG_PROG_MEM_ENG2 + 1, 0);
  320. lp55xx_write(chip, LP5562_REG_PROG_MEM_ENG3, 0);
  321. lp55xx_write(chip, LP5562_REG_PROG_MEM_ENG3 + 1, 0);
  322. /* Program engines */
  323. lp5562_write_program_memory(chip, LP5562_REG_PROG_MEM_ENG1,
  324. ptn->r, ptn->size_r);
  325. lp5562_write_program_memory(chip, LP5562_REG_PROG_MEM_ENG2,
  326. ptn->g, ptn->size_g);
  327. lp5562_write_program_memory(chip, LP5562_REG_PROG_MEM_ENG3,
  328. ptn->b, ptn->size_b);
  329. /* Run engines */
  330. lp5562_run_engine(chip, true);
  331. return 0;
  332. }
  333. static ssize_t lp5562_store_pattern(struct device *dev,
  334. struct device_attribute *attr,
  335. const char *buf, size_t len)
  336. {
  337. struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
  338. struct lp55xx_chip *chip = led->chip;
  339. struct lp55xx_predef_pattern *ptn = chip->pdata->patterns;
  340. int num_patterns = chip->pdata->num_patterns;
  341. unsigned long mode;
  342. int ret;
  343. ret = kstrtoul(buf, 0, &mode);
  344. if (ret)
  345. return ret;
  346. if (mode > num_patterns || !ptn)
  347. return -EINVAL;
  348. mutex_lock(&chip->lock);
  349. ret = lp5562_run_predef_led_pattern(chip, mode);
  350. mutex_unlock(&chip->lock);
  351. if (ret)
  352. return ret;
  353. return len;
  354. }
  355. static ssize_t lp5562_store_engine_mux(struct device *dev,
  356. struct device_attribute *attr,
  357. const char *buf, size_t len)
  358. {
  359. struct lp55xx_led *led = i2c_get_clientdata(to_i2c_client(dev));
  360. struct lp55xx_chip *chip = led->chip;
  361. u8 mask;
  362. u8 val;
  363. /* LED map
  364. * R ... Engine 1 (fixed)
  365. * G ... Engine 2 (fixed)
  366. * B ... Engine 3 (fixed)
  367. * W ... Engine 1 or 2 or 3
  368. */
  369. if (sysfs_streq(buf, "RGB")) {
  370. mask = LP5562_ENG_FOR_RGB_M;
  371. val = LP5562_ENG_SEL_RGB;
  372. } else if (sysfs_streq(buf, "W")) {
  373. enum lp55xx_engine_index idx = chip->engine_idx;
  374. mask = LP5562_ENG_FOR_W_M;
  375. switch (idx) {
  376. case LP55XX_ENGINE_1:
  377. val = LP5562_ENG1_FOR_W;
  378. break;
  379. case LP55XX_ENGINE_2:
  380. val = LP5562_ENG2_FOR_W;
  381. break;
  382. case LP55XX_ENGINE_3:
  383. val = LP5562_ENG3_FOR_W;
  384. break;
  385. default:
  386. return -EINVAL;
  387. }
  388. } else {
  389. dev_err(dev, "choose RGB or W\n");
  390. return -EINVAL;
  391. }
  392. mutex_lock(&chip->lock);
  393. lp55xx_update_bits(chip, LP5562_REG_ENG_SEL, mask, val);
  394. mutex_unlock(&chip->lock);
  395. return len;
  396. }
  397. static LP55XX_DEV_ATTR_WO(led_pattern, lp5562_store_pattern);
  398. static LP55XX_DEV_ATTR_WO(engine_mux, lp5562_store_engine_mux);
  399. static struct attribute *lp5562_attributes[] = {
  400. &dev_attr_led_pattern.attr,
  401. &dev_attr_engine_mux.attr,
  402. NULL,
  403. };
  404. static const struct attribute_group lp5562_group = {
  405. .attrs = lp5562_attributes,
  406. };
  407. /* Chip specific configurations */
  408. static struct lp55xx_device_config lp5562_cfg = {
  409. .max_channel = LP5562_MAX_LEDS,
  410. .reset = {
  411. .addr = LP5562_REG_RESET,
  412. .val = LP5562_RESET,
  413. },
  414. .enable = {
  415. .addr = LP5562_REG_ENABLE,
  416. .val = LP5562_ENABLE_DEFAULT,
  417. },
  418. .post_init_device = lp5562_post_init_device,
  419. .set_led_current = lp5562_set_led_current,
  420. .brightness_work_fn = lp5562_led_brightness_work,
  421. .run_engine = lp5562_run_engine,
  422. .firmware_cb = lp5562_firmware_loaded,
  423. .dev_attr_group = &lp5562_group,
  424. };
  425. static int lp5562_probe(struct i2c_client *client,
  426. const struct i2c_device_id *id)
  427. {
  428. int ret;
  429. struct lp55xx_chip *chip;
  430. struct lp55xx_led *led;
  431. struct lp55xx_platform_data *pdata = dev_get_platdata(&client->dev);
  432. struct device_node *np = client->dev.of_node;
  433. if (!pdata) {
  434. if (np) {
  435. pdata = lp55xx_of_populate_pdata(&client->dev, np);
  436. if (IS_ERR(pdata))
  437. return PTR_ERR(pdata);
  438. } else {
  439. dev_err(&client->dev, "no platform data\n");
  440. return -EINVAL;
  441. }
  442. }
  443. chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
  444. if (!chip)
  445. return -ENOMEM;
  446. led = devm_kzalloc(&client->dev,
  447. sizeof(*led) * pdata->num_channels, GFP_KERNEL);
  448. if (!led)
  449. return -ENOMEM;
  450. chip->cl = client;
  451. chip->pdata = pdata;
  452. chip->cfg = &lp5562_cfg;
  453. mutex_init(&chip->lock);
  454. i2c_set_clientdata(client, led);
  455. ret = lp55xx_init_device(chip);
  456. if (ret)
  457. goto err_init;
  458. ret = lp55xx_register_leds(led, chip);
  459. if (ret)
  460. goto err_register_leds;
  461. ret = lp55xx_register_sysfs(chip);
  462. if (ret) {
  463. dev_err(&client->dev, "registering sysfs failed\n");
  464. goto err_register_sysfs;
  465. }
  466. return 0;
  467. err_register_sysfs:
  468. lp55xx_unregister_leds(led, chip);
  469. err_register_leds:
  470. lp55xx_deinit_device(chip);
  471. err_init:
  472. return ret;
  473. }
  474. static int lp5562_remove(struct i2c_client *client)
  475. {
  476. struct lp55xx_led *led = i2c_get_clientdata(client);
  477. struct lp55xx_chip *chip = led->chip;
  478. lp5562_stop_engine(chip);
  479. lp55xx_unregister_sysfs(chip);
  480. lp55xx_unregister_leds(led, chip);
  481. lp55xx_deinit_device(chip);
  482. return 0;
  483. }
  484. static const struct i2c_device_id lp5562_id[] = {
  485. { "lp5562", 0 },
  486. { }
  487. };
  488. MODULE_DEVICE_TABLE(i2c, lp5562_id);
  489. #ifdef CONFIG_OF
  490. static const struct of_device_id of_lp5562_leds_match[] = {
  491. { .compatible = "ti,lp5562", },
  492. {},
  493. };
  494. MODULE_DEVICE_TABLE(of, of_lp5562_leds_match);
  495. #endif
  496. static struct i2c_driver lp5562_driver = {
  497. .driver = {
  498. .name = "lp5562",
  499. .of_match_table = of_match_ptr(of_lp5562_leds_match),
  500. },
  501. .probe = lp5562_probe,
  502. .remove = lp5562_remove,
  503. .id_table = lp5562_id,
  504. };
  505. module_i2c_driver(lp5562_driver);
  506. MODULE_DESCRIPTION("Texas Instruments LP5562 LED Driver");
  507. MODULE_AUTHOR("Milo Kim");
  508. MODULE_LICENSE("GPL");