162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * mt7986-reg.h  --  MediaTek 7986 audio driver reg definition
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2023 MediaTek Inc.
662306a36Sopenharmony_ci * Authors: Vic Wu <vic.wu@mediatek.com>
762306a36Sopenharmony_ci *          Maso Huang <maso.huang@mediatek.com>
862306a36Sopenharmony_ci */
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci#ifndef _MT7986_REG_H_
1162306a36Sopenharmony_ci#define _MT7986_REG_H_
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define AUDIO_TOP_CON2                  0x0008
1462306a36Sopenharmony_ci#define AUDIO_TOP_CON4                  0x0010
1562306a36Sopenharmony_ci#define AUDIO_ENGEN_CON0                0x0014
1662306a36Sopenharmony_ci#define AFE_IRQ_MCU_EN                  0x0100
1762306a36Sopenharmony_ci#define AFE_IRQ_MCU_STATUS              0x0120
1862306a36Sopenharmony_ci#define AFE_IRQ_MCU_CLR                 0x0128
1962306a36Sopenharmony_ci#define AFE_IRQ0_MCU_CFG0               0x0140
2062306a36Sopenharmony_ci#define AFE_IRQ0_MCU_CFG1               0x0144
2162306a36Sopenharmony_ci#define AFE_IRQ1_MCU_CFG0               0x0148
2262306a36Sopenharmony_ci#define AFE_IRQ1_MCU_CFG1               0x014c
2362306a36Sopenharmony_ci#define AFE_IRQ2_MCU_CFG0               0x0150
2462306a36Sopenharmony_ci#define AFE_IRQ2_MCU_CFG1               0x0154
2562306a36Sopenharmony_ci#define ETDM_IN5_CON0                   0x13f0
2662306a36Sopenharmony_ci#define ETDM_IN5_CON1                   0x13f4
2762306a36Sopenharmony_ci#define ETDM_IN5_CON2                   0x13f8
2862306a36Sopenharmony_ci#define ETDM_IN5_CON3                   0x13fc
2962306a36Sopenharmony_ci#define ETDM_IN5_CON4                   0x1400
3062306a36Sopenharmony_ci#define ETDM_OUT5_CON0                  0x1570
3162306a36Sopenharmony_ci#define ETDM_OUT5_CON4                  0x1580
3262306a36Sopenharmony_ci#define ETDM_OUT5_CON5                  0x1584
3362306a36Sopenharmony_ci#define ETDM_4_7_COWORK_CON0            0x15e0
3462306a36Sopenharmony_ci#define ETDM_4_7_COWORK_CON1            0x15e4
3562306a36Sopenharmony_ci#define AFE_CONN018_1                   0x1b44
3662306a36Sopenharmony_ci#define AFE_CONN018_4                   0x1b50
3762306a36Sopenharmony_ci#define AFE_CONN019_1                   0x1b64
3862306a36Sopenharmony_ci#define AFE_CONN019_4                   0x1b70
3962306a36Sopenharmony_ci#define AFE_CONN124_1                   0x2884
4062306a36Sopenharmony_ci#define AFE_CONN124_4                   0x2890
4162306a36Sopenharmony_ci#define AFE_CONN125_1                   0x28a4
4262306a36Sopenharmony_ci#define AFE_CONN125_4                   0x28b0
4362306a36Sopenharmony_ci#define AFE_CONN_RS_0                   0x3920
4462306a36Sopenharmony_ci#define AFE_CONN_RS_3                   0x392c
4562306a36Sopenharmony_ci#define AFE_CONN_16BIT_0                0x3960
4662306a36Sopenharmony_ci#define AFE_CONN_16BIT_3                0x396c
4762306a36Sopenharmony_ci#define AFE_CONN_24BIT_0                0x3980
4862306a36Sopenharmony_ci#define AFE_CONN_24BIT_3                0x398c
4962306a36Sopenharmony_ci#define AFE_MEMIF_CON0                  0x3d98
5062306a36Sopenharmony_ci#define AFE_MEMIF_RD_MON                0x3da0
5162306a36Sopenharmony_ci#define AFE_MEMIF_WR_MON                0x3da4
5262306a36Sopenharmony_ci#define AFE_DL0_BASE_MSB                0x3e40
5362306a36Sopenharmony_ci#define AFE_DL0_BASE                    0x3e44
5462306a36Sopenharmony_ci#define AFE_DL0_CUR_MSB                 0x3e48
5562306a36Sopenharmony_ci#define AFE_DL0_CUR                     0x3e4c
5662306a36Sopenharmony_ci#define AFE_DL0_END_MSB                 0x3e50
5762306a36Sopenharmony_ci#define AFE_DL0_END                     0x3e54
5862306a36Sopenharmony_ci#define AFE_DL0_RCH_MON                 0x3e58
5962306a36Sopenharmony_ci#define AFE_DL0_LCH_MON                 0x3e5c
6062306a36Sopenharmony_ci#define AFE_DL0_CON0                    0x3e60
6162306a36Sopenharmony_ci#define AFE_VUL0_BASE_MSB               0x4220
6262306a36Sopenharmony_ci#define AFE_VUL0_BASE                   0x4224
6362306a36Sopenharmony_ci#define AFE_VUL0_CUR_MSB                0x4228
6462306a36Sopenharmony_ci#define AFE_VUL0_CUR                    0x422c
6562306a36Sopenharmony_ci#define AFE_VUL0_END_MSB                0x4230
6662306a36Sopenharmony_ci#define AFE_VUL0_END                    0x4234
6762306a36Sopenharmony_ci#define AFE_VUL0_CON0                   0x4238
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#define AFE_MAX_REGISTER AFE_VUL0_CON0
7062306a36Sopenharmony_ci#define AFE_IRQ_STATUS_BITS             0x7
7162306a36Sopenharmony_ci#define AFE_IRQ_CNT_SHIFT               0
7262306a36Sopenharmony_ci#define AFE_IRQ_CNT_MASK	        0xffffff
7362306a36Sopenharmony_ci
7462306a36Sopenharmony_ci/* AUDIO_TOP_CON2 */
7562306a36Sopenharmony_ci#define CLK_OUT5_PDN                    BIT(14)
7662306a36Sopenharmony_ci#define CLK_OUT5_PDN_MASK               BIT(14)
7762306a36Sopenharmony_ci#define CLK_IN5_PDN                     BIT(7)
7862306a36Sopenharmony_ci#define CLK_IN5_PDN_MASK                BIT(7)
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci/* AUDIO_TOP_CON4 */
8162306a36Sopenharmony_ci#define PDN_APLL_TUNER2                 BIT(12)
8262306a36Sopenharmony_ci#define PDN_APLL_TUNER2_MASK            BIT(12)
8362306a36Sopenharmony_ci
8462306a36Sopenharmony_ci/* AUDIO_ENGEN_CON0 */
8562306a36Sopenharmony_ci#define AUD_APLL2_EN                    BIT(3)
8662306a36Sopenharmony_ci#define AUD_APLL2_EN_MASK               BIT(3)
8762306a36Sopenharmony_ci#define AUD_26M_EN                      BIT(0)
8862306a36Sopenharmony_ci#define AUD_26M_EN_MASK                 BIT(0)
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci/* AFE_DL0_CON0 */
9162306a36Sopenharmony_ci#define DL0_ON_SFT                      28
9262306a36Sopenharmony_ci#define DL0_ON_MASK                     0x1
9362306a36Sopenharmony_ci#define DL0_ON_MASK_SFT                 BIT(28)
9462306a36Sopenharmony_ci#define DL0_MINLEN_SFT                  20
9562306a36Sopenharmony_ci#define DL0_MINLEN_MASK                 0xf
9662306a36Sopenharmony_ci#define DL0_MINLEN_MASK_SFT             (0xf << 20)
9762306a36Sopenharmony_ci#define DL0_MODE_SFT                    8
9862306a36Sopenharmony_ci#define DL0_MODE_MASK                   0x1f
9962306a36Sopenharmony_ci#define DL0_MODE_MASK_SFT               (0x1f << 8)
10062306a36Sopenharmony_ci#define DL0_PBUF_SIZE_SFT               5
10162306a36Sopenharmony_ci#define DL0_PBUF_SIZE_MASK              0x3
10262306a36Sopenharmony_ci#define DL0_PBUF_SIZE_MASK_SFT          (0x3 << 5)
10362306a36Sopenharmony_ci#define DL0_MONO_SFT                    4
10462306a36Sopenharmony_ci#define DL0_MONO_MASK                   0x1
10562306a36Sopenharmony_ci#define DL0_MONO_MASK_SFT               BIT(4)
10662306a36Sopenharmony_ci#define DL0_HALIGN_SFT                  2
10762306a36Sopenharmony_ci#define DL0_HALIGN_MASK                 0x1
10862306a36Sopenharmony_ci#define DL0_HALIGN_MASK_SFT             BIT(2)
10962306a36Sopenharmony_ci#define DL0_HD_MODE_SFT                 0
11062306a36Sopenharmony_ci#define DL0_HD_MODE_MASK                0x3
11162306a36Sopenharmony_ci#define DL0_HD_MODE_MASK_SFT            (0x3 << 0)
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci/* AFE_VUL0_CON0 */
11462306a36Sopenharmony_ci#define VUL0_ON_SFT                     28
11562306a36Sopenharmony_ci#define VUL0_ON_MASK                    0x1
11662306a36Sopenharmony_ci#define VUL0_ON_MASK_SFT                BIT(28)
11762306a36Sopenharmony_ci#define VUL0_MODE_SFT                   8
11862306a36Sopenharmony_ci#define VUL0_MODE_MASK                  0x1f
11962306a36Sopenharmony_ci#define VUL0_MODE_MASK_SFT              (0x1f << 8)
12062306a36Sopenharmony_ci#define VUL0_MONO_SFT                   4
12162306a36Sopenharmony_ci#define VUL0_MONO_MASK                  0x1
12262306a36Sopenharmony_ci#define VUL0_MONO_MASK_SFT              BIT(4)
12362306a36Sopenharmony_ci#define VUL0_HALIGN_SFT                 2
12462306a36Sopenharmony_ci#define VUL0_HALIGN_MASK                0x1
12562306a36Sopenharmony_ci#define VUL0_HALIGN_MASK_SFT            BIT(2)
12662306a36Sopenharmony_ci#define VUL0_HD_MODE_SFT                0
12762306a36Sopenharmony_ci#define VUL0_HD_MODE_MASK               0x3
12862306a36Sopenharmony_ci#define VUL0_HD_MODE_MASK_SFT           (0x3 << 0)
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci/* AFE_IRQ_MCU_CON */
13162306a36Sopenharmony_ci#define IRQ_MCU_MODE_SFT                4
13262306a36Sopenharmony_ci#define IRQ_MCU_MODE_MASK               0x1f
13362306a36Sopenharmony_ci#define IRQ_MCU_MODE_MASK_SFT           (0x1f << 4)
13462306a36Sopenharmony_ci#define IRQ_MCU_ON_SFT                  0
13562306a36Sopenharmony_ci#define IRQ_MCU_ON_MASK                 0x1
13662306a36Sopenharmony_ci#define IRQ_MCU_ON_MASK_SFT             BIT(0)
13762306a36Sopenharmony_ci#define IRQ0_MCU_CLR_SFT                0
13862306a36Sopenharmony_ci#define IRQ0_MCU_CLR_MASK               0x1
13962306a36Sopenharmony_ci#define IRQ0_MCU_CLR_MASK_SFT           BIT(0)
14062306a36Sopenharmony_ci#define IRQ1_MCU_CLR_SFT                1
14162306a36Sopenharmony_ci#define IRQ1_MCU_CLR_MASK               0x1
14262306a36Sopenharmony_ci#define IRQ1_MCU_CLR_MASK_SFT           BIT(1)
14362306a36Sopenharmony_ci#define IRQ2_MCU_CLR_SFT                2
14462306a36Sopenharmony_ci#define IRQ2_MCU_CLR_MASK               0x1
14562306a36Sopenharmony_ci#define IRQ2_MCU_CLR_MASK_SFT           BIT(2)
14662306a36Sopenharmony_ci
14762306a36Sopenharmony_ci/* ETDM_IN5_CON2 */
14862306a36Sopenharmony_ci#define IN_CLK_SRC(x)                   ((x) << 10)
14962306a36Sopenharmony_ci#define IN_CLK_SRC_SFT                  10
15062306a36Sopenharmony_ci#define IN_CLK_SRC_MASK                 GENMASK(12, 10)
15162306a36Sopenharmony_ci
15262306a36Sopenharmony_ci/* ETDM_IN5_CON3 */
15362306a36Sopenharmony_ci#define IN_SEL_FS(x)                    ((x) << 26)
15462306a36Sopenharmony_ci#define IN_SEL_FS_SFT                   26
15562306a36Sopenharmony_ci#define IN_SEL_FS_MASK                  GENMASK(30, 26)
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci/* ETDM_IN5_CON4 */
15862306a36Sopenharmony_ci#define IN_RELATCH(x)                   ((x) << 20)
15962306a36Sopenharmony_ci#define IN_RELATCH_SFT                  20
16062306a36Sopenharmony_ci#define IN_RELATCH_MASK                 GENMASK(24, 20)
16162306a36Sopenharmony_ci#define IN_CLK_INV                      BIT(18)
16262306a36Sopenharmony_ci#define IN_CLK_INV_MASK                 BIT(18)
16362306a36Sopenharmony_ci
16462306a36Sopenharmony_ci/* ETDM_IN5_CON0 & ETDM_OUT5_CON0 */
16562306a36Sopenharmony_ci#define RELATCH_SRC_MASK                GENMASK(30, 28)
16662306a36Sopenharmony_ci#define ETDM_CH_NUM_MASK                GENMASK(27, 23)
16762306a36Sopenharmony_ci#define ETDM_WRD_LEN_MASK               GENMASK(20, 16)
16862306a36Sopenharmony_ci#define ETDM_BIT_LEN_MASK               GENMASK(15, 11)
16962306a36Sopenharmony_ci#define ETDM_FMT_MASK                   GENMASK(8, 6)
17062306a36Sopenharmony_ci#define ETDM_SYNC                       BIT(1)
17162306a36Sopenharmony_ci#define ETDM_SYNC_MASK                  BIT(1)
17262306a36Sopenharmony_ci#define ETDM_EN                         BIT(0)
17362306a36Sopenharmony_ci#define ETDM_EN_MASK                    BIT(0)
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci/* ETDM_OUT5_CON4 */
17662306a36Sopenharmony_ci#define OUT_RELATCH(x)                  ((x) << 24)
17762306a36Sopenharmony_ci#define OUT_RELATCH_SFT                 24
17862306a36Sopenharmony_ci#define OUT_RELATCH_MASK                GENMASK(28, 24)
17962306a36Sopenharmony_ci#define OUT_CLK_SRC(x)                  ((x) << 6)
18062306a36Sopenharmony_ci#define OUT_CLK_SRC_SFT                 6
18162306a36Sopenharmony_ci#define OUT_CLK_SRC_MASK                GENMASK(8, 6)
18262306a36Sopenharmony_ci#define OUT_SEL_FS(x)                   (x)
18362306a36Sopenharmony_ci#define OUT_SEL_FS_SFT                  0
18462306a36Sopenharmony_ci#define OUT_SEL_FS_MASK                 GENMASK(4, 0)
18562306a36Sopenharmony_ci
18662306a36Sopenharmony_ci/* ETDM_OUT5_CON5 */
18762306a36Sopenharmony_ci#define ETDM_CLK_DIV                    BIT(12)
18862306a36Sopenharmony_ci#define ETDM_CLK_DIV_MASK               BIT(12)
18962306a36Sopenharmony_ci#define OUT_CLK_INV                     BIT(9)
19062306a36Sopenharmony_ci#define OUT_CLK_INV_MASK                BIT(9)
19162306a36Sopenharmony_ci
19262306a36Sopenharmony_ci/* ETDM_4_7_COWORK_CON0 */
19362306a36Sopenharmony_ci#define OUT_SEL(x)                      ((x) << 12)
19462306a36Sopenharmony_ci#define OUT_SEL_SFT                     12
19562306a36Sopenharmony_ci#define OUT_SEL_MASK                    GENMASK(15, 12)
19662306a36Sopenharmony_ci#endif
197