1 /* 2 * Copyright (c) 2022 Intel Corporation. 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef ZEPHYR_DRIVERS_DMA_INTEL_ADSP_HDA_COMMON_H_ 8 #define ZEPHYR_DRIVERS_DMA_INTEL_ADSP_HDA_COMMON_H_ 9 10 #define INTEL_ADSP_HDA_MAX_CHANNELS DT_PROP(DT_NODELABEL(hda_host_out), dma_channels) 11 12 /* Minimum recommended FPI increment */ 13 #define INTEL_HDA_MIN_FPI_INCREMENT_FOR_INTERRUPT 32 14 15 #include <zephyr/drivers/dma.h> 16 #include <zephyr/pm/device.h> 17 #include <zephyr/pm/device_runtime.h> 18 19 struct intel_adsp_hda_dma_data { 20 struct dma_context ctx; 21 22 ATOMIC_DEFINE(channels_atomic, INTEL_ADSP_HDA_MAX_CHANNELS); 23 }; 24 25 struct intel_adsp_hda_dma_cfg { 26 uint32_t base; 27 uint32_t regblock_size; 28 uint32_t dma_channels; 29 enum dma_channel_direction direction; 30 void (*irq_config)(void); 31 }; 32 33 int intel_adsp_hda_dma_host_in_config(const struct device *dev, 34 uint32_t channel, 35 struct dma_config *dma_cfg); 36 37 int intel_adsp_hda_dma_host_out_config(const struct device *dev, 38 uint32_t channel, 39 struct dma_config *dma_cfg); 40 41 int intel_adsp_hda_dma_link_in_config(const struct device *dev, 42 uint32_t channel, 43 struct dma_config *dma_cfg); 44 45 int intel_adsp_hda_dma_link_out_config(const struct device *dev, 46 uint32_t channel, 47 struct dma_config *dma_cfg); 48 49 int intel_adsp_hda_dma_link_reload(const struct device *dev, uint32_t channel, 50 uint32_t src, uint32_t dst, size_t size); 51 52 int intel_adsp_hda_dma_host_reload(const struct device *dev, uint32_t channel, 53 uint32_t src, uint32_t dst, size_t size); 54 55 int intel_adsp_hda_dma_status(const struct device *dev, uint32_t channel, 56 struct dma_status *stat); 57 58 bool intel_adsp_hda_dma_chan_filter(const struct device *dev, int channel, 59 void *filter_param); 60 61 int intel_adsp_hda_dma_start(const struct device *dev, uint32_t channel); 62 63 int intel_adsp_hda_dma_stop(const struct device *dev, uint32_t channel); 64 65 int intel_adsp_hda_dma_init(const struct device *dev); 66 67 int intel_adsp_hda_dma_get_attribute(const struct device *dev, uint32_t type, uint32_t *value); 68 69 void intel_adsp_hda_dma_isr(void); 70 71 #ifdef CONFIG_PM_DEVICE 72 int intel_adsp_hda_dma_pm_action(const struct device *dev, enum pm_device_action action); 73 #endif 74 75 #endif /* ZEPHYR_DRIVERS_DMA_INTEL_ADSP_HDA_COMMON_H_ */ 76