Skip to content

Commit 1bafbf4

Browse files
kv2019iaescolar
authored andcommitted
drivers: dma: intel-adsp-hda: optimize L1 exit handling in ISR
Use the existing 'atomic' bitmask to speed up ISR processing for CONFIG_DMA_INTEL_ADSP_HDA_TIMING_L1_EXIT. This bitmask is used to track enabled DMA channels. In the common case, only a few DMA channels are active and low channels are allocated first. Take advantage of this and not iterate over all DMA channels of all all host devices. Rather break out as soon as L1 exit handling is done for all enabled channels. Signed-off-by: Kai Vehmanen <[email protected]>
1 parent ccfd16e commit 1bafbf4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/dma/dma_intel_adsp_hda.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,7 @@ void intel_adsp_hda_dma_isr(void)
459459
bool triggered_interrupts = false;
460460
int i, j;
461461
int expected_interrupts = 0;
462+
atomic_val_t enabled_chs;
462463
const struct device *host_dev[] = {
463464
#if CONFIG_DMA_INTEL_ADSP_HDA_HOST_OUT
464465
DT_FOREACH_STATUS_OKAY(intel_adsp_hda_host_out, DEVICE_DT_GET_AND_COMMA)
@@ -479,10 +480,12 @@ void intel_adsp_hda_dma_isr(void)
479480
for (i = 0; i < ARRAY_SIZE(host_dev); i++) {
480481
dma_ctx = (struct dma_context *)host_dev[i]->data;
481482
cfg = host_dev[i]->config;
482-
483-
for (j = 0; j < dma_ctx->dma_channels; j++) {
484-
if (!atomic_test_bit(dma_ctx->atomic, j))
483+
enabled_chs = atomic_get(dma_ctx->atomic);
484+
for (j = 0; enabled_chs && j < dma_ctx->dma_channels; j++) {
485+
if (!(enabled_chs & BIT(j))) {
485486
continue;
487+
}
488+
enabled_chs &= ~(BIT(j));
486489

487490
if (!intel_adsp_hda_is_buffer_interrupt_enabled(cfg->base,
488491
cfg->regblock_size, j))

0 commit comments

Comments
 (0)