162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * rt5670.h  --  RT5670 ALSA SoC audio driver
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright 2014 Realtek Microelectronics
662306a36Sopenharmony_ci * Author: Bard Liao <bardliao@realtek.com>
762306a36Sopenharmony_ci */
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#ifndef __RT5670_H__
1062306a36Sopenharmony_ci#define __RT5670_H__
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci/* Info */
1362306a36Sopenharmony_ci#define RT5670_RESET				0x00
1462306a36Sopenharmony_ci#define RT5670_VENDOR_ID			0xfd
1562306a36Sopenharmony_ci#define RT5670_VENDOR_ID1			0xfe
1662306a36Sopenharmony_ci#define RT5670_VENDOR_ID2			0xff
1762306a36Sopenharmony_ci/*  I/O - Output */
1862306a36Sopenharmony_ci#define RT5670_HP_VOL				0x02
1962306a36Sopenharmony_ci#define RT5670_LOUT1				0x03
2062306a36Sopenharmony_ci/* I/O - Input */
2162306a36Sopenharmony_ci#define RT5670_CJ_CTRL1				0x0a
2262306a36Sopenharmony_ci#define RT5670_CJ_CTRL2				0x0b
2362306a36Sopenharmony_ci#define RT5670_CJ_CTRL3				0x0c
2462306a36Sopenharmony_ci#define RT5670_IN2				0x0e
2562306a36Sopenharmony_ci#define RT5670_INL1_INR1_VOL			0x0f
2662306a36Sopenharmony_ci/* I/O - ADC/DAC/DMIC */
2762306a36Sopenharmony_ci#define RT5670_DAC1_DIG_VOL			0x19
2862306a36Sopenharmony_ci#define RT5670_DAC2_DIG_VOL			0x1a
2962306a36Sopenharmony_ci#define RT5670_DAC_CTRL				0x1b
3062306a36Sopenharmony_ci#define RT5670_STO1_ADC_DIG_VOL			0x1c
3162306a36Sopenharmony_ci#define RT5670_MONO_ADC_DIG_VOL			0x1d
3262306a36Sopenharmony_ci#define RT5670_ADC_BST_VOL1			0x1e
3362306a36Sopenharmony_ci#define RT5670_STO2_ADC_DIG_VOL			0x1f
3462306a36Sopenharmony_ci/* Mixer - D-D */
3562306a36Sopenharmony_ci#define RT5670_ADC_BST_VOL2			0x20
3662306a36Sopenharmony_ci#define RT5670_STO2_ADC_MIXER			0x26
3762306a36Sopenharmony_ci#define RT5670_STO1_ADC_MIXER			0x27
3862306a36Sopenharmony_ci#define RT5670_MONO_ADC_MIXER			0x28
3962306a36Sopenharmony_ci#define RT5670_AD_DA_MIXER			0x29
4062306a36Sopenharmony_ci#define RT5670_STO_DAC_MIXER			0x2a
4162306a36Sopenharmony_ci#define RT5670_DD_MIXER				0x2b
4262306a36Sopenharmony_ci#define RT5670_DIG_MIXER			0x2c
4362306a36Sopenharmony_ci#define RT5670_DSP_PATH1			0x2d
4462306a36Sopenharmony_ci#define RT5670_DSP_PATH2			0x2e
4562306a36Sopenharmony_ci#define RT5670_DIG_INF1_DATA			0x2f
4662306a36Sopenharmony_ci#define RT5670_DIG_INF2_DATA			0x30
4762306a36Sopenharmony_ci/* Mixer - PDM */
4862306a36Sopenharmony_ci#define RT5670_PDM_OUT_CTRL			0x31
4962306a36Sopenharmony_ci#define RT5670_PDM_DATA_CTRL1			0x32
5062306a36Sopenharmony_ci#define RT5670_PDM1_DATA_CTRL2			0x33
5162306a36Sopenharmony_ci#define RT5670_PDM1_DATA_CTRL3			0x34
5262306a36Sopenharmony_ci#define RT5670_PDM1_DATA_CTRL4			0x35
5362306a36Sopenharmony_ci#define RT5670_PDM2_DATA_CTRL2			0x36
5462306a36Sopenharmony_ci#define RT5670_PDM2_DATA_CTRL3			0x37
5562306a36Sopenharmony_ci#define RT5670_PDM2_DATA_CTRL4			0x38
5662306a36Sopenharmony_ci/* Mixer - ADC */
5762306a36Sopenharmony_ci#define RT5670_REC_L1_MIXER			0x3b
5862306a36Sopenharmony_ci#define RT5670_REC_L2_MIXER			0x3c
5962306a36Sopenharmony_ci#define RT5670_REC_R1_MIXER			0x3d
6062306a36Sopenharmony_ci#define RT5670_REC_R2_MIXER			0x3e
6162306a36Sopenharmony_ci/* Mixer - DAC */
6262306a36Sopenharmony_ci#define RT5670_HPO_MIXER			0x45
6362306a36Sopenharmony_ci#define RT5670_MONO_MIXER			0x4c
6462306a36Sopenharmony_ci#define RT5670_OUT_L1_MIXER			0x4f
6562306a36Sopenharmony_ci#define RT5670_OUT_R1_MIXER			0x52
6662306a36Sopenharmony_ci#define RT5670_LOUT_MIXER			0x53
6762306a36Sopenharmony_ci/* Power */
6862306a36Sopenharmony_ci#define RT5670_PWR_DIG1				0x61
6962306a36Sopenharmony_ci#define RT5670_PWR_DIG2				0x62
7062306a36Sopenharmony_ci#define RT5670_PWR_ANLG1			0x63
7162306a36Sopenharmony_ci#define RT5670_PWR_ANLG2			0x64
7262306a36Sopenharmony_ci#define RT5670_PWR_MIXER			0x65
7362306a36Sopenharmony_ci#define RT5670_PWR_VOL				0x66
7462306a36Sopenharmony_ci/* Private Register Control */
7562306a36Sopenharmony_ci#define RT5670_PRIV_INDEX			0x6a
7662306a36Sopenharmony_ci#define RT5670_PRIV_DATA			0x6c
7762306a36Sopenharmony_ci/* Format - ADC/DAC */
7862306a36Sopenharmony_ci#define RT5670_I2S4_SDP				0x6f
7962306a36Sopenharmony_ci#define RT5670_I2S1_SDP				0x70
8062306a36Sopenharmony_ci#define RT5670_I2S2_SDP				0x71
8162306a36Sopenharmony_ci#define RT5670_I2S3_SDP				0x72
8262306a36Sopenharmony_ci#define RT5670_ADDA_CLK1			0x73
8362306a36Sopenharmony_ci#define RT5670_ADDA_CLK2			0x74
8462306a36Sopenharmony_ci#define RT5670_DMIC_CTRL1			0x75
8562306a36Sopenharmony_ci#define RT5670_DMIC_CTRL2			0x76
8662306a36Sopenharmony_ci/* Format - TDM Control */
8762306a36Sopenharmony_ci#define RT5670_TDM_CTRL_1			0x77
8862306a36Sopenharmony_ci#define RT5670_TDM_CTRL_2			0x78
8962306a36Sopenharmony_ci#define RT5670_TDM_CTRL_3			0x79
9062306a36Sopenharmony_ci
9162306a36Sopenharmony_ci/* Function - Analog */
9262306a36Sopenharmony_ci#define RT5670_DSP_CLK				0x7f
9362306a36Sopenharmony_ci#define RT5670_GLB_CLK				0x80
9462306a36Sopenharmony_ci#define RT5670_PLL_CTRL1			0x81
9562306a36Sopenharmony_ci#define RT5670_PLL_CTRL2			0x82
9662306a36Sopenharmony_ci#define RT5670_ASRC_1				0x83
9762306a36Sopenharmony_ci#define RT5670_ASRC_2				0x84
9862306a36Sopenharmony_ci#define RT5670_ASRC_3				0x85
9962306a36Sopenharmony_ci#define RT5670_ASRC_4				0x86
10062306a36Sopenharmony_ci#define RT5670_ASRC_5				0x87
10162306a36Sopenharmony_ci#define RT5670_ASRC_7				0x89
10262306a36Sopenharmony_ci#define RT5670_ASRC_8				0x8a
10362306a36Sopenharmony_ci#define RT5670_ASRC_9				0x8b
10462306a36Sopenharmony_ci#define RT5670_ASRC_10				0x8c
10562306a36Sopenharmony_ci#define RT5670_ASRC_11				0x8d
10662306a36Sopenharmony_ci#define RT5670_DEPOP_M1				0x8e
10762306a36Sopenharmony_ci#define RT5670_DEPOP_M2				0x8f
10862306a36Sopenharmony_ci#define RT5670_DEPOP_M3				0x90
10962306a36Sopenharmony_ci#define RT5670_CHARGE_PUMP			0x91
11062306a36Sopenharmony_ci#define RT5670_MICBIAS				0x93
11162306a36Sopenharmony_ci#define RT5670_A_JD_CTRL1			0x94
11262306a36Sopenharmony_ci#define RT5670_A_JD_CTRL2			0x95
11362306a36Sopenharmony_ci#define RT5670_ASRC_12				0x97
11462306a36Sopenharmony_ci#define RT5670_ASRC_13				0x98
11562306a36Sopenharmony_ci#define RT5670_ASRC_14				0x99
11662306a36Sopenharmony_ci#define RT5670_VAD_CTRL1			0x9a
11762306a36Sopenharmony_ci#define RT5670_VAD_CTRL2			0x9b
11862306a36Sopenharmony_ci#define RT5670_VAD_CTRL3			0x9c
11962306a36Sopenharmony_ci#define RT5670_VAD_CTRL4			0x9d
12062306a36Sopenharmony_ci#define RT5670_VAD_CTRL5			0x9e
12162306a36Sopenharmony_ci/* Function - Digital */
12262306a36Sopenharmony_ci#define RT5670_ADC_EQ_CTRL1			0xae
12362306a36Sopenharmony_ci#define RT5670_ADC_EQ_CTRL2			0xaf
12462306a36Sopenharmony_ci#define RT5670_EQ_CTRL1				0xb0
12562306a36Sopenharmony_ci#define RT5670_EQ_CTRL2				0xb1
12662306a36Sopenharmony_ci#define RT5670_ALC_DRC_CTRL1			0xb2
12762306a36Sopenharmony_ci#define RT5670_ALC_DRC_CTRL2			0xb3
12862306a36Sopenharmony_ci#define RT5670_ALC_CTRL_1			0xb4
12962306a36Sopenharmony_ci#define RT5670_ALC_CTRL_2			0xb5
13062306a36Sopenharmony_ci#define RT5670_ALC_CTRL_3			0xb6
13162306a36Sopenharmony_ci#define RT5670_ALC_CTRL_4			0xb7
13262306a36Sopenharmony_ci#define RT5670_JD_CTRL				0xbb
13362306a36Sopenharmony_ci#define RT5670_IRQ_CTRL1			0xbd
13462306a36Sopenharmony_ci#define RT5670_IRQ_CTRL2			0xbe
13562306a36Sopenharmony_ci#define RT5670_INT_IRQ_ST			0xbf
13662306a36Sopenharmony_ci#define RT5670_GPIO_CTRL1			0xc0
13762306a36Sopenharmony_ci#define RT5670_GPIO_CTRL2			0xc1
13862306a36Sopenharmony_ci#define RT5670_GPIO_CTRL3			0xc2
13962306a36Sopenharmony_ci#define RT5670_SCRABBLE_FUN			0xcd
14062306a36Sopenharmony_ci#define RT5670_SCRABBLE_CTRL			0xce
14162306a36Sopenharmony_ci#define RT5670_BASE_BACK			0xcf
14262306a36Sopenharmony_ci#define RT5670_MP3_PLUS1			0xd0
14362306a36Sopenharmony_ci#define RT5670_MP3_PLUS2			0xd1
14462306a36Sopenharmony_ci#define RT5670_ADJ_HPF1				0xd3
14562306a36Sopenharmony_ci#define RT5670_ADJ_HPF2				0xd4
14662306a36Sopenharmony_ci#define RT5670_HP_CALIB_AMP_DET			0xd6
14762306a36Sopenharmony_ci#define RT5670_SV_ZCD1				0xd9
14862306a36Sopenharmony_ci#define RT5670_SV_ZCD2				0xda
14962306a36Sopenharmony_ci#define RT5670_IL_CMD				0xdb
15062306a36Sopenharmony_ci#define RT5670_IL_CMD2				0xdc
15162306a36Sopenharmony_ci#define RT5670_IL_CMD3				0xdd
15262306a36Sopenharmony_ci#define RT5670_DRC_HL_CTRL1			0xe6
15362306a36Sopenharmony_ci#define RT5670_DRC_HL_CTRL2			0xe7
15462306a36Sopenharmony_ci#define RT5670_ADC_MONO_HP_CTRL1		0xec
15562306a36Sopenharmony_ci#define RT5670_ADC_MONO_HP_CTRL2		0xed
15662306a36Sopenharmony_ci#define RT5670_ADC_STO2_HP_CTRL1		0xee
15762306a36Sopenharmony_ci#define RT5670_ADC_STO2_HP_CTRL2		0xef
15862306a36Sopenharmony_ci#define RT5670_JD_CTRL3				0xf8
15962306a36Sopenharmony_ci#define RT5670_JD_CTRL4				0xf9
16062306a36Sopenharmony_ci/* General Control */
16162306a36Sopenharmony_ci#define RT5670_DIG_MISC				0xfa
16262306a36Sopenharmony_ci#define RT5670_GEN_CTRL2			0xfb
16362306a36Sopenharmony_ci#define RT5670_GEN_CTRL3			0xfc
16462306a36Sopenharmony_ci
16562306a36Sopenharmony_ci
16662306a36Sopenharmony_ci/* Index of Codec Private Register definition */
16762306a36Sopenharmony_ci#define RT5670_DIG_VOL				0x00
16862306a36Sopenharmony_ci#define RT5670_PR_ALC_CTRL_1			0x01
16962306a36Sopenharmony_ci#define RT5670_PR_ALC_CTRL_2			0x02
17062306a36Sopenharmony_ci#define RT5670_PR_ALC_CTRL_3			0x03
17162306a36Sopenharmony_ci#define RT5670_PR_ALC_CTRL_4			0x04
17262306a36Sopenharmony_ci#define RT5670_PR_ALC_CTRL_5			0x05
17362306a36Sopenharmony_ci#define RT5670_PR_ALC_CTRL_6			0x06
17462306a36Sopenharmony_ci#define RT5670_BIAS_CUR1			0x12
17562306a36Sopenharmony_ci#define RT5670_BIAS_CUR3			0x14
17662306a36Sopenharmony_ci#define RT5670_CLSD_INT_REG1			0x1c
17762306a36Sopenharmony_ci#define RT5670_MAMP_INT_REG2			0x37
17862306a36Sopenharmony_ci#define RT5670_CHOP_DAC_ADC			0x3d
17962306a36Sopenharmony_ci#define RT5670_MIXER_INT_REG			0x3f
18062306a36Sopenharmony_ci#define RT5670_3D_SPK				0x63
18162306a36Sopenharmony_ci#define RT5670_WND_1				0x6c
18262306a36Sopenharmony_ci#define RT5670_WND_2				0x6d
18362306a36Sopenharmony_ci#define RT5670_WND_3				0x6e
18462306a36Sopenharmony_ci#define RT5670_WND_4				0x6f
18562306a36Sopenharmony_ci#define RT5670_WND_5				0x70
18662306a36Sopenharmony_ci#define RT5670_WND_8				0x73
18762306a36Sopenharmony_ci#define RT5670_DIP_SPK_INF			0x75
18862306a36Sopenharmony_ci#define RT5670_HP_DCC_INT1			0x77
18962306a36Sopenharmony_ci#define RT5670_EQ_BW_LOP			0xa0
19062306a36Sopenharmony_ci#define RT5670_EQ_GN_LOP			0xa1
19162306a36Sopenharmony_ci#define RT5670_EQ_FC_BP1			0xa2
19262306a36Sopenharmony_ci#define RT5670_EQ_BW_BP1			0xa3
19362306a36Sopenharmony_ci#define RT5670_EQ_GN_BP1			0xa4
19462306a36Sopenharmony_ci#define RT5670_EQ_FC_BP2			0xa5
19562306a36Sopenharmony_ci#define RT5670_EQ_BW_BP2			0xa6
19662306a36Sopenharmony_ci#define RT5670_EQ_GN_BP2			0xa7
19762306a36Sopenharmony_ci#define RT5670_EQ_FC_BP3			0xa8
19862306a36Sopenharmony_ci#define RT5670_EQ_BW_BP3			0xa9
19962306a36Sopenharmony_ci#define RT5670_EQ_GN_BP3			0xaa
20062306a36Sopenharmony_ci#define RT5670_EQ_FC_BP4			0xab
20162306a36Sopenharmony_ci#define RT5670_EQ_BW_BP4			0xac
20262306a36Sopenharmony_ci#define RT5670_EQ_GN_BP4			0xad
20362306a36Sopenharmony_ci#define RT5670_EQ_FC_HIP1			0xae
20462306a36Sopenharmony_ci#define RT5670_EQ_GN_HIP1			0xaf
20562306a36Sopenharmony_ci#define RT5670_EQ_FC_HIP2			0xb0
20662306a36Sopenharmony_ci#define RT5670_EQ_BW_HIP2			0xb1
20762306a36Sopenharmony_ci#define RT5670_EQ_GN_HIP2			0xb2
20862306a36Sopenharmony_ci#define RT5670_EQ_PRE_VOL			0xb3
20962306a36Sopenharmony_ci#define RT5670_EQ_PST_VOL			0xb4
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci/* global definition */
21362306a36Sopenharmony_ci#define RT5670_L_MUTE				(0x1 << 15)
21462306a36Sopenharmony_ci#define RT5670_L_MUTE_SFT			15
21562306a36Sopenharmony_ci#define RT5670_R_MUTE				(0x1 << 7)
21662306a36Sopenharmony_ci#define RT5670_R_MUTE_SFT			7
21762306a36Sopenharmony_ci#define RT5670_L_VOL_MASK			(0x3f << 8)
21862306a36Sopenharmony_ci#define RT5670_L_VOL_SFT			8
21962306a36Sopenharmony_ci#define RT5670_R_VOL_MASK			(0x3f)
22062306a36Sopenharmony_ci#define RT5670_R_VOL_SFT			0
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci/* SW Reset & Device ID (0x00) */
22362306a36Sopenharmony_ci#define RT5670_ID_MASK				(0x3 << 1)
22462306a36Sopenharmony_ci#define RT5670_ID_5670				(0x0 << 1)
22562306a36Sopenharmony_ci#define RT5670_ID_5672				(0x1 << 1)
22662306a36Sopenharmony_ci#define RT5670_ID_5671				(0x2 << 1)
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci/* Combo Jack Control 1 (0x0a) */
22962306a36Sopenharmony_ci#define RT5670_CBJ_BST1_MASK			(0xf << 12)
23062306a36Sopenharmony_ci#define RT5670_CBJ_BST1_SFT			(12)
23162306a36Sopenharmony_ci#define RT5670_CBJ_JD_HP_EN			(0x1 << 9)
23262306a36Sopenharmony_ci#define RT5670_CBJ_JD_MIC_EN			(0x1 << 8)
23362306a36Sopenharmony_ci#define RT5670_CBJ_BST1_EN			(0x1 << 2)
23462306a36Sopenharmony_ci
23562306a36Sopenharmony_ci/* Combo Jack Control 1 (0x0b) */
23662306a36Sopenharmony_ci#define RT5670_CBJ_MN_JD			(0x1 << 12)
23762306a36Sopenharmony_ci#define RT5670_CAPLESS_EN			(0x1 << 11)
23862306a36Sopenharmony_ci#define RT5670_CBJ_DET_MODE			(0x1 << 7)
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci/* IN2 Control (0x0e) */
24162306a36Sopenharmony_ci#define RT5670_BST_MASK1			(0xf<<12)
24262306a36Sopenharmony_ci#define RT5670_BST_SFT1				12
24362306a36Sopenharmony_ci#define RT5670_BST_MASK2			(0xf<<8)
24462306a36Sopenharmony_ci#define RT5670_BST_SFT2				8
24562306a36Sopenharmony_ci#define RT5670_IN_DF1				(0x1 << 7)
24662306a36Sopenharmony_ci#define RT5670_IN_SFT1				7
24762306a36Sopenharmony_ci#define RT5670_IN_DF2				(0x1 << 6)
24862306a36Sopenharmony_ci#define RT5670_IN_SFT2				6
24962306a36Sopenharmony_ci
25062306a36Sopenharmony_ci/* INL and INR Volume Control (0x0f) */
25162306a36Sopenharmony_ci#define RT5670_INL_SEL_MASK			(0x1 << 15)
25262306a36Sopenharmony_ci#define RT5670_INL_SEL_SFT			15
25362306a36Sopenharmony_ci#define RT5670_INL_SEL_IN4P			(0x0 << 15)
25462306a36Sopenharmony_ci#define RT5670_INL_SEL_MONOP			(0x1 << 15)
25562306a36Sopenharmony_ci#define RT5670_INL_VOL_MASK			(0x1f << 8)
25662306a36Sopenharmony_ci#define RT5670_INL_VOL_SFT			8
25762306a36Sopenharmony_ci#define RT5670_INR_SEL_MASK			(0x1 << 7)
25862306a36Sopenharmony_ci#define RT5670_INR_SEL_SFT			7
25962306a36Sopenharmony_ci#define RT5670_INR_SEL_IN4N			(0x0 << 7)
26062306a36Sopenharmony_ci#define RT5670_INR_SEL_MONON			(0x1 << 7)
26162306a36Sopenharmony_ci#define RT5670_INR_VOL_MASK			(0x1f)
26262306a36Sopenharmony_ci#define RT5670_INR_VOL_SFT			0
26362306a36Sopenharmony_ci
26462306a36Sopenharmony_ci/* Sidetone Control (0x18) */
26562306a36Sopenharmony_ci#define RT5670_ST_SEL_MASK			(0x7 << 9)
26662306a36Sopenharmony_ci#define RT5670_ST_SEL_SFT			9
26762306a36Sopenharmony_ci#define RT5670_M_ST_DACR2			(0x1 << 8)
26862306a36Sopenharmony_ci#define RT5670_M_ST_DACR2_SFT			8
26962306a36Sopenharmony_ci#define RT5670_M_ST_DACL2			(0x1 << 7)
27062306a36Sopenharmony_ci#define RT5670_M_ST_DACL2_SFT			7
27162306a36Sopenharmony_ci#define RT5670_ST_EN				(0x1 << 6)
27262306a36Sopenharmony_ci#define RT5670_ST_EN_SFT			6
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci/* DAC1 Digital Volume (0x19) */
27562306a36Sopenharmony_ci#define RT5670_DAC_L1_VOL_MASK			(0xff << 8)
27662306a36Sopenharmony_ci#define RT5670_DAC_L1_VOL_SFT			8
27762306a36Sopenharmony_ci#define RT5670_DAC_R1_VOL_MASK			(0xff)
27862306a36Sopenharmony_ci#define RT5670_DAC_R1_VOL_SFT			0
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci/* DAC2 Digital Volume (0x1a) */
28162306a36Sopenharmony_ci#define RT5670_DAC_L2_VOL_MASK			(0xff << 8)
28262306a36Sopenharmony_ci#define RT5670_DAC_L2_VOL_SFT			8
28362306a36Sopenharmony_ci#define RT5670_DAC_R2_VOL_MASK			(0xff)
28462306a36Sopenharmony_ci#define RT5670_DAC_R2_VOL_SFT			0
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci/* DAC2 Control (0x1b) */
28762306a36Sopenharmony_ci#define RT5670_M_DAC_L2_VOL			(0x1 << 13)
28862306a36Sopenharmony_ci#define RT5670_M_DAC_L2_VOL_SFT			13
28962306a36Sopenharmony_ci#define RT5670_M_DAC_R2_VOL			(0x1 << 12)
29062306a36Sopenharmony_ci#define RT5670_M_DAC_R2_VOL_SFT			12
29162306a36Sopenharmony_ci#define RT5670_DAC2_L_SEL_MASK			(0x7 << 4)
29262306a36Sopenharmony_ci#define RT5670_DAC2_L_SEL_SFT			4
29362306a36Sopenharmony_ci#define RT5670_DAC2_R_SEL_MASK			(0x7 << 0)
29462306a36Sopenharmony_ci#define RT5670_DAC2_R_SEL_SFT			0
29562306a36Sopenharmony_ci
29662306a36Sopenharmony_ci/* ADC Digital Volume Control (0x1c) */
29762306a36Sopenharmony_ci#define RT5670_ADC_L_VOL_MASK			(0x7f << 8)
29862306a36Sopenharmony_ci#define RT5670_ADC_L_VOL_SFT			8
29962306a36Sopenharmony_ci#define RT5670_ADC_R_VOL_MASK			(0x7f)
30062306a36Sopenharmony_ci#define RT5670_ADC_R_VOL_SFT			0
30162306a36Sopenharmony_ci
30262306a36Sopenharmony_ci/* Mono ADC Digital Volume Control (0x1d) */
30362306a36Sopenharmony_ci#define RT5670_MONO_ADC_L_VOL_MASK		(0x7f << 8)
30462306a36Sopenharmony_ci#define RT5670_MONO_ADC_L_VOL_SFT		8
30562306a36Sopenharmony_ci#define RT5670_MONO_ADC_R_VOL_MASK		(0x7f)
30662306a36Sopenharmony_ci#define RT5670_MONO_ADC_R_VOL_SFT		0
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci/* ADC Boost Volume Control (0x1e) */
30962306a36Sopenharmony_ci#define RT5670_STO1_ADC_L_BST_MASK		(0x3 << 14)
31062306a36Sopenharmony_ci#define RT5670_STO1_ADC_L_BST_SFT		14
31162306a36Sopenharmony_ci#define RT5670_STO1_ADC_R_BST_MASK		(0x3 << 12)
31262306a36Sopenharmony_ci#define RT5670_STO1_ADC_R_BST_SFT		12
31362306a36Sopenharmony_ci#define RT5670_STO1_ADC_COMP_MASK		(0x3 << 10)
31462306a36Sopenharmony_ci#define RT5670_STO1_ADC_COMP_SFT		10
31562306a36Sopenharmony_ci#define RT5670_STO2_ADC_L_BST_MASK		(0x3 << 8)
31662306a36Sopenharmony_ci#define RT5670_STO2_ADC_L_BST_SFT		8
31762306a36Sopenharmony_ci#define RT5670_STO2_ADC_R_BST_MASK		(0x3 << 6)
31862306a36Sopenharmony_ci#define RT5670_STO2_ADC_R_BST_SFT		6
31962306a36Sopenharmony_ci#define RT5670_STO2_ADC_COMP_MASK		(0x3 << 4)
32062306a36Sopenharmony_ci#define RT5670_STO2_ADC_COMP_SFT		4
32162306a36Sopenharmony_ci
32262306a36Sopenharmony_ci/* Stereo2 ADC Mixer Control (0x26) */
32362306a36Sopenharmony_ci#define RT5670_STO2_ADC_SRC_MASK		(0x1 << 15)
32462306a36Sopenharmony_ci#define RT5670_STO2_ADC_SRC_SFT			15
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci/* Stereo ADC Mixer Control (0x26 0x27) */
32762306a36Sopenharmony_ci#define RT5670_M_ADC_L1				(0x1 << 14)
32862306a36Sopenharmony_ci#define RT5670_M_ADC_L1_SFT			14
32962306a36Sopenharmony_ci#define RT5670_M_ADC_L2				(0x1 << 13)
33062306a36Sopenharmony_ci#define RT5670_M_ADC_L2_SFT			13
33162306a36Sopenharmony_ci#define RT5670_ADC_1_SRC_MASK			(0x1 << 12)
33262306a36Sopenharmony_ci#define RT5670_ADC_1_SRC_SFT			12
33362306a36Sopenharmony_ci#define RT5670_ADC_1_SRC_ADC			(0x1 << 12)
33462306a36Sopenharmony_ci#define RT5670_ADC_1_SRC_DACMIX			(0x0 << 12)
33562306a36Sopenharmony_ci#define RT5670_ADC_2_SRC_MASK			(0x1 << 11)
33662306a36Sopenharmony_ci#define RT5670_ADC_2_SRC_SFT			11
33762306a36Sopenharmony_ci#define RT5670_ADC_SRC_MASK			(0x1 << 10)
33862306a36Sopenharmony_ci#define RT5670_ADC_SRC_SFT			10
33962306a36Sopenharmony_ci#define RT5670_DMIC_SRC_MASK			(0x3 << 8)
34062306a36Sopenharmony_ci#define RT5670_DMIC_SRC_SFT			8
34162306a36Sopenharmony_ci#define RT5670_M_ADC_R1				(0x1 << 6)
34262306a36Sopenharmony_ci#define RT5670_M_ADC_R1_SFT			6
34362306a36Sopenharmony_ci#define RT5670_M_ADC_R2				(0x1 << 5)
34462306a36Sopenharmony_ci#define RT5670_M_ADC_R2_SFT			5
34562306a36Sopenharmony_ci#define RT5670_DMIC3_SRC_MASK			(0x1 << 1)
34662306a36Sopenharmony_ci#define RT5670_DMIC3_SRC_SFT			0
34762306a36Sopenharmony_ci
34862306a36Sopenharmony_ci/* Mono ADC Mixer Control (0x28) */
34962306a36Sopenharmony_ci#define RT5670_M_MONO_ADC_L1			(0x1 << 14)
35062306a36Sopenharmony_ci#define RT5670_M_MONO_ADC_L1_SFT		14
35162306a36Sopenharmony_ci#define RT5670_M_MONO_ADC_L2			(0x1 << 13)
35262306a36Sopenharmony_ci#define RT5670_M_MONO_ADC_L2_SFT		13
35362306a36Sopenharmony_ci#define RT5670_MONO_ADC_L1_SRC_MASK		(0x1 << 12)
35462306a36Sopenharmony_ci#define RT5670_MONO_ADC_L1_SRC_SFT		12
35562306a36Sopenharmony_ci#define RT5670_MONO_ADC_L1_SRC_DACMIXL		(0x0 << 12)
35662306a36Sopenharmony_ci#define RT5670_MONO_ADC_L1_SRC_ADCL		(0x1 << 12)
35762306a36Sopenharmony_ci#define RT5670_MONO_ADC_L2_SRC_MASK		(0x1 << 11)
35862306a36Sopenharmony_ci#define RT5670_MONO_ADC_L2_SRC_SFT		11
35962306a36Sopenharmony_ci#define RT5670_MONO_ADC_L_SRC_MASK		(0x1 << 10)
36062306a36Sopenharmony_ci#define RT5670_MONO_ADC_L_SRC_SFT		10
36162306a36Sopenharmony_ci#define RT5670_MONO_DMIC_L_SRC_MASK		(0x3 << 8)
36262306a36Sopenharmony_ci#define RT5670_MONO_DMIC_L_SRC_SFT		8
36362306a36Sopenharmony_ci#define RT5670_M_MONO_ADC_R1			(0x1 << 6)
36462306a36Sopenharmony_ci#define RT5670_M_MONO_ADC_R1_SFT		6
36562306a36Sopenharmony_ci#define RT5670_M_MONO_ADC_R2			(0x1 << 5)
36662306a36Sopenharmony_ci#define RT5670_M_MONO_ADC_R2_SFT		5
36762306a36Sopenharmony_ci#define RT5670_MONO_ADC_R1_SRC_MASK		(0x1 << 4)
36862306a36Sopenharmony_ci#define RT5670_MONO_ADC_R1_SRC_SFT		4
36962306a36Sopenharmony_ci#define RT5670_MONO_ADC_R1_SRC_ADCR		(0x1 << 4)
37062306a36Sopenharmony_ci#define RT5670_MONO_ADC_R1_SRC_DACMIXR		(0x0 << 4)
37162306a36Sopenharmony_ci#define RT5670_MONO_ADC_R2_SRC_MASK		(0x1 << 3)
37262306a36Sopenharmony_ci#define RT5670_MONO_ADC_R2_SRC_SFT		3
37362306a36Sopenharmony_ci#define RT5670_MONO_DMIC_R_SRC_MASK		(0x3)
37462306a36Sopenharmony_ci#define RT5670_MONO_DMIC_R_SRC_SFT		0
37562306a36Sopenharmony_ci
37662306a36Sopenharmony_ci/* ADC Mixer to DAC Mixer Control (0x29) */
37762306a36Sopenharmony_ci#define RT5670_M_ADCMIX_L			(0x1 << 15)
37862306a36Sopenharmony_ci#define RT5670_M_ADCMIX_L_SFT			15
37962306a36Sopenharmony_ci#define RT5670_M_DAC1_L				(0x1 << 14)
38062306a36Sopenharmony_ci#define RT5670_M_DAC1_L_SFT			14
38162306a36Sopenharmony_ci#define RT5670_DAC1_R_SEL_MASK			(0x3 << 10)
38262306a36Sopenharmony_ci#define RT5670_DAC1_R_SEL_SFT			10
38362306a36Sopenharmony_ci#define RT5670_DAC1_R_SEL_IF1			(0x0 << 10)
38462306a36Sopenharmony_ci#define RT5670_DAC1_R_SEL_IF2			(0x1 << 10)
38562306a36Sopenharmony_ci#define RT5670_DAC1_R_SEL_IF3			(0x2 << 10)
38662306a36Sopenharmony_ci#define RT5670_DAC1_R_SEL_IF4			(0x3 << 10)
38762306a36Sopenharmony_ci#define RT5670_DAC1_L_SEL_MASK			(0x3 << 8)
38862306a36Sopenharmony_ci#define RT5670_DAC1_L_SEL_SFT			8
38962306a36Sopenharmony_ci#define RT5670_DAC1_L_SEL_IF1			(0x0 << 8)
39062306a36Sopenharmony_ci#define RT5670_DAC1_L_SEL_IF2			(0x1 << 8)
39162306a36Sopenharmony_ci#define RT5670_DAC1_L_SEL_IF3			(0x2 << 8)
39262306a36Sopenharmony_ci#define RT5670_DAC1_L_SEL_IF4			(0x3 << 8)
39362306a36Sopenharmony_ci#define RT5670_M_ADCMIX_R			(0x1 << 7)
39462306a36Sopenharmony_ci#define RT5670_M_ADCMIX_R_SFT			7
39562306a36Sopenharmony_ci#define RT5670_M_DAC1_R				(0x1 << 6)
39662306a36Sopenharmony_ci#define RT5670_M_DAC1_R_SFT			6
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ci/* Stereo DAC Mixer Control (0x2a) */
39962306a36Sopenharmony_ci#define RT5670_M_DAC_L1				(0x1 << 14)
40062306a36Sopenharmony_ci#define RT5670_M_DAC_L1_SFT			14
40162306a36Sopenharmony_ci#define RT5670_DAC_L1_STO_L_VOL_MASK		(0x1 << 13)
40262306a36Sopenharmony_ci#define RT5670_DAC_L1_STO_L_VOL_SFT		13
40362306a36Sopenharmony_ci#define RT5670_M_DAC_L2				(0x1 << 12)
40462306a36Sopenharmony_ci#define RT5670_M_DAC_L2_SFT			12
40562306a36Sopenharmony_ci#define RT5670_DAC_L2_STO_L_VOL_MASK		(0x1 << 11)
40662306a36Sopenharmony_ci#define RT5670_DAC_L2_STO_L_VOL_SFT		11
40762306a36Sopenharmony_ci#define RT5670_M_DAC_R1_STO_L			(0x1 << 9)
40862306a36Sopenharmony_ci#define RT5670_M_DAC_R1_STO_L_SFT		9
40962306a36Sopenharmony_ci#define RT5670_DAC_R1_STO_L_VOL_MASK		(0x1 << 8)
41062306a36Sopenharmony_ci#define RT5670_DAC_R1_STO_L_VOL_SFT		8
41162306a36Sopenharmony_ci#define RT5670_M_DAC_R1				(0x1 << 6)
41262306a36Sopenharmony_ci#define RT5670_M_DAC_R1_SFT			6
41362306a36Sopenharmony_ci#define RT5670_DAC_R1_STO_R_VOL_MASK		(0x1 << 5)
41462306a36Sopenharmony_ci#define RT5670_DAC_R1_STO_R_VOL_SFT		5
41562306a36Sopenharmony_ci#define RT5670_M_DAC_R2				(0x1 << 4)
41662306a36Sopenharmony_ci#define RT5670_M_DAC_R2_SFT			4
41762306a36Sopenharmony_ci#define RT5670_DAC_R2_STO_R_VOL_MASK		(0x1 << 3)
41862306a36Sopenharmony_ci#define RT5670_DAC_R2_STO_R_VOL_SFT		3
41962306a36Sopenharmony_ci#define RT5670_M_DAC_L1_STO_R			(0x1 << 1)
42062306a36Sopenharmony_ci#define RT5670_M_DAC_L1_STO_R_SFT		1
42162306a36Sopenharmony_ci#define RT5670_DAC_L1_STO_R_VOL_MASK		(0x1)
42262306a36Sopenharmony_ci#define RT5670_DAC_L1_STO_R_VOL_SFT		0
42362306a36Sopenharmony_ci
42462306a36Sopenharmony_ci/* Mono DAC Mixer Control (0x2b) */
42562306a36Sopenharmony_ci#define RT5670_M_DAC_L1_MONO_L			(0x1 << 14)
42662306a36Sopenharmony_ci#define RT5670_M_DAC_L1_MONO_L_SFT		14
42762306a36Sopenharmony_ci#define RT5670_DAC_L1_MONO_L_VOL_MASK		(0x1 << 13)
42862306a36Sopenharmony_ci#define RT5670_DAC_L1_MONO_L_VOL_SFT		13
42962306a36Sopenharmony_ci#define RT5670_M_DAC_L2_MONO_L			(0x1 << 12)
43062306a36Sopenharmony_ci#define RT5670_M_DAC_L2_MONO_L_SFT		12
43162306a36Sopenharmony_ci#define RT5670_DAC_L2_MONO_L_VOL_MASK		(0x1 << 11)
43262306a36Sopenharmony_ci#define RT5670_DAC_L2_MONO_L_VOL_SFT		11
43362306a36Sopenharmony_ci#define RT5670_M_DAC_R2_MONO_L			(0x1 << 10)
43462306a36Sopenharmony_ci#define RT5670_M_DAC_R2_MONO_L_SFT		10
43562306a36Sopenharmony_ci#define RT5670_DAC_R2_MONO_L_VOL_MASK		(0x1 << 9)
43662306a36Sopenharmony_ci#define RT5670_DAC_R2_MONO_L_VOL_SFT		9
43762306a36Sopenharmony_ci#define RT5670_M_DAC_R1_MONO_R			(0x1 << 6)
43862306a36Sopenharmony_ci#define RT5670_M_DAC_R1_MONO_R_SFT		6
43962306a36Sopenharmony_ci#define RT5670_DAC_R1_MONO_R_VOL_MASK		(0x1 << 5)
44062306a36Sopenharmony_ci#define RT5670_DAC_R1_MONO_R_VOL_SFT		5
44162306a36Sopenharmony_ci#define RT5670_M_DAC_R2_MONO_R			(0x1 << 4)
44262306a36Sopenharmony_ci#define RT5670_M_DAC_R2_MONO_R_SFT		4
44362306a36Sopenharmony_ci#define RT5670_DAC_R2_MONO_R_VOL_MASK		(0x1 << 3)
44462306a36Sopenharmony_ci#define RT5670_DAC_R2_MONO_R_VOL_SFT		3
44562306a36Sopenharmony_ci#define RT5670_M_DAC_L2_MONO_R			(0x1 << 2)
44662306a36Sopenharmony_ci#define RT5670_M_DAC_L2_MONO_R_SFT		2
44762306a36Sopenharmony_ci#define RT5670_DAC_L2_MONO_R_VOL_MASK		(0x1 << 1)
44862306a36Sopenharmony_ci#define RT5670_DAC_L2_MONO_R_VOL_SFT		1
44962306a36Sopenharmony_ci
45062306a36Sopenharmony_ci/* Digital Mixer Control (0x2c) */
45162306a36Sopenharmony_ci#define RT5670_M_STO_L_DAC_L			(0x1 << 15)
45262306a36Sopenharmony_ci#define RT5670_M_STO_L_DAC_L_SFT		15
45362306a36Sopenharmony_ci#define RT5670_STO_L_DAC_L_VOL_MASK		(0x1 << 14)
45462306a36Sopenharmony_ci#define RT5670_STO_L_DAC_L_VOL_SFT		14
45562306a36Sopenharmony_ci#define RT5670_M_DAC_L2_DAC_L			(0x1 << 13)
45662306a36Sopenharmony_ci#define RT5670_M_DAC_L2_DAC_L_SFT		13
45762306a36Sopenharmony_ci#define RT5670_DAC_L2_DAC_L_VOL_MASK		(0x1 << 12)
45862306a36Sopenharmony_ci#define RT5670_DAC_L2_DAC_L_VOL_SFT		12
45962306a36Sopenharmony_ci#define RT5670_M_STO_R_DAC_R			(0x1 << 11)
46062306a36Sopenharmony_ci#define RT5670_M_STO_R_DAC_R_SFT		11
46162306a36Sopenharmony_ci#define RT5670_STO_R_DAC_R_VOL_MASK		(0x1 << 10)
46262306a36Sopenharmony_ci#define RT5670_STO_R_DAC_R_VOL_SFT		10
46362306a36Sopenharmony_ci#define RT5670_M_DAC_R2_DAC_R			(0x1 << 9)
46462306a36Sopenharmony_ci#define RT5670_M_DAC_R2_DAC_R_SFT		9
46562306a36Sopenharmony_ci#define RT5670_DAC_R2_DAC_R_VOL_MASK		(0x1 << 8)
46662306a36Sopenharmony_ci#define RT5670_DAC_R2_DAC_R_VOL_SFT		8
46762306a36Sopenharmony_ci#define RT5670_M_DAC_R2_DAC_L			(0x1 << 7)
46862306a36Sopenharmony_ci#define RT5670_M_DAC_R2_DAC_L_SFT		7
46962306a36Sopenharmony_ci#define RT5670_DAC_R2_DAC_L_VOL_MASK		(0x1 << 6)
47062306a36Sopenharmony_ci#define RT5670_DAC_R2_DAC_L_VOL_SFT		6
47162306a36Sopenharmony_ci#define RT5670_M_DAC_L2_DAC_R			(0x1 << 5)
47262306a36Sopenharmony_ci#define RT5670_M_DAC_L2_DAC_R_SFT		5
47362306a36Sopenharmony_ci#define RT5670_DAC_L2_DAC_R_VOL_MASK		(0x1 << 4)
47462306a36Sopenharmony_ci#define RT5670_DAC_L2_DAC_R_VOL_SFT		4
47562306a36Sopenharmony_ci
47662306a36Sopenharmony_ci/* DSP Path Control 1 (0x2d) */
47762306a36Sopenharmony_ci#define RT5670_RXDP_SEL_MASK			(0x7 << 13)
47862306a36Sopenharmony_ci#define RT5670_RXDP_SEL_SFT			13
47962306a36Sopenharmony_ci#define RT5670_RXDP_SRC_MASK			(0x3 << 11)
48062306a36Sopenharmony_ci#define RT5670_RXDP_SRC_SFT			11
48162306a36Sopenharmony_ci#define RT5670_RXDP_SRC_NOR			(0x0 << 11)
48262306a36Sopenharmony_ci#define RT5670_RXDP_SRC_DIV2			(0x1 << 11)
48362306a36Sopenharmony_ci#define RT5670_RXDP_SRC_DIV3			(0x2 << 11)
48462306a36Sopenharmony_ci#define RT5670_TXDP_SRC_MASK			(0x3 << 4)
48562306a36Sopenharmony_ci#define RT5670_TXDP_SRC_SFT			4
48662306a36Sopenharmony_ci#define RT5670_TXDP_SRC_NOR			(0x0 << 4)
48762306a36Sopenharmony_ci#define RT5670_TXDP_SRC_DIV2			(0x1 << 4)
48862306a36Sopenharmony_ci#define RT5670_TXDP_SRC_DIV3			(0x2 << 4)
48962306a36Sopenharmony_ci#define RT5670_TXDP_SLOT_SEL_MASK		(0x3 << 2)
49062306a36Sopenharmony_ci#define RT5670_TXDP_SLOT_SEL_SFT		2
49162306a36Sopenharmony_ci#define RT5670_DSP_UL_SEL			(0x1 << 1)
49262306a36Sopenharmony_ci#define RT5670_DSP_UL_SFT			1
49362306a36Sopenharmony_ci#define RT5670_DSP_DL_SEL			0x1
49462306a36Sopenharmony_ci#define RT5670_DSP_DL_SFT			0
49562306a36Sopenharmony_ci
49662306a36Sopenharmony_ci/* DSP Path Control 2 (0x2e) */
49762306a36Sopenharmony_ci#define RT5670_TXDP_L_VOL_MASK			(0x7f << 8)
49862306a36Sopenharmony_ci#define RT5670_TXDP_L_VOL_SFT			8
49962306a36Sopenharmony_ci#define RT5670_TXDP_R_VOL_MASK			(0x7f)
50062306a36Sopenharmony_ci#define RT5670_TXDP_R_VOL_SFT			0
50162306a36Sopenharmony_ci
50262306a36Sopenharmony_ci/* Digital Interface Data Control (0x2f) */
50362306a36Sopenharmony_ci#define RT5670_IF1_ADC2_IN_SEL			(0x1 << 15)
50462306a36Sopenharmony_ci#define RT5670_IF1_ADC2_IN_SFT			15
50562306a36Sopenharmony_ci#define RT5670_IF2_ADC_IN_MASK			(0x7 << 12)
50662306a36Sopenharmony_ci#define RT5670_IF2_ADC_IN_SFT			12
50762306a36Sopenharmony_ci#define RT5670_IF2_DAC_SEL_MASK			(0x3 << 10)
50862306a36Sopenharmony_ci#define RT5670_IF2_DAC_SEL_SFT			10
50962306a36Sopenharmony_ci#define RT5670_IF2_ADC_SEL_MASK			(0x3 << 8)
51062306a36Sopenharmony_ci#define RT5670_IF2_ADC_SEL_SFT			8
51162306a36Sopenharmony_ci
51262306a36Sopenharmony_ci/* Digital Interface Data Control (0x30) */
51362306a36Sopenharmony_ci#define RT5670_IF4_ADC_IN_MASK			(0x3 << 4)
51462306a36Sopenharmony_ci#define RT5670_IF4_ADC_IN_SFT			4
51562306a36Sopenharmony_ci
51662306a36Sopenharmony_ci/* PDM Output Control (0x31) */
51762306a36Sopenharmony_ci#define RT5670_PDM1_L_MASK			(0x1 << 15)
51862306a36Sopenharmony_ci#define RT5670_PDM1_L_SFT			15
51962306a36Sopenharmony_ci#define RT5670_M_PDM1_L				(0x1 << 14)
52062306a36Sopenharmony_ci#define RT5670_M_PDM1_L_SFT			14
52162306a36Sopenharmony_ci#define RT5670_PDM1_R_MASK			(0x1 << 13)
52262306a36Sopenharmony_ci#define RT5670_PDM1_R_SFT			13
52362306a36Sopenharmony_ci#define RT5670_M_PDM1_R				(0x1 << 12)
52462306a36Sopenharmony_ci#define RT5670_M_PDM1_R_SFT			12
52562306a36Sopenharmony_ci#define RT5670_PDM2_L_MASK			(0x1 << 11)
52662306a36Sopenharmony_ci#define RT5670_PDM2_L_SFT			11
52762306a36Sopenharmony_ci#define RT5670_M_PDM2_L				(0x1 << 10)
52862306a36Sopenharmony_ci#define RT5670_M_PDM2_L_SFT			10
52962306a36Sopenharmony_ci#define RT5670_PDM2_R_MASK			(0x1 << 9)
53062306a36Sopenharmony_ci#define RT5670_PDM2_R_SFT			9
53162306a36Sopenharmony_ci#define RT5670_M_PDM2_R				(0x1 << 8)
53262306a36Sopenharmony_ci#define RT5670_M_PDM2_R_SFT			8
53362306a36Sopenharmony_ci#define RT5670_PDM2_BUSY			(0x1 << 7)
53462306a36Sopenharmony_ci#define RT5670_PDM1_BUSY			(0x1 << 6)
53562306a36Sopenharmony_ci#define RT5670_PDM_PATTERN			(0x1 << 5)
53662306a36Sopenharmony_ci#define RT5670_PDM_GAIN				(0x1 << 4)
53762306a36Sopenharmony_ci#define RT5670_PDM_DIV_MASK			(0x3)
53862306a36Sopenharmony_ci
53962306a36Sopenharmony_ci/* REC Left Mixer Control 1 (0x3b) */
54062306a36Sopenharmony_ci#define RT5670_G_HP_L_RM_L_MASK			(0x7 << 13)
54162306a36Sopenharmony_ci#define RT5670_G_HP_L_RM_L_SFT			13
54262306a36Sopenharmony_ci#define RT5670_G_IN_L_RM_L_MASK			(0x7 << 10)
54362306a36Sopenharmony_ci#define RT5670_G_IN_L_RM_L_SFT			10
54462306a36Sopenharmony_ci#define RT5670_G_BST4_RM_L_MASK			(0x7 << 7)
54562306a36Sopenharmony_ci#define RT5670_G_BST4_RM_L_SFT			7
54662306a36Sopenharmony_ci#define RT5670_G_BST3_RM_L_MASK			(0x7 << 4)
54762306a36Sopenharmony_ci#define RT5670_G_BST3_RM_L_SFT			4
54862306a36Sopenharmony_ci#define RT5670_G_BST2_RM_L_MASK			(0x7 << 1)
54962306a36Sopenharmony_ci#define RT5670_G_BST2_RM_L_SFT			1
55062306a36Sopenharmony_ci
55162306a36Sopenharmony_ci/* REC Left Mixer Control 2 (0x3c) */
55262306a36Sopenharmony_ci#define RT5670_G_BST1_RM_L_MASK			(0x7 << 13)
55362306a36Sopenharmony_ci#define RT5670_G_BST1_RM_L_SFT			13
55462306a36Sopenharmony_ci#define RT5670_M_IN_L_RM_L			(0x1 << 5)
55562306a36Sopenharmony_ci#define RT5670_M_IN_L_RM_L_SFT			5
55662306a36Sopenharmony_ci#define RT5670_M_BST2_RM_L			(0x1 << 3)
55762306a36Sopenharmony_ci#define RT5670_M_BST2_RM_L_SFT			3
55862306a36Sopenharmony_ci#define RT5670_M_BST1_RM_L			(0x1 << 1)
55962306a36Sopenharmony_ci#define RT5670_M_BST1_RM_L_SFT			1
56062306a36Sopenharmony_ci
56162306a36Sopenharmony_ci/* REC Right Mixer Control 1 (0x3d) */
56262306a36Sopenharmony_ci#define RT5670_G_HP_R_RM_R_MASK			(0x7 << 13)
56362306a36Sopenharmony_ci#define RT5670_G_HP_R_RM_R_SFT			13
56462306a36Sopenharmony_ci#define RT5670_G_IN_R_RM_R_MASK			(0x7 << 10)
56562306a36Sopenharmony_ci#define RT5670_G_IN_R_RM_R_SFT			10
56662306a36Sopenharmony_ci#define RT5670_G_BST4_RM_R_MASK			(0x7 << 7)
56762306a36Sopenharmony_ci#define RT5670_G_BST4_RM_R_SFT			7
56862306a36Sopenharmony_ci#define RT5670_G_BST3_RM_R_MASK			(0x7 << 4)
56962306a36Sopenharmony_ci#define RT5670_G_BST3_RM_R_SFT			4
57062306a36Sopenharmony_ci#define RT5670_G_BST2_RM_R_MASK			(0x7 << 1)
57162306a36Sopenharmony_ci#define RT5670_G_BST2_RM_R_SFT			1
57262306a36Sopenharmony_ci
57362306a36Sopenharmony_ci/* REC Right Mixer Control 2 (0x3e) */
57462306a36Sopenharmony_ci#define RT5670_G_BST1_RM_R_MASK			(0x7 << 13)
57562306a36Sopenharmony_ci#define RT5670_G_BST1_RM_R_SFT			13
57662306a36Sopenharmony_ci#define RT5670_M_IN_R_RM_R			(0x1 << 5)
57762306a36Sopenharmony_ci#define RT5670_M_IN_R_RM_R_SFT			5
57862306a36Sopenharmony_ci#define RT5670_M_BST2_RM_R			(0x1 << 3)
57962306a36Sopenharmony_ci#define RT5670_M_BST2_RM_R_SFT			3
58062306a36Sopenharmony_ci#define RT5670_M_BST1_RM_R			(0x1 << 1)
58162306a36Sopenharmony_ci#define RT5670_M_BST1_RM_R_SFT			1
58262306a36Sopenharmony_ci
58362306a36Sopenharmony_ci/* HPMIX Control (0x45) */
58462306a36Sopenharmony_ci#define RT5670_M_DAC2_HM			(0x1 << 15)
58562306a36Sopenharmony_ci#define RT5670_M_DAC2_HM_SFT			15
58662306a36Sopenharmony_ci#define RT5670_M_HPVOL_HM			(0x1 << 14)
58762306a36Sopenharmony_ci#define RT5670_M_HPVOL_HM_SFT			14
58862306a36Sopenharmony_ci#define RT5670_M_DAC1_HM			(0x1 << 13)
58962306a36Sopenharmony_ci#define RT5670_M_DAC1_HM_SFT			13
59062306a36Sopenharmony_ci#define RT5670_G_HPOMIX_MASK			(0x1 << 12)
59162306a36Sopenharmony_ci#define RT5670_G_HPOMIX_SFT			12
59262306a36Sopenharmony_ci#define RT5670_M_INR1_HMR			(0x1 << 3)
59362306a36Sopenharmony_ci#define RT5670_M_INR1_HMR_SFT			3
59462306a36Sopenharmony_ci#define RT5670_M_DACR1_HMR			(0x1 << 2)
59562306a36Sopenharmony_ci#define RT5670_M_DACR1_HMR_SFT			2
59662306a36Sopenharmony_ci#define RT5670_M_INL1_HML			(0x1 << 1)
59762306a36Sopenharmony_ci#define RT5670_M_INL1_HML_SFT			1
59862306a36Sopenharmony_ci#define RT5670_M_DACL1_HML			(0x1)
59962306a36Sopenharmony_ci#define RT5670_M_DACL1_HML_SFT			0
60062306a36Sopenharmony_ci
60162306a36Sopenharmony_ci/* Mono Output Mixer Control (0x4c) */
60262306a36Sopenharmony_ci#define RT5670_M_DAC_R2_MA			(0x1 << 15)
60362306a36Sopenharmony_ci#define RT5670_M_DAC_R2_MA_SFT			15
60462306a36Sopenharmony_ci#define RT5670_M_DAC_L2_MA			(0x1 << 14)
60562306a36Sopenharmony_ci#define RT5670_M_DAC_L2_MA_SFT			14
60662306a36Sopenharmony_ci#define RT5670_M_OV_R_MM			(0x1 << 13)
60762306a36Sopenharmony_ci#define RT5670_M_OV_R_MM_SFT			13
60862306a36Sopenharmony_ci#define RT5670_M_OV_L_MM			(0x1 << 12)
60962306a36Sopenharmony_ci#define RT5670_M_OV_L_MM_SFT			12
61062306a36Sopenharmony_ci#define RT5670_G_MONOMIX_MASK			(0x1 << 10)
61162306a36Sopenharmony_ci#define RT5670_G_MONOMIX_SFT			10
61262306a36Sopenharmony_ci#define RT5670_M_DAC_R2_MM			(0x1 << 9)
61362306a36Sopenharmony_ci#define RT5670_M_DAC_R2_MM_SFT			9
61462306a36Sopenharmony_ci#define RT5670_M_DAC_L2_MM			(0x1 << 8)
61562306a36Sopenharmony_ci#define RT5670_M_DAC_L2_MM_SFT			8
61662306a36Sopenharmony_ci#define RT5670_M_BST4_MM			(0x1 << 7)
61762306a36Sopenharmony_ci#define RT5670_M_BST4_MM_SFT			7
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci/* Output Left Mixer Control 1 (0x4d) */
62062306a36Sopenharmony_ci#define RT5670_G_BST3_OM_L_MASK			(0x7 << 13)
62162306a36Sopenharmony_ci#define RT5670_G_BST3_OM_L_SFT			13
62262306a36Sopenharmony_ci#define RT5670_G_BST2_OM_L_MASK			(0x7 << 10)
62362306a36Sopenharmony_ci#define RT5670_G_BST2_OM_L_SFT			10
62462306a36Sopenharmony_ci#define RT5670_G_BST1_OM_L_MASK			(0x7 << 7)
62562306a36Sopenharmony_ci#define RT5670_G_BST1_OM_L_SFT			7
62662306a36Sopenharmony_ci#define RT5670_G_IN_L_OM_L_MASK			(0x7 << 4)
62762306a36Sopenharmony_ci#define RT5670_G_IN_L_OM_L_SFT			4
62862306a36Sopenharmony_ci#define RT5670_G_RM_L_OM_L_MASK			(0x7 << 1)
62962306a36Sopenharmony_ci#define RT5670_G_RM_L_OM_L_SFT			1
63062306a36Sopenharmony_ci
63162306a36Sopenharmony_ci/* Output Left Mixer Control 2 (0x4e) */
63262306a36Sopenharmony_ci#define RT5670_G_DAC_R2_OM_L_MASK		(0x7 << 13)
63362306a36Sopenharmony_ci#define RT5670_G_DAC_R2_OM_L_SFT		13
63462306a36Sopenharmony_ci#define RT5670_G_DAC_L2_OM_L_MASK		(0x7 << 10)
63562306a36Sopenharmony_ci#define RT5670_G_DAC_L2_OM_L_SFT		10
63662306a36Sopenharmony_ci#define RT5670_G_DAC_L1_OM_L_MASK		(0x7 << 7)
63762306a36Sopenharmony_ci#define RT5670_G_DAC_L1_OM_L_SFT		7
63862306a36Sopenharmony_ci
63962306a36Sopenharmony_ci/* Output Left Mixer Control 3 (0x4f) */
64062306a36Sopenharmony_ci#define RT5670_M_BST1_OM_L			(0x1 << 5)
64162306a36Sopenharmony_ci#define RT5670_M_BST1_OM_L_SFT			5
64262306a36Sopenharmony_ci#define RT5670_M_IN_L_OM_L			(0x1 << 4)
64362306a36Sopenharmony_ci#define RT5670_M_IN_L_OM_L_SFT			4
64462306a36Sopenharmony_ci#define RT5670_M_DAC_L2_OM_L			(0x1 << 1)
64562306a36Sopenharmony_ci#define RT5670_M_DAC_L2_OM_L_SFT		1
64662306a36Sopenharmony_ci#define RT5670_M_DAC_L1_OM_L			(0x1)
64762306a36Sopenharmony_ci#define RT5670_M_DAC_L1_OM_L_SFT		0
64862306a36Sopenharmony_ci
64962306a36Sopenharmony_ci/* Output Right Mixer Control 1 (0x50) */
65062306a36Sopenharmony_ci#define RT5670_G_BST4_OM_R_MASK			(0x7 << 13)
65162306a36Sopenharmony_ci#define RT5670_G_BST4_OM_R_SFT			13
65262306a36Sopenharmony_ci#define RT5670_G_BST2_OM_R_MASK			(0x7 << 10)
65362306a36Sopenharmony_ci#define RT5670_G_BST2_OM_R_SFT			10
65462306a36Sopenharmony_ci#define RT5670_G_BST1_OM_R_MASK			(0x7 << 7)
65562306a36Sopenharmony_ci#define RT5670_G_BST1_OM_R_SFT			7
65662306a36Sopenharmony_ci#define RT5670_G_IN_R_OM_R_MASK			(0x7 << 4)
65762306a36Sopenharmony_ci#define RT5670_G_IN_R_OM_R_SFT			4
65862306a36Sopenharmony_ci#define RT5670_G_RM_R_OM_R_MASK			(0x7 << 1)
65962306a36Sopenharmony_ci#define RT5670_G_RM_R_OM_R_SFT			1
66062306a36Sopenharmony_ci
66162306a36Sopenharmony_ci/* Output Right Mixer Control 2 (0x51) */
66262306a36Sopenharmony_ci#define RT5670_G_DAC_L2_OM_R_MASK		(0x7 << 13)
66362306a36Sopenharmony_ci#define RT5670_G_DAC_L2_OM_R_SFT		13
66462306a36Sopenharmony_ci#define RT5670_G_DAC_R2_OM_R_MASK		(0x7 << 10)
66562306a36Sopenharmony_ci#define RT5670_G_DAC_R2_OM_R_SFT		10
66662306a36Sopenharmony_ci#define RT5670_G_DAC_R1_OM_R_MASK		(0x7 << 7)
66762306a36Sopenharmony_ci#define RT5670_G_DAC_R1_OM_R_SFT		7
66862306a36Sopenharmony_ci
66962306a36Sopenharmony_ci/* Output Right Mixer Control 3 (0x52) */
67062306a36Sopenharmony_ci#define RT5670_M_BST2_OM_R			(0x1 << 6)
67162306a36Sopenharmony_ci#define RT5670_M_BST2_OM_R_SFT			6
67262306a36Sopenharmony_ci#define RT5670_M_IN_R_OM_R			(0x1 << 4)
67362306a36Sopenharmony_ci#define RT5670_M_IN_R_OM_R_SFT			4
67462306a36Sopenharmony_ci#define RT5670_M_DAC_R2_OM_R			(0x1 << 1)
67562306a36Sopenharmony_ci#define RT5670_M_DAC_R2_OM_R_SFT		1
67662306a36Sopenharmony_ci#define RT5670_M_DAC_R1_OM_R			(0x1)
67762306a36Sopenharmony_ci#define RT5670_M_DAC_R1_OM_R_SFT		0
67862306a36Sopenharmony_ci
67962306a36Sopenharmony_ci/* LOUT Mixer Control (0x53) */
68062306a36Sopenharmony_ci#define RT5670_M_DAC_L1_LM			(0x1 << 15)
68162306a36Sopenharmony_ci#define RT5670_M_DAC_L1_LM_SFT			15
68262306a36Sopenharmony_ci#define RT5670_M_DAC_R1_LM			(0x1 << 14)
68362306a36Sopenharmony_ci#define RT5670_M_DAC_R1_LM_SFT			14
68462306a36Sopenharmony_ci#define RT5670_M_OV_L_LM			(0x1 << 13)
68562306a36Sopenharmony_ci#define RT5670_M_OV_L_LM_SFT			13
68662306a36Sopenharmony_ci#define RT5670_M_OV_R_LM			(0x1 << 12)
68762306a36Sopenharmony_ci#define RT5670_M_OV_R_LM_SFT			12
68862306a36Sopenharmony_ci#define RT5670_G_LOUTMIX_MASK			(0x1 << 11)
68962306a36Sopenharmony_ci#define RT5670_G_LOUTMIX_SFT			11
69062306a36Sopenharmony_ci
69162306a36Sopenharmony_ci/* Power Management for Digital 1 (0x61) */
69262306a36Sopenharmony_ci#define RT5670_PWR_I2S1				(0x1 << 15)
69362306a36Sopenharmony_ci#define RT5670_PWR_I2S1_BIT			15
69462306a36Sopenharmony_ci#define RT5670_PWR_I2S2				(0x1 << 14)
69562306a36Sopenharmony_ci#define RT5670_PWR_I2S2_BIT			14
69662306a36Sopenharmony_ci#define RT5670_PWR_DAC_L1			(0x1 << 12)
69762306a36Sopenharmony_ci#define RT5670_PWR_DAC_L1_BIT			12
69862306a36Sopenharmony_ci#define RT5670_PWR_DAC_R1			(0x1 << 11)
69962306a36Sopenharmony_ci#define RT5670_PWR_DAC_R1_BIT			11
70062306a36Sopenharmony_ci#define RT5670_PWR_DAC_L2			(0x1 << 7)
70162306a36Sopenharmony_ci#define RT5670_PWR_DAC_L2_BIT			7
70262306a36Sopenharmony_ci#define RT5670_PWR_DAC_R2			(0x1 << 6)
70362306a36Sopenharmony_ci#define RT5670_PWR_DAC_R2_BIT			6
70462306a36Sopenharmony_ci#define RT5670_PWR_ADC_L			(0x1 << 2)
70562306a36Sopenharmony_ci#define RT5670_PWR_ADC_L_BIT			2
70662306a36Sopenharmony_ci#define RT5670_PWR_ADC_R			(0x1 << 1)
70762306a36Sopenharmony_ci#define RT5670_PWR_ADC_R_BIT			1
70862306a36Sopenharmony_ci#define RT5670_PWR_CLS_D			(0x1)
70962306a36Sopenharmony_ci#define RT5670_PWR_CLS_D_BIT			0
71062306a36Sopenharmony_ci
71162306a36Sopenharmony_ci/* Power Management for Digital 2 (0x62) */
71262306a36Sopenharmony_ci#define RT5670_PWR_ADC_S1F			(0x1 << 15)
71362306a36Sopenharmony_ci#define RT5670_PWR_ADC_S1F_BIT			15
71462306a36Sopenharmony_ci#define RT5670_PWR_ADC_MF_L			(0x1 << 14)
71562306a36Sopenharmony_ci#define RT5670_PWR_ADC_MF_L_BIT			14
71662306a36Sopenharmony_ci#define RT5670_PWR_ADC_MF_R			(0x1 << 13)
71762306a36Sopenharmony_ci#define RT5670_PWR_ADC_MF_R_BIT			13
71862306a36Sopenharmony_ci#define RT5670_PWR_I2S_DSP			(0x1 << 12)
71962306a36Sopenharmony_ci#define RT5670_PWR_I2S_DSP_BIT			12
72062306a36Sopenharmony_ci#define RT5670_PWR_DAC_S1F			(0x1 << 11)
72162306a36Sopenharmony_ci#define RT5670_PWR_DAC_S1F_BIT			11
72262306a36Sopenharmony_ci#define RT5670_PWR_DAC_MF_L			(0x1 << 10)
72362306a36Sopenharmony_ci#define RT5670_PWR_DAC_MF_L_BIT			10
72462306a36Sopenharmony_ci#define RT5670_PWR_DAC_MF_R			(0x1 << 9)
72562306a36Sopenharmony_ci#define RT5670_PWR_DAC_MF_R_BIT			9
72662306a36Sopenharmony_ci#define RT5670_PWR_ADC_S2F			(0x1 << 8)
72762306a36Sopenharmony_ci#define RT5670_PWR_ADC_S2F_BIT			8
72862306a36Sopenharmony_ci#define RT5670_PWR_PDM1				(0x1 << 7)
72962306a36Sopenharmony_ci#define RT5670_PWR_PDM1_BIT			7
73062306a36Sopenharmony_ci#define RT5670_PWR_PDM2				(0x1 << 6)
73162306a36Sopenharmony_ci#define RT5670_PWR_PDM2_BIT			6
73262306a36Sopenharmony_ci
73362306a36Sopenharmony_ci/* Power Management for Analog 1 (0x63) */
73462306a36Sopenharmony_ci#define RT5670_PWR_VREF1			(0x1 << 15)
73562306a36Sopenharmony_ci#define RT5670_PWR_VREF1_BIT			15
73662306a36Sopenharmony_ci#define RT5670_PWR_FV1				(0x1 << 14)
73762306a36Sopenharmony_ci#define RT5670_PWR_FV1_BIT			14
73862306a36Sopenharmony_ci#define RT5670_PWR_MB				(0x1 << 13)
73962306a36Sopenharmony_ci#define RT5670_PWR_MB_BIT			13
74062306a36Sopenharmony_ci#define RT5670_PWR_LM				(0x1 << 12)
74162306a36Sopenharmony_ci#define RT5670_PWR_LM_BIT			12
74262306a36Sopenharmony_ci#define RT5670_PWR_BG				(0x1 << 11)
74362306a36Sopenharmony_ci#define RT5670_PWR_BG_BIT			11
74462306a36Sopenharmony_ci#define RT5670_PWR_HP_L				(0x1 << 7)
74562306a36Sopenharmony_ci#define RT5670_PWR_HP_L_BIT			7
74662306a36Sopenharmony_ci#define RT5670_PWR_HP_R				(0x1 << 6)
74762306a36Sopenharmony_ci#define RT5670_PWR_HP_R_BIT			6
74862306a36Sopenharmony_ci#define RT5670_PWR_HA				(0x1 << 5)
74962306a36Sopenharmony_ci#define RT5670_PWR_HA_BIT			5
75062306a36Sopenharmony_ci#define RT5670_PWR_VREF2			(0x1 << 4)
75162306a36Sopenharmony_ci#define RT5670_PWR_VREF2_BIT			4
75262306a36Sopenharmony_ci#define RT5670_PWR_FV2				(0x1 << 3)
75362306a36Sopenharmony_ci#define RT5670_PWR_FV2_BIT			3
75462306a36Sopenharmony_ci#define RT5670_LDO_SEL_MASK			(0x7)
75562306a36Sopenharmony_ci#define RT5670_LDO_SEL_SFT			0
75662306a36Sopenharmony_ci
75762306a36Sopenharmony_ci/* Power Management for Analog 2 (0x64) */
75862306a36Sopenharmony_ci#define RT5670_PWR_BST1				(0x1 << 15)
75962306a36Sopenharmony_ci#define RT5670_PWR_BST1_BIT			15
76062306a36Sopenharmony_ci#define RT5670_PWR_BST2				(0x1 << 13)
76162306a36Sopenharmony_ci#define RT5670_PWR_BST2_BIT			13
76262306a36Sopenharmony_ci#define RT5670_PWR_MB1				(0x1 << 11)
76362306a36Sopenharmony_ci#define RT5670_PWR_MB1_BIT			11
76462306a36Sopenharmony_ci#define RT5670_PWR_MB2				(0x1 << 10)
76562306a36Sopenharmony_ci#define RT5670_PWR_MB2_BIT			10
76662306a36Sopenharmony_ci#define RT5670_PWR_PLL				(0x1 << 9)
76762306a36Sopenharmony_ci#define RT5670_PWR_PLL_BIT			9
76862306a36Sopenharmony_ci#define RT5670_PWR_BST1_P			(0x1 << 6)
76962306a36Sopenharmony_ci#define RT5670_PWR_BST1_P_BIT			6
77062306a36Sopenharmony_ci#define RT5670_PWR_BST2_P			(0x1 << 4)
77162306a36Sopenharmony_ci#define RT5670_PWR_BST2_P_BIT			4
77262306a36Sopenharmony_ci#define RT5670_PWR_JD1				(0x1 << 2)
77362306a36Sopenharmony_ci#define RT5670_PWR_JD1_BIT			2
77462306a36Sopenharmony_ci#define RT5670_PWR_JD				(0x1 << 1)
77562306a36Sopenharmony_ci#define RT5670_PWR_JD_BIT			1
77662306a36Sopenharmony_ci
77762306a36Sopenharmony_ci/* Power Management for Mixer (0x65) */
77862306a36Sopenharmony_ci#define RT5670_PWR_OM_L				(0x1 << 15)
77962306a36Sopenharmony_ci#define RT5670_PWR_OM_L_BIT			15
78062306a36Sopenharmony_ci#define RT5670_PWR_OM_R				(0x1 << 14)
78162306a36Sopenharmony_ci#define RT5670_PWR_OM_R_BIT			14
78262306a36Sopenharmony_ci#define RT5670_PWR_RM_L				(0x1 << 11)
78362306a36Sopenharmony_ci#define RT5670_PWR_RM_L_BIT			11
78462306a36Sopenharmony_ci#define RT5670_PWR_RM_R				(0x1 << 10)
78562306a36Sopenharmony_ci#define RT5670_PWR_RM_R_BIT			10
78662306a36Sopenharmony_ci
78762306a36Sopenharmony_ci/* Power Management for Volume (0x66) */
78862306a36Sopenharmony_ci#define RT5670_PWR_HV_L				(0x1 << 11)
78962306a36Sopenharmony_ci#define RT5670_PWR_HV_L_BIT			11
79062306a36Sopenharmony_ci#define RT5670_PWR_HV_R				(0x1 << 10)
79162306a36Sopenharmony_ci#define RT5670_PWR_HV_R_BIT			10
79262306a36Sopenharmony_ci#define RT5670_PWR_IN_L				(0x1 << 9)
79362306a36Sopenharmony_ci#define RT5670_PWR_IN_L_BIT			9
79462306a36Sopenharmony_ci#define RT5670_PWR_IN_R				(0x1 << 8)
79562306a36Sopenharmony_ci#define RT5670_PWR_IN_R_BIT			8
79662306a36Sopenharmony_ci#define RT5670_PWR_MIC_DET			(0x1 << 5)
79762306a36Sopenharmony_ci#define RT5670_PWR_MIC_DET_BIT			5
79862306a36Sopenharmony_ci
79962306a36Sopenharmony_ci/* I2S1/2/3 Audio Serial Data Port Control (0x70 0x71 0x72) */
80062306a36Sopenharmony_ci#define RT5670_I2S_MS_MASK			(0x1 << 15)
80162306a36Sopenharmony_ci#define RT5670_I2S_MS_SFT			15
80262306a36Sopenharmony_ci#define RT5670_I2S_MS_M				(0x0 << 15)
80362306a36Sopenharmony_ci#define RT5670_I2S_MS_S				(0x1 << 15)
80462306a36Sopenharmony_ci#define RT5670_I2S_IF_MASK			(0x7 << 12)
80562306a36Sopenharmony_ci#define RT5670_I2S_IF_SFT			12
80662306a36Sopenharmony_ci#define RT5670_I2S_O_CP_MASK			(0x3 << 10)
80762306a36Sopenharmony_ci#define RT5670_I2S_O_CP_SFT			10
80862306a36Sopenharmony_ci#define RT5670_I2S_O_CP_OFF			(0x0 << 10)
80962306a36Sopenharmony_ci#define RT5670_I2S_O_CP_U_LAW			(0x1 << 10)
81062306a36Sopenharmony_ci#define RT5670_I2S_O_CP_A_LAW			(0x2 << 10)
81162306a36Sopenharmony_ci#define RT5670_I2S_I_CP_MASK			(0x3 << 8)
81262306a36Sopenharmony_ci#define RT5670_I2S_I_CP_SFT			8
81362306a36Sopenharmony_ci#define RT5670_I2S_I_CP_OFF			(0x0 << 8)
81462306a36Sopenharmony_ci#define RT5670_I2S_I_CP_U_LAW			(0x1 << 8)
81562306a36Sopenharmony_ci#define RT5670_I2S_I_CP_A_LAW			(0x2 << 8)
81662306a36Sopenharmony_ci#define RT5670_I2S_BP_MASK			(0x1 << 7)
81762306a36Sopenharmony_ci#define RT5670_I2S_BP_SFT			7
81862306a36Sopenharmony_ci#define RT5670_I2S_BP_NOR			(0x0 << 7)
81962306a36Sopenharmony_ci#define RT5670_I2S_BP_INV			(0x1 << 7)
82062306a36Sopenharmony_ci#define RT5670_I2S_DL_MASK			(0x3 << 2)
82162306a36Sopenharmony_ci#define RT5670_I2S_DL_SFT			2
82262306a36Sopenharmony_ci#define RT5670_I2S_DL_16			(0x0 << 2)
82362306a36Sopenharmony_ci#define RT5670_I2S_DL_20			(0x1 << 2)
82462306a36Sopenharmony_ci#define RT5670_I2S_DL_24			(0x2 << 2)
82562306a36Sopenharmony_ci#define RT5670_I2S_DL_8				(0x3 << 2)
82662306a36Sopenharmony_ci#define RT5670_I2S_DF_MASK			(0x3)
82762306a36Sopenharmony_ci#define RT5670_I2S_DF_SFT			0
82862306a36Sopenharmony_ci#define RT5670_I2S_DF_I2S			(0x0)
82962306a36Sopenharmony_ci#define RT5670_I2S_DF_LEFT			(0x1)
83062306a36Sopenharmony_ci#define RT5670_I2S_DF_PCM_A			(0x2)
83162306a36Sopenharmony_ci#define RT5670_I2S_DF_PCM_B			(0x3)
83262306a36Sopenharmony_ci
83362306a36Sopenharmony_ci/* I2S2 Audio Serial Data Port Control (0x71) */
83462306a36Sopenharmony_ci#define RT5670_I2S2_SDI_MASK			(0x1 << 6)
83562306a36Sopenharmony_ci#define RT5670_I2S2_SDI_SFT			6
83662306a36Sopenharmony_ci#define RT5670_I2S2_SDI_I2S1			(0x0 << 6)
83762306a36Sopenharmony_ci#define RT5670_I2S2_SDI_I2S2			(0x1 << 6)
83862306a36Sopenharmony_ci
83962306a36Sopenharmony_ci/* ADC/DAC Clock Control 1 (0x73) */
84062306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS1_MASK		(0x1 << 15)
84162306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS1_SFT			15
84262306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS1_32			(0x0 << 15)
84362306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS1_64			(0x1 << 15)
84462306a36Sopenharmony_ci#define RT5670_I2S_PD1_MASK			(0x7 << 12)
84562306a36Sopenharmony_ci#define RT5670_I2S_PD1_SFT			12
84662306a36Sopenharmony_ci#define RT5670_I2S_PD1_1			(0x0 << 12)
84762306a36Sopenharmony_ci#define RT5670_I2S_PD1_2			(0x1 << 12)
84862306a36Sopenharmony_ci#define RT5670_I2S_PD1_3			(0x2 << 12)
84962306a36Sopenharmony_ci#define RT5670_I2S_PD1_4			(0x3 << 12)
85062306a36Sopenharmony_ci#define RT5670_I2S_PD1_6			(0x4 << 12)
85162306a36Sopenharmony_ci#define RT5670_I2S_PD1_8			(0x5 << 12)
85262306a36Sopenharmony_ci#define RT5670_I2S_PD1_12			(0x6 << 12)
85362306a36Sopenharmony_ci#define RT5670_I2S_PD1_16			(0x7 << 12)
85462306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS2_MASK		(0x1 << 11)
85562306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS2_SFT			11
85662306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS2_32			(0x0 << 11)
85762306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS2_64			(0x1 << 11)
85862306a36Sopenharmony_ci#define RT5670_I2S_PD2_MASK			(0x7 << 8)
85962306a36Sopenharmony_ci#define RT5670_I2S_PD2_SFT			8
86062306a36Sopenharmony_ci#define RT5670_I2S_PD2_1			(0x0 << 8)
86162306a36Sopenharmony_ci#define RT5670_I2S_PD2_2			(0x1 << 8)
86262306a36Sopenharmony_ci#define RT5670_I2S_PD2_3			(0x2 << 8)
86362306a36Sopenharmony_ci#define RT5670_I2S_PD2_4			(0x3 << 8)
86462306a36Sopenharmony_ci#define RT5670_I2S_PD2_6			(0x4 << 8)
86562306a36Sopenharmony_ci#define RT5670_I2S_PD2_8			(0x5 << 8)
86662306a36Sopenharmony_ci#define RT5670_I2S_PD2_12			(0x6 << 8)
86762306a36Sopenharmony_ci#define RT5670_I2S_PD2_16			(0x7 << 8)
86862306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS3_MASK		(0x1 << 7)
86962306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS3_SFT			7
87062306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS3_32			(0x0 << 7)
87162306a36Sopenharmony_ci#define RT5670_I2S_BCLK_MS3_64			(0x1 << 7)
87262306a36Sopenharmony_ci#define RT5670_I2S_PD3_MASK			(0x7 << 4)
87362306a36Sopenharmony_ci#define RT5670_I2S_PD3_SFT			4
87462306a36Sopenharmony_ci#define RT5670_I2S_PD3_1			(0x0 << 4)
87562306a36Sopenharmony_ci#define RT5670_I2S_PD3_2			(0x1 << 4)
87662306a36Sopenharmony_ci#define RT5670_I2S_PD3_3			(0x2 << 4)
87762306a36Sopenharmony_ci#define RT5670_I2S_PD3_4			(0x3 << 4)
87862306a36Sopenharmony_ci#define RT5670_I2S_PD3_6			(0x4 << 4)
87962306a36Sopenharmony_ci#define RT5670_I2S_PD3_8			(0x5 << 4)
88062306a36Sopenharmony_ci#define RT5670_I2S_PD3_12			(0x6 << 4)
88162306a36Sopenharmony_ci#define RT5670_I2S_PD3_16			(0x7 << 4)
88262306a36Sopenharmony_ci#define RT5670_DAC_OSR_MASK			(0x3 << 2)
88362306a36Sopenharmony_ci#define RT5670_DAC_OSR_SFT			2
88462306a36Sopenharmony_ci#define RT5670_DAC_OSR_128			(0x0 << 2)
88562306a36Sopenharmony_ci#define RT5670_DAC_OSR_64			(0x1 << 2)
88662306a36Sopenharmony_ci#define RT5670_DAC_OSR_32			(0x2 << 2)
88762306a36Sopenharmony_ci#define RT5670_DAC_OSR_16			(0x3 << 2)
88862306a36Sopenharmony_ci#define RT5670_ADC_OSR_MASK			(0x3)
88962306a36Sopenharmony_ci#define RT5670_ADC_OSR_SFT			0
89062306a36Sopenharmony_ci#define RT5670_ADC_OSR_128			(0x0)
89162306a36Sopenharmony_ci#define RT5670_ADC_OSR_64			(0x1)
89262306a36Sopenharmony_ci#define RT5670_ADC_OSR_32			(0x2)
89362306a36Sopenharmony_ci#define RT5670_ADC_OSR_16			(0x3)
89462306a36Sopenharmony_ci
89562306a36Sopenharmony_ci/* ADC/DAC Clock Control 2 (0x74) */
89662306a36Sopenharmony_ci#define RT5670_DAC_L_OSR_MASK			(0x3 << 14)
89762306a36Sopenharmony_ci#define RT5670_DAC_L_OSR_SFT			14
89862306a36Sopenharmony_ci#define RT5670_DAC_L_OSR_128			(0x0 << 14)
89962306a36Sopenharmony_ci#define RT5670_DAC_L_OSR_64			(0x1 << 14)
90062306a36Sopenharmony_ci#define RT5670_DAC_L_OSR_32			(0x2 << 14)
90162306a36Sopenharmony_ci#define RT5670_DAC_L_OSR_16			(0x3 << 14)
90262306a36Sopenharmony_ci#define RT5670_ADC_R_OSR_MASK			(0x3 << 12)
90362306a36Sopenharmony_ci#define RT5670_ADC_R_OSR_SFT			12
90462306a36Sopenharmony_ci#define RT5670_ADC_R_OSR_128			(0x0 << 12)
90562306a36Sopenharmony_ci#define RT5670_ADC_R_OSR_64			(0x1 << 12)
90662306a36Sopenharmony_ci#define RT5670_ADC_R_OSR_32			(0x2 << 12)
90762306a36Sopenharmony_ci#define RT5670_ADC_R_OSR_16			(0x3 << 12)
90862306a36Sopenharmony_ci#define RT5670_DAHPF_EN				(0x1 << 11)
90962306a36Sopenharmony_ci#define RT5670_DAHPF_EN_SFT			11
91062306a36Sopenharmony_ci#define RT5670_ADHPF_EN				(0x1 << 10)
91162306a36Sopenharmony_ci#define RT5670_ADHPF_EN_SFT			10
91262306a36Sopenharmony_ci
91362306a36Sopenharmony_ci/* Digital Microphone Control (0x75) */
91462306a36Sopenharmony_ci#define RT5670_DMIC_1_EN_MASK			(0x1 << 15)
91562306a36Sopenharmony_ci#define RT5670_DMIC_1_EN_SFT			15
91662306a36Sopenharmony_ci#define RT5670_DMIC_1_DIS			(0x0 << 15)
91762306a36Sopenharmony_ci#define RT5670_DMIC_1_EN			(0x1 << 15)
91862306a36Sopenharmony_ci#define RT5670_DMIC_2_EN_MASK			(0x1 << 14)
91962306a36Sopenharmony_ci#define RT5670_DMIC_2_EN_SFT			14
92062306a36Sopenharmony_ci#define RT5670_DMIC_2_DIS			(0x0 << 14)
92162306a36Sopenharmony_ci#define RT5670_DMIC_2_EN			(0x1 << 14)
92262306a36Sopenharmony_ci#define RT5670_DMIC_1L_LH_MASK			(0x1 << 13)
92362306a36Sopenharmony_ci#define RT5670_DMIC_1L_LH_SFT			13
92462306a36Sopenharmony_ci#define RT5670_DMIC_1L_LH_FALLING		(0x0 << 13)
92562306a36Sopenharmony_ci#define RT5670_DMIC_1L_LH_RISING		(0x1 << 13)
92662306a36Sopenharmony_ci#define RT5670_DMIC_1R_LH_MASK			(0x1 << 12)
92762306a36Sopenharmony_ci#define RT5670_DMIC_1R_LH_SFT			12
92862306a36Sopenharmony_ci#define RT5670_DMIC_1R_LH_FALLING		(0x0 << 12)
92962306a36Sopenharmony_ci#define RT5670_DMIC_1R_LH_RISING		(0x1 << 12)
93062306a36Sopenharmony_ci#define RT5670_DMIC_2_DP_MASK			(0x1 << 10)
93162306a36Sopenharmony_ci#define RT5670_DMIC_2_DP_SFT			10
93262306a36Sopenharmony_ci#define RT5670_DMIC_2_DP_GPIO8			(0x0 << 10)
93362306a36Sopenharmony_ci#define RT5670_DMIC_2_DP_IN3N			(0x1 << 10)
93462306a36Sopenharmony_ci#define RT5670_DMIC_2L_LH_MASK			(0x1 << 9)
93562306a36Sopenharmony_ci#define RT5670_DMIC_2L_LH_SFT			9
93662306a36Sopenharmony_ci#define RT5670_DMIC_2L_LH_FALLING		(0x0 << 9)
93762306a36Sopenharmony_ci#define RT5670_DMIC_2L_LH_RISING		(0x1 << 9)
93862306a36Sopenharmony_ci#define RT5670_DMIC_2R_LH_MASK			(0x1 << 8)
93962306a36Sopenharmony_ci#define RT5670_DMIC_2R_LH_SFT			8
94062306a36Sopenharmony_ci#define RT5670_DMIC_2R_LH_FALLING		(0x0 << 8)
94162306a36Sopenharmony_ci#define RT5670_DMIC_2R_LH_RISING		(0x1 << 8)
94262306a36Sopenharmony_ci#define RT5670_DMIC_CLK_MASK			(0x7 << 5)
94362306a36Sopenharmony_ci#define RT5670_DMIC_CLK_SFT			5
94462306a36Sopenharmony_ci#define RT5670_DMIC_3_EN_MASK			(0x1 << 4)
94562306a36Sopenharmony_ci#define RT5670_DMIC_3_EN_SFT			4
94662306a36Sopenharmony_ci#define RT5670_DMIC_3_DIS			(0x0 << 4)
94762306a36Sopenharmony_ci#define RT5670_DMIC_3_EN			(0x1 << 4)
94862306a36Sopenharmony_ci#define RT5670_DMIC_1_DP_MASK			(0x3 << 0)
94962306a36Sopenharmony_ci#define RT5670_DMIC_1_DP_SFT			0
95062306a36Sopenharmony_ci#define RT5670_DMIC_1_DP_GPIO6			(0x0 << 0)
95162306a36Sopenharmony_ci#define RT5670_DMIC_1_DP_IN2P			(0x1 << 0)
95262306a36Sopenharmony_ci#define RT5670_DMIC_1_DP_GPIO7			(0x2 << 0)
95362306a36Sopenharmony_ci
95462306a36Sopenharmony_ci/* Digital Microphone Control2 (0x76) */
95562306a36Sopenharmony_ci#define RT5670_DMIC_3_DP_MASK			(0x3 << 6)
95662306a36Sopenharmony_ci#define RT5670_DMIC_3_DP_SFT			6
95762306a36Sopenharmony_ci#define RT5670_DMIC_3_DP_GPIO9			(0x0 << 6)
95862306a36Sopenharmony_ci#define RT5670_DMIC_3_DP_GPIO10			(0x1 << 6)
95962306a36Sopenharmony_ci#define RT5670_DMIC_3_DP_GPIO5			(0x2 << 6)
96062306a36Sopenharmony_ci
96162306a36Sopenharmony_ci/* Global Clock Control (0x80) */
96262306a36Sopenharmony_ci#define RT5670_SCLK_SRC_MASK			(0x3 << 14)
96362306a36Sopenharmony_ci#define RT5670_SCLK_SRC_SFT			14
96462306a36Sopenharmony_ci#define RT5670_SCLK_SRC_MCLK			(0x0 << 14)
96562306a36Sopenharmony_ci#define RT5670_SCLK_SRC_PLL1			(0x1 << 14)
96662306a36Sopenharmony_ci#define RT5670_SCLK_SRC_RCCLK			(0x2 << 14) /* 15MHz */
96762306a36Sopenharmony_ci#define RT5670_PLL1_SRC_MASK			(0x7 << 11)
96862306a36Sopenharmony_ci#define RT5670_PLL1_SRC_SFT			11
96962306a36Sopenharmony_ci#define RT5670_PLL1_SRC_MCLK			(0x0 << 11)
97062306a36Sopenharmony_ci#define RT5670_PLL1_SRC_BCLK1			(0x1 << 11)
97162306a36Sopenharmony_ci#define RT5670_PLL1_SRC_BCLK2			(0x2 << 11)
97262306a36Sopenharmony_ci#define RT5670_PLL1_SRC_BCLK3			(0x3 << 11)
97362306a36Sopenharmony_ci#define RT5670_PLL1_PD_MASK			(0x1 << 3)
97462306a36Sopenharmony_ci#define RT5670_PLL1_PD_SFT			3
97562306a36Sopenharmony_ci#define RT5670_PLL1_PD_1			(0x0 << 3)
97662306a36Sopenharmony_ci#define RT5670_PLL1_PD_2			(0x1 << 3)
97762306a36Sopenharmony_ci
97862306a36Sopenharmony_ci#define RT5670_PLL_INP_MAX			40000000
97962306a36Sopenharmony_ci#define RT5670_PLL_INP_MIN			256000
98062306a36Sopenharmony_ci/* PLL M/N/K Code Control 1 (0x81) */
98162306a36Sopenharmony_ci#define RT5670_PLL_N_MAX			0x1ff
98262306a36Sopenharmony_ci#define RT5670_PLL_N_MASK			(RT5670_PLL_N_MAX << 7)
98362306a36Sopenharmony_ci#define RT5670_PLL_N_SFT			7
98462306a36Sopenharmony_ci#define RT5670_PLL_K_MAX			0x1f
98562306a36Sopenharmony_ci#define RT5670_PLL_K_MASK			(RT5670_PLL_K_MAX)
98662306a36Sopenharmony_ci#define RT5670_PLL_K_SFT			0
98762306a36Sopenharmony_ci
98862306a36Sopenharmony_ci/* PLL M/N/K Code Control 2 (0x82) */
98962306a36Sopenharmony_ci#define RT5670_PLL_M_MAX			0xf
99062306a36Sopenharmony_ci#define RT5670_PLL_M_MASK			(RT5670_PLL_M_MAX << 12)
99162306a36Sopenharmony_ci#define RT5670_PLL_M_SFT			12
99262306a36Sopenharmony_ci#define RT5670_PLL_M_BP				(0x1 << 11)
99362306a36Sopenharmony_ci#define RT5670_PLL_M_BP_SFT			11
99462306a36Sopenharmony_ci
99562306a36Sopenharmony_ci/* ASRC Control 1 (0x83) */
99662306a36Sopenharmony_ci#define RT5670_STO_T_MASK			(0x1 << 15)
99762306a36Sopenharmony_ci#define RT5670_STO_T_SFT			15
99862306a36Sopenharmony_ci#define RT5670_STO_T_SCLK			(0x0 << 15)
99962306a36Sopenharmony_ci#define RT5670_STO_T_LRCK1			(0x1 << 15)
100062306a36Sopenharmony_ci#define RT5670_M1_T_MASK			(0x1 << 14)
100162306a36Sopenharmony_ci#define RT5670_M1_T_SFT				14
100262306a36Sopenharmony_ci#define RT5670_M1_T_I2S2			(0x0 << 14)
100362306a36Sopenharmony_ci#define RT5670_M1_T_I2S2_D3			(0x1 << 14)
100462306a36Sopenharmony_ci#define RT5670_I2S2_F_MASK			(0x1 << 12)
100562306a36Sopenharmony_ci#define RT5670_I2S2_F_SFT			12
100662306a36Sopenharmony_ci#define RT5670_I2S2_F_I2S2_D2			(0x0 << 12)
100762306a36Sopenharmony_ci#define RT5670_I2S2_F_I2S1_TCLK			(0x1 << 12)
100862306a36Sopenharmony_ci#define RT5670_DMIC_1_M_MASK			(0x1 << 9)
100962306a36Sopenharmony_ci#define RT5670_DMIC_1_M_SFT			9
101062306a36Sopenharmony_ci#define RT5670_DMIC_1_M_NOR			(0x0 << 9)
101162306a36Sopenharmony_ci#define RT5670_DMIC_1_M_ASYN			(0x1 << 9)
101262306a36Sopenharmony_ci#define RT5670_DMIC_2_M_MASK			(0x1 << 8)
101362306a36Sopenharmony_ci#define RT5670_DMIC_2_M_SFT			8
101462306a36Sopenharmony_ci#define RT5670_DMIC_2_M_NOR			(0x0 << 8)
101562306a36Sopenharmony_ci#define RT5670_DMIC_2_M_ASYN			(0x1 << 8)
101662306a36Sopenharmony_ci
101762306a36Sopenharmony_ci/* ASRC clock source selection (0x84, 0x85) */
101862306a36Sopenharmony_ci#define RT5670_CLK_SEL_SYS			(0x0)
101962306a36Sopenharmony_ci#define RT5670_CLK_SEL_I2S1_ASRC		(0x1)
102062306a36Sopenharmony_ci#define RT5670_CLK_SEL_I2S2_ASRC		(0x2)
102162306a36Sopenharmony_ci#define RT5670_CLK_SEL_I2S3_ASRC		(0x3)
102262306a36Sopenharmony_ci#define RT5670_CLK_SEL_SYS2			(0x5)
102362306a36Sopenharmony_ci#define RT5670_CLK_SEL_SYS3			(0x6)
102462306a36Sopenharmony_ci
102562306a36Sopenharmony_ci/* ASRC Control 2 (0x84) */
102662306a36Sopenharmony_ci#define RT5670_DA_STO_CLK_SEL_MASK		(0xf << 12)
102762306a36Sopenharmony_ci#define RT5670_DA_STO_CLK_SEL_SFT		12
102862306a36Sopenharmony_ci#define RT5670_DA_MONOL_CLK_SEL_MASK		(0xf << 8)
102962306a36Sopenharmony_ci#define RT5670_DA_MONOL_CLK_SEL_SFT		8
103062306a36Sopenharmony_ci#define RT5670_DA_MONOR_CLK_SEL_MASK		(0xf << 4)
103162306a36Sopenharmony_ci#define RT5670_DA_MONOR_CLK_SEL_SFT		4
103262306a36Sopenharmony_ci#define RT5670_AD_STO1_CLK_SEL_MASK		(0xf << 0)
103362306a36Sopenharmony_ci#define RT5670_AD_STO1_CLK_SEL_SFT		0
103462306a36Sopenharmony_ci
103562306a36Sopenharmony_ci/* ASRC Control 3 (0x85) */
103662306a36Sopenharmony_ci#define RT5670_UP_CLK_SEL_MASK			(0xf << 12)
103762306a36Sopenharmony_ci#define RT5670_UP_CLK_SEL_SFT			12
103862306a36Sopenharmony_ci#define RT5670_DOWN_CLK_SEL_MASK		(0xf << 8)
103962306a36Sopenharmony_ci#define RT5670_DOWN_CLK_SEL_SFT			8
104062306a36Sopenharmony_ci#define RT5670_AD_MONOL_CLK_SEL_MASK		(0xf << 4)
104162306a36Sopenharmony_ci#define RT5670_AD_MONOL_CLK_SEL_SFT		4
104262306a36Sopenharmony_ci#define RT5670_AD_MONOR_CLK_SEL_MASK		(0xf << 0)
104362306a36Sopenharmony_ci#define RT5670_AD_MONOR_CLK_SEL_SFT		0
104462306a36Sopenharmony_ci
104562306a36Sopenharmony_ci/* ASRC Control 4 (0x89) */
104662306a36Sopenharmony_ci#define RT5670_I2S1_PD_MASK			(0x7 << 12)
104762306a36Sopenharmony_ci#define RT5670_I2S1_PD_SFT			12
104862306a36Sopenharmony_ci#define RT5670_I2S2_PD_MASK			(0x7 << 8)
104962306a36Sopenharmony_ci#define RT5670_I2S2_PD_SFT			8
105062306a36Sopenharmony_ci
105162306a36Sopenharmony_ci/* HPOUT Over Current Detection (0x8b) */
105262306a36Sopenharmony_ci#define RT5670_HP_OVCD_MASK			(0x1 << 10)
105362306a36Sopenharmony_ci#define RT5670_HP_OVCD_SFT			10
105462306a36Sopenharmony_ci#define RT5670_HP_OVCD_DIS			(0x0 << 10)
105562306a36Sopenharmony_ci#define RT5670_HP_OVCD_EN			(0x1 << 10)
105662306a36Sopenharmony_ci#define RT5670_HP_OC_TH_MASK			(0x3 << 8)
105762306a36Sopenharmony_ci#define RT5670_HP_OC_TH_SFT			8
105862306a36Sopenharmony_ci#define RT5670_HP_OC_TH_90			(0x0 << 8)
105962306a36Sopenharmony_ci#define RT5670_HP_OC_TH_105			(0x1 << 8)
106062306a36Sopenharmony_ci#define RT5670_HP_OC_TH_120			(0x2 << 8)
106162306a36Sopenharmony_ci#define RT5670_HP_OC_TH_135			(0x3 << 8)
106262306a36Sopenharmony_ci
106362306a36Sopenharmony_ci/* Class D Over Current Control (0x8c) */
106462306a36Sopenharmony_ci#define RT5670_CLSD_OC_MASK			(0x1 << 9)
106562306a36Sopenharmony_ci#define RT5670_CLSD_OC_SFT			9
106662306a36Sopenharmony_ci#define RT5670_CLSD_OC_PU			(0x0 << 9)
106762306a36Sopenharmony_ci#define RT5670_CLSD_OC_PD			(0x1 << 9)
106862306a36Sopenharmony_ci#define RT5670_AUTO_PD_MASK			(0x1 << 8)
106962306a36Sopenharmony_ci#define RT5670_AUTO_PD_SFT			8
107062306a36Sopenharmony_ci#define RT5670_AUTO_PD_DIS			(0x0 << 8)
107162306a36Sopenharmony_ci#define RT5670_AUTO_PD_EN			(0x1 << 8)
107262306a36Sopenharmony_ci#define RT5670_CLSD_OC_TH_MASK			(0x3f)
107362306a36Sopenharmony_ci#define RT5670_CLSD_OC_TH_SFT			0
107462306a36Sopenharmony_ci
107562306a36Sopenharmony_ci/* Class D Output Control (0x8d) */
107662306a36Sopenharmony_ci#define RT5670_CLSD_RATIO_MASK			(0xf << 12)
107762306a36Sopenharmony_ci#define RT5670_CLSD_RATIO_SFT			12
107862306a36Sopenharmony_ci#define RT5670_CLSD_OM_MASK			(0x1 << 11)
107962306a36Sopenharmony_ci#define RT5670_CLSD_OM_SFT			11
108062306a36Sopenharmony_ci#define RT5670_CLSD_OM_MONO			(0x0 << 11)
108162306a36Sopenharmony_ci#define RT5670_CLSD_OM_STO			(0x1 << 11)
108262306a36Sopenharmony_ci#define RT5670_CLSD_SCH_MASK			(0x1 << 10)
108362306a36Sopenharmony_ci#define RT5670_CLSD_SCH_SFT			10
108462306a36Sopenharmony_ci#define RT5670_CLSD_SCH_L			(0x0 << 10)
108562306a36Sopenharmony_ci#define RT5670_CLSD_SCH_S			(0x1 << 10)
108662306a36Sopenharmony_ci
108762306a36Sopenharmony_ci/* Depop Mode Control 1 (0x8e) */
108862306a36Sopenharmony_ci#define RT5670_SMT_TRIG_MASK			(0x1 << 15)
108962306a36Sopenharmony_ci#define RT5670_SMT_TRIG_SFT			15
109062306a36Sopenharmony_ci#define RT5670_SMT_TRIG_DIS			(0x0 << 15)
109162306a36Sopenharmony_ci#define RT5670_SMT_TRIG_EN			(0x1 << 15)
109262306a36Sopenharmony_ci#define RT5670_HP_L_SMT_MASK			(0x1 << 9)
109362306a36Sopenharmony_ci#define RT5670_HP_L_SMT_SFT			9
109462306a36Sopenharmony_ci#define RT5670_HP_L_SMT_DIS			(0x0 << 9)
109562306a36Sopenharmony_ci#define RT5670_HP_L_SMT_EN			(0x1 << 9)
109662306a36Sopenharmony_ci#define RT5670_HP_R_SMT_MASK			(0x1 << 8)
109762306a36Sopenharmony_ci#define RT5670_HP_R_SMT_SFT			8
109862306a36Sopenharmony_ci#define RT5670_HP_R_SMT_DIS			(0x0 << 8)
109962306a36Sopenharmony_ci#define RT5670_HP_R_SMT_EN			(0x1 << 8)
110062306a36Sopenharmony_ci#define RT5670_HP_CD_PD_MASK			(0x1 << 7)
110162306a36Sopenharmony_ci#define RT5670_HP_CD_PD_SFT			7
110262306a36Sopenharmony_ci#define RT5670_HP_CD_PD_DIS			(0x0 << 7)
110362306a36Sopenharmony_ci#define RT5670_HP_CD_PD_EN			(0x1 << 7)
110462306a36Sopenharmony_ci#define RT5670_RSTN_MASK			(0x1 << 6)
110562306a36Sopenharmony_ci#define RT5670_RSTN_SFT				6
110662306a36Sopenharmony_ci#define RT5670_RSTN_DIS				(0x0 << 6)
110762306a36Sopenharmony_ci#define RT5670_RSTN_EN				(0x1 << 6)
110862306a36Sopenharmony_ci#define RT5670_RSTP_MASK			(0x1 << 5)
110962306a36Sopenharmony_ci#define RT5670_RSTP_SFT				5
111062306a36Sopenharmony_ci#define RT5670_RSTP_DIS				(0x0 << 5)
111162306a36Sopenharmony_ci#define RT5670_RSTP_EN				(0x1 << 5)
111262306a36Sopenharmony_ci#define RT5670_HP_CO_MASK			(0x1 << 4)
111362306a36Sopenharmony_ci#define RT5670_HP_CO_SFT			4
111462306a36Sopenharmony_ci#define RT5670_HP_CO_DIS			(0x0 << 4)
111562306a36Sopenharmony_ci#define RT5670_HP_CO_EN				(0x1 << 4)
111662306a36Sopenharmony_ci#define RT5670_HP_CP_MASK			(0x1 << 3)
111762306a36Sopenharmony_ci#define RT5670_HP_CP_SFT			3
111862306a36Sopenharmony_ci#define RT5670_HP_CP_PD				(0x0 << 3)
111962306a36Sopenharmony_ci#define RT5670_HP_CP_PU				(0x1 << 3)
112062306a36Sopenharmony_ci#define RT5670_HP_SG_MASK			(0x1 << 2)
112162306a36Sopenharmony_ci#define RT5670_HP_SG_SFT			2
112262306a36Sopenharmony_ci#define RT5670_HP_SG_DIS			(0x0 << 2)
112362306a36Sopenharmony_ci#define RT5670_HP_SG_EN				(0x1 << 2)
112462306a36Sopenharmony_ci#define RT5670_HP_DP_MASK			(0x1 << 1)
112562306a36Sopenharmony_ci#define RT5670_HP_DP_SFT			1
112662306a36Sopenharmony_ci#define RT5670_HP_DP_PD				(0x0 << 1)
112762306a36Sopenharmony_ci#define RT5670_HP_DP_PU				(0x1 << 1)
112862306a36Sopenharmony_ci#define RT5670_HP_CB_MASK			(0x1)
112962306a36Sopenharmony_ci#define RT5670_HP_CB_SFT			0
113062306a36Sopenharmony_ci#define RT5670_HP_CB_PD				(0x0)
113162306a36Sopenharmony_ci#define RT5670_HP_CB_PU				(0x1)
113262306a36Sopenharmony_ci
113362306a36Sopenharmony_ci/* Depop Mode Control 2 (0x8f) */
113462306a36Sopenharmony_ci#define RT5670_DEPOP_MASK			(0x1 << 13)
113562306a36Sopenharmony_ci#define RT5670_DEPOP_SFT			13
113662306a36Sopenharmony_ci#define RT5670_DEPOP_AUTO			(0x0 << 13)
113762306a36Sopenharmony_ci#define RT5670_DEPOP_MAN			(0x1 << 13)
113862306a36Sopenharmony_ci#define RT5670_RAMP_MASK			(0x1 << 12)
113962306a36Sopenharmony_ci#define RT5670_RAMP_SFT				12
114062306a36Sopenharmony_ci#define RT5670_RAMP_DIS				(0x0 << 12)
114162306a36Sopenharmony_ci#define RT5670_RAMP_EN				(0x1 << 12)
114262306a36Sopenharmony_ci#define RT5670_BPS_MASK				(0x1 << 11)
114362306a36Sopenharmony_ci#define RT5670_BPS_SFT				11
114462306a36Sopenharmony_ci#define RT5670_BPS_DIS				(0x0 << 11)
114562306a36Sopenharmony_ci#define RT5670_BPS_EN				(0x1 << 11)
114662306a36Sopenharmony_ci#define RT5670_FAST_UPDN_MASK			(0x1 << 10)
114762306a36Sopenharmony_ci#define RT5670_FAST_UPDN_SFT			10
114862306a36Sopenharmony_ci#define RT5670_FAST_UPDN_DIS			(0x0 << 10)
114962306a36Sopenharmony_ci#define RT5670_FAST_UPDN_EN			(0x1 << 10)
115062306a36Sopenharmony_ci#define RT5670_MRES_MASK			(0x3 << 8)
115162306a36Sopenharmony_ci#define RT5670_MRES_SFT				8
115262306a36Sopenharmony_ci#define RT5670_MRES_15MO			(0x0 << 8)
115362306a36Sopenharmony_ci#define RT5670_MRES_25MO			(0x1 << 8)
115462306a36Sopenharmony_ci#define RT5670_MRES_35MO			(0x2 << 8)
115562306a36Sopenharmony_ci#define RT5670_MRES_45MO			(0x3 << 8)
115662306a36Sopenharmony_ci#define RT5670_VLO_MASK				(0x1 << 7)
115762306a36Sopenharmony_ci#define RT5670_VLO_SFT				7
115862306a36Sopenharmony_ci#define RT5670_VLO_3V				(0x0 << 7)
115962306a36Sopenharmony_ci#define RT5670_VLO_32V				(0x1 << 7)
116062306a36Sopenharmony_ci#define RT5670_DIG_DP_MASK			(0x1 << 6)
116162306a36Sopenharmony_ci#define RT5670_DIG_DP_SFT			6
116262306a36Sopenharmony_ci#define RT5670_DIG_DP_DIS			(0x0 << 6)
116362306a36Sopenharmony_ci#define RT5670_DIG_DP_EN			(0x1 << 6)
116462306a36Sopenharmony_ci#define RT5670_DP_TH_MASK			(0x3 << 4)
116562306a36Sopenharmony_ci#define RT5670_DP_TH_SFT			4
116662306a36Sopenharmony_ci
116762306a36Sopenharmony_ci/* Depop Mode Control 3 (0x90) */
116862306a36Sopenharmony_ci#define RT5670_CP_SYS_MASK			(0x7 << 12)
116962306a36Sopenharmony_ci#define RT5670_CP_SYS_SFT			12
117062306a36Sopenharmony_ci#define RT5670_CP_FQ1_MASK			(0x7 << 8)
117162306a36Sopenharmony_ci#define RT5670_CP_FQ1_SFT			8
117262306a36Sopenharmony_ci#define RT5670_CP_FQ2_MASK			(0x7 << 4)
117362306a36Sopenharmony_ci#define RT5670_CP_FQ2_SFT			4
117462306a36Sopenharmony_ci#define RT5670_CP_FQ3_MASK			(0x7)
117562306a36Sopenharmony_ci#define RT5670_CP_FQ3_SFT			0
117662306a36Sopenharmony_ci#define RT5670_CP_FQ_1_5_KHZ			0
117762306a36Sopenharmony_ci#define RT5670_CP_FQ_3_KHZ			1
117862306a36Sopenharmony_ci#define RT5670_CP_FQ_6_KHZ			2
117962306a36Sopenharmony_ci#define RT5670_CP_FQ_12_KHZ			3
118062306a36Sopenharmony_ci#define RT5670_CP_FQ_24_KHZ			4
118162306a36Sopenharmony_ci#define RT5670_CP_FQ_48_KHZ			5
118262306a36Sopenharmony_ci#define RT5670_CP_FQ_96_KHZ			6
118362306a36Sopenharmony_ci#define RT5670_CP_FQ_192_KHZ			7
118462306a36Sopenharmony_ci
118562306a36Sopenharmony_ci/* HPOUT charge pump (0x91) */
118662306a36Sopenharmony_ci#define RT5670_OSW_L_MASK			(0x1 << 11)
118762306a36Sopenharmony_ci#define RT5670_OSW_L_SFT			11
118862306a36Sopenharmony_ci#define RT5670_OSW_L_DIS			(0x0 << 11)
118962306a36Sopenharmony_ci#define RT5670_OSW_L_EN				(0x1 << 11)
119062306a36Sopenharmony_ci#define RT5670_OSW_R_MASK			(0x1 << 10)
119162306a36Sopenharmony_ci#define RT5670_OSW_R_SFT			10
119262306a36Sopenharmony_ci#define RT5670_OSW_R_DIS			(0x0 << 10)
119362306a36Sopenharmony_ci#define RT5670_OSW_R_EN				(0x1 << 10)
119462306a36Sopenharmony_ci#define RT5670_PM_HP_MASK			(0x3 << 8)
119562306a36Sopenharmony_ci#define RT5670_PM_HP_SFT			8
119662306a36Sopenharmony_ci#define RT5670_PM_HP_LV				(0x0 << 8)
119762306a36Sopenharmony_ci#define RT5670_PM_HP_MV				(0x1 << 8)
119862306a36Sopenharmony_ci#define RT5670_PM_HP_HV				(0x2 << 8)
119962306a36Sopenharmony_ci#define RT5670_IB_HP_MASK			(0x3 << 6)
120062306a36Sopenharmony_ci#define RT5670_IB_HP_SFT			6
120162306a36Sopenharmony_ci#define RT5670_IB_HP_125IL			(0x0 << 6)
120262306a36Sopenharmony_ci#define RT5670_IB_HP_25IL			(0x1 << 6)
120362306a36Sopenharmony_ci#define RT5670_IB_HP_5IL			(0x2 << 6)
120462306a36Sopenharmony_ci#define RT5670_IB_HP_1IL			(0x3 << 6)
120562306a36Sopenharmony_ci
120662306a36Sopenharmony_ci/* PV detection and SPK gain control (0x92) */
120762306a36Sopenharmony_ci#define RT5670_PVDD_DET_MASK			(0x1 << 15)
120862306a36Sopenharmony_ci#define RT5670_PVDD_DET_SFT			15
120962306a36Sopenharmony_ci#define RT5670_PVDD_DET_DIS			(0x0 << 15)
121062306a36Sopenharmony_ci#define RT5670_PVDD_DET_EN			(0x1 << 15)
121162306a36Sopenharmony_ci#define RT5670_SPK_AG_MASK			(0x1 << 14)
121262306a36Sopenharmony_ci#define RT5670_SPK_AG_SFT			14
121362306a36Sopenharmony_ci#define RT5670_SPK_AG_DIS			(0x0 << 14)
121462306a36Sopenharmony_ci#define RT5670_SPK_AG_EN			(0x1 << 14)
121562306a36Sopenharmony_ci
121662306a36Sopenharmony_ci/* Micbias Control (0x93) */
121762306a36Sopenharmony_ci#define RT5670_MIC1_BS_MASK			(0x1 << 15)
121862306a36Sopenharmony_ci#define RT5670_MIC1_BS_SFT			15
121962306a36Sopenharmony_ci#define RT5670_MIC1_BS_9AV			(0x0 << 15)
122062306a36Sopenharmony_ci#define RT5670_MIC1_BS_75AV			(0x1 << 15)
122162306a36Sopenharmony_ci#define RT5670_MIC2_BS_MASK			(0x1 << 14)
122262306a36Sopenharmony_ci#define RT5670_MIC2_BS_SFT			14
122362306a36Sopenharmony_ci#define RT5670_MIC2_BS_9AV			(0x0 << 14)
122462306a36Sopenharmony_ci#define RT5670_MIC2_BS_75AV			(0x1 << 14)
122562306a36Sopenharmony_ci#define RT5670_MIC1_CLK_MASK			(0x1 << 13)
122662306a36Sopenharmony_ci#define RT5670_MIC1_CLK_SFT			13
122762306a36Sopenharmony_ci#define RT5670_MIC1_CLK_DIS			(0x0 << 13)
122862306a36Sopenharmony_ci#define RT5670_MIC1_CLK_EN			(0x1 << 13)
122962306a36Sopenharmony_ci#define RT5670_MIC2_CLK_MASK			(0x1 << 12)
123062306a36Sopenharmony_ci#define RT5670_MIC2_CLK_SFT			12
123162306a36Sopenharmony_ci#define RT5670_MIC2_CLK_DIS			(0x0 << 12)
123262306a36Sopenharmony_ci#define RT5670_MIC2_CLK_EN			(0x1 << 12)
123362306a36Sopenharmony_ci#define RT5670_MIC1_OVCD_MASK			(0x1 << 11)
123462306a36Sopenharmony_ci#define RT5670_MIC1_OVCD_SFT			11
123562306a36Sopenharmony_ci#define RT5670_MIC1_OVCD_DIS			(0x0 << 11)
123662306a36Sopenharmony_ci#define RT5670_MIC1_OVCD_EN			(0x1 << 11)
123762306a36Sopenharmony_ci#define RT5670_MIC1_OVTH_MASK			(0x3 << 9)
123862306a36Sopenharmony_ci#define RT5670_MIC1_OVTH_SFT			9
123962306a36Sopenharmony_ci#define RT5670_MIC1_OVTH_600UA			(0x0 << 9)
124062306a36Sopenharmony_ci#define RT5670_MIC1_OVTH_1500UA			(0x1 << 9)
124162306a36Sopenharmony_ci#define RT5670_MIC1_OVTH_2000UA			(0x2 << 9)
124262306a36Sopenharmony_ci#define RT5670_MIC2_OVCD_MASK			(0x1 << 8)
124362306a36Sopenharmony_ci#define RT5670_MIC2_OVCD_SFT			8
124462306a36Sopenharmony_ci#define RT5670_MIC2_OVCD_DIS			(0x0 << 8)
124562306a36Sopenharmony_ci#define RT5670_MIC2_OVCD_EN			(0x1 << 8)
124662306a36Sopenharmony_ci#define RT5670_MIC2_OVTH_MASK			(0x3 << 6)
124762306a36Sopenharmony_ci#define RT5670_MIC2_OVTH_SFT			6
124862306a36Sopenharmony_ci#define RT5670_MIC2_OVTH_600UA			(0x0 << 6)
124962306a36Sopenharmony_ci#define RT5670_MIC2_OVTH_1500UA			(0x1 << 6)
125062306a36Sopenharmony_ci#define RT5670_MIC2_OVTH_2000UA			(0x2 << 6)
125162306a36Sopenharmony_ci#define RT5670_PWR_MB_MASK			(0x1 << 5)
125262306a36Sopenharmony_ci#define RT5670_PWR_MB_SFT			5
125362306a36Sopenharmony_ci#define RT5670_PWR_MB_PD			(0x0 << 5)
125462306a36Sopenharmony_ci#define RT5670_PWR_MB_PU			(0x1 << 5)
125562306a36Sopenharmony_ci#define RT5670_PWR_CLK25M_MASK			(0x1 << 4)
125662306a36Sopenharmony_ci#define RT5670_PWR_CLK25M_SFT			4
125762306a36Sopenharmony_ci#define RT5670_PWR_CLK25M_PD			(0x0 << 4)
125862306a36Sopenharmony_ci#define RT5670_PWR_CLK25M_PU			(0x1 << 4)
125962306a36Sopenharmony_ci
126062306a36Sopenharmony_ci/* Analog JD Control 1 (0x94) */
126162306a36Sopenharmony_ci#define RT5670_JD1_MODE_MASK			(0x3 << 0)
126262306a36Sopenharmony_ci#define RT5670_JD1_MODE_0			(0x0 << 0)
126362306a36Sopenharmony_ci#define RT5670_JD1_MODE_1			(0x1 << 0)
126462306a36Sopenharmony_ci#define RT5670_JD1_MODE_2			(0x2 << 0)
126562306a36Sopenharmony_ci
126662306a36Sopenharmony_ci/* VAD Control 4 (0x9d) */
126762306a36Sopenharmony_ci#define RT5670_VAD_SEL_MASK			(0x3 << 8)
126862306a36Sopenharmony_ci#define RT5670_VAD_SEL_SFT			8
126962306a36Sopenharmony_ci
127062306a36Sopenharmony_ci/* EQ Control 1 (0xb0) */
127162306a36Sopenharmony_ci#define RT5670_EQ_SRC_MASK			(0x1 << 15)
127262306a36Sopenharmony_ci#define RT5670_EQ_SRC_SFT			15
127362306a36Sopenharmony_ci#define RT5670_EQ_SRC_DAC			(0x0 << 15)
127462306a36Sopenharmony_ci#define RT5670_EQ_SRC_ADC			(0x1 << 15)
127562306a36Sopenharmony_ci#define RT5670_EQ_UPD				(0x1 << 14)
127662306a36Sopenharmony_ci#define RT5670_EQ_UPD_BIT			14
127762306a36Sopenharmony_ci#define RT5670_EQ_CD_MASK			(0x1 << 13)
127862306a36Sopenharmony_ci#define RT5670_EQ_CD_SFT			13
127962306a36Sopenharmony_ci#define RT5670_EQ_CD_DIS			(0x0 << 13)
128062306a36Sopenharmony_ci#define RT5670_EQ_CD_EN				(0x1 << 13)
128162306a36Sopenharmony_ci#define RT5670_EQ_DITH_MASK			(0x3 << 8)
128262306a36Sopenharmony_ci#define RT5670_EQ_DITH_SFT			8
128362306a36Sopenharmony_ci#define RT5670_EQ_DITH_NOR			(0x0 << 8)
128462306a36Sopenharmony_ci#define RT5670_EQ_DITH_LSB			(0x1 << 8)
128562306a36Sopenharmony_ci#define RT5670_EQ_DITH_LSB_1			(0x2 << 8)
128662306a36Sopenharmony_ci#define RT5670_EQ_DITH_LSB_2			(0x3 << 8)
128762306a36Sopenharmony_ci
128862306a36Sopenharmony_ci/* EQ Control 2 (0xb1) */
128962306a36Sopenharmony_ci#define RT5670_EQ_HPF1_M_MASK			(0x1 << 8)
129062306a36Sopenharmony_ci#define RT5670_EQ_HPF1_M_SFT			8
129162306a36Sopenharmony_ci#define RT5670_EQ_HPF1_M_HI			(0x0 << 8)
129262306a36Sopenharmony_ci#define RT5670_EQ_HPF1_M_1ST			(0x1 << 8)
129362306a36Sopenharmony_ci#define RT5670_EQ_LPF1_M_MASK			(0x1 << 7)
129462306a36Sopenharmony_ci#define RT5670_EQ_LPF1_M_SFT			7
129562306a36Sopenharmony_ci#define RT5670_EQ_LPF1_M_LO			(0x0 << 7)
129662306a36Sopenharmony_ci#define RT5670_EQ_LPF1_M_1ST			(0x1 << 7)
129762306a36Sopenharmony_ci#define RT5670_EQ_HPF2_MASK			(0x1 << 6)
129862306a36Sopenharmony_ci#define RT5670_EQ_HPF2_SFT			6
129962306a36Sopenharmony_ci#define RT5670_EQ_HPF2_DIS			(0x0 << 6)
130062306a36Sopenharmony_ci#define RT5670_EQ_HPF2_EN			(0x1 << 6)
130162306a36Sopenharmony_ci#define RT5670_EQ_HPF1_MASK			(0x1 << 5)
130262306a36Sopenharmony_ci#define RT5670_EQ_HPF1_SFT			5
130362306a36Sopenharmony_ci#define RT5670_EQ_HPF1_DIS			(0x0 << 5)
130462306a36Sopenharmony_ci#define RT5670_EQ_HPF1_EN			(0x1 << 5)
130562306a36Sopenharmony_ci#define RT5670_EQ_BPF4_MASK			(0x1 << 4)
130662306a36Sopenharmony_ci#define RT5670_EQ_BPF4_SFT			4
130762306a36Sopenharmony_ci#define RT5670_EQ_BPF4_DIS			(0x0 << 4)
130862306a36Sopenharmony_ci#define RT5670_EQ_BPF4_EN			(0x1 << 4)
130962306a36Sopenharmony_ci#define RT5670_EQ_BPF3_MASK			(0x1 << 3)
131062306a36Sopenharmony_ci#define RT5670_EQ_BPF3_SFT			3
131162306a36Sopenharmony_ci#define RT5670_EQ_BPF3_DIS			(0x0 << 3)
131262306a36Sopenharmony_ci#define RT5670_EQ_BPF3_EN			(0x1 << 3)
131362306a36Sopenharmony_ci#define RT5670_EQ_BPF2_MASK			(0x1 << 2)
131462306a36Sopenharmony_ci#define RT5670_EQ_BPF2_SFT			2
131562306a36Sopenharmony_ci#define RT5670_EQ_BPF2_DIS			(0x0 << 2)
131662306a36Sopenharmony_ci#define RT5670_EQ_BPF2_EN			(0x1 << 2)
131762306a36Sopenharmony_ci#define RT5670_EQ_BPF1_MASK			(0x1 << 1)
131862306a36Sopenharmony_ci#define RT5670_EQ_BPF1_SFT			1
131962306a36Sopenharmony_ci#define RT5670_EQ_BPF1_DIS			(0x0 << 1)
132062306a36Sopenharmony_ci#define RT5670_EQ_BPF1_EN			(0x1 << 1)
132162306a36Sopenharmony_ci#define RT5670_EQ_LPF_MASK			(0x1)
132262306a36Sopenharmony_ci#define RT5670_EQ_LPF_SFT			0
132362306a36Sopenharmony_ci#define RT5670_EQ_LPF_DIS			(0x0)
132462306a36Sopenharmony_ci#define RT5670_EQ_LPF_EN			(0x1)
132562306a36Sopenharmony_ci#define RT5670_EQ_CTRL_MASK			(0x7f)
132662306a36Sopenharmony_ci
132762306a36Sopenharmony_ci/* Memory Test (0xb2) */
132862306a36Sopenharmony_ci#define RT5670_MT_MASK				(0x1 << 15)
132962306a36Sopenharmony_ci#define RT5670_MT_SFT				15
133062306a36Sopenharmony_ci#define RT5670_MT_DIS				(0x0 << 15)
133162306a36Sopenharmony_ci#define RT5670_MT_EN				(0x1 << 15)
133262306a36Sopenharmony_ci
133362306a36Sopenharmony_ci/* DRC/AGC Control 1 (0xb4) */
133462306a36Sopenharmony_ci#define RT5670_DRC_AGC_P_MASK			(0x1 << 15)
133562306a36Sopenharmony_ci#define RT5670_DRC_AGC_P_SFT			15
133662306a36Sopenharmony_ci#define RT5670_DRC_AGC_P_DAC			(0x0 << 15)
133762306a36Sopenharmony_ci#define RT5670_DRC_AGC_P_ADC			(0x1 << 15)
133862306a36Sopenharmony_ci#define RT5670_DRC_AGC_MASK			(0x1 << 14)
133962306a36Sopenharmony_ci#define RT5670_DRC_AGC_SFT			14
134062306a36Sopenharmony_ci#define RT5670_DRC_AGC_DIS			(0x0 << 14)
134162306a36Sopenharmony_ci#define RT5670_DRC_AGC_EN			(0x1 << 14)
134262306a36Sopenharmony_ci#define RT5670_DRC_AGC_UPD			(0x1 << 13)
134362306a36Sopenharmony_ci#define RT5670_DRC_AGC_UPD_BIT			13
134462306a36Sopenharmony_ci#define RT5670_DRC_AGC_AR_MASK			(0x1f << 8)
134562306a36Sopenharmony_ci#define RT5670_DRC_AGC_AR_SFT			8
134662306a36Sopenharmony_ci#define RT5670_DRC_AGC_R_MASK			(0x7 << 5)
134762306a36Sopenharmony_ci#define RT5670_DRC_AGC_R_SFT			5
134862306a36Sopenharmony_ci#define RT5670_DRC_AGC_R_48K			(0x1 << 5)
134962306a36Sopenharmony_ci#define RT5670_DRC_AGC_R_96K			(0x2 << 5)
135062306a36Sopenharmony_ci#define RT5670_DRC_AGC_R_192K			(0x3 << 5)
135162306a36Sopenharmony_ci#define RT5670_DRC_AGC_R_441K			(0x5 << 5)
135262306a36Sopenharmony_ci#define RT5670_DRC_AGC_R_882K			(0x6 << 5)
135362306a36Sopenharmony_ci#define RT5670_DRC_AGC_R_1764K			(0x7 << 5)
135462306a36Sopenharmony_ci#define RT5670_DRC_AGC_RC_MASK			(0x1f)
135562306a36Sopenharmony_ci#define RT5670_DRC_AGC_RC_SFT			0
135662306a36Sopenharmony_ci
135762306a36Sopenharmony_ci/* DRC/AGC Control 2 (0xb5) */
135862306a36Sopenharmony_ci#define RT5670_DRC_AGC_POB_MASK			(0x3f << 8)
135962306a36Sopenharmony_ci#define RT5670_DRC_AGC_POB_SFT			8
136062306a36Sopenharmony_ci#define RT5670_DRC_AGC_CP_MASK			(0x1 << 7)
136162306a36Sopenharmony_ci#define RT5670_DRC_AGC_CP_SFT			7
136262306a36Sopenharmony_ci#define RT5670_DRC_AGC_CP_DIS			(0x0 << 7)
136362306a36Sopenharmony_ci#define RT5670_DRC_AGC_CP_EN			(0x1 << 7)
136462306a36Sopenharmony_ci#define RT5670_DRC_AGC_CPR_MASK			(0x3 << 5)
136562306a36Sopenharmony_ci#define RT5670_DRC_AGC_CPR_SFT			5
136662306a36Sopenharmony_ci#define RT5670_DRC_AGC_CPR_1_1			(0x0 << 5)
136762306a36Sopenharmony_ci#define RT5670_DRC_AGC_CPR_1_2			(0x1 << 5)
136862306a36Sopenharmony_ci#define RT5670_DRC_AGC_CPR_1_3			(0x2 << 5)
136962306a36Sopenharmony_ci#define RT5670_DRC_AGC_CPR_1_4			(0x3 << 5)
137062306a36Sopenharmony_ci#define RT5670_DRC_AGC_PRB_MASK			(0x1f)
137162306a36Sopenharmony_ci#define RT5670_DRC_AGC_PRB_SFT			0
137262306a36Sopenharmony_ci
137362306a36Sopenharmony_ci/* DRC/AGC Control 3 (0xb6) */
137462306a36Sopenharmony_ci#define RT5670_DRC_AGC_NGB_MASK			(0xf << 12)
137562306a36Sopenharmony_ci#define RT5670_DRC_AGC_NGB_SFT			12
137662306a36Sopenharmony_ci#define RT5670_DRC_AGC_TAR_MASK			(0x1f << 7)
137762306a36Sopenharmony_ci#define RT5670_DRC_AGC_TAR_SFT			7
137862306a36Sopenharmony_ci#define RT5670_DRC_AGC_NG_MASK			(0x1 << 6)
137962306a36Sopenharmony_ci#define RT5670_DRC_AGC_NG_SFT			6
138062306a36Sopenharmony_ci#define RT5670_DRC_AGC_NG_DIS			(0x0 << 6)
138162306a36Sopenharmony_ci#define RT5670_DRC_AGC_NG_EN			(0x1 << 6)
138262306a36Sopenharmony_ci#define RT5670_DRC_AGC_NGH_MASK			(0x1 << 5)
138362306a36Sopenharmony_ci#define RT5670_DRC_AGC_NGH_SFT			5
138462306a36Sopenharmony_ci#define RT5670_DRC_AGC_NGH_DIS			(0x0 << 5)
138562306a36Sopenharmony_ci#define RT5670_DRC_AGC_NGH_EN			(0x1 << 5)
138662306a36Sopenharmony_ci#define RT5670_DRC_AGC_NGT_MASK			(0x1f)
138762306a36Sopenharmony_ci#define RT5670_DRC_AGC_NGT_SFT			0
138862306a36Sopenharmony_ci
138962306a36Sopenharmony_ci/* Jack Detect Control (0xbb) */
139062306a36Sopenharmony_ci#define RT5670_JD_MASK				(0x7 << 13)
139162306a36Sopenharmony_ci#define RT5670_JD_SFT				13
139262306a36Sopenharmony_ci#define RT5670_JD_DIS				(0x0 << 13)
139362306a36Sopenharmony_ci#define RT5670_JD_GPIO1				(0x1 << 13)
139462306a36Sopenharmony_ci#define RT5670_JD_JD1_IN4P			(0x2 << 13)
139562306a36Sopenharmony_ci#define RT5670_JD_JD2_IN4N			(0x3 << 13)
139662306a36Sopenharmony_ci#define RT5670_JD_GPIO2				(0x4 << 13)
139762306a36Sopenharmony_ci#define RT5670_JD_GPIO3				(0x5 << 13)
139862306a36Sopenharmony_ci#define RT5670_JD_GPIO4				(0x6 << 13)
139962306a36Sopenharmony_ci#define RT5670_JD_HP_MASK			(0x1 << 11)
140062306a36Sopenharmony_ci#define RT5670_JD_HP_SFT			11
140162306a36Sopenharmony_ci#define RT5670_JD_HP_DIS			(0x0 << 11)
140262306a36Sopenharmony_ci#define RT5670_JD_HP_EN				(0x1 << 11)
140362306a36Sopenharmony_ci#define RT5670_JD_HP_TRG_MASK			(0x1 << 10)
140462306a36Sopenharmony_ci#define RT5670_JD_HP_TRG_SFT			10
140562306a36Sopenharmony_ci#define RT5670_JD_HP_TRG_LO			(0x0 << 10)
140662306a36Sopenharmony_ci#define RT5670_JD_HP_TRG_HI			(0x1 << 10)
140762306a36Sopenharmony_ci#define RT5670_JD_SPL_MASK			(0x1 << 9)
140862306a36Sopenharmony_ci#define RT5670_JD_SPL_SFT			9
140962306a36Sopenharmony_ci#define RT5670_JD_SPL_DIS			(0x0 << 9)
141062306a36Sopenharmony_ci#define RT5670_JD_SPL_EN			(0x1 << 9)
141162306a36Sopenharmony_ci#define RT5670_JD_SPL_TRG_MASK			(0x1 << 8)
141262306a36Sopenharmony_ci#define RT5670_JD_SPL_TRG_SFT			8
141362306a36Sopenharmony_ci#define RT5670_JD_SPL_TRG_LO			(0x0 << 8)
141462306a36Sopenharmony_ci#define RT5670_JD_SPL_TRG_HI			(0x1 << 8)
141562306a36Sopenharmony_ci#define RT5670_JD_SPR_MASK			(0x1 << 7)
141662306a36Sopenharmony_ci#define RT5670_JD_SPR_SFT			7
141762306a36Sopenharmony_ci#define RT5670_JD_SPR_DIS			(0x0 << 7)
141862306a36Sopenharmony_ci#define RT5670_JD_SPR_EN			(0x1 << 7)
141962306a36Sopenharmony_ci#define RT5670_JD_SPR_TRG_MASK			(0x1 << 6)
142062306a36Sopenharmony_ci#define RT5670_JD_SPR_TRG_SFT			6
142162306a36Sopenharmony_ci#define RT5670_JD_SPR_TRG_LO			(0x0 << 6)
142262306a36Sopenharmony_ci#define RT5670_JD_SPR_TRG_HI			(0x1 << 6)
142362306a36Sopenharmony_ci#define RT5670_JD_MO_MASK			(0x1 << 5)
142462306a36Sopenharmony_ci#define RT5670_JD_MO_SFT			5
142562306a36Sopenharmony_ci#define RT5670_JD_MO_DIS			(0x0 << 5)
142662306a36Sopenharmony_ci#define RT5670_JD_MO_EN				(0x1 << 5)
142762306a36Sopenharmony_ci#define RT5670_JD_MO_TRG_MASK			(0x1 << 4)
142862306a36Sopenharmony_ci#define RT5670_JD_MO_TRG_SFT			4
142962306a36Sopenharmony_ci#define RT5670_JD_MO_TRG_LO			(0x0 << 4)
143062306a36Sopenharmony_ci#define RT5670_JD_MO_TRG_HI			(0x1 << 4)
143162306a36Sopenharmony_ci#define RT5670_JD_LO_MASK			(0x1 << 3)
143262306a36Sopenharmony_ci#define RT5670_JD_LO_SFT			3
143362306a36Sopenharmony_ci#define RT5670_JD_LO_DIS			(0x0 << 3)
143462306a36Sopenharmony_ci#define RT5670_JD_LO_EN				(0x1 << 3)
143562306a36Sopenharmony_ci#define RT5670_JD_LO_TRG_MASK			(0x1 << 2)
143662306a36Sopenharmony_ci#define RT5670_JD_LO_TRG_SFT			2
143762306a36Sopenharmony_ci#define RT5670_JD_LO_TRG_LO			(0x0 << 2)
143862306a36Sopenharmony_ci#define RT5670_JD_LO_TRG_HI			(0x1 << 2)
143962306a36Sopenharmony_ci#define RT5670_JD1_IN4P_MASK			(0x1 << 1)
144062306a36Sopenharmony_ci#define RT5670_JD1_IN4P_SFT			1
144162306a36Sopenharmony_ci#define RT5670_JD1_IN4P_DIS			(0x0 << 1)
144262306a36Sopenharmony_ci#define RT5670_JD1_IN4P_EN			(0x1 << 1)
144362306a36Sopenharmony_ci#define RT5670_JD2_IN4N_MASK			(0x1)
144462306a36Sopenharmony_ci#define RT5670_JD2_IN4N_SFT			0
144562306a36Sopenharmony_ci#define RT5670_JD2_IN4N_DIS			(0x0)
144662306a36Sopenharmony_ci#define RT5670_JD2_IN4N_EN			(0x1)
144762306a36Sopenharmony_ci
144862306a36Sopenharmony_ci/* IRQ Control 1 (0xbd) */
144962306a36Sopenharmony_ci#define RT5670_IRQ_JD_MASK			(0x1 << 15)
145062306a36Sopenharmony_ci#define RT5670_IRQ_JD_SFT			15
145162306a36Sopenharmony_ci#define RT5670_IRQ_JD_BP			(0x0 << 15)
145262306a36Sopenharmony_ci#define RT5670_IRQ_JD_NOR			(0x1 << 15)
145362306a36Sopenharmony_ci#define RT5670_IRQ_OT_MASK			(0x1 << 14)
145462306a36Sopenharmony_ci#define RT5670_IRQ_OT_SFT			14
145562306a36Sopenharmony_ci#define RT5670_IRQ_OT_BP			(0x0 << 14)
145662306a36Sopenharmony_ci#define RT5670_IRQ_OT_NOR			(0x1 << 14)
145762306a36Sopenharmony_ci#define RT5670_JD_STKY_MASK			(0x1 << 13)
145862306a36Sopenharmony_ci#define RT5670_JD_STKY_SFT			13
145962306a36Sopenharmony_ci#define RT5670_JD_STKY_DIS			(0x0 << 13)
146062306a36Sopenharmony_ci#define RT5670_JD_STKY_EN			(0x1 << 13)
146162306a36Sopenharmony_ci#define RT5670_OT_STKY_MASK			(0x1 << 12)
146262306a36Sopenharmony_ci#define RT5670_OT_STKY_SFT			12
146362306a36Sopenharmony_ci#define RT5670_OT_STKY_DIS			(0x0 << 12)
146462306a36Sopenharmony_ci#define RT5670_OT_STKY_EN			(0x1 << 12)
146562306a36Sopenharmony_ci#define RT5670_JD_P_MASK			(0x1 << 11)
146662306a36Sopenharmony_ci#define RT5670_JD_P_SFT				11
146762306a36Sopenharmony_ci#define RT5670_JD_P_NOR				(0x0 << 11)
146862306a36Sopenharmony_ci#define RT5670_JD_P_INV				(0x1 << 11)
146962306a36Sopenharmony_ci#define RT5670_OT_P_MASK			(0x1 << 10)
147062306a36Sopenharmony_ci#define RT5670_OT_P_SFT				10
147162306a36Sopenharmony_ci#define RT5670_OT_P_NOR				(0x0 << 10)
147262306a36Sopenharmony_ci#define RT5670_OT_P_INV				(0x1 << 10)
147362306a36Sopenharmony_ci#define RT5670_JD1_1_EN_MASK			(0x1 << 9)
147462306a36Sopenharmony_ci#define RT5670_JD1_1_EN_SFT			9
147562306a36Sopenharmony_ci#define RT5670_JD1_1_DIS			(0x0 << 9)
147662306a36Sopenharmony_ci#define RT5670_JD1_1_EN				(0x1 << 9)
147762306a36Sopenharmony_ci
147862306a36Sopenharmony_ci/* IRQ Control 2 (0xbe) */
147962306a36Sopenharmony_ci#define RT5670_IRQ_MB1_OC_MASK			(0x1 << 15)
148062306a36Sopenharmony_ci#define RT5670_IRQ_MB1_OC_SFT			15
148162306a36Sopenharmony_ci#define RT5670_IRQ_MB1_OC_BP			(0x0 << 15)
148262306a36Sopenharmony_ci#define RT5670_IRQ_MB1_OC_NOR			(0x1 << 15)
148362306a36Sopenharmony_ci#define RT5670_IRQ_MB2_OC_MASK			(0x1 << 14)
148462306a36Sopenharmony_ci#define RT5670_IRQ_MB2_OC_SFT			14
148562306a36Sopenharmony_ci#define RT5670_IRQ_MB2_OC_BP			(0x0 << 14)
148662306a36Sopenharmony_ci#define RT5670_IRQ_MB2_OC_NOR			(0x1 << 14)
148762306a36Sopenharmony_ci#define RT5670_MB1_OC_STKY_MASK			(0x1 << 11)
148862306a36Sopenharmony_ci#define RT5670_MB1_OC_STKY_SFT			11
148962306a36Sopenharmony_ci#define RT5670_MB1_OC_STKY_DIS			(0x0 << 11)
149062306a36Sopenharmony_ci#define RT5670_MB1_OC_STKY_EN			(0x1 << 11)
149162306a36Sopenharmony_ci#define RT5670_MB2_OC_STKY_MASK			(0x1 << 10)
149262306a36Sopenharmony_ci#define RT5670_MB2_OC_STKY_SFT			10
149362306a36Sopenharmony_ci#define RT5670_MB2_OC_STKY_DIS			(0x0 << 10)
149462306a36Sopenharmony_ci#define RT5670_MB2_OC_STKY_EN			(0x1 << 10)
149562306a36Sopenharmony_ci#define RT5670_MB1_OC_P_MASK			(0x1 << 7)
149662306a36Sopenharmony_ci#define RT5670_MB1_OC_P_SFT			7
149762306a36Sopenharmony_ci#define RT5670_MB1_OC_P_NOR			(0x0 << 7)
149862306a36Sopenharmony_ci#define RT5670_MB1_OC_P_INV			(0x1 << 7)
149962306a36Sopenharmony_ci#define RT5670_MB2_OC_P_MASK			(0x1 << 6)
150062306a36Sopenharmony_ci#define RT5670_MB2_OC_P_SFT			6
150162306a36Sopenharmony_ci#define RT5670_MB2_OC_P_NOR			(0x0 << 6)
150262306a36Sopenharmony_ci#define RT5670_MB2_OC_P_INV			(0x1 << 6)
150362306a36Sopenharmony_ci#define RT5670_MB1_OC_CLR			(0x1 << 3)
150462306a36Sopenharmony_ci#define RT5670_MB1_OC_CLR_SFT			3
150562306a36Sopenharmony_ci#define RT5670_MB2_OC_CLR			(0x1 << 2)
150662306a36Sopenharmony_ci#define RT5670_MB2_OC_CLR_SFT			2
150762306a36Sopenharmony_ci
150862306a36Sopenharmony_ci/* GPIO Control 1 (0xc0) */
150962306a36Sopenharmony_ci#define RT5670_GP1_PIN_MASK			(0x1 << 15)
151062306a36Sopenharmony_ci#define RT5670_GP1_PIN_SFT			15
151162306a36Sopenharmony_ci#define RT5670_GP1_PIN_GPIO1			(0x0 << 15)
151262306a36Sopenharmony_ci#define RT5670_GP1_PIN_IRQ			(0x1 << 15)
151362306a36Sopenharmony_ci#define RT5670_GP2_PIN_MASK			(0x1 << 14)
151462306a36Sopenharmony_ci#define RT5670_GP2_PIN_SFT			14
151562306a36Sopenharmony_ci#define RT5670_GP2_PIN_GPIO2			(0x0 << 14)
151662306a36Sopenharmony_ci#define RT5670_GP2_PIN_DMIC1_SCL		(0x1 << 14)
151762306a36Sopenharmony_ci#define RT5670_GP3_PIN_MASK			(0x3 << 12)
151862306a36Sopenharmony_ci#define RT5670_GP3_PIN_SFT			12
151962306a36Sopenharmony_ci#define RT5670_GP3_PIN_GPIO3			(0x0 << 12)
152062306a36Sopenharmony_ci#define RT5670_GP3_PIN_DMIC1_SDA		(0x1 << 12)
152162306a36Sopenharmony_ci#define RT5670_GP3_PIN_IRQ			(0x2 << 12)
152262306a36Sopenharmony_ci#define RT5670_GP4_PIN_MASK			(0x1 << 11)
152362306a36Sopenharmony_ci#define RT5670_GP4_PIN_SFT			11
152462306a36Sopenharmony_ci#define RT5670_GP4_PIN_GPIO4			(0x0 << 11)
152562306a36Sopenharmony_ci#define RT5670_GP4_PIN_DMIC2_SDA		(0x1 << 11)
152662306a36Sopenharmony_ci#define RT5670_DP_SIG_MASK			(0x1 << 10)
152762306a36Sopenharmony_ci#define RT5670_DP_SIG_SFT			10
152862306a36Sopenharmony_ci#define RT5670_DP_SIG_TEST			(0x0 << 10)
152962306a36Sopenharmony_ci#define RT5670_DP_SIG_AP			(0x1 << 10)
153062306a36Sopenharmony_ci#define RT5670_GPIO_M_MASK			(0x1 << 9)
153162306a36Sopenharmony_ci#define RT5670_GPIO_M_SFT			9
153262306a36Sopenharmony_ci#define RT5670_GPIO_M_FLT			(0x0 << 9)
153362306a36Sopenharmony_ci#define RT5670_GPIO_M_PH			(0x1 << 9)
153462306a36Sopenharmony_ci#define RT5670_I2S2_PIN_MASK			(0x1 << 8)
153562306a36Sopenharmony_ci#define RT5670_I2S2_PIN_SFT			8
153662306a36Sopenharmony_ci#define RT5670_I2S2_PIN_I2S			(0x0 << 8)
153762306a36Sopenharmony_ci#define RT5670_I2S2_PIN_GPIO			(0x1 << 8)
153862306a36Sopenharmony_ci#define RT5670_GP5_PIN_MASK			(0x1 << 7)
153962306a36Sopenharmony_ci#define RT5670_GP5_PIN_SFT			7
154062306a36Sopenharmony_ci#define RT5670_GP5_PIN_GPIO5			(0x0 << 7)
154162306a36Sopenharmony_ci#define RT5670_GP5_PIN_DMIC3_SDA		(0x1 << 7)
154262306a36Sopenharmony_ci#define RT5670_GP6_PIN_MASK			(0x1 << 6)
154362306a36Sopenharmony_ci#define RT5670_GP6_PIN_SFT			6
154462306a36Sopenharmony_ci#define RT5670_GP6_PIN_GPIO6			(0x0 << 6)
154562306a36Sopenharmony_ci#define RT5670_GP6_PIN_DMIC1_SDA		(0x1 << 6)
154662306a36Sopenharmony_ci#define RT5670_GP7_PIN_MASK			(0x3 << 4)
154762306a36Sopenharmony_ci#define RT5670_GP7_PIN_SFT			4
154862306a36Sopenharmony_ci#define RT5670_GP7_PIN_GPIO7			(0x0 << 4)
154962306a36Sopenharmony_ci#define RT5670_GP7_PIN_DMIC1_SDA		(0x1 << 4)
155062306a36Sopenharmony_ci#define RT5670_GP7_PIN_PDM_SCL2			(0x2 << 4)
155162306a36Sopenharmony_ci#define RT5670_GP8_PIN_MASK			(0x1 << 3)
155262306a36Sopenharmony_ci#define RT5670_GP8_PIN_SFT			3
155362306a36Sopenharmony_ci#define RT5670_GP8_PIN_GPIO8			(0x0 << 3)
155462306a36Sopenharmony_ci#define RT5670_GP8_PIN_DMIC2_SDA		(0x1 << 3)
155562306a36Sopenharmony_ci#define RT5670_GP9_PIN_MASK			(0x1 << 2)
155662306a36Sopenharmony_ci#define RT5670_GP9_PIN_SFT			2
155762306a36Sopenharmony_ci#define RT5670_GP9_PIN_GPIO9			(0x0 << 2)
155862306a36Sopenharmony_ci#define RT5670_GP9_PIN_DMIC3_SDA		(0x1 << 2)
155962306a36Sopenharmony_ci#define RT5670_GP10_PIN_MASK			(0x3)
156062306a36Sopenharmony_ci#define RT5670_GP10_PIN_SFT			0
156162306a36Sopenharmony_ci#define RT5670_GP10_PIN_GPIO9			(0x0)
156262306a36Sopenharmony_ci#define RT5670_GP10_PIN_DMIC3_SDA		(0x1)
156362306a36Sopenharmony_ci#define RT5670_GP10_PIN_PDM_ADT2		(0x2)
156462306a36Sopenharmony_ci
156562306a36Sopenharmony_ci/* GPIO Control 2 (0xc1) */
156662306a36Sopenharmony_ci#define RT5670_GP4_PF_MASK			(0x1 << 11)
156762306a36Sopenharmony_ci#define RT5670_GP4_PF_SFT			11
156862306a36Sopenharmony_ci#define RT5670_GP4_PF_IN			(0x0 << 11)
156962306a36Sopenharmony_ci#define RT5670_GP4_PF_OUT			(0x1 << 11)
157062306a36Sopenharmony_ci#define RT5670_GP4_OUT_MASK			(0x1 << 10)
157162306a36Sopenharmony_ci#define RT5670_GP4_OUT_SFT			10
157262306a36Sopenharmony_ci#define RT5670_GP4_OUT_LO			(0x0 << 10)
157362306a36Sopenharmony_ci#define RT5670_GP4_OUT_HI			(0x1 << 10)
157462306a36Sopenharmony_ci#define RT5670_GP4_P_MASK			(0x1 << 9)
157562306a36Sopenharmony_ci#define RT5670_GP4_P_SFT			9
157662306a36Sopenharmony_ci#define RT5670_GP4_P_NOR			(0x0 << 9)
157762306a36Sopenharmony_ci#define RT5670_GP4_P_INV			(0x1 << 9)
157862306a36Sopenharmony_ci#define RT5670_GP3_PF_MASK			(0x1 << 8)
157962306a36Sopenharmony_ci#define RT5670_GP3_PF_SFT			8
158062306a36Sopenharmony_ci#define RT5670_GP3_PF_IN			(0x0 << 8)
158162306a36Sopenharmony_ci#define RT5670_GP3_PF_OUT			(0x1 << 8)
158262306a36Sopenharmony_ci#define RT5670_GP3_OUT_MASK			(0x1 << 7)
158362306a36Sopenharmony_ci#define RT5670_GP3_OUT_SFT			7
158462306a36Sopenharmony_ci#define RT5670_GP3_OUT_LO			(0x0 << 7)
158562306a36Sopenharmony_ci#define RT5670_GP3_OUT_HI			(0x1 << 7)
158662306a36Sopenharmony_ci#define RT5670_GP3_P_MASK			(0x1 << 6)
158762306a36Sopenharmony_ci#define RT5670_GP3_P_SFT			6
158862306a36Sopenharmony_ci#define RT5670_GP3_P_NOR			(0x0 << 6)
158962306a36Sopenharmony_ci#define RT5670_GP3_P_INV			(0x1 << 6)
159062306a36Sopenharmony_ci#define RT5670_GP2_PF_MASK			(0x1 << 5)
159162306a36Sopenharmony_ci#define RT5670_GP2_PF_SFT			5
159262306a36Sopenharmony_ci#define RT5670_GP2_PF_IN			(0x0 << 5)
159362306a36Sopenharmony_ci#define RT5670_GP2_PF_OUT			(0x1 << 5)
159462306a36Sopenharmony_ci#define RT5670_GP2_OUT_MASK			(0x1 << 4)
159562306a36Sopenharmony_ci#define RT5670_GP2_OUT_SFT			4
159662306a36Sopenharmony_ci#define RT5670_GP2_OUT_LO			(0x0 << 4)
159762306a36Sopenharmony_ci#define RT5670_GP2_OUT_HI			(0x1 << 4)
159862306a36Sopenharmony_ci#define RT5670_GP2_P_MASK			(0x1 << 3)
159962306a36Sopenharmony_ci#define RT5670_GP2_P_SFT			3
160062306a36Sopenharmony_ci#define RT5670_GP2_P_NOR			(0x0 << 3)
160162306a36Sopenharmony_ci#define RT5670_GP2_P_INV			(0x1 << 3)
160262306a36Sopenharmony_ci#define RT5670_GP1_PF_MASK			(0x1 << 2)
160362306a36Sopenharmony_ci#define RT5670_GP1_PF_SFT			2
160462306a36Sopenharmony_ci#define RT5670_GP1_PF_IN			(0x0 << 2)
160562306a36Sopenharmony_ci#define RT5670_GP1_PF_OUT			(0x1 << 2)
160662306a36Sopenharmony_ci#define RT5670_GP1_OUT_MASK			(0x1 << 1)
160762306a36Sopenharmony_ci#define RT5670_GP1_OUT_SFT			1
160862306a36Sopenharmony_ci#define RT5670_GP1_OUT_LO			(0x0 << 1)
160962306a36Sopenharmony_ci#define RT5670_GP1_OUT_HI			(0x1 << 1)
161062306a36Sopenharmony_ci#define RT5670_GP1_P_MASK			(0x1)
161162306a36Sopenharmony_ci#define RT5670_GP1_P_SFT			0
161262306a36Sopenharmony_ci#define RT5670_GP1_P_NOR			(0x0)
161362306a36Sopenharmony_ci#define RT5670_GP1_P_INV			(0x1)
161462306a36Sopenharmony_ci
161562306a36Sopenharmony_ci/* Scramble Function (0xcd) */
161662306a36Sopenharmony_ci#define RT5670_SCB_KEY_MASK			(0xff)
161762306a36Sopenharmony_ci#define RT5670_SCB_KEY_SFT			0
161862306a36Sopenharmony_ci
161962306a36Sopenharmony_ci/* Scramble Control (0xce) */
162062306a36Sopenharmony_ci#define RT5670_SCB_SWAP_MASK			(0x1 << 15)
162162306a36Sopenharmony_ci#define RT5670_SCB_SWAP_SFT			15
162262306a36Sopenharmony_ci#define RT5670_SCB_SWAP_DIS			(0x0 << 15)
162362306a36Sopenharmony_ci#define RT5670_SCB_SWAP_EN			(0x1 << 15)
162462306a36Sopenharmony_ci#define RT5670_SCB_MASK				(0x1 << 14)
162562306a36Sopenharmony_ci#define RT5670_SCB_SFT				14
162662306a36Sopenharmony_ci#define RT5670_SCB_DIS				(0x0 << 14)
162762306a36Sopenharmony_ci#define RT5670_SCB_EN				(0x1 << 14)
162862306a36Sopenharmony_ci
162962306a36Sopenharmony_ci/* Baseback Control (0xcf) */
163062306a36Sopenharmony_ci#define RT5670_BB_MASK				(0x1 << 15)
163162306a36Sopenharmony_ci#define RT5670_BB_SFT				15
163262306a36Sopenharmony_ci#define RT5670_BB_DIS				(0x0 << 15)
163362306a36Sopenharmony_ci#define RT5670_BB_EN				(0x1 << 15)
163462306a36Sopenharmony_ci#define RT5670_BB_CT_MASK			(0x7 << 12)
163562306a36Sopenharmony_ci#define RT5670_BB_CT_SFT			12
163662306a36Sopenharmony_ci#define RT5670_BB_CT_A				(0x0 << 12)
163762306a36Sopenharmony_ci#define RT5670_BB_CT_B				(0x1 << 12)
163862306a36Sopenharmony_ci#define RT5670_BB_CT_C				(0x2 << 12)
163962306a36Sopenharmony_ci#define RT5670_BB_CT_D				(0x3 << 12)
164062306a36Sopenharmony_ci#define RT5670_M_BB_L_MASK			(0x1 << 9)
164162306a36Sopenharmony_ci#define RT5670_M_BB_L_SFT			9
164262306a36Sopenharmony_ci#define RT5670_M_BB_R_MASK			(0x1 << 8)
164362306a36Sopenharmony_ci#define RT5670_M_BB_R_SFT			8
164462306a36Sopenharmony_ci#define RT5670_M_BB_HPF_L_MASK			(0x1 << 7)
164562306a36Sopenharmony_ci#define RT5670_M_BB_HPF_L_SFT			7
164662306a36Sopenharmony_ci#define RT5670_M_BB_HPF_R_MASK			(0x1 << 6)
164762306a36Sopenharmony_ci#define RT5670_M_BB_HPF_R_SFT			6
164862306a36Sopenharmony_ci#define RT5670_G_BB_BST_MASK			(0x3f)
164962306a36Sopenharmony_ci#define RT5670_G_BB_BST_SFT			0
165062306a36Sopenharmony_ci
165162306a36Sopenharmony_ci/* MP3 Plus Control 1 (0xd0) */
165262306a36Sopenharmony_ci#define RT5670_M_MP3_L_MASK			(0x1 << 15)
165362306a36Sopenharmony_ci#define RT5670_M_MP3_L_SFT			15
165462306a36Sopenharmony_ci#define RT5670_M_MP3_R_MASK			(0x1 << 14)
165562306a36Sopenharmony_ci#define RT5670_M_MP3_R_SFT			14
165662306a36Sopenharmony_ci#define RT5670_M_MP3_MASK			(0x1 << 13)
165762306a36Sopenharmony_ci#define RT5670_M_MP3_SFT			13
165862306a36Sopenharmony_ci#define RT5670_M_MP3_DIS			(0x0 << 13)
165962306a36Sopenharmony_ci#define RT5670_M_MP3_EN				(0x1 << 13)
166062306a36Sopenharmony_ci#define RT5670_EG_MP3_MASK			(0x1f << 8)
166162306a36Sopenharmony_ci#define RT5670_EG_MP3_SFT			8
166262306a36Sopenharmony_ci#define RT5670_MP3_HLP_MASK			(0x1 << 7)
166362306a36Sopenharmony_ci#define RT5670_MP3_HLP_SFT			7
166462306a36Sopenharmony_ci#define RT5670_MP3_HLP_DIS			(0x0 << 7)
166562306a36Sopenharmony_ci#define RT5670_MP3_HLP_EN			(0x1 << 7)
166662306a36Sopenharmony_ci#define RT5670_M_MP3_ORG_L_MASK			(0x1 << 6)
166762306a36Sopenharmony_ci#define RT5670_M_MP3_ORG_L_SFT			6
166862306a36Sopenharmony_ci#define RT5670_M_MP3_ORG_R_MASK			(0x1 << 5)
166962306a36Sopenharmony_ci#define RT5670_M_MP3_ORG_R_SFT			5
167062306a36Sopenharmony_ci
167162306a36Sopenharmony_ci/* MP3 Plus Control 2 (0xd1) */
167262306a36Sopenharmony_ci#define RT5670_MP3_WT_MASK			(0x1 << 13)
167362306a36Sopenharmony_ci#define RT5670_MP3_WT_SFT			13
167462306a36Sopenharmony_ci#define RT5670_MP3_WT_1_4			(0x0 << 13)
167562306a36Sopenharmony_ci#define RT5670_MP3_WT_1_2			(0x1 << 13)
167662306a36Sopenharmony_ci#define RT5670_OG_MP3_MASK			(0x1f << 8)
167762306a36Sopenharmony_ci#define RT5670_OG_MP3_SFT			8
167862306a36Sopenharmony_ci#define RT5670_HG_MP3_MASK			(0x3f)
167962306a36Sopenharmony_ci#define RT5670_HG_MP3_SFT			0
168062306a36Sopenharmony_ci
168162306a36Sopenharmony_ci/* 3D HP Control 1 (0xd2) */
168262306a36Sopenharmony_ci#define RT5670_3D_CF_MASK			(0x1 << 15)
168362306a36Sopenharmony_ci#define RT5670_3D_CF_SFT			15
168462306a36Sopenharmony_ci#define RT5670_3D_CF_DIS			(0x0 << 15)
168562306a36Sopenharmony_ci#define RT5670_3D_CF_EN				(0x1 << 15)
168662306a36Sopenharmony_ci#define RT5670_3D_HP_MASK			(0x1 << 14)
168762306a36Sopenharmony_ci#define RT5670_3D_HP_SFT			14
168862306a36Sopenharmony_ci#define RT5670_3D_HP_DIS			(0x0 << 14)
168962306a36Sopenharmony_ci#define RT5670_3D_HP_EN				(0x1 << 14)
169062306a36Sopenharmony_ci#define RT5670_3D_BT_MASK			(0x1 << 13)
169162306a36Sopenharmony_ci#define RT5670_3D_BT_SFT			13
169262306a36Sopenharmony_ci#define RT5670_3D_BT_DIS			(0x0 << 13)
169362306a36Sopenharmony_ci#define RT5670_3D_BT_EN				(0x1 << 13)
169462306a36Sopenharmony_ci#define RT5670_3D_1F_MIX_MASK			(0x3 << 11)
169562306a36Sopenharmony_ci#define RT5670_3D_1F_MIX_SFT			11
169662306a36Sopenharmony_ci#define RT5670_3D_HP_M_MASK			(0x1 << 10)
169762306a36Sopenharmony_ci#define RT5670_3D_HP_M_SFT			10
169862306a36Sopenharmony_ci#define RT5670_3D_HP_M_SUR			(0x0 << 10)
169962306a36Sopenharmony_ci#define RT5670_3D_HP_M_FRO			(0x1 << 10)
170062306a36Sopenharmony_ci#define RT5670_M_3D_HRTF_MASK			(0x1 << 9)
170162306a36Sopenharmony_ci#define RT5670_M_3D_HRTF_SFT			9
170262306a36Sopenharmony_ci#define RT5670_M_3D_D2H_MASK			(0x1 << 8)
170362306a36Sopenharmony_ci#define RT5670_M_3D_D2H_SFT			8
170462306a36Sopenharmony_ci#define RT5670_M_3D_D2R_MASK			(0x1 << 7)
170562306a36Sopenharmony_ci#define RT5670_M_3D_D2R_SFT			7
170662306a36Sopenharmony_ci#define RT5670_M_3D_REVB_MASK			(0x1 << 6)
170762306a36Sopenharmony_ci#define RT5670_M_3D_REVB_SFT			6
170862306a36Sopenharmony_ci
170962306a36Sopenharmony_ci/* Adjustable high pass filter control 1 (0xd3) */
171062306a36Sopenharmony_ci#define RT5670_2ND_HPF_MASK			(0x1 << 15)
171162306a36Sopenharmony_ci#define RT5670_2ND_HPF_SFT			15
171262306a36Sopenharmony_ci#define RT5670_2ND_HPF_DIS			(0x0 << 15)
171362306a36Sopenharmony_ci#define RT5670_2ND_HPF_EN			(0x1 << 15)
171462306a36Sopenharmony_ci#define RT5670_HPF_CF_L_MASK			(0x7 << 12)
171562306a36Sopenharmony_ci#define RT5670_HPF_CF_L_SFT			12
171662306a36Sopenharmony_ci#define RT5670_1ST_HPF_MASK			(0x1 << 11)
171762306a36Sopenharmony_ci#define RT5670_1ST_HPF_SFT			11
171862306a36Sopenharmony_ci#define RT5670_1ST_HPF_DIS			(0x0 << 11)
171962306a36Sopenharmony_ci#define RT5670_1ST_HPF_EN			(0x1 << 11)
172062306a36Sopenharmony_ci#define RT5670_HPF_CF_R_MASK			(0x7 << 8)
172162306a36Sopenharmony_ci#define RT5670_HPF_CF_R_SFT			8
172262306a36Sopenharmony_ci#define RT5670_ZD_T_MASK			(0x3 << 6)
172362306a36Sopenharmony_ci#define RT5670_ZD_T_SFT				6
172462306a36Sopenharmony_ci#define RT5670_ZD_F_MASK			(0x3 << 4)
172562306a36Sopenharmony_ci#define RT5670_ZD_F_SFT				4
172662306a36Sopenharmony_ci#define RT5670_ZD_F_IM				(0x0 << 4)
172762306a36Sopenharmony_ci#define RT5670_ZD_F_ZC_IM			(0x1 << 4)
172862306a36Sopenharmony_ci#define RT5670_ZD_F_ZC_IOD			(0x2 << 4)
172962306a36Sopenharmony_ci#define RT5670_ZD_F_UN				(0x3 << 4)
173062306a36Sopenharmony_ci
173162306a36Sopenharmony_ci/* HP calibration control and Amp detection (0xd6) */
173262306a36Sopenharmony_ci#define RT5670_SI_DAC_MASK			(0x1 << 11)
173362306a36Sopenharmony_ci#define RT5670_SI_DAC_SFT			11
173462306a36Sopenharmony_ci#define RT5670_SI_DAC_AUTO			(0x0 << 11)
173562306a36Sopenharmony_ci#define RT5670_SI_DAC_TEST			(0x1 << 11)
173662306a36Sopenharmony_ci#define RT5670_DC_CAL_M_MASK			(0x1 << 10)
173762306a36Sopenharmony_ci#define RT5670_DC_CAL_M_SFT			10
173862306a36Sopenharmony_ci#define RT5670_DC_CAL_M_CAL			(0x0 << 10)
173962306a36Sopenharmony_ci#define RT5670_DC_CAL_M_NOR			(0x1 << 10)
174062306a36Sopenharmony_ci#define RT5670_DC_CAL_MASK			(0x1 << 9)
174162306a36Sopenharmony_ci#define RT5670_DC_CAL_SFT			9
174262306a36Sopenharmony_ci#define RT5670_DC_CAL_DIS			(0x0 << 9)
174362306a36Sopenharmony_ci#define RT5670_DC_CAL_EN			(0x1 << 9)
174462306a36Sopenharmony_ci#define RT5670_HPD_RCV_MASK			(0x7 << 6)
174562306a36Sopenharmony_ci#define RT5670_HPD_RCV_SFT			6
174662306a36Sopenharmony_ci#define RT5670_HPD_PS_MASK			(0x1 << 5)
174762306a36Sopenharmony_ci#define RT5670_HPD_PS_SFT			5
174862306a36Sopenharmony_ci#define RT5670_HPD_PS_DIS			(0x0 << 5)
174962306a36Sopenharmony_ci#define RT5670_HPD_PS_EN			(0x1 << 5)
175062306a36Sopenharmony_ci#define RT5670_CAL_M_MASK			(0x1 << 4)
175162306a36Sopenharmony_ci#define RT5670_CAL_M_SFT			4
175262306a36Sopenharmony_ci#define RT5670_CAL_M_DEP			(0x0 << 4)
175362306a36Sopenharmony_ci#define RT5670_CAL_M_CAL			(0x1 << 4)
175462306a36Sopenharmony_ci#define RT5670_CAL_MASK				(0x1 << 3)
175562306a36Sopenharmony_ci#define RT5670_CAL_SFT				3
175662306a36Sopenharmony_ci#define RT5670_CAL_DIS				(0x0 << 3)
175762306a36Sopenharmony_ci#define RT5670_CAL_EN				(0x1 << 3)
175862306a36Sopenharmony_ci#define RT5670_CAL_TEST_MASK			(0x1 << 2)
175962306a36Sopenharmony_ci#define RT5670_CAL_TEST_SFT			2
176062306a36Sopenharmony_ci#define RT5670_CAL_TEST_DIS			(0x0 << 2)
176162306a36Sopenharmony_ci#define RT5670_CAL_TEST_EN			(0x1 << 2)
176262306a36Sopenharmony_ci#define RT5670_CAL_P_MASK			(0x3)
176362306a36Sopenharmony_ci#define RT5670_CAL_P_SFT			0
176462306a36Sopenharmony_ci#define RT5670_CAL_P_NONE			(0x0)
176562306a36Sopenharmony_ci#define RT5670_CAL_P_CAL			(0x1)
176662306a36Sopenharmony_ci#define RT5670_CAL_P_DAC_CAL			(0x2)
176762306a36Sopenharmony_ci
176862306a36Sopenharmony_ci/* Soft volume and zero cross control 1 (0xd9) */
176962306a36Sopenharmony_ci#define RT5670_SV_MASK				(0x1 << 15)
177062306a36Sopenharmony_ci#define RT5670_SV_SFT				15
177162306a36Sopenharmony_ci#define RT5670_SV_DIS				(0x0 << 15)
177262306a36Sopenharmony_ci#define RT5670_SV_EN				(0x1 << 15)
177362306a36Sopenharmony_ci#define RT5670_SPO_SV_MASK			(0x1 << 14)
177462306a36Sopenharmony_ci#define RT5670_SPO_SV_SFT			14
177562306a36Sopenharmony_ci#define RT5670_SPO_SV_DIS			(0x0 << 14)
177662306a36Sopenharmony_ci#define RT5670_SPO_SV_EN			(0x1 << 14)
177762306a36Sopenharmony_ci#define RT5670_OUT_SV_MASK			(0x1 << 13)
177862306a36Sopenharmony_ci#define RT5670_OUT_SV_SFT			13
177962306a36Sopenharmony_ci#define RT5670_OUT_SV_DIS			(0x0 << 13)
178062306a36Sopenharmony_ci#define RT5670_OUT_SV_EN			(0x1 << 13)
178162306a36Sopenharmony_ci#define RT5670_HP_SV_MASK			(0x1 << 12)
178262306a36Sopenharmony_ci#define RT5670_HP_SV_SFT			12
178362306a36Sopenharmony_ci#define RT5670_HP_SV_DIS			(0x0 << 12)
178462306a36Sopenharmony_ci#define RT5670_HP_SV_EN				(0x1 << 12)
178562306a36Sopenharmony_ci#define RT5670_ZCD_DIG_MASK			(0x1 << 11)
178662306a36Sopenharmony_ci#define RT5670_ZCD_DIG_SFT			11
178762306a36Sopenharmony_ci#define RT5670_ZCD_DIG_DIS			(0x0 << 11)
178862306a36Sopenharmony_ci#define RT5670_ZCD_DIG_EN			(0x1 << 11)
178962306a36Sopenharmony_ci#define RT5670_ZCD_MASK				(0x1 << 10)
179062306a36Sopenharmony_ci#define RT5670_ZCD_SFT				10
179162306a36Sopenharmony_ci#define RT5670_ZCD_PD				(0x0 << 10)
179262306a36Sopenharmony_ci#define RT5670_ZCD_PU				(0x1 << 10)
179362306a36Sopenharmony_ci#define RT5670_M_ZCD_MASK			(0x3f << 4)
179462306a36Sopenharmony_ci#define RT5670_M_ZCD_SFT			4
179562306a36Sopenharmony_ci#define RT5670_M_ZCD_RM_L			(0x1 << 9)
179662306a36Sopenharmony_ci#define RT5670_M_ZCD_RM_R			(0x1 << 8)
179762306a36Sopenharmony_ci#define RT5670_M_ZCD_SM_L			(0x1 << 7)
179862306a36Sopenharmony_ci#define RT5670_M_ZCD_SM_R			(0x1 << 6)
179962306a36Sopenharmony_ci#define RT5670_M_ZCD_OM_L			(0x1 << 5)
180062306a36Sopenharmony_ci#define RT5670_M_ZCD_OM_R			(0x1 << 4)
180162306a36Sopenharmony_ci#define RT5670_SV_DLY_MASK			(0xf)
180262306a36Sopenharmony_ci#define RT5670_SV_DLY_SFT			0
180362306a36Sopenharmony_ci
180462306a36Sopenharmony_ci/* Soft volume and zero cross control 2 (0xda) */
180562306a36Sopenharmony_ci#define RT5670_ZCD_HP_MASK			(0x1 << 15)
180662306a36Sopenharmony_ci#define RT5670_ZCD_HP_SFT			15
180762306a36Sopenharmony_ci#define RT5670_ZCD_HP_DIS			(0x0 << 15)
180862306a36Sopenharmony_ci#define RT5670_ZCD_HP_EN			(0x1 << 15)
180962306a36Sopenharmony_ci
181062306a36Sopenharmony_ci/* General Control 3 (0xfc) */
181162306a36Sopenharmony_ci#define RT5670_TDM_DATA_MODE_SEL		(0x1 << 11)
181262306a36Sopenharmony_ci#define RT5670_TDM_DATA_MODE_NOR		(0x0 << 11)
181362306a36Sopenharmony_ci#define RT5670_TDM_DATA_MODE_50FS		(0x1 << 11)
181462306a36Sopenharmony_ci
181562306a36Sopenharmony_ci/* Codec Private Register definition */
181662306a36Sopenharmony_ci/* 3D Speaker Control (0x63) */
181762306a36Sopenharmony_ci#define RT5670_3D_SPK_MASK			(0x1 << 15)
181862306a36Sopenharmony_ci#define RT5670_3D_SPK_SFT			15
181962306a36Sopenharmony_ci#define RT5670_3D_SPK_DIS			(0x0 << 15)
182062306a36Sopenharmony_ci#define RT5670_3D_SPK_EN			(0x1 << 15)
182162306a36Sopenharmony_ci#define RT5670_3D_SPK_M_MASK			(0x3 << 13)
182262306a36Sopenharmony_ci#define RT5670_3D_SPK_M_SFT			13
182362306a36Sopenharmony_ci#define RT5670_3D_SPK_CG_MASK			(0x1f << 8)
182462306a36Sopenharmony_ci#define RT5670_3D_SPK_CG_SFT			8
182562306a36Sopenharmony_ci#define RT5670_3D_SPK_SG_MASK			(0x1f)
182662306a36Sopenharmony_ci#define RT5670_3D_SPK_SG_SFT			0
182762306a36Sopenharmony_ci
182862306a36Sopenharmony_ci/* Wind Noise Detection Control 1 (0x6c) */
182962306a36Sopenharmony_ci#define RT5670_WND_MASK				(0x1 << 15)
183062306a36Sopenharmony_ci#define RT5670_WND_SFT				15
183162306a36Sopenharmony_ci#define RT5670_WND_DIS				(0x0 << 15)
183262306a36Sopenharmony_ci#define RT5670_WND_EN				(0x1 << 15)
183362306a36Sopenharmony_ci
183462306a36Sopenharmony_ci/* Wind Noise Detection Control 2 (0x6d) */
183562306a36Sopenharmony_ci#define RT5670_WND_FC_NW_MASK			(0x3f << 10)
183662306a36Sopenharmony_ci#define RT5670_WND_FC_NW_SFT			10
183762306a36Sopenharmony_ci#define RT5670_WND_FC_WK_MASK			(0x3f << 4)
183862306a36Sopenharmony_ci#define RT5670_WND_FC_WK_SFT			4
183962306a36Sopenharmony_ci
184062306a36Sopenharmony_ci/* Wind Noise Detection Control 3 (0x6e) */
184162306a36Sopenharmony_ci#define RT5670_HPF_FC_MASK			(0x3f << 6)
184262306a36Sopenharmony_ci#define RT5670_HPF_FC_SFT			6
184362306a36Sopenharmony_ci#define RT5670_WND_FC_ST_MASK			(0x3f)
184462306a36Sopenharmony_ci#define RT5670_WND_FC_ST_SFT			0
184562306a36Sopenharmony_ci
184662306a36Sopenharmony_ci/* Wind Noise Detection Control 4 (0x6f) */
184762306a36Sopenharmony_ci#define RT5670_WND_TH_LO_MASK			(0x3ff)
184862306a36Sopenharmony_ci#define RT5670_WND_TH_LO_SFT			0
184962306a36Sopenharmony_ci
185062306a36Sopenharmony_ci/* Wind Noise Detection Control 5 (0x70) */
185162306a36Sopenharmony_ci#define RT5670_WND_TH_HI_MASK			(0x3ff)
185262306a36Sopenharmony_ci#define RT5670_WND_TH_HI_SFT			0
185362306a36Sopenharmony_ci
185462306a36Sopenharmony_ci/* Wind Noise Detection Control 8 (0x73) */
185562306a36Sopenharmony_ci#define RT5670_WND_WIND_MASK			(0x1 << 13) /* Read-Only */
185662306a36Sopenharmony_ci#define RT5670_WND_WIND_SFT			13
185762306a36Sopenharmony_ci#define RT5670_WND_STRONG_MASK			(0x1 << 12) /* Read-Only */
185862306a36Sopenharmony_ci#define RT5670_WND_STRONG_SFT			12
185962306a36Sopenharmony_cienum {
186062306a36Sopenharmony_ci	RT5670_NO_WIND,
186162306a36Sopenharmony_ci	RT5670_BREEZE,
186262306a36Sopenharmony_ci	RT5670_STORM,
186362306a36Sopenharmony_ci};
186462306a36Sopenharmony_ci
186562306a36Sopenharmony_ci/* Dipole Speaker Interface (0x75) */
186662306a36Sopenharmony_ci#define RT5670_DP_ATT_MASK			(0x3 << 14)
186762306a36Sopenharmony_ci#define RT5670_DP_ATT_SFT			14
186862306a36Sopenharmony_ci#define RT5670_DP_SPK_MASK			(0x1 << 10)
186962306a36Sopenharmony_ci#define RT5670_DP_SPK_SFT			10
187062306a36Sopenharmony_ci#define RT5670_DP_SPK_DIS			(0x0 << 10)
187162306a36Sopenharmony_ci#define RT5670_DP_SPK_EN			(0x1 << 10)
187262306a36Sopenharmony_ci
187362306a36Sopenharmony_ci/* EQ Pre Volume Control (0xb3) */
187462306a36Sopenharmony_ci#define RT5670_EQ_PRE_VOL_MASK			(0xffff)
187562306a36Sopenharmony_ci#define RT5670_EQ_PRE_VOL_SFT			0
187662306a36Sopenharmony_ci
187762306a36Sopenharmony_ci/* EQ Post Volume Control (0xb4) */
187862306a36Sopenharmony_ci#define RT5670_EQ_PST_VOL_MASK			(0xffff)
187962306a36Sopenharmony_ci#define RT5670_EQ_PST_VOL_SFT			0
188062306a36Sopenharmony_ci
188162306a36Sopenharmony_ci/* Jack Detect Control 3 (0xf8) */
188262306a36Sopenharmony_ci#define RT5670_CMP_MIC_IN_DET_MASK		(0x7 << 12)
188362306a36Sopenharmony_ci#define RT5670_JD_CBJ_EN			(0x1 << 7)
188462306a36Sopenharmony_ci#define RT5670_JD_CBJ_POL			(0x1 << 6)
188562306a36Sopenharmony_ci#define RT5670_JD_TRI_CBJ_SEL_MASK		(0x7 << 3)
188662306a36Sopenharmony_ci#define RT5670_JD_TRI_CBJ_SEL_SFT		(3)
188762306a36Sopenharmony_ci#define RT5670_JD_CBJ_GPIO_JD1			(0x0 << 3)
188862306a36Sopenharmony_ci#define RT5670_JD_CBJ_JD1_1			(0x1 << 3)
188962306a36Sopenharmony_ci#define RT5670_JD_CBJ_JD1_2			(0x2 << 3)
189062306a36Sopenharmony_ci#define RT5670_JD_CBJ_JD2			(0x3 << 3)
189162306a36Sopenharmony_ci#define RT5670_JD_CBJ_JD3			(0x4 << 3)
189262306a36Sopenharmony_ci#define RT5670_JD_CBJ_GPIO_JD2			(0x5 << 3)
189362306a36Sopenharmony_ci#define RT5670_JD_CBJ_MX0B_12			(0x6 << 3)
189462306a36Sopenharmony_ci#define RT5670_JD_TRI_HPO_SEL_MASK		(0x7 << 3)
189562306a36Sopenharmony_ci#define RT5670_JD_TRI_HPO_SEL_SFT		(0)
189662306a36Sopenharmony_ci#define RT5670_JD_HPO_GPIO_JD1			(0x0)
189762306a36Sopenharmony_ci#define RT5670_JD_HPO_JD1_1			(0x1)
189862306a36Sopenharmony_ci#define RT5670_JD_HPO_JD1_2			(0x2)
189962306a36Sopenharmony_ci#define RT5670_JD_HPO_JD2			(0x3)
190062306a36Sopenharmony_ci#define RT5670_JD_HPO_JD3			(0x4)
190162306a36Sopenharmony_ci#define RT5670_JD_HPO_GPIO_JD2			(0x5)
190262306a36Sopenharmony_ci#define RT5670_JD_HPO_MX0B_12			(0x6)
190362306a36Sopenharmony_ci
190462306a36Sopenharmony_ci/* Digital Misc Control (0xfa) */
190562306a36Sopenharmony_ci#define RT5670_RST_DSP				(0x1 << 13)
190662306a36Sopenharmony_ci#define RT5670_IF1_ADC1_IN1_SEL			(0x1 << 12)
190762306a36Sopenharmony_ci#define RT5670_IF1_ADC1_IN1_SFT			12
190862306a36Sopenharmony_ci#define RT5670_IF1_ADC1_IN2_SEL			(0x1 << 11)
190962306a36Sopenharmony_ci#define RT5670_IF1_ADC1_IN2_SFT			11
191062306a36Sopenharmony_ci#define RT5670_IF1_ADC2_IN1_SEL			(0x1 << 10)
191162306a36Sopenharmony_ci#define RT5670_IF1_ADC2_IN1_SFT			10
191262306a36Sopenharmony_ci#define RT5670_MCLK_DET				(0x1 << 3)
191362306a36Sopenharmony_ci
191462306a36Sopenharmony_ci/* General Control2 (0xfb) */
191562306a36Sopenharmony_ci#define RT5670_RXDC_SRC_MASK			(0x1 << 7)
191662306a36Sopenharmony_ci#define RT5670_RXDC_SRC_STO			(0x0 << 7)
191762306a36Sopenharmony_ci#define RT5670_RXDC_SRC_MONO			(0x1 << 7)
191862306a36Sopenharmony_ci#define RT5670_RXDC_SRC_SFT			(7)
191962306a36Sopenharmony_ci#define RT5670_RXDP2_SEL_MASK			(0x1 << 3)
192062306a36Sopenharmony_ci#define RT5670_RXDP2_SEL_IF2			(0x0 << 3)
192162306a36Sopenharmony_ci#define RT5670_RXDP2_SEL_ADC			(0x1 << 3)
192262306a36Sopenharmony_ci#define RT5670_RXDP2_SEL_SFT			(3)
192362306a36Sopenharmony_ci
192462306a36Sopenharmony_ci/* System Clock Source */
192562306a36Sopenharmony_cienum {
192662306a36Sopenharmony_ci	RT5670_SCLK_S_MCLK,
192762306a36Sopenharmony_ci	RT5670_SCLK_S_PLL1,
192862306a36Sopenharmony_ci	RT5670_SCLK_S_RCCLK,
192962306a36Sopenharmony_ci};
193062306a36Sopenharmony_ci
193162306a36Sopenharmony_ci/* PLL1 Source */
193262306a36Sopenharmony_cienum {
193362306a36Sopenharmony_ci	RT5670_PLL1_S_MCLK,
193462306a36Sopenharmony_ci	RT5670_PLL1_S_BCLK1,
193562306a36Sopenharmony_ci	RT5670_PLL1_S_BCLK2,
193662306a36Sopenharmony_ci	RT5670_PLL1_S_BCLK3,
193762306a36Sopenharmony_ci	RT5670_PLL1_S_BCLK4,
193862306a36Sopenharmony_ci};
193962306a36Sopenharmony_ci
194062306a36Sopenharmony_cienum {
194162306a36Sopenharmony_ci	RT5670_AIF1,
194262306a36Sopenharmony_ci	RT5670_AIF2,
194362306a36Sopenharmony_ci	RT5670_AIF3,
194462306a36Sopenharmony_ci	RT5670_AIF4,
194562306a36Sopenharmony_ci	RT5670_AIFS,
194662306a36Sopenharmony_ci};
194762306a36Sopenharmony_ci
194862306a36Sopenharmony_cienum {
194962306a36Sopenharmony_ci	RT5670_DMIC1_DISABLED,
195062306a36Sopenharmony_ci	RT5670_DMIC_DATA_GPIO6,
195162306a36Sopenharmony_ci	RT5670_DMIC_DATA_IN2P,
195262306a36Sopenharmony_ci	RT5670_DMIC_DATA_GPIO7,
195362306a36Sopenharmony_ci};
195462306a36Sopenharmony_ci
195562306a36Sopenharmony_cienum {
195662306a36Sopenharmony_ci	RT5670_DMIC2_DISABLED,
195762306a36Sopenharmony_ci	RT5670_DMIC_DATA_GPIO8,
195862306a36Sopenharmony_ci	RT5670_DMIC_DATA_IN3N,
195962306a36Sopenharmony_ci};
196062306a36Sopenharmony_ci
196162306a36Sopenharmony_cienum {
196262306a36Sopenharmony_ci	RT5670_DMIC3_DISABLED,
196362306a36Sopenharmony_ci	RT5670_DMIC_DATA_GPIO9,
196462306a36Sopenharmony_ci	RT5670_DMIC_DATA_GPIO10,
196562306a36Sopenharmony_ci	RT5670_DMIC_DATA_GPIO5,
196662306a36Sopenharmony_ci};
196762306a36Sopenharmony_ci
196862306a36Sopenharmony_ci/* filter mask */
196962306a36Sopenharmony_cienum {
197062306a36Sopenharmony_ci	RT5670_DA_STEREO_FILTER = 0x1,
197162306a36Sopenharmony_ci	RT5670_DA_MONO_L_FILTER = (0x1 << 1),
197262306a36Sopenharmony_ci	RT5670_DA_MONO_R_FILTER = (0x1 << 2),
197362306a36Sopenharmony_ci	RT5670_AD_STEREO_FILTER = (0x1 << 3),
197462306a36Sopenharmony_ci	RT5670_AD_MONO_L_FILTER = (0x1 << 4),
197562306a36Sopenharmony_ci	RT5670_AD_MONO_R_FILTER = (0x1 << 5),
197662306a36Sopenharmony_ci	RT5670_UP_RATE_FILTER   = (0x1 << 6),
197762306a36Sopenharmony_ci	RT5670_DOWN_RATE_FILTER = (0x1 << 7),
197862306a36Sopenharmony_ci};
197962306a36Sopenharmony_ci
198062306a36Sopenharmony_ciint rt5670_sel_asrc_clk_src(struct snd_soc_component *component,
198162306a36Sopenharmony_ci			    unsigned int filter_mask, unsigned int clk_src);
198262306a36Sopenharmony_ci
198362306a36Sopenharmony_cistruct rt5670_priv {
198462306a36Sopenharmony_ci	struct snd_soc_component *component;
198562306a36Sopenharmony_ci	struct regmap *regmap;
198662306a36Sopenharmony_ci	struct snd_soc_jack *jack;
198762306a36Sopenharmony_ci	struct snd_soc_jack_gpio hp_gpio;
198862306a36Sopenharmony_ci
198962306a36Sopenharmony_ci	int jd_mode;
199062306a36Sopenharmony_ci	bool in2_diff;
199162306a36Sopenharmony_ci	bool gpio1_is_irq;
199262306a36Sopenharmony_ci	bool gpio1_is_ext_spk_en;
199362306a36Sopenharmony_ci
199462306a36Sopenharmony_ci	bool dmic_en;
199562306a36Sopenharmony_ci	unsigned int dmic1_data_pin;
199662306a36Sopenharmony_ci	/* 0 = GPIO6; 1 = IN2P; 3 = GPIO7*/
199762306a36Sopenharmony_ci	unsigned int dmic2_data_pin;
199862306a36Sopenharmony_ci	/* 0 = GPIO8; 1 = IN3N; */
199962306a36Sopenharmony_ci	unsigned int dmic3_data_pin;
200062306a36Sopenharmony_ci	/* 0 = GPIO9; 1 = GPIO10; 2 = GPIO5*/
200162306a36Sopenharmony_ci
200262306a36Sopenharmony_ci	int sysclk;
200362306a36Sopenharmony_ci	int sysclk_src;
200462306a36Sopenharmony_ci	int lrck[RT5670_AIFS];
200562306a36Sopenharmony_ci	int bclk[RT5670_AIFS];
200662306a36Sopenharmony_ci	int master[RT5670_AIFS];
200762306a36Sopenharmony_ci
200862306a36Sopenharmony_ci	int pll_src;
200962306a36Sopenharmony_ci	int pll_in;
201062306a36Sopenharmony_ci	int pll_out;
201162306a36Sopenharmony_ci
201262306a36Sopenharmony_ci	int dsp_sw; /* expected parameter setting */
201362306a36Sopenharmony_ci	int dsp_rate;
201462306a36Sopenharmony_ci	int jack_type;
201562306a36Sopenharmony_ci	int jack_type_saved;
201662306a36Sopenharmony_ci
201762306a36Sopenharmony_ci	bool dac1_mixl_dac1_switch;
201862306a36Sopenharmony_ci	bool dac1_mixr_dac1_switch;
201962306a36Sopenharmony_ci	bool dac1_playback_switch_l;
202062306a36Sopenharmony_ci	bool dac1_playback_switch_r;
202162306a36Sopenharmony_ci};
202262306a36Sopenharmony_ci
202362306a36Sopenharmony_civoid rt5670_jack_suspend(struct snd_soc_component *component);
202462306a36Sopenharmony_civoid rt5670_jack_resume(struct snd_soc_component *component);
202562306a36Sopenharmony_ciint rt5670_set_jack_detect(struct snd_soc_component *component,
202662306a36Sopenharmony_ci	struct snd_soc_jack *jack);
202762306a36Sopenharmony_ciconst char *rt5670_components(void);
202862306a36Sopenharmony_ci
202962306a36Sopenharmony_ci#endif /* __RT5670_H__ */
2030