162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * mt2701-reg.h  --  Mediatek 2701 audio driver reg definition
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2016 MediaTek Inc.
662306a36Sopenharmony_ci * Author: Garlic Tseng <garlic.tseng@mediatek.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef _MT2701_REG_H_
1062306a36Sopenharmony_ci#define _MT2701_REG_H_
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#define AUDIO_TOP_CON0 0x0000
1362306a36Sopenharmony_ci#define AUDIO_TOP_CON4 0x0010
1462306a36Sopenharmony_ci#define AUDIO_TOP_CON5 0x0014
1562306a36Sopenharmony_ci#define AFE_DAIBT_CON0 0x001c
1662306a36Sopenharmony_ci#define AFE_MRGIF_CON 0x003c
1762306a36Sopenharmony_ci#define ASMI_TIMING_CON1 0x0100
1862306a36Sopenharmony_ci#define ASMO_TIMING_CON1 0x0104
1962306a36Sopenharmony_ci#define PWR1_ASM_CON1 0x0108
2062306a36Sopenharmony_ci#define ASYS_TOP_CON 0x0600
2162306a36Sopenharmony_ci#define ASYS_I2SIN1_CON 0x0604
2262306a36Sopenharmony_ci#define ASYS_I2SIN2_CON 0x0608
2362306a36Sopenharmony_ci#define ASYS_I2SIN3_CON 0x060c
2462306a36Sopenharmony_ci#define ASYS_I2SIN4_CON 0x0610
2562306a36Sopenharmony_ci#define ASYS_I2SIN5_CON 0x0614
2662306a36Sopenharmony_ci#define ASYS_I2SO1_CON 0x061C
2762306a36Sopenharmony_ci#define ASYS_I2SO2_CON 0x0620
2862306a36Sopenharmony_ci#define ASYS_I2SO3_CON 0x0624
2962306a36Sopenharmony_ci#define ASYS_I2SO4_CON 0x0628
3062306a36Sopenharmony_ci#define ASYS_I2SO5_CON 0x062c
3162306a36Sopenharmony_ci#define PWR2_TOP_CON 0x0634
3262306a36Sopenharmony_ci#define AFE_CONN0 0x06c0
3362306a36Sopenharmony_ci#define AFE_CONN1 0x06c4
3462306a36Sopenharmony_ci#define AFE_CONN2 0x06c8
3562306a36Sopenharmony_ci#define AFE_CONN3 0x06cc
3662306a36Sopenharmony_ci#define AFE_CONN14 0x06f8
3762306a36Sopenharmony_ci#define AFE_CONN15 0x06fc
3862306a36Sopenharmony_ci#define AFE_CONN16 0x0700
3962306a36Sopenharmony_ci#define AFE_CONN17 0x0704
4062306a36Sopenharmony_ci#define AFE_CONN18 0x0708
4162306a36Sopenharmony_ci#define AFE_CONN19 0x070c
4262306a36Sopenharmony_ci#define AFE_CONN20 0x0710
4362306a36Sopenharmony_ci#define AFE_CONN21 0x0714
4462306a36Sopenharmony_ci#define AFE_CONN22 0x0718
4562306a36Sopenharmony_ci#define AFE_CONN23 0x071c
4662306a36Sopenharmony_ci#define AFE_CONN24 0x0720
4762306a36Sopenharmony_ci#define AFE_CONN41 0x0764
4862306a36Sopenharmony_ci#define ASYS_IRQ1_CON 0x0780
4962306a36Sopenharmony_ci#define ASYS_IRQ2_CON 0x0784
5062306a36Sopenharmony_ci#define ASYS_IRQ3_CON 0x0788
5162306a36Sopenharmony_ci#define ASYS_IRQ_CLR 0x07c0
5262306a36Sopenharmony_ci#define ASYS_IRQ_STATUS 0x07c4
5362306a36Sopenharmony_ci#define PWR2_ASM_CON1 0x1070
5462306a36Sopenharmony_ci#define AFE_DAC_CON0 0x1200
5562306a36Sopenharmony_ci#define AFE_DAC_CON1 0x1204
5662306a36Sopenharmony_ci#define AFE_DAC_CON2 0x1208
5762306a36Sopenharmony_ci#define AFE_DAC_CON3 0x120c
5862306a36Sopenharmony_ci#define AFE_DAC_CON4 0x1210
5962306a36Sopenharmony_ci#define AFE_MEMIF_HD_CON1 0x121c
6062306a36Sopenharmony_ci#define AFE_MEMIF_PBUF_SIZE 0x1238
6162306a36Sopenharmony_ci#define AFE_MEMIF_HD_CON0 0x123c
6262306a36Sopenharmony_ci#define AFE_DL1_BASE 0x1240
6362306a36Sopenharmony_ci#define AFE_DL1_CUR 0x1244
6462306a36Sopenharmony_ci#define AFE_DL2_BASE 0x1250
6562306a36Sopenharmony_ci#define AFE_DL2_CUR 0x1254
6662306a36Sopenharmony_ci#define AFE_DL3_BASE 0x1260
6762306a36Sopenharmony_ci#define AFE_DL3_CUR 0x1264
6862306a36Sopenharmony_ci#define AFE_DL4_BASE 0x1270
6962306a36Sopenharmony_ci#define AFE_DL4_CUR 0x1274
7062306a36Sopenharmony_ci#define AFE_DL5_BASE 0x1280
7162306a36Sopenharmony_ci#define AFE_DL5_CUR 0x1284
7262306a36Sopenharmony_ci#define AFE_DLMCH_BASE 0x12a0
7362306a36Sopenharmony_ci#define AFE_DLMCH_CUR 0x12a4
7462306a36Sopenharmony_ci#define AFE_ARB1_BASE 0x12b0
7562306a36Sopenharmony_ci#define AFE_ARB1_CUR 0x12b4
7662306a36Sopenharmony_ci#define AFE_VUL_BASE 0x1300
7762306a36Sopenharmony_ci#define AFE_VUL_CUR 0x130c
7862306a36Sopenharmony_ci#define AFE_UL2_BASE 0x1310
7962306a36Sopenharmony_ci#define AFE_UL2_END 0x1318
8062306a36Sopenharmony_ci#define AFE_UL2_CUR 0x131c
8162306a36Sopenharmony_ci#define AFE_UL3_BASE 0x1320
8262306a36Sopenharmony_ci#define AFE_UL3_END 0x1328
8362306a36Sopenharmony_ci#define AFE_UL3_CUR 0x132c
8462306a36Sopenharmony_ci#define AFE_UL4_BASE 0x1330
8562306a36Sopenharmony_ci#define AFE_UL4_END 0x1338
8662306a36Sopenharmony_ci#define AFE_UL4_CUR 0x133c
8762306a36Sopenharmony_ci#define AFE_UL5_BASE 0x1340
8862306a36Sopenharmony_ci#define AFE_UL5_END 0x1348
8962306a36Sopenharmony_ci#define AFE_UL5_CUR 0x134c
9062306a36Sopenharmony_ci#define AFE_DAI_BASE 0x1370
9162306a36Sopenharmony_ci#define AFE_DAI_CUR 0x137c
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci/* AFE_DAIBT_CON0 (0x001c) */
9462306a36Sopenharmony_ci#define AFE_DAIBT_CON0_DAIBT_EN		(0x1 << 0)
9562306a36Sopenharmony_ci#define AFE_DAIBT_CON0_BT_FUNC_EN	(0x1 << 1)
9662306a36Sopenharmony_ci#define AFE_DAIBT_CON0_BT_FUNC_RDY	(0x1 << 3)
9762306a36Sopenharmony_ci#define AFE_DAIBT_CON0_BT_WIDE_MODE_EN	(0x1 << 9)
9862306a36Sopenharmony_ci#define AFE_DAIBT_CON0_MRG_USE		(0x1 << 12)
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci/* PWR1_ASM_CON1 (0x0108) */
10162306a36Sopenharmony_ci#define PWR1_ASM_CON1_INIT_VAL		(0x492)
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci/* AFE_MRGIF_CON (0x003c) */
10462306a36Sopenharmony_ci#define AFE_MRGIF_CON_MRG_EN		(0x1 << 0)
10562306a36Sopenharmony_ci#define AFE_MRGIF_CON_MRG_I2S_EN	(0x1 << 16)
10662306a36Sopenharmony_ci#define AFE_MRGIF_CON_I2S_MODE_MASK	(0xf << 20)
10762306a36Sopenharmony_ci#define AFE_MRGIF_CON_I2S_MODE_32K	(0x4 << 20)
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci/* ASYS_TOP_CON (0x0600) */
11062306a36Sopenharmony_ci#define ASYS_TOP_CON_ASYS_TIMING_ON		(0x3 << 0)
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci/* PWR2_ASM_CON1 (0x1070) */
11362306a36Sopenharmony_ci#define PWR2_ASM_CON1_INIT_VAL		(0x492492)
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci/* AFE_DAC_CON0 (0x1200) */
11662306a36Sopenharmony_ci#define AFE_DAC_CON0_AFE_ON		(0x1 << 0)
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci/* AFE_MEMIF_PBUF_SIZE (0x1238) */
11962306a36Sopenharmony_ci#define AFE_MEMIF_PBUF_SIZE_DLM_MASK		(0x1 << 29)
12062306a36Sopenharmony_ci#define AFE_MEMIF_PBUF_SIZE_PAIR_INTERLEAVE	(0x0 << 29)
12162306a36Sopenharmony_ci#define AFE_MEMIF_PBUF_SIZE_FULL_INTERLEAVE	(0x1 << 29)
12262306a36Sopenharmony_ci#define DLMCH_BIT_WIDTH_MASK			(0x1 << 28)
12362306a36Sopenharmony_ci#define AFE_MEMIF_PBUF_SIZE_DLM_CH_MASK		(0xf << 24)
12462306a36Sopenharmony_ci#define AFE_MEMIF_PBUF_SIZE_DLM_CH(x)		((x) << 24)
12562306a36Sopenharmony_ci#define AFE_MEMIF_PBUF_SIZE_DLM_BYTE_MASK	(0x3 << 12)
12662306a36Sopenharmony_ci#define AFE_MEMIF_PBUF_SIZE_DLM_32BYTES		(0x1 << 12)
12762306a36Sopenharmony_ci
12862306a36Sopenharmony_ci/* I2S in/out register bit control */
12962306a36Sopenharmony_ci#define ASYS_I2S_CON_FS			(0x1f << 8)
13062306a36Sopenharmony_ci#define ASYS_I2S_CON_FS_SET(x)		((x) << 8)
13162306a36Sopenharmony_ci#define ASYS_I2S_CON_RESET		(0x1 << 30)
13262306a36Sopenharmony_ci#define ASYS_I2S_CON_I2S_EN		(0x1 << 0)
13362306a36Sopenharmony_ci#define ASYS_I2S_CON_ONE_HEART_MODE	(0x1 << 16)
13462306a36Sopenharmony_ci#define ASYS_I2S_CON_I2S_COUPLE_MODE	(0x1 << 17)
13562306a36Sopenharmony_ci/* 0:EIAJ 1:I2S */
13662306a36Sopenharmony_ci#define ASYS_I2S_CON_I2S_MODE		(0x1 << 3)
13762306a36Sopenharmony_ci#define ASYS_I2S_CON_WIDE_MODE		(0x1 << 1)
13862306a36Sopenharmony_ci#define ASYS_I2S_CON_WIDE_MODE_SET(x)	((x) << 1)
13962306a36Sopenharmony_ci#define ASYS_I2S_IN_PHASE_FIX		(0x1 << 31)
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ci#endif
142