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_in
8 
9 #include <zephyr/drivers/dma.h>
10 #include "dma_intel_adsp_hda.h"
11 
12 static const struct dma_driver_api intel_adsp_hda_dma_host_in_api = {
13 	.config = intel_adsp_hda_dma_host_in_config,
14 	.reload = intel_adsp_hda_dma_host_reload,
15 	.start = intel_adsp_hda_dma_start,
16 	.stop = intel_adsp_hda_dma_stop,
17 	.get_status = intel_adsp_hda_dma_status,
18 	.get_attribute = intel_adsp_hda_dma_get_attribute,
19 	.chan_filter = intel_adsp_hda_dma_chan_filter,
20 };
21 
22 #define INTEL_ADSP_HDA_DMA_HOST_IN_INIT(inst)                                                      \
23 	static const struct intel_adsp_hda_dma_cfg intel_adsp_hda_dma##inst##_config = {           \
24 		.base = DT_INST_REG_ADDR(inst),                                                    \
25 		.regblock_size  = DT_INST_REG_SIZE(inst),					   \
26 		.dma_channels = DT_INST_PROP(inst, dma_channels),                                  \
27 		.direction = MEMORY_TO_HOST                                                        \
28 	};                                                                                         \
29 												   \
30 	static struct intel_adsp_hda_dma_data intel_adsp_hda_dma##inst##_data = {};                \
31 												   \
32 	PM_DEVICE_DT_INST_DEFINE(inst, intel_adsp_hda_dma_pm_action);				   \
33 												   \
34 	DEVICE_DT_INST_DEFINE(inst, &intel_adsp_hda_dma_init,					   \
35 			      PM_DEVICE_DT_INST_GET(inst),					   \
36 			      &intel_adsp_hda_dma##inst##_data,                                    \
37 			      &intel_adsp_hda_dma##inst##_config, POST_KERNEL,                     \
38 			      CONFIG_DMA_INIT_PRIORITY,                                            \
39 			      &intel_adsp_hda_dma_host_in_api);
40 
41 DT_INST_FOREACH_STATUS_OKAY(INTEL_ADSP_HDA_DMA_HOST_IN_INIT)
42