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