xref: /openbmc/linux/sound/soc/codecs/rt5645.h (revision 8be98d2f2a0a262f8bf8a0bc1fdf522b3c7aab17)
1*d2912cb1SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
21319b2f6SOder Chiou /*
31319b2f6SOder Chiou  * rt5645.h  --  RT5645 ALSA SoC audio driver
41319b2f6SOder Chiou  *
51319b2f6SOder Chiou  * Copyright 2013 Realtek Microelectronics
61319b2f6SOder Chiou  * Author: Bard Liao <bardliao@realtek.com>
71319b2f6SOder Chiou  */
81319b2f6SOder Chiou 
91319b2f6SOder Chiou #ifndef __RT5645_H__
101319b2f6SOder Chiou #define __RT5645_H__
111319b2f6SOder Chiou 
121319b2f6SOder Chiou /* Info */
131319b2f6SOder Chiou #define RT5645_RESET				0x00
141319b2f6SOder Chiou #define RT5645_VENDOR_ID			0xfd
151319b2f6SOder Chiou #define RT5645_VENDOR_ID1			0xfe
161319b2f6SOder Chiou #define RT5645_VENDOR_ID2			0xff
171319b2f6SOder Chiou /*  I/O - Output */
181319b2f6SOder Chiou #define RT5645_SPK_VOL				0x01
191319b2f6SOder Chiou #define RT5645_HP_VOL				0x02
201319b2f6SOder Chiou #define RT5645_LOUT1				0x03
211319b2f6SOder Chiou #define RT5645_LOUT_CTRL			0x05
221319b2f6SOder Chiou /* I/O - Input */
231319b2f6SOder Chiou #define RT5645_IN1_CTRL1			0x0a
241319b2f6SOder Chiou #define RT5645_IN1_CTRL2			0x0b
251319b2f6SOder Chiou #define RT5645_IN1_CTRL3			0x0c
261319b2f6SOder Chiou #define RT5645_IN2_CTRL				0x0d
271319b2f6SOder Chiou #define RT5645_INL1_INR1_VOL			0x0f
281319b2f6SOder Chiou #define RT5645_SPK_FUNC_LIM			0x14
291319b2f6SOder Chiou #define RT5645_ADJ_HPF_CTRL			0x16
301319b2f6SOder Chiou /* I/O - ADC/DAC/DMIC */
311319b2f6SOder Chiou #define RT5645_DAC1_DIG_VOL			0x19
321319b2f6SOder Chiou #define RT5645_DAC2_DIG_VOL			0x1a
331319b2f6SOder Chiou #define RT5645_DAC_CTRL				0x1b
341319b2f6SOder Chiou #define RT5645_STO1_ADC_DIG_VOL			0x1c
351319b2f6SOder Chiou #define RT5645_MONO_ADC_DIG_VOL			0x1d
361319b2f6SOder Chiou #define RT5645_ADC_BST_VOL1			0x1e
371319b2f6SOder Chiou #define RT5645_ADC_BST_VOL2			0x20
388c1a9d63SOder Chiou /* Mixer - D-D */
391319b2f6SOder Chiou #define RT5645_STO1_ADC_MIXER			0x27
401319b2f6SOder Chiou #define RT5645_MONO_ADC_MIXER			0x28
411319b2f6SOder Chiou #define RT5645_AD_DA_MIXER			0x29
421319b2f6SOder Chiou #define RT5645_STO_DAC_MIXER			0x2a
431319b2f6SOder Chiou #define RT5645_MONO_DAC_MIXER			0x2b
441319b2f6SOder Chiou #define RT5645_DIG_MIXER			0x2c
455c4ca99dSBard Liao #define RT5650_A_DAC_SOUR			0x2d
461319b2f6SOder Chiou #define RT5645_DIG_INF1_DATA			0x2f
471319b2f6SOder Chiou /* Mixer - PDM */
481319b2f6SOder Chiou #define RT5645_PDM_OUT_CTRL			0x31
491319b2f6SOder Chiou /* Mixer - ADC */
501319b2f6SOder Chiou #define RT5645_REC_L1_MIXER			0x3b
511319b2f6SOder Chiou #define RT5645_REC_L2_MIXER			0x3c
521319b2f6SOder Chiou #define RT5645_REC_R1_MIXER			0x3d
531319b2f6SOder Chiou #define RT5645_REC_R2_MIXER			0x3e
541319b2f6SOder Chiou /* Mixer - DAC */
551319b2f6SOder Chiou #define RT5645_HPMIXL_CTRL			0x3f
561319b2f6SOder Chiou #define RT5645_HPOMIXL_CTRL			0x40
571319b2f6SOder Chiou #define RT5645_HPMIXR_CTRL			0x41
581319b2f6SOder Chiou #define RT5645_HPOMIXR_CTRL			0x42
591319b2f6SOder Chiou #define RT5645_HPO_MIXER			0x45
601319b2f6SOder Chiou #define RT5645_SPK_L_MIXER			0x46
611319b2f6SOder Chiou #define RT5645_SPK_R_MIXER			0x47
621319b2f6SOder Chiou #define RT5645_SPO_MIXER			0x48
631319b2f6SOder Chiou #define RT5645_SPO_CLSD_RATIO			0x4a
641319b2f6SOder Chiou #define RT5645_OUT_L_GAIN1			0x4d
651319b2f6SOder Chiou #define RT5645_OUT_L_GAIN2			0x4e
661319b2f6SOder Chiou #define RT5645_OUT_L1_MIXER			0x4f
671319b2f6SOder Chiou #define RT5645_OUT_R_GAIN1			0x50
681319b2f6SOder Chiou #define RT5645_OUT_R_GAIN2			0x51
691319b2f6SOder Chiou #define RT5645_OUT_R1_MIXER			0x52
701319b2f6SOder Chiou #define RT5645_LOUT_MIXER			0x53
711319b2f6SOder Chiou /* Haptic */
721319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL1			0x56
731319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL2			0x57
741319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL3			0x58
751319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL4			0x59
761319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL5			0x5a
771319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL6			0x5b
781319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL7			0x5c
791319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL8			0x5d
801319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL9			0x5e
811319b2f6SOder Chiou #define RT5645_HAPTIC_CTRL10			0x5f
821319b2f6SOder Chiou /* Power */
831319b2f6SOder Chiou #define RT5645_PWR_DIG1				0x61
841319b2f6SOder Chiou #define RT5645_PWR_DIG2				0x62
851319b2f6SOder Chiou #define RT5645_PWR_ANLG1			0x63
861319b2f6SOder Chiou #define RT5645_PWR_ANLG2			0x64
871319b2f6SOder Chiou #define RT5645_PWR_MIXER			0x65
881319b2f6SOder Chiou #define RT5645_PWR_VOL				0x66
891319b2f6SOder Chiou /* Private Register Control */
901319b2f6SOder Chiou #define RT5645_PRIV_INDEX			0x6a
911319b2f6SOder Chiou #define RT5645_PRIV_DATA			0x6c
921319b2f6SOder Chiou /* Format - ADC/DAC */
931319b2f6SOder Chiou #define RT5645_I2S1_SDP				0x70
941319b2f6SOder Chiou #define RT5645_I2S2_SDP				0x71
951319b2f6SOder Chiou #define RT5645_ADDA_CLK1			0x73
961319b2f6SOder Chiou #define RT5645_ADDA_CLK2			0x74
971319b2f6SOder Chiou #define RT5645_DMIC_CTRL1			0x75
981319b2f6SOder Chiou #define RT5645_DMIC_CTRL2			0x76
991319b2f6SOder Chiou /* Format - TDM Control */
1001319b2f6SOder Chiou #define RT5645_TDM_CTRL_1			0x77
1011319b2f6SOder Chiou #define RT5645_TDM_CTRL_2			0x78
1021319b2f6SOder Chiou #define RT5645_TDM_CTRL_3			0x79
10321ab3f2bSBard Liao #define RT5650_TDM_CTRL_4			0x7a
1041319b2f6SOder Chiou 
1051319b2f6SOder Chiou /* Function - Analog */
1061319b2f6SOder Chiou #define RT5645_GLB_CLK				0x80
1071319b2f6SOder Chiou #define RT5645_PLL_CTRL1			0x81
1081319b2f6SOder Chiou #define RT5645_PLL_CTRL2			0x82
1091319b2f6SOder Chiou #define RT5645_ASRC_1				0x83
1101319b2f6SOder Chiou #define RT5645_ASRC_2				0x84
1111319b2f6SOder Chiou #define RT5645_ASRC_3				0x85
1121319b2f6SOder Chiou #define RT5645_ASRC_4				0x8a
1131319b2f6SOder Chiou #define RT5645_DEPOP_M1				0x8e
1141319b2f6SOder Chiou #define RT5645_DEPOP_M2				0x8f
1151319b2f6SOder Chiou #define RT5645_DEPOP_M3				0x90
1161319b2f6SOder Chiou #define RT5645_CHARGE_PUMP			0x91
1171319b2f6SOder Chiou #define RT5645_MICBIAS				0x93
1181319b2f6SOder Chiou #define RT5645_A_JD_CTRL1			0x94
1191319b2f6SOder Chiou #define RT5645_VAD_CTRL4			0x9d
1201319b2f6SOder Chiou #define RT5645_CLSD_OUT_CTRL			0xa0
1211319b2f6SOder Chiou /* Function - Digital */
1221319b2f6SOder Chiou #define RT5645_ADC_EQ_CTRL1			0xae
1231319b2f6SOder Chiou #define RT5645_ADC_EQ_CTRL2			0xaf
1241319b2f6SOder Chiou #define RT5645_EQ_CTRL1				0xb0
1251319b2f6SOder Chiou #define RT5645_EQ_CTRL2				0xb1
1261319b2f6SOder Chiou #define RT5645_ALC_CTRL_1			0xb3
1271319b2f6SOder Chiou #define RT5645_ALC_CTRL_2			0xb4
1281319b2f6SOder Chiou #define RT5645_ALC_CTRL_3			0xb5
1291319b2f6SOder Chiou #define RT5645_ALC_CTRL_4			0xb6
1301319b2f6SOder Chiou #define RT5645_ALC_CTRL_5			0xb7
1311319b2f6SOder Chiou #define RT5645_JD_CTRL				0xbb
1321319b2f6SOder Chiou #define RT5645_IRQ_CTRL1			0xbc
1331319b2f6SOder Chiou #define RT5645_IRQ_CTRL2			0xbd
1341319b2f6SOder Chiou #define RT5645_IRQ_CTRL3			0xbe
1351319b2f6SOder Chiou #define RT5645_INT_IRQ_ST			0xbf
1361319b2f6SOder Chiou #define RT5645_GPIO_CTRL1			0xc0
1371319b2f6SOder Chiou #define RT5645_GPIO_CTRL2			0xc1
1381319b2f6SOder Chiou #define RT5645_GPIO_CTRL3			0xc2
1391319b2f6SOder Chiou #define RT5645_BASS_BACK			0xcf
1401319b2f6SOder Chiou #define RT5645_MP3_PLUS1			0xd0
1411319b2f6SOder Chiou #define RT5645_MP3_PLUS2			0xd1
1421319b2f6SOder Chiou #define RT5645_ADJ_HPF1				0xd3
1431319b2f6SOder Chiou #define RT5645_ADJ_HPF2				0xd4
1441319b2f6SOder Chiou #define RT5645_HP_CALIB_AMP_DET			0xd6
1451319b2f6SOder Chiou #define RT5645_SV_ZCD1				0xd9
1461319b2f6SOder Chiou #define RT5645_SV_ZCD2				0xda
1471319b2f6SOder Chiou #define RT5645_IL_CMD				0xdb
1481319b2f6SOder Chiou #define RT5645_IL_CMD2				0xdc
1491319b2f6SOder Chiou #define RT5645_IL_CMD3				0xdd
1505c4ca99dSBard Liao #define RT5650_4BTN_IL_CMD1			0xdf
1515c4ca99dSBard Liao #define RT5650_4BTN_IL_CMD2			0xe0
1521319b2f6SOder Chiou #define RT5645_DRC1_HL_CTRL1			0xe7
1531319b2f6SOder Chiou #define RT5645_DRC2_HL_CTRL1			0xe9
1541319b2f6SOder Chiou #define RT5645_MUTI_DRC_CTRL1			0xea
1551319b2f6SOder Chiou #define RT5645_ADC_MONO_HP_CTRL1		0xec
1561319b2f6SOder Chiou #define RT5645_ADC_MONO_HP_CTRL2		0xed
1571319b2f6SOder Chiou #define RT5645_DRC2_CTRL1			0xf0
1581319b2f6SOder Chiou #define RT5645_DRC2_CTRL2			0xf1
1591319b2f6SOder Chiou #define RT5645_DRC2_CTRL3			0xf2
1601319b2f6SOder Chiou #define RT5645_DRC2_CTRL4			0xf3
1611319b2f6SOder Chiou #define RT5645_DRC2_CTRL5			0xf4
1621319b2f6SOder Chiou #define RT5645_JD_CTRL3				0xf8
1631319b2f6SOder Chiou #define RT5645_JD_CTRL4				0xf9
1641319b2f6SOder Chiou /* General Control */
1651319b2f6SOder Chiou #define RT5645_GEN_CTRL1			0xfa
1661319b2f6SOder Chiou #define RT5645_GEN_CTRL2			0xfb
1671319b2f6SOder Chiou #define RT5645_GEN_CTRL3			0xfc
1681319b2f6SOder Chiou 
1691319b2f6SOder Chiou 
1701319b2f6SOder Chiou /* Index of Codec Private Register definition */
1711319b2f6SOder Chiou #define RT5645_DIG_VOL				0x00
1721319b2f6SOder Chiou #define RT5645_PR_ALC_CTRL_1			0x01
1731319b2f6SOder Chiou #define RT5645_PR_ALC_CTRL_2			0x02
1741319b2f6SOder Chiou #define RT5645_PR_ALC_CTRL_3			0x03
1751319b2f6SOder Chiou #define RT5645_PR_ALC_CTRL_4			0x04
1761319b2f6SOder Chiou #define RT5645_PR_ALC_CTRL_5			0x05
1771319b2f6SOder Chiou #define RT5645_PR_ALC_CTRL_6			0x06
1781319b2f6SOder Chiou #define RT5645_BIAS_CUR1			0x12
1791319b2f6SOder Chiou #define RT5645_BIAS_CUR3			0x14
1801319b2f6SOder Chiou #define RT5645_CLSD_INT_REG1			0x1c
1811319b2f6SOder Chiou #define RT5645_MAMP_INT_REG2			0x37
1821319b2f6SOder Chiou #define RT5645_CHOP_DAC_ADC			0x3d
1831319b2f6SOder Chiou #define RT5645_MIXER_INT_REG			0x3f
1841319b2f6SOder Chiou #define RT5645_3D_SPK				0x63
1851319b2f6SOder Chiou #define RT5645_WND_1				0x6c
1861319b2f6SOder Chiou #define RT5645_WND_2				0x6d
1871319b2f6SOder Chiou #define RT5645_WND_3				0x6e
1881319b2f6SOder Chiou #define RT5645_WND_4				0x6f
1891319b2f6SOder Chiou #define RT5645_WND_5				0x70
1901319b2f6SOder Chiou #define RT5645_WND_8				0x73
1911319b2f6SOder Chiou #define RT5645_DIP_SPK_INF			0x75
1921319b2f6SOder Chiou #define RT5645_HP_DCC_INT1			0x77
1931319b2f6SOder Chiou #define RT5645_EQ_BW_LOP			0xa0
1941319b2f6SOder Chiou #define RT5645_EQ_GN_LOP			0xa1
1951319b2f6SOder Chiou #define RT5645_EQ_FC_BP1			0xa2
1961319b2f6SOder Chiou #define RT5645_EQ_BW_BP1			0xa3
1971319b2f6SOder Chiou #define RT5645_EQ_GN_BP1			0xa4
1981319b2f6SOder Chiou #define RT5645_EQ_FC_BP2			0xa5
1991319b2f6SOder Chiou #define RT5645_EQ_BW_BP2			0xa6
2001319b2f6SOder Chiou #define RT5645_EQ_GN_BP2			0xa7
2011319b2f6SOder Chiou #define RT5645_EQ_FC_BP3			0xa8
2021319b2f6SOder Chiou #define RT5645_EQ_BW_BP3			0xa9
2031319b2f6SOder Chiou #define RT5645_EQ_GN_BP3			0xaa
2041319b2f6SOder Chiou #define RT5645_EQ_FC_BP4			0xab
2051319b2f6SOder Chiou #define RT5645_EQ_BW_BP4			0xac
2061319b2f6SOder Chiou #define RT5645_EQ_GN_BP4			0xad
2071319b2f6SOder Chiou #define RT5645_EQ_FC_HIP1			0xae
2081319b2f6SOder Chiou #define RT5645_EQ_GN_HIP1			0xaf
2091319b2f6SOder Chiou #define RT5645_EQ_FC_HIP2			0xb0
2101319b2f6SOder Chiou #define RT5645_EQ_BW_HIP2			0xb1
2111319b2f6SOder Chiou #define RT5645_EQ_GN_HIP2			0xb2
2121319b2f6SOder Chiou #define RT5645_EQ_PRE_VOL			0xb3
2131319b2f6SOder Chiou #define RT5645_EQ_PST_VOL			0xb4
2141319b2f6SOder Chiou 
2151319b2f6SOder Chiou 
2161319b2f6SOder Chiou /* global definition */
2171319b2f6SOder Chiou #define RT5645_L_MUTE				(0x1 << 15)
2181319b2f6SOder Chiou #define RT5645_L_MUTE_SFT			15
2191319b2f6SOder Chiou #define RT5645_VOL_L_MUTE			(0x1 << 14)
2201319b2f6SOder Chiou #define RT5645_VOL_L_SFT			14
2211319b2f6SOder Chiou #define RT5645_R_MUTE				(0x1 << 7)
2221319b2f6SOder Chiou #define RT5645_R_MUTE_SFT			7
2231319b2f6SOder Chiou #define RT5645_VOL_R_MUTE			(0x1 << 6)
2241319b2f6SOder Chiou #define RT5645_VOL_R_SFT			6
2251319b2f6SOder Chiou #define RT5645_L_VOL_MASK			(0x3f << 8)
2261319b2f6SOder Chiou #define RT5645_L_VOL_SFT			8
2271319b2f6SOder Chiou #define RT5645_R_VOL_MASK			(0x3f)
2281319b2f6SOder Chiou #define RT5645_R_VOL_SFT			0
2291319b2f6SOder Chiou 
2301319b2f6SOder Chiou /* IN1 Control 1 (0x0a) */
2311319b2f6SOder Chiou #define RT5645_CBJ_BST1_MASK			(0xf << 12)
2321319b2f6SOder Chiou #define RT5645_CBJ_BST1_SFT			(12)
2331319b2f6SOder Chiou #define RT5645_CBJ_JD_HP_EN			(0x1 << 9)
2341319b2f6SOder Chiou #define RT5645_CBJ_JD_MIC_EN			(0x1 << 8)
2351319b2f6SOder Chiou #define RT5645_CBJ_JD_MIC_SW_EN			(0x1 << 7)
2361319b2f6SOder Chiou #define RT5645_CBJ_MIC_SEL_R			(0x1 << 6)
2371319b2f6SOder Chiou #define RT5645_CBJ_MIC_SEL_L			(0x1 << 5)
2381319b2f6SOder Chiou #define RT5645_CBJ_MIC_SW			(0x1 << 4)
2391319b2f6SOder Chiou #define RT5645_CBJ_BST1_EN			(0x1 << 2)
2401319b2f6SOder Chiou 
2411319b2f6SOder Chiou /* IN1 Control 2 (0x0b) */
2421319b2f6SOder Chiou #define RT5645_CBJ_MN_JD			(0x1 << 12)
2431319b2f6SOder Chiou #define RT5645_CAPLESS_EN			(0x1 << 11)
2441319b2f6SOder Chiou #define RT5645_CBJ_DET_MODE			(0x1 << 7)
2451319b2f6SOder Chiou 
2461319b2f6SOder Chiou /* IN1 Control 3 (0x0c) */
2471319b2f6SOder Chiou #define RT5645_CBJ_TIE_G_L			(0x1 << 15)
2481319b2f6SOder Chiou #define RT5645_CBJ_TIE_G_R			(0x1 << 14)
2491319b2f6SOder Chiou 
2501319b2f6SOder Chiou /* IN2 Control (0x0d) */
2511319b2f6SOder Chiou #define RT5645_BST_MASK1			(0xf<<12)
2521319b2f6SOder Chiou #define RT5645_BST_SFT1				12
2531319b2f6SOder Chiou #define RT5645_BST_MASK2			(0xf<<8)
2541319b2f6SOder Chiou #define RT5645_BST_SFT2				8
2551319b2f6SOder Chiou #define RT5645_IN_DF2				(0x1 << 6)
2561319b2f6SOder Chiou #define RT5645_IN_SFT2				6
2571319b2f6SOder Chiou 
2581319b2f6SOder Chiou /* INL and INR Volume Control (0x0f) */
2591319b2f6SOder Chiou #define RT5645_INL_SEL_MASK			(0x1 << 15)
2601319b2f6SOder Chiou #define RT5645_INL_SEL_SFT			15
2611319b2f6SOder Chiou #define RT5645_INL_SEL_IN4P			(0x0 << 15)
2621319b2f6SOder Chiou #define RT5645_INL_SEL_MONOP			(0x1 << 15)
2631319b2f6SOder Chiou #define RT5645_INL_VOL_MASK			(0x1f << 8)
2641319b2f6SOder Chiou #define RT5645_INL_VOL_SFT			8
2651319b2f6SOder Chiou #define RT5645_INR_SEL_MASK			(0x1 << 7)
2661319b2f6SOder Chiou #define RT5645_INR_SEL_SFT			7
2671319b2f6SOder Chiou #define RT5645_INR_SEL_IN4N			(0x0 << 7)
2681319b2f6SOder Chiou #define RT5645_INR_SEL_MONON			(0x1 << 7)
2691319b2f6SOder Chiou #define RT5645_INR_VOL_MASK			(0x1f)
2701319b2f6SOder Chiou #define RT5645_INR_VOL_SFT			0
2711319b2f6SOder Chiou 
2721319b2f6SOder Chiou /* DAC1 Digital Volume (0x19) */
2731319b2f6SOder Chiou #define RT5645_DAC_L1_VOL_MASK			(0xff << 8)
2741319b2f6SOder Chiou #define RT5645_DAC_L1_VOL_SFT			8
2751319b2f6SOder Chiou #define RT5645_DAC_R1_VOL_MASK			(0xff)
2761319b2f6SOder Chiou #define RT5645_DAC_R1_VOL_SFT			0
2771319b2f6SOder Chiou 
2781319b2f6SOder Chiou /* DAC2 Digital Volume (0x1a) */
2791319b2f6SOder Chiou #define RT5645_DAC_L2_VOL_MASK			(0xff << 8)
2801319b2f6SOder Chiou #define RT5645_DAC_L2_VOL_SFT			8
2811319b2f6SOder Chiou #define RT5645_DAC_R2_VOL_MASK			(0xff)
2821319b2f6SOder Chiou #define RT5645_DAC_R2_VOL_SFT			0
2831319b2f6SOder Chiou 
2841319b2f6SOder Chiou /* DAC2 Control (0x1b) */
2851319b2f6SOder Chiou #define RT5645_M_DAC_L2_VOL			(0x1 << 13)
2861319b2f6SOder Chiou #define RT5645_M_DAC_L2_VOL_SFT			13
2871319b2f6SOder Chiou #define RT5645_M_DAC_R2_VOL			(0x1 << 12)
2881319b2f6SOder Chiou #define RT5645_M_DAC_R2_VOL_SFT			12
2891319b2f6SOder Chiou #define RT5645_DAC2_L_SEL_MASK			(0x7 << 4)
2901319b2f6SOder Chiou #define RT5645_DAC2_L_SEL_SFT			4
2911319b2f6SOder Chiou #define RT5645_DAC2_R_SEL_MASK			(0x7 << 0)
2921319b2f6SOder Chiou #define RT5645_DAC2_R_SEL_SFT			0
2931319b2f6SOder Chiou 
2941319b2f6SOder Chiou /* ADC Digital Volume Control (0x1c) */
2951319b2f6SOder Chiou #define RT5645_ADC_L_VOL_MASK			(0x7f << 8)
2961319b2f6SOder Chiou #define RT5645_ADC_L_VOL_SFT			8
2971319b2f6SOder Chiou #define RT5645_ADC_R_VOL_MASK			(0x7f)
2981319b2f6SOder Chiou #define RT5645_ADC_R_VOL_SFT			0
2991319b2f6SOder Chiou 
3001319b2f6SOder Chiou /* Mono ADC Digital Volume Control (0x1d) */
3011319b2f6SOder Chiou #define RT5645_MONO_ADC_L_VOL_MASK		(0x7f << 8)
3021319b2f6SOder Chiou #define RT5645_MONO_ADC_L_VOL_SFT		8
3031319b2f6SOder Chiou #define RT5645_MONO_ADC_R_VOL_MASK		(0x7f)
3041319b2f6SOder Chiou #define RT5645_MONO_ADC_R_VOL_SFT		0
3051319b2f6SOder Chiou 
3061319b2f6SOder Chiou /* ADC Boost Volume Control (0x1e) */
3071319b2f6SOder Chiou #define RT5645_STO1_ADC_L_BST_MASK		(0x3 << 14)
3081319b2f6SOder Chiou #define RT5645_STO1_ADC_L_BST_SFT		14
3091319b2f6SOder Chiou #define RT5645_STO1_ADC_R_BST_MASK		(0x3 << 12)
3101319b2f6SOder Chiou #define RT5645_STO1_ADC_R_BST_SFT		12
3111319b2f6SOder Chiou #define RT5645_STO1_ADC_COMP_MASK		(0x3 << 10)
3121319b2f6SOder Chiou #define RT5645_STO1_ADC_COMP_SFT		10
3138c1a9d63SOder Chiou 
3148c1a9d63SOder Chiou /* ADC Boost Volume Control (0x20) */
3158c1a9d63SOder Chiou #define RT5645_MONO_ADC_L_BST_MASK		(0x3 << 14)
3168c1a9d63SOder Chiou #define RT5645_MONO_ADC_L_BST_SFT		14
3178c1a9d63SOder Chiou #define RT5645_MONO_ADC_R_BST_MASK		(0x3 << 12)
3188c1a9d63SOder Chiou #define RT5645_MONO_ADC_R_BST_SFT		12
3198c1a9d63SOder Chiou #define RT5645_MONO_ADC_COMP_MASK		(0x3 << 10)
3208c1a9d63SOder Chiou #define RT5645_MONO_ADC_COMP_SFT		10
3211319b2f6SOder Chiou 
3221319b2f6SOder Chiou /* Stereo2 ADC Mixer Control (0x26) */
3231319b2f6SOder Chiou #define RT5645_STO2_ADC_SRC_MASK		(0x1 << 15)
3241319b2f6SOder Chiou #define RT5645_STO2_ADC_SRC_SFT			15
3251319b2f6SOder Chiou 
3261319b2f6SOder Chiou /* Stereo ADC Mixer Control (0x27) */
3271319b2f6SOder Chiou #define RT5645_M_ADC_L1				(0x1 << 14)
3281319b2f6SOder Chiou #define RT5645_M_ADC_L1_SFT			14
3291319b2f6SOder Chiou #define RT5645_M_ADC_L2				(0x1 << 13)
3301319b2f6SOder Chiou #define RT5645_M_ADC_L2_SFT			13
3311319b2f6SOder Chiou #define RT5645_ADC_1_SRC_MASK			(0x1 << 12)
3321319b2f6SOder Chiou #define RT5645_ADC_1_SRC_SFT			12
3331319b2f6SOder Chiou #define RT5645_ADC_1_SRC_ADC			(0x1 << 12)
3341319b2f6SOder Chiou #define RT5645_ADC_1_SRC_DACMIX			(0x0 << 12)
3351319b2f6SOder Chiou #define RT5645_ADC_2_SRC_MASK			(0x1 << 11)
3361319b2f6SOder Chiou #define RT5645_ADC_2_SRC_SFT			11
3371319b2f6SOder Chiou #define RT5645_DMIC_SRC_MASK			(0x1 << 8)
3381319b2f6SOder Chiou #define RT5645_DMIC_SRC_SFT			8
3391319b2f6SOder Chiou #define RT5645_M_ADC_R1				(0x1 << 6)
3401319b2f6SOder Chiou #define RT5645_M_ADC_R1_SFT			6
3411319b2f6SOder Chiou #define RT5645_M_ADC_R2				(0x1 << 5)
3421319b2f6SOder Chiou #define RT5645_M_ADC_R2_SFT			5
3431319b2f6SOder Chiou #define RT5645_DMIC3_SRC_MASK			(0x1 << 1)
3441319b2f6SOder Chiou #define RT5645_DMIC3_SRC_SFT			0
3451319b2f6SOder Chiou 
3461319b2f6SOder Chiou /* Mono ADC Mixer Control (0x28) */
3471319b2f6SOder Chiou #define RT5645_M_MONO_ADC_L1			(0x1 << 14)
3481319b2f6SOder Chiou #define RT5645_M_MONO_ADC_L1_SFT		14
3491319b2f6SOder Chiou #define RT5645_M_MONO_ADC_L2			(0x1 << 13)
3501319b2f6SOder Chiou #define RT5645_M_MONO_ADC_L2_SFT		13
3511319b2f6SOder Chiou #define RT5645_MONO_ADC_L1_SRC_MASK		(0x1 << 12)
3521319b2f6SOder Chiou #define RT5645_MONO_ADC_L1_SRC_SFT		12
3531319b2f6SOder Chiou #define RT5645_MONO_ADC_L1_SRC_DACMIXL		(0x0 << 12)
3541319b2f6SOder Chiou #define RT5645_MONO_ADC_L1_SRC_ADCL		(0x1 << 12)
3551319b2f6SOder Chiou #define RT5645_MONO_ADC_L2_SRC_MASK		(0x1 << 11)
3561319b2f6SOder Chiou #define RT5645_MONO_ADC_L2_SRC_SFT		11
3571319b2f6SOder Chiou #define RT5645_MONO_DMIC_L_SRC_MASK		(0x1 << 8)
3581319b2f6SOder Chiou #define RT5645_MONO_DMIC_L_SRC_SFT		8
3591319b2f6SOder Chiou #define RT5645_M_MONO_ADC_R1			(0x1 << 6)
3601319b2f6SOder Chiou #define RT5645_M_MONO_ADC_R1_SFT		6
3611319b2f6SOder Chiou #define RT5645_M_MONO_ADC_R2			(0x1 << 5)
3621319b2f6SOder Chiou #define RT5645_M_MONO_ADC_R2_SFT		5
3631319b2f6SOder Chiou #define RT5645_MONO_ADC_R1_SRC_MASK		(0x1 << 4)
3641319b2f6SOder Chiou #define RT5645_MONO_ADC_R1_SRC_SFT		4
3651319b2f6SOder Chiou #define RT5645_MONO_ADC_R1_SRC_ADCR		(0x1 << 4)
3661319b2f6SOder Chiou #define RT5645_MONO_ADC_R1_SRC_DACMIXR		(0x0 << 4)
3671319b2f6SOder Chiou #define RT5645_MONO_ADC_R2_SRC_MASK		(0x1 << 3)
3681319b2f6SOder Chiou #define RT5645_MONO_ADC_R2_SRC_SFT		3
3691319b2f6SOder Chiou #define RT5645_MONO_DMIC_R_SRC_MASK		(0x3)
3701319b2f6SOder Chiou #define RT5645_MONO_DMIC_R_SRC_SFT		0
3711319b2f6SOder Chiou 
3721319b2f6SOder Chiou /* ADC Mixer to DAC Mixer Control (0x29) */
3731319b2f6SOder Chiou #define RT5645_M_ADCMIX_L			(0x1 << 15)
3741319b2f6SOder Chiou #define RT5645_M_ADCMIX_L_SFT			15
3751319b2f6SOder Chiou #define RT5645_M_DAC1_L				(0x1 << 14)
3761319b2f6SOder Chiou #define RT5645_M_DAC1_L_SFT			14
3771319b2f6SOder Chiou #define RT5645_DAC1_R_SEL_MASK			(0x3 << 10)
3781319b2f6SOder Chiou #define RT5645_DAC1_R_SEL_SFT			10
3791319b2f6SOder Chiou #define RT5645_DAC1_R_SEL_IF1			(0x0 << 10)
3801319b2f6SOder Chiou #define RT5645_DAC1_R_SEL_IF2			(0x1 << 10)
3811319b2f6SOder Chiou #define RT5645_DAC1_R_SEL_IF3			(0x2 << 10)
3821319b2f6SOder Chiou #define RT5645_DAC1_R_SEL_IF4			(0x3 << 10)
3831319b2f6SOder Chiou #define RT5645_DAC1_L_SEL_MASK			(0x3 << 8)
3841319b2f6SOder Chiou #define RT5645_DAC1_L_SEL_SFT			8
3851319b2f6SOder Chiou #define RT5645_DAC1_L_SEL_IF1			(0x0 << 8)
3861319b2f6SOder Chiou #define RT5645_DAC1_L_SEL_IF2			(0x1 << 8)
3871319b2f6SOder Chiou #define RT5645_DAC1_L_SEL_IF3			(0x2 << 8)
3881319b2f6SOder Chiou #define RT5645_DAC1_L_SEL_IF4			(0x3 << 8)
3891319b2f6SOder Chiou #define RT5645_M_ADCMIX_R			(0x1 << 7)
3901319b2f6SOder Chiou #define RT5645_M_ADCMIX_R_SFT			7
3911319b2f6SOder Chiou #define RT5645_M_DAC1_R				(0x1 << 6)
3921319b2f6SOder Chiou #define RT5645_M_DAC1_R_SFT			6
3931319b2f6SOder Chiou 
3941319b2f6SOder Chiou /* Stereo DAC Mixer Control (0x2a) */
3951319b2f6SOder Chiou #define RT5645_M_DAC_L1				(0x1 << 14)
3961319b2f6SOder Chiou #define RT5645_M_DAC_L1_SFT			14
3971319b2f6SOder Chiou #define RT5645_DAC_L1_STO_L_VOL_MASK		(0x1 << 13)
3981319b2f6SOder Chiou #define RT5645_DAC_L1_STO_L_VOL_SFT		13
3991319b2f6SOder Chiou #define RT5645_M_DAC_L2				(0x1 << 12)
4001319b2f6SOder Chiou #define RT5645_M_DAC_L2_SFT			12
4011319b2f6SOder Chiou #define RT5645_DAC_L2_STO_L_VOL_MASK		(0x1 << 11)
4021319b2f6SOder Chiou #define RT5645_DAC_L2_STO_L_VOL_SFT		11
4031319b2f6SOder Chiou #define RT5645_M_ANC_DAC_L			(0x1 << 10)
4041319b2f6SOder Chiou #define RT5645_M_ANC_DAC_L_SFT			10
4051319b2f6SOder Chiou #define RT5645_M_DAC_R1_STO_L			(0x1 << 9)
4061319b2f6SOder Chiou #define RT5645_M_DAC_R1_STO_L_SFT			9
4071319b2f6SOder Chiou #define RT5645_DAC_R1_STO_L_VOL_MASK		(0x1 << 8)
4081319b2f6SOder Chiou #define RT5645_DAC_R1_STO_L_VOL_SFT		8
4091319b2f6SOder Chiou #define RT5645_M_DAC_R1				(0x1 << 6)
4101319b2f6SOder Chiou #define RT5645_M_DAC_R1_SFT			6
4111319b2f6SOder Chiou #define RT5645_DAC_R1_STO_R_VOL_MASK		(0x1 << 5)
4121319b2f6SOder Chiou #define RT5645_DAC_R1_STO_R_VOL_SFT		5
4131319b2f6SOder Chiou #define RT5645_M_DAC_R2				(0x1 << 4)
4141319b2f6SOder Chiou #define RT5645_M_DAC_R2_SFT			4
4151319b2f6SOder Chiou #define RT5645_DAC_R2_STO_R_VOL_MASK		(0x1 << 3)
4161319b2f6SOder Chiou #define RT5645_DAC_R2_STO_R_VOL_SFT		3
4171319b2f6SOder Chiou #define RT5645_M_ANC_DAC_R			(0x1 << 2)
4181319b2f6SOder Chiou #define RT5645_M_ANC_DAC_R_SFT			2
4191319b2f6SOder Chiou #define RT5645_M_DAC_L1_STO_R			(0x1 << 1)
4201319b2f6SOder Chiou #define RT5645_M_DAC_L1_STO_R_SFT			1
4211319b2f6SOder Chiou #define RT5645_DAC_L1_STO_R_VOL_MASK		(0x1)
4221319b2f6SOder Chiou #define RT5645_DAC_L1_STO_R_VOL_SFT		0
4231319b2f6SOder Chiou 
4241319b2f6SOder Chiou /* Mono DAC Mixer Control (0x2b) */
4251319b2f6SOder Chiou #define RT5645_M_DAC_L1_MONO_L			(0x1 << 14)
4261319b2f6SOder Chiou #define RT5645_M_DAC_L1_MONO_L_SFT		14
4271319b2f6SOder Chiou #define RT5645_DAC_L1_MONO_L_VOL_MASK		(0x1 << 13)
4281319b2f6SOder Chiou #define RT5645_DAC_L1_MONO_L_VOL_SFT		13
4291319b2f6SOder Chiou #define RT5645_M_DAC_L2_MONO_L			(0x1 << 12)
4301319b2f6SOder Chiou #define RT5645_M_DAC_L2_MONO_L_SFT		12
4311319b2f6SOder Chiou #define RT5645_DAC_L2_MONO_L_VOL_MASK		(0x1 << 11)
4321319b2f6SOder Chiou #define RT5645_DAC_L2_MONO_L_VOL_SFT		11
4331319b2f6SOder Chiou #define RT5645_M_DAC_R2_MONO_L			(0x1 << 10)
4341319b2f6SOder Chiou #define RT5645_M_DAC_R2_MONO_L_SFT		10
4351319b2f6SOder Chiou #define RT5645_DAC_R2_MONO_L_VOL_MASK		(0x1 << 9)
4361319b2f6SOder Chiou #define RT5645_DAC_R2_MONO_L_VOL_SFT		9
4371319b2f6SOder Chiou #define RT5645_M_DAC_R1_MONO_R			(0x1 << 6)
4381319b2f6SOder Chiou #define RT5645_M_DAC_R1_MONO_R_SFT		6
4391319b2f6SOder Chiou #define RT5645_DAC_R1_MONO_R_VOL_MASK		(0x1 << 5)
4401319b2f6SOder Chiou #define RT5645_DAC_R1_MONO_R_VOL_SFT		5
4411319b2f6SOder Chiou #define RT5645_M_DAC_R2_MONO_R			(0x1 << 4)
4421319b2f6SOder Chiou #define RT5645_M_DAC_R2_MONO_R_SFT		4
4431319b2f6SOder Chiou #define RT5645_DAC_R2_MONO_R_VOL_MASK		(0x1 << 3)
4441319b2f6SOder Chiou #define RT5645_DAC_R2_MONO_R_VOL_SFT		3
4451319b2f6SOder Chiou #define RT5645_M_DAC_L2_MONO_R			(0x1 << 2)
4461319b2f6SOder Chiou #define RT5645_M_DAC_L2_MONO_R_SFT		2
4471319b2f6SOder Chiou #define RT5645_DAC_L2_MONO_R_VOL_MASK		(0x1 << 1)
4481319b2f6SOder Chiou #define RT5645_DAC_L2_MONO_R_VOL_SFT		1
4491319b2f6SOder Chiou 
4501319b2f6SOder Chiou /* Digital Mixer Control (0x2c) */
4511319b2f6SOder Chiou #define RT5645_M_STO_L_DAC_L			(0x1 << 15)
4521319b2f6SOder Chiou #define RT5645_M_STO_L_DAC_L_SFT		15
4531319b2f6SOder Chiou #define RT5645_STO_L_DAC_L_VOL_MASK		(0x1 << 14)
4541319b2f6SOder Chiou #define RT5645_STO_L_DAC_L_VOL_SFT		14
4551319b2f6SOder Chiou #define RT5645_M_DAC_L2_DAC_L			(0x1 << 13)
4561319b2f6SOder Chiou #define RT5645_M_DAC_L2_DAC_L_SFT		13
4571319b2f6SOder Chiou #define RT5645_DAC_L2_DAC_L_VOL_MASK		(0x1 << 12)
4581319b2f6SOder Chiou #define RT5645_DAC_L2_DAC_L_VOL_SFT		12
4591319b2f6SOder Chiou #define RT5645_M_STO_R_DAC_R			(0x1 << 11)
4601319b2f6SOder Chiou #define RT5645_M_STO_R_DAC_R_SFT		11
4611319b2f6SOder Chiou #define RT5645_STO_R_DAC_R_VOL_MASK		(0x1 << 10)
4621319b2f6SOder Chiou #define RT5645_STO_R_DAC_R_VOL_SFT		10
4631319b2f6SOder Chiou #define RT5645_M_DAC_R2_DAC_R			(0x1 << 9)
4641319b2f6SOder Chiou #define RT5645_M_DAC_R2_DAC_R_SFT		9
4651319b2f6SOder Chiou #define RT5645_DAC_R2_DAC_R_VOL_MASK		(0x1 << 8)
4661319b2f6SOder Chiou #define RT5645_DAC_R2_DAC_R_VOL_SFT		8
4671319b2f6SOder Chiou #define RT5645_M_DAC_R2_DAC_L			(0x1 << 7)
4681319b2f6SOder Chiou #define RT5645_M_DAC_R2_DAC_L_SFT		7
4691319b2f6SOder Chiou #define RT5645_DAC_R2_DAC_L_VOL_MASK		(0x1 << 6)
4701319b2f6SOder Chiou #define RT5645_DAC_R2_DAC_L_VOL_SFT		6
4711319b2f6SOder Chiou #define RT5645_M_DAC_L2_DAC_R			(0x1 << 5)
4721319b2f6SOder Chiou #define RT5645_M_DAC_L2_DAC_R_SFT		5
4731319b2f6SOder Chiou #define RT5645_DAC_L2_DAC_R_VOL_MASK		(0x1 << 4)
4741319b2f6SOder Chiou #define RT5645_DAC_L2_DAC_R_VOL_SFT		4
4751319b2f6SOder Chiou 
4765c4ca99dSBard Liao /* Analog DAC1/2 Input Source Control (0x2d) */
4775c4ca99dSBard Liao #define RT5650_A_DAC1_L_IN_SFT			3
4785c4ca99dSBard Liao #define RT5650_A_DAC1_R_IN_SFT			2
4795c4ca99dSBard Liao #define RT5650_A_DAC2_L_IN_SFT			1
4805c4ca99dSBard Liao #define RT5650_A_DAC2_R_IN_SFT			0
4815c4ca99dSBard Liao 
4821319b2f6SOder Chiou /* Digital Interface Data Control (0x2f) */
4831319b2f6SOder Chiou #define RT5645_IF1_ADC2_IN_SEL			(0x1 << 15)
4841319b2f6SOder Chiou #define RT5645_IF1_ADC2_IN_SFT			15
4851319b2f6SOder Chiou #define RT5645_IF2_ADC_IN_MASK			(0x7 << 12)
4861319b2f6SOder Chiou #define RT5645_IF2_ADC_IN_SFT			12
4871319b2f6SOder Chiou #define RT5645_IF2_DAC_SEL_MASK			(0x3 << 10)
4881319b2f6SOder Chiou #define RT5645_IF2_DAC_SEL_SFT			10
4891319b2f6SOder Chiou #define RT5645_IF2_ADC_SEL_MASK			(0x3 << 8)
4901319b2f6SOder Chiou #define RT5645_IF2_ADC_SEL_SFT			8
4911319b2f6SOder Chiou #define RT5645_IF3_DAC_SEL_MASK			(0x3 << 6)
4921319b2f6SOder Chiou #define RT5645_IF3_DAC_SEL_SFT			6
4931319b2f6SOder Chiou #define RT5645_IF3_ADC_SEL_MASK			(0x3 << 4)
4941319b2f6SOder Chiou #define RT5645_IF3_ADC_SEL_SFT			4
4951319b2f6SOder Chiou #define RT5645_IF3_ADC_IN_MASK			(0x7)
4961319b2f6SOder Chiou #define RT5645_IF3_ADC_IN_SFT			0
4971319b2f6SOder Chiou 
4981319b2f6SOder Chiou /* PDM Output Control (0x31) */
4991319b2f6SOder Chiou #define RT5645_PDM1_L_MASK			(0x1 << 15)
5001319b2f6SOder Chiou #define RT5645_PDM1_L_SFT			15
5011319b2f6SOder Chiou #define RT5645_M_PDM1_L				(0x1 << 14)
5021319b2f6SOder Chiou #define RT5645_M_PDM1_L_SFT			14
5031319b2f6SOder Chiou #define RT5645_PDM1_R_MASK			(0x1 << 13)
5041319b2f6SOder Chiou #define RT5645_PDM1_R_SFT			13
5051319b2f6SOder Chiou #define RT5645_M_PDM1_R				(0x1 << 12)
5061319b2f6SOder Chiou #define RT5645_M_PDM1_R_SFT			12
5071319b2f6SOder Chiou #define RT5645_PDM2_L_MASK			(0x1 << 11)
5081319b2f6SOder Chiou #define RT5645_PDM2_L_SFT			11
5091319b2f6SOder Chiou #define RT5645_M_PDM2_L				(0x1 << 10)
5101319b2f6SOder Chiou #define RT5645_M_PDM2_L_SFT			10
5111319b2f6SOder Chiou #define RT5645_PDM2_R_MASK			(0x1 << 9)
5121319b2f6SOder Chiou #define RT5645_PDM2_R_SFT			9
5131319b2f6SOder Chiou #define RT5645_M_PDM2_R				(0x1 << 8)
5141319b2f6SOder Chiou #define RT5645_M_PDM2_R_SFT			8
5151319b2f6SOder Chiou #define RT5645_PDM2_BUSY			(0x1 << 7)
5161319b2f6SOder Chiou #define RT5645_PDM1_BUSY			(0x1 << 6)
5171319b2f6SOder Chiou #define RT5645_PDM_PATTERN			(0x1 << 5)
5181319b2f6SOder Chiou #define RT5645_PDM_GAIN				(0x1 << 4)
5191319b2f6SOder Chiou #define RT5645_PDM_DIV_MASK			(0x3)
5201319b2f6SOder Chiou 
5211319b2f6SOder Chiou /* REC Left Mixer Control 1 (0x3b) */
5221319b2f6SOder Chiou #define RT5645_G_HP_L_RM_L_MASK			(0x7 << 13)
5231319b2f6SOder Chiou #define RT5645_G_HP_L_RM_L_SFT			13
5241319b2f6SOder Chiou #define RT5645_G_IN_L_RM_L_MASK			(0x7 << 10)
5251319b2f6SOder Chiou #define RT5645_G_IN_L_RM_L_SFT			10
5261319b2f6SOder Chiou #define RT5645_G_BST4_RM_L_MASK			(0x7 << 7)
5271319b2f6SOder Chiou #define RT5645_G_BST4_RM_L_SFT			7
5281319b2f6SOder Chiou #define RT5645_G_BST3_RM_L_MASK			(0x7 << 4)
5291319b2f6SOder Chiou #define RT5645_G_BST3_RM_L_SFT			4
5301319b2f6SOder Chiou #define RT5645_G_BST2_RM_L_MASK			(0x7 << 1)
5311319b2f6SOder Chiou #define RT5645_G_BST2_RM_L_SFT			1
5321319b2f6SOder Chiou 
5331319b2f6SOder Chiou /* REC Left Mixer Control 2 (0x3c) */
5341319b2f6SOder Chiou #define RT5645_G_BST1_RM_L_MASK			(0x7 << 13)
5351319b2f6SOder Chiou #define RT5645_G_BST1_RM_L_SFT			13
5361319b2f6SOder Chiou #define RT5645_G_OM_L_RM_L_MASK			(0x7 << 10)
5371319b2f6SOder Chiou #define RT5645_G_OM_L_RM_L_SFT			10
5381319b2f6SOder Chiou #define RT5645_M_MM_L_RM_L			(0x1 << 6)
5391319b2f6SOder Chiou #define RT5645_M_MM_L_RM_L_SFT			6
5401319b2f6SOder Chiou #define RT5645_M_IN_L_RM_L			(0x1 << 5)
5411319b2f6SOder Chiou #define RT5645_M_IN_L_RM_L_SFT			5
5421319b2f6SOder Chiou #define RT5645_M_HP_L_RM_L			(0x1 << 4)
5431319b2f6SOder Chiou #define RT5645_M_HP_L_RM_L_SFT			4
5441319b2f6SOder Chiou #define RT5645_M_BST3_RM_L			(0x1 << 3)
5451319b2f6SOder Chiou #define RT5645_M_BST3_RM_L_SFT			3
5461319b2f6SOder Chiou #define RT5645_M_BST2_RM_L			(0x1 << 2)
5471319b2f6SOder Chiou #define RT5645_M_BST2_RM_L_SFT			2
5481319b2f6SOder Chiou #define RT5645_M_BST1_RM_L			(0x1 << 1)
5491319b2f6SOder Chiou #define RT5645_M_BST1_RM_L_SFT			1
5501319b2f6SOder Chiou #define RT5645_M_OM_L_RM_L			(0x1)
5511319b2f6SOder Chiou #define RT5645_M_OM_L_RM_L_SFT			0
5521319b2f6SOder Chiou 
5531319b2f6SOder Chiou /* REC Right Mixer Control 1 (0x3d) */
5541319b2f6SOder Chiou #define RT5645_G_HP_R_RM_R_MASK			(0x7 << 13)
5551319b2f6SOder Chiou #define RT5645_G_HP_R_RM_R_SFT			13
5561319b2f6SOder Chiou #define RT5645_G_IN_R_RM_R_MASK			(0x7 << 10)
5571319b2f6SOder Chiou #define RT5645_G_IN_R_RM_R_SFT			10
5581319b2f6SOder Chiou #define RT5645_G_BST4_RM_R_MASK			(0x7 << 7)
5591319b2f6SOder Chiou #define RT5645_G_BST4_RM_R_SFT			7
5601319b2f6SOder Chiou #define RT5645_G_BST3_RM_R_MASK			(0x7 << 4)
5611319b2f6SOder Chiou #define RT5645_G_BST3_RM_R_SFT			4
5621319b2f6SOder Chiou #define RT5645_G_BST2_RM_R_MASK			(0x7 << 1)
5631319b2f6SOder Chiou #define RT5645_G_BST2_RM_R_SFT			1
5641319b2f6SOder Chiou 
5651319b2f6SOder Chiou /* REC Right Mixer Control 2 (0x3e) */
5661319b2f6SOder Chiou #define RT5645_G_BST1_RM_R_MASK			(0x7 << 13)
5671319b2f6SOder Chiou #define RT5645_G_BST1_RM_R_SFT			13
5681319b2f6SOder Chiou #define RT5645_G_OM_R_RM_R_MASK			(0x7 << 10)
5691319b2f6SOder Chiou #define RT5645_G_OM_R_RM_R_SFT			10
5701319b2f6SOder Chiou #define RT5645_M_MM_R_RM_R			(0x1 << 6)
5711319b2f6SOder Chiou #define RT5645_M_MM_R_RM_R_SFT			6
5721319b2f6SOder Chiou #define RT5645_M_IN_R_RM_R			(0x1 << 5)
5731319b2f6SOder Chiou #define RT5645_M_IN_R_RM_R_SFT			5
5741319b2f6SOder Chiou #define RT5645_M_HP_R_RM_R			(0x1 << 4)
5751319b2f6SOder Chiou #define RT5645_M_HP_R_RM_R_SFT			4
5761319b2f6SOder Chiou #define RT5645_M_BST3_RM_R			(0x1 << 3)
5771319b2f6SOder Chiou #define RT5645_M_BST3_RM_R_SFT			3
5781319b2f6SOder Chiou #define RT5645_M_BST2_RM_R			(0x1 << 2)
5791319b2f6SOder Chiou #define RT5645_M_BST2_RM_R_SFT			2
5801319b2f6SOder Chiou #define RT5645_M_BST1_RM_R			(0x1 << 1)
5811319b2f6SOder Chiou #define RT5645_M_BST1_RM_R_SFT			1
5821319b2f6SOder Chiou #define RT5645_M_OM_R_RM_R			(0x1)
5831319b2f6SOder Chiou #define RT5645_M_OM_R_RM_R_SFT			0
5841319b2f6SOder Chiou 
5851319b2f6SOder Chiou /* HPOMIX Control (0x40) (0x42) */
5861319b2f6SOder Chiou #define RT5645_M_BST1_HV			(0x1 << 4)
5871319b2f6SOder Chiou #define RT5645_M_BST1_HV_SFT			4
5881319b2f6SOder Chiou #define RT5645_M_BST2_HV			(0x1 << 4)
5891319b2f6SOder Chiou #define RT5645_M_BST2_HV_SFT			4
5901319b2f6SOder Chiou #define RT5645_M_BST3_HV			(0x1 << 3)
5911319b2f6SOder Chiou #define RT5645_M_BST3_HV_SFT			3
5921319b2f6SOder Chiou #define RT5645_M_IN_HV				(0x1 << 2)
5931319b2f6SOder Chiou #define RT5645_M_IN_HV_SFT			2
5941319b2f6SOder Chiou #define RT5645_M_DAC2_HV			(0x1 << 1)
5951319b2f6SOder Chiou #define RT5645_M_DAC2_HV_SFT			1
5961319b2f6SOder Chiou #define RT5645_M_DAC1_HV			(0x1 << 0)
5971319b2f6SOder Chiou #define RT5645_M_DAC1_HV_SFT			0
5981319b2f6SOder Chiou 
5991319b2f6SOder Chiou /* HPMIX Control (0x45) */
6001319b2f6SOder Chiou #define RT5645_M_DAC1_HM			(0x1 << 14)
6011319b2f6SOder Chiou #define RT5645_M_DAC1_HM_SFT			14
6021319b2f6SOder Chiou #define RT5645_M_HPVOL_HM			(0x1 << 13)
6031319b2f6SOder Chiou #define RT5645_M_HPVOL_HM_SFT			13
6042d4e2d02SBard Liao #define RT5645_IRQ_PSV_MODE			(0x1 << 12)
6051319b2f6SOder Chiou 
6061319b2f6SOder Chiou /* SPK Left Mixer Control (0x46) */
6071319b2f6SOder Chiou #define RT5645_G_RM_L_SM_L_MASK			(0x3 << 14)
6081319b2f6SOder Chiou #define RT5645_G_RM_L_SM_L_SFT			14
6091319b2f6SOder Chiou #define RT5645_G_IN_L_SM_L_MASK			(0x3 << 12)
6101319b2f6SOder Chiou #define RT5645_G_IN_L_SM_L_SFT			12
6111319b2f6SOder Chiou #define RT5645_G_DAC_L1_SM_L_MASK		(0x3 << 10)
6121319b2f6SOder Chiou #define RT5645_G_DAC_L1_SM_L_SFT		10
6131319b2f6SOder Chiou #define RT5645_G_DAC_L2_SM_L_MASK		(0x3 << 8)
6141319b2f6SOder Chiou #define RT5645_G_DAC_L2_SM_L_SFT		8
6151319b2f6SOder Chiou #define RT5645_G_OM_L_SM_L_MASK			(0x3 << 6)
6161319b2f6SOder Chiou #define RT5645_G_OM_L_SM_L_SFT			6
6171319b2f6SOder Chiou #define RT5645_M_BST1_L_SM_L			(0x1 << 5)
6181319b2f6SOder Chiou #define RT5645_M_BST1_L_SM_L_SFT		5
6191319b2f6SOder Chiou #define RT5645_M_BST3_L_SM_L			(0x1 << 4)
6201319b2f6SOder Chiou #define RT5645_M_BST3_L_SM_L_SFT		4
621bc86e53aSAxel Lin #define RT5645_M_IN_L_SM_L			(0x1 << 3)
622bc86e53aSAxel Lin #define RT5645_M_IN_L_SM_L_SFT			3
623bc86e53aSAxel Lin #define RT5645_M_DAC_L2_SM_L			(0x1 << 2)
624bc86e53aSAxel Lin #define RT5645_M_DAC_L2_SM_L_SFT		2
625bc86e53aSAxel Lin #define RT5645_M_DAC_L1_SM_L			(0x1 << 1)
626bc86e53aSAxel Lin #define RT5645_M_DAC_L1_SM_L_SFT		1
6271319b2f6SOder Chiou 
6281319b2f6SOder Chiou /* SPK Right Mixer Control (0x47) */
6291319b2f6SOder Chiou #define RT5645_G_RM_R_SM_R_MASK			(0x3 << 14)
6301319b2f6SOder Chiou #define RT5645_G_RM_R_SM_R_SFT			14
6311319b2f6SOder Chiou #define RT5645_G_IN_R_SM_R_MASK			(0x3 << 12)
6321319b2f6SOder Chiou #define RT5645_G_IN_R_SM_R_SFT			12
6331319b2f6SOder Chiou #define RT5645_G_DAC_R1_SM_R_MASK		(0x3 << 10)
6341319b2f6SOder Chiou #define RT5645_G_DAC_R1_SM_R_SFT		10
6351319b2f6SOder Chiou #define RT5645_G_DAC_R2_SM_R_MASK		(0x3 << 8)
6361319b2f6SOder Chiou #define RT5645_G_DAC_R2_SM_R_SFT		8
6371319b2f6SOder Chiou #define RT5645_G_OM_R_SM_R_MASK			(0x3 << 6)
6381319b2f6SOder Chiou #define RT5645_G_OM_R_SM_R_SFT			6
6391319b2f6SOder Chiou #define RT5645_M_BST2_R_SM_R			(0x1 << 5)
6401319b2f6SOder Chiou #define RT5645_M_BST2_R_SM_R_SFT		5
6411319b2f6SOder Chiou #define RT5645_M_BST3_R_SM_R			(0x1 << 4)
6421319b2f6SOder Chiou #define RT5645_M_BST3_R_SM_R_SFT		4
643bc86e53aSAxel Lin #define RT5645_M_IN_R_SM_R			(0x1 << 3)
644bc86e53aSAxel Lin #define RT5645_M_IN_R_SM_R_SFT			3
645bc86e53aSAxel Lin #define RT5645_M_DAC_R2_SM_R			(0x1 << 2)
646bc86e53aSAxel Lin #define RT5645_M_DAC_R2_SM_R_SFT		2
647bc86e53aSAxel Lin #define RT5645_M_DAC_R1_SM_R			(0x1 << 1)
648bc86e53aSAxel Lin #define RT5645_M_DAC_R1_SM_R_SFT		1
6491319b2f6SOder Chiou 
6501319b2f6SOder Chiou /* SPOLMIX Control (0x48) */
6511319b2f6SOder Chiou #define RT5645_M_DAC_L1_SPM_L			(0x1 << 15)
6521319b2f6SOder Chiou #define RT5645_M_DAC_L1_SPM_L_SFT		15
6531319b2f6SOder Chiou #define RT5645_M_DAC_R1_SPM_L			(0x1 << 14)
6541319b2f6SOder Chiou #define RT5645_M_DAC_R1_SPM_L_SFT		14
6551319b2f6SOder Chiou #define RT5645_M_SV_L_SPM_L			(0x1 << 13)
6561319b2f6SOder Chiou #define RT5645_M_SV_L_SPM_L_SFT			13
6571319b2f6SOder Chiou #define RT5645_M_SV_R_SPM_L			(0x1 << 12)
6581319b2f6SOder Chiou #define RT5645_M_SV_R_SPM_L_SFT			12
6591319b2f6SOder Chiou #define RT5645_M_BST3_SPM_L			(0x1 << 11)
6601319b2f6SOder Chiou #define RT5645_M_BST3_SPM_L_SFT			11
6611319b2f6SOder Chiou #define RT5645_M_DAC_R1_SPM_R			(0x1 << 2)
6621319b2f6SOder Chiou #define RT5645_M_DAC_R1_SPM_R_SFT		2
6631319b2f6SOder Chiou #define RT5645_M_BST3_SPM_R			(0x1 << 1)
6641319b2f6SOder Chiou #define RT5645_M_BST3_SPM_R_SFT			1
6651319b2f6SOder Chiou #define RT5645_M_SV_R_SPM_R			(0x1 << 0)
6661319b2f6SOder Chiou #define RT5645_M_SV_R_SPM_R_SFT			0
6671319b2f6SOder Chiou 
668e29fd55dSOder Chiou /* SPOMIX Ratio Control (0x4a) */
669e29fd55dSOder Chiou #define RT5645_SPK_G_CLSD_MASK			(0x7 << 0)
670e29fd55dSOder Chiou #define RT5645_SPK_G_CLSD_SFT			0
671e29fd55dSOder Chiou 
6721319b2f6SOder Chiou /* Mono Output Mixer Control (0x4c) */
673bc86e53aSAxel Lin #define RT5645_G_MONOMIX_MASK			(0x1 << 10)
674bc86e53aSAxel Lin #define RT5645_G_MONOMIX_SFT			10
6751319b2f6SOder Chiou #define RT5645_M_OV_L_MM			(0x1 << 9)
6761319b2f6SOder Chiou #define RT5645_M_OV_L_MM_SFT			9
6771319b2f6SOder Chiou #define RT5645_M_DAC_L2_MA			(0x1 << 8)
6781319b2f6SOder Chiou #define RT5645_M_DAC_L2_MA_SFT			8
6791319b2f6SOder Chiou #define RT5645_M_BST2_MM			(0x1 << 4)
6801319b2f6SOder Chiou #define RT5645_M_BST2_MM_SFT			4
6811319b2f6SOder Chiou #define RT5645_M_DAC_R1_MM			(0x1 << 3)
6821319b2f6SOder Chiou #define RT5645_M_DAC_R1_MM_SFT			3
6831319b2f6SOder Chiou #define RT5645_M_DAC_R2_MM			(0x1 << 2)
6841319b2f6SOder Chiou #define RT5645_M_DAC_R2_MM_SFT			2
6851319b2f6SOder Chiou #define RT5645_M_DAC_L2_MM			(0x1 << 1)
6861319b2f6SOder Chiou #define RT5645_M_DAC_L2_MM_SFT			1
6871319b2f6SOder Chiou #define RT5645_M_BST3_MM			(0x1 << 0)
6881319b2f6SOder Chiou #define RT5645_M_BST3_MM_SFT			0
6891319b2f6SOder Chiou 
6901319b2f6SOder Chiou /* Output Left Mixer Control 1 (0x4d) */
6911319b2f6SOder Chiou #define RT5645_G_BST3_OM_L_MASK			(0x7 << 13)
6921319b2f6SOder Chiou #define RT5645_G_BST3_OM_L_SFT			13
6931319b2f6SOder Chiou #define RT5645_G_BST2_OM_L_MASK			(0x7 << 10)
6941319b2f6SOder Chiou #define RT5645_G_BST2_OM_L_SFT			10
6951319b2f6SOder Chiou #define RT5645_G_BST1_OM_L_MASK			(0x7 << 7)
6961319b2f6SOder Chiou #define RT5645_G_BST1_OM_L_SFT			7
6971319b2f6SOder Chiou #define RT5645_G_IN_L_OM_L_MASK			(0x7 << 4)
6981319b2f6SOder Chiou #define RT5645_G_IN_L_OM_L_SFT			4
6991319b2f6SOder Chiou #define RT5645_G_RM_L_OM_L_MASK			(0x7 << 1)
7001319b2f6SOder Chiou #define RT5645_G_RM_L_OM_L_SFT			1
7011319b2f6SOder Chiou 
7021319b2f6SOder Chiou /* Output Left Mixer Control 2 (0x4e) */
7031319b2f6SOder Chiou #define RT5645_G_DAC_R2_OM_L_MASK		(0x7 << 13)
7041319b2f6SOder Chiou #define RT5645_G_DAC_R2_OM_L_SFT		13
7051319b2f6SOder Chiou #define RT5645_G_DAC_L2_OM_L_MASK		(0x7 << 10)
7061319b2f6SOder Chiou #define RT5645_G_DAC_L2_OM_L_SFT		10
7071319b2f6SOder Chiou #define RT5645_G_DAC_L1_OM_L_MASK		(0x7 << 7)
7081319b2f6SOder Chiou #define RT5645_G_DAC_L1_OM_L_SFT		7
7091319b2f6SOder Chiou 
7101319b2f6SOder Chiou /* Output Left Mixer Control 3 (0x4f) */
7111319b2f6SOder Chiou #define RT5645_M_BST3_OM_L			(0x1 << 4)
7121319b2f6SOder Chiou #define RT5645_M_BST3_OM_L_SFT			4
7131319b2f6SOder Chiou #define RT5645_M_BST1_OM_L			(0x1 << 3)
7141319b2f6SOder Chiou #define RT5645_M_BST1_OM_L_SFT			3
7151319b2f6SOder Chiou #define RT5645_M_IN_L_OM_L			(0x1 << 2)
7161319b2f6SOder Chiou #define RT5645_M_IN_L_OM_L_SFT			2
7171319b2f6SOder Chiou #define RT5645_M_DAC_L2_OM_L			(0x1 << 1)
7181319b2f6SOder Chiou #define RT5645_M_DAC_L2_OM_L_SFT		1
7191319b2f6SOder Chiou #define RT5645_M_DAC_L1_OM_L			(0x1)
7201319b2f6SOder Chiou #define RT5645_M_DAC_L1_OM_L_SFT		0
7211319b2f6SOder Chiou 
7221319b2f6SOder Chiou /* Output Right Mixer Control 1 (0x50) */
7231319b2f6SOder Chiou #define RT5645_G_BST4_OM_R_MASK			(0x7 << 13)
7241319b2f6SOder Chiou #define RT5645_G_BST4_OM_R_SFT			13
7251319b2f6SOder Chiou #define RT5645_G_BST2_OM_R_MASK			(0x7 << 10)
7261319b2f6SOder Chiou #define RT5645_G_BST2_OM_R_SFT			10
7271319b2f6SOder Chiou #define RT5645_G_BST1_OM_R_MASK			(0x7 << 7)
7281319b2f6SOder Chiou #define RT5645_G_BST1_OM_R_SFT			7
7291319b2f6SOder Chiou #define RT5645_G_IN_R_OM_R_MASK			(0x7 << 4)
7301319b2f6SOder Chiou #define RT5645_G_IN_R_OM_R_SFT			4
7311319b2f6SOder Chiou #define RT5645_G_RM_R_OM_R_MASK			(0x7 << 1)
7321319b2f6SOder Chiou #define RT5645_G_RM_R_OM_R_SFT			1
7331319b2f6SOder Chiou 
7341319b2f6SOder Chiou /* Output Right Mixer Control 2 (0x51) */
7351319b2f6SOder Chiou #define RT5645_G_DAC_L2_OM_R_MASK		(0x7 << 13)
7361319b2f6SOder Chiou #define RT5645_G_DAC_L2_OM_R_SFT		13
7371319b2f6SOder Chiou #define RT5645_G_DAC_R2_OM_R_MASK		(0x7 << 10)
7381319b2f6SOder Chiou #define RT5645_G_DAC_R2_OM_R_SFT		10
7391319b2f6SOder Chiou #define RT5645_G_DAC_R1_OM_R_MASK		(0x7 << 7)
7401319b2f6SOder Chiou #define RT5645_G_DAC_R1_OM_R_SFT		7
7411319b2f6SOder Chiou 
7421319b2f6SOder Chiou /* Output Right Mixer Control 3 (0x52) */
7431319b2f6SOder Chiou #define RT5645_M_BST3_OM_R			(0x1 << 4)
7441319b2f6SOder Chiou #define RT5645_M_BST3_OM_R_SFT			4
7451319b2f6SOder Chiou #define RT5645_M_BST2_OM_R			(0x1 << 3)
7461319b2f6SOder Chiou #define RT5645_M_BST2_OM_R_SFT			3
7471319b2f6SOder Chiou #define RT5645_M_IN_R_OM_R			(0x1 << 2)
7481319b2f6SOder Chiou #define RT5645_M_IN_R_OM_R_SFT			2
7491319b2f6SOder Chiou #define RT5645_M_DAC_R2_OM_R			(0x1 << 1)
7501319b2f6SOder Chiou #define RT5645_M_DAC_R2_OM_R_SFT		1
7511319b2f6SOder Chiou #define RT5645_M_DAC_R1_OM_R			(0x1)
7521319b2f6SOder Chiou #define RT5645_M_DAC_R1_OM_R_SFT		0
7531319b2f6SOder Chiou 
7541319b2f6SOder Chiou /* LOUT Mixer Control (0x53) */
7551319b2f6SOder Chiou #define RT5645_M_DAC_L1_LM			(0x1 << 15)
7561319b2f6SOder Chiou #define RT5645_M_DAC_L1_LM_SFT			15
7571319b2f6SOder Chiou #define RT5645_M_DAC_R1_LM			(0x1 << 14)
7581319b2f6SOder Chiou #define RT5645_M_DAC_R1_LM_SFT			14
7591319b2f6SOder Chiou #define RT5645_M_OV_L_LM			(0x1 << 13)
7601319b2f6SOder Chiou #define RT5645_M_OV_L_LM_SFT			13
7611319b2f6SOder Chiou #define RT5645_M_OV_R_LM			(0x1 << 12)
7621319b2f6SOder Chiou #define RT5645_M_OV_R_LM_SFT			12
7631319b2f6SOder Chiou #define RT5645_G_LOUTMIX_MASK			(0x1 << 11)
7641319b2f6SOder Chiou #define RT5645_G_LOUTMIX_SFT			11
7651319b2f6SOder Chiou 
7661319b2f6SOder Chiou /* Power Management for Digital 1 (0x61) */
7671319b2f6SOder Chiou #define RT5645_PWR_I2S1				(0x1 << 15)
7681319b2f6SOder Chiou #define RT5645_PWR_I2S1_BIT			15
7691319b2f6SOder Chiou #define RT5645_PWR_I2S2				(0x1 << 14)
7701319b2f6SOder Chiou #define RT5645_PWR_I2S2_BIT			14
7711319b2f6SOder Chiou #define RT5645_PWR_I2S3				(0x1 << 13)
7721319b2f6SOder Chiou #define RT5645_PWR_I2S3_BIT			13
7731319b2f6SOder Chiou #define RT5645_PWR_DAC_L1			(0x1 << 12)
7741319b2f6SOder Chiou #define RT5645_PWR_DAC_L1_BIT			12
7751319b2f6SOder Chiou #define RT5645_PWR_DAC_R1			(0x1 << 11)
7761319b2f6SOder Chiou #define RT5645_PWR_DAC_R1_BIT			11
7771319b2f6SOder Chiou #define RT5645_PWR_CLS_D_R			(0x1 << 9)
7781319b2f6SOder Chiou #define RT5645_PWR_CLS_D_R_BIT			9
7791319b2f6SOder Chiou #define RT5645_PWR_CLS_D_L			(0x1 << 8)
7801319b2f6SOder Chiou #define RT5645_PWR_CLS_D_L_BIT			8
7811319b2f6SOder Chiou #define RT5645_PWR_DAC_L2			(0x1 << 7)
7821319b2f6SOder Chiou #define RT5645_PWR_DAC_L2_BIT			7
7831319b2f6SOder Chiou #define RT5645_PWR_DAC_R2			(0x1 << 6)
7841319b2f6SOder Chiou #define RT5645_PWR_DAC_R2_BIT			6
7851319b2f6SOder Chiou #define RT5645_PWR_ADC_L			(0x1 << 2)
7861319b2f6SOder Chiou #define RT5645_PWR_ADC_L_BIT			2
7871319b2f6SOder Chiou #define RT5645_PWR_ADC_R			(0x1 << 1)
7881319b2f6SOder Chiou #define RT5645_PWR_ADC_R_BIT			1
7891319b2f6SOder Chiou #define RT5645_PWR_CLS_D			(0x1)
7901319b2f6SOder Chiou #define RT5645_PWR_CLS_D_BIT			0
7911319b2f6SOder Chiou 
7921319b2f6SOder Chiou /* Power Management for Digital 2 (0x62) */
7931319b2f6SOder Chiou #define RT5645_PWR_ADC_S1F			(0x1 << 15)
7941319b2f6SOder Chiou #define RT5645_PWR_ADC_S1F_BIT			15
7951319b2f6SOder Chiou #define RT5645_PWR_ADC_MF_L			(0x1 << 14)
7961319b2f6SOder Chiou #define RT5645_PWR_ADC_MF_L_BIT			14
7971319b2f6SOder Chiou #define RT5645_PWR_ADC_MF_R			(0x1 << 13)
7981319b2f6SOder Chiou #define RT5645_PWR_ADC_MF_R_BIT			13
7991319b2f6SOder Chiou #define RT5645_PWR_I2S_DSP			(0x1 << 12)
8001319b2f6SOder Chiou #define RT5645_PWR_I2S_DSP_BIT			12
8011319b2f6SOder Chiou #define RT5645_PWR_DAC_S1F			(0x1 << 11)
8021319b2f6SOder Chiou #define RT5645_PWR_DAC_S1F_BIT			11
8031319b2f6SOder Chiou #define RT5645_PWR_DAC_MF_L			(0x1 << 10)
8041319b2f6SOder Chiou #define RT5645_PWR_DAC_MF_L_BIT			10
8051319b2f6SOder Chiou #define RT5645_PWR_DAC_MF_R			(0x1 << 9)
8061319b2f6SOder Chiou #define RT5645_PWR_DAC_MF_R_BIT			9
8071319b2f6SOder Chiou #define RT5645_PWR_PDM1				(0x1 << 7)
8081319b2f6SOder Chiou #define RT5645_PWR_PDM1_BIT			7
8091319b2f6SOder Chiou #define RT5645_PWR_PDM2				(0x1 << 6)
8101319b2f6SOder Chiou #define RT5645_PWR_PDM2_BIT			6
8111319b2f6SOder Chiou #define RT5645_PWR_IPTV				(0x1 << 1)
8121319b2f6SOder Chiou #define RT5645_PWR_IPTV_BIT			1
8131319b2f6SOder Chiou #define RT5645_PWR_PAD				(0x1)
8141319b2f6SOder Chiou #define RT5645_PWR_PAD_BIT			0
8151319b2f6SOder Chiou 
8161319b2f6SOder Chiou /* Power Management for Analog 1 (0x63) */
8171319b2f6SOder Chiou #define RT5645_PWR_VREF1			(0x1 << 15)
8181319b2f6SOder Chiou #define RT5645_PWR_VREF1_BIT			15
8191319b2f6SOder Chiou #define RT5645_PWR_FV1				(0x1 << 14)
8201319b2f6SOder Chiou #define RT5645_PWR_FV1_BIT			14
8211319b2f6SOder Chiou #define RT5645_PWR_MB				(0x1 << 13)
8221319b2f6SOder Chiou #define RT5645_PWR_MB_BIT			13
8231319b2f6SOder Chiou #define RT5645_PWR_LM				(0x1 << 12)
8241319b2f6SOder Chiou #define RT5645_PWR_LM_BIT			12
8251319b2f6SOder Chiou #define RT5645_PWR_BG				(0x1 << 11)
8261319b2f6SOder Chiou #define RT5645_PWR_BG_BIT			11
8271319b2f6SOder Chiou #define RT5645_PWR_MA				(0x1 << 10)
8281319b2f6SOder Chiou #define RT5645_PWR_MA_BIT			10
8291319b2f6SOder Chiou #define RT5645_PWR_HP_L				(0x1 << 7)
8301319b2f6SOder Chiou #define RT5645_PWR_HP_L_BIT			7
8311319b2f6SOder Chiou #define RT5645_PWR_HP_R				(0x1 << 6)
8321319b2f6SOder Chiou #define RT5645_PWR_HP_R_BIT			6
8331319b2f6SOder Chiou #define RT5645_PWR_HA				(0x1 << 5)
8341319b2f6SOder Chiou #define RT5645_PWR_HA_BIT			5
8351319b2f6SOder Chiou #define RT5645_PWR_VREF2			(0x1 << 4)
8361319b2f6SOder Chiou #define RT5645_PWR_VREF2_BIT			4
8371319b2f6SOder Chiou #define RT5645_PWR_FV2				(0x1 << 3)
8381319b2f6SOder Chiou #define RT5645_PWR_FV2_BIT			3
8391319b2f6SOder Chiou #define RT5645_LDO_SEL_MASK			(0x3)
8401319b2f6SOder Chiou #define RT5645_LDO_SEL_SFT			0
8411319b2f6SOder Chiou 
8421319b2f6SOder Chiou /* Power Management for Analog 2 (0x64) */
8431319b2f6SOder Chiou #define RT5645_PWR_BST1				(0x1 << 15)
8441319b2f6SOder Chiou #define RT5645_PWR_BST1_BIT			15
8451319b2f6SOder Chiou #define RT5645_PWR_BST2				(0x1 << 14)
8461319b2f6SOder Chiou #define RT5645_PWR_BST2_BIT			14
8471319b2f6SOder Chiou #define RT5645_PWR_BST3				(0x1 << 13)
8481319b2f6SOder Chiou #define RT5645_PWR_BST3_BIT			13
8491319b2f6SOder Chiou #define RT5645_PWR_BST4				(0x1 << 12)
8501319b2f6SOder Chiou #define RT5645_PWR_BST4_BIT			12
8511319b2f6SOder Chiou #define RT5645_PWR_MB1				(0x1 << 11)
8521319b2f6SOder Chiou #define RT5645_PWR_MB1_BIT			11
8531319b2f6SOder Chiou #define RT5645_PWR_MB2				(0x1 << 10)
8541319b2f6SOder Chiou #define RT5645_PWR_MB2_BIT			10
8551319b2f6SOder Chiou #define RT5645_PWR_PLL				(0x1 << 9)
8561319b2f6SOder Chiou #define RT5645_PWR_PLL_BIT			9
8571319b2f6SOder Chiou #define RT5645_PWR_BST2_P			(0x1 << 5)
8581319b2f6SOder Chiou #define RT5645_PWR_BST2_P_BIT			5
8591319b2f6SOder Chiou #define RT5645_PWR_BST3_P			(0x1 << 4)
8601319b2f6SOder Chiou #define RT5645_PWR_BST3_P_BIT			4
8611319b2f6SOder Chiou #define RT5645_PWR_BST4_P			(0x1 << 3)
8621319b2f6SOder Chiou #define RT5645_PWR_BST4_P_BIT			3
8631319b2f6SOder Chiou #define RT5645_PWR_JD1				(0x1 << 2)
8641319b2f6SOder Chiou #define RT5645_PWR_JD1_BIT			2
8651319b2f6SOder Chiou #define RT5645_PWR_JD				(0x1 << 1)
8661319b2f6SOder Chiou #define RT5645_PWR_JD_BIT			1
8671319b2f6SOder Chiou 
8681319b2f6SOder Chiou /* Power Management for Mixer (0x65) */
8691319b2f6SOder Chiou #define RT5645_PWR_OM_L				(0x1 << 15)
8701319b2f6SOder Chiou #define RT5645_PWR_OM_L_BIT			15
8711319b2f6SOder Chiou #define RT5645_PWR_OM_R				(0x1 << 14)
8721319b2f6SOder Chiou #define RT5645_PWR_OM_R_BIT			14
8731319b2f6SOder Chiou #define RT5645_PWR_SM_L				(0x1 << 13)
8741319b2f6SOder Chiou #define RT5645_PWR_SM_L_BIT			13
8751319b2f6SOder Chiou #define RT5645_PWR_SM_R				(0x1 << 12)
8761319b2f6SOder Chiou #define RT5645_PWR_SM_R_BIT			12
8771319b2f6SOder Chiou #define RT5645_PWR_RM_L				(0x1 << 11)
8781319b2f6SOder Chiou #define RT5645_PWR_RM_L_BIT			11
8791319b2f6SOder Chiou #define RT5645_PWR_RM_R				(0x1 << 10)
8801319b2f6SOder Chiou #define RT5645_PWR_RM_R_BIT			10
8811319b2f6SOder Chiou #define RT5645_PWR_MM				(0x1 << 8)
8821319b2f6SOder Chiou #define RT5645_PWR_MM_BIT			8
8831319b2f6SOder Chiou #define RT5645_PWR_HM_L				(0x1 << 7)
8841319b2f6SOder Chiou #define RT5645_PWR_HM_L_BIT			7
8851319b2f6SOder Chiou #define RT5645_PWR_HM_R				(0x1 << 6)
8861319b2f6SOder Chiou #define RT5645_PWR_HM_R_BIT			6
8871319b2f6SOder Chiou #define RT5645_PWR_LDO2				(0x1 << 1)
8881319b2f6SOder Chiou #define RT5645_PWR_LDO2_BIT			1
8891319b2f6SOder Chiou 
8901319b2f6SOder Chiou /* Power Management for Volume (0x66) */
8911319b2f6SOder Chiou #define RT5645_PWR_SV_L				(0x1 << 15)
8921319b2f6SOder Chiou #define RT5645_PWR_SV_L_BIT			15
8931319b2f6SOder Chiou #define RT5645_PWR_SV_R				(0x1 << 14)
8941319b2f6SOder Chiou #define RT5645_PWR_SV_R_BIT			14
8951319b2f6SOder Chiou #define RT5645_PWR_HV_L				(0x1 << 11)
8961319b2f6SOder Chiou #define RT5645_PWR_HV_L_BIT			11
8971319b2f6SOder Chiou #define RT5645_PWR_HV_R				(0x1 << 10)
8981319b2f6SOder Chiou #define RT5645_PWR_HV_R_BIT			10
8991319b2f6SOder Chiou #define RT5645_PWR_IN_L				(0x1 << 9)
9001319b2f6SOder Chiou #define RT5645_PWR_IN_L_BIT			9
9011319b2f6SOder Chiou #define RT5645_PWR_IN_R				(0x1 << 8)
9021319b2f6SOder Chiou #define RT5645_PWR_IN_R_BIT			8
9031319b2f6SOder Chiou #define RT5645_PWR_MIC_DET			(0x1 << 5)
9041319b2f6SOder Chiou #define RT5645_PWR_MIC_DET_BIT			5
9051319b2f6SOder Chiou 
9061319b2f6SOder Chiou /* I2S1/2 Audio Serial Data Port Control (0x70 0x71) */
9071319b2f6SOder Chiou #define RT5645_I2S_MS_MASK			(0x1 << 15)
9081319b2f6SOder Chiou #define RT5645_I2S_MS_SFT			15
9091319b2f6SOder Chiou #define RT5645_I2S_MS_M				(0x0 << 15)
9101319b2f6SOder Chiou #define RT5645_I2S_MS_S				(0x1 << 15)
9111319b2f6SOder Chiou #define RT5645_I2S_O_CP_MASK			(0x3 << 10)
9121319b2f6SOder Chiou #define RT5645_I2S_O_CP_SFT			10
9131319b2f6SOder Chiou #define RT5645_I2S_O_CP_OFF			(0x0 << 10)
9141319b2f6SOder Chiou #define RT5645_I2S_O_CP_U_LAW			(0x1 << 10)
9151319b2f6SOder Chiou #define RT5645_I2S_O_CP_A_LAW			(0x2 << 10)
9161319b2f6SOder Chiou #define RT5645_I2S_I_CP_MASK			(0x3 << 8)
9171319b2f6SOder Chiou #define RT5645_I2S_I_CP_SFT			8
9181319b2f6SOder Chiou #define RT5645_I2S_I_CP_OFF			(0x0 << 8)
9191319b2f6SOder Chiou #define RT5645_I2S_I_CP_U_LAW			(0x1 << 8)
9201319b2f6SOder Chiou #define RT5645_I2S_I_CP_A_LAW			(0x2 << 8)
9211319b2f6SOder Chiou #define RT5645_I2S_BP_MASK			(0x1 << 7)
9221319b2f6SOder Chiou #define RT5645_I2S_BP_SFT			7
9231319b2f6SOder Chiou #define RT5645_I2S_BP_NOR			(0x0 << 7)
9241319b2f6SOder Chiou #define RT5645_I2S_BP_INV			(0x1 << 7)
9251319b2f6SOder Chiou #define RT5645_I2S_DL_MASK			(0x3 << 2)
9261319b2f6SOder Chiou #define RT5645_I2S_DL_SFT			2
9271319b2f6SOder Chiou #define RT5645_I2S_DL_16			(0x0 << 2)
9281319b2f6SOder Chiou #define RT5645_I2S_DL_20			(0x1 << 2)
9291319b2f6SOder Chiou #define RT5645_I2S_DL_24			(0x2 << 2)
9301319b2f6SOder Chiou #define RT5645_I2S_DL_8				(0x3 << 2)
9311319b2f6SOder Chiou #define RT5645_I2S_DF_MASK			(0x3)
9321319b2f6SOder Chiou #define RT5645_I2S_DF_SFT			0
9331319b2f6SOder Chiou #define RT5645_I2S_DF_I2S			(0x0)
9341319b2f6SOder Chiou #define RT5645_I2S_DF_LEFT			(0x1)
9351319b2f6SOder Chiou #define RT5645_I2S_DF_PCM_A			(0x2)
9361319b2f6SOder Chiou #define RT5645_I2S_DF_PCM_B			(0x3)
9371319b2f6SOder Chiou 
9381319b2f6SOder Chiou /* I2S2 Audio Serial Data Port Control (0x71) */
9391319b2f6SOder Chiou #define RT5645_I2S2_SDI_MASK			(0x1 << 6)
9401319b2f6SOder Chiou #define RT5645_I2S2_SDI_SFT			6
9411319b2f6SOder Chiou #define RT5645_I2S2_SDI_I2S1			(0x0 << 6)
9421319b2f6SOder Chiou #define RT5645_I2S2_SDI_I2S2			(0x1 << 6)
9431319b2f6SOder Chiou 
9441319b2f6SOder Chiou /* ADC/DAC Clock Control 1 (0x73) */
9451319b2f6SOder Chiou #define RT5645_I2S_PD1_MASK			(0x7 << 12)
9461319b2f6SOder Chiou #define RT5645_I2S_PD1_SFT			12
9471319b2f6SOder Chiou #define RT5645_I2S_PD1_1			(0x0 << 12)
9481319b2f6SOder Chiou #define RT5645_I2S_PD1_2			(0x1 << 12)
9491319b2f6SOder Chiou #define RT5645_I2S_PD1_3			(0x2 << 12)
9501319b2f6SOder Chiou #define RT5645_I2S_PD1_4			(0x3 << 12)
9511319b2f6SOder Chiou #define RT5645_I2S_PD1_6			(0x4 << 12)
9521319b2f6SOder Chiou #define RT5645_I2S_PD1_8			(0x5 << 12)
9531319b2f6SOder Chiou #define RT5645_I2S_PD1_12			(0x6 << 12)
9541319b2f6SOder Chiou #define RT5645_I2S_PD1_16			(0x7 << 12)
9551319b2f6SOder Chiou #define RT5645_I2S_BCLK_MS2_MASK		(0x1 << 11)
9561319b2f6SOder Chiou #define RT5645_I2S_BCLK_MS2_SFT			11
9571319b2f6SOder Chiou #define RT5645_I2S_BCLK_MS2_32			(0x0 << 11)
9581319b2f6SOder Chiou #define RT5645_I2S_BCLK_MS2_64			(0x1 << 11)
9591319b2f6SOder Chiou #define RT5645_I2S_PD2_MASK			(0x7 << 8)
9601319b2f6SOder Chiou #define RT5645_I2S_PD2_SFT			8
9611319b2f6SOder Chiou #define RT5645_I2S_PD2_1			(0x0 << 8)
9621319b2f6SOder Chiou #define RT5645_I2S_PD2_2			(0x1 << 8)
9631319b2f6SOder Chiou #define RT5645_I2S_PD2_3			(0x2 << 8)
9641319b2f6SOder Chiou #define RT5645_I2S_PD2_4			(0x3 << 8)
9651319b2f6SOder Chiou #define RT5645_I2S_PD2_6			(0x4 << 8)
9661319b2f6SOder Chiou #define RT5645_I2S_PD2_8			(0x5 << 8)
9671319b2f6SOder Chiou #define RT5645_I2S_PD2_12			(0x6 << 8)
9681319b2f6SOder Chiou #define RT5645_I2S_PD2_16			(0x7 << 8)
9691319b2f6SOder Chiou #define RT5645_I2S_BCLK_MS3_MASK		(0x1 << 7)
9701319b2f6SOder Chiou #define RT5645_I2S_BCLK_MS3_SFT			7
9711319b2f6SOder Chiou #define RT5645_I2S_BCLK_MS3_32			(0x0 << 7)
9721319b2f6SOder Chiou #define RT5645_I2S_BCLK_MS3_64			(0x1 << 7)
9731319b2f6SOder Chiou #define RT5645_I2S_PD3_MASK			(0x7 << 4)
9741319b2f6SOder Chiou #define RT5645_I2S_PD3_SFT			4
9751319b2f6SOder Chiou #define RT5645_I2S_PD3_1			(0x0 << 4)
9761319b2f6SOder Chiou #define RT5645_I2S_PD3_2			(0x1 << 4)
9771319b2f6SOder Chiou #define RT5645_I2S_PD3_3			(0x2 << 4)
9781319b2f6SOder Chiou #define RT5645_I2S_PD3_4			(0x3 << 4)
9791319b2f6SOder Chiou #define RT5645_I2S_PD3_6			(0x4 << 4)
9801319b2f6SOder Chiou #define RT5645_I2S_PD3_8			(0x5 << 4)
9811319b2f6SOder Chiou #define RT5645_I2S_PD3_12			(0x6 << 4)
9821319b2f6SOder Chiou #define RT5645_I2S_PD3_16			(0x7 << 4)
9831319b2f6SOder Chiou #define RT5645_DAC_OSR_MASK			(0x3 << 2)
9841319b2f6SOder Chiou #define RT5645_DAC_OSR_SFT			2
9851319b2f6SOder Chiou #define RT5645_DAC_OSR_128			(0x0 << 2)
9861319b2f6SOder Chiou #define RT5645_DAC_OSR_64			(0x1 << 2)
9871319b2f6SOder Chiou #define RT5645_DAC_OSR_32			(0x2 << 2)
9881319b2f6SOder Chiou #define RT5645_DAC_OSR_16			(0x3 << 2)
9891319b2f6SOder Chiou #define RT5645_ADC_OSR_MASK			(0x3)
9901319b2f6SOder Chiou #define RT5645_ADC_OSR_SFT			0
9911319b2f6SOder Chiou #define RT5645_ADC_OSR_128			(0x0)
9921319b2f6SOder Chiou #define RT5645_ADC_OSR_64			(0x1)
9931319b2f6SOder Chiou #define RT5645_ADC_OSR_32			(0x2)
9941319b2f6SOder Chiou #define RT5645_ADC_OSR_16			(0x3)
9951319b2f6SOder Chiou 
9961319b2f6SOder Chiou /* ADC/DAC Clock Control 2 (0x74) */
9971319b2f6SOder Chiou #define RT5645_DAC_L_OSR_MASK			(0x3 << 14)
9981319b2f6SOder Chiou #define RT5645_DAC_L_OSR_SFT			14
9991319b2f6SOder Chiou #define RT5645_DAC_L_OSR_128			(0x0 << 14)
10001319b2f6SOder Chiou #define RT5645_DAC_L_OSR_64			(0x1 << 14)
10011319b2f6SOder Chiou #define RT5645_DAC_L_OSR_32			(0x2 << 14)
10021319b2f6SOder Chiou #define RT5645_DAC_L_OSR_16			(0x3 << 14)
10031319b2f6SOder Chiou #define RT5645_ADC_R_OSR_MASK			(0x3 << 12)
10041319b2f6SOder Chiou #define RT5645_ADC_R_OSR_SFT			12
10051319b2f6SOder Chiou #define RT5645_ADC_R_OSR_128			(0x0 << 12)
10061319b2f6SOder Chiou #define RT5645_ADC_R_OSR_64			(0x1 << 12)
10071319b2f6SOder Chiou #define RT5645_ADC_R_OSR_32			(0x2 << 12)
10081319b2f6SOder Chiou #define RT5645_ADC_R_OSR_16			(0x3 << 12)
10091319b2f6SOder Chiou #define RT5645_DAHPF_EN				(0x1 << 11)
10101319b2f6SOder Chiou #define RT5645_DAHPF_EN_SFT			11
10111319b2f6SOder Chiou #define RT5645_ADHPF_EN				(0x1 << 10)
10121319b2f6SOder Chiou #define RT5645_ADHPF_EN_SFT			10
10131319b2f6SOder Chiou 
10141319b2f6SOder Chiou /* Digital Microphone Control (0x75) */
10151319b2f6SOder Chiou #define RT5645_DMIC_1_EN_MASK			(0x1 << 15)
10161319b2f6SOder Chiou #define RT5645_DMIC_1_EN_SFT			15
10171319b2f6SOder Chiou #define RT5645_DMIC_1_DIS			(0x0 << 15)
10181319b2f6SOder Chiou #define RT5645_DMIC_1_EN			(0x1 << 15)
10191319b2f6SOder Chiou #define RT5645_DMIC_2_EN_MASK			(0x1 << 14)
10201319b2f6SOder Chiou #define RT5645_DMIC_2_EN_SFT			14
10211319b2f6SOder Chiou #define RT5645_DMIC_2_DIS			(0x0 << 14)
10221319b2f6SOder Chiou #define RT5645_DMIC_2_EN			(0x1 << 14)
10231319b2f6SOder Chiou #define RT5645_DMIC_1L_LH_MASK			(0x1 << 13)
10241319b2f6SOder Chiou #define RT5645_DMIC_1L_LH_SFT			13
10251319b2f6SOder Chiou #define RT5645_DMIC_1L_LH_FALLING		(0x0 << 13)
10261319b2f6SOder Chiou #define RT5645_DMIC_1L_LH_RISING		(0x1 << 13)
10271319b2f6SOder Chiou #define RT5645_DMIC_1R_LH_MASK			(0x1 << 12)
10281319b2f6SOder Chiou #define RT5645_DMIC_1R_LH_SFT			12
10291319b2f6SOder Chiou #define RT5645_DMIC_1R_LH_FALLING		(0x0 << 12)
10301319b2f6SOder Chiou #define RT5645_DMIC_1R_LH_RISING		(0x1 << 12)
10311319b2f6SOder Chiou #define RT5645_DMIC_2_DP_MASK			(0x3 << 10)
10321319b2f6SOder Chiou #define RT5645_DMIC_2_DP_SFT			10
10331319b2f6SOder Chiou #define RT5645_DMIC_2_DP_GPIO6			(0x0 << 10)
10341319b2f6SOder Chiou #define RT5645_DMIC_2_DP_GPIO10			(0x1 << 10)
10351319b2f6SOder Chiou #define RT5645_DMIC_2_DP_GPIO12			(0x2 << 10)
10361319b2f6SOder Chiou #define RT5645_DMIC_2_DP_IN2P			(0x3 << 10)
10371319b2f6SOder Chiou #define RT5645_DMIC_2L_LH_MASK			(0x1 << 9)
10381319b2f6SOder Chiou #define RT5645_DMIC_2L_LH_SFT			9
10391319b2f6SOder Chiou #define RT5645_DMIC_2L_LH_FALLING		(0x0 << 9)
10401319b2f6SOder Chiou #define RT5645_DMIC_2L_LH_RISING		(0x1 << 9)
10411319b2f6SOder Chiou #define RT5645_DMIC_2R_LH_MASK			(0x1 << 8)
10421319b2f6SOder Chiou #define RT5645_DMIC_2R_LH_SFT			8
10431319b2f6SOder Chiou #define RT5645_DMIC_2R_LH_FALLING		(0x0 << 8)
10441319b2f6SOder Chiou #define RT5645_DMIC_2R_LH_RISING		(0x1 << 8)
10451319b2f6SOder Chiou #define RT5645_DMIC_CLK_MASK			(0x7 << 5)
10461319b2f6SOder Chiou #define RT5645_DMIC_CLK_SFT			5
10471319b2f6SOder Chiou #define RT5645_DMIC_3_EN_MASK			(0x1 << 4)
10481319b2f6SOder Chiou #define RT5645_DMIC_3_EN_SFT			4
10491319b2f6SOder Chiou #define RT5645_DMIC_3_DIS			(0x0 << 4)
10501319b2f6SOder Chiou #define RT5645_DMIC_3_EN			(0x1 << 4)
10511319b2f6SOder Chiou #define RT5645_DMIC_1_DP_MASK			(0x3 << 0)
10521319b2f6SOder Chiou #define RT5645_DMIC_1_DP_SFT			0
10531319b2f6SOder Chiou #define RT5645_DMIC_1_DP_GPIO5			(0x0 << 0)
10541319b2f6SOder Chiou #define RT5645_DMIC_1_DP_IN2N			(0x1 << 0)
10551319b2f6SOder Chiou #define RT5645_DMIC_1_DP_GPIO11			(0x2 << 0)
10561319b2f6SOder Chiou 
10571319b2f6SOder Chiou /* TDM Control 1 (0x77) */
10581319b2f6SOder Chiou #define RT5645_IF1_ADC_IN_MASK			(0x3 << 8)
10591319b2f6SOder Chiou #define RT5645_IF1_ADC_IN_SFT			8
10601319b2f6SOder Chiou 
10611319b2f6SOder Chiou /* Global Clock Control (0x80) */
10621319b2f6SOder Chiou #define RT5645_SCLK_SRC_MASK			(0x3 << 14)
10631319b2f6SOder Chiou #define RT5645_SCLK_SRC_SFT			14
10641319b2f6SOder Chiou #define RT5645_SCLK_SRC_MCLK			(0x0 << 14)
10651319b2f6SOder Chiou #define RT5645_SCLK_SRC_PLL1			(0x1 << 14)
1066de97c15bSBard Liao #define RT5645_SCLK_SRC_RCCLK			(0x2 << 14)
1067de97c15bSBard Liao #define RT5645_PLL1_SRC_MASK			(0x7 << 11)
1068de97c15bSBard Liao #define RT5645_PLL1_SRC_SFT			11
1069de97c15bSBard Liao #define RT5645_PLL1_SRC_MCLK			(0x0 << 11)
1070de97c15bSBard Liao #define RT5645_PLL1_SRC_BCLK1			(0x1 << 11)
1071de97c15bSBard Liao #define RT5645_PLL1_SRC_BCLK2			(0x2 << 11)
1072de97c15bSBard Liao #define RT5645_PLL1_SRC_BCLK3			(0x3 << 11)
1073de97c15bSBard Liao #define RT5645_PLL1_SRC_RCCLK			(0x4 << 11)
10741319b2f6SOder Chiou #define RT5645_PLL1_PD_MASK			(0x1 << 3)
10751319b2f6SOder Chiou #define RT5645_PLL1_PD_SFT			3
10761319b2f6SOder Chiou #define RT5645_PLL1_PD_1			(0x0 << 3)
10771319b2f6SOder Chiou #define RT5645_PLL1_PD_2			(0x1 << 3)
10781319b2f6SOder Chiou 
10791319b2f6SOder Chiou #define RT5645_PLL_INP_MAX			40000000
10801319b2f6SOder Chiou #define RT5645_PLL_INP_MIN			256000
10811319b2f6SOder Chiou /* PLL M/N/K Code Control 1 (0x81) */
10821319b2f6SOder Chiou #define RT5645_PLL_N_MAX			0x1ff
10831319b2f6SOder Chiou #define RT5645_PLL_N_MASK			(RT5645_PLL_N_MAX << 7)
10841319b2f6SOder Chiou #define RT5645_PLL_N_SFT			7
10851319b2f6SOder Chiou #define RT5645_PLL_K_MAX			0x1f
10861319b2f6SOder Chiou #define RT5645_PLL_K_MASK			(RT5645_PLL_K_MAX)
10871319b2f6SOder Chiou #define RT5645_PLL_K_SFT			0
10881319b2f6SOder Chiou 
10891319b2f6SOder Chiou /* PLL M/N/K Code Control 2 (0x82) */
10901319b2f6SOder Chiou #define RT5645_PLL_M_MAX			0xf
10911319b2f6SOder Chiou #define RT5645_PLL_M_MASK			(RT5645_PLL_M_MAX << 12)
10921319b2f6SOder Chiou #define RT5645_PLL_M_SFT			12
10931319b2f6SOder Chiou #define RT5645_PLL_M_BP				(0x1 << 11)
10941319b2f6SOder Chiou #define RT5645_PLL_M_BP_SFT			11
10951319b2f6SOder Chiou 
10961319b2f6SOder Chiou /* ASRC Control 1 (0x83) */
10971319b2f6SOder Chiou #define RT5645_STO_T_MASK			(0x1 << 15)
10981319b2f6SOder Chiou #define RT5645_STO_T_SFT			15
10991319b2f6SOder Chiou #define RT5645_STO_T_SCLK			(0x0 << 15)
11001319b2f6SOder Chiou #define RT5645_STO_T_LRCK1			(0x1 << 15)
11011319b2f6SOder Chiou #define RT5645_M1_T_MASK			(0x1 << 14)
11021319b2f6SOder Chiou #define RT5645_M1_T_SFT				14
11031319b2f6SOder Chiou #define RT5645_M1_T_I2S2			(0x0 << 14)
11041319b2f6SOder Chiou #define RT5645_M1_T_I2S2_D3			(0x1 << 14)
11051319b2f6SOder Chiou #define RT5645_I2S2_F_MASK			(0x1 << 12)
11061319b2f6SOder Chiou #define RT5645_I2S2_F_SFT			12
11071319b2f6SOder Chiou #define RT5645_I2S2_F_I2S2_D2			(0x0 << 12)
11081319b2f6SOder Chiou #define RT5645_I2S2_F_I2S1_TCLK			(0x1 << 12)
11091319b2f6SOder Chiou #define RT5645_DMIC_1_M_MASK			(0x1 << 9)
11101319b2f6SOder Chiou #define RT5645_DMIC_1_M_SFT			9
11111319b2f6SOder Chiou #define RT5645_DMIC_1_M_NOR			(0x0 << 9)
11121319b2f6SOder Chiou #define RT5645_DMIC_1_M_ASYN			(0x1 << 9)
11131319b2f6SOder Chiou #define RT5645_DMIC_2_M_MASK			(0x1 << 8)
11141319b2f6SOder Chiou #define RT5645_DMIC_2_M_SFT			8
11151319b2f6SOder Chiou #define RT5645_DMIC_2_M_NOR			(0x0 << 8)
11161319b2f6SOder Chiou #define RT5645_DMIC_2_M_ASYN			(0x1 << 8)
11171319b2f6SOder Chiou 
111879080a8bSFang, Yang A /* ASRC clock source selection (0x84, 0x85) */
111979080a8bSFang, Yang A #define RT5645_CLK_SEL_SYS			(0x0)
112079080a8bSFang, Yang A #define RT5645_CLK_SEL_I2S1_ASRC		(0x1)
112179080a8bSFang, Yang A #define RT5645_CLK_SEL_I2S2_ASRC		(0x2)
112279080a8bSFang, Yang A #define RT5645_CLK_SEL_SYS2			(0x5)
112379080a8bSFang, Yang A 
11241319b2f6SOder Chiou /* ASRC Control 2 (0x84) */
112579080a8bSFang, Yang A #define RT5645_DA_STO_CLK_SEL_MASK		(0xf << 12)
112679080a8bSFang, Yang A #define RT5645_DA_STO_CLK_SEL_SFT		12
112779080a8bSFang, Yang A #define RT5645_DA_MONOL_CLK_SEL_MASK		(0xf << 8)
112879080a8bSFang, Yang A #define RT5645_DA_MONOL_CLK_SEL_SFT		8
112979080a8bSFang, Yang A #define RT5645_DA_MONOR_CLK_SEL_MASK		(0xf << 4)
113079080a8bSFang, Yang A #define RT5645_DA_MONOR_CLK_SEL_SFT		4
113179080a8bSFang, Yang A #define RT5645_AD_STO1_CLK_SEL_MASK		(0xf << 0)
113279080a8bSFang, Yang A #define RT5645_AD_STO1_CLK_SEL_SFT		0
11331319b2f6SOder Chiou 
11341319b2f6SOder Chiou /* ASRC Control 3 (0x85) */
113579080a8bSFang, Yang A #define RT5645_AD_MONOL_CLK_SEL_MASK		(0xf << 4)
113679080a8bSFang, Yang A #define RT5645_AD_MONOL_CLK_SEL_SFT		4
113779080a8bSFang, Yang A #define RT5645_AD_MONOR_CLK_SEL_MASK		(0xf << 0)
113879080a8bSFang, Yang A #define RT5645_AD_MONOR_CLK_SEL_SFT		0
11391319b2f6SOder Chiou 
11401319b2f6SOder Chiou /* ASRC Control 4 (0x89) */
11411319b2f6SOder Chiou #define RT5645_I2S1_PD_MASK			(0x7 << 12)
11421319b2f6SOder Chiou #define RT5645_I2S1_PD_SFT			12
11431319b2f6SOder Chiou #define RT5645_I2S2_PD_MASK			(0x7 << 8)
11441319b2f6SOder Chiou #define RT5645_I2S2_PD_SFT			8
11451319b2f6SOder Chiou 
11461319b2f6SOder Chiou /* HPOUT Over Current Detection (0x8b) */
11471319b2f6SOder Chiou #define RT5645_HP_OVCD_MASK			(0x1 << 10)
11481319b2f6SOder Chiou #define RT5645_HP_OVCD_SFT			10
11491319b2f6SOder Chiou #define RT5645_HP_OVCD_DIS			(0x0 << 10)
11501319b2f6SOder Chiou #define RT5645_HP_OVCD_EN			(0x1 << 10)
11511319b2f6SOder Chiou #define RT5645_HP_OC_TH_MASK			(0x3 << 8)
11521319b2f6SOder Chiou #define RT5645_HP_OC_TH_SFT			8
11531319b2f6SOder Chiou #define RT5645_HP_OC_TH_90			(0x0 << 8)
11541319b2f6SOder Chiou #define RT5645_HP_OC_TH_105			(0x1 << 8)
11551319b2f6SOder Chiou #define RT5645_HP_OC_TH_120			(0x2 << 8)
11561319b2f6SOder Chiou #define RT5645_HP_OC_TH_135			(0x3 << 8)
11571319b2f6SOder Chiou 
11581319b2f6SOder Chiou /* Class D Over Current Control (0x8c) */
11591319b2f6SOder Chiou #define RT5645_CLSD_OC_MASK			(0x1 << 9)
11601319b2f6SOder Chiou #define RT5645_CLSD_OC_SFT			9
11611319b2f6SOder Chiou #define RT5645_CLSD_OC_PU			(0x0 << 9)
11621319b2f6SOder Chiou #define RT5645_CLSD_OC_PD			(0x1 << 9)
11631319b2f6SOder Chiou #define RT5645_AUTO_PD_MASK			(0x1 << 8)
11641319b2f6SOder Chiou #define RT5645_AUTO_PD_SFT			8
11651319b2f6SOder Chiou #define RT5645_AUTO_PD_DIS			(0x0 << 8)
11661319b2f6SOder Chiou #define RT5645_AUTO_PD_EN			(0x1 << 8)
11671319b2f6SOder Chiou #define RT5645_CLSD_OC_TH_MASK			(0x3f)
11681319b2f6SOder Chiou #define RT5645_CLSD_OC_TH_SFT			0
11691319b2f6SOder Chiou 
11701319b2f6SOder Chiou /* Class D Output Control (0x8d) */
11711319b2f6SOder Chiou #define RT5645_CLSD_RATIO_MASK			(0xf << 12)
11721319b2f6SOder Chiou #define RT5645_CLSD_RATIO_SFT			12
11731319b2f6SOder Chiou #define RT5645_CLSD_OM_MASK			(0x1 << 11)
11741319b2f6SOder Chiou #define RT5645_CLSD_OM_SFT			11
11751319b2f6SOder Chiou #define RT5645_CLSD_OM_MONO			(0x0 << 11)
11761319b2f6SOder Chiou #define RT5645_CLSD_OM_STO			(0x1 << 11)
11771319b2f6SOder Chiou #define RT5645_CLSD_SCH_MASK			(0x1 << 10)
11781319b2f6SOder Chiou #define RT5645_CLSD_SCH_SFT			10
11791319b2f6SOder Chiou #define RT5645_CLSD_SCH_L			(0x0 << 10)
11801319b2f6SOder Chiou #define RT5645_CLSD_SCH_S			(0x1 << 10)
11811319b2f6SOder Chiou 
11821319b2f6SOder Chiou /* Depop Mode Control 1 (0x8e) */
11831319b2f6SOder Chiou #define RT5645_SMT_TRIG_MASK			(0x1 << 15)
11841319b2f6SOder Chiou #define RT5645_SMT_TRIG_SFT			15
11851319b2f6SOder Chiou #define RT5645_SMT_TRIG_DIS			(0x0 << 15)
11861319b2f6SOder Chiou #define RT5645_SMT_TRIG_EN			(0x1 << 15)
11871319b2f6SOder Chiou #define RT5645_HP_L_SMT_MASK			(0x1 << 9)
11881319b2f6SOder Chiou #define RT5645_HP_L_SMT_SFT			9
11891319b2f6SOder Chiou #define RT5645_HP_L_SMT_DIS			(0x0 << 9)
11901319b2f6SOder Chiou #define RT5645_HP_L_SMT_EN			(0x1 << 9)
11911319b2f6SOder Chiou #define RT5645_HP_R_SMT_MASK			(0x1 << 8)
11921319b2f6SOder Chiou #define RT5645_HP_R_SMT_SFT			8
11931319b2f6SOder Chiou #define RT5645_HP_R_SMT_DIS			(0x0 << 8)
11941319b2f6SOder Chiou #define RT5645_HP_R_SMT_EN			(0x1 << 8)
11951319b2f6SOder Chiou #define RT5645_HP_CD_PD_MASK			(0x1 << 7)
11961319b2f6SOder Chiou #define RT5645_HP_CD_PD_SFT			7
11971319b2f6SOder Chiou #define RT5645_HP_CD_PD_DIS			(0x0 << 7)
11981319b2f6SOder Chiou #define RT5645_HP_CD_PD_EN			(0x1 << 7)
11991319b2f6SOder Chiou #define RT5645_RSTN_MASK			(0x1 << 6)
12001319b2f6SOder Chiou #define RT5645_RSTN_SFT				6
12011319b2f6SOder Chiou #define RT5645_RSTN_DIS				(0x0 << 6)
12021319b2f6SOder Chiou #define RT5645_RSTN_EN				(0x1 << 6)
12031319b2f6SOder Chiou #define RT5645_RSTP_MASK			(0x1 << 5)
12041319b2f6SOder Chiou #define RT5645_RSTP_SFT				5
12051319b2f6SOder Chiou #define RT5645_RSTP_DIS				(0x0 << 5)
12061319b2f6SOder Chiou #define RT5645_RSTP_EN				(0x1 << 5)
12071319b2f6SOder Chiou #define RT5645_HP_CO_MASK			(0x1 << 4)
12081319b2f6SOder Chiou #define RT5645_HP_CO_SFT			4
12091319b2f6SOder Chiou #define RT5645_HP_CO_DIS			(0x0 << 4)
12101319b2f6SOder Chiou #define RT5645_HP_CO_EN				(0x1 << 4)
12111319b2f6SOder Chiou #define RT5645_HP_CP_MASK			(0x1 << 3)
12121319b2f6SOder Chiou #define RT5645_HP_CP_SFT			3
12131319b2f6SOder Chiou #define RT5645_HP_CP_PD				(0x0 << 3)
12141319b2f6SOder Chiou #define RT5645_HP_CP_PU				(0x1 << 3)
12151319b2f6SOder Chiou #define RT5645_HP_SG_MASK			(0x1 << 2)
12161319b2f6SOder Chiou #define RT5645_HP_SG_SFT			2
12171319b2f6SOder Chiou #define RT5645_HP_SG_DIS			(0x0 << 2)
12181319b2f6SOder Chiou #define RT5645_HP_SG_EN				(0x1 << 2)
12191319b2f6SOder Chiou #define RT5645_HP_DP_MASK			(0x1 << 1)
12201319b2f6SOder Chiou #define RT5645_HP_DP_SFT			1
12211319b2f6SOder Chiou #define RT5645_HP_DP_PD				(0x0 << 1)
12221319b2f6SOder Chiou #define RT5645_HP_DP_PU				(0x1 << 1)
12231319b2f6SOder Chiou #define RT5645_HP_CB_MASK			(0x1)
12241319b2f6SOder Chiou #define RT5645_HP_CB_SFT			0
12251319b2f6SOder Chiou #define RT5645_HP_CB_PD				(0x0)
12261319b2f6SOder Chiou #define RT5645_HP_CB_PU				(0x1)
12271319b2f6SOder Chiou 
12281319b2f6SOder Chiou /* Depop Mode Control 2 (0x8f) */
12291319b2f6SOder Chiou #define RT5645_DEPOP_MASK			(0x1 << 13)
12301319b2f6SOder Chiou #define RT5645_DEPOP_SFT			13
12311319b2f6SOder Chiou #define RT5645_DEPOP_AUTO			(0x0 << 13)
12321319b2f6SOder Chiou #define RT5645_DEPOP_MAN			(0x1 << 13)
12331319b2f6SOder Chiou #define RT5645_RAMP_MASK			(0x1 << 12)
12341319b2f6SOder Chiou #define RT5645_RAMP_SFT				12
12351319b2f6SOder Chiou #define RT5645_RAMP_DIS				(0x0 << 12)
12361319b2f6SOder Chiou #define RT5645_RAMP_EN				(0x1 << 12)
12371319b2f6SOder Chiou #define RT5645_BPS_MASK				(0x1 << 11)
12381319b2f6SOder Chiou #define RT5645_BPS_SFT				11
12391319b2f6SOder Chiou #define RT5645_BPS_DIS				(0x0 << 11)
12401319b2f6SOder Chiou #define RT5645_BPS_EN				(0x1 << 11)
12411319b2f6SOder Chiou #define RT5645_FAST_UPDN_MASK			(0x1 << 10)
12421319b2f6SOder Chiou #define RT5645_FAST_UPDN_SFT			10
12431319b2f6SOder Chiou #define RT5645_FAST_UPDN_DIS			(0x0 << 10)
12441319b2f6SOder Chiou #define RT5645_FAST_UPDN_EN			(0x1 << 10)
12451319b2f6SOder Chiou #define RT5645_MRES_MASK			(0x3 << 8)
12461319b2f6SOder Chiou #define RT5645_MRES_SFT				8
12471319b2f6SOder Chiou #define RT5645_MRES_15MO			(0x0 << 8)
12481319b2f6SOder Chiou #define RT5645_MRES_25MO			(0x1 << 8)
12491319b2f6SOder Chiou #define RT5645_MRES_35MO			(0x2 << 8)
12501319b2f6SOder Chiou #define RT5645_MRES_45MO			(0x3 << 8)
12511319b2f6SOder Chiou #define RT5645_VLO_MASK				(0x1 << 7)
12521319b2f6SOder Chiou #define RT5645_VLO_SFT				7
12531319b2f6SOder Chiou #define RT5645_VLO_3V				(0x0 << 7)
12541319b2f6SOder Chiou #define RT5645_VLO_32V				(0x1 << 7)
12551319b2f6SOder Chiou #define RT5645_DIG_DP_MASK			(0x1 << 6)
12561319b2f6SOder Chiou #define RT5645_DIG_DP_SFT			6
12571319b2f6SOder Chiou #define RT5645_DIG_DP_DIS			(0x0 << 6)
12581319b2f6SOder Chiou #define RT5645_DIG_DP_EN			(0x1 << 6)
12591319b2f6SOder Chiou #define RT5645_DP_TH_MASK			(0x3 << 4)
12601319b2f6SOder Chiou #define RT5645_DP_TH_SFT			4
12611319b2f6SOder Chiou 
12621319b2f6SOder Chiou /* Depop Mode Control 3 (0x90) */
12631319b2f6SOder Chiou #define RT5645_CP_SYS_MASK			(0x7 << 12)
12641319b2f6SOder Chiou #define RT5645_CP_SYS_SFT			12
12651319b2f6SOder Chiou #define RT5645_CP_FQ1_MASK			(0x7 << 8)
12661319b2f6SOder Chiou #define RT5645_CP_FQ1_SFT			8
12671319b2f6SOder Chiou #define RT5645_CP_FQ2_MASK			(0x7 << 4)
12681319b2f6SOder Chiou #define RT5645_CP_FQ2_SFT			4
12691319b2f6SOder Chiou #define RT5645_CP_FQ3_MASK			(0x7)
12701319b2f6SOder Chiou #define RT5645_CP_FQ3_SFT			0
12711319b2f6SOder Chiou #define RT5645_CP_FQ_1_5_KHZ			0
12721319b2f6SOder Chiou #define RT5645_CP_FQ_3_KHZ			1
12731319b2f6SOder Chiou #define RT5645_CP_FQ_6_KHZ			2
12741319b2f6SOder Chiou #define RT5645_CP_FQ_12_KHZ			3
12751319b2f6SOder Chiou #define RT5645_CP_FQ_24_KHZ			4
12761319b2f6SOder Chiou #define RT5645_CP_FQ_48_KHZ			5
12771319b2f6SOder Chiou #define RT5645_CP_FQ_96_KHZ			6
12781319b2f6SOder Chiou #define RT5645_CP_FQ_192_KHZ			7
12791319b2f6SOder Chiou 
12801319b2f6SOder Chiou /* PV detection and SPK gain control (0x92) */
12811319b2f6SOder Chiou #define RT5645_PVDD_DET_MASK			(0x1 << 15)
12821319b2f6SOder Chiou #define RT5645_PVDD_DET_SFT			15
12831319b2f6SOder Chiou #define RT5645_PVDD_DET_DIS			(0x0 << 15)
12841319b2f6SOder Chiou #define RT5645_PVDD_DET_EN			(0x1 << 15)
12851319b2f6SOder Chiou #define RT5645_SPK_AG_MASK			(0x1 << 14)
12861319b2f6SOder Chiou #define RT5645_SPK_AG_SFT			14
12871319b2f6SOder Chiou #define RT5645_SPK_AG_DIS			(0x0 << 14)
12881319b2f6SOder Chiou #define RT5645_SPK_AG_EN			(0x1 << 14)
12891319b2f6SOder Chiou 
12901319b2f6SOder Chiou /* Micbias Control (0x93) */
12911319b2f6SOder Chiou #define RT5645_MIC1_BS_MASK			(0x1 << 15)
12921319b2f6SOder Chiou #define RT5645_MIC1_BS_SFT			15
12931319b2f6SOder Chiou #define RT5645_MIC1_BS_9AV			(0x0 << 15)
12941319b2f6SOder Chiou #define RT5645_MIC1_BS_75AV			(0x1 << 15)
12951319b2f6SOder Chiou #define RT5645_MIC2_BS_MASK			(0x1 << 14)
12961319b2f6SOder Chiou #define RT5645_MIC2_BS_SFT			14
12971319b2f6SOder Chiou #define RT5645_MIC2_BS_9AV			(0x0 << 14)
12981319b2f6SOder Chiou #define RT5645_MIC2_BS_75AV			(0x1 << 14)
12991319b2f6SOder Chiou #define RT5645_MIC1_CLK_MASK			(0x1 << 13)
13001319b2f6SOder Chiou #define RT5645_MIC1_CLK_SFT			13
13011319b2f6SOder Chiou #define RT5645_MIC1_CLK_DIS			(0x0 << 13)
13021319b2f6SOder Chiou #define RT5645_MIC1_CLK_EN			(0x1 << 13)
13031319b2f6SOder Chiou #define RT5645_MIC2_CLK_MASK			(0x1 << 12)
13041319b2f6SOder Chiou #define RT5645_MIC2_CLK_SFT			12
13051319b2f6SOder Chiou #define RT5645_MIC2_CLK_DIS			(0x0 << 12)
13061319b2f6SOder Chiou #define RT5645_MIC2_CLK_EN			(0x1 << 12)
13071319b2f6SOder Chiou #define RT5645_MIC1_OVCD_MASK			(0x1 << 11)
13081319b2f6SOder Chiou #define RT5645_MIC1_OVCD_SFT			11
13091319b2f6SOder Chiou #define RT5645_MIC1_OVCD_DIS			(0x0 << 11)
13101319b2f6SOder Chiou #define RT5645_MIC1_OVCD_EN			(0x1 << 11)
13111319b2f6SOder Chiou #define RT5645_MIC1_OVTH_MASK			(0x3 << 9)
13121319b2f6SOder Chiou #define RT5645_MIC1_OVTH_SFT			9
13131319b2f6SOder Chiou #define RT5645_MIC1_OVTH_600UA			(0x0 << 9)
13141319b2f6SOder Chiou #define RT5645_MIC1_OVTH_1500UA			(0x1 << 9)
13151319b2f6SOder Chiou #define RT5645_MIC1_OVTH_2000UA			(0x2 << 9)
13161319b2f6SOder Chiou #define RT5645_MIC2_OVCD_MASK			(0x1 << 8)
13171319b2f6SOder Chiou #define RT5645_MIC2_OVCD_SFT			8
13181319b2f6SOder Chiou #define RT5645_MIC2_OVCD_DIS			(0x0 << 8)
13191319b2f6SOder Chiou #define RT5645_MIC2_OVCD_EN			(0x1 << 8)
13201319b2f6SOder Chiou #define RT5645_MIC2_OVTH_MASK			(0x3 << 6)
13211319b2f6SOder Chiou #define RT5645_MIC2_OVTH_SFT			6
13221319b2f6SOder Chiou #define RT5645_MIC2_OVTH_600UA			(0x0 << 6)
13231319b2f6SOder Chiou #define RT5645_MIC2_OVTH_1500UA			(0x1 << 6)
13241319b2f6SOder Chiou #define RT5645_MIC2_OVTH_2000UA			(0x2 << 6)
13251319b2f6SOder Chiou #define RT5645_PWR_MB_MASK			(0x1 << 5)
13261319b2f6SOder Chiou #define RT5645_PWR_MB_SFT			5
13271319b2f6SOder Chiou #define RT5645_PWR_MB_PD			(0x0 << 5)
13281319b2f6SOder Chiou #define RT5645_PWR_MB_PU			(0x1 << 5)
13291319b2f6SOder Chiou #define RT5645_PWR_CLK25M_MASK			(0x1 << 4)
13301319b2f6SOder Chiou #define RT5645_PWR_CLK25M_SFT			4
13311319b2f6SOder Chiou #define RT5645_PWR_CLK25M_PD			(0x0 << 4)
13321319b2f6SOder Chiou #define RT5645_PWR_CLK25M_PU			(0x1 << 4)
1333bb656addSBard Liao #define RT5645_IRQ_CLK_MCLK			(0x0 << 3)
1334bb656addSBard Liao #define RT5645_IRQ_CLK_INT			(0x1 << 3)
13352d4e2d02SBard Liao #define RT5645_JD1_MODE_MASK			(0x3 << 0)
13362d4e2d02SBard Liao #define RT5645_JD1_MODE_0			(0x0 << 0)
13372d4e2d02SBard Liao #define RT5645_JD1_MODE_1			(0x1 << 0)
13382d4e2d02SBard Liao #define RT5645_JD1_MODE_2			(0x2 << 0)
13391319b2f6SOder Chiou 
13401319b2f6SOder Chiou /* VAD Control 4 (0x9d) */
13411319b2f6SOder Chiou #define RT5645_VAD_SEL_MASK			(0x3 << 8)
13421319b2f6SOder Chiou #define RT5645_VAD_SEL_SFT			8
13431319b2f6SOder Chiou 
13441319b2f6SOder Chiou /* EQ Control 1 (0xb0) */
13451319b2f6SOder Chiou #define RT5645_EQ_SRC_MASK			(0x1 << 15)
13461319b2f6SOder Chiou #define RT5645_EQ_SRC_SFT			15
13471319b2f6SOder Chiou #define RT5645_EQ_SRC_DAC			(0x0 << 15)
13481319b2f6SOder Chiou #define RT5645_EQ_SRC_ADC			(0x1 << 15)
13491319b2f6SOder Chiou #define RT5645_EQ_UPD				(0x1 << 14)
13501319b2f6SOder Chiou #define RT5645_EQ_UPD_BIT			14
13511319b2f6SOder Chiou #define RT5645_EQ_CD_MASK			(0x1 << 13)
13521319b2f6SOder Chiou #define RT5645_EQ_CD_SFT			13
13531319b2f6SOder Chiou #define RT5645_EQ_CD_DIS			(0x0 << 13)
13541319b2f6SOder Chiou #define RT5645_EQ_CD_EN				(0x1 << 13)
13551319b2f6SOder Chiou #define RT5645_EQ_DITH_MASK			(0x3 << 8)
13561319b2f6SOder Chiou #define RT5645_EQ_DITH_SFT			8
13571319b2f6SOder Chiou #define RT5645_EQ_DITH_NOR			(0x0 << 8)
13581319b2f6SOder Chiou #define RT5645_EQ_DITH_LSB			(0x1 << 8)
13591319b2f6SOder Chiou #define RT5645_EQ_DITH_LSB_1			(0x2 << 8)
13601319b2f6SOder Chiou #define RT5645_EQ_DITH_LSB_2			(0x3 << 8)
13611319b2f6SOder Chiou 
13621319b2f6SOder Chiou /* EQ Control 2 (0xb1) */
13631319b2f6SOder Chiou #define RT5645_EQ_HPF1_M_MASK			(0x1 << 8)
13641319b2f6SOder Chiou #define RT5645_EQ_HPF1_M_SFT			8
13651319b2f6SOder Chiou #define RT5645_EQ_HPF1_M_HI			(0x0 << 8)
13661319b2f6SOder Chiou #define RT5645_EQ_HPF1_M_1ST			(0x1 << 8)
13671319b2f6SOder Chiou #define RT5645_EQ_LPF1_M_MASK			(0x1 << 7)
13681319b2f6SOder Chiou #define RT5645_EQ_LPF1_M_SFT			7
13691319b2f6SOder Chiou #define RT5645_EQ_LPF1_M_LO			(0x0 << 7)
13701319b2f6SOder Chiou #define RT5645_EQ_LPF1_M_1ST			(0x1 << 7)
13711319b2f6SOder Chiou #define RT5645_EQ_HPF2_MASK			(0x1 << 6)
13721319b2f6SOder Chiou #define RT5645_EQ_HPF2_SFT			6
13731319b2f6SOder Chiou #define RT5645_EQ_HPF2_DIS			(0x0 << 6)
13741319b2f6SOder Chiou #define RT5645_EQ_HPF2_EN			(0x1 << 6)
13751319b2f6SOder Chiou #define RT5645_EQ_HPF1_MASK			(0x1 << 5)
13761319b2f6SOder Chiou #define RT5645_EQ_HPF1_SFT			5
13771319b2f6SOder Chiou #define RT5645_EQ_HPF1_DIS			(0x0 << 5)
13781319b2f6SOder Chiou #define RT5645_EQ_HPF1_EN			(0x1 << 5)
13791319b2f6SOder Chiou #define RT5645_EQ_BPF4_MASK			(0x1 << 4)
13801319b2f6SOder Chiou #define RT5645_EQ_BPF4_SFT			4
13811319b2f6SOder Chiou #define RT5645_EQ_BPF4_DIS			(0x0 << 4)
13821319b2f6SOder Chiou #define RT5645_EQ_BPF4_EN			(0x1 << 4)
13831319b2f6SOder Chiou #define RT5645_EQ_BPF3_MASK			(0x1 << 3)
13841319b2f6SOder Chiou #define RT5645_EQ_BPF3_SFT			3
13851319b2f6SOder Chiou #define RT5645_EQ_BPF3_DIS			(0x0 << 3)
13861319b2f6SOder Chiou #define RT5645_EQ_BPF3_EN			(0x1 << 3)
13871319b2f6SOder Chiou #define RT5645_EQ_BPF2_MASK			(0x1 << 2)
13881319b2f6SOder Chiou #define RT5645_EQ_BPF2_SFT			2
13891319b2f6SOder Chiou #define RT5645_EQ_BPF2_DIS			(0x0 << 2)
13901319b2f6SOder Chiou #define RT5645_EQ_BPF2_EN			(0x1 << 2)
13911319b2f6SOder Chiou #define RT5645_EQ_BPF1_MASK			(0x1 << 1)
13921319b2f6SOder Chiou #define RT5645_EQ_BPF1_SFT			1
13931319b2f6SOder Chiou #define RT5645_EQ_BPF1_DIS			(0x0 << 1)
13941319b2f6SOder Chiou #define RT5645_EQ_BPF1_EN			(0x1 << 1)
13951319b2f6SOder Chiou #define RT5645_EQ_LPF_MASK			(0x1)
13961319b2f6SOder Chiou #define RT5645_EQ_LPF_SFT			0
13971319b2f6SOder Chiou #define RT5645_EQ_LPF_DIS			(0x0)
13981319b2f6SOder Chiou #define RT5645_EQ_LPF_EN			(0x1)
13991319b2f6SOder Chiou #define RT5645_EQ_CTRL_MASK			(0x7f)
14001319b2f6SOder Chiou 
14011319b2f6SOder Chiou /* Memory Test (0xb2) */
14021319b2f6SOder Chiou #define RT5645_MT_MASK				(0x1 << 15)
14031319b2f6SOder Chiou #define RT5645_MT_SFT				15
14041319b2f6SOder Chiou #define RT5645_MT_DIS				(0x0 << 15)
14051319b2f6SOder Chiou #define RT5645_MT_EN				(0x1 << 15)
14061319b2f6SOder Chiou 
14071319b2f6SOder Chiou /* DRC/AGC Control 1 (0xb4) */
14081319b2f6SOder Chiou #define RT5645_DRC_AGC_P_MASK			(0x1 << 15)
14091319b2f6SOder Chiou #define RT5645_DRC_AGC_P_SFT			15
14101319b2f6SOder Chiou #define RT5645_DRC_AGC_P_DAC			(0x0 << 15)
14111319b2f6SOder Chiou #define RT5645_DRC_AGC_P_ADC			(0x1 << 15)
14121319b2f6SOder Chiou #define RT5645_DRC_AGC_MASK			(0x1 << 14)
14131319b2f6SOder Chiou #define RT5645_DRC_AGC_SFT			14
14141319b2f6SOder Chiou #define RT5645_DRC_AGC_DIS			(0x0 << 14)
14151319b2f6SOder Chiou #define RT5645_DRC_AGC_EN			(0x1 << 14)
14161319b2f6SOder Chiou #define RT5645_DRC_AGC_UPD			(0x1 << 13)
14171319b2f6SOder Chiou #define RT5645_DRC_AGC_UPD_BIT			13
14181319b2f6SOder Chiou #define RT5645_DRC_AGC_AR_MASK			(0x1f << 8)
14191319b2f6SOder Chiou #define RT5645_DRC_AGC_AR_SFT			8
14201319b2f6SOder Chiou #define RT5645_DRC_AGC_R_MASK			(0x7 << 5)
14211319b2f6SOder Chiou #define RT5645_DRC_AGC_R_SFT			5
14221319b2f6SOder Chiou #define RT5645_DRC_AGC_R_48K			(0x1 << 5)
14231319b2f6SOder Chiou #define RT5645_DRC_AGC_R_96K			(0x2 << 5)
14241319b2f6SOder Chiou #define RT5645_DRC_AGC_R_192K			(0x3 << 5)
14251319b2f6SOder Chiou #define RT5645_DRC_AGC_R_441K			(0x5 << 5)
14261319b2f6SOder Chiou #define RT5645_DRC_AGC_R_882K			(0x6 << 5)
14271319b2f6SOder Chiou #define RT5645_DRC_AGC_R_1764K			(0x7 << 5)
14281319b2f6SOder Chiou #define RT5645_DRC_AGC_RC_MASK			(0x1f)
14291319b2f6SOder Chiou #define RT5645_DRC_AGC_RC_SFT			0
14301319b2f6SOder Chiou 
14311319b2f6SOder Chiou /* DRC/AGC Control 2 (0xb5) */
14321319b2f6SOder Chiou #define RT5645_DRC_AGC_POB_MASK			(0x3f << 8)
14331319b2f6SOder Chiou #define RT5645_DRC_AGC_POB_SFT			8
14341319b2f6SOder Chiou #define RT5645_DRC_AGC_CP_MASK			(0x1 << 7)
14351319b2f6SOder Chiou #define RT5645_DRC_AGC_CP_SFT			7
14361319b2f6SOder Chiou #define RT5645_DRC_AGC_CP_DIS			(0x0 << 7)
14371319b2f6SOder Chiou #define RT5645_DRC_AGC_CP_EN			(0x1 << 7)
14381319b2f6SOder Chiou #define RT5645_DRC_AGC_CPR_MASK			(0x3 << 5)
14391319b2f6SOder Chiou #define RT5645_DRC_AGC_CPR_SFT			5
14401319b2f6SOder Chiou #define RT5645_DRC_AGC_CPR_1_1			(0x0 << 5)
14411319b2f6SOder Chiou #define RT5645_DRC_AGC_CPR_1_2			(0x1 << 5)
14421319b2f6SOder Chiou #define RT5645_DRC_AGC_CPR_1_3			(0x2 << 5)
14431319b2f6SOder Chiou #define RT5645_DRC_AGC_CPR_1_4			(0x3 << 5)
14441319b2f6SOder Chiou #define RT5645_DRC_AGC_PRB_MASK			(0x1f)
14451319b2f6SOder Chiou #define RT5645_DRC_AGC_PRB_SFT			0
14461319b2f6SOder Chiou 
14471319b2f6SOder Chiou /* DRC/AGC Control 3 (0xb6) */
14481319b2f6SOder Chiou #define RT5645_DRC_AGC_NGB_MASK			(0xf << 12)
14491319b2f6SOder Chiou #define RT5645_DRC_AGC_NGB_SFT			12
14501319b2f6SOder Chiou #define RT5645_DRC_AGC_TAR_MASK			(0x1f << 7)
14511319b2f6SOder Chiou #define RT5645_DRC_AGC_TAR_SFT			7
14521319b2f6SOder Chiou #define RT5645_DRC_AGC_NG_MASK			(0x1 << 6)
14531319b2f6SOder Chiou #define RT5645_DRC_AGC_NG_SFT			6
14541319b2f6SOder Chiou #define RT5645_DRC_AGC_NG_DIS			(0x0 << 6)
14551319b2f6SOder Chiou #define RT5645_DRC_AGC_NG_EN			(0x1 << 6)
14561319b2f6SOder Chiou #define RT5645_DRC_AGC_NGH_MASK			(0x1 << 5)
14571319b2f6SOder Chiou #define RT5645_DRC_AGC_NGH_SFT			5
14581319b2f6SOder Chiou #define RT5645_DRC_AGC_NGH_DIS			(0x0 << 5)
14591319b2f6SOder Chiou #define RT5645_DRC_AGC_NGH_EN			(0x1 << 5)
14601319b2f6SOder Chiou #define RT5645_DRC_AGC_NGT_MASK			(0x1f)
14611319b2f6SOder Chiou #define RT5645_DRC_AGC_NGT_SFT			0
14621319b2f6SOder Chiou 
14631319b2f6SOder Chiou /* ANC Control 1 (0xb8) */
14641319b2f6SOder Chiou #define RT5645_ANC_M_MASK			(0x1 << 15)
14651319b2f6SOder Chiou #define RT5645_ANC_M_SFT			15
14661319b2f6SOder Chiou #define RT5645_ANC_M_NOR			(0x0 << 15)
14671319b2f6SOder Chiou #define RT5645_ANC_M_REV			(0x1 << 15)
14681319b2f6SOder Chiou #define RT5645_ANC_MASK				(0x1 << 14)
14691319b2f6SOder Chiou #define RT5645_ANC_SFT				14
14701319b2f6SOder Chiou #define RT5645_ANC_DIS				(0x0 << 14)
14711319b2f6SOder Chiou #define RT5645_ANC_EN				(0x1 << 14)
14721319b2f6SOder Chiou #define RT5645_ANC_MD_MASK			(0x3 << 12)
14731319b2f6SOder Chiou #define RT5645_ANC_MD_SFT			12
14741319b2f6SOder Chiou #define RT5645_ANC_MD_DIS			(0x0 << 12)
14751319b2f6SOder Chiou #define RT5645_ANC_MD_67MS			(0x1 << 12)
14761319b2f6SOder Chiou #define RT5645_ANC_MD_267MS			(0x2 << 12)
14771319b2f6SOder Chiou #define RT5645_ANC_MD_1067MS			(0x3 << 12)
14781319b2f6SOder Chiou #define RT5645_ANC_SN_MASK			(0x1 << 11)
14791319b2f6SOder Chiou #define RT5645_ANC_SN_SFT			11
14801319b2f6SOder Chiou #define RT5645_ANC_SN_DIS			(0x0 << 11)
14811319b2f6SOder Chiou #define RT5645_ANC_SN_EN			(0x1 << 11)
14821319b2f6SOder Chiou #define RT5645_ANC_CLK_MASK			(0x1 << 10)
14831319b2f6SOder Chiou #define RT5645_ANC_CLK_SFT			10
14841319b2f6SOder Chiou #define RT5645_ANC_CLK_ANC			(0x0 << 10)
14851319b2f6SOder Chiou #define RT5645_ANC_CLK_REG			(0x1 << 10)
14861319b2f6SOder Chiou #define RT5645_ANC_ZCD_MASK			(0x3 << 8)
14871319b2f6SOder Chiou #define RT5645_ANC_ZCD_SFT			8
14881319b2f6SOder Chiou #define RT5645_ANC_ZCD_DIS			(0x0 << 8)
14891319b2f6SOder Chiou #define RT5645_ANC_ZCD_T1			(0x1 << 8)
14901319b2f6SOder Chiou #define RT5645_ANC_ZCD_T2			(0x2 << 8)
14911319b2f6SOder Chiou #define RT5645_ANC_ZCD_WT			(0x3 << 8)
14921319b2f6SOder Chiou #define RT5645_ANC_CS_MASK			(0x1 << 7)
14931319b2f6SOder Chiou #define RT5645_ANC_CS_SFT			7
14941319b2f6SOder Chiou #define RT5645_ANC_CS_DIS			(0x0 << 7)
14951319b2f6SOder Chiou #define RT5645_ANC_CS_EN			(0x1 << 7)
14961319b2f6SOder Chiou #define RT5645_ANC_SW_MASK			(0x1 << 6)
14971319b2f6SOder Chiou #define RT5645_ANC_SW_SFT			6
14981319b2f6SOder Chiou #define RT5645_ANC_SW_NOR			(0x0 << 6)
14991319b2f6SOder Chiou #define RT5645_ANC_SW_AUTO			(0x1 << 6)
15001319b2f6SOder Chiou #define RT5645_ANC_CO_L_MASK			(0x3f)
15011319b2f6SOder Chiou #define RT5645_ANC_CO_L_SFT			0
15021319b2f6SOder Chiou 
15031319b2f6SOder Chiou /* ANC Control 2 (0xb6) */
15041319b2f6SOder Chiou #define RT5645_ANC_FG_R_MASK			(0xf << 12)
15051319b2f6SOder Chiou #define RT5645_ANC_FG_R_SFT			12
15061319b2f6SOder Chiou #define RT5645_ANC_FG_L_MASK			(0xf << 8)
15071319b2f6SOder Chiou #define RT5645_ANC_FG_L_SFT			8
15081319b2f6SOder Chiou #define RT5645_ANC_CG_R_MASK			(0xf << 4)
15091319b2f6SOder Chiou #define RT5645_ANC_CG_R_SFT			4
15101319b2f6SOder Chiou #define RT5645_ANC_CG_L_MASK			(0xf)
15111319b2f6SOder Chiou #define RT5645_ANC_CG_L_SFT			0
15121319b2f6SOder Chiou 
15131319b2f6SOder Chiou /* ANC Control 3 (0xb6) */
15141319b2f6SOder Chiou #define RT5645_ANC_CD_MASK			(0x1 << 6)
15151319b2f6SOder Chiou #define RT5645_ANC_CD_SFT			6
15161319b2f6SOder Chiou #define RT5645_ANC_CD_BOTH			(0x0 << 6)
15171319b2f6SOder Chiou #define RT5645_ANC_CD_IND			(0x1 << 6)
15181319b2f6SOder Chiou #define RT5645_ANC_CO_R_MASK			(0x3f)
15191319b2f6SOder Chiou #define RT5645_ANC_CO_R_SFT			0
15201319b2f6SOder Chiou 
15211319b2f6SOder Chiou /* Jack Detect Control (0xbb) */
15221319b2f6SOder Chiou #define RT5645_JD_MASK				(0x7 << 13)
15231319b2f6SOder Chiou #define RT5645_JD_SFT				13
15241319b2f6SOder Chiou #define RT5645_JD_DIS				(0x0 << 13)
15251319b2f6SOder Chiou #define RT5645_JD_GPIO1				(0x1 << 13)
15261319b2f6SOder Chiou #define RT5645_JD_JD1_IN4P			(0x2 << 13)
15271319b2f6SOder Chiou #define RT5645_JD_JD2_IN4N			(0x3 << 13)
15281319b2f6SOder Chiou #define RT5645_JD_GPIO2				(0x4 << 13)
15291319b2f6SOder Chiou #define RT5645_JD_GPIO3				(0x5 << 13)
15301319b2f6SOder Chiou #define RT5645_JD_GPIO4				(0x6 << 13)
15311319b2f6SOder Chiou #define RT5645_JD_HP_MASK			(0x1 << 11)
15321319b2f6SOder Chiou #define RT5645_JD_HP_SFT			11
15331319b2f6SOder Chiou #define RT5645_JD_HP_DIS			(0x0 << 11)
15341319b2f6SOder Chiou #define RT5645_JD_HP_EN				(0x1 << 11)
15351319b2f6SOder Chiou #define RT5645_JD_HP_TRG_MASK			(0x1 << 10)
15361319b2f6SOder Chiou #define RT5645_JD_HP_TRG_SFT			10
15371319b2f6SOder Chiou #define RT5645_JD_HP_TRG_LO			(0x0 << 10)
15381319b2f6SOder Chiou #define RT5645_JD_HP_TRG_HI			(0x1 << 10)
15391319b2f6SOder Chiou #define RT5645_JD_SPL_MASK			(0x1 << 9)
15401319b2f6SOder Chiou #define RT5645_JD_SPL_SFT			9
15411319b2f6SOder Chiou #define RT5645_JD_SPL_DIS			(0x0 << 9)
15421319b2f6SOder Chiou #define RT5645_JD_SPL_EN			(0x1 << 9)
15431319b2f6SOder Chiou #define RT5645_JD_SPL_TRG_MASK			(0x1 << 8)
15441319b2f6SOder Chiou #define RT5645_JD_SPL_TRG_SFT			8
15451319b2f6SOder Chiou #define RT5645_JD_SPL_TRG_LO			(0x0 << 8)
15461319b2f6SOder Chiou #define RT5645_JD_SPL_TRG_HI			(0x1 << 8)
15471319b2f6SOder Chiou #define RT5645_JD_SPR_MASK			(0x1 << 7)
15481319b2f6SOder Chiou #define RT5645_JD_SPR_SFT			7
15491319b2f6SOder Chiou #define RT5645_JD_SPR_DIS			(0x0 << 7)
15501319b2f6SOder Chiou #define RT5645_JD_SPR_EN			(0x1 << 7)
15511319b2f6SOder Chiou #define RT5645_JD_SPR_TRG_MASK			(0x1 << 6)
15521319b2f6SOder Chiou #define RT5645_JD_SPR_TRG_SFT			6
15531319b2f6SOder Chiou #define RT5645_JD_SPR_TRG_LO			(0x0 << 6)
15541319b2f6SOder Chiou #define RT5645_JD_SPR_TRG_HI			(0x1 << 6)
15551319b2f6SOder Chiou #define RT5645_JD_MO_MASK			(0x1 << 5)
15561319b2f6SOder Chiou #define RT5645_JD_MO_SFT			5
15571319b2f6SOder Chiou #define RT5645_JD_MO_DIS			(0x0 << 5)
15581319b2f6SOder Chiou #define RT5645_JD_MO_EN				(0x1 << 5)
15591319b2f6SOder Chiou #define RT5645_JD_MO_TRG_MASK			(0x1 << 4)
15601319b2f6SOder Chiou #define RT5645_JD_MO_TRG_SFT			4
15611319b2f6SOder Chiou #define RT5645_JD_MO_TRG_LO			(0x0 << 4)
15621319b2f6SOder Chiou #define RT5645_JD_MO_TRG_HI			(0x1 << 4)
15631319b2f6SOder Chiou #define RT5645_JD_LO_MASK			(0x1 << 3)
15641319b2f6SOder Chiou #define RT5645_JD_LO_SFT			3
15651319b2f6SOder Chiou #define RT5645_JD_LO_DIS			(0x0 << 3)
15661319b2f6SOder Chiou #define RT5645_JD_LO_EN				(0x1 << 3)
15671319b2f6SOder Chiou #define RT5645_JD_LO_TRG_MASK			(0x1 << 2)
15681319b2f6SOder Chiou #define RT5645_JD_LO_TRG_SFT			2
15691319b2f6SOder Chiou #define RT5645_JD_LO_TRG_LO			(0x0 << 2)
15701319b2f6SOder Chiou #define RT5645_JD_LO_TRG_HI			(0x1 << 2)
15711319b2f6SOder Chiou #define RT5645_JD1_IN4P_MASK			(0x1 << 1)
15721319b2f6SOder Chiou #define RT5645_JD1_IN4P_SFT			1
15731319b2f6SOder Chiou #define RT5645_JD1_IN4P_DIS			(0x0 << 1)
15741319b2f6SOder Chiou #define RT5645_JD1_IN4P_EN			(0x1 << 1)
15751319b2f6SOder Chiou #define RT5645_JD2_IN4N_MASK			(0x1)
15761319b2f6SOder Chiou #define RT5645_JD2_IN4N_SFT			0
15771319b2f6SOder Chiou #define RT5645_JD2_IN4N_DIS			(0x0)
15781319b2f6SOder Chiou #define RT5645_JD2_IN4N_EN			(0x1)
15791319b2f6SOder Chiou 
15801319b2f6SOder Chiou /* Jack detect for ANC (0xbc) */
15811319b2f6SOder Chiou #define RT5645_ANC_DET_MASK			(0x3 << 4)
15821319b2f6SOder Chiou #define RT5645_ANC_DET_SFT			4
15831319b2f6SOder Chiou #define RT5645_ANC_DET_DIS			(0x0 << 4)
15841319b2f6SOder Chiou #define RT5645_ANC_DET_MB1			(0x1 << 4)
15851319b2f6SOder Chiou #define RT5645_ANC_DET_MB2			(0x2 << 4)
15861319b2f6SOder Chiou #define RT5645_ANC_DET_JD			(0x3 << 4)
15871319b2f6SOder Chiou #define RT5645_AD_TRG_MASK			(0x1 << 3)
15881319b2f6SOder Chiou #define RT5645_AD_TRG_SFT			3
15891319b2f6SOder Chiou #define RT5645_AD_TRG_LO			(0x0 << 3)
15901319b2f6SOder Chiou #define RT5645_AD_TRG_HI			(0x1 << 3)
15911319b2f6SOder Chiou #define RT5645_ANCM_DET_MASK			(0x3 << 4)
15921319b2f6SOder Chiou #define RT5645_ANCM_DET_SFT			4
15931319b2f6SOder Chiou #define RT5645_ANCM_DET_DIS			(0x0 << 4)
15941319b2f6SOder Chiou #define RT5645_ANCM_DET_MB1			(0x1 << 4)
15951319b2f6SOder Chiou #define RT5645_ANCM_DET_MB2			(0x2 << 4)
15961319b2f6SOder Chiou #define RT5645_ANCM_DET_JD			(0x3 << 4)
15971319b2f6SOder Chiou #define RT5645_AMD_TRG_MASK			(0x1 << 3)
15981319b2f6SOder Chiou #define RT5645_AMD_TRG_SFT			3
15991319b2f6SOder Chiou #define RT5645_AMD_TRG_LO			(0x0 << 3)
16001319b2f6SOder Chiou #define RT5645_AMD_TRG_HI			(0x1 << 3)
16011319b2f6SOder Chiou 
16021319b2f6SOder Chiou /* IRQ Control 1 (0xbd) */
16031319b2f6SOder Chiou #define RT5645_IRQ_JD_MASK			(0x1 << 15)
16041319b2f6SOder Chiou #define RT5645_IRQ_JD_SFT			15
16051319b2f6SOder Chiou #define RT5645_IRQ_JD_BP			(0x0 << 15)
16061319b2f6SOder Chiou #define RT5645_IRQ_JD_NOR			(0x1 << 15)
16071319b2f6SOder Chiou #define RT5645_IRQ_OT_MASK			(0x1 << 14)
16081319b2f6SOder Chiou #define RT5645_IRQ_OT_SFT			14
16091319b2f6SOder Chiou #define RT5645_IRQ_OT_BP			(0x0 << 14)
16101319b2f6SOder Chiou #define RT5645_IRQ_OT_NOR			(0x1 << 14)
16111319b2f6SOder Chiou #define RT5645_JD_STKY_MASK			(0x1 << 13)
16121319b2f6SOder Chiou #define RT5645_JD_STKY_SFT			13
16131319b2f6SOder Chiou #define RT5645_JD_STKY_DIS			(0x0 << 13)
16141319b2f6SOder Chiou #define RT5645_JD_STKY_EN			(0x1 << 13)
16151319b2f6SOder Chiou #define RT5645_OT_STKY_MASK			(0x1 << 12)
16161319b2f6SOder Chiou #define RT5645_OT_STKY_SFT			12
16171319b2f6SOder Chiou #define RT5645_OT_STKY_DIS			(0x0 << 12)
16181319b2f6SOder Chiou #define RT5645_OT_STKY_EN			(0x1 << 12)
16191319b2f6SOder Chiou #define RT5645_JD_P_MASK			(0x1 << 11)
16201319b2f6SOder Chiou #define RT5645_JD_P_SFT				11
16211319b2f6SOder Chiou #define RT5645_JD_P_NOR				(0x0 << 11)
16221319b2f6SOder Chiou #define RT5645_JD_P_INV				(0x1 << 11)
16231319b2f6SOder Chiou #define RT5645_OT_P_MASK			(0x1 << 10)
16241319b2f6SOder Chiou #define RT5645_OT_P_SFT				10
16251319b2f6SOder Chiou #define RT5645_OT_P_NOR				(0x0 << 10)
16261319b2f6SOder Chiou #define RT5645_OT_P_INV				(0x1 << 10)
16272d4e2d02SBard Liao #define RT5645_IRQ_JD_1_1_EN			(0x1 << 9)
1628917536aeSJohn Lin #define RT5645_JD_1_1_MASK			(0x1 << 7)
1629917536aeSJohn Lin #define RT5645_JD_1_1_SFT			7
1630917536aeSJohn Lin #define RT5645_JD_1_1_NOR			(0x0 << 7)
1631917536aeSJohn Lin #define RT5645_JD_1_1_INV			(0x1 << 7)
16321319b2f6SOder Chiou 
16331319b2f6SOder Chiou /* IRQ Control 2 (0xbe) */
16341319b2f6SOder Chiou #define RT5645_IRQ_MB1_OC_MASK			(0x1 << 15)
16351319b2f6SOder Chiou #define RT5645_IRQ_MB1_OC_SFT			15
16361319b2f6SOder Chiou #define RT5645_IRQ_MB1_OC_BP			(0x0 << 15)
16371319b2f6SOder Chiou #define RT5645_IRQ_MB1_OC_NOR			(0x1 << 15)
16381319b2f6SOder Chiou #define RT5645_IRQ_MB2_OC_MASK			(0x1 << 14)
16391319b2f6SOder Chiou #define RT5645_IRQ_MB2_OC_SFT			14
16401319b2f6SOder Chiou #define RT5645_IRQ_MB2_OC_BP			(0x0 << 14)
16411319b2f6SOder Chiou #define RT5645_IRQ_MB2_OC_NOR			(0x1 << 14)
16421319b2f6SOder Chiou #define RT5645_MB1_OC_STKY_MASK			(0x1 << 13)
16431319b2f6SOder Chiou #define RT5645_MB1_OC_STKY_SFT			13
16441319b2f6SOder Chiou #define RT5645_MB1_OC_STKY_DIS			(0x0 << 13)
16451319b2f6SOder Chiou #define RT5645_MB1_OC_STKY_EN			(0x1 << 13)
16461319b2f6SOder Chiou #define RT5645_MB2_OC_STKY_MASK			(0x1 << 12)
16471319b2f6SOder Chiou #define RT5645_MB2_OC_STKY_SFT			12
16481319b2f6SOder Chiou #define RT5645_MB2_OC_STKY_DIS			(0x0 << 12)
16491319b2f6SOder Chiou #define RT5645_MB2_OC_STKY_EN			(0x1 << 12)
16501319b2f6SOder Chiou #define RT5645_MB1_OC_P_MASK			(0x1 << 7)
16511319b2f6SOder Chiou #define RT5645_MB1_OC_P_SFT			7
16521319b2f6SOder Chiou #define RT5645_MB1_OC_P_NOR			(0x0 << 7)
16531319b2f6SOder Chiou #define RT5645_MB1_OC_P_INV			(0x1 << 7)
16541319b2f6SOder Chiou #define RT5645_MB2_OC_P_MASK			(0x1 << 6)
16551319b2f6SOder Chiou #define RT5645_MB2_OC_P_SFT			6
16561319b2f6SOder Chiou #define RT5645_MB2_OC_P_NOR			(0x0 << 6)
16571319b2f6SOder Chiou #define RT5645_MB2_OC_P_INV			(0x1 << 6)
16581319b2f6SOder Chiou #define RT5645_MB1_OC_CLR			(0x1 << 3)
16591319b2f6SOder Chiou #define RT5645_MB1_OC_CLR_SFT			3
16601319b2f6SOder Chiou #define RT5645_MB2_OC_CLR			(0x1 << 2)
16611319b2f6SOder Chiou #define RT5645_MB2_OC_CLR_SFT			2
16621319b2f6SOder Chiou 
16631319b2f6SOder Chiou /* GPIO Control 1 (0xc0) */
16641319b2f6SOder Chiou #define RT5645_GP1_PIN_MASK			(0x1 << 15)
16651319b2f6SOder Chiou #define RT5645_GP1_PIN_SFT			15
16661319b2f6SOder Chiou #define RT5645_GP1_PIN_GPIO1			(0x0 << 15)
16671319b2f6SOder Chiou #define RT5645_GP1_PIN_IRQ			(0x1 << 15)
16681319b2f6SOder Chiou #define RT5645_GP2_PIN_MASK			(0x1 << 14)
16691319b2f6SOder Chiou #define RT5645_GP2_PIN_SFT			14
16701319b2f6SOder Chiou #define RT5645_GP2_PIN_GPIO2			(0x0 << 14)
16711319b2f6SOder Chiou #define RT5645_GP2_PIN_DMIC1_SCL		(0x1 << 14)
16721319b2f6SOder Chiou #define RT5645_GP3_PIN_MASK			(0x3 << 12)
16731319b2f6SOder Chiou #define RT5645_GP3_PIN_SFT			12
16741319b2f6SOder Chiou #define RT5645_GP3_PIN_GPIO3			(0x0 << 12)
16751319b2f6SOder Chiou #define RT5645_GP3_PIN_DMIC1_SDA		(0x1 << 12)
16761319b2f6SOder Chiou #define RT5645_GP3_PIN_IRQ			(0x2 << 12)
16771319b2f6SOder Chiou #define RT5645_GP4_PIN_MASK			(0x1 << 11)
16781319b2f6SOder Chiou #define RT5645_GP4_PIN_SFT			11
16791319b2f6SOder Chiou #define RT5645_GP4_PIN_GPIO4			(0x0 << 11)
16801319b2f6SOder Chiou #define RT5645_GP4_PIN_DMIC2_SDA		(0x1 << 11)
16811319b2f6SOder Chiou #define RT5645_DP_SIG_MASK			(0x1 << 10)
16821319b2f6SOder Chiou #define RT5645_DP_SIG_SFT			10
16831319b2f6SOder Chiou #define RT5645_DP_SIG_TEST			(0x0 << 10)
16841319b2f6SOder Chiou #define RT5645_DP_SIG_AP			(0x1 << 10)
16851319b2f6SOder Chiou #define RT5645_GPIO_M_MASK			(0x1 << 9)
16861319b2f6SOder Chiou #define RT5645_GPIO_M_SFT			9
16871319b2f6SOder Chiou #define RT5645_GPIO_M_FLT			(0x0 << 9)
16881319b2f6SOder Chiou #define RT5645_GPIO_M_PH			(0x1 << 9)
16891319b2f6SOder Chiou #define RT5645_I2S2_SEL				(0x1 << 8)
16901319b2f6SOder Chiou #define RT5645_I2S2_SEL_SFT			8
16911319b2f6SOder Chiou #define RT5645_GP5_PIN_MASK			(0x1 << 7)
16921319b2f6SOder Chiou #define RT5645_GP5_PIN_SFT			7
16931319b2f6SOder Chiou #define RT5645_GP5_PIN_GPIO5			(0x0 << 7)
16941319b2f6SOder Chiou #define RT5645_GP5_PIN_DMIC1_SDA		(0x1 << 7)
16951319b2f6SOder Chiou #define RT5645_GP6_PIN_MASK			(0x1 << 6)
16961319b2f6SOder Chiou #define RT5645_GP6_PIN_SFT			6
16971319b2f6SOder Chiou #define RT5645_GP6_PIN_GPIO6			(0x0 << 6)
16981319b2f6SOder Chiou #define RT5645_GP6_PIN_DMIC2_SDA		(0x1 << 6)
1699a094935eSBard Liao #define RT5645_I2S2_DAC_PIN_MASK		(0x1 << 4)
1700a094935eSBard Liao #define RT5645_I2S2_DAC_PIN_SFT			4
1701a094935eSBard Liao #define RT5645_I2S2_DAC_PIN_I2S			(0x0 << 4)
1702a094935eSBard Liao #define RT5645_I2S2_DAC_PIN_GPIO		(0x1 << 4)
17031319b2f6SOder Chiou #define RT5645_GP8_PIN_MASK			(0x1 << 3)
17041319b2f6SOder Chiou #define RT5645_GP8_PIN_SFT			3
17051319b2f6SOder Chiou #define RT5645_GP8_PIN_GPIO8			(0x0 << 3)
17061319b2f6SOder Chiou #define RT5645_GP8_PIN_DMIC2_SDA		(0x1 << 3)
17071319b2f6SOder Chiou #define RT5645_GP12_PIN_MASK			(0x1 << 2)
17081319b2f6SOder Chiou #define RT5645_GP12_PIN_SFT			2
17091319b2f6SOder Chiou #define RT5645_GP12_PIN_GPIO12			(0x0 << 2)
17101319b2f6SOder Chiou #define RT5645_GP12_PIN_DMIC2_SDA		(0x1 << 2)
17111319b2f6SOder Chiou #define RT5645_GP11_PIN_MASK			(0x1 << 1)
17121319b2f6SOder Chiou #define RT5645_GP11_PIN_SFT			1
17131319b2f6SOder Chiou #define RT5645_GP11_PIN_GPIO11			(0x0 << 1)
17141319b2f6SOder Chiou #define RT5645_GP11_PIN_DMIC1_SDA		(0x1 << 1)
17151319b2f6SOder Chiou #define RT5645_GP10_PIN_MASK			(0x1)
17161319b2f6SOder Chiou #define RT5645_GP10_PIN_SFT			0
17171319b2f6SOder Chiou #define RT5645_GP10_PIN_GPIO10			(0x0)
17181319b2f6SOder Chiou #define RT5645_GP10_PIN_DMIC2_SDA		(0x1)
17191319b2f6SOder Chiou 
17201319b2f6SOder Chiou /* GPIO Control 3 (0xc2) */
17211319b2f6SOder Chiou #define RT5645_GP4_PF_MASK			(0x1 << 11)
17221319b2f6SOder Chiou #define RT5645_GP4_PF_SFT			11
17231319b2f6SOder Chiou #define RT5645_GP4_PF_IN			(0x0 << 11)
17241319b2f6SOder Chiou #define RT5645_GP4_PF_OUT			(0x1 << 11)
17251319b2f6SOder Chiou #define RT5645_GP4_OUT_MASK			(0x1 << 10)
17261319b2f6SOder Chiou #define RT5645_GP4_OUT_SFT			10
17271319b2f6SOder Chiou #define RT5645_GP4_OUT_LO			(0x0 << 10)
17281319b2f6SOder Chiou #define RT5645_GP4_OUT_HI			(0x1 << 10)
17291319b2f6SOder Chiou #define RT5645_GP4_P_MASK			(0x1 << 9)
17301319b2f6SOder Chiou #define RT5645_GP4_P_SFT			9
17311319b2f6SOder Chiou #define RT5645_GP4_P_NOR			(0x0 << 9)
17321319b2f6SOder Chiou #define RT5645_GP4_P_INV			(0x1 << 9)
17331319b2f6SOder Chiou #define RT5645_GP3_PF_MASK			(0x1 << 8)
17341319b2f6SOder Chiou #define RT5645_GP3_PF_SFT			8
17351319b2f6SOder Chiou #define RT5645_GP3_PF_IN			(0x0 << 8)
17361319b2f6SOder Chiou #define RT5645_GP3_PF_OUT			(0x1 << 8)
17371319b2f6SOder Chiou #define RT5645_GP3_OUT_MASK			(0x1 << 7)
17381319b2f6SOder Chiou #define RT5645_GP3_OUT_SFT			7
17391319b2f6SOder Chiou #define RT5645_GP3_OUT_LO			(0x0 << 7)
17401319b2f6SOder Chiou #define RT5645_GP3_OUT_HI			(0x1 << 7)
17411319b2f6SOder Chiou #define RT5645_GP3_P_MASK			(0x1 << 6)
17421319b2f6SOder Chiou #define RT5645_GP3_P_SFT			6
17431319b2f6SOder Chiou #define RT5645_GP3_P_NOR			(0x0 << 6)
17441319b2f6SOder Chiou #define RT5645_GP3_P_INV			(0x1 << 6)
17451319b2f6SOder Chiou #define RT5645_GP2_PF_MASK			(0x1 << 5)
17461319b2f6SOder Chiou #define RT5645_GP2_PF_SFT			5
17471319b2f6SOder Chiou #define RT5645_GP2_PF_IN			(0x0 << 5)
17481319b2f6SOder Chiou #define RT5645_GP2_PF_OUT			(0x1 << 5)
17491319b2f6SOder Chiou #define RT5645_GP2_OUT_MASK			(0x1 << 4)
17501319b2f6SOder Chiou #define RT5645_GP2_OUT_SFT			4
17511319b2f6SOder Chiou #define RT5645_GP2_OUT_LO			(0x0 << 4)
17521319b2f6SOder Chiou #define RT5645_GP2_OUT_HI			(0x1 << 4)
17531319b2f6SOder Chiou #define RT5645_GP2_P_MASK			(0x1 << 3)
17541319b2f6SOder Chiou #define RT5645_GP2_P_SFT			3
17551319b2f6SOder Chiou #define RT5645_GP2_P_NOR			(0x0 << 3)
17561319b2f6SOder Chiou #define RT5645_GP2_P_INV			(0x1 << 3)
17571319b2f6SOder Chiou #define RT5645_GP1_PF_MASK			(0x1 << 2)
17581319b2f6SOder Chiou #define RT5645_GP1_PF_SFT			2
17591319b2f6SOder Chiou #define RT5645_GP1_PF_IN			(0x0 << 2)
17601319b2f6SOder Chiou #define RT5645_GP1_PF_OUT			(0x1 << 2)
17611319b2f6SOder Chiou #define RT5645_GP1_OUT_MASK			(0x1 << 1)
17621319b2f6SOder Chiou #define RT5645_GP1_OUT_SFT			1
17631319b2f6SOder Chiou #define RT5645_GP1_OUT_LO			(0x0 << 1)
17641319b2f6SOder Chiou #define RT5645_GP1_OUT_HI			(0x1 << 1)
17651319b2f6SOder Chiou #define RT5645_GP1_P_MASK			(0x1)
17661319b2f6SOder Chiou #define RT5645_GP1_P_SFT			0
17671319b2f6SOder Chiou #define RT5645_GP1_P_NOR			(0x0)
17681319b2f6SOder Chiou #define RT5645_GP1_P_INV			(0x1)
17691319b2f6SOder Chiou 
17701319b2f6SOder Chiou /* Programmable Register Array Control 1 (0xc8) */
17711319b2f6SOder Chiou #define RT5645_REG_SEQ_MASK			(0xf << 12)
17721319b2f6SOder Chiou #define RT5645_REG_SEQ_SFT			12
17731319b2f6SOder Chiou #define RT5645_SEQ1_ST_MASK			(0x1 << 11) /*RO*/
17741319b2f6SOder Chiou #define RT5645_SEQ1_ST_SFT			11
17751319b2f6SOder Chiou #define RT5645_SEQ1_ST_RUN			(0x0 << 11)
17761319b2f6SOder Chiou #define RT5645_SEQ1_ST_FIN			(0x1 << 11)
17771319b2f6SOder Chiou #define RT5645_SEQ2_ST_MASK			(0x1 << 10) /*RO*/
17781319b2f6SOder Chiou #define RT5645_SEQ2_ST_SFT			10
17791319b2f6SOder Chiou #define RT5645_SEQ2_ST_RUN			(0x0 << 10)
17801319b2f6SOder Chiou #define RT5645_SEQ2_ST_FIN			(0x1 << 10)
17811319b2f6SOder Chiou #define RT5645_REG_LV_MASK			(0x1 << 9)
17821319b2f6SOder Chiou #define RT5645_REG_LV_SFT			9
17831319b2f6SOder Chiou #define RT5645_REG_LV_MX			(0x0 << 9)
17841319b2f6SOder Chiou #define RT5645_REG_LV_PR			(0x1 << 9)
17851319b2f6SOder Chiou #define RT5645_SEQ_2_PT_MASK			(0x1 << 8)
17861319b2f6SOder Chiou #define RT5645_SEQ_2_PT_BIT			8
17871319b2f6SOder Chiou #define RT5645_REG_IDX_MASK			(0xff)
17881319b2f6SOder Chiou #define RT5645_REG_IDX_SFT			0
17891319b2f6SOder Chiou 
17901319b2f6SOder Chiou /* Programmable Register Array Control 2 (0xc9) */
17911319b2f6SOder Chiou #define RT5645_REG_DAT_MASK			(0xffff)
17921319b2f6SOder Chiou #define RT5645_REG_DAT_SFT			0
17931319b2f6SOder Chiou 
17941319b2f6SOder Chiou /* Programmable Register Array Control 3 (0xca) */
17951319b2f6SOder Chiou #define RT5645_SEQ_DLY_MASK			(0xff << 8)
17961319b2f6SOder Chiou #define RT5645_SEQ_DLY_SFT			8
17971319b2f6SOder Chiou #define RT5645_PROG_MASK			(0x1 << 7)
17981319b2f6SOder Chiou #define RT5645_PROG_SFT				7
17991319b2f6SOder Chiou #define RT5645_PROG_DIS				(0x0 << 7)
18001319b2f6SOder Chiou #define RT5645_PROG_EN				(0x1 << 7)
18011319b2f6SOder Chiou #define RT5645_SEQ1_PT_RUN			(0x1 << 6)
18021319b2f6SOder Chiou #define RT5645_SEQ1_PT_RUN_BIT			6
18031319b2f6SOder Chiou #define RT5645_SEQ2_PT_RUN			(0x1 << 5)
18041319b2f6SOder Chiou #define RT5645_SEQ2_PT_RUN_BIT			5
18051319b2f6SOder Chiou 
18061319b2f6SOder Chiou /* Programmable Register Array Control 4 (0xcb) */
18071319b2f6SOder Chiou #define RT5645_SEQ1_START_MASK			(0xf << 8)
18081319b2f6SOder Chiou #define RT5645_SEQ1_START_SFT			8
18091319b2f6SOder Chiou #define RT5645_SEQ1_END_MASK			(0xf)
18101319b2f6SOder Chiou #define RT5645_SEQ1_END_SFT			0
18111319b2f6SOder Chiou 
18121319b2f6SOder Chiou /* Programmable Register Array Control 5 (0xcc) */
18131319b2f6SOder Chiou #define RT5645_SEQ2_START_MASK			(0xf << 8)
18141319b2f6SOder Chiou #define RT5645_SEQ2_START_SFT			8
18151319b2f6SOder Chiou #define RT5645_SEQ2_END_MASK			(0xf)
18161319b2f6SOder Chiou #define RT5645_SEQ2_END_SFT			0
18171319b2f6SOder Chiou 
18181319b2f6SOder Chiou /* Scramble Function (0xcd) */
18191319b2f6SOder Chiou #define RT5645_SCB_KEY_MASK			(0xff)
18201319b2f6SOder Chiou #define RT5645_SCB_KEY_SFT			0
18211319b2f6SOder Chiou 
18221319b2f6SOder Chiou /* Scramble Control (0xce) */
18231319b2f6SOder Chiou #define RT5645_SCB_SWAP_MASK			(0x1 << 15)
18241319b2f6SOder Chiou #define RT5645_SCB_SWAP_SFT			15
18251319b2f6SOder Chiou #define RT5645_SCB_SWAP_DIS			(0x0 << 15)
18261319b2f6SOder Chiou #define RT5645_SCB_SWAP_EN			(0x1 << 15)
18271319b2f6SOder Chiou #define RT5645_SCB_MASK				(0x1 << 14)
18281319b2f6SOder Chiou #define RT5645_SCB_SFT				14
18291319b2f6SOder Chiou #define RT5645_SCB_DIS				(0x0 << 14)
18301319b2f6SOder Chiou #define RT5645_SCB_EN				(0x1 << 14)
18311319b2f6SOder Chiou 
18321319b2f6SOder Chiou /* Baseback Control (0xcf) */
18331319b2f6SOder Chiou #define RT5645_BB_MASK				(0x1 << 15)
18341319b2f6SOder Chiou #define RT5645_BB_SFT				15
18351319b2f6SOder Chiou #define RT5645_BB_DIS				(0x0 << 15)
18361319b2f6SOder Chiou #define RT5645_BB_EN				(0x1 << 15)
18371319b2f6SOder Chiou #define RT5645_BB_CT_MASK			(0x7 << 12)
18381319b2f6SOder Chiou #define RT5645_BB_CT_SFT			12
18391319b2f6SOder Chiou #define RT5645_BB_CT_A				(0x0 << 12)
18401319b2f6SOder Chiou #define RT5645_BB_CT_B				(0x1 << 12)
18411319b2f6SOder Chiou #define RT5645_BB_CT_C				(0x2 << 12)
18421319b2f6SOder Chiou #define RT5645_BB_CT_D				(0x3 << 12)
18431319b2f6SOder Chiou #define RT5645_M_BB_L_MASK			(0x1 << 9)
18441319b2f6SOder Chiou #define RT5645_M_BB_L_SFT			9
18451319b2f6SOder Chiou #define RT5645_M_BB_R_MASK			(0x1 << 8)
18461319b2f6SOder Chiou #define RT5645_M_BB_R_SFT			8
18471319b2f6SOder Chiou #define RT5645_M_BB_HPF_L_MASK			(0x1 << 7)
18481319b2f6SOder Chiou #define RT5645_M_BB_HPF_L_SFT			7
18491319b2f6SOder Chiou #define RT5645_M_BB_HPF_R_MASK			(0x1 << 6)
18501319b2f6SOder Chiou #define RT5645_M_BB_HPF_R_SFT			6
18511319b2f6SOder Chiou #define RT5645_G_BB_BST_MASK			(0x3f)
18521319b2f6SOder Chiou #define RT5645_G_BB_BST_SFT			0
1853850577dbSBard Liao #define RT5645_G_BB_BST_25DB			0x14
18541319b2f6SOder Chiou 
18551319b2f6SOder Chiou /* MP3 Plus Control 1 (0xd0) */
18561319b2f6SOder Chiou #define RT5645_M_MP3_L_MASK			(0x1 << 15)
18571319b2f6SOder Chiou #define RT5645_M_MP3_L_SFT			15
18581319b2f6SOder Chiou #define RT5645_M_MP3_R_MASK			(0x1 << 14)
18591319b2f6SOder Chiou #define RT5645_M_MP3_R_SFT			14
18601319b2f6SOder Chiou #define RT5645_M_MP3_MASK			(0x1 << 13)
18611319b2f6SOder Chiou #define RT5645_M_MP3_SFT			13
18621319b2f6SOder Chiou #define RT5645_M_MP3_DIS			(0x0 << 13)
18631319b2f6SOder Chiou #define RT5645_M_MP3_EN				(0x1 << 13)
18641319b2f6SOder Chiou #define RT5645_EG_MP3_MASK			(0x1f << 8)
18651319b2f6SOder Chiou #define RT5645_EG_MP3_SFT			8
18661319b2f6SOder Chiou #define RT5645_MP3_HLP_MASK			(0x1 << 7)
18671319b2f6SOder Chiou #define RT5645_MP3_HLP_SFT			7
18681319b2f6SOder Chiou #define RT5645_MP3_HLP_DIS			(0x0 << 7)
18691319b2f6SOder Chiou #define RT5645_MP3_HLP_EN			(0x1 << 7)
18701319b2f6SOder Chiou #define RT5645_M_MP3_ORG_L_MASK			(0x1 << 6)
18711319b2f6SOder Chiou #define RT5645_M_MP3_ORG_L_SFT			6
18721319b2f6SOder Chiou #define RT5645_M_MP3_ORG_R_MASK			(0x1 << 5)
18731319b2f6SOder Chiou #define RT5645_M_MP3_ORG_R_SFT			5
18741319b2f6SOder Chiou 
18751319b2f6SOder Chiou /* MP3 Plus Control 2 (0xd1) */
18761319b2f6SOder Chiou #define RT5645_MP3_WT_MASK			(0x1 << 13)
18771319b2f6SOder Chiou #define RT5645_MP3_WT_SFT			13
18781319b2f6SOder Chiou #define RT5645_MP3_WT_1_4			(0x0 << 13)
18791319b2f6SOder Chiou #define RT5645_MP3_WT_1_2			(0x1 << 13)
18801319b2f6SOder Chiou #define RT5645_OG_MP3_MASK			(0x1f << 8)
18811319b2f6SOder Chiou #define RT5645_OG_MP3_SFT			8
18821319b2f6SOder Chiou #define RT5645_HG_MP3_MASK			(0x3f)
18831319b2f6SOder Chiou #define RT5645_HG_MP3_SFT			0
18841319b2f6SOder Chiou 
18851319b2f6SOder Chiou /* 3D HP Control 1 (0xd2) */
18861319b2f6SOder Chiou #define RT5645_3D_CF_MASK			(0x1 << 15)
18871319b2f6SOder Chiou #define RT5645_3D_CF_SFT			15
18881319b2f6SOder Chiou #define RT5645_3D_CF_DIS			(0x0 << 15)
18891319b2f6SOder Chiou #define RT5645_3D_CF_EN				(0x1 << 15)
18901319b2f6SOder Chiou #define RT5645_3D_HP_MASK			(0x1 << 14)
18911319b2f6SOder Chiou #define RT5645_3D_HP_SFT			14
18921319b2f6SOder Chiou #define RT5645_3D_HP_DIS			(0x0 << 14)
18931319b2f6SOder Chiou #define RT5645_3D_HP_EN				(0x1 << 14)
18941319b2f6SOder Chiou #define RT5645_3D_BT_MASK			(0x1 << 13)
18951319b2f6SOder Chiou #define RT5645_3D_BT_SFT			13
18961319b2f6SOder Chiou #define RT5645_3D_BT_DIS			(0x0 << 13)
18971319b2f6SOder Chiou #define RT5645_3D_BT_EN				(0x1 << 13)
18981319b2f6SOder Chiou #define RT5645_3D_1F_MIX_MASK			(0x3 << 11)
18991319b2f6SOder Chiou #define RT5645_3D_1F_MIX_SFT			11
19001319b2f6SOder Chiou #define RT5645_3D_HP_M_MASK			(0x1 << 10)
19011319b2f6SOder Chiou #define RT5645_3D_HP_M_SFT			10
19021319b2f6SOder Chiou #define RT5645_3D_HP_M_SUR			(0x0 << 10)
19031319b2f6SOder Chiou #define RT5645_3D_HP_M_FRO			(0x1 << 10)
19041319b2f6SOder Chiou #define RT5645_M_3D_HRTF_MASK			(0x1 << 9)
19051319b2f6SOder Chiou #define RT5645_M_3D_HRTF_SFT			9
19061319b2f6SOder Chiou #define RT5645_M_3D_D2H_MASK			(0x1 << 8)
19071319b2f6SOder Chiou #define RT5645_M_3D_D2H_SFT			8
19081319b2f6SOder Chiou #define RT5645_M_3D_D2R_MASK			(0x1 << 7)
19091319b2f6SOder Chiou #define RT5645_M_3D_D2R_SFT			7
19101319b2f6SOder Chiou #define RT5645_M_3D_REVB_MASK			(0x1 << 6)
19111319b2f6SOder Chiou #define RT5645_M_3D_REVB_SFT			6
19121319b2f6SOder Chiou 
19131319b2f6SOder Chiou /* Adjustable high pass filter control 1 (0xd3) */
19141319b2f6SOder Chiou #define RT5645_2ND_HPF_MASK			(0x1 << 15)
19151319b2f6SOder Chiou #define RT5645_2ND_HPF_SFT			15
19161319b2f6SOder Chiou #define RT5645_2ND_HPF_DIS			(0x0 << 15)
19171319b2f6SOder Chiou #define RT5645_2ND_HPF_EN			(0x1 << 15)
19181319b2f6SOder Chiou #define RT5645_HPF_CF_L_MASK			(0x7 << 12)
19191319b2f6SOder Chiou #define RT5645_HPF_CF_L_SFT			12
19201319b2f6SOder Chiou #define RT5645_1ST_HPF_MASK			(0x1 << 11)
19211319b2f6SOder Chiou #define RT5645_1ST_HPF_SFT			11
19221319b2f6SOder Chiou #define RT5645_1ST_HPF_DIS			(0x0 << 11)
19231319b2f6SOder Chiou #define RT5645_1ST_HPF_EN			(0x1 << 11)
19241319b2f6SOder Chiou #define RT5645_HPF_CF_R_MASK			(0x7 << 8)
19251319b2f6SOder Chiou #define RT5645_HPF_CF_R_SFT			8
19261319b2f6SOder Chiou #define RT5645_ZD_T_MASK			(0x3 << 6)
19271319b2f6SOder Chiou #define RT5645_ZD_T_SFT				6
19281319b2f6SOder Chiou #define RT5645_ZD_F_MASK			(0x3 << 4)
19291319b2f6SOder Chiou #define RT5645_ZD_F_SFT				4
19301319b2f6SOder Chiou #define RT5645_ZD_F_IM				(0x0 << 4)
19311319b2f6SOder Chiou #define RT5645_ZD_F_ZC_IM			(0x1 << 4)
19321319b2f6SOder Chiou #define RT5645_ZD_F_ZC_IOD			(0x2 << 4)
19331319b2f6SOder Chiou #define RT5645_ZD_F_UN				(0x3 << 4)
19341319b2f6SOder Chiou 
19351319b2f6SOder Chiou /* HP calibration control and Amp detection (0xd6) */
19361319b2f6SOder Chiou #define RT5645_SI_DAC_MASK			(0x1 << 11)
19371319b2f6SOder Chiou #define RT5645_SI_DAC_SFT			11
19381319b2f6SOder Chiou #define RT5645_SI_DAC_AUTO			(0x0 << 11)
19391319b2f6SOder Chiou #define RT5645_SI_DAC_TEST			(0x1 << 11)
19401319b2f6SOder Chiou #define RT5645_DC_CAL_M_MASK			(0x1 << 10)
19411319b2f6SOder Chiou #define RT5645_DC_CAL_M_SFT			10
19421319b2f6SOder Chiou #define RT5645_DC_CAL_M_CAL			(0x0 << 10)
19431319b2f6SOder Chiou #define RT5645_DC_CAL_M_NOR			(0x1 << 10)
19441319b2f6SOder Chiou #define RT5645_DC_CAL_MASK			(0x1 << 9)
19451319b2f6SOder Chiou #define RT5645_DC_CAL_SFT			9
19461319b2f6SOder Chiou #define RT5645_DC_CAL_DIS			(0x0 << 9)
19471319b2f6SOder Chiou #define RT5645_DC_CAL_EN			(0x1 << 9)
19481319b2f6SOder Chiou #define RT5645_HPD_RCV_MASK			(0x7 << 6)
19491319b2f6SOder Chiou #define RT5645_HPD_RCV_SFT			6
19501319b2f6SOder Chiou #define RT5645_HPD_PS_MASK			(0x1 << 5)
19511319b2f6SOder Chiou #define RT5645_HPD_PS_SFT			5
19521319b2f6SOder Chiou #define RT5645_HPD_PS_DIS			(0x0 << 5)
19531319b2f6SOder Chiou #define RT5645_HPD_PS_EN			(0x1 << 5)
19541319b2f6SOder Chiou #define RT5645_CAL_M_MASK			(0x1 << 4)
19551319b2f6SOder Chiou #define RT5645_CAL_M_SFT			4
19561319b2f6SOder Chiou #define RT5645_CAL_M_DEP			(0x0 << 4)
19571319b2f6SOder Chiou #define RT5645_CAL_M_CAL			(0x1 << 4)
19581319b2f6SOder Chiou #define RT5645_CAL_MASK				(0x1 << 3)
19591319b2f6SOder Chiou #define RT5645_CAL_SFT				3
19601319b2f6SOder Chiou #define RT5645_CAL_DIS				(0x0 << 3)
19611319b2f6SOder Chiou #define RT5645_CAL_EN				(0x1 << 3)
19621319b2f6SOder Chiou #define RT5645_CAL_TEST_MASK			(0x1 << 2)
19631319b2f6SOder Chiou #define RT5645_CAL_TEST_SFT			2
19641319b2f6SOder Chiou #define RT5645_CAL_TEST_DIS			(0x0 << 2)
19651319b2f6SOder Chiou #define RT5645_CAL_TEST_EN			(0x1 << 2)
19661319b2f6SOder Chiou #define RT5645_CAL_P_MASK			(0x3)
19671319b2f6SOder Chiou #define RT5645_CAL_P_SFT			0
19681319b2f6SOder Chiou #define RT5645_CAL_P_NONE			(0x0)
19691319b2f6SOder Chiou #define RT5645_CAL_P_CAL			(0x1)
19701319b2f6SOder Chiou #define RT5645_CAL_P_DAC_CAL			(0x2)
19711319b2f6SOder Chiou 
19721319b2f6SOder Chiou /* Soft volume and zero cross control 1 (0xd9) */
19731319b2f6SOder Chiou #define RT5645_SV_MASK				(0x1 << 15)
19741319b2f6SOder Chiou #define RT5645_SV_SFT				15
19751319b2f6SOder Chiou #define RT5645_SV_DIS				(0x0 << 15)
19761319b2f6SOder Chiou #define RT5645_SV_EN				(0x1 << 15)
19771319b2f6SOder Chiou #define RT5645_SPO_SV_MASK			(0x1 << 14)
19781319b2f6SOder Chiou #define RT5645_SPO_SV_SFT			14
19791319b2f6SOder Chiou #define RT5645_SPO_SV_DIS			(0x0 << 14)
19801319b2f6SOder Chiou #define RT5645_SPO_SV_EN			(0x1 << 14)
19811319b2f6SOder Chiou #define RT5645_OUT_SV_MASK			(0x1 << 13)
19821319b2f6SOder Chiou #define RT5645_OUT_SV_SFT			13
19831319b2f6SOder Chiou #define RT5645_OUT_SV_DIS			(0x0 << 13)
19841319b2f6SOder Chiou #define RT5645_OUT_SV_EN			(0x1 << 13)
19851319b2f6SOder Chiou #define RT5645_HP_SV_MASK			(0x1 << 12)
19861319b2f6SOder Chiou #define RT5645_HP_SV_SFT			12
19871319b2f6SOder Chiou #define RT5645_HP_SV_DIS			(0x0 << 12)
19881319b2f6SOder Chiou #define RT5645_HP_SV_EN				(0x1 << 12)
19891319b2f6SOder Chiou #define RT5645_ZCD_DIG_MASK			(0x1 << 11)
19901319b2f6SOder Chiou #define RT5645_ZCD_DIG_SFT			11
19911319b2f6SOder Chiou #define RT5645_ZCD_DIG_DIS			(0x0 << 11)
19921319b2f6SOder Chiou #define RT5645_ZCD_DIG_EN			(0x1 << 11)
19931319b2f6SOder Chiou #define RT5645_ZCD_MASK				(0x1 << 10)
19941319b2f6SOder Chiou #define RT5645_ZCD_SFT				10
19951319b2f6SOder Chiou #define RT5645_ZCD_PD				(0x0 << 10)
19961319b2f6SOder Chiou #define RT5645_ZCD_PU				(0x1 << 10)
19971319b2f6SOder Chiou #define RT5645_M_ZCD_MASK			(0x3f << 4)
19981319b2f6SOder Chiou #define RT5645_M_ZCD_SFT			4
19991319b2f6SOder Chiou #define RT5645_M_ZCD_RM_L			(0x1 << 9)
20001319b2f6SOder Chiou #define RT5645_M_ZCD_RM_R			(0x1 << 8)
20011319b2f6SOder Chiou #define RT5645_M_ZCD_SM_L			(0x1 << 7)
20021319b2f6SOder Chiou #define RT5645_M_ZCD_SM_R			(0x1 << 6)
20031319b2f6SOder Chiou #define RT5645_M_ZCD_OM_L			(0x1 << 5)
20041319b2f6SOder Chiou #define RT5645_M_ZCD_OM_R			(0x1 << 4)
20051319b2f6SOder Chiou #define RT5645_SV_DLY_MASK			(0xf)
20061319b2f6SOder Chiou #define RT5645_SV_DLY_SFT			0
20071319b2f6SOder Chiou 
20081319b2f6SOder Chiou /* Soft volume and zero cross control 2 (0xda) */
20091319b2f6SOder Chiou #define RT5645_ZCD_HP_MASK			(0x1 << 15)
20101319b2f6SOder Chiou #define RT5645_ZCD_HP_SFT			15
20111319b2f6SOder Chiou #define RT5645_ZCD_HP_DIS			(0x0 << 15)
20121319b2f6SOder Chiou #define RT5645_ZCD_HP_EN			(0x1 << 15)
20131319b2f6SOder Chiou 
20141319b2f6SOder Chiou 
20151319b2f6SOder Chiou /* Codec Private Register definition */
2016467b1479SBard Liao /* DAC ADC Digital Volume (0x00) */
2017467b1479SBard Liao #define RT5645_DA1_ZDET_SFT			6
2018467b1479SBard Liao 
20191319b2f6SOder Chiou /* 3D Speaker Control (0x63) */
20201319b2f6SOder Chiou #define RT5645_3D_SPK_MASK			(0x1 << 15)
20211319b2f6SOder Chiou #define RT5645_3D_SPK_SFT			15
20221319b2f6SOder Chiou #define RT5645_3D_SPK_DIS			(0x0 << 15)
20231319b2f6SOder Chiou #define RT5645_3D_SPK_EN			(0x1 << 15)
20241319b2f6SOder Chiou #define RT5645_3D_SPK_M_MASK			(0x3 << 13)
20251319b2f6SOder Chiou #define RT5645_3D_SPK_M_SFT			13
20261319b2f6SOder Chiou #define RT5645_3D_SPK_CG_MASK			(0x1f << 8)
20271319b2f6SOder Chiou #define RT5645_3D_SPK_CG_SFT			8
20281319b2f6SOder Chiou #define RT5645_3D_SPK_SG_MASK			(0x1f)
20291319b2f6SOder Chiou #define RT5645_3D_SPK_SG_SFT			0
20301319b2f6SOder Chiou 
20311319b2f6SOder Chiou /* Wind Noise Detection Control 1 (0x6c) */
20321319b2f6SOder Chiou #define RT5645_WND_MASK				(0x1 << 15)
20331319b2f6SOder Chiou #define RT5645_WND_SFT				15
20341319b2f6SOder Chiou #define RT5645_WND_DIS				(0x0 << 15)
20351319b2f6SOder Chiou #define RT5645_WND_EN				(0x1 << 15)
20361319b2f6SOder Chiou 
20371319b2f6SOder Chiou /* Wind Noise Detection Control 2 (0x6d) */
20381319b2f6SOder Chiou #define RT5645_WND_FC_NW_MASK			(0x3f << 10)
20391319b2f6SOder Chiou #define RT5645_WND_FC_NW_SFT			10
20401319b2f6SOder Chiou #define RT5645_WND_FC_WK_MASK			(0x3f << 4)
20411319b2f6SOder Chiou #define RT5645_WND_FC_WK_SFT			4
20421319b2f6SOder Chiou 
20431319b2f6SOder Chiou /* Wind Noise Detection Control 3 (0x6e) */
20441319b2f6SOder Chiou #define RT5645_HPF_FC_MASK			(0x3f << 6)
20451319b2f6SOder Chiou #define RT5645_HPF_FC_SFT			6
20461319b2f6SOder Chiou #define RT5645_WND_FC_ST_MASK			(0x3f)
20471319b2f6SOder Chiou #define RT5645_WND_FC_ST_SFT			0
20481319b2f6SOder Chiou 
20491319b2f6SOder Chiou /* Wind Noise Detection Control 4 (0x6f) */
20501319b2f6SOder Chiou #define RT5645_WND_TH_LO_MASK			(0x3ff)
20511319b2f6SOder Chiou #define RT5645_WND_TH_LO_SFT			0
20521319b2f6SOder Chiou 
20531319b2f6SOder Chiou /* Wind Noise Detection Control 5 (0x70) */
20541319b2f6SOder Chiou #define RT5645_WND_TH_HI_MASK			(0x3ff)
20551319b2f6SOder Chiou #define RT5645_WND_TH_HI_SFT			0
20561319b2f6SOder Chiou 
20571319b2f6SOder Chiou /* Wind Noise Detection Control 8 (0x73) */
20581319b2f6SOder Chiou #define RT5645_WND_WIND_MASK			(0x1 << 13) /* Read-Only */
20591319b2f6SOder Chiou #define RT5645_WND_WIND_SFT			13
20601319b2f6SOder Chiou #define RT5645_WND_STRONG_MASK			(0x1 << 12) /* Read-Only */
20611319b2f6SOder Chiou #define RT5645_WND_STRONG_SFT			12
20621319b2f6SOder Chiou enum {
20631319b2f6SOder Chiou 	RT5645_NO_WIND,
20641319b2f6SOder Chiou 	RT5645_BREEZE,
20651319b2f6SOder Chiou 	RT5645_STORM,
20661319b2f6SOder Chiou };
20671319b2f6SOder Chiou 
20681319b2f6SOder Chiou /* Dipole Speaker Interface (0x75) */
20691319b2f6SOder Chiou #define RT5645_DP_ATT_MASK			(0x3 << 14)
20701319b2f6SOder Chiou #define RT5645_DP_ATT_SFT			14
20711319b2f6SOder Chiou #define RT5645_DP_SPK_MASK			(0x1 << 10)
20721319b2f6SOder Chiou #define RT5645_DP_SPK_SFT			10
20731319b2f6SOder Chiou #define RT5645_DP_SPK_DIS			(0x0 << 10)
20741319b2f6SOder Chiou #define RT5645_DP_SPK_EN			(0x1 << 10)
20751319b2f6SOder Chiou 
20761319b2f6SOder Chiou /* EQ Pre Volume Control (0xb3) */
20771319b2f6SOder Chiou #define RT5645_EQ_PRE_VOL_MASK			(0xffff)
20781319b2f6SOder Chiou #define RT5645_EQ_PRE_VOL_SFT			0
20791319b2f6SOder Chiou 
20801319b2f6SOder Chiou /* EQ Post Volume Control (0xb4) */
20811319b2f6SOder Chiou #define RT5645_EQ_PST_VOL_MASK			(0xffff)
20821319b2f6SOder Chiou #define RT5645_EQ_PST_VOL_SFT			0
20831319b2f6SOder Chiou 
20841319b2f6SOder Chiou /* Jack Detect Control 3 (0xf8) */
20851319b2f6SOder Chiou #define RT5645_CMP_MIC_IN_DET_MASK		(0x7 << 12)
20861319b2f6SOder Chiou #define RT5645_JD_CBJ_EN			(0x1 << 7)
20871319b2f6SOder Chiou #define RT5645_JD_CBJ_POL			(0x1 << 6)
20881319b2f6SOder Chiou #define RT5645_JD_TRI_CBJ_SEL_MASK		(0x7 << 3)
20891319b2f6SOder Chiou #define RT5645_JD_TRI_CBJ_SEL_SFT		(3)
20901319b2f6SOder Chiou #define RT5645_JD_TRI_HPO_SEL_MASK		(0x7)
20911319b2f6SOder Chiou #define RT5645_JD_TRI_HPO_SEL_SFT		(0)
20921319b2f6SOder Chiou #define RT5645_JD_F_GPIO_JD1			(0x0)
20931319b2f6SOder Chiou #define RT5645_JD_F_JD1_1			(0x1)
20941319b2f6SOder Chiou #define RT5645_JD_F_JD1_2			(0x2)
20951319b2f6SOder Chiou #define RT5645_JD_F_JD2				(0x3)
20961319b2f6SOder Chiou #define RT5645_JD_F_JD3				(0x4)
20971319b2f6SOder Chiou #define RT5645_JD_F_GPIO_JD2			(0x5)
20981319b2f6SOder Chiou #define RT5645_JD_F_MX0B_12			(0x6)
20991319b2f6SOder Chiou 
21001319b2f6SOder Chiou /* Digital Misc Control (0xfa) */
21011319b2f6SOder Chiou #define RT5645_RST_DSP				(0x1 << 13)
21021319b2f6SOder Chiou #define RT5645_IF1_ADC1_IN1_SEL			(0x1 << 12)
21031319b2f6SOder Chiou #define RT5645_IF1_ADC1_IN1_SFT			12
21041319b2f6SOder Chiou #define RT5645_IF1_ADC1_IN2_SEL			(0x1 << 11)
21051319b2f6SOder Chiou #define RT5645_IF1_ADC1_IN2_SFT			11
21061319b2f6SOder Chiou #define RT5645_IF1_ADC2_IN1_SEL			(0x1 << 10)
21071319b2f6SOder Chiou #define RT5645_IF1_ADC2_IN1_SFT			10
21081319b2f6SOder Chiou #define RT5645_DIG_GATE_CTRL			0x1
21091319b2f6SOder Chiou 
21101319b2f6SOder Chiou /* General Control2 (0xfb) */
21111319b2f6SOder Chiou #define RT5645_RXDC_SRC_MASK			(0x1 << 7)
21121319b2f6SOder Chiou #define RT5645_RXDC_SRC_STO			(0x0 << 7)
21131319b2f6SOder Chiou #define RT5645_RXDC_SRC_MONO			(0x1 << 7)
21141319b2f6SOder Chiou #define RT5645_RXDC_SRC_SFT			(7)
2115e61f3f31SBard Liao #define RT5645_MICBIAS1_POW_CTRL_SEL_MASK	(0x1 << 5)
2116e61f3f31SBard Liao #define RT5645_MICBIAS1_POW_CTRL_SEL_A		(0x0 << 5)
2117e61f3f31SBard Liao #define RT5645_MICBIAS1_POW_CTRL_SEL_M		(0x1 << 5)
2118e61f3f31SBard Liao #define RT5645_MICBIAS2_POW_CTRL_SEL_MASK	(0x1 << 4)
2119e61f3f31SBard Liao #define RT5645_MICBIAS2_POW_CTRL_SEL_A		(0x0 << 4)
2120e61f3f31SBard Liao #define RT5645_MICBIAS2_POW_CTRL_SEL_M		(0x1 << 4)
21211319b2f6SOder Chiou #define RT5645_RXDP2_SEL_MASK			(0x1 << 3)
21221319b2f6SOder Chiou #define RT5645_RXDP2_SEL_IF2			(0x0 << 3)
21231319b2f6SOder Chiou #define RT5645_RXDP2_SEL_ADC			(0x1 << 3)
21241319b2f6SOder Chiou #define RT5645_RXDP2_SEL_SFT			(3)
21251319b2f6SOder Chiou 
2126bb656addSBard Liao /* General Control3 (0xfc) */
21272d4e2d02SBard Liao #define RT5645_JD_PSV_MODE			(0x1 << 12)
2128bb656addSBard Liao #define RT5645_IRQ_CLK_GATE_CTRL		(0x1 << 11)
2129ca8457bbSBard Liao #define RT5645_DET_CLK_MASK			(0x3 << 9)
2130ca8457bbSBard Liao #define RT5645_DET_CLK_DIS			(0x0 << 9)
2131ca8457bbSBard Liao #define RT5645_DET_CLK_MODE1			(0x1 << 9)
2132ca8457bbSBard Liao #define RT5645_DET_CLK_MODE2			(0x2 << 9)
2133bb656addSBard Liao #define RT5645_MICINDET_MANU			(0x1 << 7)
2134f2988afeSOder Chiou #define RT5645_RING2_SLEEVE_GND			(0x1 << 5)
21351319b2f6SOder Chiou 
21361319b2f6SOder Chiou /* Vendor ID (0xfd) */
21371319b2f6SOder Chiou #define RT5645_VER_C				0x2
21381319b2f6SOder Chiou #define RT5645_VER_D				0x3
21391319b2f6SOder Chiou 
21401319b2f6SOder Chiou 
21411319b2f6SOder Chiou /* Volume Rescale */
21421319b2f6SOder Chiou #define RT5645_VOL_RSCL_MAX 0x27
21431319b2f6SOder Chiou #define RT5645_VOL_RSCL_RANGE 0x1F
21441319b2f6SOder Chiou /* Debug String Length */
21451319b2f6SOder Chiou #define RT5645_REG_DISP_LEN 23
21461319b2f6SOder Chiou 
21471319b2f6SOder Chiou 
21481319b2f6SOder Chiou /* System Clock Source */
21491319b2f6SOder Chiou enum {
21501319b2f6SOder Chiou 	RT5645_SCLK_S_MCLK,
21511319b2f6SOder Chiou 	RT5645_SCLK_S_PLL1,
21521319b2f6SOder Chiou 	RT5645_SCLK_S_RCCLK,
21531319b2f6SOder Chiou };
21541319b2f6SOder Chiou 
21551319b2f6SOder Chiou /* PLL1 Source */
21561319b2f6SOder Chiou enum {
21571319b2f6SOder Chiou 	RT5645_PLL1_S_MCLK,
21581319b2f6SOder Chiou 	RT5645_PLL1_S_BCLK1,
21591319b2f6SOder Chiou 	RT5645_PLL1_S_BCLK2,
21601319b2f6SOder Chiou };
21611319b2f6SOder Chiou 
21621319b2f6SOder Chiou enum {
21631319b2f6SOder Chiou 	RT5645_AIF1,
21641319b2f6SOder Chiou 	RT5645_AIF2,
21651319b2f6SOder Chiou 	RT5645_AIFS,
21661319b2f6SOder Chiou };
21671319b2f6SOder Chiou 
21681319b2f6SOder Chiou enum {
2169ac4fc3eeSBard Liao 	RT5645_DMIC1_DISABLE,
21701319b2f6SOder Chiou 	RT5645_DMIC_DATA_IN2P,
21711319b2f6SOder Chiou 	RT5645_DMIC_DATA_GPIO6,
21721319b2f6SOder Chiou 	RT5645_DMIC_DATA_GPIO10,
21731319b2f6SOder Chiou 	RT5645_DMIC_DATA_GPIO12,
21741319b2f6SOder Chiou };
21751319b2f6SOder Chiou 
21761319b2f6SOder Chiou enum {
2177ac4fc3eeSBard Liao 	RT5645_DMIC2_DISABLE,
21781319b2f6SOder Chiou 	RT5645_DMIC_DATA_IN2N,
21791319b2f6SOder Chiou 	RT5645_DMIC_DATA_GPIO5,
21801319b2f6SOder Chiou 	RT5645_DMIC_DATA_GPIO11,
21811319b2f6SOder Chiou };
21821319b2f6SOder Chiou 
21835c4ca99dSBard Liao enum {
21845c4ca99dSBard Liao 	CODEC_TYPE_RT5645,
21855c4ca99dSBard Liao 	CODEC_TYPE_RT5650,
21865c4ca99dSBard Liao };
21875c4ca99dSBard Liao 
218879080a8bSFang, Yang A /* filter mask */
218979080a8bSFang, Yang A enum {
219079080a8bSFang, Yang A 	RT5645_DA_STEREO_FILTER = 0x1,
219179080a8bSFang, Yang A 	RT5645_DA_MONO_L_FILTER = (0x1 << 1),
219279080a8bSFang, Yang A 	RT5645_DA_MONO_R_FILTER = (0x1 << 2),
219379080a8bSFang, Yang A 	RT5645_AD_STEREO_FILTER = (0x1 << 3),
219479080a8bSFang, Yang A 	RT5645_AD_MONO_L_FILTER = (0x1 << 4),
219579080a8bSFang, Yang A 	RT5645_AD_MONO_R_FILTER = (0x1 << 5),
219679080a8bSFang, Yang A };
219779080a8bSFang, Yang A 
219879223bf1SKuninori Morimoto int rt5645_sel_asrc_clk_src(struct snd_soc_component *component,
219979080a8bSFang, Yang A 		unsigned int filter_mask, unsigned int clk_src);
220079080a8bSFang, Yang A 
220179223bf1SKuninori Morimoto int rt5645_set_jack_detect(struct snd_soc_component *component,
22026e747d53SBard Liao 	struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack,
22036e747d53SBard Liao 	struct snd_soc_jack *btn_jack);
22041319b2f6SOder Chiou #endif /* __RT5645_H__ */
2205