gpio-tz1090.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605
  1. /*
  2. * Toumaz Xenif TZ1090 GPIO handling.
  3. *
  4. * Copyright (C) 2008-2013 Imagination Technologies Ltd.
  5. *
  6. * Based on ARM PXA code and others.
  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/bitops.h>
  13. #include <linux/export.h>
  14. #include <linux/gpio.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/io.h>
  17. #include <linux/irq.h>
  18. #include <linux/irqdomain.h>
  19. #include <linux/kernel.h>
  20. #include <linux/of_irq.h>
  21. #include <linux/pinctrl/consumer.h>
  22. #include <linux/platform_device.h>
  23. #include <linux/slab.h>
  24. #include <linux/syscore_ops.h>
  25. #include <asm/global_lock.h>
  26. /* Register offsets from bank base address */
  27. #define REG_GPIO_DIR 0x00
  28. #define REG_GPIO_IRQ_PLRT 0x20
  29. #define REG_GPIO_IRQ_TYPE 0x30
  30. #define REG_GPIO_IRQ_EN 0x40
  31. #define REG_GPIO_IRQ_STS 0x50
  32. #define REG_GPIO_BIT_EN 0x60
  33. #define REG_GPIO_DIN 0x70
  34. #define REG_GPIO_DOUT 0x80
  35. /* REG_GPIO_IRQ_PLRT */
  36. #define REG_GPIO_IRQ_PLRT_LOW 0
  37. #define REG_GPIO_IRQ_PLRT_HIGH 1
  38. /* REG_GPIO_IRQ_TYPE */
  39. #define REG_GPIO_IRQ_TYPE_LEVEL 0
  40. #define REG_GPIO_IRQ_TYPE_EDGE 1
  41. /**
  42. * struct tz1090_gpio_bank - GPIO bank private data
  43. * @chip: Generic GPIO chip for GPIO bank
  44. * @domain: IRQ domain for GPIO bank (may be NULL)
  45. * @reg: Base of registers, offset for this GPIO bank
  46. * @irq: IRQ number for GPIO bank
  47. * @label: Debug GPIO bank label, used for storage of chip->label
  48. *
  49. * This is the main private data for a GPIO bank. It encapsulates a gpio_chip,
  50. * and the callbacks for the gpio_chip can access the private data with the
  51. * to_bank() macro below.
  52. */
  53. struct tz1090_gpio_bank {
  54. struct gpio_chip chip;
  55. struct irq_domain *domain;
  56. void __iomem *reg;
  57. int irq;
  58. char label[16];
  59. };
  60. /**
  61. * struct tz1090_gpio - Overall GPIO device private data
  62. * @dev: Device (from platform device)
  63. * @reg: Base of GPIO registers
  64. *
  65. * Represents the overall GPIO device. This structure is actually only
  66. * temporary, and used during init.
  67. */
  68. struct tz1090_gpio {
  69. struct device *dev;
  70. void __iomem *reg;
  71. };
  72. /**
  73. * struct tz1090_gpio_bank_info - Temporary registration info for GPIO bank
  74. * @priv: Overall GPIO device private data
  75. * @node: Device tree node specific to this GPIO bank
  76. * @index: Index of bank in range 0-2
  77. */
  78. struct tz1090_gpio_bank_info {
  79. struct tz1090_gpio *priv;
  80. struct device_node *node;
  81. unsigned int index;
  82. };
  83. /* Convenience register accessors */
  84. static inline void tz1090_gpio_write(struct tz1090_gpio_bank *bank,
  85. unsigned int reg_offs, u32 data)
  86. {
  87. iowrite32(data, bank->reg + reg_offs);
  88. }
  89. static inline u32 tz1090_gpio_read(struct tz1090_gpio_bank *bank,
  90. unsigned int reg_offs)
  91. {
  92. return ioread32(bank->reg + reg_offs);
  93. }
  94. /* caller must hold LOCK2 */
  95. static inline void _tz1090_gpio_clear_bit(struct tz1090_gpio_bank *bank,
  96. unsigned int reg_offs,
  97. unsigned int offset)
  98. {
  99. u32 value;
  100. value = tz1090_gpio_read(bank, reg_offs);
  101. value &= ~BIT(offset);
  102. tz1090_gpio_write(bank, reg_offs, value);
  103. }
  104. static void tz1090_gpio_clear_bit(struct tz1090_gpio_bank *bank,
  105. unsigned int reg_offs,
  106. unsigned int offset)
  107. {
  108. int lstat;
  109. __global_lock2(lstat);
  110. _tz1090_gpio_clear_bit(bank, reg_offs, offset);
  111. __global_unlock2(lstat);
  112. }
  113. /* caller must hold LOCK2 */
  114. static inline void _tz1090_gpio_set_bit(struct tz1090_gpio_bank *bank,
  115. unsigned int reg_offs,
  116. unsigned int offset)
  117. {
  118. u32 value;
  119. value = tz1090_gpio_read(bank, reg_offs);
  120. value |= BIT(offset);
  121. tz1090_gpio_write(bank, reg_offs, value);
  122. }
  123. static void tz1090_gpio_set_bit(struct tz1090_gpio_bank *bank,
  124. unsigned int reg_offs,
  125. unsigned int offset)
  126. {
  127. int lstat;
  128. __global_lock2(lstat);
  129. _tz1090_gpio_set_bit(bank, reg_offs, offset);
  130. __global_unlock2(lstat);
  131. }
  132. /* caller must hold LOCK2 */
  133. static inline void _tz1090_gpio_mod_bit(struct tz1090_gpio_bank *bank,
  134. unsigned int reg_offs,
  135. unsigned int offset,
  136. bool val)
  137. {
  138. u32 value;
  139. value = tz1090_gpio_read(bank, reg_offs);
  140. value &= ~BIT(offset);
  141. if (val)
  142. value |= BIT(offset);
  143. tz1090_gpio_write(bank, reg_offs, value);
  144. }
  145. static void tz1090_gpio_mod_bit(struct tz1090_gpio_bank *bank,
  146. unsigned int reg_offs,
  147. unsigned int offset,
  148. bool val)
  149. {
  150. int lstat;
  151. __global_lock2(lstat);
  152. _tz1090_gpio_mod_bit(bank, reg_offs, offset, val);
  153. __global_unlock2(lstat);
  154. }
  155. static inline int tz1090_gpio_read_bit(struct tz1090_gpio_bank *bank,
  156. unsigned int reg_offs,
  157. unsigned int offset)
  158. {
  159. return tz1090_gpio_read(bank, reg_offs) & BIT(offset);
  160. }
  161. /* GPIO chip callbacks */
  162. static int tz1090_gpio_direction_input(struct gpio_chip *chip,
  163. unsigned int offset)
  164. {
  165. struct tz1090_gpio_bank *bank = gpiochip_get_data(chip);
  166. tz1090_gpio_set_bit(bank, REG_GPIO_DIR, offset);
  167. return 0;
  168. }
  169. static int tz1090_gpio_direction_output(struct gpio_chip *chip,
  170. unsigned int offset, int output_value)
  171. {
  172. struct tz1090_gpio_bank *bank = gpiochip_get_data(chip);
  173. int lstat;
  174. __global_lock2(lstat);
  175. _tz1090_gpio_mod_bit(bank, REG_GPIO_DOUT, offset, output_value);
  176. _tz1090_gpio_clear_bit(bank, REG_GPIO_DIR, offset);
  177. __global_unlock2(lstat);
  178. return 0;
  179. }
  180. /*
  181. * Return GPIO level
  182. */
  183. static int tz1090_gpio_get(struct gpio_chip *chip, unsigned int offset)
  184. {
  185. struct tz1090_gpio_bank *bank = gpiochip_get_data(chip);
  186. return !!tz1090_gpio_read_bit(bank, REG_GPIO_DIN, offset);
  187. }
  188. /*
  189. * Set output GPIO level
  190. */
  191. static void tz1090_gpio_set(struct gpio_chip *chip, unsigned int offset,
  192. int output_value)
  193. {
  194. struct tz1090_gpio_bank *bank = gpiochip_get_data(chip);
  195. tz1090_gpio_mod_bit(bank, REG_GPIO_DOUT, offset, output_value);
  196. }
  197. static int tz1090_gpio_request(struct gpio_chip *chip, unsigned int offset)
  198. {
  199. struct tz1090_gpio_bank *bank = gpiochip_get_data(chip);
  200. int ret;
  201. ret = pinctrl_request_gpio(chip->base + offset);
  202. if (ret)
  203. return ret;
  204. tz1090_gpio_set_bit(bank, REG_GPIO_DIR, offset);
  205. tz1090_gpio_set_bit(bank, REG_GPIO_BIT_EN, offset);
  206. return 0;
  207. }
  208. static void tz1090_gpio_free(struct gpio_chip *chip, unsigned int offset)
  209. {
  210. struct tz1090_gpio_bank *bank = gpiochip_get_data(chip);
  211. pinctrl_free_gpio(chip->base + offset);
  212. tz1090_gpio_clear_bit(bank, REG_GPIO_BIT_EN, offset);
  213. }
  214. static int tz1090_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
  215. {
  216. struct tz1090_gpio_bank *bank = gpiochip_get_data(chip);
  217. if (!bank->domain)
  218. return -EINVAL;
  219. return irq_create_mapping(bank->domain, offset);
  220. }
  221. /* IRQ chip handlers */
  222. /* Get TZ1090 GPIO chip from irq data provided to generic IRQ callbacks */
  223. static inline struct tz1090_gpio_bank *irqd_to_gpio_bank(struct irq_data *data)
  224. {
  225. return (struct tz1090_gpio_bank *)data->domain->host_data;
  226. }
  227. static void tz1090_gpio_irq_polarity(struct tz1090_gpio_bank *bank,
  228. unsigned int offset, unsigned int polarity)
  229. {
  230. tz1090_gpio_mod_bit(bank, REG_GPIO_IRQ_PLRT, offset, polarity);
  231. }
  232. static void tz1090_gpio_irq_type(struct tz1090_gpio_bank *bank,
  233. unsigned int offset, unsigned int type)
  234. {
  235. tz1090_gpio_mod_bit(bank, REG_GPIO_IRQ_TYPE, offset, type);
  236. }
  237. /* set polarity to trigger on next edge, whether rising or falling */
  238. static void tz1090_gpio_irq_next_edge(struct tz1090_gpio_bank *bank,
  239. unsigned int offset)
  240. {
  241. unsigned int value_p, value_i;
  242. int lstat;
  243. /*
  244. * Set the GPIO's interrupt polarity to the opposite of the current
  245. * input value so that the next edge triggers an interrupt.
  246. */
  247. __global_lock2(lstat);
  248. value_i = ~tz1090_gpio_read(bank, REG_GPIO_DIN);
  249. value_p = tz1090_gpio_read(bank, REG_GPIO_IRQ_PLRT);
  250. value_p &= ~BIT(offset);
  251. value_p |= value_i & BIT(offset);
  252. tz1090_gpio_write(bank, REG_GPIO_IRQ_PLRT, value_p);
  253. __global_unlock2(lstat);
  254. }
  255. static unsigned int gpio_startup_irq(struct irq_data *data)
  256. {
  257. /*
  258. * This warning indicates that the type of the irq hasn't been set
  259. * before enabling the irq. This would normally be done by passing some
  260. * trigger flags to request_irq().
  261. */
  262. WARN(irqd_get_trigger_type(data) == IRQ_TYPE_NONE,
  263. "irq type not set before enabling gpio irq %d", data->irq);
  264. irq_gc_ack_clr_bit(data);
  265. irq_gc_mask_set_bit(data);
  266. return 0;
  267. }
  268. static int gpio_set_irq_type(struct irq_data *data, unsigned int flow_type)
  269. {
  270. struct tz1090_gpio_bank *bank = irqd_to_gpio_bank(data);
  271. unsigned int type;
  272. unsigned int polarity;
  273. switch (flow_type) {
  274. case IRQ_TYPE_EDGE_BOTH:
  275. type = REG_GPIO_IRQ_TYPE_EDGE;
  276. polarity = REG_GPIO_IRQ_PLRT_LOW;
  277. break;
  278. case IRQ_TYPE_EDGE_RISING:
  279. type = REG_GPIO_IRQ_TYPE_EDGE;
  280. polarity = REG_GPIO_IRQ_PLRT_HIGH;
  281. break;
  282. case IRQ_TYPE_EDGE_FALLING:
  283. type = REG_GPIO_IRQ_TYPE_EDGE;
  284. polarity = REG_GPIO_IRQ_PLRT_LOW;
  285. break;
  286. case IRQ_TYPE_LEVEL_HIGH:
  287. type = REG_GPIO_IRQ_TYPE_LEVEL;
  288. polarity = REG_GPIO_IRQ_PLRT_HIGH;
  289. break;
  290. case IRQ_TYPE_LEVEL_LOW:
  291. type = REG_GPIO_IRQ_TYPE_LEVEL;
  292. polarity = REG_GPIO_IRQ_PLRT_LOW;
  293. break;
  294. default:
  295. return -EINVAL;
  296. }
  297. tz1090_gpio_irq_type(bank, data->hwirq, type);
  298. irq_setup_alt_chip(data, flow_type);
  299. if (flow_type == IRQ_TYPE_EDGE_BOTH)
  300. tz1090_gpio_irq_next_edge(bank, data->hwirq);
  301. else
  302. tz1090_gpio_irq_polarity(bank, data->hwirq, polarity);
  303. return 0;
  304. }
  305. #ifdef CONFIG_SUSPEND
  306. static int gpio_set_irq_wake(struct irq_data *data, unsigned int on)
  307. {
  308. struct tz1090_gpio_bank *bank = irqd_to_gpio_bank(data);
  309. #ifdef CONFIG_PM_DEBUG
  310. pr_info("irq_wake irq%d state:%d\n", data->irq, on);
  311. #endif
  312. /* wake on gpio block interrupt */
  313. return irq_set_irq_wake(bank->irq, on);
  314. }
  315. #else
  316. #define gpio_set_irq_wake NULL
  317. #endif
  318. static void tz1090_gpio_irq_handler(struct irq_desc *desc)
  319. {
  320. irq_hw_number_t hw;
  321. unsigned int irq_stat, irq_no;
  322. struct tz1090_gpio_bank *bank;
  323. struct irq_desc *child_desc;
  324. bank = (struct tz1090_gpio_bank *)irq_desc_get_handler_data(desc);
  325. irq_stat = tz1090_gpio_read(bank, REG_GPIO_DIR) &
  326. tz1090_gpio_read(bank, REG_GPIO_IRQ_STS) &
  327. tz1090_gpio_read(bank, REG_GPIO_IRQ_EN) &
  328. 0x3FFFFFFF; /* 30 bits only */
  329. for (hw = 0; irq_stat; irq_stat >>= 1, ++hw) {
  330. if (!(irq_stat & 1))
  331. continue;
  332. irq_no = irq_linear_revmap(bank->domain, hw);
  333. child_desc = irq_to_desc(irq_no);
  334. /* Toggle edge for pin with both edges triggering enabled */
  335. if (irqd_get_trigger_type(&child_desc->irq_data)
  336. == IRQ_TYPE_EDGE_BOTH)
  337. tz1090_gpio_irq_next_edge(bank, hw);
  338. generic_handle_irq_desc(child_desc);
  339. }
  340. }
  341. static int tz1090_gpio_bank_probe(struct tz1090_gpio_bank_info *info)
  342. {
  343. struct device_node *np = info->node;
  344. struct device *dev = info->priv->dev;
  345. struct tz1090_gpio_bank *bank;
  346. struct irq_chip_generic *gc;
  347. int err;
  348. bank = devm_kzalloc(dev, sizeof(*bank), GFP_KERNEL);
  349. if (!bank) {
  350. dev_err(dev, "unable to allocate driver data\n");
  351. return -ENOMEM;
  352. }
  353. /* Offset the main registers to the first register in this bank */
  354. bank->reg = info->priv->reg + info->index * 4;
  355. /* Set up GPIO chip */
  356. snprintf(bank->label, sizeof(bank->label), "tz1090-gpio-%u",
  357. info->index);
  358. bank->chip.label = bank->label;
  359. bank->chip.parent = dev;
  360. bank->chip.direction_input = tz1090_gpio_direction_input;
  361. bank->chip.direction_output = tz1090_gpio_direction_output;
  362. bank->chip.get = tz1090_gpio_get;
  363. bank->chip.set = tz1090_gpio_set;
  364. bank->chip.free = tz1090_gpio_free;
  365. bank->chip.request = tz1090_gpio_request;
  366. bank->chip.to_irq = tz1090_gpio_to_irq;
  367. bank->chip.of_node = np;
  368. /* GPIO numbering from 0 */
  369. bank->chip.base = info->index * 30;
  370. bank->chip.ngpio = 30;
  371. /* Add the GPIO bank */
  372. gpiochip_add_data(&bank->chip, bank);
  373. /* Get the GPIO bank IRQ if provided */
  374. bank->irq = irq_of_parse_and_map(np, 0);
  375. /* The interrupt is optional (it may be used by another core on chip) */
  376. if (!bank->irq) {
  377. dev_info(dev, "IRQ not provided for bank %u, IRQs disabled\n",
  378. info->index);
  379. return 0;
  380. }
  381. dev_info(dev, "Setting up IRQs for GPIO bank %u\n",
  382. info->index);
  383. /*
  384. * Initialise all interrupts to disabled so we don't get
  385. * spurious ones on a dirty boot and hit the BUG_ON in the
  386. * handler.
  387. */
  388. tz1090_gpio_write(bank, REG_GPIO_IRQ_EN, 0);
  389. /* Add a virtual IRQ for each GPIO */
  390. bank->domain = irq_domain_add_linear(np,
  391. bank->chip.ngpio,
  392. &irq_generic_chip_ops,
  393. bank);
  394. /* Set up a generic irq chip with 2 chip types (level and edge) */
  395. err = irq_alloc_domain_generic_chips(bank->domain, bank->chip.ngpio, 2,
  396. bank->label, handle_bad_irq, 0, 0,
  397. IRQ_GC_INIT_NESTED_LOCK);
  398. if (err) {
  399. dev_info(dev,
  400. "irq_alloc_domain_generic_chips failed for bank %u, IRQs disabled\n",
  401. info->index);
  402. irq_domain_remove(bank->domain);
  403. return 0;
  404. }
  405. gc = irq_get_domain_generic_chip(bank->domain, 0);
  406. gc->reg_base = bank->reg;
  407. /* level chip type */
  408. gc->chip_types[0].type = IRQ_TYPE_LEVEL_MASK;
  409. gc->chip_types[0].handler = handle_level_irq;
  410. gc->chip_types[0].regs.ack = REG_GPIO_IRQ_STS;
  411. gc->chip_types[0].regs.mask = REG_GPIO_IRQ_EN;
  412. gc->chip_types[0].chip.irq_startup = gpio_startup_irq;
  413. gc->chip_types[0].chip.irq_ack = irq_gc_ack_clr_bit;
  414. gc->chip_types[0].chip.irq_mask = irq_gc_mask_clr_bit;
  415. gc->chip_types[0].chip.irq_unmask = irq_gc_mask_set_bit;
  416. gc->chip_types[0].chip.irq_set_type = gpio_set_irq_type;
  417. gc->chip_types[0].chip.irq_set_wake = gpio_set_irq_wake;
  418. gc->chip_types[0].chip.flags = IRQCHIP_MASK_ON_SUSPEND;
  419. /* edge chip type */
  420. gc->chip_types[1].type = IRQ_TYPE_EDGE_BOTH;
  421. gc->chip_types[1].handler = handle_edge_irq;
  422. gc->chip_types[1].regs.ack = REG_GPIO_IRQ_STS;
  423. gc->chip_types[1].regs.mask = REG_GPIO_IRQ_EN;
  424. gc->chip_types[1].chip.irq_startup = gpio_startup_irq;
  425. gc->chip_types[1].chip.irq_ack = irq_gc_ack_clr_bit;
  426. gc->chip_types[1].chip.irq_mask = irq_gc_mask_clr_bit;
  427. gc->chip_types[1].chip.irq_unmask = irq_gc_mask_set_bit;
  428. gc->chip_types[1].chip.irq_set_type = gpio_set_irq_type;
  429. gc->chip_types[1].chip.irq_set_wake = gpio_set_irq_wake;
  430. gc->chip_types[1].chip.flags = IRQCHIP_MASK_ON_SUSPEND;
  431. /* Setup chained handler for this GPIO bank */
  432. irq_set_chained_handler_and_data(bank->irq, tz1090_gpio_irq_handler,
  433. bank);
  434. return 0;
  435. }
  436. static void tz1090_gpio_register_banks(struct tz1090_gpio *priv)
  437. {
  438. struct device_node *np = priv->dev->of_node;
  439. struct device_node *node;
  440. for_each_available_child_of_node(np, node) {
  441. struct tz1090_gpio_bank_info info;
  442. u32 addr;
  443. int ret;
  444. ret = of_property_read_u32(node, "reg", &addr);
  445. if (ret) {
  446. dev_err(priv->dev, "invalid reg on %s\n",
  447. node->full_name);
  448. continue;
  449. }
  450. if (addr >= 3) {
  451. dev_err(priv->dev, "index %u in %s out of range\n",
  452. addr, node->full_name);
  453. continue;
  454. }
  455. info.index = addr;
  456. info.node = of_node_get(node);
  457. info.priv = priv;
  458. ret = tz1090_gpio_bank_probe(&info);
  459. if (ret) {
  460. dev_err(priv->dev, "failure registering %s\n",
  461. node->full_name);
  462. of_node_put(node);
  463. continue;
  464. }
  465. }
  466. }
  467. static int tz1090_gpio_probe(struct platform_device *pdev)
  468. {
  469. struct device_node *np = pdev->dev.of_node;
  470. struct resource *res_regs;
  471. struct tz1090_gpio priv;
  472. if (!np) {
  473. dev_err(&pdev->dev, "must be instantiated via devicetree\n");
  474. return -ENOENT;
  475. }
  476. res_regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  477. if (!res_regs) {
  478. dev_err(&pdev->dev, "cannot find registers resource\n");
  479. return -ENOENT;
  480. }
  481. priv.dev = &pdev->dev;
  482. /* Ioremap the registers */
  483. priv.reg = devm_ioremap(&pdev->dev, res_regs->start,
  484. resource_size(res_regs));
  485. if (!priv.reg) {
  486. dev_err(&pdev->dev, "unable to ioremap registers\n");
  487. return -ENOMEM;
  488. }
  489. /* Look for banks */
  490. tz1090_gpio_register_banks(&priv);
  491. return 0;
  492. }
  493. static struct of_device_id tz1090_gpio_of_match[] = {
  494. { .compatible = "img,tz1090-gpio" },
  495. { },
  496. };
  497. static struct platform_driver tz1090_gpio_driver = {
  498. .driver = {
  499. .name = "tz1090-gpio",
  500. .of_match_table = tz1090_gpio_of_match,
  501. },
  502. .probe = tz1090_gpio_probe,
  503. };
  504. static int __init tz1090_gpio_init(void)
  505. {
  506. return platform_driver_register(&tz1090_gpio_driver);
  507. }
  508. subsys_initcall(tz1090_gpio_init);