gpio-ml-ioh.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. /*
  2. * Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; version 2 of the License.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
  16. */
  17. #include <linux/module.h>
  18. #include <linux/kernel.h>
  19. #include <linux/slab.h>
  20. #include <linux/pci.h>
  21. #include <linux/gpio.h>
  22. #include <linux/interrupt.h>
  23. #include <linux/irq.h>
  24. #define IOH_EDGE_FALLING 0
  25. #define IOH_EDGE_RISING BIT(0)
  26. #define IOH_LEVEL_L BIT(1)
  27. #define IOH_LEVEL_H (BIT(0) | BIT(1))
  28. #define IOH_EDGE_BOTH BIT(2)
  29. #define IOH_IM_MASK (BIT(0) | BIT(1) | BIT(2))
  30. #define IOH_IRQ_BASE 0
  31. #define PCI_VENDOR_ID_ROHM 0x10DB
  32. struct ioh_reg_comn {
  33. u32 ien;
  34. u32 istatus;
  35. u32 idisp;
  36. u32 iclr;
  37. u32 imask;
  38. u32 imaskclr;
  39. u32 po;
  40. u32 pi;
  41. u32 pm;
  42. u32 im_0;
  43. u32 im_1;
  44. u32 reserved;
  45. };
  46. struct ioh_regs {
  47. struct ioh_reg_comn regs[8];
  48. u32 reserve1[16];
  49. u32 ioh_sel_reg[4];
  50. u32 reserve2[11];
  51. u32 srst;
  52. };
  53. /**
  54. * struct ioh_gpio_reg_data - The register store data.
  55. * @ien_reg To store contents of interrupt enable register.
  56. * @imask_reg: To store contents of interrupt mask regist
  57. * @po_reg: To store contents of PO register.
  58. * @pm_reg: To store contents of PM register.
  59. * @im0_reg: To store contents of interrupt mode regist0
  60. * @im1_reg: To store contents of interrupt mode regist1
  61. * @use_sel_reg: To store contents of GPIO_USE_SEL0~3
  62. */
  63. struct ioh_gpio_reg_data {
  64. u32 ien_reg;
  65. u32 imask_reg;
  66. u32 po_reg;
  67. u32 pm_reg;
  68. u32 im0_reg;
  69. u32 im1_reg;
  70. u32 use_sel_reg;
  71. };
  72. /**
  73. * struct ioh_gpio - GPIO private data structure.
  74. * @base: PCI base address of Memory mapped I/O register.
  75. * @reg: Memory mapped IOH GPIO register list.
  76. * @dev: Pointer to device structure.
  77. * @gpio: Data for GPIO infrastructure.
  78. * @ioh_gpio_reg: Memory mapped Register data is saved here
  79. * when suspend.
  80. * @gpio_use_sel: Save GPIO_USE_SEL1~4 register for PM
  81. * @ch: Indicate GPIO channel
  82. * @irq_base: Save base of IRQ number for interrupt
  83. * @spinlock: Used for register access protection in
  84. * interrupt context ioh_irq_type and PM;
  85. */
  86. struct ioh_gpio {
  87. void __iomem *base;
  88. struct ioh_regs __iomem *reg;
  89. struct device *dev;
  90. struct gpio_chip gpio;
  91. struct ioh_gpio_reg_data ioh_gpio_reg;
  92. u32 gpio_use_sel;
  93. struct mutex lock;
  94. int ch;
  95. int irq_base;
  96. spinlock_t spinlock;
  97. };
  98. static const int num_ports[] = {6, 12, 16, 16, 15, 16, 16, 12};
  99. static void ioh_gpio_set(struct gpio_chip *gpio, unsigned nr, int val)
  100. {
  101. u32 reg_val;
  102. struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio);
  103. mutex_lock(&chip->lock);
  104. reg_val = ioread32(&chip->reg->regs[chip->ch].po);
  105. if (val)
  106. reg_val |= (1 << nr);
  107. else
  108. reg_val &= ~(1 << nr);
  109. iowrite32(reg_val, &chip->reg->regs[chip->ch].po);
  110. mutex_unlock(&chip->lock);
  111. }
  112. static int ioh_gpio_get(struct gpio_chip *gpio, unsigned nr)
  113. {
  114. struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio);
  115. return ioread32(&chip->reg->regs[chip->ch].pi) & (1 << nr);
  116. }
  117. static int ioh_gpio_direction_output(struct gpio_chip *gpio, unsigned nr,
  118. int val)
  119. {
  120. struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio);
  121. u32 pm;
  122. u32 reg_val;
  123. mutex_lock(&chip->lock);
  124. pm = ioread32(&chip->reg->regs[chip->ch].pm) &
  125. ((1 << num_ports[chip->ch]) - 1);
  126. pm |= (1 << nr);
  127. iowrite32(pm, &chip->reg->regs[chip->ch].pm);
  128. reg_val = ioread32(&chip->reg->regs[chip->ch].po);
  129. if (val)
  130. reg_val |= (1 << nr);
  131. else
  132. reg_val &= ~(1 << nr);
  133. iowrite32(reg_val, &chip->reg->regs[chip->ch].po);
  134. mutex_unlock(&chip->lock);
  135. return 0;
  136. }
  137. static int ioh_gpio_direction_input(struct gpio_chip *gpio, unsigned nr)
  138. {
  139. struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio);
  140. u32 pm;
  141. mutex_lock(&chip->lock);
  142. pm = ioread32(&chip->reg->regs[chip->ch].pm) &
  143. ((1 << num_ports[chip->ch]) - 1);
  144. pm &= ~(1 << nr);
  145. iowrite32(pm, &chip->reg->regs[chip->ch].pm);
  146. mutex_unlock(&chip->lock);
  147. return 0;
  148. }
  149. #ifdef CONFIG_PM
  150. /*
  151. * Save register configuration and disable interrupts.
  152. */
  153. static void ioh_gpio_save_reg_conf(struct ioh_gpio *chip)
  154. {
  155. int i;
  156. for (i = 0; i < 8; i ++, chip++) {
  157. chip->ioh_gpio_reg.po_reg =
  158. ioread32(&chip->reg->regs[chip->ch].po);
  159. chip->ioh_gpio_reg.pm_reg =
  160. ioread32(&chip->reg->regs[chip->ch].pm);
  161. chip->ioh_gpio_reg.ien_reg =
  162. ioread32(&chip->reg->regs[chip->ch].ien);
  163. chip->ioh_gpio_reg.imask_reg =
  164. ioread32(&chip->reg->regs[chip->ch].imask);
  165. chip->ioh_gpio_reg.im0_reg =
  166. ioread32(&chip->reg->regs[chip->ch].im_0);
  167. chip->ioh_gpio_reg.im1_reg =
  168. ioread32(&chip->reg->regs[chip->ch].im_1);
  169. if (i < 4)
  170. chip->ioh_gpio_reg.use_sel_reg =
  171. ioread32(&chip->reg->ioh_sel_reg[i]);
  172. }
  173. }
  174. /*
  175. * This function restores the register configuration of the GPIO device.
  176. */
  177. static void ioh_gpio_restore_reg_conf(struct ioh_gpio *chip)
  178. {
  179. int i;
  180. for (i = 0; i < 8; i ++, chip++) {
  181. iowrite32(chip->ioh_gpio_reg.po_reg,
  182. &chip->reg->regs[chip->ch].po);
  183. iowrite32(chip->ioh_gpio_reg.pm_reg,
  184. &chip->reg->regs[chip->ch].pm);
  185. iowrite32(chip->ioh_gpio_reg.ien_reg,
  186. &chip->reg->regs[chip->ch].ien);
  187. iowrite32(chip->ioh_gpio_reg.imask_reg,
  188. &chip->reg->regs[chip->ch].imask);
  189. iowrite32(chip->ioh_gpio_reg.im0_reg,
  190. &chip->reg->regs[chip->ch].im_0);
  191. iowrite32(chip->ioh_gpio_reg.im1_reg,
  192. &chip->reg->regs[chip->ch].im_1);
  193. if (i < 4)
  194. iowrite32(chip->ioh_gpio_reg.use_sel_reg,
  195. &chip->reg->ioh_sel_reg[i]);
  196. }
  197. }
  198. #endif
  199. static int ioh_gpio_to_irq(struct gpio_chip *gpio, unsigned offset)
  200. {
  201. struct ioh_gpio *chip = container_of(gpio, struct ioh_gpio, gpio);
  202. return chip->irq_base + offset;
  203. }
  204. static void ioh_gpio_setup(struct ioh_gpio *chip, int num_port)
  205. {
  206. struct gpio_chip *gpio = &chip->gpio;
  207. gpio->label = dev_name(chip->dev);
  208. gpio->owner = THIS_MODULE;
  209. gpio->direction_input = ioh_gpio_direction_input;
  210. gpio->get = ioh_gpio_get;
  211. gpio->direction_output = ioh_gpio_direction_output;
  212. gpio->set = ioh_gpio_set;
  213. gpio->dbg_show = NULL;
  214. gpio->base = -1;
  215. gpio->ngpio = num_port;
  216. gpio->can_sleep = 0;
  217. gpio->to_irq = ioh_gpio_to_irq;
  218. }
  219. static int ioh_irq_type(struct irq_data *d, unsigned int type)
  220. {
  221. u32 im;
  222. void __iomem *im_reg;
  223. u32 ien;
  224. u32 im_pos;
  225. int ch;
  226. unsigned long flags;
  227. u32 val;
  228. int irq = d->irq;
  229. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  230. struct ioh_gpio *chip = gc->private;
  231. ch = irq - chip->irq_base;
  232. if (irq <= chip->irq_base + 7) {
  233. im_reg = &chip->reg->regs[chip->ch].im_0;
  234. im_pos = ch;
  235. } else {
  236. im_reg = &chip->reg->regs[chip->ch].im_1;
  237. im_pos = ch - 8;
  238. }
  239. dev_dbg(chip->dev, "%s:irq=%d type=%d ch=%d pos=%d type=%d\n",
  240. __func__, irq, type, ch, im_pos, type);
  241. spin_lock_irqsave(&chip->spinlock, flags);
  242. switch (type) {
  243. case IRQ_TYPE_EDGE_RISING:
  244. val = IOH_EDGE_RISING;
  245. break;
  246. case IRQ_TYPE_EDGE_FALLING:
  247. val = IOH_EDGE_FALLING;
  248. break;
  249. case IRQ_TYPE_EDGE_BOTH:
  250. val = IOH_EDGE_BOTH;
  251. break;
  252. case IRQ_TYPE_LEVEL_HIGH:
  253. val = IOH_LEVEL_H;
  254. break;
  255. case IRQ_TYPE_LEVEL_LOW:
  256. val = IOH_LEVEL_L;
  257. break;
  258. case IRQ_TYPE_PROBE:
  259. goto end;
  260. default:
  261. dev_warn(chip->dev, "%s: unknown type(%dd)",
  262. __func__, type);
  263. goto end;
  264. }
  265. /* Set interrupt mode */
  266. im = ioread32(im_reg) & ~(IOH_IM_MASK << (im_pos * 4));
  267. iowrite32(im | (val << (im_pos * 4)), im_reg);
  268. /* iclr */
  269. iowrite32(BIT(ch), &chip->reg->regs[chip->ch].iclr);
  270. /* IMASKCLR */
  271. iowrite32(BIT(ch), &chip->reg->regs[chip->ch].imaskclr);
  272. /* Enable interrupt */
  273. ien = ioread32(&chip->reg->regs[chip->ch].ien);
  274. iowrite32(ien | BIT(ch), &chip->reg->regs[chip->ch].ien);
  275. end:
  276. spin_unlock_irqrestore(&chip->spinlock, flags);
  277. return 0;
  278. }
  279. static void ioh_irq_unmask(struct irq_data *d)
  280. {
  281. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  282. struct ioh_gpio *chip = gc->private;
  283. iowrite32(1 << (d->irq - chip->irq_base),
  284. &chip->reg->regs[chip->ch].imaskclr);
  285. }
  286. static void ioh_irq_mask(struct irq_data *d)
  287. {
  288. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  289. struct ioh_gpio *chip = gc->private;
  290. iowrite32(1 << (d->irq - chip->irq_base),
  291. &chip->reg->regs[chip->ch].imask);
  292. }
  293. static void ioh_irq_disable(struct irq_data *d)
  294. {
  295. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  296. struct ioh_gpio *chip = gc->private;
  297. unsigned long flags;
  298. u32 ien;
  299. spin_lock_irqsave(&chip->spinlock, flags);
  300. ien = ioread32(&chip->reg->regs[chip->ch].ien);
  301. ien &= ~(1 << (d->irq - chip->irq_base));
  302. iowrite32(ien, &chip->reg->regs[chip->ch].ien);
  303. spin_unlock_irqrestore(&chip->spinlock, flags);
  304. }
  305. static void ioh_irq_enable(struct irq_data *d)
  306. {
  307. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  308. struct ioh_gpio *chip = gc->private;
  309. unsigned long flags;
  310. u32 ien;
  311. spin_lock_irqsave(&chip->spinlock, flags);
  312. ien = ioread32(&chip->reg->regs[chip->ch].ien);
  313. ien |= 1 << (d->irq - chip->irq_base);
  314. iowrite32(ien, &chip->reg->regs[chip->ch].ien);
  315. spin_unlock_irqrestore(&chip->spinlock, flags);
  316. }
  317. static irqreturn_t ioh_gpio_handler(int irq, void *dev_id)
  318. {
  319. struct ioh_gpio *chip = dev_id;
  320. u32 reg_val;
  321. int i, j;
  322. int ret = IRQ_NONE;
  323. for (i = 0; i < 8; i++, chip++) {
  324. reg_val = ioread32(&chip->reg->regs[i].istatus);
  325. for (j = 0; j < num_ports[i]; j++) {
  326. if (reg_val & BIT(j)) {
  327. dev_dbg(chip->dev,
  328. "%s:[%d]:irq=%d status=0x%x\n",
  329. __func__, j, irq, reg_val);
  330. iowrite32(BIT(j),
  331. &chip->reg->regs[chip->ch].iclr);
  332. generic_handle_irq(chip->irq_base + j);
  333. ret = IRQ_HANDLED;
  334. }
  335. }
  336. }
  337. return ret;
  338. }
  339. static __devinit void ioh_gpio_alloc_generic_chip(struct ioh_gpio *chip,
  340. unsigned int irq_start, unsigned int num)
  341. {
  342. struct irq_chip_generic *gc;
  343. struct irq_chip_type *ct;
  344. gc = irq_alloc_generic_chip("ioh_gpio", 1, irq_start, chip->base,
  345. handle_simple_irq);
  346. gc->private = chip;
  347. ct = gc->chip_types;
  348. ct->chip.irq_mask = ioh_irq_mask;
  349. ct->chip.irq_unmask = ioh_irq_unmask;
  350. ct->chip.irq_set_type = ioh_irq_type;
  351. ct->chip.irq_disable = ioh_irq_disable;
  352. ct->chip.irq_enable = ioh_irq_enable;
  353. irq_setup_generic_chip(gc, IRQ_MSK(num), IRQ_GC_INIT_MASK_CACHE,
  354. IRQ_NOREQUEST | IRQ_NOPROBE, 0);
  355. }
  356. static int __devinit ioh_gpio_probe(struct pci_dev *pdev,
  357. const struct pci_device_id *id)
  358. {
  359. int ret;
  360. int i, j;
  361. struct ioh_gpio *chip;
  362. void __iomem *base;
  363. void *chip_save;
  364. int irq_base;
  365. ret = pci_enable_device(pdev);
  366. if (ret) {
  367. dev_err(&pdev->dev, "%s : pci_enable_device failed", __func__);
  368. goto err_pci_enable;
  369. }
  370. ret = pci_request_regions(pdev, KBUILD_MODNAME);
  371. if (ret) {
  372. dev_err(&pdev->dev, "pci_request_regions failed-%d", ret);
  373. goto err_request_regions;
  374. }
  375. base = pci_iomap(pdev, 1, 0);
  376. if (!base) {
  377. dev_err(&pdev->dev, "%s : pci_iomap failed", __func__);
  378. ret = -ENOMEM;
  379. goto err_iomap;
  380. }
  381. chip_save = kzalloc(sizeof(*chip) * 8, GFP_KERNEL);
  382. if (chip_save == NULL) {
  383. dev_err(&pdev->dev, "%s : kzalloc failed", __func__);
  384. ret = -ENOMEM;
  385. goto err_kzalloc;
  386. }
  387. chip = chip_save;
  388. for (i = 0; i < 8; i++, chip++) {
  389. chip->dev = &pdev->dev;
  390. chip->base = base;
  391. chip->reg = chip->base;
  392. chip->ch = i;
  393. mutex_init(&chip->lock);
  394. spin_lock_init(&chip->spinlock);
  395. ioh_gpio_setup(chip, num_ports[i]);
  396. ret = gpiochip_add(&chip->gpio);
  397. if (ret) {
  398. dev_err(&pdev->dev, "IOH gpio: Failed to register GPIO\n");
  399. goto err_gpiochip_add;
  400. }
  401. }
  402. chip = chip_save;
  403. for (j = 0; j < 8; j++, chip++) {
  404. irq_base = irq_alloc_descs(-1, IOH_IRQ_BASE, num_ports[j],
  405. NUMA_NO_NODE);
  406. if (irq_base < 0) {
  407. dev_warn(&pdev->dev,
  408. "ml_ioh_gpio: Failed to get IRQ base num\n");
  409. chip->irq_base = -1;
  410. goto err_irq_alloc_descs;
  411. }
  412. chip->irq_base = irq_base;
  413. ioh_gpio_alloc_generic_chip(chip, irq_base, num_ports[j]);
  414. }
  415. chip = chip_save;
  416. ret = request_irq(pdev->irq, ioh_gpio_handler,
  417. IRQF_SHARED, KBUILD_MODNAME, chip);
  418. if (ret != 0) {
  419. dev_err(&pdev->dev,
  420. "%s request_irq failed\n", __func__);
  421. goto err_request_irq;
  422. }
  423. pci_set_drvdata(pdev, chip);
  424. return 0;
  425. err_request_irq:
  426. chip = chip_save;
  427. err_irq_alloc_descs:
  428. while (--j >= 0) {
  429. chip--;
  430. irq_free_descs(chip->irq_base, num_ports[j]);
  431. }
  432. chip = chip_save;
  433. err_gpiochip_add:
  434. while (--i >= 0) {
  435. chip--;
  436. ret = gpiochip_remove(&chip->gpio);
  437. if (ret)
  438. dev_err(&pdev->dev, "Failed gpiochip_remove(%d)\n", i);
  439. }
  440. kfree(chip_save);
  441. err_kzalloc:
  442. pci_iounmap(pdev, base);
  443. err_iomap:
  444. pci_release_regions(pdev);
  445. err_request_regions:
  446. pci_disable_device(pdev);
  447. err_pci_enable:
  448. dev_err(&pdev->dev, "%s Failed returns %d\n", __func__, ret);
  449. return ret;
  450. }
  451. static void __devexit ioh_gpio_remove(struct pci_dev *pdev)
  452. {
  453. int err;
  454. int i;
  455. struct ioh_gpio *chip = pci_get_drvdata(pdev);
  456. void *chip_save;
  457. chip_save = chip;
  458. free_irq(pdev->irq, chip);
  459. for (i = 0; i < 8; i++, chip++) {
  460. irq_free_descs(chip->irq_base, num_ports[i]);
  461. err = gpiochip_remove(&chip->gpio);
  462. if (err)
  463. dev_err(&pdev->dev, "Failed gpiochip_remove\n");
  464. }
  465. chip = chip_save;
  466. pci_iounmap(pdev, chip->base);
  467. pci_release_regions(pdev);
  468. pci_disable_device(pdev);
  469. kfree(chip);
  470. }
  471. #ifdef CONFIG_PM
  472. static int ioh_gpio_suspend(struct pci_dev *pdev, pm_message_t state)
  473. {
  474. s32 ret;
  475. struct ioh_gpio *chip = pci_get_drvdata(pdev);
  476. unsigned long flags;
  477. spin_lock_irqsave(&chip->spinlock, flags);
  478. ioh_gpio_save_reg_conf(chip);
  479. spin_unlock_irqrestore(&chip->spinlock, flags);
  480. ret = pci_save_state(pdev);
  481. if (ret) {
  482. dev_err(&pdev->dev, "pci_save_state Failed-%d\n", ret);
  483. return ret;
  484. }
  485. pci_disable_device(pdev);
  486. pci_set_power_state(pdev, PCI_D0);
  487. ret = pci_enable_wake(pdev, PCI_D0, 1);
  488. if (ret)
  489. dev_err(&pdev->dev, "pci_enable_wake Failed -%d\n", ret);
  490. return 0;
  491. }
  492. static int ioh_gpio_resume(struct pci_dev *pdev)
  493. {
  494. s32 ret;
  495. struct ioh_gpio *chip = pci_get_drvdata(pdev);
  496. unsigned long flags;
  497. ret = pci_enable_wake(pdev, PCI_D0, 0);
  498. pci_set_power_state(pdev, PCI_D0);
  499. ret = pci_enable_device(pdev);
  500. if (ret) {
  501. dev_err(&pdev->dev, "pci_enable_device Failed-%d ", ret);
  502. return ret;
  503. }
  504. pci_restore_state(pdev);
  505. spin_lock_irqsave(&chip->spinlock, flags);
  506. iowrite32(0x01, &chip->reg->srst);
  507. iowrite32(0x00, &chip->reg->srst);
  508. ioh_gpio_restore_reg_conf(chip);
  509. spin_unlock_irqrestore(&chip->spinlock, flags);
  510. return 0;
  511. }
  512. #else
  513. #define ioh_gpio_suspend NULL
  514. #define ioh_gpio_resume NULL
  515. #endif
  516. static DEFINE_PCI_DEVICE_TABLE(ioh_gpio_pcidev_id) = {
  517. { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x802E) },
  518. { 0, }
  519. };
  520. MODULE_DEVICE_TABLE(pci, ioh_gpio_pcidev_id);
  521. static struct pci_driver ioh_gpio_driver = {
  522. .name = "ml_ioh_gpio",
  523. .id_table = ioh_gpio_pcidev_id,
  524. .probe = ioh_gpio_probe,
  525. .remove = __devexit_p(ioh_gpio_remove),
  526. .suspend = ioh_gpio_suspend,
  527. .resume = ioh_gpio_resume
  528. };
  529. static int __init ioh_gpio_pci_init(void)
  530. {
  531. return pci_register_driver(&ioh_gpio_driver);
  532. }
  533. module_init(ioh_gpio_pci_init);
  534. static void __exit ioh_gpio_pci_exit(void)
  535. {
  536. pci_unregister_driver(&ioh_gpio_driver);
  537. }
  538. module_exit(ioh_gpio_pci_exit);
  539. MODULE_DESCRIPTION("OKI SEMICONDUCTOR ML-IOH series GPIO Driver");
  540. MODULE_LICENSE("GPL");