generic-chip.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /*
  2. * Library implementing the most common irq chip callback functions
  3. *
  4. * Copyright (C) 2011, Thomas Gleixner
  5. */
  6. #include <linux/io.h>
  7. #include <linux/irq.h>
  8. #include <linux/slab.h>
  9. #include <linux/export.h>
  10. #include <linux/irqdomain.h>
  11. #include <linux/interrupt.h>
  12. #include <linux/kernel_stat.h>
  13. #include <linux/syscore_ops.h>
  14. #include "internals.h"
  15. static LIST_HEAD(gc_list);
  16. static DEFINE_RAW_SPINLOCK(gc_lock);
  17. /**
  18. * irq_gc_noop - NOOP function
  19. * @d: irq_data
  20. */
  21. void irq_gc_noop(struct irq_data *d)
  22. {
  23. }
  24. /**
  25. * irq_gc_mask_disable_reg - Mask chip via disable register
  26. * @d: irq_data
  27. *
  28. * Chip has separate enable/disable registers instead of a single mask
  29. * register.
  30. */
  31. void irq_gc_mask_disable_reg(struct irq_data *d)
  32. {
  33. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  34. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  35. u32 mask = d->mask;
  36. irq_gc_lock(gc);
  37. irq_reg_writel(gc, mask, ct->regs.disable);
  38. *ct->mask_cache &= ~mask;
  39. irq_gc_unlock(gc);
  40. }
  41. /**
  42. * irq_gc_mask_set_bit - Mask chip via setting bit in mask register
  43. * @d: irq_data
  44. *
  45. * Chip has a single mask register. Values of this register are cached
  46. * and protected by gc->lock
  47. */
  48. void irq_gc_mask_set_bit(struct irq_data *d)
  49. {
  50. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  51. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  52. u32 mask = d->mask;
  53. irq_gc_lock(gc);
  54. *ct->mask_cache |= mask;
  55. irq_reg_writel(gc, *ct->mask_cache, ct->regs.mask);
  56. irq_gc_unlock(gc);
  57. }
  58. EXPORT_SYMBOL_GPL(irq_gc_mask_set_bit);
  59. /**
  60. * irq_gc_mask_clr_bit - Mask chip via clearing bit in mask register
  61. * @d: irq_data
  62. *
  63. * Chip has a single mask register. Values of this register are cached
  64. * and protected by gc->lock
  65. */
  66. void irq_gc_mask_clr_bit(struct irq_data *d)
  67. {
  68. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  69. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  70. u32 mask = d->mask;
  71. irq_gc_lock(gc);
  72. *ct->mask_cache &= ~mask;
  73. irq_reg_writel(gc, *ct->mask_cache, ct->regs.mask);
  74. irq_gc_unlock(gc);
  75. }
  76. EXPORT_SYMBOL_GPL(irq_gc_mask_clr_bit);
  77. /**
  78. * irq_gc_unmask_enable_reg - Unmask chip via enable register
  79. * @d: irq_data
  80. *
  81. * Chip has separate enable/disable registers instead of a single mask
  82. * register.
  83. */
  84. void irq_gc_unmask_enable_reg(struct irq_data *d)
  85. {
  86. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  87. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  88. u32 mask = d->mask;
  89. irq_gc_lock(gc);
  90. irq_reg_writel(gc, mask, ct->regs.enable);
  91. *ct->mask_cache |= mask;
  92. irq_gc_unlock(gc);
  93. }
  94. /**
  95. * irq_gc_ack_set_bit - Ack pending interrupt via setting bit
  96. * @d: irq_data
  97. */
  98. void irq_gc_ack_set_bit(struct irq_data *d)
  99. {
  100. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  101. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  102. u32 mask = d->mask;
  103. irq_gc_lock(gc);
  104. irq_reg_writel(gc, mask, ct->regs.ack);
  105. irq_gc_unlock(gc);
  106. }
  107. EXPORT_SYMBOL_GPL(irq_gc_ack_set_bit);
  108. /**
  109. * irq_gc_ack_clr_bit - Ack pending interrupt via clearing bit
  110. * @d: irq_data
  111. */
  112. void irq_gc_ack_clr_bit(struct irq_data *d)
  113. {
  114. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  115. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  116. u32 mask = ~d->mask;
  117. irq_gc_lock(gc);
  118. irq_reg_writel(gc, mask, ct->regs.ack);
  119. irq_gc_unlock(gc);
  120. }
  121. /**
  122. * irq_gc_mask_disable_reg_and_ack - Mask and ack pending interrupt
  123. * @d: irq_data
  124. */
  125. void irq_gc_mask_disable_reg_and_ack(struct irq_data *d)
  126. {
  127. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  128. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  129. u32 mask = d->mask;
  130. irq_gc_lock(gc);
  131. irq_reg_writel(gc, mask, ct->regs.mask);
  132. irq_reg_writel(gc, mask, ct->regs.ack);
  133. irq_gc_unlock(gc);
  134. }
  135. /**
  136. * irq_gc_eoi - EOI interrupt
  137. * @d: irq_data
  138. */
  139. void irq_gc_eoi(struct irq_data *d)
  140. {
  141. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  142. struct irq_chip_type *ct = irq_data_get_chip_type(d);
  143. u32 mask = d->mask;
  144. irq_gc_lock(gc);
  145. irq_reg_writel(gc, mask, ct->regs.eoi);
  146. irq_gc_unlock(gc);
  147. }
  148. /**
  149. * irq_gc_set_wake - Set/clr wake bit for an interrupt
  150. * @d: irq_data
  151. * @on: Indicates whether the wake bit should be set or cleared
  152. *
  153. * For chips where the wake from suspend functionality is not
  154. * configured in a separate register and the wakeup active state is
  155. * just stored in a bitmask.
  156. */
  157. int irq_gc_set_wake(struct irq_data *d, unsigned int on)
  158. {
  159. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  160. u32 mask = d->mask;
  161. if (!(mask & gc->wake_enabled))
  162. return -EINVAL;
  163. irq_gc_lock(gc);
  164. if (on)
  165. gc->wake_active |= mask;
  166. else
  167. gc->wake_active &= ~mask;
  168. irq_gc_unlock(gc);
  169. return 0;
  170. }
  171. static u32 irq_readl_be(void __iomem *addr)
  172. {
  173. return ioread32be(addr);
  174. }
  175. static void irq_writel_be(u32 val, void __iomem *addr)
  176. {
  177. iowrite32be(val, addr);
  178. }
  179. static void
  180. irq_init_generic_chip(struct irq_chip_generic *gc, const char *name,
  181. int num_ct, unsigned int irq_base,
  182. void __iomem *reg_base, irq_flow_handler_t handler)
  183. {
  184. raw_spin_lock_init(&gc->lock);
  185. gc->num_ct = num_ct;
  186. gc->irq_base = irq_base;
  187. gc->reg_base = reg_base;
  188. gc->chip_types->chip.name = name;
  189. gc->chip_types->handler = handler;
  190. }
  191. /**
  192. * irq_alloc_generic_chip - Allocate a generic chip and initialize it
  193. * @name: Name of the irq chip
  194. * @num_ct: Number of irq_chip_type instances associated with this
  195. * @irq_base: Interrupt base nr for this chip
  196. * @reg_base: Register base address (virtual)
  197. * @handler: Default flow handler associated with this chip
  198. *
  199. * Returns an initialized irq_chip_generic structure. The chip defaults
  200. * to the primary (index 0) irq_chip_type and @handler
  201. */
  202. struct irq_chip_generic *
  203. irq_alloc_generic_chip(const char *name, int num_ct, unsigned int irq_base,
  204. void __iomem *reg_base, irq_flow_handler_t handler)
  205. {
  206. struct irq_chip_generic *gc;
  207. unsigned long sz = sizeof(*gc) + num_ct * sizeof(struct irq_chip_type);
  208. gc = kzalloc(sz, GFP_KERNEL);
  209. if (gc) {
  210. irq_init_generic_chip(gc, name, num_ct, irq_base, reg_base,
  211. handler);
  212. }
  213. return gc;
  214. }
  215. EXPORT_SYMBOL_GPL(irq_alloc_generic_chip);
  216. static void
  217. irq_gc_init_mask_cache(struct irq_chip_generic *gc, enum irq_gc_flags flags)
  218. {
  219. struct irq_chip_type *ct = gc->chip_types;
  220. u32 *mskptr = &gc->mask_cache, mskreg = ct->regs.mask;
  221. int i;
  222. for (i = 0; i < gc->num_ct; i++) {
  223. if (flags & IRQ_GC_MASK_CACHE_PER_TYPE) {
  224. mskptr = &ct[i].mask_cache_priv;
  225. mskreg = ct[i].regs.mask;
  226. }
  227. ct[i].mask_cache = mskptr;
  228. if (flags & IRQ_GC_INIT_MASK_CACHE)
  229. *mskptr = irq_reg_readl(gc, mskreg);
  230. }
  231. }
  232. /**
  233. * __irq_alloc_domain_generic_chip - Allocate generic chips for an irq domain
  234. * @d: irq domain for which to allocate chips
  235. * @irqs_per_chip: Number of interrupts each chip handles (max 32)
  236. * @num_ct: Number of irq_chip_type instances associated with this
  237. * @name: Name of the irq chip
  238. * @handler: Default flow handler associated with these chips
  239. * @clr: IRQ_* bits to clear in the mapping function
  240. * @set: IRQ_* bits to set in the mapping function
  241. * @gcflags: Generic chip specific setup flags
  242. */
  243. int __irq_alloc_domain_generic_chips(struct irq_domain *d, int irqs_per_chip,
  244. int num_ct, const char *name,
  245. irq_flow_handler_t handler,
  246. unsigned int clr, unsigned int set,
  247. enum irq_gc_flags gcflags)
  248. {
  249. struct irq_domain_chip_generic *dgc;
  250. struct irq_chip_generic *gc;
  251. int numchips, sz, i;
  252. unsigned long flags;
  253. void *tmp;
  254. if (d->gc)
  255. return -EBUSY;
  256. numchips = DIV_ROUND_UP(d->revmap_size, irqs_per_chip);
  257. if (!numchips)
  258. return -EINVAL;
  259. /* Allocate a pointer, generic chip and chiptypes for each chip */
  260. sz = sizeof(*dgc) + numchips * sizeof(gc);
  261. sz += numchips * (sizeof(*gc) + num_ct * sizeof(struct irq_chip_type));
  262. tmp = dgc = kzalloc(sz, GFP_KERNEL);
  263. if (!dgc)
  264. return -ENOMEM;
  265. dgc->irqs_per_chip = irqs_per_chip;
  266. dgc->num_chips = numchips;
  267. dgc->irq_flags_to_set = set;
  268. dgc->irq_flags_to_clear = clr;
  269. dgc->gc_flags = gcflags;
  270. d->gc = dgc;
  271. /* Calc pointer to the first generic chip */
  272. tmp += sizeof(*dgc) + numchips * sizeof(gc);
  273. for (i = 0; i < numchips; i++) {
  274. /* Store the pointer to the generic chip */
  275. dgc->gc[i] = gc = tmp;
  276. irq_init_generic_chip(gc, name, num_ct, i * irqs_per_chip,
  277. NULL, handler);
  278. gc->domain = d;
  279. if (gcflags & IRQ_GC_BE_IO) {
  280. gc->reg_readl = &irq_readl_be;
  281. gc->reg_writel = &irq_writel_be;
  282. }
  283. raw_spin_lock_irqsave(&gc_lock, flags);
  284. list_add_tail(&gc->list, &gc_list);
  285. raw_spin_unlock_irqrestore(&gc_lock, flags);
  286. /* Calc pointer to the next generic chip */
  287. tmp += sizeof(*gc) + num_ct * sizeof(struct irq_chip_type);
  288. }
  289. d->name = name;
  290. return 0;
  291. }
  292. EXPORT_SYMBOL_GPL(__irq_alloc_domain_generic_chips);
  293. static struct irq_chip_generic *
  294. __irq_get_domain_generic_chip(struct irq_domain *d, unsigned int hw_irq)
  295. {
  296. struct irq_domain_chip_generic *dgc = d->gc;
  297. int idx;
  298. if (!dgc)
  299. return ERR_PTR(-ENODEV);
  300. idx = hw_irq / dgc->irqs_per_chip;
  301. if (idx >= dgc->num_chips)
  302. return ERR_PTR(-EINVAL);
  303. return dgc->gc[idx];
  304. }
  305. /**
  306. * irq_get_domain_generic_chip - Get a pointer to the generic chip of a hw_irq
  307. * @d: irq domain pointer
  308. * @hw_irq: Hardware interrupt number
  309. */
  310. struct irq_chip_generic *
  311. irq_get_domain_generic_chip(struct irq_domain *d, unsigned int hw_irq)
  312. {
  313. struct irq_chip_generic *gc = __irq_get_domain_generic_chip(d, hw_irq);
  314. return !IS_ERR(gc) ? gc : NULL;
  315. }
  316. EXPORT_SYMBOL_GPL(irq_get_domain_generic_chip);
  317. /*
  318. * Separate lockdep class for interrupt chip which can nest irq_desc
  319. * lock.
  320. */
  321. static struct lock_class_key irq_nested_lock_class;
  322. /*
  323. * irq_map_generic_chip - Map a generic chip for an irq domain
  324. */
  325. int irq_map_generic_chip(struct irq_domain *d, unsigned int virq,
  326. irq_hw_number_t hw_irq)
  327. {
  328. struct irq_data *data = irq_domain_get_irq_data(d, virq);
  329. struct irq_domain_chip_generic *dgc = d->gc;
  330. struct irq_chip_generic *gc;
  331. struct irq_chip_type *ct;
  332. struct irq_chip *chip;
  333. unsigned long flags;
  334. int idx;
  335. gc = __irq_get_domain_generic_chip(d, hw_irq);
  336. if (IS_ERR(gc))
  337. return PTR_ERR(gc);
  338. idx = hw_irq % dgc->irqs_per_chip;
  339. if (test_bit(idx, &gc->unused))
  340. return -ENOTSUPP;
  341. if (test_bit(idx, &gc->installed))
  342. return -EBUSY;
  343. ct = gc->chip_types;
  344. chip = &ct->chip;
  345. /* We only init the cache for the first mapping of a generic chip */
  346. if (!gc->installed) {
  347. raw_spin_lock_irqsave(&gc->lock, flags);
  348. irq_gc_init_mask_cache(gc, dgc->gc_flags);
  349. raw_spin_unlock_irqrestore(&gc->lock, flags);
  350. }
  351. /* Mark the interrupt as installed */
  352. set_bit(idx, &gc->installed);
  353. if (dgc->gc_flags & IRQ_GC_INIT_NESTED_LOCK)
  354. irq_set_lockdep_class(virq, &irq_nested_lock_class);
  355. if (chip->irq_calc_mask)
  356. chip->irq_calc_mask(data);
  357. else
  358. data->mask = 1 << idx;
  359. irq_domain_set_info(d, virq, hw_irq, chip, gc, ct->handler, NULL, NULL);
  360. irq_modify_status(virq, dgc->irq_flags_to_clear, dgc->irq_flags_to_set);
  361. return 0;
  362. }
  363. static void irq_unmap_generic_chip(struct irq_domain *d, unsigned int virq)
  364. {
  365. struct irq_data *data = irq_domain_get_irq_data(d, virq);
  366. struct irq_domain_chip_generic *dgc = d->gc;
  367. unsigned int hw_irq = data->hwirq;
  368. struct irq_chip_generic *gc;
  369. int irq_idx;
  370. gc = irq_get_domain_generic_chip(d, hw_irq);
  371. if (!gc)
  372. return;
  373. irq_idx = hw_irq % dgc->irqs_per_chip;
  374. clear_bit(irq_idx, &gc->installed);
  375. irq_domain_set_info(d, virq, hw_irq, &no_irq_chip, NULL, NULL, NULL,
  376. NULL);
  377. }
  378. struct irq_domain_ops irq_generic_chip_ops = {
  379. .map = irq_map_generic_chip,
  380. .unmap = irq_unmap_generic_chip,
  381. .xlate = irq_domain_xlate_onetwocell,
  382. };
  383. EXPORT_SYMBOL_GPL(irq_generic_chip_ops);
  384. /**
  385. * irq_setup_generic_chip - Setup a range of interrupts with a generic chip
  386. * @gc: Generic irq chip holding all data
  387. * @msk: Bitmask holding the irqs to initialize relative to gc->irq_base
  388. * @flags: Flags for initialization
  389. * @clr: IRQ_* bits to clear
  390. * @set: IRQ_* bits to set
  391. *
  392. * Set up max. 32 interrupts starting from gc->irq_base. Note, this
  393. * initializes all interrupts to the primary irq_chip_type and its
  394. * associated handler.
  395. */
  396. void irq_setup_generic_chip(struct irq_chip_generic *gc, u32 msk,
  397. enum irq_gc_flags flags, unsigned int clr,
  398. unsigned int set)
  399. {
  400. struct irq_chip_type *ct = gc->chip_types;
  401. struct irq_chip *chip = &ct->chip;
  402. unsigned int i;
  403. raw_spin_lock(&gc_lock);
  404. list_add_tail(&gc->list, &gc_list);
  405. raw_spin_unlock(&gc_lock);
  406. irq_gc_init_mask_cache(gc, flags);
  407. for (i = gc->irq_base; msk; msk >>= 1, i++) {
  408. if (!(msk & 0x01))
  409. continue;
  410. if (flags & IRQ_GC_INIT_NESTED_LOCK)
  411. irq_set_lockdep_class(i, &irq_nested_lock_class);
  412. if (!(flags & IRQ_GC_NO_MASK)) {
  413. struct irq_data *d = irq_get_irq_data(i);
  414. if (chip->irq_calc_mask)
  415. chip->irq_calc_mask(d);
  416. else
  417. d->mask = 1 << (i - gc->irq_base);
  418. }
  419. irq_set_chip_and_handler(i, chip, ct->handler);
  420. irq_set_chip_data(i, gc);
  421. irq_modify_status(i, clr, set);
  422. }
  423. gc->irq_cnt = i - gc->irq_base;
  424. }
  425. EXPORT_SYMBOL_GPL(irq_setup_generic_chip);
  426. /**
  427. * irq_setup_alt_chip - Switch to alternative chip
  428. * @d: irq_data for this interrupt
  429. * @type: Flow type to be initialized
  430. *
  431. * Only to be called from chip->irq_set_type() callbacks.
  432. */
  433. int irq_setup_alt_chip(struct irq_data *d, unsigned int type)
  434. {
  435. struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
  436. struct irq_chip_type *ct = gc->chip_types;
  437. unsigned int i;
  438. for (i = 0; i < gc->num_ct; i++, ct++) {
  439. if (ct->type & type) {
  440. d->chip = &ct->chip;
  441. irq_data_to_desc(d)->handle_irq = ct->handler;
  442. return 0;
  443. }
  444. }
  445. return -EINVAL;
  446. }
  447. EXPORT_SYMBOL_GPL(irq_setup_alt_chip);
  448. /**
  449. * irq_remove_generic_chip - Remove a chip
  450. * @gc: Generic irq chip holding all data
  451. * @msk: Bitmask holding the irqs to initialize relative to gc->irq_base
  452. * @clr: IRQ_* bits to clear
  453. * @set: IRQ_* bits to set
  454. *
  455. * Remove up to 32 interrupts starting from gc->irq_base.
  456. */
  457. void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk,
  458. unsigned int clr, unsigned int set)
  459. {
  460. unsigned int i = gc->irq_base;
  461. raw_spin_lock(&gc_lock);
  462. list_del(&gc->list);
  463. raw_spin_unlock(&gc_lock);
  464. for (; msk; msk >>= 1, i++) {
  465. if (!(msk & 0x01))
  466. continue;
  467. /* Remove handler first. That will mask the irq line */
  468. irq_set_handler(i, NULL);
  469. irq_set_chip(i, &no_irq_chip);
  470. irq_set_chip_data(i, NULL);
  471. irq_modify_status(i, clr, set);
  472. }
  473. }
  474. EXPORT_SYMBOL_GPL(irq_remove_generic_chip);
  475. static struct irq_data *irq_gc_get_irq_data(struct irq_chip_generic *gc)
  476. {
  477. unsigned int virq;
  478. if (!gc->domain)
  479. return irq_get_irq_data(gc->irq_base);
  480. /*
  481. * We don't know which of the irqs has been actually
  482. * installed. Use the first one.
  483. */
  484. if (!gc->installed)
  485. return NULL;
  486. virq = irq_find_mapping(gc->domain, gc->irq_base + __ffs(gc->installed));
  487. return virq ? irq_get_irq_data(virq) : NULL;
  488. }
  489. #ifdef CONFIG_PM
  490. static int irq_gc_suspend(void)
  491. {
  492. struct irq_chip_generic *gc;
  493. list_for_each_entry(gc, &gc_list, list) {
  494. struct irq_chip_type *ct = gc->chip_types;
  495. if (ct->chip.irq_suspend) {
  496. struct irq_data *data = irq_gc_get_irq_data(gc);
  497. if (data)
  498. ct->chip.irq_suspend(data);
  499. }
  500. if (gc->suspend)
  501. gc->suspend(gc);
  502. }
  503. return 0;
  504. }
  505. static void irq_gc_resume(void)
  506. {
  507. struct irq_chip_generic *gc;
  508. list_for_each_entry(gc, &gc_list, list) {
  509. struct irq_chip_type *ct = gc->chip_types;
  510. if (gc->resume)
  511. gc->resume(gc);
  512. if (ct->chip.irq_resume) {
  513. struct irq_data *data = irq_gc_get_irq_data(gc);
  514. if (data)
  515. ct->chip.irq_resume(data);
  516. }
  517. }
  518. }
  519. #else
  520. #define irq_gc_suspend NULL
  521. #define irq_gc_resume NULL
  522. #endif
  523. static void irq_gc_shutdown(void)
  524. {
  525. struct irq_chip_generic *gc;
  526. list_for_each_entry(gc, &gc_list, list) {
  527. struct irq_chip_type *ct = gc->chip_types;
  528. if (ct->chip.irq_pm_shutdown) {
  529. struct irq_data *data = irq_gc_get_irq_data(gc);
  530. if (data)
  531. ct->chip.irq_pm_shutdown(data);
  532. }
  533. }
  534. }
  535. static struct syscore_ops irq_gc_syscore_ops = {
  536. .suspend = irq_gc_suspend,
  537. .resume = irq_gc_resume,
  538. .shutdown = irq_gc_shutdown,
  539. };
  540. static int __init irq_gc_init_ops(void)
  541. {
  542. register_syscore_ops(&irq_gc_syscore_ops);
  543. return 0;
  544. }
  545. device_initcall(irq_gc_init_ops);