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