1 /* 2 * Copyright (c) 2022 Intel Corporation. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #define DT_DRV_COMPAT intel_adsp_hda_host_out 8 9 #include <zephyr/drivers/dma.h> 10 #include <adsp_interrupt.h> 11 #include "dma_intel_adsp_hda.h" 12 13 #define LOG_LEVEL CONFIG_DMA_LOG_LEVEL 14 #include <zephyr/logging/log.h> 15 LOG_MODULE_REGISTER(dma_intel_adsp_hda_dma_host_out); 16 17 static const struct dma_driver_api intel_adsp_hda_dma_host_out_api = { 18 .config = intel_adsp_hda_dma_host_out_config, 19 .reload = intel_adsp_hda_dma_host_reload, 20 .start = intel_adsp_hda_dma_start, 21 .stop = intel_adsp_hda_dma_stop, 22 .get_status = intel_adsp_hda_dma_status, 23 .get_attribute = intel_adsp_hda_dma_get_attribute, 24 .chan_filter = intel_adsp_hda_dma_chan_filter, 25 }; 26 27 #define INTEL_ADSP_HDA_DMA_HOST_OUT_INIT(inst) \ 28 static void intel_adsp_hda_dma##inst##_irq_config(void); \ 29 \ 30 static const struct intel_adsp_hda_dma_cfg intel_adsp_hda_dma##inst##_config = { \ 31 .base = DT_INST_REG_ADDR(inst), \ 32 .regblock_size = DT_INST_REG_SIZE(inst), \ 33 .dma_channels = DT_INST_PROP(inst, dma_channels), \ 34 .direction = HOST_TO_MEMORY, \ 35 .irq_config = intel_adsp_hda_dma##inst##_irq_config, \ 36 }; \ 37 \ 38 static struct intel_adsp_hda_dma_data intel_adsp_hda_dma##inst##_data = {}; \ 39 \ 40 PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action); \ 41 \ 42 DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init, \ 43 PM_DEVICE_DT_INST_GET(inst), \ 44 &intel_adsp_hda_dma##inst##_data, \ 45 &intel_adsp_hda_dma##inst##_config, POST_KERNEL, \ 46 CONFIG_DMA_INIT_PRIORITY, \ 47 &intel_adsp_hda_dma_host_out_api); \ 48 \ 49 static void intel_adsp_hda_dma##inst##_irq_config(void) \ 50 { \ 51 IRQ_CONNECT(DT_INST_IRQN(inst), \ 52 DT_INST_IRQ(inst, priority), intel_adsp_hda_dma_isr, \ 53 DEVICE_DT_INST_GET(inst), \ 54 DT_INST_IRQ(inst, sense)); \ 55 irq_enable(DT_INST_IRQN(inst)); \ 56 IF_ENABLED(CONFIG_SOC_SERIES_INTEL_ADSP_ACE, \ 57 (ACE_DINT[0].ie[ACE_INTL_HDAHODMA] = 1;)) \ 58 } 59 60 DT_INST_FOREACH_STATUS_OKAY(INTEL_ADSP_HDA_DMA_HOST_OUT_INIT) 61