ASoC: mediatek: mt8196: add common header

Add header files for register definitions and structures.

Signed-off-by: Darren Ye <darren.ye@mediatek.com>
Signed-off-by: Cyril Chao <Cyril.Chao@mediatek.com>
Link: https://patch.msgid.link/20260430022417.32282-3-Cyril.Chao@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Darren Ye 2026-04-30 10:23:15 +08:00 committed by Mark Brown
parent 1aadc0147b
commit 33eda2c14f
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
3 changed files with 12394 additions and 0 deletions

View File

@ -0,0 +1,205 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* mt8196-afe-common.h -- Mediatek 8196 audio driver definitions
*
* Copyright (c) 2025 MediaTek Inc.
* Author: Darren Ye <darren.ye@mediatek.com>
*/
#ifndef _MT_8196_AFE_COMMON_H_
#define _MT_8196_AFE_COMMON_H_
#include <sound/pcm.h>
#include <sound/soc.h>
#include "mt8196-reg.h"
#include "../common/mtk-base-afe.h"
/* HW IPM 2.0 */
enum {
MTK_AFE_IPM2P0_RATE_8K = 0x0,
MTK_AFE_IPM2P0_RATE_11K = 0x1,
MTK_AFE_IPM2P0_RATE_12K = 0x2,
MTK_AFE_IPM2P0_RATE_16K = 0x4,
MTK_AFE_IPM2P0_RATE_22K = 0x5,
MTK_AFE_IPM2P0_RATE_24K = 0x6,
MTK_AFE_IPM2P0_RATE_32K = 0x8,
MTK_AFE_IPM2P0_RATE_44K = 0x9,
MTK_AFE_IPM2P0_RATE_48K = 0xa,
MTK_AFE_IPM2P0_RATE_88K = 0xd,
MTK_AFE_IPM2P0_RATE_96K = 0xe,
MTK_AFE_IPM2P0_RATE_176K = 0x11,
MTK_AFE_IPM2P0_RATE_192K = 0x12,
MTK_AFE_IPM2P0_RATE_352K = 0x15,
MTK_AFE_IPM2P0_RATE_384K = 0x16,
};
enum {
MTKAIF_PROTOCOL_1,
MTKAIF_PROTOCOL_2,
MTKAIF_PROTOCOL_2_CLK_P2,
};
enum {
MT8196_MEMIF_DL0,
MT8196_MEMIF_DL1,
MT8196_MEMIF_DL2,
MT8196_MEMIF_DL3,
MT8196_MEMIF_DL4,
MT8196_MEMIF_DL5,
MT8196_MEMIF_DL6,
MT8196_MEMIF_DL7,
MT8196_MEMIF_DL8,
MT8196_MEMIF_DL23,
MT8196_MEMIF_DL24,
MT8196_MEMIF_DL25,
MT8196_MEMIF_DL26,
MT8196_MEMIF_DL_4CH,
MT8196_MEMIF_DL_24CH,
MT8196_MEMIF_VUL0,
MT8196_MEMIF_VUL1,
MT8196_MEMIF_VUL2,
MT8196_MEMIF_VUL3,
MT8196_MEMIF_VUL4,
MT8196_MEMIF_VUL5,
MT8196_MEMIF_VUL6,
MT8196_MEMIF_VUL7,
MT8196_MEMIF_VUL8,
MT8196_MEMIF_VUL9,
MT8196_MEMIF_VUL10,
MT8196_MEMIF_VUL24,
MT8196_MEMIF_VUL25,
MT8196_MEMIF_VUL26,
MT8196_MEMIF_VUL_CM0,
MT8196_MEMIF_VUL_CM1,
MT8196_MEMIF_VUL_CM2,
MT8196_MEMIF_ETDM_IN0,
MT8196_MEMIF_ETDM_IN1,
MT8196_MEMIF_ETDM_IN2,
MT8196_MEMIF_ETDM_IN3,
MT8196_MEMIF_ETDM_IN4,
MT8196_MEMIF_ETDM_IN6,
MT8196_MEMIF_HDMI,
MT8196_MEMIF_NUM,
MT8196_DAI_ADDA = MT8196_MEMIF_NUM,
MT8196_DAI_ADDA_CH34,
MT8196_DAI_ADDA_CH56,
MT8196_DAI_AP_DMIC,
MT8196_DAI_AP_DMIC_CH34,
MT8196_DAI_AP_DMIC_MULTICH,
MT8196_DAI_I2S_IN0,
MT8196_DAI_I2S_IN1,
MT8196_DAI_I2S_IN2,
MT8196_DAI_I2S_IN3,
MT8196_DAI_I2S_IN4,
MT8196_DAI_I2S_IN6,
MT8196_DAI_I2S_OUT0,
MT8196_DAI_I2S_OUT1,
MT8196_DAI_I2S_OUT2,
MT8196_DAI_I2S_OUT3,
MT8196_DAI_I2S_OUT4,
MT8196_DAI_I2S_OUT6,
MT8196_DAI_FM_I2S_MASTER,
MT8196_DAI_TDM,
MT8196_DAI_TDM_DPTX,
MT8196_DAI_NUM,
};
#define MT8196_DAI_I2S_MAX_NUM 13 //depends each platform's max i2s num
/* update irq ID (= enum) from AFE_IRQ_MCU_STATUS */
enum {
MT8196_IRQ_0,
MT8196_IRQ_1,
MT8196_IRQ_2,
MT8196_IRQ_3,
MT8196_IRQ_4,
MT8196_IRQ_5,
MT8196_IRQ_6,
MT8196_IRQ_7,
MT8196_IRQ_8,
MT8196_IRQ_9,
MT8196_IRQ_10,
MT8196_IRQ_11,
MT8196_IRQ_12,
MT8196_IRQ_13,
MT8196_IRQ_14,
MT8196_IRQ_15,
MT8196_IRQ_16,
MT8196_IRQ_17,
MT8196_IRQ_18,
MT8196_IRQ_19,
MT8196_IRQ_20,
MT8196_IRQ_21,
MT8196_IRQ_22,
MT8196_IRQ_23,
MT8196_IRQ_24,
MT8196_IRQ_25,
MT8196_IRQ_26,
MT8196_IRQ_31, /* used only for TDM */
MT8196_IRQ_NUM,
};
/* update irq ID (= enum) from AFE_IRQ_MCU_STATUS */
enum {
MT8196_CUS_IRQ_TDM, /* used only for TDM */
MT8196_CUS_IRQ_NUM,
};
enum {
/* AUDIO_ENGEN_CON0 */
MT8196_AUDIO_26M_EN_ON,
MT8196_AUDIO_F3P25M_EN_ON,
MT8196_AUDIO_APLL1_EN_ON,
MT8196_AUDIO_APLL2_EN_ON,
MT8196_AUDIO_F26M_EN_RST,
MT8196_MULTI_USER_RST,
MT8196_MULTI_USER_BYPASS,
/* AUDIO_TOP_CON4 */
MT8196_CG_AUDIO_HOPPING_CK,
MT8196_CG_AUDIO_F26M_CK,
MT8196_CG_APLL1_CK,
MT8196_CG_APLL2_CK,
MT8196_PDN_APLL_TUNER2,
MT8196_PDN_APLL_TUNER1,
MT8196_AUDIO_CG_NUM,
};
/* MCLK */
enum {
MT8196_I2SIN0_MCK,
MT8196_I2SIN1_MCK,
MT8196_FMI2S_MCK,
MT8196_TDMOUT_MCK,
MT8196_TDMOUT_BCK,
MT8196_MCK_NUM,
};
/* CM*/
enum {
CM0,
CM1,
CM2,
CM_NUM,
};
struct clk;
struct mtk_base_afe;
struct mt8196_afe_private {
struct clk **clk;
/* dai */
void *dai_priv[MT8196_DAI_NUM];
/* mck */
int mck_rate[MT8196_MCK_NUM];
/* channel merge */
u32 cm_rate[CM_NUM];
u32 cm_channels;
};
int mt8196_dai_adda_register(struct mtk_base_afe *afe);
int mt8196_dai_i2s_register(struct mtk_base_afe *afe);
int mt8196_dai_tdm_register(struct mtk_base_afe *afe);
int mt8196_dai_set_priv(struct mtk_base_afe *afe, int id,
int priv_size, const void *priv_data);
#endif

