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
{
42 int agent_disable_reg
;
43 int agent_disable_shift
;
44 /* playback memif only */
53 struct mtk_base_irq_data
{
69 struct mtk_base_afe_memif
;
70 struct mtk_base_afe_irq
;
71 struct mtk_base_afe_dai
;
73 struct snd_pcm_substream
;
77 void __iomem
*base_addr
;
79 struct regmap
*regmap
;
80 struct mutex irq_alloc_lock
; /* dynamic alloc irq lock */
82 unsigned int const *reg_back_up_list
;
83 unsigned int *reg_back_up
;
84 unsigned int reg_back_up_list_num
;
86 int (*runtime_suspend
)(struct device
*dev
);
87 int (*runtime_resume
)(struct device
*dev
);
90 struct mtk_base_afe_memif
*memif
;
92 struct mtk_base_afe_irq
*irqs
;
94 int memif_32bit_supported
;
96 struct list_head sub_dais
;
97 struct snd_soc_dai_driver
*dai_drivers
;
98 unsigned int num_dai_drivers
;
100 const struct snd_pcm_hardware
*mtk_afe_hardware
;
101 int (*memif_fs
)(struct snd_pcm_substream
*substream
,
103 int (*irq_fs
)(struct snd_pcm_substream
*substream
,
105 int (*get_dai_fs
)(struct mtk_base_afe
*afe
,
106 int dai_id
, unsigned int rate
);
107 int (*get_memif_pbuf_size
)(struct snd_pcm_substream
*substream
);
109 int (*request_dram_resource
)(struct device
*dev
);
110 int (*release_dram_resource
)(struct device
*dev
);
115 struct mtk_base_afe_memif
{
116 unsigned int phys_buf_addr
;
118 struct snd_pcm_substream
*substream
;
119 const struct mtk_base_memif_data
*data
;
122 unsigned char *dma_area
;
127 struct mtk_base_afe_irq
{
128 const struct mtk_base_irq_data
*irq_data
;
132 struct mtk_base_afe_dai
{
133 struct snd_soc_dai_driver
*dai_drivers
;
134 unsigned int num_dai_drivers
;
136 const struct snd_kcontrol_new
*controls
;
137 unsigned int num_controls
;
138 const struct snd_soc_dapm_widget
*dapm_widgets
;
139 unsigned int num_dapm_widgets
;
140 const struct snd_soc_dapm_route
*dapm_routes
;
141 unsigned int num_dapm_routes
;
143 struct list_head list
;