1 /* SPDX-License-Identifier: GPL-2.0 */ 2 3 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved. 4 * Copyright (C) 2018-2024 Linaro Ltd. 5 */ 6 #ifndef _IPA_INTERRUPT_H_ 7 #define _IPA_INTERRUPT_H_ 8 9 #include <linux/types.h> 10 11 struct platform_device; 12 13 struct ipa; 14 struct ipa_interrupt; 15 enum ipa_irq_id; 16 17 /** 18 * ipa_interrupt_suspend_enable - Enable TX_SUSPEND for an endpoint 19 * @interrupt: IPA interrupt structure 20 * @endpoint_id: Endpoint whose interrupt should be enabled 21 * 22 * Note: The "TX" in the name is from the perspective of the IPA hardware. 23 * A TX_SUSPEND interrupt arrives on an AP RX enpoint when packet data can't 24 * be delivered to the endpoint because it is suspended (or its underlying 25 * channel is stopped). 26 */ 27 void ipa_interrupt_suspend_enable(struct ipa_interrupt *interrupt, 28 u32 endpoint_id); 29 30 /** 31 * ipa_interrupt_suspend_disable - Disable TX_SUSPEND for an endpoint 32 * @interrupt: IPA interrupt structure 33 * @endpoint_id: Endpoint whose interrupt should be disabled 34 */ 35 void ipa_interrupt_suspend_disable(struct ipa_interrupt *interrupt, 36 u32 endpoint_id); 37 38 /** 39 * ipa_interrupt_simulate_suspend() - Simulate TX_SUSPEND IPA interrupt 40 * @interrupt: IPA interrupt structure 41 * 42 * This calls the TX_SUSPEND interrupt handler, as if such an interrupt 43 * had been signaled. This is needed to work around a hardware quirk 44 * that occurs if aggregation is active on an endpoint when its underlying 45 * channel is suspended. 46 */ 47 void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt); 48 49 /** 50 * ipa_interrupt_enable() - Enable an IPA interrupt type 51 * @ipa: IPA pointer 52 * @ipa_irq: IPA interrupt ID 53 */ 54 void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq); 55 56 /** 57 * ipa_interrupt_disable() - Disable an IPA interrupt type 58 * @ipa: IPA pointer 59 * @ipa_irq: IPA interrupt ID 60 */ 61 void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq); 62 63 /** 64 * ipa_interrupt_irq_enable() - Enable IPA interrupts 65 * @ipa: IPA pointer 66 * 67 * This enables the IPA interrupt line 68 */ 69 void ipa_interrupt_irq_enable(struct ipa *ipa); 70 71 /** 72 * ipa_interrupt_irq_disable() - Disable IPA interrupts 73 * @ipa: IPA pointer 74 * 75 * This disables the IPA interrupt line 76 */ 77 void ipa_interrupt_irq_disable(struct ipa *ipa); 78 79 /** 80 * ipa_interrupt_config() - Configure IPA interrupts 81 * @ipa: IPA pointer 82 * 83 * Return: 0 if successful, or a negative error code 84 */ 85 int ipa_interrupt_config(struct ipa *ipa); 86 87 /** 88 * ipa_interrupt_deconfig() - Inverse of ipa_interrupt_config() 89 * @ipa: IPA pointer 90 */ 91 void ipa_interrupt_deconfig(struct ipa *ipa); 92 93 /** 94 * ipa_interrupt_init() - Initialize the IPA interrupt structure 95 * @pdev: IPA platform device pointer 96 * 97 * Return: Pointer to an IPA interrupt structure, or a pointer-coded error 98 */ 99 struct ipa_interrupt *ipa_interrupt_init(struct platform_device *pdev); 100 101 /** 102 * ipa_interrupt_exit() - Inverse of ipa_interrupt_init() 103 * @interrupt: IPA interrupt structure 104 */ 105 void ipa_interrupt_exit(struct ipa_interrupt *interrupt); 106 107 #endif /* _IPA_INTERRUPT_H_ */ 108