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