gpio-sx150x.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. /* Copyright (c) 2010, The Linux Foundation. All rights reserved.
  2. *
  3. * This program is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License version 2 and
  5. * only version 2 as published by the Free Software Foundation.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. */
  12. #include <linux/gpio.h>
  13. #include <linux/i2c.h>
  14. #include <linux/init.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/irq.h>
  17. #include <linux/module.h>
  18. #include <linux/mutex.h>
  19. #include <linux/slab.h>
  20. #include <linux/workqueue.h>
  21. #include <linux/i2c/sx150x.h>
  22. #define NO_UPDATE_PENDING -1
  23. struct sx150x_device_data {
  24. u8 reg_pullup;
  25. u8 reg_pulldn;
  26. u8 reg_drain;
  27. u8 reg_polarity;
  28. u8 reg_dir;
  29. u8 reg_data;
  30. u8 reg_irq_mask;
  31. u8 reg_irq_src;
  32. u8 reg_sense;
  33. u8 reg_clock;
  34. u8 reg_misc;
  35. u8 reg_reset;
  36. u8 ngpios;
  37. };
  38. struct sx150x_chip {
  39. struct gpio_chip gpio_chip;
  40. struct i2c_client *client;
  41. const struct sx150x_device_data *dev_cfg;
  42. int irq_summary;
  43. int irq_base;
  44. int irq_update;
  45. u32 irq_sense;
  46. u32 irq_masked;
  47. u32 dev_sense;
  48. u32 dev_masked;
  49. struct irq_chip irq_chip;
  50. struct mutex lock;
  51. };
  52. static const struct sx150x_device_data sx150x_devices[] = {
  53. [0] = { /* sx1508q */
  54. .reg_pullup = 0x03,
  55. .reg_pulldn = 0x04,
  56. .reg_drain = 0x05,
  57. .reg_polarity = 0x06,
  58. .reg_dir = 0x07,
  59. .reg_data = 0x08,
  60. .reg_irq_mask = 0x09,
  61. .reg_irq_src = 0x0c,
  62. .reg_sense = 0x0b,
  63. .reg_clock = 0x0f,
  64. .reg_misc = 0x10,
  65. .reg_reset = 0x7d,
  66. .ngpios = 8
  67. },
  68. [1] = { /* sx1509q */
  69. .reg_pullup = 0x07,
  70. .reg_pulldn = 0x09,
  71. .reg_drain = 0x0b,
  72. .reg_polarity = 0x0d,
  73. .reg_dir = 0x0f,
  74. .reg_data = 0x11,
  75. .reg_irq_mask = 0x13,
  76. .reg_irq_src = 0x19,
  77. .reg_sense = 0x17,
  78. .reg_clock = 0x1e,
  79. .reg_misc = 0x1f,
  80. .reg_reset = 0x7d,
  81. .ngpios = 16
  82. },
  83. };
  84. static const struct i2c_device_id sx150x_id[] = {
  85. {"sx1508q", 0},
  86. {"sx1509q", 1},
  87. {}
  88. };
  89. MODULE_DEVICE_TABLE(i2c, sx150x_id);
  90. static s32 sx150x_i2c_write(struct i2c_client *client, u8 reg, u8 val)
  91. {
  92. s32 err = i2c_smbus_write_byte_data(client, reg, val);
  93. if (err < 0)
  94. dev_warn(&client->dev,
  95. "i2c write fail: can't write %02x to %02x: %d\n",
  96. val, reg, err);
  97. return err;
  98. }
  99. static s32 sx150x_i2c_read(struct i2c_client *client, u8 reg, u8 *val)
  100. {
  101. s32 err = i2c_smbus_read_byte_data(client, reg);
  102. if (err >= 0)
  103. *val = err;
  104. else
  105. dev_warn(&client->dev,
  106. "i2c read fail: can't read from %02x: %d\n",
  107. reg, err);
  108. return err;
  109. }
  110. static inline bool offset_is_oscio(struct sx150x_chip *chip, unsigned offset)
  111. {
  112. return (chip->dev_cfg->ngpios == offset);
  113. }
  114. /*
  115. * These utility functions solve the common problem of locating and setting
  116. * configuration bits. Configuration bits are grouped into registers
  117. * whose indexes increase downwards. For example, with eight-bit registers,
  118. * sixteen gpios would have their config bits grouped in the following order:
  119. * REGISTER N-1 [ f e d c b a 9 8 ]
  120. * N [ 7 6 5 4 3 2 1 0 ]
  121. *
  122. * For multi-bit configurations, the pattern gets wider:
  123. * REGISTER N-3 [ f f e e d d c c ]
  124. * N-2 [ b b a a 9 9 8 8 ]
  125. * N-1 [ 7 7 6 6 5 5 4 4 ]
  126. * N [ 3 3 2 2 1 1 0 0 ]
  127. *
  128. * Given the address of the starting register 'N', the index of the gpio
  129. * whose configuration we seek to change, and the width in bits of that
  130. * configuration, these functions allow us to locate the correct
  131. * register and mask the correct bits.
  132. */
  133. static inline void sx150x_find_cfg(u8 offset, u8 width,
  134. u8 *reg, u8 *mask, u8 *shift)
  135. {
  136. *reg -= offset * width / 8;
  137. *mask = (1 << width) - 1;
  138. *shift = (offset * width) % 8;
  139. *mask <<= *shift;
  140. }
  141. static s32 sx150x_write_cfg(struct sx150x_chip *chip,
  142. u8 offset, u8 width, u8 reg, u8 val)
  143. {
  144. u8 mask;
  145. u8 data;
  146. u8 shift;
  147. s32 err;
  148. sx150x_find_cfg(offset, width, &reg, &mask, &shift);
  149. err = sx150x_i2c_read(chip->client, reg, &data);
  150. if (err < 0)
  151. return err;
  152. data &= ~mask;
  153. data |= (val << shift) & mask;
  154. return sx150x_i2c_write(chip->client, reg, data);
  155. }
  156. static int sx150x_get_io(struct sx150x_chip *chip, unsigned offset)
  157. {
  158. u8 reg = chip->dev_cfg->reg_data;
  159. u8 mask;
  160. u8 data;
  161. u8 shift;
  162. s32 err;
  163. sx150x_find_cfg(offset, 1, &reg, &mask, &shift);
  164. err = sx150x_i2c_read(chip->client, reg, &data);
  165. if (err >= 0)
  166. err = (data & mask) != 0 ? 1 : 0;
  167. return err;
  168. }
  169. static s32 sx150x_set_oscio(struct sx150x_chip *chip, int val)
  170. {
  171. return sx150x_i2c_write(chip->client,
  172. chip->dev_cfg->reg_clock,
  173. (val ? 0x1f : 0x10));
  174. }
  175. static void sx150x_set_io(struct sx150x_chip *chip, unsigned offset, int val)
  176. {
  177. sx150x_write_cfg(chip,
  178. offset,
  179. 1,
  180. chip->dev_cfg->reg_data,
  181. (val ? 1 : 0));
  182. }
  183. static int sx150x_io_input(struct sx150x_chip *chip, unsigned offset)
  184. {
  185. return sx150x_write_cfg(chip,
  186. offset,
  187. 1,
  188. chip->dev_cfg->reg_dir,
  189. 1);
  190. }
  191. static int sx150x_io_output(struct sx150x_chip *chip, unsigned offset, int val)
  192. {
  193. int err;
  194. err = sx150x_write_cfg(chip,
  195. offset,
  196. 1,
  197. chip->dev_cfg->reg_data,
  198. (val ? 1 : 0));
  199. if (err >= 0)
  200. err = sx150x_write_cfg(chip,
  201. offset,
  202. 1,
  203. chip->dev_cfg->reg_dir,
  204. 0);
  205. return err;
  206. }
  207. static int sx150x_gpio_get(struct gpio_chip *gc, unsigned offset)
  208. {
  209. struct sx150x_chip *chip;
  210. int status = -EINVAL;
  211. chip = container_of(gc, struct sx150x_chip, gpio_chip);
  212. if (!offset_is_oscio(chip, offset)) {
  213. mutex_lock(&chip->lock);
  214. status = sx150x_get_io(chip, offset);
  215. mutex_unlock(&chip->lock);
  216. }
  217. return status;
  218. }
  219. static void sx150x_gpio_set(struct gpio_chip *gc, unsigned offset, int val)
  220. {
  221. struct sx150x_chip *chip;
  222. chip = container_of(gc, struct sx150x_chip, gpio_chip);
  223. mutex_lock(&chip->lock);
  224. if (offset_is_oscio(chip, offset))
  225. sx150x_set_oscio(chip, val);
  226. else
  227. sx150x_set_io(chip, offset, val);
  228. mutex_unlock(&chip->lock);
  229. }
  230. static int sx150x_gpio_direction_input(struct gpio_chip *gc, unsigned offset)
  231. {
  232. struct sx150x_chip *chip;
  233. int status = -EINVAL;
  234. chip = container_of(gc, struct sx150x_chip, gpio_chip);
  235. if (!offset_is_oscio(chip, offset)) {
  236. mutex_lock(&chip->lock);
  237. status = sx150x_io_input(chip, offset);
  238. mutex_unlock(&chip->lock);
  239. }
  240. return status;
  241. }
  242. static int sx150x_gpio_direction_output(struct gpio_chip *gc,
  243. unsigned offset,
  244. int val)
  245. {
  246. struct sx150x_chip *chip;
  247. int status = 0;
  248. chip = container_of(gc, struct sx150x_chip, gpio_chip);
  249. mutex_lock(&chip->lock);
  250. if (offset_is_oscio(chip, offset))
  251. status = sx150x_set_oscio(chip, val);
  252. else
  253. status = sx150x_io_output(chip, offset, val);
  254. mutex_unlock(&chip->lock);
  255. return status;
  256. }
  257. static int sx150x_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
  258. {
  259. struct sx150x_chip *chip;
  260. chip = container_of(gc, struct sx150x_chip, gpio_chip);
  261. if (offset >= chip->dev_cfg->ngpios)
  262. return -EINVAL;
  263. if (chip->irq_base < 0)
  264. return -EINVAL;
  265. return chip->irq_base + offset;
  266. }
  267. static void sx150x_irq_mask(struct irq_data *d)
  268. {
  269. struct irq_chip *ic = irq_data_get_irq_chip(d);
  270. struct sx150x_chip *chip;
  271. unsigned n;
  272. chip = container_of(ic, struct sx150x_chip, irq_chip);
  273. n = d->irq - chip->irq_base;
  274. chip->irq_masked |= (1 << n);
  275. chip->irq_update = n;
  276. }
  277. static void sx150x_irq_unmask(struct irq_data *d)
  278. {
  279. struct irq_chip *ic = irq_data_get_irq_chip(d);
  280. struct sx150x_chip *chip;
  281. unsigned n;
  282. chip = container_of(ic, struct sx150x_chip, irq_chip);
  283. n = d->irq - chip->irq_base;
  284. chip->irq_masked &= ~(1 << n);
  285. chip->irq_update = n;
  286. }
  287. static int sx150x_irq_set_type(struct irq_data *d, unsigned int flow_type)
  288. {
  289. struct irq_chip *ic = irq_data_get_irq_chip(d);
  290. struct sx150x_chip *chip;
  291. unsigned n, val = 0;
  292. if (flow_type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_LEVEL_LOW))
  293. return -EINVAL;
  294. chip = container_of(ic, struct sx150x_chip, irq_chip);
  295. n = d->irq - chip->irq_base;
  296. if (flow_type & IRQ_TYPE_EDGE_RISING)
  297. val |= 0x1;
  298. if (flow_type & IRQ_TYPE_EDGE_FALLING)
  299. val |= 0x2;
  300. chip->irq_sense &= ~(3UL << (n * 2));
  301. chip->irq_sense |= val << (n * 2);
  302. chip->irq_update = n;
  303. return 0;
  304. }
  305. static irqreturn_t sx150x_irq_thread_fn(int irq, void *dev_id)
  306. {
  307. struct sx150x_chip *chip = (struct sx150x_chip *)dev_id;
  308. unsigned nhandled = 0;
  309. unsigned sub_irq;
  310. unsigned n;
  311. s32 err;
  312. u8 val;
  313. int i;
  314. for (i = (chip->dev_cfg->ngpios / 8) - 1; i >= 0; --i) {
  315. err = sx150x_i2c_read(chip->client,
  316. chip->dev_cfg->reg_irq_src - i,
  317. &val);
  318. if (err < 0)
  319. continue;
  320. sx150x_i2c_write(chip->client,
  321. chip->dev_cfg->reg_irq_src - i,
  322. val);
  323. for (n = 0; n < 8; ++n) {
  324. if (val & (1 << n)) {
  325. sub_irq = chip->irq_base + (i * 8) + n;
  326. handle_nested_irq(sub_irq);
  327. ++nhandled;
  328. }
  329. }
  330. }
  331. return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE);
  332. }
  333. static void sx150x_irq_bus_lock(struct irq_data *d)
  334. {
  335. struct irq_chip *ic = irq_data_get_irq_chip(d);
  336. struct sx150x_chip *chip;
  337. chip = container_of(ic, struct sx150x_chip, irq_chip);
  338. mutex_lock(&chip->lock);
  339. }
  340. static void sx150x_irq_bus_sync_unlock(struct irq_data *d)
  341. {
  342. struct irq_chip *ic = irq_data_get_irq_chip(d);
  343. struct sx150x_chip *chip;
  344. unsigned n;
  345. chip = container_of(ic, struct sx150x_chip, irq_chip);
  346. if (chip->irq_update == NO_UPDATE_PENDING)
  347. goto out;
  348. n = chip->irq_update;
  349. chip->irq_update = NO_UPDATE_PENDING;
  350. /* Avoid updates if nothing changed */
  351. if (chip->dev_sense == chip->irq_sense &&
  352. chip->dev_sense == chip->irq_masked)
  353. goto out;
  354. chip->dev_sense = chip->irq_sense;
  355. chip->dev_masked = chip->irq_masked;
  356. if (chip->irq_masked & (1 << n)) {
  357. sx150x_write_cfg(chip, n, 1, chip->dev_cfg->reg_irq_mask, 1);
  358. sx150x_write_cfg(chip, n, 2, chip->dev_cfg->reg_sense, 0);
  359. } else {
  360. sx150x_write_cfg(chip, n, 1, chip->dev_cfg->reg_irq_mask, 0);
  361. sx150x_write_cfg(chip, n, 2, chip->dev_cfg->reg_sense,
  362. chip->irq_sense >> (n * 2));
  363. }
  364. out:
  365. mutex_unlock(&chip->lock);
  366. }
  367. static void sx150x_init_chip(struct sx150x_chip *chip,
  368. struct i2c_client *client,
  369. kernel_ulong_t driver_data,
  370. struct sx150x_platform_data *pdata)
  371. {
  372. mutex_init(&chip->lock);
  373. chip->client = client;
  374. chip->dev_cfg = &sx150x_devices[driver_data];
  375. chip->gpio_chip.label = client->name;
  376. chip->gpio_chip.direction_input = sx150x_gpio_direction_input;
  377. chip->gpio_chip.direction_output = sx150x_gpio_direction_output;
  378. chip->gpio_chip.get = sx150x_gpio_get;
  379. chip->gpio_chip.set = sx150x_gpio_set;
  380. chip->gpio_chip.to_irq = sx150x_gpio_to_irq;
  381. chip->gpio_chip.base = pdata->gpio_base;
  382. chip->gpio_chip.can_sleep = 1;
  383. chip->gpio_chip.ngpio = chip->dev_cfg->ngpios;
  384. if (pdata->oscio_is_gpo)
  385. ++chip->gpio_chip.ngpio;
  386. chip->irq_chip.name = client->name;
  387. chip->irq_chip.irq_mask = sx150x_irq_mask;
  388. chip->irq_chip.irq_unmask = sx150x_irq_unmask;
  389. chip->irq_chip.irq_set_type = sx150x_irq_set_type;
  390. chip->irq_chip.irq_bus_lock = sx150x_irq_bus_lock;
  391. chip->irq_chip.irq_bus_sync_unlock = sx150x_irq_bus_sync_unlock;
  392. chip->irq_summary = -1;
  393. chip->irq_base = -1;
  394. chip->irq_masked = ~0;
  395. chip->irq_sense = 0;
  396. chip->dev_masked = ~0;
  397. chip->dev_sense = 0;
  398. chip->irq_update = NO_UPDATE_PENDING;
  399. }
  400. static int sx150x_init_io(struct sx150x_chip *chip, u8 base, u16 cfg)
  401. {
  402. int err = 0;
  403. unsigned n;
  404. for (n = 0; err >= 0 && n < (chip->dev_cfg->ngpios / 8); ++n)
  405. err = sx150x_i2c_write(chip->client, base - n, cfg >> (n * 8));
  406. return err;
  407. }
  408. static int sx150x_reset(struct sx150x_chip *chip)
  409. {
  410. int err;
  411. err = i2c_smbus_write_byte_data(chip->client,
  412. chip->dev_cfg->reg_reset,
  413. 0x12);
  414. if (err < 0)
  415. return err;
  416. err = i2c_smbus_write_byte_data(chip->client,
  417. chip->dev_cfg->reg_reset,
  418. 0x34);
  419. return err;
  420. }
  421. static int sx150x_init_hw(struct sx150x_chip *chip,
  422. struct sx150x_platform_data *pdata)
  423. {
  424. int err = 0;
  425. if (pdata->reset_during_probe) {
  426. err = sx150x_reset(chip);
  427. if (err < 0)
  428. return err;
  429. }
  430. err = sx150x_i2c_write(chip->client,
  431. chip->dev_cfg->reg_misc,
  432. 0x01);
  433. if (err < 0)
  434. return err;
  435. err = sx150x_init_io(chip, chip->dev_cfg->reg_pullup,
  436. pdata->io_pullup_ena);
  437. if (err < 0)
  438. return err;
  439. err = sx150x_init_io(chip, chip->dev_cfg->reg_pulldn,
  440. pdata->io_pulldn_ena);
  441. if (err < 0)
  442. return err;
  443. err = sx150x_init_io(chip, chip->dev_cfg->reg_drain,
  444. pdata->io_open_drain_ena);
  445. if (err < 0)
  446. return err;
  447. err = sx150x_init_io(chip, chip->dev_cfg->reg_polarity,
  448. pdata->io_polarity);
  449. if (err < 0)
  450. return err;
  451. if (pdata->oscio_is_gpo)
  452. sx150x_set_oscio(chip, 0);
  453. return err;
  454. }
  455. static int sx150x_install_irq_chip(struct sx150x_chip *chip,
  456. int irq_summary,
  457. int irq_base)
  458. {
  459. int err;
  460. unsigned n;
  461. unsigned irq;
  462. chip->irq_summary = irq_summary;
  463. chip->irq_base = irq_base;
  464. for (n = 0; n < chip->dev_cfg->ngpios; ++n) {
  465. irq = irq_base + n;
  466. irq_set_chip_and_handler(irq, &chip->irq_chip, handle_edge_irq);
  467. irq_set_nested_thread(irq, 1);
  468. #ifdef CONFIG_ARM
  469. set_irq_flags(irq, IRQF_VALID);
  470. #else
  471. irq_set_noprobe(irq);
  472. #endif
  473. }
  474. err = request_threaded_irq(irq_summary,
  475. NULL,
  476. sx150x_irq_thread_fn,
  477. IRQF_SHARED | IRQF_TRIGGER_FALLING,
  478. chip->irq_chip.name,
  479. chip);
  480. if (err < 0) {
  481. chip->irq_summary = -1;
  482. chip->irq_base = -1;
  483. }
  484. return err;
  485. }
  486. static void sx150x_remove_irq_chip(struct sx150x_chip *chip)
  487. {
  488. unsigned n;
  489. unsigned irq;
  490. free_irq(chip->irq_summary, chip);
  491. for (n = 0; n < chip->dev_cfg->ngpios; ++n) {
  492. irq = chip->irq_base + n;
  493. irq_set_chip_and_handler(irq, NULL, NULL);
  494. }
  495. }
  496. static int __devinit sx150x_probe(struct i2c_client *client,
  497. const struct i2c_device_id *id)
  498. {
  499. static const u32 i2c_funcs = I2C_FUNC_SMBUS_BYTE_DATA |
  500. I2C_FUNC_SMBUS_WRITE_WORD_DATA;
  501. struct sx150x_platform_data *pdata;
  502. struct sx150x_chip *chip;
  503. int rc;
  504. pdata = client->dev.platform_data;
  505. if (!pdata)
  506. return -EINVAL;
  507. if (!i2c_check_functionality(client->adapter, i2c_funcs))
  508. return -ENOSYS;
  509. chip = kzalloc(sizeof(struct sx150x_chip), GFP_KERNEL);
  510. if (!chip)
  511. return -ENOMEM;
  512. sx150x_init_chip(chip, client, id->driver_data, pdata);
  513. rc = sx150x_init_hw(chip, pdata);
  514. if (rc < 0)
  515. goto probe_fail_pre_gpiochip_add;
  516. rc = gpiochip_add(&chip->gpio_chip);
  517. if (rc < 0)
  518. goto probe_fail_pre_gpiochip_add;
  519. if (pdata->irq_summary >= 0) {
  520. rc = sx150x_install_irq_chip(chip,
  521. pdata->irq_summary,
  522. pdata->irq_base);
  523. if (rc < 0)
  524. goto probe_fail_post_gpiochip_add;
  525. }
  526. i2c_set_clientdata(client, chip);
  527. return 0;
  528. probe_fail_post_gpiochip_add:
  529. WARN_ON(gpiochip_remove(&chip->gpio_chip) < 0);
  530. probe_fail_pre_gpiochip_add:
  531. kfree(chip);
  532. return rc;
  533. }
  534. static int __devexit sx150x_remove(struct i2c_client *client)
  535. {
  536. struct sx150x_chip *chip;
  537. int rc;
  538. chip = i2c_get_clientdata(client);
  539. rc = gpiochip_remove(&chip->gpio_chip);
  540. if (rc < 0)
  541. return rc;
  542. if (chip->irq_summary >= 0)
  543. sx150x_remove_irq_chip(chip);
  544. kfree(chip);
  545. return 0;
  546. }
  547. static struct i2c_driver sx150x_driver = {
  548. .driver = {
  549. .name = "sx150x",
  550. .owner = THIS_MODULE
  551. },
  552. .probe = sx150x_probe,
  553. .remove = __devexit_p(sx150x_remove),
  554. .id_table = sx150x_id,
  555. };
  556. static int __init sx150x_init(void)
  557. {
  558. return i2c_add_driver(&sx150x_driver);
  559. }
  560. subsys_initcall(sx150x_init);
  561. static void __exit sx150x_exit(void)
  562. {
  563. return i2c_del_driver(&sx150x_driver);
  564. }
  565. module_exit(sx150x_exit);
  566. MODULE_AUTHOR("Gregory Bean <gbean@codeaurora.org>");
  567. MODULE_DESCRIPTION("Driver for Semtech SX150X I2C GPIO Expanders");
  568. MODULE_LICENSE("GPL v2");
  569. MODULE_ALIAS("i2c:sx150x");