idc: add an irq private data member

Use the platform provided IDC IRQ number only once and save the
number in a private field. This relies on the fact, that the
interrupt number is the same on all cores.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2019-02-22 14:51:10 +01:00 committed by Liam Girdwood
parent d79c9190e9
commit fe5886808b
2 changed files with 10 additions and 6 deletions

View File

@ -50,9 +50,11 @@ static struct idc **idc_get(void)
*/
void idc_enable_interrupts(int target_core, int source_core)
{
struct idc *idc = *idc_get();
idc_write(IPC_IDCCTL, target_core,
IPC_IDCCTL_IDCTBIE(source_core));
interrupt_unmask(PLATFORM_IDC_INTERRUPT(target_core), target_core);
interrupt_unmask(idc->irq, target_core);
}
/**
@ -347,11 +349,12 @@ int arch_idc_init(void)
SOF_TASK_PRI_IDC, idc_do_cmd, *idc, core, 0);
/* configure interrupt */
ret = interrupt_register(PLATFORM_IDC_INTERRUPT(core), IRQ_AUTO_UNMASK,
idc_irq_handler, *idc);
(*idc)->irq = PLATFORM_IDC_INTERRUPT(core);
ret = interrupt_register((*idc)->irq, IRQ_AUTO_UNMASK, idc_irq_handler,
*idc);
if (ret < 0)
return ret;
interrupt_enable(PLATFORM_IDC_INTERRUPT(core));
interrupt_enable((*idc)->irq);
/* enable BUSY and DONE (only for master core) interrupts */
idc_write(IPC_IDCCTL, core,
@ -373,8 +376,8 @@ void idc_free(void)
trace_idc("idc_free()");
/* disable and unregister interrupt */
interrupt_disable(PLATFORM_IDC_INTERRUPT(core));
interrupt_unregister(PLATFORM_IDC_INTERRUPT(core), idc);
interrupt_disable(idc->irq);
interrupt_unregister(idc->irq, idc);
/* clear BUSY bits */
for (i = 0; i < PLATFORM_CORE_COUNT; i++) {

View File

@ -98,6 +98,7 @@ struct idc {
uint32_t done_bit_mask; /**< done interrupt mask */
struct idc_msg received_msg; /**< received message */
struct task idc_task; /**< IDC processing task */
int irq;
};
#endif /* __SOF_DRIVERS_IDC_H__ */