1 /* SPDX-License-Identifier: GPL-2.0 */
3 * mtk-base-afe.h -- Mediatek base afe structure
5 * Copyright (c) 2016 MediaTek Inc.
6 * Author: Garlic Tseng <garlic.tseng@mediatek.com>
9 #ifndef _MTK_BASE_AFE_H_
10 #define _MTK_BASE_AFE_H_
12 #define MTK_STREAM_NUM (SNDRV_PCM_STREAM_LAST + 1)
14 struct mtk_base_memif_data {
33 int int_odd_flag_shift;
44 int agent_disable_reg;
45 int agent_disable_shift;
49 /* playback memif only */
58 struct mtk_base_irq_data {
75 struct mtk_base_afe_memif;
76 struct mtk_base_afe_irq;
77 struct mtk_base_afe_dai;
79 struct snd_pcm_substream;
83 void __iomem *base_addr;
85 struct regmap *regmap;
86 struct mutex irq_alloc_lock; /* dynamic alloc irq lock */
88 unsigned int const *reg_back_up_list;
89 unsigned int *reg_back_up;
90 unsigned int reg_back_up_list_num;
92 int (*runtime_suspend)(struct device *dev);
93 int (*runtime_resume)(struct device *dev);
96 struct mtk_base_afe_memif *memif;
98 struct mtk_base_afe_irq *irqs;
100 int memif_32bit_supported;
102 struct list_head sub_dais;
103 struct snd_soc_dai_driver *dai_drivers;
104 unsigned int num_dai_drivers;
106 const struct snd_pcm_hardware *mtk_afe_hardware;
107 int (*memif_fs)(struct snd_pcm_substream *substream,
109 int (*irq_fs)(struct snd_pcm_substream *substream,
111 int (*get_dai_fs)(struct mtk_base_afe *afe,
112 int dai_id, unsigned int rate);
113 int (*get_memif_pbuf_size)(struct snd_pcm_substream *substream);
115 int (*request_dram_resource)(struct device *dev);
116 int (*release_dram_resource)(struct device *dev);
121 struct mtk_base_afe_memif {
122 unsigned int phys_buf_addr;
124 struct snd_pcm_substream *substream;
125 const struct mtk_base_memif_data *data;
128 unsigned char *dma_area;
133 struct mtk_base_afe_irq {
134 const struct mtk_base_irq_data *irq_data;
138 struct mtk_base_afe_dai {
139 struct snd_soc_dai_driver *dai_drivers;
140 unsigned int num_dai_drivers;
142 const struct snd_kcontrol_new *controls;
143 unsigned int num_controls;
144 const struct snd_soc_dapm_widget *dapm_widgets;
145 unsigned int num_dapm_widgets;
146 const struct snd_soc_dapm_route *dapm_routes;
147 unsigned int num_dapm_routes;
149 struct list_head list;