Sound Open Firmware
Loading...
Searching...
No Matches
afe-drv.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-3-Clause */
2/*
3 * Copyright(c) 2021 MediaTek. All rights reserved.
4 *
5 * Author: Bo Pan <bo.pan@mediatek.com>
6 * YC Hung <yc.hung@mediatek.com>
7 */
8
9#ifndef __SOF_DRIVERS_AFE_DRV_H__
10#define __SOF_DRIVERS_AFE_DRV_H__
11
55
73
75 unsigned int dma_addr;
76 unsigned int afe_addr;
77 unsigned int buffer_size;
78
81};
82
84 int id;
85 unsigned int channel;
86 unsigned int rate;
87 unsigned int format;
88 /* other? */
89};
90
96
99 unsigned int base;
100
105
108
111
112 unsigned int (*afe2adsp_addr)(unsigned int addr);
113 unsigned int (*adsp2afe_addr)(unsigned int addr);
114 unsigned int (*afe_fs)(unsigned int rate, int aud_blk);
115 unsigned int (*irq_fs)(unsigned int rate);
116
118
120};
121
122/* platform information */
124 unsigned int base_addr;
129
133
135
136 /* misc */
137 unsigned int (*afe2adsp_addr)(unsigned int addr);
138 unsigned int (*adsp2afe_addr)(unsigned int addr);
139 unsigned int (*afe_fs)(unsigned int rate, int aud_blk);
140 unsigned int (*irq_fs)(unsigned int rate);
141};
142
144
145struct mtk_base_afe *afe_get(void);
146int afe_probe(struct mtk_base_afe *afe);
147void afe_remove(struct mtk_base_afe *afe);
148
149/* dai operation */
150int afe_dai_get_config(struct mtk_base_afe *afe, int id, unsigned int *channel, unsigned int *rate,
151 unsigned int *format);
152int afe_dai_set_config(struct mtk_base_afe *afe, int id, unsigned int channel, unsigned int rate,
153 unsigned int format);
154
155/* memif operation */
156int afe_memif_set_params(struct mtk_base_afe *afe, int id, unsigned int channel, unsigned int rate,
157 unsigned int format);
158int afe_memif_set_addr(struct mtk_base_afe *afe, int id, unsigned int dma_addr,
159 unsigned int dma_bytes);
160int afe_memif_set_enable(struct mtk_base_afe *afe, int id, int enable);
161unsigned int afe_memif_get_cur_position(struct mtk_base_afe *afe, int id);
162int afe_memif_get_direction(struct mtk_base_afe *afe, int id);
163
164/* irq opeartion */
165int afe_irq_get_status(struct mtk_base_afe *afe, int id);
166int afe_irq_clear(struct mtk_base_afe *afe, int id);
167int afe_irq_config(struct mtk_base_afe *afe, int id, unsigned int rate, unsigned int period);
168int afe_irq_enable(struct mtk_base_afe *afe, int id);
169int afe_irq_disable(struct mtk_base_afe *afe, int id);
170
171#endif /* __SOF_DRIVERS_AFE_DRV_H__ */
172
int afe_irq_enable(struct mtk_base_afe *afe, int id)
int afe_irq_get_status(struct mtk_base_afe *afe, int id)
int afe_dai_get_config(struct mtk_base_afe *afe, int id, unsigned int *channel, unsigned int *rate, unsigned int *format)
int afe_irq_clear(struct mtk_base_afe *afe, int id)
int afe_memif_set_params(struct mtk_base_afe *afe, int id, unsigned int channel, unsigned int rate, unsigned int format)
int afe_irq_disable(struct mtk_base_afe *afe, int id)
void afe_remove(struct mtk_base_afe *afe)
int afe_memif_set_enable(struct mtk_base_afe *afe, int id, int enable)
int afe_probe(struct mtk_base_afe *afe)
int afe_memif_set_addr(struct mtk_base_afe *afe, int id, unsigned int dma_addr, unsigned int dma_bytes)
int afe_irq_config(struct mtk_base_afe *afe, int id, unsigned int rate, unsigned int period)
int afe_memif_get_direction(struct mtk_base_afe *afe, int id)
struct mtk_base_afe_platform mtk_afe_platform
unsigned int afe_memif_get_cur_position(struct mtk_base_afe *afe, int id)
struct mtk_base_afe * afe_get(void)
int afe_dai_set_config(struct mtk_base_afe *afe, int id, unsigned int channel, unsigned int rate, unsigned int format)
Definition afe-drv.h:83
unsigned int rate
Definition afe-drv.h:86
int id
Definition afe-drv.h:84
unsigned int format
Definition afe-drv.h:87
unsigned int channel
Definition afe-drv.h:85
Definition afe-drv.h:91
const struct mtk_base_irq_data * irq_data
Definition afe-drv.h:92
int mask
Definition afe-drv.h:93
int irq_occupyed
Definition afe-drv.h:94
Definition afe-drv.h:74
const struct mtk_base_memif_data * data
Definition afe-drv.h:79
unsigned int afe_addr
Definition afe-drv.h:76
int irq_usage
Definition afe-drv.h:80
unsigned int dma_addr
Definition afe-drv.h:75
unsigned int buffer_size
Definition afe-drv.h:77
Definition afe-drv.h:123
unsigned int base_addr
Definition afe-drv.h:124
const struct mtk_base_memif_data * memif_datas
Definition afe-drv.h:125
struct mtk_base_irq_data * irq_datas
Definition afe-drv.h:130
int dais_size
Definition afe-drv.h:132
unsigned int(* afe_fs)(unsigned int rate, int aud_blk)
Definition afe-drv.h:139
unsigned int(* irq_fs)(unsigned int rate)
Definition afe-drv.h:140
int base_end_offset
Definition afe-drv.h:134
int irqs_size
Definition afe-drv.h:131
int memif_32bit_supported
Definition afe-drv.h:127
unsigned int(* afe2adsp_addr)(unsigned int addr)
Definition afe-drv.h:137
int memif_size
Definition afe-drv.h:126
int memif_dl_num
Definition afe-drv.h:128
unsigned int(* adsp2afe_addr)(unsigned int addr)
Definition afe-drv.h:138
Definition afe-drv.h:97
int irqs_size
Definition afe-drv.h:107
struct mtk_base_afe_dai * dais
Definition afe-drv.h:109
struct mtk_base_afe_irq * irqs
Definition afe-drv.h:106
struct mtk_base_afe_memif * memif
Definition afe-drv.h:101
unsigned int(* adsp2afe_addr)(unsigned int addr)
Definition afe-drv.h:113
void * platform_priv
Definition afe-drv.h:119
int dais_size
Definition afe-drv.h:110
int ref_count
Definition afe-drv.h:98
int memif_dl_num
Definition afe-drv.h:104
int memifs_size
Definition afe-drv.h:102
unsigned int(* afe_fs)(unsigned int rate, int aud_blk)
Definition afe-drv.h:114
int memif_32bit_supported
Definition afe-drv.h:103
unsigned int(* irq_fs)(unsigned int rate)
Definition afe-drv.h:115
int base_end_offset
Definition afe-drv.h:117
unsigned int(* afe2adsp_addr)(unsigned int addr)
Definition afe-drv.h:112
unsigned int base
Definition afe-drv.h:99
Definition afe-drv.h:56
int irq_scp_en_shift
Definition afe-drv.h:71
int irq_en_reg
Definition afe-drv.h:64
int irq_ap_en_reg
Definition afe-drv.h:68
int irq_clr_shift
Definition afe-drv.h:67
int irq_cnt_maskbit
Definition afe-drv.h:60
int irq_fs_reg
Definition afe-drv.h:61
int irq_scp_en_reg
Definition afe-drv.h:70
int irq_cnt_shift
Definition afe-drv.h:59
int irq_en_shift
Definition afe-drv.h:65
int id
Definition afe-drv.h:57
int irq_clr_reg
Definition afe-drv.h:66
int irq_cnt_reg
Definition afe-drv.h:58
int irq_fs_maskbit
Definition afe-drv.h:63
int irq_ap_en_shift
Definition afe-drv.h:69
int irq_fs_shift
Definition afe-drv.h:62
Definition afe-drv.h:12
int mono_reg
Definition afe-drv.h:24
int reg_ofs_base_msb
Definition afe-drv.h:18
int msb2_shift
Definition afe-drv.h:41
int quad_ch_reg
Definition afe-drv.h:27
int fs_maskbit
Definition afe-drv.h:23
int fs_reg
Definition afe-drv.h:21
int int_odd_flag_reg
Definition afe-drv.h:30
int hd_align_reg
Definition afe-drv.h:36
int pbuf_shift
Definition afe-drv.h:50
int enable_shift
Definition afe-drv.h:33
int ch_num_shift
Definition afe-drv.h:45
int minlen_reg
Definition afe-drv.h:51
int msb_reg
Definition afe-drv.h:38
int msb_shift
Definition afe-drv.h:39
const char * name
Definition afe-drv.h:14
int minlen_shift
Definition afe-drv.h:53
int id
Definition afe-drv.h:13
int hd_reg
Definition afe-drv.h:34
int reg_ofs_end_msb
Definition afe-drv.h:20
int pbuf_mask
Definition afe-drv.h:49
int agent_disable_shift
Definition afe-drv.h:43
int reg_ofs_base
Definition afe-drv.h:15
int enable_reg
Definition afe-drv.h:32
int reg_ofs_cur
Definition afe-drv.h:16
int int_odd_flag_shift
Definition afe-drv.h:31
int minlen_mask
Definition afe-drv.h:52
int mono_invert
Definition afe-drv.h:26
int hd_shift
Definition afe-drv.h:35
int quad_ch_mask
Definition afe-drv.h:28
int ch_num_reg
Definition afe-drv.h:44
int pbuf_reg
Definition afe-drv.h:48
int hd_align_mshift
Definition afe-drv.h:37
int mono_shift
Definition afe-drv.h:25
int agent_disable_reg
Definition afe-drv.h:42
int reg_ofs_end
Definition afe-drv.h:17
int quad_ch_shift
Definition afe-drv.h:29
int ch_num_maskbit
Definition afe-drv.h:46
int msb2_reg
Definition afe-drv.h:40
int reg_ofs_cur_msb
Definition afe-drv.h:19
int fs_shift
Definition afe-drv.h:22