View File

@ -0,0 +1,121 @@
/* SPDX-License-Identifier: GPL-2.0 */
/*
* Mediatek MT8196 audio driver interconnection definition
*
* Copyright (c) 2025 MediaTek Inc.
* Author: Darren Ye <darren.ye@mediatek.com>
*/
#ifndef _MT8196_INTERCONNECTION_H_
#define _MT8196_INTERCONNECTION_H_
/* in port define */
#define I_CONNSYS_I2S_CH1 0
#define I_CONNSYS_I2S_CH2 1
#define I_GAIN0_OUT_CH1 6
#define I_GAIN0_OUT_CH2 7
#define I_GAIN1_OUT_CH1 8
#define I_GAIN1_OUT_CH2 9
#define I_GAIN2_OUT_CH1 10
#define I_GAIN2_OUT_CH2 11
#define I_GAIN3_OUT_CH1 12
#define I_GAIN3_OUT_CH2 13
#define I_STF_CH1 14
#define I_ADDA_UL_CH1 16
#define I_ADDA_UL_CH2 17
#define I_ADDA_UL_CH3 18
#define I_ADDA_UL_CH4 19
#define I_UL_PROX_CH1 20
#define I_UL_PROX_CH2 21
#define I_ADDA_UL_CH5 24
#define I_ADDA_UL_CH6 25
#define I_DMIC0_CH1 28
#define I_DMIC0_CH2 29
#define I_DMIC1_CH1 30
#define I_DMIC1_CH2 31
/* in port define >= 32 */
#define I_32_OFFSET 32
#define I_DL0_CH1 (32 - I_32_OFFSET)
#define I_DL0_CH2 (33 - I_32_OFFSET)
#define I_DL1_CH1 (34 - I_32_OFFSET)
#define I_DL1_CH2 (35 - I_32_OFFSET)
#define I_DL2_CH1 (36 - I_32_OFFSET)
#define I_DL2_CH2 (37 - I_32_OFFSET)
#define I_DL3_CH1 (38 - I_32_OFFSET)
#define I_DL3_CH2 (39 - I_32_OFFSET)
#define I_DL4_CH1 (40 - I_32_OFFSET)
#define I_DL4_CH2 (41 - I_32_OFFSET)
#define I_DL5_CH1 (42 - I_32_OFFSET)
#define I_DL5_CH2 (43 - I_32_OFFSET)
#define I_DL6_CH1 (44 - I_32_OFFSET)
#define I_DL6_CH2 (45 - I_32_OFFSET)
#define I_DL7_CH1 (46 - I_32_OFFSET)
#define I_DL7_CH2 (47 - I_32_OFFSET)
#define I_DL8_CH1 (48 - I_32_OFFSET)
#define I_DL8_CH2 (49 - I_32_OFFSET)
#define I_DL_4CH_CH1 (50 - I_32_OFFSET)
#define I_DL_4CH_CH2 (51 - I_32_OFFSET)
#define I_DL_4CH_CH3 (52 - I_32_OFFSET)
#define I_DL_4CH_CH4 (53 - I_32_OFFSET)
#define I_DL_24CH_CH1 (54 - I_32_OFFSET)
#define I_DL_24CH_CH2 (55 - I_32_OFFSET)
#define I_DL_24CH_CH3 (56 - I_32_OFFSET)
#define I_DL_24CH_CH4 (57 - I_32_OFFSET)
#define I_DL_24CH_CH5 (58 - I_32_OFFSET)
#define I_DL_24CH_CH6 (59 - I_32_OFFSET)
#define I_DL_24CH_CH7 (60 - I_32_OFFSET)
#define I_DL_24CH_CH8 (61 - I_32_OFFSET)
/* in port define >= 64 */
#define I_64_OFFSET 64
#define I_DL23_CH1 (78 - I_64_OFFSET)
#define I_DL23_CH2 (79 - I_64_OFFSET)
#define I_DL24_CH1 (80 - I_64_OFFSET)
#define I_DL24_CH2 (81 - I_64_OFFSET)
#define I_DL25_CH1 (82 - I_64_OFFSET)
#define I_DL25_CH2 (83 - I_64_OFFSET)
#define I_DL26_CH1 (84 - I_64_OFFSET)
#define I_DL26_CH2 (85 - I_64_OFFSET)
/* in port define >= 128 */
#define I_128_OFFSET 128
#define I_PCM_0_CAP_CH1 (130 - I_128_OFFSET)
#define I_PCM_0_CAP_CH2 (131 - I_128_OFFSET)
#define I_PCM_1_CAP_CH1 (132 - I_128_OFFSET)
#define I_PCM_1_CAP_CH2 (133 - I_128_OFFSET)
#define I_I2SIN0_CH1 (134 - I_128_OFFSET)
#define I_I2SIN0_CH2 (135 - I_128_OFFSET)
#define I_I2SIN1_CH1 (136 - I_128_OFFSET)
#define I_I2SIN1_CH2 (137 - I_128_OFFSET)
#define I_I2SIN2_CH1 (138 - I_128_OFFSET)
#define I_I2SIN2_CH2 (139 - I_128_OFFSET)
#define I_I2SIN3_CH1 (140 - I_128_OFFSET)
#define I_I2SIN3_CH2 (141 - I_128_OFFSET)
#define I_I2SIN4_CH1 (142 - I_128_OFFSET)
#define I_I2SIN4_CH2 (143 - I_128_OFFSET)
#define I_I2SIN4_CH3 (144 - I_128_OFFSET)
#define I_I2SIN4_CH4 (145 - I_128_OFFSET)
#define I_I2SIN4_CH5 (146 - I_128_OFFSET)
#define I_I2SIN4_CH6 (147 - I_128_OFFSET)
#define I_I2SIN4_CH7 (148 - I_128_OFFSET)
#define I_I2SIN4_CH8 (149 - I_128_OFFSET)
/* in port define >= 160 */
#define I_160_OFFSET 160
#define I_I2SIN6_CH1 (166 - I_160_OFFSET)
#define I_I2SIN6_CH2 (167 - I_160_OFFSET)
/* in port define >= 192 */
#define I_192_OFFSET 192
#define I_SRC_0_OUT_CH1 (198 - I_192_OFFSET)
#define I_SRC_0_OUT_CH2 (199 - I_192_OFFSET)
#define I_SRC_1_OUT_CH1 (200 - I_192_OFFSET)
#define I_SRC_1_OUT_CH2 (201 - I_192_OFFSET)
#define I_SRC_2_OUT_CH1 (202 - I_192_OFFSET)
#define I_SRC_2_OUT_CH2 (203 - I_192_OFFSET)
#define I_SRC_3_OUT_CH1 (204 - I_192_OFFSET)
#define I_SRC_3_OUT_CH2 (205 - I_192_OFFSET)
#endif

File diff suppressed because it is too large Load Diff