ipa_interrupt.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
  3. * Copyright (C) 2018-2022 Linaro Ltd.
  4. */
  5. #ifndef _IPA_INTERRUPT_H_
  6. #define _IPA_INTERRUPT_H_
  7. #include <linux/types.h>
  8. #include <linux/bits.h>
  9. struct ipa;
  10. struct ipa_interrupt;
  11. /**
  12. * typedef ipa_irq_handler_t - IPA interrupt handler function type
  13. * @ipa: IPA pointer
  14. * @irq_id: interrupt type
  15. *
  16. * Callback function registered by ipa_interrupt_add() to handle a specific
  17. * IPA interrupt type
  18. */
  19. typedef void (*ipa_irq_handler_t)(struct ipa *ipa, enum ipa_irq_id irq_id);
  20. /**
  21. * ipa_interrupt_add() - Register a handler for an IPA interrupt type
  22. * @interrupt: IPA interrupt structure
  23. * @irq_id: IPA interrupt type
  24. * @handler: Handler function for the interrupt
  25. *
  26. * Add a handler for an IPA interrupt and enable it. IPA interrupt
  27. * handlers are run in threaded interrupt context, so are allowed to
  28. * block.
  29. */
  30. void ipa_interrupt_add(struct ipa_interrupt *interrupt, enum ipa_irq_id irq_id,
  31. ipa_irq_handler_t handler);
  32. /**
  33. * ipa_interrupt_remove() - Remove the handler for an IPA interrupt type
  34. * @interrupt: IPA interrupt structure
  35. * @irq_id: IPA interrupt type
  36. *
  37. * Remove an IPA interrupt handler and disable it.
  38. */
  39. void ipa_interrupt_remove(struct ipa_interrupt *interrupt,
  40. enum ipa_irq_id irq_id);
  41. /**
  42. * ipa_interrupt_suspend_enable - Enable TX_SUSPEND for an endpoint
  43. * @interrupt: IPA interrupt structure
  44. * @endpoint_id: Endpoint whose interrupt should be enabled
  45. *
  46. * Note: The "TX" in the name is from the perspective of the IPA hardware.
  47. * A TX_SUSPEND interrupt arrives on an AP RX enpoint when packet data can't
  48. * be delivered to the endpoint because it is suspended (or its underlying
  49. * channel is stopped).
  50. */
  51. void ipa_interrupt_suspend_enable(struct ipa_interrupt *interrupt,
  52. u32 endpoint_id);
  53. /**
  54. * ipa_interrupt_suspend_disable - Disable TX_SUSPEND for an endpoint
  55. * @interrupt: IPA interrupt structure
  56. * @endpoint_id: Endpoint whose interrupt should be disabled
  57. */
  58. void ipa_interrupt_suspend_disable(struct ipa_interrupt *interrupt,
  59. u32 endpoint_id);
  60. /**
  61. * ipa_interrupt_suspend_clear_all - clear all suspend interrupts
  62. * @interrupt: IPA interrupt structure
  63. *
  64. * Clear the TX_SUSPEND interrupt for all endpoints that signaled it.
  65. */
  66. void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt);
  67. /**
  68. * ipa_interrupt_simulate_suspend() - Simulate TX_SUSPEND IPA interrupt
  69. * @interrupt: IPA interrupt structure
  70. *
  71. * This calls the TX_SUSPEND interrupt handler, as if such an interrupt
  72. * had been signaled. This is needed to work around a hardware quirk
  73. * that occurs if aggregation is active on an endpoint when its underlying
  74. * channel is suspended.
  75. */
  76. void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt);
  77. /**
  78. * ipa_interrupt_irq_enable() - Enable IPA interrupts
  79. * @ipa: IPA pointer
  80. *
  81. * This enables the IPA interrupt line
  82. */
  83. void ipa_interrupt_irq_enable(struct ipa *ipa);
  84. /**
  85. * ipa_interrupt_irq_disable() - Disable IPA interrupts
  86. * @ipa: IPA pointer
  87. *
  88. * This disables the IPA interrupt line
  89. */
  90. void ipa_interrupt_irq_disable(struct ipa *ipa);
  91. /**
  92. * ipa_interrupt_config() - Configure the IPA interrupt framework
  93. * @ipa: IPA pointer
  94. *
  95. * Return: Pointer to IPA SMP2P info, or a pointer-coded error
  96. */
  97. struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa);
  98. /**
  99. * ipa_interrupt_deconfig() - Inverse of ipa_interrupt_config()
  100. * @interrupt: IPA interrupt structure
  101. */
  102. void ipa_interrupt_deconfig(struct ipa_interrupt *interrupt);
  103. #endif /* _IPA_INTERRUPT_H_ */