htc-i2cpld.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  1. /*
  2. * htc-i2cpld.c
  3. * Chip driver for an unknown CPLD chip found on omap850 HTC devices like
  4. * the HTC Wizard and HTC Herald.
  5. * The cpld is located on the i2c bus and acts as an input/output GPIO
  6. * extender.
  7. *
  8. * Copyright (C) 2009 Cory Maccarrone <darkstar6262@gmail.com>
  9. *
  10. * Based on work done in the linwizard project
  11. * Copyright (C) 2008-2009 Angelo Arrifano <miknix@gmail.com>
  12. *
  13. * This program is free software; you can redistribute it and/or modify
  14. * it under the terms of the GNU General Public License as published by
  15. * the Free Software Foundation; either version 2 of the License, or
  16. * (at your option) any later version.
  17. *
  18. * This program is distributed in the hope that it will be useful,
  19. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  21. * GNU General Public License for more details.
  22. *
  23. * You should have received a copy of the GNU General Public License
  24. * along with this program; if not, write to the Free Software
  25. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26. */
  27. #include <linux/kernel.h>
  28. #include <linux/init.h>
  29. #include <linux/module.h>
  30. #include <linux/interrupt.h>
  31. #include <linux/platform_device.h>
  32. #include <linux/i2c.h>
  33. #include <linux/irq.h>
  34. #include <linux/spinlock.h>
  35. #include <linux/htcpld.h>
  36. #include <linux/gpio.h>
  37. #include <linux/slab.h>
  38. struct htcpld_chip {
  39. spinlock_t lock;
  40. /* chip info */
  41. u8 reset;
  42. u8 addr;
  43. struct device *dev;
  44. struct i2c_client *client;
  45. /* Output details */
  46. u8 cache_out;
  47. struct gpio_chip chip_out;
  48. /* Input details */
  49. u8 cache_in;
  50. struct gpio_chip chip_in;
  51. u16 irqs_enabled;
  52. uint irq_start;
  53. int nirqs;
  54. unsigned int flow_type;
  55. /*
  56. * Work structure to allow for setting values outside of any
  57. * possible interrupt context
  58. */
  59. struct work_struct set_val_work;
  60. };
  61. struct htcpld_data {
  62. /* irq info */
  63. u16 irqs_enabled;
  64. uint irq_start;
  65. int nirqs;
  66. uint chained_irq;
  67. unsigned int int_reset_gpio_hi;
  68. unsigned int int_reset_gpio_lo;
  69. /* htcpld info */
  70. struct htcpld_chip *chip;
  71. unsigned int nchips;
  72. };
  73. /* There does not appear to be a way to proactively mask interrupts
  74. * on the htcpld chip itself. So, we simply ignore interrupts that
  75. * aren't desired. */
  76. static void htcpld_mask(struct irq_data *data)
  77. {
  78. struct htcpld_chip *chip = irq_data_get_irq_chip_data(data);
  79. chip->irqs_enabled &= ~(1 << (data->irq - chip->irq_start));
  80. pr_debug("HTCPLD mask %d %04x\n", data->irq, chip->irqs_enabled);
  81. }
  82. static void htcpld_unmask(struct irq_data *data)
  83. {
  84. struct htcpld_chip *chip = irq_data_get_irq_chip_data(data);
  85. chip->irqs_enabled |= 1 << (data->irq - chip->irq_start);
  86. pr_debug("HTCPLD unmask %d %04x\n", data->irq, chip->irqs_enabled);
  87. }
  88. static int htcpld_set_type(struct irq_data *data, unsigned int flags)
  89. {
  90. struct htcpld_chip *chip = irq_data_get_irq_chip_data(data);
  91. if (flags & ~IRQ_TYPE_SENSE_MASK)
  92. return -EINVAL;
  93. /* We only allow edge triggering */
  94. if (flags & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH))
  95. return -EINVAL;
  96. chip->flow_type = flags;
  97. return 0;
  98. }
  99. static struct irq_chip htcpld_muxed_chip = {
  100. .name = "htcpld",
  101. .irq_mask = htcpld_mask,
  102. .irq_unmask = htcpld_unmask,
  103. .irq_set_type = htcpld_set_type,
  104. };
  105. /* To properly dispatch IRQ events, we need to read from the
  106. * chip. This is an I2C action that could possibly sleep
  107. * (which is bad in interrupt context) -- so we use a threaded
  108. * interrupt handler to get around that.
  109. */
  110. static irqreturn_t htcpld_handler(int irq, void *dev)
  111. {
  112. struct htcpld_data *htcpld = dev;
  113. unsigned int i;
  114. unsigned long flags;
  115. int irqpin;
  116. if (!htcpld) {
  117. pr_debug("htcpld is null in ISR\n");
  118. return IRQ_HANDLED;
  119. }
  120. /*
  121. * For each chip, do a read of the chip and trigger any interrupts
  122. * desired. The interrupts will be triggered from LSB to MSB (i.e.
  123. * bit 0 first, then bit 1, etc.)
  124. *
  125. * For chips that have no interrupt range specified, just skip 'em.
  126. */
  127. for (i = 0; i < htcpld->nchips; i++) {
  128. struct htcpld_chip *chip = &htcpld->chip[i];
  129. struct i2c_client *client;
  130. int val;
  131. unsigned long uval, old_val;
  132. if (!chip) {
  133. pr_debug("chip %d is null in ISR\n", i);
  134. continue;
  135. }
  136. if (chip->nirqs == 0)
  137. continue;
  138. client = chip->client;
  139. if (!client) {
  140. pr_debug("client %d is null in ISR\n", i);
  141. continue;
  142. }
  143. /* Scan the chip */
  144. val = i2c_smbus_read_byte_data(client, chip->cache_out);
  145. if (val < 0) {
  146. /* Throw a warning and skip this chip */
  147. dev_warn(chip->dev, "Unable to read from chip: %d\n",
  148. val);
  149. continue;
  150. }
  151. uval = (unsigned long)val;
  152. spin_lock_irqsave(&chip->lock, flags);
  153. /* Save away the old value so we can compare it */
  154. old_val = chip->cache_in;
  155. /* Write the new value */
  156. chip->cache_in = uval;
  157. spin_unlock_irqrestore(&chip->lock, flags);
  158. /*
  159. * For each bit in the data (starting at bit 0), trigger
  160. * associated interrupts.
  161. */
  162. for (irqpin = 0; irqpin < chip->nirqs; irqpin++) {
  163. unsigned oldb, newb, type = chip->flow_type;
  164. irq = chip->irq_start + irqpin;
  165. /* Run the IRQ handler, but only if the bit value
  166. * changed, and the proper flags are set */
  167. oldb = (old_val >> irqpin) & 1;
  168. newb = (uval >> irqpin) & 1;
  169. if ((!oldb && newb && (type & IRQ_TYPE_EDGE_RISING)) ||
  170. (oldb && !newb && (type & IRQ_TYPE_EDGE_FALLING))) {
  171. pr_debug("fire IRQ %d\n", irqpin);
  172. generic_handle_irq(irq);
  173. }
  174. }
  175. }
  176. /*
  177. * In order to continue receiving interrupts, the int_reset_gpio must
  178. * be asserted.
  179. */
  180. if (htcpld->int_reset_gpio_hi)
  181. gpio_set_value(htcpld->int_reset_gpio_hi, 1);
  182. if (htcpld->int_reset_gpio_lo)
  183. gpio_set_value(htcpld->int_reset_gpio_lo, 0);
  184. return IRQ_HANDLED;
  185. }
  186. /*
  187. * The GPIO set routines can be called from interrupt context, especially if,
  188. * for example they're attached to the led-gpio framework and a trigger is
  189. * enabled. As such, we declared work above in the htcpld_chip structure,
  190. * and that work is scheduled in the set routine. The kernel can then run
  191. * the I2C functions, which will sleep, in process context.
  192. */
  193. static void htcpld_chip_set(struct gpio_chip *chip, unsigned offset, int val)
  194. {
  195. struct i2c_client *client;
  196. struct htcpld_chip *chip_data = gpiochip_get_data(chip);
  197. unsigned long flags;
  198. client = chip_data->client;
  199. if (!client)
  200. return;
  201. spin_lock_irqsave(&chip_data->lock, flags);
  202. if (val)
  203. chip_data->cache_out |= (1 << offset);
  204. else
  205. chip_data->cache_out &= ~(1 << offset);
  206. spin_unlock_irqrestore(&chip_data->lock, flags);
  207. schedule_work(&(chip_data->set_val_work));
  208. }
  209. static void htcpld_chip_set_ni(struct work_struct *work)
  210. {
  211. struct htcpld_chip *chip_data;
  212. struct i2c_client *client;
  213. chip_data = container_of(work, struct htcpld_chip, set_val_work);
  214. client = chip_data->client;
  215. i2c_smbus_read_byte_data(client, chip_data->cache_out);
  216. }
  217. static int htcpld_chip_get(struct gpio_chip *chip, unsigned offset)
  218. {
  219. struct htcpld_chip *chip_data = gpiochip_get_data(chip);
  220. u8 cache;
  221. if (!strncmp(chip->label, "htcpld-out", 10)) {
  222. cache = chip_data->cache_out;
  223. } else if (!strncmp(chip->label, "htcpld-in", 9)) {
  224. cache = chip_data->cache_in;
  225. } else
  226. return -EINVAL;
  227. return (cache >> offset) & 1;
  228. }
  229. static int htcpld_direction_output(struct gpio_chip *chip,
  230. unsigned offset, int value)
  231. {
  232. htcpld_chip_set(chip, offset, value);
  233. return 0;
  234. }
  235. static int htcpld_direction_input(struct gpio_chip *chip,
  236. unsigned offset)
  237. {
  238. /*
  239. * No-op: this function can only be called on the input chip.
  240. * We do however make sure the offset is within range.
  241. */
  242. return (offset < chip->ngpio) ? 0 : -EINVAL;
  243. }
  244. static int htcpld_chip_to_irq(struct gpio_chip *chip, unsigned offset)
  245. {
  246. struct htcpld_chip *chip_data = gpiochip_get_data(chip);
  247. if (offset < chip_data->nirqs)
  248. return chip_data->irq_start + offset;
  249. else
  250. return -EINVAL;
  251. }
  252. static void htcpld_chip_reset(struct i2c_client *client)
  253. {
  254. struct htcpld_chip *chip_data = i2c_get_clientdata(client);
  255. if (!chip_data)
  256. return;
  257. i2c_smbus_read_byte_data(
  258. client, (chip_data->cache_out = chip_data->reset));
  259. }
  260. static int htcpld_setup_chip_irq(
  261. struct platform_device *pdev,
  262. int chip_index)
  263. {
  264. struct htcpld_data *htcpld;
  265. struct htcpld_chip *chip;
  266. unsigned int irq, irq_end;
  267. /* Get the platform and driver data */
  268. htcpld = platform_get_drvdata(pdev);
  269. chip = &htcpld->chip[chip_index];
  270. /* Setup irq handlers */
  271. irq_end = chip->irq_start + chip->nirqs;
  272. for (irq = chip->irq_start; irq < irq_end; irq++) {
  273. irq_set_chip_and_handler(irq, &htcpld_muxed_chip,
  274. handle_simple_irq);
  275. irq_set_chip_data(irq, chip);
  276. irq_clear_status_flags(irq, IRQ_NOREQUEST | IRQ_NOPROBE);
  277. }
  278. return 0;
  279. }
  280. static int htcpld_register_chip_i2c(
  281. struct platform_device *pdev,
  282. int chip_index)
  283. {
  284. struct htcpld_data *htcpld;
  285. struct device *dev = &pdev->dev;
  286. struct htcpld_core_platform_data *pdata;
  287. struct htcpld_chip *chip;
  288. struct htcpld_chip_platform_data *plat_chip_data;
  289. struct i2c_adapter *adapter;
  290. struct i2c_client *client;
  291. struct i2c_board_info info;
  292. /* Get the platform and driver data */
  293. pdata = dev_get_platdata(dev);
  294. htcpld = platform_get_drvdata(pdev);
  295. chip = &htcpld->chip[chip_index];
  296. plat_chip_data = &pdata->chip[chip_index];
  297. adapter = i2c_get_adapter(pdata->i2c_adapter_id);
  298. if (!adapter) {
  299. /* Eek, no such I2C adapter! Bail out. */
  300. dev_warn(dev, "Chip at i2c address 0x%x: Invalid i2c adapter %d\n",
  301. plat_chip_data->addr, pdata->i2c_adapter_id);
  302. return -ENODEV;
  303. }
  304. if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_READ_BYTE_DATA)) {
  305. dev_warn(dev, "i2c adapter %d non-functional\n",
  306. pdata->i2c_adapter_id);
  307. return -EINVAL;
  308. }
  309. memset(&info, 0, sizeof(struct i2c_board_info));
  310. info.addr = plat_chip_data->addr;
  311. strlcpy(info.type, "htcpld-chip", I2C_NAME_SIZE);
  312. info.platform_data = chip;
  313. /* Add the I2C device. This calls the probe() function. */
  314. client = i2c_new_device(adapter, &info);
  315. if (!client) {
  316. /* I2C device registration failed, contineu with the next */
  317. dev_warn(dev, "Unable to add I2C device for 0x%x\n",
  318. plat_chip_data->addr);
  319. return -ENODEV;
  320. }
  321. i2c_set_clientdata(client, chip);
  322. snprintf(client->name, I2C_NAME_SIZE, "Chip_0x%x", client->addr);
  323. chip->client = client;
  324. /* Reset the chip */
  325. htcpld_chip_reset(client);
  326. chip->cache_in = i2c_smbus_read_byte_data(client, chip->cache_out);
  327. return 0;
  328. }
  329. static void htcpld_unregister_chip_i2c(
  330. struct platform_device *pdev,
  331. int chip_index)
  332. {
  333. struct htcpld_data *htcpld;
  334. struct htcpld_chip *chip;
  335. /* Get the platform and driver data */
  336. htcpld = platform_get_drvdata(pdev);
  337. chip = &htcpld->chip[chip_index];
  338. if (chip->client)
  339. i2c_unregister_device(chip->client);
  340. }
  341. static int htcpld_register_chip_gpio(
  342. struct platform_device *pdev,
  343. int chip_index)
  344. {
  345. struct htcpld_data *htcpld;
  346. struct device *dev = &pdev->dev;
  347. struct htcpld_core_platform_data *pdata;
  348. struct htcpld_chip *chip;
  349. struct htcpld_chip_platform_data *plat_chip_data;
  350. struct gpio_chip *gpio_chip;
  351. int ret = 0;
  352. /* Get the platform and driver data */
  353. pdata = dev_get_platdata(dev);
  354. htcpld = platform_get_drvdata(pdev);
  355. chip = &htcpld->chip[chip_index];
  356. plat_chip_data = &pdata->chip[chip_index];
  357. /* Setup the GPIO chips */
  358. gpio_chip = &(chip->chip_out);
  359. gpio_chip->label = "htcpld-out";
  360. gpio_chip->parent = dev;
  361. gpio_chip->owner = THIS_MODULE;
  362. gpio_chip->get = htcpld_chip_get;
  363. gpio_chip->set = htcpld_chip_set;
  364. gpio_chip->direction_input = NULL;
  365. gpio_chip->direction_output = htcpld_direction_output;
  366. gpio_chip->base = plat_chip_data->gpio_out_base;
  367. gpio_chip->ngpio = plat_chip_data->num_gpios;
  368. gpio_chip = &(chip->chip_in);
  369. gpio_chip->label = "htcpld-in";
  370. gpio_chip->parent = dev;
  371. gpio_chip->owner = THIS_MODULE;
  372. gpio_chip->get = htcpld_chip_get;
  373. gpio_chip->set = NULL;
  374. gpio_chip->direction_input = htcpld_direction_input;
  375. gpio_chip->direction_output = NULL;
  376. gpio_chip->to_irq = htcpld_chip_to_irq;
  377. gpio_chip->base = plat_chip_data->gpio_in_base;
  378. gpio_chip->ngpio = plat_chip_data->num_gpios;
  379. /* Add the GPIO chips */
  380. ret = gpiochip_add_data(&(chip->chip_out), chip);
  381. if (ret) {
  382. dev_warn(dev, "Unable to register output GPIOs for 0x%x: %d\n",
  383. plat_chip_data->addr, ret);
  384. return ret;
  385. }
  386. ret = gpiochip_add_data(&(chip->chip_in), chip);
  387. if (ret) {
  388. dev_warn(dev, "Unable to register input GPIOs for 0x%x: %d\n",
  389. plat_chip_data->addr, ret);
  390. gpiochip_remove(&(chip->chip_out));
  391. return ret;
  392. }
  393. return 0;
  394. }
  395. static int htcpld_setup_chips(struct platform_device *pdev)
  396. {
  397. struct htcpld_data *htcpld;
  398. struct device *dev = &pdev->dev;
  399. struct htcpld_core_platform_data *pdata;
  400. int i;
  401. /* Get the platform and driver data */
  402. pdata = dev_get_platdata(dev);
  403. htcpld = platform_get_drvdata(pdev);
  404. /* Setup each chip's output GPIOs */
  405. htcpld->nchips = pdata->num_chip;
  406. htcpld->chip = devm_kzalloc(dev, sizeof(struct htcpld_chip) * htcpld->nchips,
  407. GFP_KERNEL);
  408. if (!htcpld->chip) {
  409. dev_warn(dev, "Unable to allocate memory for chips\n");
  410. return -ENOMEM;
  411. }
  412. /* Add the chips as best we can */
  413. for (i = 0; i < htcpld->nchips; i++) {
  414. int ret;
  415. /* Setup the HTCPLD chips */
  416. htcpld->chip[i].reset = pdata->chip[i].reset;
  417. htcpld->chip[i].cache_out = pdata->chip[i].reset;
  418. htcpld->chip[i].cache_in = 0;
  419. htcpld->chip[i].dev = dev;
  420. htcpld->chip[i].irq_start = pdata->chip[i].irq_base;
  421. htcpld->chip[i].nirqs = pdata->chip[i].num_irqs;
  422. INIT_WORK(&(htcpld->chip[i].set_val_work), &htcpld_chip_set_ni);
  423. spin_lock_init(&(htcpld->chip[i].lock));
  424. /* Setup the interrupts for the chip */
  425. if (htcpld->chained_irq) {
  426. ret = htcpld_setup_chip_irq(pdev, i);
  427. if (ret)
  428. continue;
  429. }
  430. /* Register the chip with I2C */
  431. ret = htcpld_register_chip_i2c(pdev, i);
  432. if (ret)
  433. continue;
  434. /* Register the chips with the GPIO subsystem */
  435. ret = htcpld_register_chip_gpio(pdev, i);
  436. if (ret) {
  437. /* Unregister the chip from i2c and continue */
  438. htcpld_unregister_chip_i2c(pdev, i);
  439. continue;
  440. }
  441. dev_info(dev, "Registered chip at 0x%x\n", pdata->chip[i].addr);
  442. }
  443. return 0;
  444. }
  445. static int htcpld_core_probe(struct platform_device *pdev)
  446. {
  447. struct htcpld_data *htcpld;
  448. struct device *dev = &pdev->dev;
  449. struct htcpld_core_platform_data *pdata;
  450. struct resource *res;
  451. int ret = 0;
  452. if (!dev)
  453. return -ENODEV;
  454. pdata = dev_get_platdata(dev);
  455. if (!pdata) {
  456. dev_warn(dev, "Platform data not found for htcpld core!\n");
  457. return -ENXIO;
  458. }
  459. htcpld = devm_kzalloc(dev, sizeof(struct htcpld_data), GFP_KERNEL);
  460. if (!htcpld)
  461. return -ENOMEM;
  462. /* Find chained irq */
  463. res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  464. if (res) {
  465. int flags;
  466. htcpld->chained_irq = res->start;
  467. /* Setup the chained interrupt handler */
  468. flags = IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING |
  469. IRQF_ONESHOT;
  470. ret = request_threaded_irq(htcpld->chained_irq,
  471. NULL, htcpld_handler,
  472. flags, pdev->name, htcpld);
  473. if (ret) {
  474. dev_warn(dev, "Unable to setup chained irq handler: %d\n", ret);
  475. return ret;
  476. } else
  477. device_init_wakeup(dev, 0);
  478. }
  479. /* Set the driver data */
  480. platform_set_drvdata(pdev, htcpld);
  481. /* Setup the htcpld chips */
  482. ret = htcpld_setup_chips(pdev);
  483. if (ret)
  484. return ret;
  485. /* Request the GPIO(s) for the int reset and set them up */
  486. if (pdata->int_reset_gpio_hi) {
  487. ret = gpio_request(pdata->int_reset_gpio_hi, "htcpld-core");
  488. if (ret) {
  489. /*
  490. * If it failed, that sucks, but we can probably
  491. * continue on without it.
  492. */
  493. dev_warn(dev, "Unable to request int_reset_gpio_hi -- interrupts may not work\n");
  494. htcpld->int_reset_gpio_hi = 0;
  495. } else {
  496. htcpld->int_reset_gpio_hi = pdata->int_reset_gpio_hi;
  497. gpio_set_value(htcpld->int_reset_gpio_hi, 1);
  498. }
  499. }
  500. if (pdata->int_reset_gpio_lo) {
  501. ret = gpio_request(pdata->int_reset_gpio_lo, "htcpld-core");
  502. if (ret) {
  503. /*
  504. * If it failed, that sucks, but we can probably
  505. * continue on without it.
  506. */
  507. dev_warn(dev, "Unable to request int_reset_gpio_lo -- interrupts may not work\n");
  508. htcpld->int_reset_gpio_lo = 0;
  509. } else {
  510. htcpld->int_reset_gpio_lo = pdata->int_reset_gpio_lo;
  511. gpio_set_value(htcpld->int_reset_gpio_lo, 0);
  512. }
  513. }
  514. dev_info(dev, "Initialized successfully\n");
  515. return 0;
  516. }
  517. /* The I2C Driver -- used internally */
  518. static const struct i2c_device_id htcpld_chip_id[] = {
  519. { "htcpld-chip", 0 },
  520. { }
  521. };
  522. MODULE_DEVICE_TABLE(i2c, htcpld_chip_id);
  523. static struct i2c_driver htcpld_chip_driver = {
  524. .driver = {
  525. .name = "htcpld-chip",
  526. },
  527. .id_table = htcpld_chip_id,
  528. };
  529. /* The Core Driver */
  530. static struct platform_driver htcpld_core_driver = {
  531. .driver = {
  532. .name = "i2c-htcpld",
  533. },
  534. };
  535. static int __init htcpld_core_init(void)
  536. {
  537. int ret;
  538. /* Register the I2C Chip driver */
  539. ret = i2c_add_driver(&htcpld_chip_driver);
  540. if (ret)
  541. return ret;
  542. /* Probe for our chips */
  543. return platform_driver_probe(&htcpld_core_driver, htcpld_core_probe);
  544. }
  545. static void __exit htcpld_core_exit(void)
  546. {
  547. i2c_del_driver(&htcpld_chip_driver);
  548. platform_driver_unregister(&htcpld_core_driver);
  549. }
  550. module_init(htcpld_core_init);
  551. module_exit(htcpld_core_exit);
  552. MODULE_AUTHOR("Cory Maccarrone <darkstar6262@gmail.com>");
  553. MODULE_DESCRIPTION("I2C HTC PLD Driver");
  554. MODULE_LICENSE("GPL");