2 * mt2701-afe-common.h -- Mediatek 2701 audio driver definitions
4 * Copyright (c) 2016 MediaTek Inc.
5 * Author: Garlic Tseng <garlic.tseng@mediatek.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 and
9 * only version 2 as published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
17 #ifndef _MT_2701_AFE_COMMON_H_
18 #define _MT_2701_AFE_COMMON_H_
19 #include <sound/soc.h>
20 #include <linux/clk.h>
21 #include <linux/regmap.h>
22 #include "mt2701-reg.h"
23 #include "../common/mtk-base-afe.h"
25 #define MT2701_STREAM_DIR_NUM (SNDRV_PCM_STREAM_LAST + 1)
26 #define MT2701_PLL_DOMAIN_0_RATE 98304000
27 #define MT2701_PLL_DOMAIN_1_RATE 90316800
28 #define MT2701_AUD_AUD_MUX1_DIV_RATE (MT2701_PLL_DOMAIN_0_RATE / 2)
29 #define MT2701_AUD_AUD_MUX2_DIV_RATE (MT2701_PLL_DOMAIN_1_RATE / 2)
45 MT2701_MEMIF_DL_SINGLE_NUM
,
46 MT2701_MEMIF_DLM
= MT2701_MEMIF_DL_SINGLE_NUM
,
55 MT2701_IO_I2S
= MT2701_MEMIF_NUM
,
65 MT2701_IRQ_ASYS_START
,
66 MT2701_IRQ_ASYS_IRQ1
= MT2701_IRQ_ASYS_START
,
73 enum audio_system_clock_type
{
74 MT2701_AUD_INFRA_SYS_AUDIO
,
75 MT2701_AUD_AUD_MUX1_SEL
,
76 MT2701_AUD_AUD_MUX2_SEL
,
77 MT2701_AUD_AUD_MUX1_DIV
,
78 MT2701_AUD_AUD_MUX2_DIV
,
79 MT2701_AUD_AUD_48K_TIMING
,
80 MT2701_AUD_AUD_44K_TIMING
,
81 MT2701_AUD_AUDPLL_MUX_SEL
,
83 MT2701_AUD_AUD1PLL_98M
,
84 MT2701_AUD_AUD2PLL_90M
,
85 MT2701_AUD_HADDS2PLL_98M
,
86 MT2701_AUD_HADDS2PLL_294M
,
90 MT2701_AUD_AUDPLL_D16
,
91 MT2701_AUD_AUDPLL_D24
,
94 MT2701_AUD_SYSPLL1_D4
,
95 MT2701_AUD_AUD_K1_SRC_SEL
,
96 MT2701_AUD_AUD_K2_SRC_SEL
,
97 MT2701_AUD_AUD_K3_SRC_SEL
,
98 MT2701_AUD_AUD_K4_SRC_SEL
,
99 MT2701_AUD_AUD_K5_SRC_SEL
,
100 MT2701_AUD_AUD_K6_SRC_SEL
,
101 MT2701_AUD_AUD_K1_SRC_DIV
,
102 MT2701_AUD_AUD_K2_SRC_DIV
,
103 MT2701_AUD_AUD_K3_SRC_DIV
,
104 MT2701_AUD_AUD_K4_SRC_DIV
,
105 MT2701_AUD_AUD_K5_SRC_DIV
,
106 MT2701_AUD_AUD_K6_SRC_DIV
,
107 MT2701_AUD_AUD_I2S1_MCLK
,
108 MT2701_AUD_AUD_I2S2_MCLK
,
109 MT2701_AUD_AUD_I2S3_MCLK
,
110 MT2701_AUD_AUD_I2S4_MCLK
,
111 MT2701_AUD_AUD_I2S5_MCLK
,
112 MT2701_AUD_AUD_I2S6_MCLK
,
113 MT2701_AUD_ASM_M_SEL
,
114 MT2701_AUD_ASM_H_SEL
,
115 MT2701_AUD_UNIVPLL2_D4
,
116 MT2701_AUD_UNIVPLL2_D2
,
117 MT2701_AUD_SYSPLL_D5
,
121 static const unsigned int mt2701_afe_backup_list
[] = {
142 struct snd_pcm_substream
;
143 struct mtk_base_irq_data
;
145 struct mt2701_i2s_data
{
148 int i2s_asrc_fs_shift
;
149 int i2s_asrc_fs_mask
;
152 enum mt2701_i2s_dir
{
158 struct mt2701_i2s_path
{
162 int occupied
[I2S_DIR_NUM
];
163 const struct mt2701_i2s_data
*i2s_data
[2];
166 struct mt2701_afe_private
{
167 struct clk
*clocks
[MT2701_CLOCK_NUM
];
168 struct mt2701_i2s_path i2s_path
[MT2701_I2S_NUM
];
169 bool mrg_enable
[MT2701_STREAM_DIR_NUM
];