// SPDX-License-Identifier: GPL-2.0 /* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved. * Copyright (C) 2018-2024 Linaro Ltd. */ /* DOC: IPA Interrupts * * The IPA has an interrupt line distinct from the interrupt used by the GSI * code. Whereas GSI interrupts are generally related to channel events (like * transfer completions), IPA interrupts are related to other events related * to the IPA. Some of the IPA interrupts come from a microcontroller * embedded in the IPA. Each IPA interrupt type can be both masked and * acknowledged independent of the others. * * Two of the IPA interrupts are initiated by the microcontroller. A third * can be generated to signal the need for a wakeup/resume when an IPA * endpoint has been suspended. There are other IPA events, but at this * time only these three are supported. */ #include <linux/interrupt.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/pm_wakeirq.h> #include <linux/types.h> #include "ipa.h" #include "ipa_endpoint.h" #include "ipa_interrupt.h" #include "ipa_power.h" #include "ipa_reg.h" #include "ipa_uc.h" /** * struct ipa_interrupt - IPA interrupt information * @ipa: IPA pointer * @irq: Linux IRQ number used for IPA interrupts * @enabled: Mask indicating which interrupts are enabled * @suspend_enabled: Bitmap of endpoints with the SUSPEND interrupt enabled */ struct ipa_interrupt { … }; /* Clear the suspend interrupt for all endpoints that signaled it */ static void ipa_interrupt_suspend_clear_all(struct ipa_interrupt *interrupt) { … } /* Process a particular interrupt type that has been received */ static void ipa_interrupt_process(struct ipa_interrupt *interrupt, u32 irq_id) { … } /* IPA IRQ handler is threaded */ static irqreturn_t ipa_isr_thread(int irq, void *dev_id) { … } static void ipa_interrupt_enabled_update(struct ipa *ipa) { … } /* Enable an IPA interrupt type */ void ipa_interrupt_enable(struct ipa *ipa, enum ipa_irq_id ipa_irq) { … } /* Disable an IPA interrupt type */ void ipa_interrupt_disable(struct ipa *ipa, enum ipa_irq_id ipa_irq) { … } void ipa_interrupt_irq_disable(struct ipa *ipa) { … } void ipa_interrupt_irq_enable(struct ipa *ipa) { … } /* Common function used to enable/disable TX_SUSPEND for an endpoint */ static void ipa_interrupt_suspend_control(struct ipa_interrupt *interrupt, u32 endpoint_id, bool enable) { … } /* Enable TX_SUSPEND for an endpoint */ void ipa_interrupt_suspend_enable(struct ipa_interrupt *interrupt, u32 endpoint_id) { … } /* Disable TX_SUSPEND for an endpoint */ void ipa_interrupt_suspend_disable(struct ipa_interrupt *interrupt, u32 endpoint_id) { … } /* Simulate arrival of an IPA TX_SUSPEND interrupt */ void ipa_interrupt_simulate_suspend(struct ipa_interrupt *interrupt) { … } /* Configure the IPA interrupt framework */ int ipa_interrupt_config(struct ipa *ipa) { … } /* Inverse of ipa_interrupt_config() */ void ipa_interrupt_deconfig(struct ipa *ipa) { … } /* Initialize the IPA interrupt structure */ struct ipa_interrupt *ipa_interrupt_init(struct platform_device *pdev) { … } /* Inverse of ipa_interrupt_init() */ void ipa_interrupt_exit(struct ipa_interrupt *interrupt) { … }