mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	net: ipa: enable IPA interrupt handlers separate from registration
Expose ipa_interrupt_enable() and have functions that register IPA interrupt handlers enable them directly, rather than having the registration process do that. Do the same for disabling IPA interrupt handlers. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
		
							parent
							
								
									8e461e1f09
								
							
						
					
					
						commit
						d50ed35587
					
				
					 4 changed files with 26 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -135,7 +135,7 @@ static void ipa_interrupt_enabled_update(struct ipa *ipa)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* Enable an IPA interrupt type */
 | 
			
		||||
static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
 | 
			
		||||
void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
 | 
			
		||||
{
 | 
			
		||||
	/* Update the IPA interrupt mask to enable it */
 | 
			
		||||
	ipa->interrupt->enabled |= BIT(ipa_irq);
 | 
			
		||||
| 
						 | 
				
			
			@ -143,7 +143,7 @@ static void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
/* Disable an IPA interrupt type */
 | 
			
		||||
static void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
 | 
			
		||||
void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq)
 | 
			
		||||
{
 | 
			
		||||
	/* Update the IPA interrupt mask to disable it */
 | 
			
		||||
	ipa->interrupt->enabled &= ~BIT(ipa_irq);
 | 
			
		||||
| 
						 | 
				
			
			@ -231,8 +231,6 @@ void ipa_interrupt_add(struct ipa_interrupt *interrupt,
 | 
			
		|||
		return;
 | 
			
		||||
 | 
			
		||||
	interrupt->handler[ipa_irq] = handler;
 | 
			
		||||
 | 
			
		||||
	ipa_interrupt_enable(interrupt->ipa, ipa_irq);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Remove the handler for an IPA interrupt type */
 | 
			
		||||
| 
						 | 
				
			
			@ -242,8 +240,6 @@ ipa_interrupt_remove(struct ipa_interrupt *interrupt, enum ipa_irq_id ipa_irq)
 | 
			
		|||
	if (WARN_ON(ipa_irq >= IPA_IRQ_COUNT))
 | 
			
		||||
		return;
 | 
			
		||||
 | 
			
		||||
	ipa_interrupt_disable(interrupt->ipa, ipa_irq);
 | 
			
		||||
 | 
			
		||||
	interrupt->handler[ipa_irq] = NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,6 +11,7 @@
 | 
			
		|||
 | 
			
		||||
struct ipa;
 | 
			
		||||
struct ipa_interrupt;
 | 
			
		||||
enum ipa_irq_id;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * typedef ipa_irq_handler_t - IPA interrupt handler function type
 | 
			
		||||
| 
						 | 
				
			
			@ -85,6 +86,20 @@ void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt);
 | 
			
		|||
 */
 | 
			
		||||
void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ipa_interrupt_enable() - Enable an IPA interrupt type
 | 
			
		||||
 * @ipa:	IPA pointer
 | 
			
		||||
 * @ipa_irq:	IPA interrupt ID
 | 
			
		||||
 */
 | 
			
		||||
void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ipa_interrupt_disable() - Disable an IPA interrupt type
 | 
			
		||||
 * @ipa:	IPA pointer
 | 
			
		||||
 * @ipa_irq:	IPA interrupt ID
 | 
			
		||||
 */
 | 
			
		||||
void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * ipa_interrupt_config() - Configure the IPA interrupt framework
 | 
			
		||||
 * @ipa:	IPA pointer
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -337,10 +337,13 @@ int ipa_power_setup(struct ipa *ipa)
 | 
			
		|||
 | 
			
		||||
	ipa_interrupt_add(ipa->interrupt, IPA_IRQ_TX_SUSPEND,
 | 
			
		||||
			  ipa_suspend_handler);
 | 
			
		||||
	ipa_interrupt_enable(ipa, IPA_IRQ_TX_SUSPEND);
 | 
			
		||||
 | 
			
		||||
	ret = device_init_wakeup(&ipa->pdev->dev, true);
 | 
			
		||||
	if (ret)
 | 
			
		||||
	if (ret) {
 | 
			
		||||
		ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND);
 | 
			
		||||
		ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -348,6 +351,7 @@ int ipa_power_setup(struct ipa *ipa)
 | 
			
		|||
void ipa_power_teardown(struct ipa *ipa)
 | 
			
		||||
{
 | 
			
		||||
	(void)device_init_wakeup(&ipa->pdev->dev, false);
 | 
			
		||||
	ipa_interrupt_disable(ipa, IPA_IRQ_TX_SUSPEND);
 | 
			
		||||
	ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_TX_SUSPEND);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -187,7 +187,9 @@ void ipa_uc_config(struct ipa *ipa)
 | 
			
		|||
	ipa->uc_powered = false;
 | 
			
		||||
	ipa->uc_loaded = false;
 | 
			
		||||
	ipa_interrupt_add(interrupt, IPA_IRQ_UC_0, ipa_uc_interrupt_handler);
 | 
			
		||||
	ipa_interrupt_enable(ipa, IPA_IRQ_UC_0);
 | 
			
		||||
	ipa_interrupt_add(interrupt, IPA_IRQ_UC_1, ipa_uc_interrupt_handler);
 | 
			
		||||
	ipa_interrupt_enable(ipa, IPA_IRQ_UC_1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Inverse of ipa_uc_config() */
 | 
			
		||||
| 
						 | 
				
			
			@ -195,7 +197,9 @@ void ipa_uc_deconfig(struct ipa *ipa)
 | 
			
		|||
{
 | 
			
		||||
	struct device *dev = &ipa->pdev->dev;
 | 
			
		||||
 | 
			
		||||
	ipa_interrupt_disable(ipa, IPA_IRQ_UC_1);
 | 
			
		||||
	ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_1);
 | 
			
		||||
	ipa_interrupt_disable(ipa, IPA_IRQ_UC_0);
 | 
			
		||||
	ipa_interrupt_remove(ipa->interrupt, IPA_IRQ_UC_0);
 | 
			
		||||
	if (ipa->uc_loaded)
 | 
			
		||||
		ipa_power_retention(ipa, false);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue