Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 
0003 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
0004  * Copyright (C) 2018-2020 Linaro Ltd.
0005  */
0006 #ifndef _IPA_INTERRUPT_H_
0007 #define _IPA_INTERRUPT_H_
0008 
0009 #include <linux/types.h>
0010 #include <linux/bits.h>
0011 
0012 struct ipa;
0013 struct ipa_interrupt;
0014 
0015 /**
0016  * typedef ipa_irq_handler_t - IPA interrupt handler function type
0017  * @ipa:    IPA pointer
0018  * @irq_id: interrupt type
0019  *
0020  * Callback function registered by ipa_interrupt_add() to handle a specific
0021  * IPA interrupt type
0022  */
0023 typedef void (*ipa_irq_handler_t)(struct ipa *ipa, enum ipa_irq_id irq_id);
0024 
0025 /**
0026  * ipa_interrupt_add() - Register a handler for an IPA interrupt type
0027  * @interrupt:  IPA interrupt structure
0028  * @irq_id: IPA interrupt type
0029  * @handler:    Handler function for the interrupt
0030  *
0031  * Add a handler for an IPA interrupt and enable it.  IPA interrupt
0032  * handlers are run in threaded interrupt context, so are allowed to
0033  * block.
0034  */
0035 void ipa_interrupt_add(struct ipa_interrupt *interrupt, enum ipa_irq_id irq_id,
0036                ipa_irq_handler_t handler);
0037 
0038 /**
0039  * ipa_interrupt_remove() - Remove the handler for an IPA interrupt type
0040  * @interrupt:  IPA interrupt structure
0041  * @irq_id: IPA interrupt type
0042  *
0043  * Remove an IPA interrupt handler and disable it.
0044  */
0045 void ipa_interrupt_remove(struct ipa_interrupt *interrupt,
0046               enum ipa_irq_id irq_id);
0047 
0048 /**
0049  * ipa_interrupt_suspend_enable - Enable TX_SUSPEND for an endpoint
0050  * @interrupt:      IPA interrupt structure
0051  * @endpoint_id:    Endpoint whose interrupt should be enabled
0052  *
0053  * Note:  The "TX" in the name is from the perspective of the IPA hardware.
0054  * A TX_SUSPEND interrupt arrives on an AP RX enpoint when packet data can't
0055  * be delivered to the endpoint because it is suspended (or its underlying
0056  * channel is stopped).
0057  */
0058 void ipa_interrupt_suspend_enable(struct ipa_interrupt *interrupt,
0059                   u32 endpoint_id);
0060 
0061 /**
0062  * ipa_interrupt_suspend_disable - Disable TX_SUSPEND for an endpoint
0063  * @interrupt:      IPA interrupt structure
0064  * @endpoint_id:    Endpoint whose interrupt should be disabled
0065  */
0066 void ipa_interrupt_suspend_disable(struct ipa_interrupt *interrupt,
0067                    u32 endpoint_id);
0068 
0069 /**
0070  * ipa_interrupt_suspend_clear_all - clear all suspend interrupts
0071  * @interrupt:  IPA interrupt structure
0072  *
0073  * Clear the TX_SUSPEND interrupt for all endpoints that signaled it.
0074  */
0075 void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt);
0076 
0077 /**
0078  * ipa_interrupt_simulate_suspend() - Simulate TX_SUSPEND IPA interrupt
0079  * @interrupt:  IPA interrupt structure
0080  *
0081  * This calls the TX_SUSPEND interrupt handler, as if such an interrupt
0082  * had been signaled.  This is needed to work around a hardware quirk
0083  * that occurs if aggregation is active on an endpoint when its underlying
0084  * channel is suspended.
0085  */
0086 void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt);
0087 
0088 /**
0089  * ipa_interrupt_config() - Configure the IPA interrupt framework
0090  * @ipa:    IPA pointer
0091  *
0092  * Return:  Pointer to IPA SMP2P info, or a pointer-coded error
0093  */
0094 struct ipa_interrupt *ipa_interrupt_config(struct ipa *ipa);
0095 
0096 /**
0097  * ipa_interrupt_deconfig() - Inverse of ipa_interrupt_config()
0098  * @interrupt:  IPA interrupt structure
0099  */
0100 void ipa_interrupt_deconfig(struct ipa_interrupt *interrupt);
0101 
0102 #endif /* _IPA_INTERRUPT_H_ */